akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <assert.h>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <random>
#include <cmath>
#include <chrono>
#include <bitset>

#define ld long double
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;

const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 20;

bool check(int n, int k, vector<int> a, int x) {
	for (int i = 0; i < n; i++) {
		a[i] %= x;
	}
	sort(all(a));

	int now = 0;
	for (int i = 0; i < n; i++) {
		now += (x - a[i]) % x;
	}

	int y = 0;
	for (int i = 0; i < n; i++) {
		if (y == now) {
			return y <= k;
		}
		y += a[i];
		now -= (x - a[i]) % x;
	}
	return false;
}

void solve() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	int ans = 0;
	for (int d = 1; d * d <= sum; d++) {
		if (sum % d == 0) {
			if (check(n, k, a, d)) ans = max(ans, d);
			if (check(n, k, a, sum / d)) ans = max(ans, sum / d);
		}
	}
	cout << ans;
}
signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(12);
	solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;

//最大公約数
int gcd(int a,int b){
    return b ? gcd(b,a%b):a;
}

//最小公倍数
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

//素数判定
bool isPrime(int x){
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

//桁ごとの足し算
int digsum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

//約数列挙
vector<int> enum_div(int n){
    vector<int> ret;
    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i !=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

//累乗の計算とあまり,0で累乗そのまま出力
long long modpow(long long a,long long n,long long mod){
    if(mod==0)mod=__LONG_LONG_MAX__;
    long long res=1;
    while(n>0){
        if(n & 1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

string N;
int main(){
    cin>>N;
    ll count=0;
    for(int i=0;i<N.size();++i){
        count+=N[i]-'0';
    }
    if(count%9==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define repeat(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string str;
    cin >> str;
    string str_1 = str;
    int min = str_1.size() + 1;
    int ee = 0;
    rep(i, str.size()){
        if(str[i] == str[0]) ee ++;
    }
    if(ee == str.size()) cout << 0 << endl;
    else{
    rep(i, str_1.size()){
        int rr = 0;
        str = str_1;
        rep(k, str.size()){
            rep(j, str.size() - 1){
                if(str[j + 1] == str[i]) str[j] = str[i];
            }
            rr ++;
            str.erase(str.end() - 1);
            int g = 0;
            rep(j, str.size()){
                if(str[j] == str[i]) g ++;
            }

            if(g == str.size()){
                if(min > rr) min = rr;
                break;
            }
        }
    }
    cout << min << endl;
}}

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 = 100010, M = 1010;

int n;
int v[N];
LL m, x[N], y[N];
LL s[N], f[N], g[N];

int main()
{
	scanf("%d%lld", &n, &m);
	for (int i = 1; i <= n; i ++ )
	{
		scanf("%lld%d", &x[i], &v[i]);
		s[i] = s[i - 1] + v[i];
		f[i] = max(f[i - 1], s[i] - x[i]);
	}
	for (int i = n; i >= 1; i -- )
	{
		y[i] = m - x[i];
		s[i] = s[i + 1] + v[i];
		g[i] = max(g[i + 1], s[i] - y[i]);
	}
	
	LL res = 0;
	for (int i = 1; i <= n; i ++ )
	{
		res = max(res, f[i]);
		res = max(res, f[i] + g[i + 1] - x[i]);
	}
	for (int i = n; i >= 1; i -- )
	{
		res = max(res, g[i]);
		res = max(res, f[i - 1] + g[i] - y[i]);
	}
	
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
const int mod = 1e9 + 7, N = 2e6 + 5;
int x, y;
ll fact[N], inv[N];
ll fp(ll base, ll exp){
    if (exp == 0) return 1;
    ll ans = fp(base, exp / 2);
    if (exp % 2 == 0) return (ans * ans) % mod;
    else return (((ans * ans)% mod) * base)% mod;
}
void calcFacAndInv(){
    fact[0] = inv[0] = 1;
    for (ll i = 1; i <= N; i++){
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = fp(fact[i], mod - 2);
    }
}
ll ncr(ll n, ll r){
    if(n - r < 0){
        cout << 0;
        exit(0);
    }
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}
int main()
{
    Hello
    calcFacAndInv();
    cin >> x >> y;
    if((x + y) % 3 || (2 * x - y) < 0) cout << 0;
    else cout << ncr((x + y)/3, (2 * x - y)/3);
    return 0;
}


Measured memory_bytes: 34896
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i=0; i<N; i++) cin >> A[i];

    map<long long, long long> mp;
    for(int i=0; i<N; i++){
        mp[A[i]]++;
    }
    long long ans = 0;

    vector<long long> v;
    for(auto x=mp.rbegin(); x!=mp.rend(); x++)
        v.push_back(x->first);

    for(auto x : v){
        long long val = x;
        long long cnt = mp[x];
        if(cnt == 0) continue;
        if(__builtin_popcount(val) == 1){
            ans += cnt / 2;
            if(cnt % 2 == 0) continue;
            else mp[x] = 1;
        }

        for(long long i=31; i>=1; i--){
            long long b = (1LL<<i) - val;
            if(b == val) continue;
            if(b < 0) continue;
            if(mp[b] > 0){
                long long tmp = min(mp[b], mp[x]);
                mp[b] -= tmp;
                mp[x] -= tmp;
                ans += tmp;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 54256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
 
public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final char[] input = sc.next().toCharArray();
		
		final int limit = input.length - 1;
		
		long answer = 0;
		for(int bit = 0; bit < (1 << limit); bit++){
			StringBuilder sb = new StringBuilder();
			
			long sum = 0;
			
			for(int pos = 0; pos < input.length; pos++){
				sb.append(input[pos]);
				
				if((bit & (1 << pos)) != 0){
					sum += Long.parseLong(sb.toString());
					sb.setLength(0);
				}
			}
			
			if(sb.length() != 0){
				sum += Long.parseLong(sb.toString());
			}
			
			answer += sum;
		}
		
		System.out.println(answer);
		
	}
 
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}	
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 8660
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n; string s;
    cin>>n;cin>>s;
    int r_no=0; for(int i=0;i<n;i++) if(s[i]=='R') r_no++;
    int ans=0; for(int i=0;i<r_no;i++) if(s[i]!='R') ans++;
    cout<<ans<<"\n";
}

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

    solve();
    return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <string>

using namespace std;

#define FOR(i,a,b) for(int i=int(a);i<int(b);++i)
#define RFOR(i,a,b) for(int i=int(b)-1;i>=int(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)

int main()
{
    string str, m_str;
    int m, h, l;
    while (cin >> str) {
        if (str == "-") break;
        cin >> m;
        REP(i,m) {
            cin >> h;
            m_str = str.substr(0, h);
            str.erase(0, h);
            str += m_str;
        }
        cout << str << endl;
    }
    return 0;
}



Measured memory_bytes: 3196
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){r(1)(r(2).readFileSync("/dev/stdin","UTF-8"))},function(e,t){e.exports=function(e){for(var t=e.split("\n"),r=Number(t[0]),n=t[1].split(" ").map(function(e){return Number(e)}),o=0,u=0;u<r;u++){var i=9999999;u<r-1&&(i=n[u]),u>0&&(i=Math.min(i,n[u-1])),o+=i}console.log(o)}},function(e,t){e.exports=require("fs")}]);

Measured memory_bytes: 21064
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#define N 1000
using namespace std;
int n,M[N],D[N],h[N],m[N],p[N],f,f2,s,sum,ans;
char e[N];
vector<int> v[N];

int Getminute(int a,int b){
  return (h[b]*60+m[b])-(h[a]*60+m[a]);
}

int main(){
  while(1){
    cin>>n;
    if(!n) break;
    for(int i=0;i<n;i++){
      scanf("%d/%d %d:%d %c %d",&M[i],&D[i],&h[i],&m[i],&e[i],&p[i]);
      if(!p[i])
	for(int j=0;j<N;j++) v[j].push_back(i);
      else v[p[i]].push_back(i);
    }
    ans=0;
    for(int i=0;i<N;i++){
      s=f=f2=sum=0;
      for(int j=0;j<v[i].size();j++){
	int x=v[i][j];
	if(!p[x]&&e[x]=='I') f=1,s=x;
	if(!p[x]&&e[x]=='O'){
	  if(f2) sum+=Getminute(s,x);
	  f=0;
	}
	if(p[x]&&e[x]=='I') f2=1,s=x;
	if(p[x]&&e[x]=='O'){
	  if(f) sum+=Getminute(s,x);
	  f2=0;
	}
      }
      ans=max(ans,sum);
    }
    cout<<ans<<endl;
    for(int i=0;i<N;i++) v[i].clear();
  }
  return 0;
}

Measured memory_bytes: 5332
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<random>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const ll Mod=1000000007;
short gh[2][4] = { {0,0,-1,1},{-1,1,0,0} };
struct P {
ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
ll to, cost;
};
struct S {//辺の情報を入れる変数
int from, to, cost;
};
struct H {
int x, y;
};
bool operator<(H a, H b) {
if (a.x != b.x) return a.x < b.x;
return a.y < b.y;
}
ll gcm(ll i, ll j) {//最大公約数
if (i > j) swap(i, j);
if (i == 0) return j;
return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
if (b <= c || d <= a) return 0;
return 1;
}//[a,b),[c,d)
ll mod_pow(ll x,ll n,ll p){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%p;
        x=x*x%p;
        n>>=1;
    }
    return res;
}
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int a,b;
signed main() {
	cin>>a>>b;
	if(a*b%2==1){
		cout<<"Odd"<<endl;
	}
	else{
		cout<<"Even"<<endl;
	}
    getchar(); getchar();
}


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

using namespace std;

void solve()
{
	int N;
	cin >> N;
	vector<long> as(N), bs(N), ds(N);
	for (int i = 0; i < N; i++) cin >> as[i];
	for (int i = 0; i < N; i++) cin >> bs[i];
	for (int i = 0; i < N; i++)
	{
		ds[i] = as[i] - bs[i];
	}
	//sort(ps.begin(), ps.end());
	sort(ds.begin(), ds.end());

	int l = 0, r = N - 1;
	bitset<100010> used;
	while (l < r)
	{
		if (ds[l] >= 0) break;
		if (ds[r] < 0)
		{
			cout << -1 << endl;
			return;
		}
		long x = min(ds[r], -ds[l]);
		ds[r] -= x;
		ds[l] += x;
		used[l] = used[r] = 1;
		if (ds[l] < 0)
		{
			r--;
		}
		else if (ds[r] > 0)
		{
			l++;
		}
		else
		{
			l++;
			r--;
		}
		//cout << l << ' ' << r << endl;
	}

	if (ds[r] < 0)
	{
		cout << -1 << endl;
		return;
	}

	cout << used.count() << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main(){
    lli n,k;
    cin >> n >> k;
    vector<lli> pos, neg;
    lli zero = 0;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if(a == 0) zero++;
        else if(a > 0) pos.push_back(a);
        else if(a < 0) neg.push_back(-a);
    }
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());

    lli lb=-2e18, ub=2e18;
    while(lb+1 < ub){
        lli mid = (lb+ub)/2;
        lli count = 0;
        if(mid < 0){
            for(lli x: pos){
                count += neg.end() -lower_bound(neg.begin(), neg.end(), (-mid+x-1)/x);
            }
        }else{
            lli ps=pos.size(), ns=neg.size();
            count += ps*ns +zero*(ps+ns) +zero*(zero-1)/2;
            for(int i=0; i<(int)pos.size(); i++){
                int idx = upper_bound(pos.begin(), pos.end(), mid/pos[i]) -pos.begin();
                count += max(0, min(idx, i));
            }
            for(int i=0; i<(int)neg.size(); i++){
                int idx = upper_bound(neg.begin(), neg.end(), mid/neg[i]) -neg.begin();
                count += max(0, min(idx, i));
            }
        }
        if(count < k){
            lb = mid;
        }else{
            ub = mid;
        }
    }
    cout << ub << endl;
    return 0;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std ;
int bcj[2510] ;
int father( int x ){
    return bcj[x] == x ? x : bcj[x] = father( bcj[x] ) ;
}
void join( int x , int y ){
    int fx = father( x ) ;
    int fy = father( y ) ;
    if ( fx != fy ) bcj[fy] = fx ;
}
char s[55][55] ;
int d[2510] ;
int main(){
    int h , w ;
    cin >> h >> w ;
    for( int i = 0 ; i < h ; i++ )
        scanf( "%s" , s[i] ) ;
    for( int i = 0 ; i < h * w ; i++ )
        bcj[i] = i ;
    for( int i = 0 ; i < h ; i++ )
        for( int j = 0 ; j < w ; j++ ){
            if ( j != w - 1 && s[i][j] == '#' && s[i][j + 1] == '#' ){
                int p1 = i * w + j ;
                int p2 = i * w + j + 1 ;
                join( p1 , p2 ) ;
            }
            if ( i != h - 1 && s[i][j] == '#' && s[i + 1][j] == '#' ){
                int p1 = i * w + j ;
                int p2 = ( i + 1 ) * w + j ;
                join( p1 , p2 ) ;
            }
    }
    for( int i = 0 ; i < h ; i++ )
        for( int j = 0 ; j < w ; j++ ){
            if ( s[i][j] == '#' ){
                int p = i * w + j ;
                d[father(p)]++ ;
            }
        }
    bool flag = true ;
    for( int i = 0 ; i < h * w ; i++ )
        if ( d[i] == 1 ) flag = false ;
    if ( flag ) cout << "Yes" << endl ;
    else cout << "No" << endl ;
    return 0 ;
}

Measured memory_bytes: 256
from sys import exit
def main():
  N = int(input())
  S = input()
  middle = int(N / 2)
  
  if middle == 0 or N % 2 != 0:
    print('No')
    exit()
  
  for i in range(middle):
    if S[i] != S[i + middle]:
      print('No')
      exit()
  
  print('Yes')
  
main()

Measured memory_bytes: 9160
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
using namespace std;
main()
{
    int n,l,i;
    string s,p;
    vector<string>v;
    cin>>n>>l;
    for(i=0;i<n;i++)
    {
        cin>>s;
        v.pb(s);
    }
    sort(v.begin(),v.end());
    for(i=0;i<v.size();i++)
        p+=v[i];
    cout<<p;
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

vector<int> match;
vector<bool> seen;
template<class G>
bool find(int j, G &g) {
	if (match[j] == -1) return 1;
	seen[j] = 1; int di = match[j];
	trav(e, g[di])
		if (!seen[e] && find(e, g)) {
			match[e] = di;
			match[j] = -1;
			return 1;
		}
	return 0;
}
template<class G>
int dfs_matching(G &g, int n, int m) {
	match.assign(m, -1);
	rep(i,0,n) {
		seen.assign(m, false);
		trav(j,g[i])
			if (find(j, g)) {
				match[j] = i;
				break;
			}
	}
	return m - count(all(match), -1);
}

const ll big = 1000000007;
const ll mod = 998244353;
ll n,k,m;
ll T;

vector<vi> C(101, vi());

vi X1;
vi Y1;
vi X2;
vi Y2;

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);
    ll a,b,c,d,e;

    cin >> n;

    for(int c1 = 0; c1 < n; c1++){
        cin >> a >> b;
        X1.push_back(a);
        Y1.push_back(b);
    }
    for(int c1 = 0; c1 < n; c1++){
        cin >> a >> b;
        for(int c2 = 0; c2 < n; c2++){
            if(X1[c2] < a && Y1[c2] < b){
                C[c2].push_back(c1);
            }
        }
    }
    cout << dfs_matching(C,n,n) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n,x,x1,x2,x3,flag=0;
	
	scanf("%d",&n);
	
	//10で割った余りがx桁目
	x1 = n % 10;
	if(x1 == 7)	flag =1;
	
		x = n / 10;
//		printf("%d\t",x);

	
	x2 = x % 10;
	if(x2 == 7)	flag =1;
	
		x = x / 10;
//		printf("%d\t",x);

	
	x3 = x %10;
	if(x3 == 7)	flag =1;
	
	if(flag==1){
		printf("Yes");
	}
	else printf("No");
	
	return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N;
	cin >> N;

	set<int> s;
	for(int i = 0; i < N; i++){
		int a;
		cin >> a;
		if(s.count(a)) s.erase(a);
		else s.insert(a);
	}

	cout << s.size() << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

int main() {
	int n;
	cin >> n;
	if ((n - n % 100)/100 == n % 10)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using graph = vector<vector<long long int>>;
using wgraph = vector<vector<pair<long long int, long long int>>>;
long long int INF = 1001001001001001LL;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;
long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define rep(i,n) for(long long int i = 0; i < (n); i++)
#define rrep(i,n) for(long long int i = 1; i <= (n); i++)
#define drep(i,n) for(long long int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for(long long int i = s; i < t; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

int main(){
  
  set<int> odd;
  set<int> even;
  odd.insert('R');
  odd.insert('U');
  odd.insert('D');

  even.insert('L');
  even.insert('U');
  even.insert('D');

  string s; cin >> s;
  for(int i = 0; i < s.size(); i++) {
    if(i % 2 == 0) {
      if(odd.find(s[i]) == odd.end()) {
        cout << "No" << endl;
        return 0;
      }
    }else {
      if(even.find(s[i]) == even.end()) {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;

  return 0;
}


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

int main(void){
    string s;
    cin>>s;
    int now=0;
    int maxnum=0;
    rep(i, s.size()){
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T') {
            now++;
            maxnum=max(maxnum, now);
        }
        else {
            maxnum=max(maxnum, now);
            now=0;
        }
    }
    cout<<maxnum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e18
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  int n; ll k;  cin >> n >> k;
  vector<pair<int,int> > p(n);
  vi cnt(n+1);
  rep0(i,n){
    cin >> p[i].first >> p[i].second;
  }

  sort(all(p));
  rep0(i,n){
    cnt[i+1] = cnt[i]+p[i].second;
  }

  /*rep0(i,n){
    if(cnt[i+1] > k){
      cout << p[i].first << endl;
      return 0;
    }
  }*/
  rep0(i,n){
    if(p[i].second < k){
      k-=p[i].second;
    }else{
      cout << p[i].first;
      return 0;
    }
  }
}


Measured memory_bytes: 1408
#include<stdio.h>

int main(void){
  long long int N,A,B;
  long long int i;
  long long int h[100000];
  long long int K;
  long long int left,right;
  long long int sum;

  scanf("%lld %lld %lld",&N,&A,&B);
  //printf("%d\n", N);

  for(i=0;i<N;++i){
    scanf("%lld",&h[i]);
  }

  left=0;
  right=1000000000;

  while(left!=right-1){
    K=(right+left)/2;
    sum=0;
    for(i=0;i<N;i++){
      if(h[i]-K*B > 0){
        // sum += (h[i]-K*B)%(A-B) ? (h[i]-B*K)/(A-B)+1 : (h[i]-B*K)/(A-B);
        if((h[i]-K*B)%(A-B)==0){
          sum += (h[i]-B*K)/(A-B);
        }else{
          sum += (h[i]-B*K)/(A-B)+1;
        }
      }
    }
    if(sum <= K){
      right=(right+left)/2;
    }else{
      left=(right+left)/2;
    }
  }

  printf("%lld\n", right);

  return 0;
}


Measured memory_bytes: 896
package main

import (
	"fmt"
)

func trace(A []int, N int) {
	for i := 0; i < N; i++ {
		if i > 0 {
			fmt.Printf(" ")
		}
		fmt.Printf("%d", A[i])
	}
	fmt.Printf("\n")
}

func bubbleSort(A []int, N int) {
	exchangeCount := 0
	flag := true
	for flag {
		flag = false
		for j := N - 1; j > 0; j-- {
			if A[j] < A[j-1] {
				A[j], A[j-1] = A[j-1], A[j]
				exchangeCount++
				flag = true
			}
		}
	}
	trace(A, N)
	fmt.Println(exchangeCount)
}

func main() {
	var length int
	fmt.Scanf("%d", &length)

	array := make([]int, length)
	for i := 0; i < length; i++ {
		fmt.Scanf("%d", &array[i])
	}
	bubbleSort(array, length)
}



Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
int N=1000;
int lcs(string x,string  y){
    int c[N+1][N+1];
    int m=x.size();
    int n=y.size();
    int maxl=0;
    x=' '+x;
    y=' '+y;
    for(int i=0;i<=m;i++) c[i][0]=0;
    for(int j=1;j<=n;j++) c[0][j]=0;
    
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if(x[i]==y[j]){
                c[i][j]=c[i-1][j-1]+1;
            }
            else{
                c[i][j]=max(c[i-1][j],c[i][j-1]);
            }
            maxl=max(maxl,c[i][j]);
        }
    }
    return maxl;
}
int main(){
    string  s1,s2;
    int n; cin>>n;
    for(int i=0;i<n;i++){
        cin>>s1>>s2;
        cout<<lcs(s1,s2)<<'\n';
    }
    return 0;
}



Measured memory_bytes: 7124
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST

main = do
  n <- readLn :: IO Int
  let n' = n-1
  print $ max 0 (n' * (n'+1) `div` 2)


Measured memory_bytes: 508
using System;

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var sL = s.Length;
        if (sL == 1) Console.WriteLine(1);
        else if (sL == 2) Console.WriteLine(check2(s));
        else
        {
            var a = sL / 2;
            if (sL % 2 == 0) Console.WriteLine(a + check0(s, a));
            else Console.WriteLine((sL + check1(s, a)) / 2);
        }
    }
    static int check2(string s) => s[0] == s[1] ? 2 : 1;
    static int check1(string s, int a)
    {
        var s0 = s[a];
        var count = 1;
        for (int i = 1; i <= a; i++)
        {
            if (s[a - i] == s0 && s[a + i] == s0) count += 2;
            else return count;
        }
        return count;

    }
    static int check0(string s, int a)
    {
        if (s[a - 1] != s[a]) return 0;
        var s0 = s[a - 1];
        var count = 1;
        for (int i = 1; i < a; i++)
        {
            if (s[a + i] == s0 && s[a - 1 - i] == s0) count++;
            else return count;
        }
        return count;
    }
}


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

int main()
{
    int num = 1299711, prime_num, k;
    num = (num - 3) / 2;
    vector<bool> prime_list(num, true);
    vector<int> primes(1, 2);
    for (int i = 0; i < num; ++i) {
        if (prime_list[i]) {
            prime_num = i + i + 3;
            primes.push_back(prime_num);
            for (int j = i + prime_num; j < num; j += prime_num)
                prime_list[j] = false;
        }
    }
    while (cin >> k, k) {
        for (int i = 0; i < primes.size(); ++i) {
            if (primes[i] == k) {
                cout << 0 << endl;
                break;
            } else if (primes[i] > k) {
                cout << primes[i] - primes[i - 1] << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1792
H,W,K = list(map(int,input().split()))


amida = [0 for i in range(8)]
amida[0]=1
amida[1]=2
amida[2]=3
amida[3]=5
amida[4]=8
amida[5]=13
amida[6]=21
amida[7]=34

def amida_num(k,l):
    return amida[max(k,0)]*amida[max(l,0)]


dp=[[0 for i in range(W)] for j in range(H+1)]

dp[0][0] = 1

if W!=1:
    for i in range(1,H+1):
        for j in range(W):
            if j==0:
                dp[i][j]=dp[i-1][j+1]*amida_num(0,W-3) + dp[i-1][j]* amida_num(0,W-2)
            elif j==W-1:
                dp[i][j]=dp[i-1][j-1]*amida_num(0,W-3) + dp[i-1][j]* amida_num(0,W-2)
            else:
                dp[i][j]=dp[i-1][j-1]*amida_num(j-2,W-j-2) + dp[i-1][j]*amida_num(j-1,W-j-2) + dp[i-1][j+1]*amida_num(j-1,W-j-3)
    print(dp[H][K-1]%(10**9+7))
else:
    print(1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<pii>>;
const int MOD = 1e9 + 7;

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

    int N, M, lim, ans = 1;
    cin >> N >> M;

    lim = M / N;
    for (int i = 1; i * i <= M && i <= lim; ++i) {
        if (M % i == 0) {
            ans = max(ans, i);
            if (M / i <= lim)
                ans = max(ans, M / i);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// 5/24
// 過去問ガリガリ
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main() {
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
}


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
	int n,k;
	cin>>n>>k;
	vi arr(n);
	rep(i,0,n)cin>>arr[i];
	vector<int>dp(n,INT_MAX);
	dp[0]=0;
	//dp[1]=abs(arr[0]-arr[1]);
	for (int i=0;i<n;i++){
		for (int j=1;j<=k;j++){
			if (i+j<=n-1){
				dp[i+j]=min(dp[i+j],dp[i]+abs(arr[i]-arr[i+j]));
			}
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

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


int main() {
    int N, M;
    cin >> N >> M;
    vector<int> x(M), y(M);
    rep(i,M) {
        cin >> x.at(i) >> y.at(i);
        --x.at(i);
        --y.at(i);
    }
    vector<int> num(N, 1);
    vector<bool> ans(N, false);
    ans.at(0) = true; 
    rep(i,M) {
        if (ans.at(x.at(i)) == true) {
            ans.at(y.at(i)) = true;
            if (num.at(x.at(i)) == 1) ans.at(x.at(i)) = false;
        }
        --num.at(x.at(i));
        ++num.at(y.at(i));
    }
    cout << count(ans.begin(), ans.end(), true) << endl;
}


Measured memory_bytes: 4436
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		List<String> input = Arrays.asList(sc.nextLine().split(" "));
		int[] inputNum = input.stream().mapToInt(in -> Integer.parseInt(in)).toArray();
		int sa = inputNum[1] - inputNum[0];
		int tall = 0;
		for (int i = 1; i <= sa; i++) {
			tall += i;
		}
		System.out.println(tall - inputNum[1]);
		sc.close();

	}
}


Measured memory_bytes: 26964
#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 main()
{
	int n;
	read(n);
	printf("%.10lf",1-(n/2)*1.0/n);
	return 0;
}









Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    string ans;
    ll n;
    cin >> n;
    while(n){
        ll now=n%26;
        now--;
        now+=26;
        now=now%26;
        char c='a'+now;
        ans+=c;
        if(n==26) break;
        n=(n-1)/26;
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;

    return 0;
}











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

int h;

int parent(int i){
  return i / 2;
}

int left(int i){
  return 2 * i;
}

int right(int i){
  return 2 * i + 1;
}

void maxHeapify(int *A, int i){
  int l, r, largest;

  l = left(i);
  r = right(i);

  if(l <= h && A[l] > A[i]) largest = l;
  else largest = i;

  if(r <= h && A[r] > A[largest]) largest = r;

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

int heapExtractMax(int *A){
  if(h < 1) return -1;

  int max = A[1];
  A[1] = A[h];
  h--;
  maxHeapify(A, 1); //rebuilding a max-Heap

  return max;
}

void heapIncreaseKey(int *A, int i, int key){
  if(key < A[i]) return ;

  //inset new value into the poper place
  A[i] = key;
  while(i > 1 && A[parent(i)] < A[i]){
    swap(A[i], A[parent(i)]);
    i = parent(i);
  }
}

void maxHeapInsert(int *A, int key){
  h++; //size up
  A[h] = -1;
  heapIncreaseKey(A, h, key);
}

int main(){

  int k, a[2000010];
  string command;

  //input
  while(cin >> command, command != "end"){
    if(command == "insert"){
      cin >> k;
      maxHeapInsert(a, k);
    }else if(command == "extract"){
      cout << heapExtractMax(a) << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 6972
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
long long fib(int n){
    //if(n==0) return 0;
    //if(n==1) return 1;
    //return fib(n-1) + fib(n-2);
    double pl = 1+sqrt(5),mi = 1-sqrt(5);
    double l = 1,r = 1;
    REP(i,n) l*=pl/2,r*=mi/2;
    l -= r;
    //l /= 1LL<<1;
    l /= sqrt(5);
    ull res = l;
    return res;
}
int main(){
  int n;
  vector<bitset<7>> seg(10);
  seg[0] = 0b0111111;
  seg[1] = 0b0000110;
  seg[2] = 0b1011011;
  seg[3] = 0b1001111;
  seg[4] = 0b1100110;
  seg[5] = 0b1101101;
  seg[6] = 0b1111101;
  seg[7] = 0b0100111;
  seg[8] = 0b1111111;
  seg[9] = 0b1101111;
  while(cin>>n,n!=-1){
    bitset<7> now;
    REP(i,n){
      int d;
      cin >> d;
      cout << (seg[d]^now) << endl;
      now = seg[d];
    }
  }
}


Measured memory_bytes: 3076
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#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 REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = 1234567;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	int n;
	cin>>n;
	vector<int> v;
	rep(i,n){
		int h;
		cin>>h;
		v.push_back(h);
	}
	sort(all(v));
	double ans = v[0];
	reps(i,v.size()-1){
		ans += v[i];
		ans /= 2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String str = sc.nextLine();

		int cnt = 0;
		char x = str.charAt(0);
		for (int i = 0; i < str.length(); i++) {
			if (i % 2 == 0 && str.charAt(i) != x) {
				cnt++;
			} else if (i % 2 != 0 && str.charAt(i) == x) {
				cnt++;
			}
		}

		System.out.println(cnt);
	}

}

Measured memory_bytes: 28620
#include<bits/stdc++.h>
using namespace std;
int n,k,ans=1;
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		if(ans>k) ans+=k;
		else ans*=2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int[] L = new int[N];
        int[] R = new int[N];
        int cnt = 0;

        for(int i=0; i < N; i++){
            string[] str = Console.ReadLine().Split(' ');
            L[i] = int.Parse(str[0]);
            R[i] = int.Parse(str[1]);
        }

        for(int i=0; i < N; i++){
            if(L[i] == R[i]){
                cnt++;
            }else{
                for(int j = 0; j < R[i] - L[i] + 1; j++){
                    cnt++;
                }
            }
        }
        
        Console.WriteLine(cnt);
    }
}



Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9+7;
typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<bool> vb;
long long int max(long long int a,long long int b){
  if(a>b)
    return a;
  else
    return b;
}
long long int min(long long int a,long long int b){
  if(a<b)
    return a;
  else
    return b;
}
long long int binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
    }
  return res;
}
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}
 
//############################ENDOFTEMPLATE############################
vector<vector<int>> v;
int ans = 0;
int n,m;

void dfs(int i,int j,vi& curr){
  if(j>m)
    return;
  if(i>n)
    return;


  if(i==n){
    //for(auto s:curr)
      //cout<<s<<" ";

    int score = 0;
    for(auto s:v){
      int a = s[0] , b = s[1], c = s[2], d = s[3];
      if(curr[b-1]-curr[a-1]==c)
        score+=d;

    }
    //cout<<score<<endl;
    ans = max(ans,score);
    
    return;
  }

  curr.push_back(j);
  dfs(i+1,j,curr);
  //dfs(i+1,j+1,curr);
  curr.pop_back();
  dfs(i,j+1,curr);


  return;

}

void solve(){
  int q;
  cin>>n>>m>>q;

  v.resize(q,vector<int>(4));

  for(int i = 0;i<q;i++){
    cin>>v[i][0]>>v[i][1]>>v[i][2]>>v[i][3];
  }

  vi curr;
  //for(int i = 1;i<=m;i++)
    dfs(0,1,curr);

  cout<<ans;

}

 
 
 
 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  //freopen("moobuzz.in","r",stdin);
  //freopen("moobuzz.out","w",stdout);
  int t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}

Measured memory_bytes: 3680
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
#include <cmath>
#include <map>
#include <utility>
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int MOD=1e9+7;
int main(){
    int n,m,k;
    cin>>n>>m>>k;
    vector<ll> a(n+1,0),b(m+1,0);
    for(int i=1;i<=n;i++){
        cin>>a[i];
        a[i]=a[i]+a[i-1];
    }
    for(int i=1;i<=m;i++){
        cin>>b[i];
        b[i]=b[i]+b[i-1];
    }
    int ret=0;
    for(int i=0;i<=n;i++){
        if(k<a[i])continue;
        ret=max(ret,(int)(upper_bound(b.begin(),b.end(),(ll)k-a[i])-b.begin()+i-1));
    }
    cout<<ret<<endl;
}


Measured memory_bytes: 6340
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*
s 26
 */
string s;

int main(){
  cin>>s;
  int l = s.size();
  set<int> st;
  REP(i,l){
    st.insert(s[i]);
  }

  if(st.size() == s.size())
    cout<<"yes\n";
  else
    cout<<"no\n";

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
using namespace std;
const int MOD = 2019;
int main() {
  int L, R, m{MOD};
  cin >> L >> R;
  R = min(R - L, MOD);
  L %= MOD;
  for (int i = 0; i < R; ++i)
    for (int j = i; j < R; ++j) m = min(m, (L + i) * (L + j + 1) % MOD);
  cout << m << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

vector<int> ary,aryh;

template <class BifirectionalIterator> bool next_partial_permutation(BifirectionalIterator first,BifirectionalIterator last,int k){
	reverse(first+k,last);
	return next_permutation(first,last);
}

int myp(int x,int y){
	int a;
	a=1;
	for(int i=0;i<y;i++)a*=x;
	return a;
}

int main(){
	int N,K,tmp,ket,hog;
	set<int> s;
	set<int>::iterator it;
	while(1){
		cin>>N>>K;
		ary.clear();
		if(N==0&&K==0) break;
		for(int i=0;i<N;i++){
			cin>>tmp;
			ary.push_back(tmp);
		}
		s.clear();

		sort(ary.begin(),ary.end());
		do{
			
			ket=hog=0;
			for(int i=0;i<K;i++){
				hog+=ary[i]*myp(10,ket);
				//?????????
				if(ary[i]>9){
					ket+=2;
				}
				else{
					ket++;
				}
			}
			s.insert(hog);

		}while(next_partial_permutation(ary.begin(),ary.end(),K));
		//
		/*for(it=s.begin();it!=s.end();it++){
			cout<<*it<<" ";
		}
		cout<<endl;*/
		//
		cout<<s.size()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1332
#include<bits/stdc++.h>
using namespace std;
#define PI 3.14159265
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
static const int INF = 0x3f3f3f3f;
static const long long int INFL = 0x3f3f3f3f3f3f3f3fLL;
const long long int MOD = 1e9+7;
const long long int  mod = 998244353;


int main()
{
    long long int d,t,s;
    cin>>d>>t>>s;
    if( d <= t*s)
        cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3600