akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static class Edge {
		int to, cost;

		public Edge(int to, int cost) {
			this.to = to;
			this.cost = cost;
		}
	}

	List<Edge>[] g;
	int[] color;

	void dfs(int u, int parent, long sum) {
		color[u] = (int) (sum % 2L);
		for (Edge e : g[u]) {
			if (e.to == parent)
				continue;
			dfs(e.to, u, sum + e.cost);
		}
	}

	void solve(Scanner in, PrintWriter out) {
		int n = in.nextInt();
		g = new ArrayList[n + 1];
		color = new int[n + 1];
		for (int i = 0; i <= n; ++i) {
			g[i] = new ArrayList<>();
		}
		for (int i = 0; i < n - 1; ++i) {
			int u = in.nextInt(), v = in.nextInt(), c = in.nextInt();
			g[u].add(new Edge(v, c));
			g[v].add(new Edge(u, c));
		}
		dfs(1, 0, 0);
		for (int i = 1; i <= n; ++i) {
			out.println(color[i]);
		}
	}

	public static void main(String[] args) {
		try (Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out)) {
			new Main().solve(in, out);
		}
	}
}


Measured memory_bytes: 112544
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  char a,b;
  cin>>a>>b;
  if(a=='H'){
    if(b=='H'){
      cout<<'H';
    }
    else if(b=='D'){
      cout<<'D';
    }
  }
  else if(a=='D'){
    if(b=='H'){
      cout<<'D';
    }
    else if(b=='D'){
      cout<<'H';
    }
  }
}


Measured memory_bytes: 256
def main():
  N = int(input())

  N =  N % 10

  if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
    print('hon') 
  elif N == 3:
    print('bon')
  else:
    print('pon')

if __name__ == '__main__':
  main()

Measured memory_bytes: 9192
K = int(input())
A,B = list(map(int,input().split()))
a = A // K
b = B // K
flag = 0
for i in range(a,b+1):
    if A <= K * i and K * i <= B:
        flag += 1
if flag != 0:
    print('OK')
else:
    print('NG')

Measured memory_bytes: 9208
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    int neg = 0, zero = 0;
    for(int i=0;i<n;++i){
        cin >> a[i];
        if(a[i] < 0) {
            ++neg;
        } else if(a[i] == 0) {
            ++zero;
        }
    }

    ll ans = 0LL;
    ll abs_min = 1LL << 30;
    for(int i=0;i<n;++i){
        ans += abs(a[i]);
        abs_min = min(abs_min, abs(a[i]));
    }
    if(neg % 2 == 1 && zero == 0) {
        ans -= 2*abs_min;
    }

    cout << ans << endl;


}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 11451419
int main(){
    ll n;
    cin>>n;
    vector<ll>a(n),b,c;
    ll case1=0,case2=0,cost1=0,cost2=0,sum=0;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++){
        case1+=a[i];
        if(i%2==0&&case1<=0){
            cost1+=abs(case1)+1;
            case1=1;
        }
        else if(i%2==1&&case1>=0){
            cost1+=abs(case1)+1;
            case1=-1;
        }
        b.push_back(case1);
    }

    for(int i=0;i<n;i++){
        case2+=a[i];
        if(i%2==1&&case2<=0){
            cost2+=abs(case2)+1;
            case2=1;
        }
        else if(i%2==0&&case2>=0){
            cost2+=abs(case2)+1;
            case2=-1;
        }
        c.push_back(case2);
    }
    cout<<min(cost1,cost2)<<endl;
}

Measured memory_bytes: 3316
def reverse(s):
    return s[::-1]
a=str(input())
b=reverse(a)
n=len(a)
c=a[:(n-1)//2]
d=reverse(c)
e=a[(n+3)//2-1:n]
f=reverse(e)

if a==b and c==d and e==f:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
#include <iostream>
using namespace std;


int main()
{
	int a, b,c,x=0;
	cin >> a >> b>>c;

	if (a > b ) { 
		x = a;
		a = b;
		b = x;
	}
	if (a > c) {
		x = a;
		a = c;
		c = x;
	}
	if (b > c) {
		x = b;
		b = c;
		c = x;
	}

	cout << a << " " << b << " " << c << "\n";

    return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;

constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;

long mpow(long a, long b) {
  long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}

long com(long n, long r) {
  if (n < r || n < 0 || r < 0) return 0;
  long x = 1, y = 1;
  for (int i = 1; i <= r; i++) {
    x = x * (n - i + 1) % MOD;
    y = y * i % MOD;
  }
  return x * mpow(y, MOD - 2) % MOD;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  long ans = mpow(2, n);
  ans -= 1;
  ans -= com(n, a);
  ans -= com(n, b);
  while (ans < 0) ans += MOD;
  cout << ans << "\n";
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    if(n==1||n==2||n==3||n==5||n==6||n==9||n==10||n==13||n==17){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

ll f(ll n, ll c) {
  ll res = 1;
  while (c--) res *= n;
  return res;
}

int main() {
  // 入力
  int N, K;
  cin >> N >> K;

  ll amari_zero = 0;
  ll amari_half = 0;
  for (int i = 1; i <= N; i++) {
    if (i % K == 0) amari_zero++;
    if (i % K == K / 2) amari_half++;
  }

  // 解答
  if (K & 1) cout << f(amari_zero, 3) << endl;
  else cout << f(amari_zero, 3) + f(amari_half, 3) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstring>
#include <algorithm>
#include <vector> 
#include <map>
#include <string>
using namespace std;
pair<long long, long long> a[200001];

bool comp(pair<long long, long long> x, pair<long long, long long> y) {
	return x.second < y.second;
}
int main() { 
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}
	sort(a, a + n, comp);
	long long ans = a[0].second + 1 - a[0].first;
	if (ans <= 0) {
		cout << "No" << '\n'; return 0;
	}
	for (int i = 1; i < n; i++) {
		ans += (a[i].second - a[i - 1].second);
		ans -= a[i].first;
		if (ans <= 0) {
			cout << "No" << '\n'; return 0;
		}
	}
	cout << "Yes" << '\n';




}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define forn(i, n) for(int i = 0; i < int__(n); i++) 
#define sz(a) int__(a.size())
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
const int MAX = 1e9 + 7;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=998244353;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int x,int y){return y!=0 ? gcd(y,x%y) : x;}
 
int__ main() {
	fast;
	
	string a,b; cin >> a >> b;

	vvi dp(a.size() + 1, vi(b.size() + 1, 0));

	for(int i=1;i<=a.size();i++){
		for(int j=1;j<=b.size();j++) {
			if(a[i-1] == b[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
			else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
		}
	}

	int times = dp[a.size()][b.size()];

	string ans = "";
	int x = a.size(),y = b.size();
	while(times > 0) {
		if(a[x-1] == b[y-1]) {
			ans += a[x-1];
			x--; y--;
			times--;
		}
		else {
			if(dp[x-1][y] > dp[x][y-1]) x--;
			else y--;
		}
	}

	reverse(ans.begin(), ans.end());

	cout << ans << endl;
}

Measured memory_bytes: 70784
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;



int main() {
	char a, b;

	cin >> a >> b;

	if (a == 'H')cout << b;
	else {
		if (b == 'H')cout << 'D';
		else cout << 'H';
	}

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
bool t[1000001];
int  u[1000001];
int N =1000000;
int n,m;
void make_table(){
  for(int i=0;i<=N;i++){
    t[i]=false;
    u[i]=0;
  }

  t[1]=true;

  for(int i=1;i<=N;i++){
    u[i]=u[i-1];
    if(t[i]==false)continue;
    u[i]++;
    if(i*2<=N)t[i*2]=true;
    if(i*3<=N)t[i*3]=true;
    if(i*5<=N)t[i*5]=true;
  }
}



int main(){
  make_table();
  while(cin>>n>>m){
    cout<<u[m]-u[n]+t[n]<<endl;
  }
}

Measured memory_bytes: 6044
#include <iostream>
#define N 100000
using namespace std;

int main(void){
bool isprime[N];
for(int i=0;i<N;i++)
	isprime[i]=true;
isprime[0]=isprime[1]=false;
for(int i=2;i<N;i++)
	if(isprime[i])
		for(int j=i*2;j<N;j+=i)
			isprime[j]=false;

	while(true){
		int n;
		cin >> n;
		if(cin.eof())
			break;
		int min=0,max=0;
		for(int i=n-1;i>=2;i--){
			min=i;
			if(isprime[i])
				break;
		}
		for(int i=n+1;i<N;i++){
			max=i;
			if(isprime[i])
				break;
		}
		cout << min << ' ' << max << endl;
	}
	return 0;
}

Measured memory_bytes: 1252
n = int(input())
s = [input().split() for _ in range(n)]
for i in range(n):
    s[i].append(i+1)

s = sorted(s,key=lambda x:int(x[1]),reverse=True)
s = sorted(s,key=lambda x:x[0])
for i in range(n):
    print(s[i][2])


Measured memory_bytes: 8916
n = int(input())
p = [int(input()) for i in range(n)]
index = [None]*(n+1)
for i in range(n):
    index[p[i]] = i
length = 0
now = 0
max_length = 0
for i in range(1, n+1):
    if index[i] >= now:
        now = index[i]
        length += 1
    else:
        now = index[i]
        max_length = max(max_length, length)
        length = 1
max_length = max(max_length, length)

print(n-max_length)


Measured memory_bytes: 18968
from typing import Optional, Sequence


class BinaryIndexedTree:
    """Binary Indexed Tree (Fenwick Tree): O(logN)

    References:
        http://hos.ac/slides/20140319_bit.pdf
    """

    __slots__ = ["_size", "_tree", "is_zero_origin"]

    def __init__(
        self,
        size: int,
        initial_values: Optional[Sequence[int]] = None,
        is_zero_origin: bool = True,
    ):
        self._size = size
        self._tree = [0] * (size + 1)
        self.is_zero_origin = is_zero_origin

        if initial_values:
            for i, a in enumerate(initial_values):
                self.add(i, a)

    def add(self, index: int, value: int) -> None:
        """Add value to tree[index], O(logN)."""
        if self.is_zero_origin:
            index += 1
        while index <= self._size:
            self._tree[index] += value
            index += index & -index

    def sum(self, index: int) -> int:
        """Return the sum of [1, index] in O(logN)."""
        ret = 0
        while index > 0:
            ret += self._tree[index]
            index -= index & -index
        return ret

    def range_sum(self, left: int, right: int) -> int:
        """Return the range sum of [left, right] in O(logN)."""
        if not self.is_zero_origin:
            left -= 1
        return self.sum(right) - self.sum(left)


def point_add_range_sum():
    # https://judge.yosupo.jp/problem/point_add_range_sum
    N, Q, *X = map(int, open(0).read().split())
    A, queries = X[:N], X[N:]
    tree = BinaryIndexedTree(N, A)
    res = []
    for com, x, y in zip(*[iter(queries)] * 3):
        if com:
            res.append(tree.range_sum(x, y))
        else:
            tree.add(x, y)
    print("\n".join(map(str, res)))


def jsc2019_qual_b():
    # https://atcoder.jp/contests/jsc2019-qual/tasks/jsc2019_qual_b
    N, K, *A = map(int, open(0).read().split())
    tree = BinaryIndexedTree(2000, is_zero_origin=False)
    x = 0
    for i, a in enumerate(A, 1):  # internal inversion
        tree.add(a, 1)
        x += i - tree.sum(a)
    y = -x
    for i, a in enumerate(A, 1):  # external inversion
        tree.add(a, 1)
        y += i + N - tree.sum(a)
    MOD = 10 ** 9 + 7
    print((x * K + y * K * (K - 1) // 2) % MOD)


if __name__ == "__main__":
    # point_add_range_sum()
    jsc2019_qual_b()


Measured memory_bytes: 10160
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            int X = Integer.parseInt(br.readLine());
            if(X >= 30){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
            
        }catch(Exception e){
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 32700
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define vint vector<signed>
#define pint pair<signed,signed>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define isEven(t) t%2==0
#define debg(o) cout<<#o<<":"<<o<<endl;

signed main(){
  int n;
  cin>>n;
  int a[n];
  rep(i,n)cin>>a[i];
  int res=0;
  int sum[n+1]={0};
  for(int i=1;i<=n;++i)sum[i]=sum[i-1]+a[i-1];
  sort(sum,sum+n+1);
  int tmp=sum[0],cnt=1;
  for(int i=1;i<=n;++i){
    if(tmp==sum[i]){
      res+=cnt;
      cnt++;
      //debg(res);
    }
    else tmp=sum[i],cnt=1;
  }
  //rep(i,n)cout<<sum[i]<<" ";cout<<endl;
  cout<<res;
  return 0;
}


Measured memory_bytes: 3328
#include "bits/stdc++.h"

using namespace std;
using VI = vector<int>;
using VPI = vector<pair<int, int>>;
using LL = long long;

#define FOR(a,n) for(int i=a;i<n;i++)
#define rFOR(a,n) for(int i=n-1;i>=a;i--)
#define IN(n,a) for(int i=0;i<n;i++) cin>>a[i]
#define pIN(n,t) for(int i=0;i<n;i++){int a,b; cin>>a>>b; t.emplace_back(a,b);}
#define SORT(a) sort(a.begin(), a.end())
#define ALL(a) a.begin(), a.end()

bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

int main()
{
	int x;
	cin >> x;

	while (!IsPrime(x)) x++;

	cout << x;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

string S;
signed main() {
    cin >> S;
    sort(S.begin(), S.end());
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) { cout << "Yes" << endl; }
    else { cout << "No" << endl; }
}


Measured memory_bytes: 256
k = int(input())
import math

total = 0
for i in range(k):
    for j in range(k):
        ij_gcd = math.gcd(i+1, j+1)
        if ij_gcd == 1:
            total+=k
            continue
        for l in range(k):
            total+=math.gcd(l+1, ij_gcd)

print(total)

Measured memory_bytes: 9180
#include <algorithm> //STLÍ¨ÓÃËã·¨
#include <cmath> //¶¨ÒåÊýÑ§º¯Êý
#include <cstdio> //¶¨ÒåÊäÈë/Êä³öº¯Êý
#include <iostream> //Êý¾ÝÁ÷ÊäÈë/Êä³ö
#include <cstring> //×Ö·û´®´¦Àí
#include <string> //×Ö·û´®Àà
#include <ctime> //¶¨Òå¹ØÓÚÊ±¼äµÄº¯Êý
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLÎ»¼¯ÈÝÆ÷
#include <cstype> //×Ö·û´¦Àí
#include <cerrno> //¶¨Òå´íÎóÂë
#include <complex> //¸´ÊýÀà
#include <clocale> //¶¨Òå±¾µØ»¯º¯Êý
#include <cstdlib> //¶¨ÒåÔÓÏîº¯Êý¼°ÄÚ´æ·ÖÅäº¯Êý
#include <deque> //STLË«¶Ë¶ÓÁÐÈÝÆ÷
#include <exception> //Òì³£´¦ÀíÀà
#include <fstream> //ÎÄ¼þÊäÈë/Êä³ö
#include <functional> //STL¶¨ÒåÔËËãº¯Êý(´úÌæÔËËã·û)
#include <limits> //¶¨Òå¸÷ÖÖÊý¾ÝÀàÐÍ×îÖµ³£Á¿
#include <list> //STLÏßÐÔÁÐ±íÈÝÆ÷
#include <map> //STLÓ³ÉäÈÝÆ÷
#include <iomanip> //²ÎÊý»¯ÊäÈë/Êä³ö
#include <ios> //»ù±¾ÊäÈë/Êä³öÖ§³Ö
#include <iosfwd> //ÊäÈë/Êä³öÏµÍ³Ê¹ÓÃµÄÇ°ÖÃÉùÃ÷
#include <istream> //»ù±¾ÊäÈëÁ÷
#include <ostream> //»ù±¾Êä³öÁ÷
#include <queue> //STL¶ÓÁÐÈÝÆ÷
#include <set> //STL¼¯ºÏÈÝÆ÷
#include <sstream> //»ùÓÚ×Ö·û´®µÄÁ÷
#include <stack> //STL¶ÑÕ»ÈÝÆ÷
#include <stdexcept> //±ê×¼Òì³£Àà
#include <streambuf> //µ×²ãÊäÈë/Êä³öÖ§³Ö
#include <utility> //STLÍ¨ÓÃÄ£°åÀà
#include <vector> //STL¶¯Ì¬Êý×éÈÝÆ÷
#include <cwchar.h>//¿í×Ö·û´¦Àí¼°ÊäÈë/Êä³ö
#include <cwctype.h> //¿í×Ö·û·ÖÀà*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}
int a[101];
double all=0;
int main()
{
	int n;
	read(n);
	for (int i=1;i<=n;i++) read(a[i]),all+=a[i];
	all=all/n;
	ans=1;
	for (int i=2;i<=n;i++)
		if (fabs(a[ans]-all)>fabs(a[i]-all)) ans=i;
	cout<<ans-1;
	return 0;
}








Measured memory_bytes: 2304
#include <bits/stdc++.h>

using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);

  string s,t; cin>>s>>t;
  int ans = 0;
  for (int i = 0; i < 3; i++)
    if (s[i] == t[i])
      ans++;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define reps(i, n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define repi(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
    int n,k; string s;
    cin>>n>>k>>s;
    vector<int> vec;
    int now=1;
    int cnt=0;
    rep(i,n){
        int k=s.at(i)-'0';
        if(k==now) cnt++;
        else{
            vec.push_back(cnt);
            now=1-now;
            cnt=1;
        }
    }
    vec.push_back(cnt);
    if(now==0) vec.push_back(0);
    
    int m=vec.size();
    vector<int> sums(n+1,0);
    rep(i,m) sums.at(i+1)=sums.at(i)+vec.at(i);
    
    int ans=0;
    for(int i=0;i<=m;i+=2){
        ans=max(ans, sums.at(min(m,i+2*k+1))-sums.at(i));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1272
import sys
A, B = map(int, input().split())
tmp = 0

if (abs(A)-abs(B))%2 == 1:
  print("IMPOSSIBLE")
  sys.exit()

if A < B:
  tmp = A
  A = B
  B = tmp

if A > 0 and B > 0:
  K = (A+B)/2
elif A < 0 and B < 0:
  K = -(abs(A)+abs(B))/2
else:
  K = A-(abs(A)+abs(B))/2

print(int(K))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int box[1000];
	int i;
	int n,q;
	int d,a,b;
	int MAX,MIN;
	cin>>n;
	for(i=0;i<n;i++)	cin>>box[i];
	cin>>q;
	for(i=0;i<q;i++){
		cin>>d>>a>>b;
		if(d==0){
			MIN=*min_element(box+a,box+b);
			cout<<MIN<<endl;
		}
		else{
			MAX=*max_element(box+a,box+b);
			cout<<MAX<<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 3120
use std::io;

fn get_line() -> String {
  let mut line = String::new();
  io::stdin()
    .read_line(&mut line)
    .unwrap();
  line
}

fn line_to_vec(line: &str) -> Vec<&str> {
  line
    .trim()
    .split_whitespace()
    .collect::<Vec<&str>>()
}

fn expr_to_tuple<'a>(vec: &'a Vec<&str>) -> (i64, &'a str, i64) {
  let a = vec[0].trim().parse::<i64>().unwrap();
  let b = vec[2].trim().parse::<i64>().unwrap();
  (a, vec[1], b)
}

fn main() {
  loop {
    let line = get_line();
    let v = line_to_vec(&line);
    let t = expr_to_tuple(&v);
    let ans = match t.1 {
      "+" => t.0 + t.2,
      "-" => t.0 - t.2,
      "*" => t.0 * t.2,
      "/" => t.0 / t.2,
      "?" => break,
      _   => continue
    };
    println!("{}", ans);
  }
}



Measured memory_bytes: 5032
#include<iostream>
using namespace std; 
int main()
{
  int a,b,c,x,Ans,i,j;
  cin >> a >> b >> c >> x;
  i=0;
  while(500*i<=x&&i<=a){
    j=0;
    while(500*i+100*j<=x&&j<=b){
      if(x-500*i-100*j<=50*c)Ans++;
      j++;
    }
    i++;
  }
printf("%d",Ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long

string boin = "aiueo";
string shin = "ksthp";

bool isBoin(char c) {
  return (boin.find(c) != string::npos);
}

bool isShin(char c) {
  return (shin.find(c) != string::npos);
}

void out(string s) {
  int p = 0;
  while(!isBoin(s[p]) && s[p] != '\'') cout << s[p++];
  cout << '(' << s[p] << ')';
}

signed main(){
  string s;
  while(cin>>s,s!="#"){
    s += '\'';
    vector<string> v;
    int idx = 0;
    while(idx < s.size()){
      string hk = "";
      while(!isBoin(s[idx]) && s[idx] != '\'') {
	if(hk.size() && hk.back() == s[idx]) {
	  v.push_back(hk);
	  hk = "";
	} else if(hk.size() && hk[0] == 'n' && !isBoin(s[idx])) {
	  v.push_back(hk);
	  hk = "";
	}
	hk += s[idx];
	idx++;
      }
      v.push_back(hk+s[idx]);
      idx++;
    }
    string hoge = v.back();
    if(hoge.back() == '\'') {
      v.pop_back();
      hoge = hoge.substr(0, hoge.size()-1);
      if(hoge.size()) v.push_back(hoge);
    }
//for(string a : v) cout << a << endl;
    bool prev_b = false;
    for(int i = 0; i < v.size()-1; i++) {
      string hk = v[i];
      if(prev_b) {
	cout << hk;
	if(v[i-1].back() == 'i' || v[i-1].back() == 'u') {
	  if(!isShin(hk.back())) prev_b = false;
	} else {
	  prev_b = false;
	}
	continue;
      }
      if(hk.back() == 'i' || hk.back() == 'u') {
	if(isShin(hk[0]) && isShin(v[i+1][0])) {
	  out(hk);
	  prev_b = true;
	  continue;
	}
      }
      if(hk.back() == 'a' || hk.back() == 'o') {
	if(isShin(hk[0]) && isShin(v[i+1][0]) && v[i+1].back() == hk.back()) {
	  out(hk);
	  prev_b = true;
	  continue;
	}
      }
      cout << hk;
    }
    string piyo = v.back();
    if(!prev_b && isShin(piyo[0]) && (piyo.back() == 'i' || piyo.back() == 'u')) out(piyo);
    else cout << v.back();
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3112
# coding: utf-8
# Your code here!
n=int(input())
s = list(map(int,input().split()))

a=1
ans=0
for i in range(n):
    if i > 0:
        if s[i] == s[i-1]:
            a+=1
        else: 
            ans += a//2
            a=1
    if i==n-1 and  s[i] == s[i-1]:
            ans += a//2
#    print(a,ans)

print(ans)    




Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define clr(x,y) memset(x,y,sizeof x)
#define INF 0x3f3f3f3f
const int maxn = 1e5 + 10;
typedef long long ll;
typedef unsigned long long ull;
const ull D = 131;
const ll Mod = 1e9 + 7;
const int N = 2e6 + 10;

int main()
{
    char s[10];
    while( ~ scanf("%s",s))
    {
        for(int S = 0;S < 1 << 3;S ++)
        {
            int sum = s[0] - '0';
            for(int i = 1; i <= 3; i ++)
            {
                if(S & (1 << (i - 1)))
                {
                    sum += s[i] - '0';
                }
                else sum -= s[i] - '0';
            }
            if(sum == 7)
            {
                cout << s[0];
                for(int i = 1; i <= 3;i ++)
                {
                    if(S & (1 <<(i - 1)))
                    {
                        cout << "+" << s[i];
                    }
                    else cout << "-" << s[i];
                }
                cout << "=" << 7 <<endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 210, M = 10, INF = 0x3f3f3f3f;

int n, m, k;
int f[N][N];
int r[N];

int main()
{
	scanf("%d%d%d", &n, &m, &k);
	
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			if (i == j) f[i][j] = 0;
			else f[i][j] = INF;
			
	for (int i = 0; i < k; i ++ ) scanf("%d", &r[i]);
	sort(r, r + k);
	
	for (int i = 0; i < m; i ++ )
	{
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		f[a][b] = f[b][a] = min(f[a][b], c);
	}
	
	for (int k = 1; k <= n; k ++ )
		for (int i = 1; i <= n; i ++ )	
		 	for (int j = 1; j <= n; j ++ )
		 		f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
	
	int res = INF;
	do
	{
		int sum = 0;
		for (int i = 0; i < k - 1; i ++ )
		{
			int a = r[i], b = r[i + 1];
			sum += f[a][b];
		}
		res = min(res, sum);
	}while (next_permutation(r, r + k));
	
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 384
R,C,K = map(int,input().split())

grid=[[0]*C for _ in range(R)]
for i in range(K):
    x,y,v = map(int,input().split())
    grid[x-1][y-1] = v
dp1 = [[0]*(C+1) for _ in range(R+1)]
dp2 = [[0]*(C+1) for _ in range(R+1)]
dp3 = [[0]*(C+1) for _ in range(R+1)]

for i in range(R):
    for j in range(C):
        dp1[i][j] = max(dp1[i][j-1],dp1[i-1][j]+grid[i][j],
                    dp2[i-1][j]+grid[i][j],dp3[i-1][j]+grid[i][j])
        dp2[i][j] = max(dp2[i][j-1],dp1[i][j-1]+grid[i][j])
        dp3[i][j] = max(dp3[i][j-1],dp2[i][j-1]+grid[i][j])
ans=0
for i in range(R):
    for j in range(C):
        ans=max(ans,dp1[i][j],dp2[i][j],dp3[i][j])
print(ans)

Measured memory_bytes: 359044
#include<stdio.h>
#define MAX 2000000

int H, A[MAX+1],a;

void maxHeapify(int i){
  
  int l, r, largest;
  l = 2 * i;
  r = 2 * i + 1;

  if(l <= H && A[l] > A[i]){
    largest = l;
  }
  else{
    largest = i;
  }
  if(r <= H && A[r] > A[largest]){
    largest = r;
  }

  if(largest != i){
    a = A[i]; 
    A[i] = A[largest];        
    A[largest] = a;
    maxHeapify(largest);
  }

}

int main(){

  int i;

  scanf("%d",&H);

  for(i=1; i<=H; i++){
    scanf("%d",&A[i]);
  }

  for(i=H/2; i>=1; i--){
    maxHeapify(i);
  }

  for(i=1; i<=H; i++){
    printf(" %d",A[i]);
    }
  printf("\n");
  return 0;
}

Measured memory_bytes: 2556
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> A (n+1), B (n+1), C(n+1);
    for(int i = 1; i <= n; i++)      cin >> A[i];
    for(int i = 1; i <= n; i++)      cin >> B[i];
    for(int i = 1; i <= n-1; i++)    cin >> C[i];
    //
    long long sat = 0;
    int prevDish = -9;
    for(int i = 1; i <= n; i++) {
        if( A[i]-1 == prevDish ) sat += C[prevDish];
        sat += B[A[i]];
        prevDish = A[i];
    }
    cout << sat;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long

LL n, cnt = 0;

bool check (int x) {
	LL m = n;
	while (m % x == 0) m /= x;
	return m % x == 1;
}

int main () {
	cin >> n;
	LL sq = sqrt (n);
	for (LL i = 2; i <= sq; i ++) {
		if (n % i == 0) {
			if (check (i)) cnt ++;
			if (i != n / i && check (n / i)) cnt ++;
		}
	}
	n --;
	if (n > sq) {
		cnt ++;
		for (LL i = 2; i <= sq; i ++) {
			if (n % i == 0) {
				cnt ++;
				if (i != n / i) cnt ++;
			}
		}
	}
	cout << cnt + 1;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
const int maxn = 1e5+10;

int n, m;
vector<int> graph[maxn];
bool bio[maxn];
deque<int> path;

void dfs1(int pos) {
    path.push_front(pos);
    bio[pos] = true;
    for (int i = 0; i < graph[pos].size(); i++) {
        int tren = graph[pos][i];
        if (!bio[tren]) {
            dfs1(tren);
            break;
        }
    }
}

void dfs2(int pos) {
    path.push_back(pos);
    bio[pos] = true;
    for (int i = 0; i < graph[pos].size(); i++) {
        int tren = graph[pos][i];
        if (!bio[tren]) {
            dfs2(tren);
            break;
        }
    }
}


int main() {
    memset(bio, false, sizeof bio);
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    int fx = 1, fy = graph[1].front();
    bio[fx] = bio[fy] = true;
    dfs1(fx);
    dfs2(fy);

    printf("%d\n", path.size());
    for (int i = 0; i < path.size(); i++)
        printf("%d ", path[i]);
    return 0;
}


Measured memory_bytes: 6784
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [1e+10 for i in range(n)]
dp[0] = 0

for i in range(0,n):
    for j in range(1,k+1):
        p = i + j
        if p < n:
            dp[p] = min(dp[p],dp[i] + abs(h[i] - h[p]))
print(dp[n-1])

Measured memory_bytes: 90876
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> h(n),dp(n);
  for(int i=0;i<n;i++) cin>>h[i];
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  for(int i=2;i<n;i++){
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>


int main(int argc, char *argv[])
{
	string s;
	cin >> s;
	

	cout<< ((s=="AAA" || s=="BBB") ?"No":"Yes")<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int main() {
	int n, k; cin >> n >> k;
	int z = (n + 1) / 2;
	if (z < k)cout << "NO" << endl;
	else cout << "YES" << endl;
	//stop
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long

using pi = pair<int, int>;

typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update>Order_Set;

Order_Set X;

const int mxn = 1e6+100;
const int Mod = 1e9+7;

int arr[mxn], qs[mxn];
int bitOn[55];
map<int,int>Mp, cnt, op;
vector<int>Pi, Ans;
vector<int>G[mxn];
set<int>seet[mxn];

char str[55][55];
int n, k;
int visit[55][55];
int dist[55][55];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

int BFS(int i, int j)
{
    queue<pi>q;
    visit[i][j] = 1;
    dist[i][j] = 0;
    q.push({i, j});
    int cost = 0;
    while(!q.empty()){
            int x = q.front().first;
            int y = q.front().second;
            q.pop();
            for(int c=0 ; c<4 ; c++){
                int nx = x + dx[c];
                int ny = y + dy[c];
                if(nx < 0 or nx >= n or ny < 0 or ny >= k or str[nx][ny] == '#' ) continue;
                if(!visit[nx][ny]){
                    visit[nx][ny] = 1;
                    dist[nx][ny] = dist[x][y] + 1;
                    cost = max(dist[nx][ny], cost);
                    q.push({nx, ny});
                }
            }
    }
    return cost;
}

int main()
{
    ios::sync_with_stdio(false);

    cin>>n>>k;
    for(int i=0 ; i<n ; i++){
        for(int j=0 ; j<k ; j++){
            char ch;
            cin>>ch;
            str[i][j] = ch;
        }
    }

    int Ans = 0;
    for(int i=0 ; i<n ; i++){
        for(int j=0 ; j<k ; j++){
            memset(visit, 0, sizeof visit);
            int co = 0;
            if(str[i][j] == '.') co = BFS(i, j);
            Ans = max(Ans, co);
        }
    }

    cout<<Ans<<endl;

    return 0;
}


Measured memory_bytes: 72064
n,k= (int(x) for x in input().split())
num_list = []
for i in range(k):
    a = input().split()
    num_list.append(list(map(int,input().split())))

list = []
for i in range(1,n+1):
    list.append(i)
for risu in num_list:
    for x in risu:
        if x in list:
            list.remove(x)
tuple = tuple(list)


print(len(tuple))

Measured memory_bytes: 9280
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());

		Set<Integer> set = new HashSet<Integer>();
		for(int i = 0 ;i < n ;i++) {
			int a = Integer.parseInt(sc.next());
			set.add(a);
		}
		
		if(set.size() == n) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 67904
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>

int main (int argc, char **argv)
{
  char s[12] = {0};
  int m = 0;

  scanf("%s", s);

  strtok(s, "/");
  m = atoi(strtok(NULL, "/"));

  printf("%s\n", ((m > 4) ? "TBD" : "Heisei"));

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;

int main () {
  int N;
  cin >> N;
  int i=0;
  int num=0;
  int k=1;
  while (N >= k) {
    num += ((N-(N%k))/k)%10;
    ++i;
	k *= 10;
  }
  if (N%num == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int x_1, y_1, x_2, y_2;
    cin >> x_1 >> y_1 >> x_2 >> y_2;
    int dx = x_2 - x_1;
    int dy = y_2 - y_1;
    int x_3 = x_2 + (-dy);
    int y_3 = y_2 + dx;
    int x_4 = x_3 + (-dx);
    int y_4 = y_3 + (-dy);
    cout << x_3 << " " << y_3 << " " << x_4 << " " << y_4 << endl;
}


Measured memory_bytes: 3588
#include<iostream>
using namespace std;
int main(){
	int a,b,c,t;
	cin >> a >> b >> c;
	if (a > b){
		t = a;
		a = b;
		b = t;
	}
	if (b > c){
		t = b;
		b = c;
		c = t;
	}
	if (a > b){
		t = a;
		a = b;
		b = t;
	}

	cout << a <<" "<< b <<" "<< c << endl;

	return 0;
}

Measured memory_bytes: 3028
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long// long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};
typedef long long ll;

int ans;
const int r=2200; 
int h,w;
char a[r][r];
int lef[r][r],rig[r][r],up[r][r],down[r][r];
signed main(){
    
    
    cin>>h>>w;
    rep(i,h)rep(j,w)cin>>a[i][j];
    
    rep(i,h){
        int count=0;
        rep(j,w){
            if(a[i][j]=='#')count=0;
            else count++;
            lef[i][j]=count;
        }
    }
    rep(i,h){
        int count=0;
        repb(j,w){
            if(a[i][j]=='#')count=0;
            else count++;
            rig[i][j]=count;
        }
    }
    rep(i,w){
        int count=0;
        rep(j,h){
            if(a[j][i]=='#')count=0;
            else count++;
            up[j][i]=count;
        }
    }
    rep(i,w){
        int count=0;
        repb(j,h){
            if(a[j][i]=='#')count=0;
            else count++;
            down[j][i]=count;
        }
    }
    int max=0;
    rep(i,h)rep(j,w){
        max=std::max(lef[i][j]+rig[i][j]+up[i][j]+down[i][j]-3,max);
    }
    cout<<max<<endl;
}


Measured memory_bytes: 151808
using System;
using System.Linq;


namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;

        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }

            var res = line[index];
            index++;
            return res;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public ulong NextUlong()
        {
            return ulong.Parse(Next());
        }

        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }

        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }

        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }
    }

    struct MyStruct
    {
        public long N;
        public int Cnt;
    }

    class Program
    {
        private int N;
        private int W;
        private long[] w, v;
        void Scan()
        {
            var sc = new Scanner();
            N = sc.NextInt();
            W = sc.NextInt();
            w = new long[N];
            v = new long[N];
            for (int i = 0; i < N; i++)
            {
                w[i] = sc.NextInt();
                v[i] = sc.NextLong();
            }
        }

        public void Solve()
        {
            Scan();
            var dp = (new long[100001]).Select(i => (long)int.MaxValue).ToArray();
            dp[0] = 0;
            for (int i = 0; i < N; i++)
            {
                for (int j = 100000; j >= 0; j--)
                {
                    if (dp[j] + w[i] > W) continue;
                    dp[j + v[i]] = Math.Min(dp[j + v[i]], dp[j] + w[i]);
                }
            }

            for (int i = 100000; i >= 0; i--)
            {
                if (dp[i] <= W)
                {
                    Console.WriteLine(i);
                    return;
                }
            }
        }



        static void Main() => new Program().Solve();
    }


}

Measured memory_bytes: 14432
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,r,a,b,c,d;
    cin>>n>>r;
    if(n<10)
    {
        a=100*(10-n);
        cout<<(r+a)<<endl;
    }
    else
    {
        cout<<r<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    char a; cin >> a;
    if ('a' <= a && a <= 'z') {
        cout << 'a' << endl;
    } else {
        cout << 'A' << endl;
    }
}


Measured memory_bytes: 3628
import java.util.*;

class Main{
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    String str_S = sc.next();
    char[] s = str_S.toCharArray();
    String str_T = sc.next();
    char[] t = str_T.toCharArray();
    int result = 0;
    for(int i = 0;i < s.length;i++) {
      if(s[i] != t[i]) {
        result++;
      }
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 41636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> P;

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) break;

        rep(i, n) {
            int m, e, j;
            cin >> m >> e >> j;
            if (m == 100 || e == 100 || j == 100 || m+e >= 180 || m+e+j >= 240) cout << 'A' << endl;
            else if (m+e+j >= 210 || (m+e+j >= 150 && (m >= 80 || e >= 80))) cout << 'B' << endl;
            else cout << 'C' << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3088
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>

void Funca() {
	int a, b, x;
	std::cin >> a >> b >> x;
	if (a <= x && a + b >= x) {
		std::cout << "YES" << std::endl;
	}
	else
	{
		std::cout << "NO" << std::endl;

	}
}

int main()
{
	int n, m, x;
	int cost0 = 0;
	int cost1 = 0;
	std::map<int, int> mp;
	std::vector<int> vec;
	std::cin >> n >> m >> x;
	for (int i = 0; i < m; ++i) {
		int t;
		std::cin >>t;
		vec.push_back(t);
	}
	for (auto it : vec) {
		if (0 < it&&it < x) {
			++cost0;
		}
		else {
			++cost1;
		}
	}
	std::cout << std::min(cost0, cost1) << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ar array

double a,b;


void solve(){

    cin >> a >> b;

    

    ll c = (ll)a * (ll)(b*100+0.1);
    c = c/100;
    cout << c << endl;
}





int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

}

Measured memory_bytes: 3720
from fractions import gcd
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

def lcm(values):
    ans = values[0]
    for i in range(1, len(values)):
        ans = ans * values[i] // gcd(ans, values[i])
    return ans

def count_div2(value):
    count = 0
    while value % 2 == 0:
        count += 1
        value //= 2
    return count

min_value = lcm(A)
amount = M * 2 // min_value

div2 = count_div2(A[0])
if any([count_div2(a) != div2 for a in A]):
    print(0)
else:
    print((amount + 1) // 2)


Measured memory_bytes: 16284
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io;
use std::str::FromStr;
use std::iter::FromIterator;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::mem::{replace, swap};

const BIGINT: i64 = 1e9 as i64 + 7;

// [NOTE] つかうときには trim() 入れないと RE になるので注意
// abcde
fn read_as_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    line
}

// #.#.###..
fn read_as_chars<T: FromIterator<char>>() -> T {
    let s = read_as_line();
    s.trim().chars().collect()
}

fn length_in_base2(x: usize) -> usize {
    let mut x = x;
    let mut ans = 0;
    while x > 0 {
        ans += 1;
        x >>= 1;
    }
    ans
}

fn powmod(x: i64, y: usize, z: i64) -> i64 {
    let mut ans = 1_i64;
    let mut px = x;
    let y_size = length_in_base2(y);
    for i in 0..y_size {
        if (y >> i) & 1 == 1 {
            ans = (ans * px) % z;
        }
        px = (px * px) % z;
    }
    ans
}

fn main() {
    let s: Vec<char> = read_as_chars();
    let mut xs: Vec<i64> = vec![0; 13];
    xs[0] = 1;

    for (p, &c) in s.iter().rev().enumerate() {
        let powpow = powmod(10, p, 13) as usize;
        let mut ys: Vec<i64> = vec![0; 13];
        if c == '?' {
            for k in 0..13 {
                for i in 0..10 {
                    let idx = (powpow * i + k) % 13;
                    ys[idx] = (ys[idx] + xs[k]) % BIGINT;
                }
            }
        } else {
            let n: usize = c.to_digit(10).unwrap() as usize;
            for k in 0..13 {
                let idx = (powpow * n + k) % 13;
                ys[idx] = xs[k];
            }
        }
        xs = ys;
    }
    println!("{}", xs[5]);

}

Measured memory_bytes: 4352
#include<iostream>
#include<string>
using namespace std;

int main(){
    string a,b;cin>>a>>b;
    int c=atoi((a+b).c_str());
    int i;
    bool flag=false;
    for(i=0;i*i<=c;i++){
        if(i*i==c){
            flag=true;
        }
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
pt = 0
px = 0
py = 0
for _ in range(n):
    t, x, y = MAP()
    tmp = abs(x - px) + abs(y - py) - (t - pt)
    if tmp > 0 or tmp % 2 != 0:
        print('No')
        exit()
    px = x
    py = y
    pt = t
print('Yes')

Measured memory_bytes: 5200
n = gets.chomp.to_i
v = gets.chomp.split.map(&:to_i)

ans = 0.0
count = 0
k = 1.0
v.sort.reverse_each do |vi|
  count += 1
  k /= 2.0 if count != n
  ans += vi * k
end

puts(ans)

Measured memory_bytes: 1788
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <typeinfo>
#include <climits>
#include <ctype.h>
#include <string>
#include <stack>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    int x, t;
    cin >> x >> t;

    int ans = x - t;
    if(ans < 0) cout << 0 << endl;
    else cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
#define fr first
#define sc second
#define pii pair<int, int>
#define all(v) v.begin(), v.end()

using namespace std;

const ll MOD = 1000000007;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    if (n >= 30)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
      	int n = 0;

        while (Math.pow(2,n + 1) <= N ) {
          n = n + 1;
          
        } 
          System.out.println(Math.round(Math.pow(2,n)));
           
    }
}



Measured memory_bytes: 20820
// 2011/02/05 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		int dat[100];
		for(int i=0; i<n; i++)
			cin >> dat[i];

		int key;
		cin >> key;

		int cnt = 0;
		for(int lef=0, rig=n-1; lef<=rig;){
			int mid = (lef+rig)/2;
			cnt++;
			if(key==dat[mid])
				break;
			else if(key<dat[mid])
				rig = mid-1;
			else
				lef = mid+1;
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 0
i;main(a,b,c,d){
	for(scanf("%1d%1d%1d%d",&a,&b,&c,&d);i<8;i++){
		if(a+(i&1?b:-b)+(i&2?c:-c)+(i&4?d:-d)==7)
			return!printf("%d%+d%+d%+d=7",a,i&1?b:-b,i&2?c:-c,i&4?d:-d);
	}
}

Measured memory_bytes: 128