akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define PI 3.14159265359
#define INF 1000000009
#define LINF 1000000000000000009
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std; 

int main(void)
{   
    int n;
    cin >> n;

    map<ll, ll> job;
    irep(i, n) {
        int a, b;
        cin >> a >> b;
        job[b] += a;
    }
    
    ll prev = 0;

    for(auto mp : job) {
        //cout << prev << endl;
        //printf("%lu,%lu\n", mp.first, mp.second);
        if(mp.first >= (mp.second + prev)) {
            prev += mp.second;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}
/** tcoder **/


Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int a[m];
    for(int i=0; i<m; i++)
        cin>>a[i];
    int sum=0;
    for(int i=0; i<m; i++)
        sum=sum+a[i];
    int diff=n-sum;
    if(diff>=0)
        cout<<diff<<endl;
    else
        cout<<"-1"<<endl;
}


Measured memory_bytes: 3624
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (a==b) {
			System.out.println(c);
		}else if(a==c) {
			System.out.println(b);
		}else {
			System.out.println(a);
		}
		sc.close();
	}

}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C,X;
    cin>>A>>B>>C>>X;
    int ans=0;
    for(int a=0;a<=A;a++){
        for(int b=0;b<=B;b++){
            for(int c=0;c<=C;c++){
                if(500*a+100*b+50*c==X){ans++;}
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;

signed main(){
	//cout << fixed << setprecision(10);
	rep(q,0,100100){
		int a,b; cin>>a>>b;
		if(a==0 && b==0)return 0;
		rep(i,0,a){
			rep(j,0,b){
				cout<<'#';
			}
			cout<<endl;
		}
		cout<<endl;
	}


	return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int n;
  cin >> n;
  vll a(n);
  REP(i,n) {
    cin >> a[i];
  }
  int ans=a[0];
  REP(i,n-1) {
    ans=euclidean_gcd(ans,a[i+1]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
N = gets.to_i
A = gets.split(' ').map(&:to_i)
sum_x = A.inject(:+) / 2
x_1 = sum_x
1.step(N-1, 2) do |i|
  x_1 -= A[i]
end
print "#{2*x_1} "
x_prev = x_1
(1..N-1).each do |i|
  x_now = A[i-1] - x_prev
  print "#{2*x_now} "
  x_prev = x_now
end
puts

Measured memory_bytes: 12292
def gcd(a, b):
    while b != 0:
        t = a
        a = b
        b = t%b
    return a

k = int(input())

s = 0
for i in range(1, k+1):
    if i == 1:
        s += k*k
        continue
    for j in range(1, k+1):
        if j == 1:
            s += k
            continue

        d = gcd(i, j)
        if d == 1:
            s += k
            continue

        for k in range(1, k+1):
            if k == 1:
                s += 1
                continue
            s += gcd(d, k)

print(s)

Measured memory_bytes: 9196
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}


ll cntN[100005];


void cal(ll N){
    ll cnt = 0;
    rep(i, N){
        cnt += i;
        cntN[i+1] = cnt;
    }
}


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

    ll N,  M ;

    cin >> N >> M;

    cal(100001);


    vector<ll> A;
    vector<ll> sumA;
    rep(i,N){
        ll inp;
        cin >> inp;
        A.pb(inp);
    }

    ll s = 0;
    map<ll,ll> cnt;
    sumA.pb(0);
    cnt[0] ++;
    rep(i,N){
        s += A[i];
        sumA.pb(s % M);
        cnt[s%M] ++;
    }

    rmsame(sumA);

    ll ans = 0 ;
    rep(i, sumA.size()){
        ans += cntN[cnt[sumA[i]]];
    }
    cout << ans << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 7028
<?php
list($x) = ints();
if ($x <= 599) $ans = 8;
elseif ($x <= 799) $ans = 7;
elseif ($x <= 999) $ans = 6;
elseif ($x <= 1199) $ans = 5;
elseif ($x <= 1399) $ans = 4;
elseif ($x <= 1599) $ans = 3;
elseif ($x <= 1799) $ans = 2;
elseif ($x <= 1999) $ans = 1;
echo $ans;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 16176
#include<iostream>
#include<string>
using namespace std;
string s;
int main()
{
	cin>>s;
	int n=s.size();
	for (int i=0;i<n-1;i++)
	{
		if (s[i]=='A' && s[i+1]=='C') 
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{	
	int N;
	int ans=0;
	vector<int> A(N);
	vector<int> B(N);
	vector<int> C(N-1);
	cin >> N;
	REP(i, N) cin >> A[i];
	REP(i, N) cin >> B[i];
	REP(i, N-1) cin >> C[i];

	ans=B[A[0]-1];
	for(int i=1;i<N;i++){
		ans+=B[A[i]-1];
		if(A[i]-A[i-1] == 1){
			ans+=C[A[i]-2];
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
from collections import defaultdict

N, M = map(int, raw_input().split())
X = [map(int, raw_input().split()) for _ in range(M)]

D = defaultdict(list)
for a, b in X:
    D[a].append(b)
    D[b].append(a)


def dfs(now, p):
    cnt = 0
    if set(now) == set(range(1, N+1)):
        return 1
    for k in D[p]:
        if k in now:
            continue
        cnt += dfs(now + [k], k)
    return cnt

print dfs([1], 1)


Measured memory_bytes: 2812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
static const int INFTY = (1 << 30);
int N, K, R, S, P;
void func()
{
    cin >> N >> K;
    cin >> R >> S >> P;
    string T;
    cin >> T;
    int ans(0), max(0), v[N];
    rep(i, 0, N)
    {
        if (T[i] == 'r')
        {
            max += P;
            v[i] = 3;
        }
        else if (T[i] == 's')
        {
            max += R;
            v[i] = 1;
        }
        else
        {
            max += S;
            v[i] = 2;
        }
    }
    rep(i, K, N)
    {
        if (v[i] == v[i - K])
        {
            v[i] == 1 ? max -= R : v[i] == 2 ? max -= S : max -= P;
            v[i] = 0;
        }
    }
    cout << max << endl;
}
int main()
{
    func();
}

Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

string make_str(vector<int> &v) {
	int n = v.size() - 1;
	string s(n, '?');
	for (int i = 0; i < n; i++) {
		s[i] = v[i] == 0 ? 'S' : 'W';
	}
	return s;
}

int main() {
	int n;
	string s;
	cin >> n >> s;

	for (int i = 0; i < 4; i++) {
		vector<int> animal(n + 1, -1);
		switch (i) {
			case 0: animal[0] = 0; animal[1] = 0; break;
			case 1: animal[0] = 0; animal[1] = 1; break;
			case 2: animal[0] = 1; animal[1] = 0; break;
			case 3: animal[0] = 1; animal[1] = 1; break;
			default: break;
		}

		for (int i = 1; i < n; i++) {
			if (animal[i] == 0 && s[i] == 'o') {
				animal[i+1] = animal[i-1];
			} else if (animal[i] == 0 && s[i] == 'x') {
				animal[i+1] = 1 - animal[i-1];
			} else if (animal[i] == 1 && s[i] == 'o') {
				animal[i+1] = 1 - animal[i-1];
			} else if (animal[i] == 1 && s[i] == 'x') {
				animal[i+1] = animal[i-1];
			}

			// printf("%d %c: %d %d %d\n", i, s[i], animal[i-1], animal[i], animal[i+1]);
		}
		// printf("check %d %d\n", animal[0], animal[n]);

		if (animal[0] != animal[n]) {
			continue;
		}

		if ((animal[0] == 0 && s[0] == 'o' && animal[1] == animal[n - 1]) ||
		    (animal[0] == 0 && s[0] == 'x' && animal[1] != animal[n - 1]) ||
		    (animal[0] == 1 && s[0] == 'o' && animal[1] != animal[n - 1]) ||
		    (animal[0] == 1 && s[0] == 'x' && animal[1] == animal[n - 1]))
		{
			auto ans = make_str(animal);
			cout << ans << endl;
			return 0;
		}
	}

	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 1016
// ABC 151-F
// 2020.1.12 bal4u

#include <stdio.h>
//#include <stdlib.h>
#include <math.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

#define EPS 1e-10

typedef struct { double x, y; } PP;
PP p[55];

double dist(PP a, PP b)
{
	double x = a.x - b.x;
	double y = a.y - b.y;
	return sqrt(x*x + y*y);
}

double solve_by_movement(int n)
{
	int  k, i, t;
	PP a;
	double move, max, d;

    a.x = a.y = 500;
	move = 0.5;
	while (move > EPS) {
		for (t = 0; t < 500; t++) {
			max = 0;
			for (i = 0; i < n; i++) {
				if ((d = dist(a, p[i])) > max) max = d, k = i;
			}
			a.x += (p[k].x - a.x)*move;
			a.y += (p[k].y - a.y)*move;
		}
		move /= 2;
	}
	return max;
}

int main()
{
	int i, x, y, N;

	N = in();
	for (i = 0; i < N; ++i) {
		p[i].x = in(), p[i].y = in();
	}
	printf("%.10lf\n", solve_by_movement(N));
	return 0;
}


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

int main()
{
  i64 n;
  cin >> n;
  i64 ans = 1;
  while (ans * 2 <= n)
    ans *= 2;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3084
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
 
#define INF_LL 1e18
#define INF 1e9
 
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
 
using namespace std;
 
using ll = long long;
using PII = pair<int, int>;
 
class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;
 
public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}
 
	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}
 
	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
 
		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}
 
	bool same(int x, int y){
		return find(x) == find(y);
	}
};
 
ll mod = 1e9+7;
 
ll powm(ll x, ll a){
	ll res = 1;
	REP(i, a){
		res = (res * x) % mod;
	}
	return res;
}
 
int main(void){
	int N, C;
	ll A[401], B[401];
	ll dp[401][401] = {};
	cin >> N >> C;
	REP(i, N){
		cin >> A[i];
	}
	REP(i, N){
		cin >> B[i];
	}
	dp[0][0] = 1;
	int mul[401][401];
	mul[0][0] = 0;
	REP(i, 401){
		mul[i][0] = 0;;
		REP(j, 401){
			mul[i][j] = powm(i, j);
			if(i > 0)
				mul[i][j] = (mul[i][j] + mul[i-1][j])%mod;
		}
	}
	REP(i, N){
		REP(j, C+1){
			ll sum = 0;
			REP(k, j+1){
				sum = (sum + dp[i][j-k] * (mul[B[i]][k]-mul[A[i]-1][k]+mod)%mod) % mod;
			}
			dp[i+1][j] = sum;
		}
	}
	cout << dp[N][C] << endl;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    set<pair<int, int>> s;
    int a;
    REP(i, n) {
        cin >> a;
        s.emplace(a, 1);
    }
    int b;
    REP(i, n) {
        cin >> b;
        s.emplace(b, -1);
    }

    ll ans = 1;
    ll c = 0;
    bool st = false;
    int d;
    for (auto p : s) {
        if (!st) {
            st = true;
            d = p.second;
            c++;
        } else {
            if (p.second == d) {
                c++;
            } else {
                ans = ans * c % MOD;
                c--;
            }
            if (c == 0) {
                st = false;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 9600
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, m;
const int maxN = 1e5 + 10;
vector < int > g[maxN];
bool used[maxN];
int clr[maxN];
int sz = 0;
bool BIP;
void dfs(int v) {
    sz++;
    used[v] = true;
    for (int to : g[v]) {
        if (used[to]) {
            if (clr[to] == clr[v]) {
                BIP = false;
            }
        }
        else {
            clr[to] = clr[v] ^ 1;
            dfs(to);
        }
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int good = 0;
    int bad = 0;
    int single = 0;
    for (int i = 1; i <= n; i++) {
        if (!used[i]) {
            sz = 0;
            BIP = true;
            dfs(i);
            if (sz == 1) single++;
            else if (!BIP) good++;
            else bad++;
        }
    }
    ll ans = 1LL * single * single + 2LL * single * (n - single);
    ans += 2LL * good * bad + 1LL * good * good + 2LL * bad * bad;
    cout << ans;
    return 0;
}

Measured memory_bytes: 9088
n, m = map(int, input().split())
students = [tuple(map(int, input().split())) for i in range(n)]
checkpoints = [tuple(map(int, input().split())) for i in range(m)]

for student in students:
    list_ = []
    for i in range(len(checkpoints)):
        list_.append((abs(student[0] - checkpoints[i][0]) + abs(student[1] - checkpoints[i][1]), i+1))
    print(sorted(list_)[0][1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define mod 1e9+7
using namespace std;
ll dp[100010];
int main()
{
    for(int i=0; i<=100000; i++)
        dp[i]=100000000000000;
    dp[0]=0;
    ll N, W;
    scanf("%lld%lld", &N, &W);
    for(int i=0; i<N; i++)
    {
        ll w, v;
        scanf("%lld%lld", &w, &v);
        for(int left=100000-v; left>=0; left--)
        {
            dp[v+left]=min(dp[v+left], dp[left]+w);
          //  cout<<v+left<<" "<<dp[v+left]<<endl;
        }
    }
    ll ans=0;
    for(int i=0; i<=100000; i++)
        {
            if(dp[i]<=W) ans=i;
        }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++){
    cin >> a[i];
  }
  int C = 0;
  for (int i = 0; i < N; i++){
    C += a[i];
  }
  vector<vector<long long>> dp(N + 1, vector<long long>(C + 1, 0));
  dp[0][0] = 1;
  for (int i = 0; i < N; i++){
    for (int j = 0; j <= C - a[i]; j++){
      dp[i + 1][j] += dp[i][j] * 2;
      dp[i + 1][j + a[i]] += dp[i][j];
    }
    for (int j = 0; j <= C; j++){
      dp[i + 1][j] %= MOD;
    }
  }
  vector<vector<long long>> dp2(N + 1, vector<long long>(C + 1, 0));
  dp2[0][0] = 1;
  for (int i = 0; i < N; i++){
    for (int j = 0; j <= C - a[i]; j++){
      dp2[i + 1][j] += dp2[i][j];
      dp2[i + 1][j + a[i]] += dp2[i][j];
    }
    for (int j = 0; j <= C; j++){
      dp2[i + 1][j] %= MOD;
    }
  }
  long long ans = 1;
  for (int i = 0; i < N; i++){
    ans *= 3;
    ans %= MOD;
  }
  for (int i = (C + 1) / 2; i <= C; i++){
    ans += (MOD - dp[N][i]) * 3;
    ans %= MOD;
  }
  if (C % 2 == 0){
    ans += dp2[N][C / 2] * 3;
    ans %= MOD;
  }
  cout << ans << endl;
}

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

using namespace std;

using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


signed main(){
    int a, b, n;
    cin >> a >> b >> n;
    vector<int> table(2000, 0);
    for(int i = 0; i < n; ++i){
        int l, r;
        cin >> l >> r;
        for(int j = l; j < r; ++j)
            table[j] = 1;
    }
    int fl = 0;
    for(int j = a; j < b; ++j)
        fl |= (table[j]);

    cout << fl << endl;
}



Measured memory_bytes: 3108
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

using ll = long long;

//各種nil
template <class T>
constexpr T nil = static_cast<T>(-1);

constexpr int nil_i = nil<int>;
constexpr int nil_ll = nil<ll>;
constexpr double nil_d = nil<double>;

//vector
template <class T>
using vec = std::vector<T>;

struct Item
{
    int weight, value;
};

void solve()
{
    using namespace std;

    constexpr int inf = 1 << 30;
    
    int n;
    cin >> n;
    vec<int> a(n, 0);
    for (auto& x : a) cin >> x;
    
    ////この方法ではO(n^2)
    ////dp[i + 1]  a[i]を最終要素とした増加部分列の長さ
    //vec<int> dp(n + 1, 1);

    //for (int i = 0; i < n; ++i)
    //    for (int j = 0; j < i; ++j)
    //        if (a[j] < a[i])
    //            dp[i + 1] = max(dp[i + 1], dp[j] + 1);

    //dp[i]  長さがi + 1となる増加部分列の最終要素の最小値
    vec<int> dp(n, inf);

    for (int i = 0; i < n; ++i)
        *lower_bound(dp.begin(), dp.end(), a[i]) = a[i];

    cout << distance(dp.begin(), lower_bound(dp.begin(), dp.end(), inf)) << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define pi acos(-1)
#define valid(x , y) x >= 1 && x <= 8 && y >= 1 && y <= 8
#define pb push_back
#define pll pair <ll, ll>
#define pii <pair<ll , ll>
#define mp make_pair
#define M (1e9 + 7)
#define sl1(t) scanf("%lld" , &t)
#define si1(t) scanf("%d" , &t)
#define sl3(t , u , v) scanf("%lld %lld %lld" , &t , &u , &v)
#define si3(t , u , v) scanf("%d %d %d" , &t , &u , &v)
#define sl2(t , u) scanf("%lld %lld" , &t , &u)
#define si2(t , u) scanf("%d %d" , &t , &u)
#define el printf("\n")
#define sp printf(" ")
#define pri(t) printf("%d " ,t)
#define prl(t) printf("%lld " , t)
#define pc(x) printf("Case %lld: " , x)
//int dx[] = {1 , -1  , 0 , 0 , 1 , -1 , 1 , -1};
//int dy[] = {0 , 0 , 1 , -1 , -1 , 1 , 1 , -1};

vector<ll>v[200005];
ll vis[200005];

ll cnt = 0;
ll cnt2 = 0;

void dfs(ll n)
{
    if(vis[n] != 0)return;
    vis[n] = cnt;
    cnt2++;
    for(ll i = 0 ; i < v[n].size() ; i++){
        dfs(v[n][i]);
    }
}

int main()
{
    //ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ///*
    #ifndef ONLINE_JUDGE
    freopen("input.cpp", "r" , stdin);
    //freopen("output.txt" , "w" , stdout);
    #endif // ONLINE_JUDGE
    //*/
    ll n , e;cin >> n >> e;
    for(ll i = 0 ; i < e ; i++){
        ll a , b;cin >> a >> b;
        v[a].pb(b);
        v[b].pb(a);
    }
    ll ans = 0;
    for(ll i = 1 ; i <= n ; i++){
        if(vis[i] == 0){
            cnt++;
            cnt2 = 0;
            dfs(i);
            ans = max(ans , cnt2 );
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 22284
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {

	int n = 0, m = 0;
	cin >> n >> m;
	vector<int> vec(n);
	
	int input = 0;
	long long votes = 0;

	for (int i = 0; i < n; i++) {
		cin >> input;
		vec[i] = input;
		votes += input;
	}
	
	double condition = (1 / (4 * (double)m));
	double minimumVote = condition * votes;
	int items = 0;

	for (int x : vec) {
		
		if (x >= minimumVote)  items++;

	}

	if (items >= m) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
//@source : 
//@create : 15:15:59 Tuesday 30/06/2020
//@author : nghethuat102
//@status : 
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int pos;
    for (int i = 1; i <= 5; ++i) {
        int x;
        cin >> x;
        if (x == 0) {
            pos = i;
        }
    }
    cout << pos << "\n";
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    while (t--) {
        solve();
    }
 //   cerr << fixed << setprecision(5) << double(clock()) * 1000 / CLOCKS_PER_SEC << " ms\n";
    return 0;
}

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

using namespace std;

#define sp << " " <<
#define mod 1000000007

/*mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long long dice()
{
    uniform_int_distribution<long long> uid(1,2);//specify l and r.
    return uid(rng) ;
}

int read()
{
       int cc = getc(stdin);
       for (;cc < '0' || cc > '9';)  cc = getc(stdin);
       int ret = 0;
       for (;cc >= '0' && cc <= '9';)
       {
          ret = ret * 10 + cc - '0';
          cc = getc(stdin);
       }
      return ret;
}

inline void print(int n)
{
  if (n == 0)
  {
    putchar('0');
    putchar('\n');
  }
  else if (n == -1)
  {
    putchar('-');
    putchar('1');
    putchar('\n');
  }
  else
  {
    char buf[11];
    buf[10] = '\n';
    int i = 9;
    while (n)
    {
      buf[i--] = n % 10 + '0';
      n /= 10;
    }
    while (buf[i] != '\n')
      putchar(buf[++i]);
  }
}
*/

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b&&b==c)
        cout << "Yes";
    else
        cout << "No";
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	void solve(Supplier<String> sc) {
		int L = Integer.parseInt(sc.get());
		int R = Integer.parseInt(sc.get());
		int D = Integer.parseInt(sc.get());
		var l = (L - 1) / D;
		var r = R / D;
		System.out.println(r - l);
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		new Solver().solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 32712
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int mx = *max_element(A.begin(), A.end());
    if (count(A.begin(), A.end(), mx) == 1) {
        int second = 0;
        rep(i, N) {
            if (A[i] == mx) continue;
            if (A[i] > second) second = A[i];
        }
        rep(i, N) {
            if (A[i] == mx) printf("%d\n", second);
            else printf("%d\n", mx);
        }
    } else {
        rep(i, N) printf("%d\n", mx);
    }
    return 0;
}

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


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long int n,d,cnt=0;
    cin>>n>>d;
    while(n--){
        long long int a,b;
        cin>>a>>b;
        double result;
        result=(double)sqrt(pow(a,2)+pow(b,2));
        if(result<=d)
            cnt++;
    }
    cout<<cnt;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;

int main(){
int X;
  cin>>X;
int ans=0;

  ans=X/200;
  
  ans=10-ans;
     cout<<ans<<endl;

  
}


Measured memory_bytes: 3632
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  int n,m;
  scanf("%d%d",&n,&m);
  vi d(n);
  rep(i,m) {
    int a,b;
    scanf("%d%d",&a,&b);
    --a; --b;
    d[a] ^= 1;
    d[b] ^= 1;
  }
  int ans = 0;
  rep(i,n) ans += d[i];
  if (ans > 1) puts("NO");
  else puts("YES");
  return 0;
}






















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

using namespace std;

#define Fast  ios::sync_with_stdio(false); cin.tie(0)
#define pb push_back
#define pf push_front
#define pp pop
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define S second
#define F first
typedef long long ll;
const ll mod = 1e9 + 7;
const ll N = 1e6 + 5;
ll inf = 1e18;

ll a[N];
ll sm[N];

int main(){

    Fast;

    ll n;
    cin >> n;

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

    sm[n-1] = a[n-1];

    for(int i = n-2; i >= 0 ; i --){
        sm[i] = a[i] + sm[i+1];
        sm[i] %= mod;
    }

    ll ans = 0;

    for(int i = 0 ; i < n-1 ;i ++){
        ans += a[i] * sm[i+1];
        ans %= mod;
    }

    cout << ans ;



    return 0;
}


Measured memory_bytes: 6788
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
	int i,n,num[100];
	scanf("%d", &n);
	for (i = 0; i < n;i++) {
		scanf("%d", &num[i]);
	}

	for (i = n-1; i >= 0; i--) {
		printf("%d", num[i]);
		if (i != 0) {
			printf(" ");
		}
	}
	printf("\n");
}

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


int main(void){

    int W,H;
    int N;
    cin >> W >> H >>N;
    // int型の2次元配列(H×W要素)の宣言 初期値0
    vector<vector<int>> map(H, vector<int>(W,0));
    int cnt = 0;
    int x, y, a;
    for(int i=0; i<N;i++){
        cin >> x >> y >> a;

        if(a == 1){
            for(int l=0; l<H; l++){
                for(int m=0; m<W; m++){
                    if(m<x){
                        map[l][m] = 1;
                    }
                }
            }
        }

        if(a == 2){
            for(int l=0; l<H; l++){
                for(int m=0; m<W; m++){
                    if(m>=x){
                        map[l][m] = 1;

                    }

                }
            }
        }

        if(a == 3){
            for(int l=0; l<H; l++){
                for(int m=0; m<W; m++){
                    if(l<y){
                        map[l][m] = 1;

                    }

                }
            }
        }

        if(a == 4){
            for(int l=0; l<H; l++){
                for(int m=0; m<W; m++){
                    if(l>=y){
                        map[l][m] = 1;

                    }

                }
            }
        }


    }

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(map[i][j]==0){
                cnt++;
            }
            //cout << map[i][j];
        }
        //cout << endl;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
while(1):
    [a,b,c]=[int(x) for x in raw_input().split()]
    if a==0:
        break
    else:
        quality=[2 for x in range(a+b+c+1)]
        N=int(raw_input())
        test=[]
        for i in range(N):
            test.append([int(x) for x in raw_input().split()])
        for t in test:
            if t[3]:
               for x in t[:3]:
                   quality[x]=1
        for t in test:
            qcheck=[quality[x] for x in t[:3]]
            if qcheck==[1,1,2]:
                quality[t[2]]=0
            elif qcheck==[1,2,1]:
                quality[t[1]]=0
            elif qcheck==[2,1,1]:
                quality[t[0]]=0               
        for q in quality[1:]:
            print q

Measured memory_bytes: 4332
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp93 {
    class Program {
        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());

            List<List<int>> F = new List<List<int>>();
            for (int i = 0; i < N; i++) {
                F.Add(Console.ReadLine().Split().Select(int.Parse).ToList());
            }

            List<List<int>> P = new List<List<int>>();
            for (int i = 0; i < N; i++) {
                P.Add(Console.ReadLine().Split().Select(int.Parse).ToList());
            }

            int max = -1000000001;

            for (int s = 0; s < (1 << 10); s++) {
                if (s == 0) {
                    continue;
                }

                int ans = 0;

                for (int shop = 0; shop < N; shop++) {
                    int cnt = 0;
                    for (int i = 0; i < 10; i++) {
                        if ((s & (1 << i)) != 0 && F[shop][i] != 0) {
                            cnt++;
                        } else {

                        }
                    }

                    ans += P[shop][cnt];
                }


                max = Math.Max(max, ans);
            }

            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 13396
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}


int main(){
    multiset<int> S;
    int q; cin >> q;
    REP(i, q){
        int op, x, y, cnt = 0; cin >> op >> x;
        switch(op){
            case 0:
                S.insert(x);
                cout << S.size() << endl;
                break;
            case 1:
                for(auto itr = S.lower_bound(x); itr != S.end(); ++itr){
                    if(*itr == x) ++cnt;
                    else break;
                }
                cout << cnt << "\n";
                break;
            case 2:
                S.erase(x);
                break;
            case 3:
                cin >> y;
                for(auto itr = S.lower_bound(x); itr != S.end(); ++itr){
                    if(x <= *itr && *itr <= y)
                        cout << *itr << "\n";
                    if(y < *itr)
                        break;
                }
        }
    }
    return 0;
}



Measured memory_bytes: 12284
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int ans=max(a,b);
    if(a>b)
    a--;
    else
    b--;
    ans=ans+max(a,b);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main() {
  int N;
  std::cin >> N;
  
  int a[N];
  for (int i=0; i<N; i++) std::cin >> a[i];
  
  int ans = 0;
  
  for (int i=0; i<N; i++) {
    while (a[i] % 2 == 0) {
      a[i] /= 2;
      ans++;
    }
  }
  
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  a.emplace(a.begin(),0);
  a.emplace_back(0);
  Int ans=0;
  for(Int i=1;i<(Int)a.size();i++)
    ans+=abs(a[i]-a[i-1]);
  for(Int i=1;i<=n;i++){
    cout<<ans-(abs(a[i]-a[i-1])+abs(a[i]-a[i+1]))+abs(a[i+1]-a[i-1])<<endl;
  }
  return 0;
}


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

using namespace std;
using ll = long long;

constexpr int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> a(100);
  double p = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    p += a[i];
  }
  p /= n;
  double mi = 1e9;
  int ans;
  for (int i = 0; i < n; ++i) {
    if (mi > abs(p - a[i])) {
      ans = i;
      mi = abs(p - a[i]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
S=input()
T=input()
SL=len(S)
TL=len(T)

def match(x,y):
  c=0
  for i in range(TL):
    if x[i]==y[i]:
      c+=1
  return c

max_match=0
for j in range(SL-TL+1):
  m=match(S[j:],T)
  max_match=max(max_match,m)

print("{}".format(TL-max_match))

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, d;
    cin >> n >> d;
    int x[n][d];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < d; j++)
        {
            cin >> x[i][j];
        }
    }
    int sum, cnt = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            sum = 0;
            for (int k = 0; k < d; k++)
            {
                sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            for (int k = 0; k <= 1000; k++)
            {
                if (k * k == sum)
                    cnt++;
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(usize));
    }
    
    let h = get!();
    let w = get!();
    let a = get!();
    let b = get!();
    
    let mut ans = vec![];
    for i in 0 .. h {
        if i < b {
            let mut s = vec![b'0'; w];
            for j in 0 .. a {
                s[j] = b'1';
            }
            let s = String::from_utf8(s).unwrap();
            ans.push(s);
        } else {
            let mut s = vec![b'1'; w];
            for j in 0 .. a {
                s[j] = b'0';
            }
            let s = String::from_utf8(s).unwrap();
            ans.push(s);
        }
    }
    for i in 0 .. h {
        println!("{}", ans[i]);
    }
}

Measured memory_bytes: 5244
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  var a = lines[0]
  var b = lines[1]
  console.log(6 - a - b)
});

Measured memory_bytes: 21320
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Random;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		PrintWriter pw=new PrintWriter(System.out);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int T=sc.nextInt();
		pw.println(T/A*B);
		pw.close();
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public int nextInt() {
    	return Integer.parseInt(next());
    }
    
    public long nextLong() {
    	return Long.parseLong(next());
    }
}

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

int main()
{
	int n,i,j;
  	string s ;
  	cin >> n ; 
  	cin >> s ;

  	for(i=0;i<s.length();i++)
  	{
  		s[i] = ( s[i] + n ) ;
  		if(s[i]<='Z') continue;
  		s[i] = s[i] - 'Z' + 'A' - 1 ;
  	}

  	cout << s << endl;



	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <set>
#include <vector>
#include <tuple>
#include <map>
#include <iomanip>
#include <string>
#include <queue>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for (int i = 0; i < (int)n; ++i)
#define loop1(i, n) for (int i = 1; i <= (int)n; ++i)
#define pb push_back
#define pi pair<double, double>
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define ti tuple<int, int, int, int>
#define mkt make_tuple
#define mkp make_pair
#define cerr if (1) cerr

const int N = 507;

int f[N][N];
bool bad[N][N];
pi dx[4] = { {0, 1}, {0, -1}, {-1, 0}, {1, 0} };
 
void bfs(int x, int y, int n) {
    queue <pi> q;
    q.push({ x, y });
    while (!q.empty()) {
        int x = q.front().F, y = q.front().S;
        q.pop();
        loop(i, 4) {
            int nx = x + dx[i].F, ny = y + dx[i].S;
            if (nx < 0 || ny < 0 || nx >= n || ny >= n)
                continue;
            if (f[x][y] + bad[nx][ny] < f[nx][ny]) {
                f[nx][ny] = f[x][y] + bad[nx][ny];
                q.push({ nx, ny });
            }
        }
    }
}

void solve() {
    int n, ans = 0; cin >> n;
    loop(i, n)
        loop(j, n) {
            f[i][j] = min({ i + 1, j + 1, n - i, n - j });
            bad[i][j] = 1;
        }
    loop(kk, n * n) {
        int x; cin >> x; --x;
        ans += f[x / n][x % n] - 1;
        --f[x / n][x % n];
        bad[x / n][x % n] = 0;
        bfs(x / n, x % n, n);
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 4908
n = int(input())
a = list(map(int,input().split()))


def check_1(a):
    
    ##正負正...
    res = 0
    s = 0
    for i in range(n):
        s += a[i]
        if i%2 == 0:
            if s <= 0:
                res += abs(s) + 1
                s = 1
        else:
            if s >= 0:
                res += abs(s) + 1
                s = -1
    return res

def check_2(a):
    ##負正負...
    res = 0
    s = 0
    for i in range(n):
        s += a[i]
        if i%2 == 0:
            if s >= 0:
                res += abs(s)+ 1
                s = -1
        else:
            if s <= 0:
                res += abs(s) + 1 
                s = 1
    return res

b = a[:]
print(min(check_1(a),check_2(b)))

Measured memory_bytes: 14468
#include <stdio.h>

int main(void)
{
	int a[4][13] = {0};
	int b,d,e;
	char c;
	
	scanf("%d",&b);
	
	for(d = 0;d < b;++d){
		scanf(" %c %d",&c,&e);
		if(c == 'S'){
			a[0][e-1] = e;
		}
		else if(c =='H'){
			a[1][e-1] = e;
		}
		else if(c == 'C'){
			a[2][e-1] = e;
		}
		else if(c == 'D'){
			a[3][e-1] = e;
		}
	}
	for(d = 0;d < 4;++d){
		for(b = 0;b < 13;++b){
			if(a[d][b] == 0){
				if(d == 0){
					printf("S %d\n",b+1);
				}
				else if(d == 1){
					printf("H %d\n",b+1);
				}
				else if(d == 2){
					printf("C %d\n",b+1);
				}
				else if(d == 3){
					printf("D %d\n",b+1);
				}
			}
		}
	}
	
	return(0);
}

Measured memory_bytes: 2684