akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<limits.h>
#define ll long long
#define modulo 1000000007
using namespace std;
int main()
{
	int n;
	int i,j,k;
	
	cin>>n>>k;
	int a[n+1];
	bool dp[k+1][2];
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(i=1;i<=k;i++)
	{
		dp[i][0] = dp[i][1] = 0;
	}
	
	for(i=1;i<=n;i++)
	{
		dp[a[i]][0] = dp[a[i]][1] = 1;
	}	
	
	for(i=1;i<=k;i++)
	{
		for(j=1;j<=n;j++)
		{
			bool flag = 1;
			if(i >= a[j])
			flag = dp[i - a[j]][1];
			
			if(flag==0)
			{
				dp[i][0] = 1;
				break;
			}
		}
		
		dp[i][1] = dp[i][0];
	}
	
	if(dp[k][0])
	cout<<"First";
	else
	cout<<"Second";
}

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

using namespace std;

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

	if (s == "ABC") {
		cout << "ARC" << endl;
	}
	else {
		cout << "ABC" << endl;
	}

	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

string s;
int main() {
    cin >> s;
    bool aflg = false;
    bool bflg = false;
    bool cflg = false;
    for(int i = 0; i < 3; ++i) {
        if(s.at(i) == 'a') aflg = true;
        if(s.at(i) == 'b') bflg = true;
        if(s.at(i) == 'c') cflg = true;
    }

    if(aflg && bflg && cflg) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, l, r) for (long long int i = l; i < r; i++)
#define MAX 1000001
#define MOD 1000000007

typedef long long int lli;
void swap(lli *a, lli *b)
{
  lli tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}

lli modinv(lli a, lli m)
{
  lli b = m, u = 1, v = 0;
  while (b)
  {
    lli t = a / b;
    a -= t * b;
    swap(&a, &b);
    u -= t * v;
    swap(&u, &v);
  }
  u %= m;
  if (u < 0)
    u += m;
  return u;
}
lli combi(lli n, lli k)
{
  lli ans = 1;
  rep(i, 1, n + 1) ans = ans * i % MOD;
  rep(i, 1, k + 1) ans = ans * modinv(i, MOD) % MOD;
  rep(i, 1, n - k + 1) ans = ans * modinv(i, MOD) % MOD;
  return ans;
}

int main(void)
{
  lli x, y;
  scanf("%lld %lld", &x, &y);
  lli n = (x + y) / 3;
  if ((x + y) % 3 != 0)
  {
    printf("0\n");
    return 0;
  }

  int k = min(x - n, y - n);
  if (k < 0)
  {
    printf("0\n");
    return 0;
  }
  lli ans = combi(n, k);
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#define forn(i, n) for(int i = 0; i < int(n); i++) 
using namespace std;
typedef long long ll;
inline int read() {
    char ch = getchar(); int x = 0, f = 1;
    while(ch < '0' || ch > '9') {
        if(ch == '-') f = -1;
        ch = getchar();
    } while('0' <= ch && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    } return x * f;
}
inline void out(int x)
{
    if(x<0){
    	putchar('-');
		x=-x;
	}
    if(x>9) out(x/10);
    putchar(x%10+'0');
}
int main()
{
	int n=read();
	while(n)
	{
		int temp=n%10;
		if(temp==7) return (cout<<"Yes")&&0;
		n/=10;
	 }
	 cout<<"No";
	return 0;
 } 

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <cmath>
#include <utility>
#define Maxn 100005
#define Maxm 1000005
#define lowbit(x) x&(-x)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define PI acos(-1.0)
#define LL long long 
#define Inf (1LL<<62)
#define inf 0x3f3f3f3f
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
using namespace std;
const int mod=1e9+7;
int main()
{
	//input;output;
	int arr[Maxn<<1],ans[Maxn<<1],n,front,rear;
	while(~scanf("%d",&n))
	{
		front=0;rear=n-1;
		for(int i=0;i<n;i++)
			scanf("%d",arr+i);
		for(int i=n-1;i>=0;i--)
		{
			if((i-(n-1))&1)
				ans[rear--]=arr[i];
			else
				ans[front++]=arr[i];
		}
		for(int i=0;i<n;i++)
			printf("%d%c",ans[i],i==n-1?'\n':' ');
	}
	return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define vc vector<ll>
#define vcs vector<string>
#define vcp vector<pair<ll, ll>>
#define vct vector<tuple<ll, ll, ll>>
using namespace std;
//vector<vector<ll>> vv(n, vector<ll>(n));

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

int main()
{
	string s;
	cin >> s;
	cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
}

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

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long
const int N = 2e5 + 10;
const int MOD = 1e9 + 7;

int fact[N] , inv[N];
int n , w , a , b;

int fastpow(int a , int b){
	int ans = 1;
	a %= MOD;
	while(b){
		if(b&1)
			ans = (ans*a)%MOD;
		b >>= 1;
		a = (a*a)%MOD;
	}
	return ans;
}

void pre(){
	fact[0] = 1;
	for(int i = 1 ; i < N ; ++i){
		fact[i] = (fact[i-1]*i)%MOD;
	}

	for(int i = 0 ; i < N; ++i){
		inv[i] = fastpow(fact[i],MOD-2);
	}
}

int ways(int n , int r){
	return (fact[n+r-2]*(inv[r-1]%MOD * inv[n-1]%MOD)%MOD)%MOD;
}

int32_t main(){
	// boost;
	// cin >> n >> w >> a >> b;
	scanf("%lld%lld%lld%lld",&n,&w,&a,&b);
	pre();

	int out = 0;	
	for(int i = b+1 ; i <= w ; ++i){

		// Number of ways till (1,1) to (n-a , i) * Number of ways the remaining till last ( (a,w-i+1 ))
		out += ((ways(n-a,i)%MOD)*ways(a,w-i+1)%MOD)%MOD;
		out %= MOD;
	}

	// cout << out;
	printf("%lld\n", out);
	return 0;
}// Read my code it is awesome.


Measured memory_bytes: 3328
import math
def isPrime(a):
    if a==2:
        return 1
    d=int(math.sqrt(a)+1)
    for i in range(2,d+1):
        if a%i==0:
            return 0
    return 1

count = 0
n=int(input())
for i in range(n):
    a=int(input())
    #print(isPrime(a))
    if isPrime(a)==1:
        count += 1
print(count)


Measured memory_bytes: 5676
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n,k; cin >> n >> k;
  int x[n];
  REP(i,n) cin >> x[i];

  int ans = INF;
  REP(l,n-k+1) {
    int r = l+k-1;
    int totl = abs(x[l]) + abs(x[r]-x[l]);
    int totr = abs(x[r]) + abs(x[r]-x[l]);
    ans = min(ans, min(totl, totr));
  }
  COUT(ans);
  return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

const int INF = 1e9+7;

void see(vector<int> &dp){
	rep(i,dp.size()) cout << dp[i] << " ";
	cout << endl;
}

int binary_search(vector<int> &dp, int thr){
	int head = 0, tail = dp.size()-1;
	while(tail - head > 1){
		int mid = (head + tail) / 2;
		if(dp[mid] < thr) tail = mid;
		else head = mid;
	}
	if(dp[head] < thr) return head;
	if(dp[tail] < thr) return tail;
	return -1;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	vector<int> dp;
	dp.push_back(a[0]);
	for(int i = 1; i < n; i++){
		int it = binary_search(dp, a[i]);
		if(it > -1) dp[it] = a[i];
		else dp.push_back(a[i]);
	}
	int ans = dp.size();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

typedef long long ll;

int main(){
  ll n,a,b;
  cin >>n>>a>>b;
  cout << n/(a+b)*a + min(n%(a+b),a) << endl;
}


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

typedef long long ll;

ll gcd( ll x, ll y );
ll lcm( ll x, ll y );

int main()
{
    int q, c, a, n;
    int team = 0;

    scanf("%d", &q );

    for ( int i = 0; i < q; ++i ) {
        team = 0;
        scanf("%d %d %d", &c, &a, &n );
        while ( true ) {
            if ( c >= 1 && a >= 1 && n >= 1 ) {
                team++;
                c -= 1;
                a -= 1;
                n -=1;
            } else if ( c >= 2 && a >= 1 ) {
                team++;
                c -= 2;
                a -= 1;
            } else if ( c >= 3 ) {
                team++;
                c-=3;
            } else {
                break;
            }
        }
        printf("%d\n", team );
    }

    return 0;
}

ll gcd( ll x, ll y )
{
    if ( y == 0 ) return x;
    return gcd( y, x % y );
}

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




Measured memory_bytes: 3220
#include <stdio.h>
#include <stdlib.h>
#define N 3

int P[N][N],G[N][N];
int X[4]={0,1,0,-1};
int Y[4]={1,0,-1,0};

void Empty(int *,int *);
void Swap(int *,int *);
int DFS(int ,int ,int ,int ,const int );
int cal();

int main()
{
  int i,j;
  int h,ans,row,col;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      scanf("%d",&P[i][j]);
    }
  }
    for(i=0;i<N;i++){
      for(j=0;j<N;j++){
	G[i][j] = -1;
      }
    }

  Empty(&row,&col);

  for(h=0;h<100;h++){
    for(i=0;i<N;i++){
      for(j=0;j<N;j++){
        G[i][j] = P[i][j];
      }
    }
    
    ans = DFS(row,col,-1,0,h);

    for(i=0;i<N;i++){
      
    }

    if(ans != -1){
      printf("%d\n",ans);
      break;
    }
    for(i=0;i<N;i++){
      for(j=0;j<N;j++){
        P[i][j] = G[i][j];
      }
    }
    
    ans = -1;

    if(h == 99)
      printf("%d\n\n",ans);
  }
  return 0;
}

void Empty(int *row,int *col)
{
  int i,j;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(!P[i][j]){
        *row = j;
        *col = i;
        return;
      }
    }
  }
}

void Swap(int *a,int *b) //交換
{
  int tmp;
  
  tmp = *a;
  *a = *b;
  *b = tmp;
}

int DFS(int x,int y,int p,int deep,const int lim)
{
  int i,len,emc;
  int x2,y2;

  len = cal();

  if(len == 0)
    return deep;
  if(deep + len > lim)
    return -1;

  for(i=0; i<N+1; i++){
    x2 = x+X[i];
    y2 = y+Y[i];
    if(p != -1 && i == (p + 2) % 4) 
      continue;
    if(!(0<=x2 && x2<3 && 0<=y2 && y2<3))
      continue;

    Swap(&P[y][x],&P[y2][x2]);

    emc = DFS(x2,y2,i,deep+1,lim);

    if (emc != -1) 
      return emc;

    Swap(&P[y][x],&P[y2][x2]);
  }

  return -1;
}

int cal()
{
  int i,e,C = 0;

  for(i=0;i<9;i++){
    e = P[i/3][i%3];
    if(e){
      e--;
      C += abs(i/3-e/3) + abs(i%3-e%3);
    }
  }
  return C;
}



Measured memory_bytes: 2132
#include <iostream>
#include<algorithm>

using namespace std;

int main()
{
    long long a,b,k,i,j,m;
    cin>>a >>b >>k ;
    if(a==0 && b==0)
    {
        cout<<a <<" "<<b <<endl;
    }else
    {
      if(k<=a)
    {
        cout<<a-k<<" "<< b <<endl;
    }else 
    {
        m=(k-a);
     cout<<0<<" "<<b- min(b,m);  
    }  
    }
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i, N) for(int i = 0; i < N; i++)
#define FOR(i, a, b) for(int i = a; i < b; i++)
using namespace std;
const int INF = 1e9;
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, C; cin >> N >> C;
    unordered_map<int,int> MP[3]; // (i+j)%3が同じものについて、色kに変えた時の違和感の和

    vector<vector<int>> D(C+1, vector<int>(C+1)), c(N, vector<int>(N));

    FOR(i,1,C+1) FOR(j, 1, C + 1) cin >> D[i][j];
    rep(i, N) rep(j, N) cin >> c[i][j];

    //vector<vector<int>> dis(N, vector<int>(3,INF));

    rep(i, N) rep(j, N) FOR(k, 1, C+1){
        MP[(i + j) % 3][k] += D[c[i][j]][k];
    }

    int ans = INF;
    FOR(c1, 1, C+1) FOR(c2, 1, C+1) FOR(c3, 1, C+1){
        if(c1 == c2 || c2 == c3 || c3 == c1) continue;
        int tmp = 0;
        tmp += MP[0][c1] + MP[1][c2] + MP[2][c3];
        chmin(ans, tmp);
    }
    cout << ans << endl;
    
}

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

int main() {
  int k , x;
  cin >> k >> x;
  int max = x + k - 1;
  int min = x - k + 1;

  if (max <= 1000000 && min >= -1000000) {
    for (int i = min; i <= max; i++) cout << i << " ";
  }

  else if (max >= 1000000 && min >= -1000000) {
    for (int i = min; i <=1000000; i++) cout << i << " ";
  }

  else if (max <= 1000000 && min <= -1000000) {
    for (int i = -1000000; i <= max; i++) cout << i << " ";
  }

  else {
    for (int i = -1000000; i <= 1000000; i++) cout << i << " ";
  }
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, ticket;
	cin >> n >> ticket;
	priority_queue<int> Q;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		Q.push(x);
	}
	for(int i = 0; i < ticket; i++) {
		int t = Q.top();
		Q.pop();
		Q.push(t/2);
	}
	long long ans = 0;
	while(!Q.empty()) {
		ans += Q.top();
		Q.pop();
	}
	cout << ans << endl;
	return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	string N;
	cin >> N;
	int sum = 0;
	fx(N.size()) {
		sum += N[x] - '0';
		sum %= 9;
	}
	if (sum==0) {
		cey;
	}
	else {
		cen;
	}
    return 0;
}



Measured memory_bytes: 3720
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i > 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
    int A,B,H,M;
    cin >> A >> B >> H >> M;

    double c1 = (H * 30 + M * 0.5) * (M_PI / 180);
    double c2 = M * 6 * (M_PI / 180);
    double dist = abs(c1 - c2);
    double ans = A * A + B * B - (2 * A * B * cos(min(dist, 2 * M_PI - dist)));
    cout << fixed << setprecision(20);
    cout << sqrt(ans) << endl;
}

Measured memory_bytes: 4128
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b;
    cin>>a>>b;
    if(std::max(a,b)<=8)
        cout<<"Yay!";
    else
        cout<<":(";
    
    
    return 0;


} 






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

#define all(x) (x).begin(), (x).end()
#define sz(x) static_cast<int>((x).size())

using LL = long long;
template<class T, size_t D>
struct vec : vector<vec<T, D - 1>> {
  template<class... Args>
  vec(size_t n = 0, Args... args)
    : vector<vec<T, D - 1>>(n, vec<T, D - 1>(args...)) {}
};
template<class T>
struct vec<T, 1> : vector<T> {
  template<class... Args>
  vec(Args... args)
    : vector<T>(args...) {}
};

template<class T>
inline bool asMn(T& a, const T& b) { return a > b ? a = b, true : false; }
template<class T>
inline bool asMx(T& a, const T& b) { return a < b ? a = b, true : false; }
inline int nex(int i, int n) { return i == n - 1 ? 0 : i + 1; }
inline int pre(int i, int n) { return !i ? n - 1 : i - 1; }

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

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

  int n; cin >> n;
  vec<int, 1> a(n);
  for (auto& i : a) {
    cin >> i;
  }
  int const mxA = *max_element(all(a));

  vec<bool, 1> banned(mxA + 1);
  vec<int, 1> cnt(mxA + 1);
  for (int i = 0; i < n; ++i) {
    if (!cnt[a[i]]) {
      for (int j = a[i] << 1; j <= mxA; j += a[i]) {
        banned[j] = true;
      }
    }
    ++cnt[a[i]];
  }

  int ans = n;
  for (int i = 0; i < n; ++i) {
    ans -= banned[a[i]] || cnt[a[i]] > 1;
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 7944
#include <cstdio>
#include <algorithm>
using namespace std;

const int MAX_N = 1008;
int N, LB, UB, K;

int ans[MAX_N];
int cards[MAX_N/2][MAX_N];

//ÈÁÄéH
bool check(){
	for(int i=0; i<K; i++){
		int cnt = 0;
		for(int j=0; j<N/2; j++){
			cnt += ans[cards[i][j]];
		}
		if(cnt < LB || UB < cnt){
			return false;
		}
	}
	return true;
}

//_
void solve(){

	for(int i=0; i<N/2; i++){
		ans[i] = 1;
	}

	for(;;){
		random_shuffle(ans, ans+N);
		if(check()) break;
	}
}

int main(){

	scanf("%d%d",&N,&K);
	LB = N/8;
	UB = 3*LB;

	for(int i=0; i<K; i++){
		for(int j=0; j<N/2; j++){
			scanf("%d", cards[i]+j);
			cards[i][j]--;
		}
	}

	solve();

	for(int i=0; i<N; i++){
		printf("%d", ans[i]);
	}
	puts("");

	return 0;
}

Measured memory_bytes: 2396
h,w,m=map(int,input().split())
bomb=[list(map(int,input().split())) for _ in range(m)] #bombの位置
a=[0 for i in range(h+1)] #各行のbombの個数
b=[0 for _ in range(w+1)] #各列のbombの個数
for i in range(m):
    a[bomb[i][0]]+=1
    b[bomb[i][1]]+=1
am=max(a) #１行にあるbombの最大値
bm=max(b) #１列にあるbombの最大値
hmax=[0]*(h+1) #最大値をとるh全部
wmax=[0]*(w+1) #最大値をとるw全部
for i in range(h+1):
    if am==a[i]:
        hmax[i]+=1
for i in range(w+1):
    if bm==b[i]:
        wmax[i]+=1
ans=am+bm #基本解
k=sum(hmax)*sum(wmax)
if k>m: #鳩ノ巣原理
    print(ans)
    exit()
for i in bomb:
    if hmax[i[0]]==1 and wmax[i[1]]==1:
        k-=1
if k==0:
    print(ans-1)
else:
    print(ans)

Measured memory_bytes: 72932
L = input().split(" ")
N = int(L[0])
K = int(L[1])
Q = int(L[2])
correct = []
points =[]
for i in range(N):
    points.append(K-Q)
for i in range(Q):
    correct.append(input())
for i in range(Q):
    win = int(correct[i])
    points[win-1] = points[win-1] + 1
ans = []
for i in range(N):
    if points[i] > 0:
        ans.append("Yes")
    else:
        ans.append("No")
for i in range(N):
    print(ans[i])


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

#define all(x) x.begin(), x.end()
#define lc (i << 1)
#define rc (i << 1 | 1)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MN = 2e5 + 5, LN = 17, MOD = 1e9 + 7, INF = 0x3f3f3f3f, BSZ = 320;
int N;
map<ll, ll> mp;
ll ret = 0;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> N;
    for (int i = 1, a; i <= N; i++) {
        cin >> a;
        ret += mp[i - a];
        mp[i + a]++;
    }
    cout << ret << '\n';
    return 0;
}


Measured memory_bytes: 26316
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );

double rad(double deg){
  return deg * M_PI / 180.0;
}

int main(void){

  ll a,b,x;
  cin>>a>>b>>x;
  double theta_l=0.0;
  double theta_r=90.0;

  double theta=180.0;
  //double h1=a*sin( rad(theta) );
  //double h2=b*cos( rad(theta) );
  double vol=INT_MAX;

  cout << setprecision(10);

  double prev_theta=-180.0;

  //while(abs(x-vol)>1e-12){
  while(abs(prev_theta-theta)>1e-9){
    prev_theta=theta;
    theta=theta_l+(theta_r-theta_l)/2;
    double h1=a*sin( rad(theta) );
    double h2=b*cos( rad(theta) );
    if(h1>h2){
      vol=a*b*b/tan(rad(theta))/2;
    }
    else{
      vol=a*a*( b- a*tan(rad(theta))/2 );
    }
    //cout << x << "," << theta << "," << vol << endl;
    if(x>vol) theta_r=theta;
    else theta_l=theta;
  }
  cout << theta << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}


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

#define LL long long
char c[1001][1001];
int d[1000005], ans;
queue<int> q;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    int n, m; cin >> n >> m;
    for(int i = 1; i <= n; i++) cin >> (c[i]+1);

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++) {
            if(c[i][j] == '#') {
                q.push((i - 1) * m + j);
                d[(i - 1) * m + j] = 1;
            }
        }

    while(!q.empty()) {
        int u = q.front(); q.pop();
        ans = max(ans, d[u]);

        for(int i = 0; i < 4; i++) {
            int v = u;
            if(i==0 && v<=m || i==1 && v%m == 1%m || i==2 && u>=(n-1)*m+1 || i==3 && u%m==0)
                continue;
            if(i == 0) v -= m;
            else if(i == 1) --v;
            else if(i == 2) v += m;
            else v++;

            if(!d[v]) {
                d[v] = d[u] + 1;
                q.push(v);
            }
        }
    }

    --ans;
    cout << ans;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	for(int i=0; i<n; i++) cout << s[i] << t[i];
	cout << endl;
	return 0;
}

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

template<typename Mono>
class SegmentTree {
private:
	using F = function<Mono(Mono, Mono)>;
	vector<Mono> Node;
	long long Size;
	const F f;
	const Mono Unit;

public:
	SegmentTree(long long N, const F f, const Mono& M) : f(f), Unit(M) {
		Size = 1;
		while (Size < N) Size <<= 1;
		Node.assign(Size * 2, Unit);
	}

	void Set(long long N, long long X) {
		Node[N + Size] = X;
	}

	void Set(vector<Mono> V) {
		for (int i = 0; i < V.size(); i++) {
			Set(i, V[i]);
		}
		for (int i = Size - 1; i > 0; i--) Node[i] = f(Node[i * 2], Node[i * 2 + 1]);
	}

	void Set(Mono V[], long long S) {
		for (int i = 0; i < S; i++) {
			Set(i, V[i]);
		}
		for (int i = Size - 1; i > 0; i--) Node[i] = f(Node[i * 2], Node[i * 2 + 1]);
	}

	void update(long long K, long long X) {
		K += Size;
		Node[K] = X;
		while (K >>= 1) Node[K] = f(Node[K * 2], Node[K * 2 + 1]);
	}

	Mono query(long long A, long long B, long long K = 1, long long L = 0, long long R = -1) {
		if (R == -1) R = Size;
		if (B <= L || R <= A) return Unit;
		if (A <= L && R <= B) return Node[K];
		return f(query(A, B, K * 2, L, (L + R) / 2), query(A, B, K * 2 + 1, (L + R) / 2, R));
	}

	Mono operator[](const long long K) const { return Node[K + Size]; };

	long long size() { return Size; };

	void put() {
		printf("%ld\n", Size);
		for (int i = 1; i < Size * 2; i++) {
			printf("%ld", Node[i]);
			if (i == Size * 2 - 1) printf("\n");
			else printf(" ");
		}
	}
};

int main() {
	long long N, COUNT = 0;
	static long long A[3][100000];
	vector<pair<long long, long long> > V;
	cin >> N;
	for (int i = 0; i < 3; i++) for (int j = 0; j < N; j++) cin >> A[i][j], A[i][j]--;
	for (int i = 0; i < N; i++) {
		pair<long long, long long> P[3];
		for (int j = 0; j < 3; j++) {
			P[j] = { A[j][i] / 3, A[j][i] % 3 };
		}
		if (P[0].first != P[1].first || P[1].first != P[2].first || P[2].first != P[0].first || P[1].second != 1 || P[0].first % 2 != i % 2) {
			cout << "No" << endl;
			return 0;
		}
		if (P[0].second == 0) V.push_back({ P[0].first, 0 });
		else V.push_back({ P[0].first, 1 }), COUNT++;
	}
	long long Dists = 0, Rotates = 0;
	vector<long long> Even, Odd;
	SegmentTree<long long> SegE(N, [](long long A, long long B) {return A + B; }, 0);
	SegmentTree<long long> SegO(N, [](long long A, long long B) {return A + B; }, 0);
	for (int i = 0; i < N; i += 2) {
		Even.push_back(V[i].first / 2);
		Rotates += V[i].second;
	}
	for (int i = 0; i < Even.size(); i++) {
		Dists += SegE.query(Even[i], N);
		SegE.update(Even[i], 1);
	}
	if ((Rotates + Dists) % 2 != COUNT % 2) {
		cout << "No" << endl;
		return 0;
	}
	Dists = 0, Rotates = 0;
	for (int i = 1; i < N; i += 2) {
		Odd.push_back(V[i].first / 2);
		Rotates += V[i].second;
	}
	for (int i = 0; i < Odd.size(); i++) {
		Dists += SegO.query(Odd[i], N);
		SegO.update(Odd[i], 1);
	}
	if ((Rotates + Dists) % 2 != COUNT % 2) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 9584
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
typedef vector<int> vi;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];
int gcd(int a,int b){
if(b==0){
    return a;
}
return gcd(b,a%b);
}

int main()
{
   int l,r,d;
   cin>>l>>r>>d;
   l--;
   int res=(r/d)-(l/d);
   cout<<res;
}




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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  vector<int> x(n);
  vector<int> y(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
  }
  double sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      sum += sqrt((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]));
    }
  }
  cout << sum * 2 / n << endl;
}


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

int main() {
    string O,E;
    cin >> O >> E;

    rep(i,min(O.size(),E.size()))
        cout << O.at(i) << E.at(i);
    if(O.size() > E.size())
        cout << O.at(O.size()-1);
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define pb push_back
#define all(x) x.begin(),x.end()
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const int maxn = 1e6+10;
const int maxM = 1e6+10;
const int inf = 0x3f3f3f3f;
const ll inf2 = 0x3f3f3f3f3f3f3f3f;
inline void read(int &x){
    int s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    x = s*w;
}

int N,M;
int fa[maxn],sz[maxn];
int find(int x){
    return x == fa[x] ? x :fa[x] = find(fa[x]);
}
void solve(){
    int ans = 0;
    for(int i = 1;i<=N;i++){
        if(find(i) == i){
            ans = max(ans,sz[i]);
        }
    }
    cout<<ans<<'\n';
}
int main(){
//    debug;
    ios;

    cin>>N>>M;
    for(int i =1;i<=N;i++) fa[i] = i,sz[i] = 1;
    for(int i =1;i<=M;i++){
        int x,y;cin>>x>>y;
        int fx = find(x),fy = find(y);
        if(fx != fy){
            fa[fx] = fy;
            sz[fy] += sz[fx];
            sz[fx] = 0;
        }
    }
    solve();


    return 0;
}

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

#define all(a) a.begin(), a.end()
#define forn(l, r) for(int i = l; i < (r); ++i)
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
// #define int long long int

using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
using ii = pair<int, int>;
using li = pair<ll, int>;
using vi = vector<int>;
using graph = vector<vi>;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

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

const ll mod =  1000000007;
const int INF = 0x3f3f3f3f;
const int MAXN = 112345;
// const double pi = 3.14159265359;
const double eps = 0.00000001;


int32_t main() {
    $
    int n;
    cin >> n;
    int sum = 0, mx = -INF;
    int x;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        sum += x;
        mx = max(mx, x);
    }
    if (mx < sum - mx) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}   



Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

dic = {}
for i in range(1, N+1):
    dic[i] = A[i-1]

dic_sorted = sorted(dic.items(), key=lambda x:x[1])

a = []
for v in dic_sorted:
    a.append(v[0])

a_str = [str(w) for w in a]

print(' '.join(a_str))


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

using namespace std;
int ans = 0,n;

void a( int t, int k, int s) {
 if (k==0&&s == 0) {
  ans++;
  return;
 }
 if (k == 0 || t > n)return;
 for (int i = t+1; i <= n; i++) {
  a( i, k - 1, s - i);
 }
 return;
}
int main() {
 int  k, s;
 while (1) {
  cin >> n >> k >> s;
  if (n == 0 && k == 0 && s == 0)break;
  ans = 0;
  a(0, k, s);
  cout << ans << endl;
 }
 return 0;
}


Measured memory_bytes: 3092
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <string>
#include <tuple>

int main() {
  intmax_t r, D, x;
  scanf("%jd %jd %jd", &r, &D, &x);

  for (int i = 2001; i <= 2010; ++i) {
    x = r*x - D;
    printf("%jd\n", x);
  }
}


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

typedef long long int ll;
typedef pair<ll, ll> pii;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define sz(a) ll(a.size())
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front 
#define MAXN 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define debug(x) cout << '>' << #x << ':' << x << " ";
#define nl '\n'
#define INF 1000000000000000000
#define IO                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define int long long int

const int N = 2020;
int dp[N];

void solve(){
    int S;
    cin >> S;
    
    dp[0] = 1;

    fo(i, 3, S){
        fo(j, 3, N){
            if(i-j >= 0){
                (dp[i] += dp[i-j])%=MOD;
            }
        }
    }
    cout << dp[S] << nl;
}
main()
{
    IO;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int T = 1;
    // cin >> T;
    fo(c, 1, T){
        solve();
        // cout<<"Case #"<<c<<": ";
    }
    return 0;
}

Measured memory_bytes: 3652
from collections import deque

def bfs(maze,visited,start_h,start_w,goal_h,goal_w):
  queue=deque([[start_h,start_w]])
  visited[start_h][start_w]=0
  while queue:
    h,w=queue.popleft()
    if [h,w]==[goal_h,goal_w]:
      return visited[goal_h][goal_w]
    for i,j in ([1,0],[-1,0],[0,1],[0,-1]):
      new_h,new_w=h+i,w+j
      if new_h<0 or new_h>=H or new_w<0 or new_w>=W:
        continue
      if maze[new_h][new_w]=='.' and visited[new_h][new_w]==-1:
        visited[new_h][new_w]=visited[h][w]+1
        queue.append([new_h,new_w])

H,W=map(int,input().split())
maze=[input() for _ in range(H)]
visited=[[-1]*W for _ in range(H)]

cost=bfs(maze,visited,0,0,H-1,W-1)
if cost==None:
  print(-1)
else:
  cnt=-1
  for i in range(H):
    cnt+=maze[i].count('.')
  print(cnt-cost)

Measured memory_bytes: 3316
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

int gcd(int a,int b){ return b? gcd(b,a%b): a;}

int main(void)
{
	int n;
	scanf("%d",&n);
	ll ans=0;
	for(int i=1; i<=n; ++i)
		for(int j=1; j<=n; ++j)
		{
			int tmp = gcd(i,j);
			for(int k=1; k<=n; ++k)
				ans += gcd(tmp,k);
		}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3836
#include<iostream>

using namespace std;

void chmax(int &a,int b){
  if(a < b) a = b;
}

int main(){
  int N,i;
  int a[111111],b[111111],c[1111111]; //0:a,1:b,2:c
  cin >> N;
  for(i=0;i<=N-1;i++)
    cin >> a[i] >> b[i] >> c[i];
  int dp[111111][3] = {0};
  for(i=1;i<=N;i++){
    chmax(dp[i][0],dp[i-1][1]+a[i-1]);
    chmax(dp[i][0],dp[i-1][2]+a[i-1]);
    chmax(dp[i][1],dp[i-1][0]+b[i-1]);
    chmax(dp[i][1],dp[i-1][2]+b[i-1]);
    chmax(dp[i][2],dp[i-1][0]+c[i-1]);
    chmax(dp[i][2],dp[i-1][1]+c[i-1]);
  }
  int max = dp[N][0];
  if(max < dp[N][1]) max = dp[N][1];
  if(max < dp[N][2]) max = dp[N][2];
  cout << max << endl;
}

Measured memory_bytes: 4736
import java.io.*;
import java.util.Arrays;

class Main {
    public static void main(String[] args) throws IOException {
        int i, n, m; 
        String line, chr;
        String str;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        for(;;) {
            str = in.readLine();
            if("-".equals(str)) {
                break;
            }
            n = Integer.parseInt(in.readLine());
            for(i = 0; i < n; i++) {
                m = Integer.parseInt(in.readLine());
                chr = str.substring(0, m);
                line = str.substring(m, str.length());
                str = line + chr;
            }
            System.out.println(str);
        }
        System.out.flush();
    }
}

Measured memory_bytes: 24304
def func(idx,s,p):
    global a
    if s == p:
        return True
    if s > p or idx == n:
        return False
    if s + sum(a[idx:]) < p:
        return False
    return func(idx+1,s,p) or func(idx+1,s+a[idx],p)


n = int(input())
a = [int(s) for s in input().split()]
m = int(input())
b = [int(t) for t in input().split()]
a.sort()

for i in b:
    if func(0,0,i):
        print("yes")
    else:
        print("no")


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

using namespace std;

int main(){
	string s; cin >> s;
	int ans = 753;
	for(int i = 0; i < s.size() - 2; ++i){
		ans = min(ans, abs(753 - (s[i]-'0')*100 - (s[i+1]-'0')*10 - (s[i+2]-'0')));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		sc.close();
		int A = Integer.parseInt(String.valueOf(ch[0]));
		int B = Integer.parseInt(String.valueOf(ch[1]));
		int C = Integer.parseInt(String.valueOf(ch[2]));
		int D = Integer.parseInt(String.valueOf(ch[3]));
		char[] op = {'+','-'};
		int sum = 0;
		for(int i = 0;i < op.length;i++) {
			for(int j = 0;j < op.length;j++) {
				for(int k = 0;k < op.length;k++) {
					if(op[i]=='+') {
						sum += A+B;
					}else {
						sum += A-B;
					}
					if(op[j]=='+') {
						sum += C;
					}else {
						sum -= C;
					}
					if(op[k]=='+') {
						sum += D;
					}else {
						sum -=D;
					}
					if(sum==7) {
						System.out.println(A+String.valueOf(op[i])
								+B+String.valueOf(op[j])
								+C+String.valueOf(op[k])
								+D+"=7");
						return;
					}
					sum=0;
				}
			}
		}
	}
}

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

a, b = MAP()
bit = [[0, 0] for _ in range(40)]
for i in range(40):
    p1 =  pow(2, i)
    p2 = pow(2, i + 1)
    bit[i][0] = a // p2 * p1 + max(a % p2 - p1, 0)
    bit[i][1] = (b + 1) // p2 * p1 + max((b + 1) % p2 - p1, 0)
ansbit = [(bit[i][1] - bit[i][0]) % 2 for i in range(40)]
ans = 0
for i in range(40):
    ans += ansbit[i] * pow(2, i)
print(ans)


Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
#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(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
const int inf = 1e9;
int dp[1005][4100];
int main(){
    int n,m; cin >> n >> m;
    vector<int> a(m),b(m),c(m,0);
    rep(i,m){
        cin >> a[i] >> b[i];
        rep(j,b[i]){
            int v; cin >> v; v--;
            c[i] += (1<<v);
        }
    }

    rep(i,1005){
        rep(j,4100){
            dp[i][j] = inf;
        }
    }
    dp[0][0] = 0;

    rep(i,m){
        rep(j,(1<<n)){
            dp[i+1][j] = min(dp[i][j], dp[i+1][j]);

            dp[i+1][j|c[i]] = min(dp[i+1][j|c[i]], dp[i][j] + a[i]);
        }
    }

    int ans = dp[m][(1<<n)-1];
    if(ans == inf) ans = -1;
    cout << ans << endl;
}


Measured memory_bytes: 16384
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
vector<int>a;
int main()
{
    for(int i=0;i<3;i++)
    {
        int temp;
        scanf("%d",&temp);
        a.push_back(temp);
    }
    sort(a.begin(),a.end());
    vector<int>::iterator it;
    int sum=0;
    for(it=a.begin();it!=a.begin()+2;it++)
    {
        sum+=*it;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 256
function main(input) {
    const args = input.split(' ');
  	const a = parseInt(args[0], 10),
          b = parseInt(args[1], 10);
  if((a*b)%2==1){
  	console.log("Odd")  
  }else{
    console.log("Even")
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; ++i)
    cin >> A[i];
  int all = 0;
  for (int i = 0; i < N; ++i)
    all += A[i];
  int flag = 0;
  for (int i = 0; i < N; ++i)
    if (A[i] >= all / (4.0 * M))
      ++flag;
  if (flag >= M)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

int gcd(int a, int b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

//-----------------------ここから-----------


int main(void){
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}



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

def dfs(s):
    if int(s) > N:
        return 0
    if all(s.count(i) > 0 for i in '753'):
        score = 1
    else:
        score = 0
    for c in '753':
        score += dfs(s+c)
    return score

print(dfs('0'))

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N >> K;
	vector< int > S(N, 0);
	rep(i,K){
		int d;
		cin >> d;
		rep(j,d){
			int a;
			cin >> a;
			--a;
			S[a]++;
		}
	}
	int ans = 0;
	rep(i, N) if (S[i] == 0) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <cstring>
#include <cstdint>
#include <iostream>
#include <string>
#include <memory>
#include <queue>
#include <limits>
#include <list>
#include <utility>
#include <sstream>
#include <random>
using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int ans = 0;

	while(true)
	{
		if (A & 0x01 || B & 0x01 || C & 0x01) {
			break;
		}
		if (A == B && B == C) {
			ans = -1;
			break;
		}
		int nA, nB, nC;
		nA = B / 2 + C /2;
		nB = A / 2 + C /2;
		nC = A /2  + B /2;
		A = nA;
		B = nB;
		C = nC;
		++ans;
	}

	cout << ans;
	return 0;
}

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

#define mod 1000000007

int main() {
    ll N, K;
    cin >> N >> K;
    vector<int>A(N);
    for (int i = 0; i < N; ++i) {
      cin >> A[i];
    }

    vector<ll>v1(N, 0);
    for (int i = 0; i < N; ++i) {
        for (int j = i+1; j < N; ++j) {
            if(A[i] > A[j]) v1[i]++;
        }
    }
    vector<ll>v2(N, 0);
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if(A[i] > A[j]) v2[i]++;
        }
    }

    ll ans = 0;
    ll temp = 0;
    for (int i = 0; i < N; ++i) {
        temp += v1[i];
    }
    temp = temp * K % mod;
    ans += temp;

    if(K == 1){
        cout << ans;
        return 0;
    }

    ll s = K * (K-1) / 2;
    s %= mod;
    for (int i = 0; i < N; ++i) {
        ans += s * v2[i];
        ans %= mod;
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;

  vector<bool> broken_stairs(N+1, false);
  for (int i = 1; i < M+1; ++i)
  {
    int a;
    cin >> a;
    broken_stairs[a] = true;
  }

  vector<int> dp(N + 2);
  const long long mod = 1000000007;
  dp[N] = 1;
  for (int i = N - 1; i >= 0; --i)
  {
    if (broken_stairs[i])
    {
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i + 1] + dp[i + 2]) % mod;
  }
  cout << dp[0] << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int n;
bool is_composite[1000001];
vector<int> primes;

int main() {
  for (int i=2; i<=1000000; i++) {
    if (!is_composite[i]) {
      primes.push_back(i);
      for (int j=i+i; j<=1000000; j+=i) is_composite[j] = true;
    }
  }


  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;
  
    int ans = 0;
    for (int i=0; i<primes.size(); i++) {
      if (primes[i] > n) break;
      if (primes[i]+primes[i] == n) ans += 2;
      else if (binary_search(primes.begin(), primes.end(), n-primes[i])) {
        ++ans;
      }
    }
  
    ans /= 2;
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
//cout << fixed << setprecision(15);

int main() {
  int n;
  cin >> n;
  int r = 0;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    if(a == b) {
      if(++r == 3) {
        cout << "Yes" << endl;
        return 0;
      }
    }
    else {
      r = 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3632