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

int student[10001][721];
int now[10001];

int main(){
  int N,M,r,   i,j,   t,n,m,s;
  while(1){
    cin>>N>>M;
    if(N==0)break;
    for(i=1;i<=M;i++){
      for(j=0;j<=720;j++){
	student[i][j]=0;
      }
    }

    cin>>r;
    for(i=0;i<r;i++){
      cin>>t>>n>>m>>s;
      if(s==1){
	student[m][t-540]++;
      }else{
	student[m][t-540]--;
      }
    }
    for(i=1;i<=M;++i){
      for(j=1;j<=720;++j){
	student[i][j]+=student[i][j-1];
      }
    }

      int q,ts,te, ans;
      cin>>q;
      for(i=0;i<q;i++){
	ans=0;
	cin>>ts>>te>>m;
	for(j=ts-540; j<te-540; j++){
	  if(student[m][j])ans++;
	}
	cout<<ans<<endl;
      }
    }
    return 0;
  }


Measured memory_bytes: 30260
#include <cstdio>
#include <utility>
#include <unordered_map>
#include <vector>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define is inline bool scan
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
is(int &n) {int c=gcu();return c==EOF?false:(n=in(c),true);}
is(char &c){c=gcu();gcu();return c!=EOF;}
//is(string &s) {int c;for(;;){c=gcu();if(c=='\n'||c==' ')return true;s+=c;}}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
//void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

int main() {
	int n;
	while ((n = in())) {
		unordered_map<int, long> m;
		vector<int> e;
		while (n--) {
			int i = in(), p = in(), q = in();
			if (!m.count(i))
				e.push_back(i);
			m[i] += p * q;
		}
		bool NA = true;
		for (int i: e)
			if (m[i] >= 1000000) {
				out(i, '\n');
				NA = false;
			}
		if (NA)
			out("NA\n");
	}
}


Measured memory_bytes: 2476
A,B,K=map(int, raw_input().split())

cnt=0

while cnt<K:
	cnt+=1
	# A turn
	if cnt%2==1:
		if A%2==1:
			A-=1

		B+=A/2
		A=A/2
	else:
		# B turn
		if B%2==1:
			B-=1

		A+=B/2
		B=B/2

print A,B



Measured memory_bytes: 27884
/******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define int ll
ll po(ll a, ll x, ll m) { if (x == 0) {return 1;} ll ans = 1; ll k = 1;  while (k <= x) {if (x & k) {ans = ((ans * a) % m);} k <<= 1; a *= a; a %= m; } return ans; }
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE
map<int, vector<int>>gh;
vector<int>cnt;
vector<bool>vis;
int tmp = 0;
int wh = -1, no = -1;
void dfs(int a) {
  if (vis[a]) {
    wh = a;
    no = tmp;
    return;
  }
  cnt[a] = tmp++;
  vis[a] = true;;
  for (auto x : gh[a]) {
    dfs(x);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int n, k;
  cin >> n >> k;
  cnt  = vector<int>(n + 1, -1);
  vis  = vector<bool>(n + 1, false);
  forr(i, n) {
    int a;
    cin >> a;
    gh[i + 1].pb(a);
  }
  dfs(1);
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == k) {
      cout << i << "\n";
      return 0;
    }
  }
  int time  = no - cnt[wh];
  k = (k - cnt[wh]) % time;
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == cnt[wh] + k) {
      cout << i << "\n";
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 32764
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

int main(){
  int r;
  cin>>r;
  cout<<3*r*r<<endl;
  return 0;
}

  



Measured memory_bytes: 256
N = int(input())
i = 0
a_max = 2
a_min = 2*(10**9)
s_max = 1-10**9
s_min = 10**9-1

for i in range(N):
    x,y=map(int,input().split())
    add = x+y
    sub = x-y

    if add > a_max:
        a_max = add
    if add < a_min:
        a_min = add
    
    if sub > s_max:
        s_max = sub
    if sub < s_min:
        s_min = sub

d_add = a_max - a_min
d_sub = s_max - s_min

#if d_add >= d_sub:
#    print(d_add)
#if d_add < d_sub:
#    print(d_sub)
print(max(d_add,d_sub))

Measured memory_bytes: 9140
# https://atcoder.jp/contests/abc108/tasks/abc108_b



x_1, y_1, x_2, y_2 = gets.split.map(&:to_i)

diff_x = x_2 - x_1
diff_y = y_2 - y_1

# if diff_y == 0
#   puts [x_2, y_2 + diff_x, x_1, y_1 + diff_x].join(' ')
#   exit
# end

x_3 = x_2 + (-1) * diff_y
y_3 = y_2 + diff_x
x_4 = x_1 + (-1) * diff_y
y_4 = y_1 + diff_x

puts [x_3, y_3, x_4, y_4].join(' ')


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

#define ms(s,n) memset(s,n,sizeof(s))
#define all(a) a.begin(),a.end()
#define present(t, x) (t.find(x) != t.end())
#define sz(a) int((a).size())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;

const int MOD = (int) 1e9+7;
const int INF = (int) 1e9+1;
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

string s,t;

void solve(){
	cin>>s>>t;
	int n=s.length();
	int cnt=0;
	FOR(i,0,n){
		if(s[i]==t[i])
			cnt++;
	}
	cout<<n-cnt<<endl;
}
int main(){
	solve();
	return 0;
}


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

using namespace std;
const int N = 1e5 + 3, MOD = 1e9 + 7;
char s[N];
int mem[N][13];
int go(int i, int m) {
	if (!s[i])
		return m == 5;
	int &ret = mem[i][m];
	if (~ret)
		return ret;
	ret = 0;
	if (s[i] == '?')
		for (int d = 0; d <= 9; ++d)
			ret = (ret + go(i + 1, (m * 10 + d) % 13)) % MOD;
	else
		ret = go(i + 1, (m * 10 + s[i] - '0') % 13);
	return ret;
}
int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
#endif
	scanf("%s", s);
	memset(mem, -1, sizeof mem);
	printf("%d\n", go(0, 0));
	return 0;
}

Measured memory_bytes: 10112
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#define rep(i,j,n) for(int i=j;i<n;i++)
using ll = long long;
const int MOD = 1e9 + 7; // 10^9 + 7
using namespace std;

// ------------------ コンビネーション関数 ------------------ //
// ---------------- 使用前「COMinit();」必須 ---------------- //
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// ------------------ 最大公約数関数 ------------------ //
int GCD(int x, int y) {
	if (x == 0) return y;
	else GCD(y % x, x);
}

// ------------------ ベクター表示 ------------------ //
void printVec(vector<ll>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}


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

int main(void) {

	ll N, K, ans = 0;
	cin >> N >> K;

	if (K == N + 1) {
		cout << 1 << endl;
		return 0;
	}
	else {
		vector<ll> tmp(N + 1), Ktmp(N + 2);

		tmp[0] = 0;
		for (ll i = 1; i <= N; i++) {
			tmp[i] = (tmp[i - 1] + i);
		}
		
		//printVec(tmp);

		Ktmp[0] = 0;
		for (ll i = 1; i <= N; i++) {
			Ktmp[i] = ((tmp[N] - tmp[N - i]) - tmp[i - 1] + 1);
		}

		//printVec(Ktmp);

		for (ll i = K; i <= N; i++) {
			ans = (ans + Ktmp[i]) % MOD;
			//if (i == K) {
			//	cout << "ans = " << ans << " i = " << i << endl;
			//	break;
			//}
		}

		cout << ans + 1 << endl;

		return 0;
	}
}

Measured memory_bytes: 6252
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld double
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pll pair <ll,ll>
#define nl "\n"
string k;
ll d,n;
ll dp[10002][102][2];
ll fx(ll idx, ll su, ll fl)
{
	if(idx == n)
	{
		if(su == 0)
			return dp[idx][su][fl]=1;
		else
			return dp[idx][su][fl]=0;
	}
	if(dp[idx][su][fl] != -1)
		return dp[idx][su][fl];
	if(fl == 1)
	{
		ll sum = 0;
		for(int i=0;i<10;i++)
		{
			sum = (sum + fx(idx+1, (su+i)%d, fl))%mod;
		}
		return dp[idx][su][fl] = sum;
	}
	else
	{
		ll sum = 0;
		for(int i=0;i<k[idx]-'0';i++)
		{
			sum = (sum + fx(idx+1, (su+i)%d, 1))%mod;
		}
		sum = (sum + fx(idx+1, (su+k[idx]-'0')%d, fl))%mod;
		return dp[idx][su][fl] = sum;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>k>>d;
	ll i,j,l;
	n=k.length();
	for(i=0;i<10002;i++)
		for(j=0;j<102;j++)
			dp[i][j][0]=dp[i][j][1]=-1;
	cout<<(fx(0, 0, 0) - 1 + mod)%mod<<nl;
	return 0;
}

Measured memory_bytes: 20368
IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 INP PIC X(100).
       01 A PIC 999999.
       01 B PIC 999999.
       01 C PIC 999999999.
       01 REN PIC 9999999.
       01 RE PIC Z(7).
       01 temp1 PIC 9999.
       01 temp2 PIC 9999.
       01 N PIC 9999.
       PROCEDURE DIVISION.
       MAIN.
       	ACCEPT INP.
      	PERFORM VARYING temp1 FROM 1 BY 1 UNTIL INP(temp1:1)=SPACE
      	END-PERFORM.
      	SUBTRACT 1 FROM temp1.
      	MOVE INP(1:temp1) TO A.
      	ADD 2 TO temp1.
      	PERFORM VARYING temp2 FROM temp1 BY 1 UNTIL INP(temp2:1)=SPACE
      	END-PERFORM.
      	COMPUTE N=temp2 - temp1.
      	MOVE INP(temp1:N) TO B.
      	ADD 1 TO temp2.
      	PERFORM VARYING temp1 FROM temp2 BY 1 UNTIL INP(temp1:1)=SPACE
      	END-PERFORM.
      	COMPUTE N=temp1 - temp2.
      	MOVE INP(temp2:N) TO C.
      	IF A = 7 THEN
      		IF B = 5 AND C = 5 THEN
      			DISPLAY "YES"
      		ELSE
      			DISPLAY "NO"
      		END-IF
      	ELSE IF B = 7 THEN
      		IF A = 5 AND C = 5 THEN
      			DISPLAY "YES"
      		ELSE
      			DISPLAY "NO"
      		END-IF
      	ELSE IF C = 7 THEN
      		IF B = 5 AND A = 5 THEN
      			DISPLAY "YES"
      		ELSE
      			DISPLAY "NO"
      		END-IF
      	ELSE
      		DISPLAY "NO"
      	END-IF.
        STOP RUN.



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

string s;

bool is_palindrome (int i, int j) {
	while (i <= j) {
		if (s[i] != s[j]) return false;
		i ++, j --;
	}	
	return true;
}

int main () {
	cin >> s;
	int len = s.length ();
	if (is_palindrome (0, len - 1) && is_palindrome (0, (len - 1) / 2 - 1) && is_palindrome ((len + 3) / 2 - 1, len - 1))
		cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 256
a = int(input())
s = [input().split() for i in range(a)]
cnt = int(0)
maxcnt = int(0)

for i in range(a):
    if s[i][0] == s[i][1]:
        cnt += 1
    else:
        cnt = 0
    if maxcnt < cnt:
        maxcnt = cnt

if maxcnt >= 3:
    print("Yes")
else:
    print("No")

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

using namespace std;

int main(){
    
    int a,b;

    scanf("%d %d", &a, &b);

    if((a > 8) || (b > 8)){
        printf(":(\n");
    }else{
        printf("Yay!\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main() {
  long long N,M;
  cin >> N >> M;
  
  long long A[M],sum=0;
  A[0] = 0;
  for(long long i=1;i<=M;i++){
    cin >> A[i];
    sum += A[i];
  }
  
  if(sum <= N){
  	cout << N-sum <<endl;
  }else{
  	cout<< -1 << endl;
  }
  
}

Measured memory_bytes: 3668
/* ex4_2
   KKOO  */

#include <stdio.h>
#include <math.h>
//円周率を定義する
#define PI 3.1415926536

//プロトタイプ宣言
double cos_low(double hour_length, double minute_length, double hour, double minute);

int main(void){
    double a, b, now_hour, now_minute, ans;
    //時針と分針の長さ、現在の時刻を入力
    scanf("%lf %lf %lf %lf", &a, &b, &now_hour, &now_minute);

    ans = cos_low(a, b, now_hour, now_minute);
    printf("%.9f\n", ans);

    return 0;
}

//関数の定義
double cos_low(double hour_length, double minute_length, double hour, double minute){
    double distance, square_distance, angle, angle_rad;

    //時針と分針の成す角の計算
    angle = fabs(0.5 * (60 * hour + minute) - 6 * minute);
    if(angle > 180){
        angle = 360 - angle;
    }
    //角度をラジアン表記にする
    angle_rad = angle * PI / 180;
    //余弦定理の計算
    square_distance = pow(hour_length, 2) + pow(minute_length, 2) - 2 * hour_length * minute_length * cos(angle_rad);
    distance = sqrt(square_distance);

    return distance;
}


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

int main() {
	int n, l, sum;
	cin >> n >> l;
	for (int i = 1; i <= n; i++) {
		sum += (l + i - 1);
	}
	if (l < 0 && n <= l * (-1)) {
		sum -= (l + n -1);
	}
	if (l > 0) {
		sum -= l;
	}
	cout << sum << endl;
	return 0;
}

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

int main(){
	int a,b;
	cin >> a >> b;
	if(a <= 0 && b >= 0){
		cout << "Zero" << endl;
	}
	else if(abs(a + b) % 2 == 0 && b < 0){
		cout << "Negative" << endl;
	}
	else{
		cout << "Positive" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a,b;
    cin >> a >> b;
    int p = 1;
    int ans = 0;
    while(p < b){
        p = p - 1;
        p += a;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>

using namespace std;

const int N = 1e5 + 5, M = 2e5 + 5;
int x, y, a, b, c, t, n;
int p[N], q[N], ans[M];
long long res;

int main() {
	scanf("%d%d%d%d%d", &x, &y, &a, &b, &c);
	for (register int i = 1; i <= a; ++i) 
		scanf("%d", &p[i]);
	sort(p+1, p + a+1);
	for (int i = a ; i >= a - x+1; --i)
		ans[++t] = p[i];
	for (register int i = 1; i <= b; ++i)
		scanf("%d", &q[i]);
	sort(q+1, q + b+1);
	for (int i = b; i >= b - y+1; --i)
		ans[++t] = q[i];
	for (int i = 1; i <= c; ++i) {
		scanf("%d", &n);
		ans[++t] = n;
	}
	sort(ans + 1, ans + 1 + t);
	for (register int i = t; i >= t - x - y + 1; --i)
		res += ans[i];
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <utility>
#include <tuple>
#include <map>
using namespace std;
using ll = long long;
int main() {
    bool divide_ok = true;
    int N; cin >> N;
    vector<int> A(N);
    for (int i=0;i<N;i++) cin >> A[i];
    int res=0;
    while(divide_ok){
        for (int i=0;i<N;i++){
            if (A[i]%2==0) A[i]/=2;
            else {
                divide_ok = false;
                break;
            }
        }
        if (divide_ok) res++;
        else break;
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int nx = x2 - x1;
  int ny = y1 - y2;
  cout << x2 + ny << " " << y2 + nx << " " << x1 + ny << " " << y1 + nx << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
xy = [0] * N
ans = 0
for i in range(N):
    a = int(input())
    xy[i] = [list(map(int, input().split())) for _ in range(a)]
is_honest = [False for i in range(N)]
for i in range(2 ** (N)):
    for j in range(N):
        if i >> j & 1:
            is_honest[j] = True
        else:
            is_honest[j] = False
    broke = False
    for j in range(N):
        if is_honest[j]:
            for k in xy[j]:
                if is_honest[k[0]-1] != bool(k[1]):
                    broke = True
                    break
            if broke:
                break
    if broke == False:
        ans = max(ans, is_honest.count(True))
print(ans)

Measured memory_bytes: 3064
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline
    import collections
    n, k = map(int, input().split())
    td = [list(map(int, input().split())) for _ in range(n)]
    td.sort(key=lambda x: x[1], reverse=True)
    ans_list = [0]
    reverse_td = list(zip(*td))
    c = collections.Counter(reverse_td[0][:k])
    kind = len(c)
    ans = sum(reverse_td[1][:k])+kind**2
    check = k-1
    flag=False
    for i in range(k,n):
        t = td[i][0]
        d = td[i][1]
        if t in c:
            pass
        else:
            c[t]=1
            while True:
                new_t = td[check][0]
                if c[new_t]==1:
                    check -=1
                    if check == -1:
                        flag =True
                        break
                else:
                    c[new_t]-=1
                    ans_list.append(ans_list[-1]+2*kind+1+d-td[check][1])
                    check-=1
                    kind+=1
                    break
            if flag:
                break
    print(ans+max(ans_list))


Measured memory_bytes: 36408
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const ll M = 1e9+7;
const ll INF = 1e9+7;

ll n, ans;
ll a[20], x[20][20];
bool y[20][20];

int main() {
  cin >> n;

  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
    a[i];
    for (ll j = 0; j < a[i]; ++j) {
      cin >> x[i][j] >> y[i][j];
      --x[i][j];
    }
  }
  
  for (ll bit = 0; bit < (1 << n); ++bit) {
    bool ok = true;
    for (ll i = 0; i < n; ++i) {
      if ((bit >> i) & 1) {
        for (ll j = 0; j < a[i]; ++j) {
          if (((bit >> x[i][j]) & 1) != y[i][j]) {
            ok = false;
          }
        }
      }
    }
    if (ok) {
      ll cnt = 0;
      for (ll i = 0; i < n; i++) {
        cnt += (bit >> i) & 1;
      }
      ans = max(ans, cnt);
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;

namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = CinL();
            Cout(N * (N - 1) / 2);
            Cin();
        }

        static int GCD(int a, int b)
        {
            if (a < b) { swap(ref a, ref b); }
            if (a % b == 0) { return b; }
            else { return GCD(b, a % b); }
        }

        static void swap<T>(ref T a, ref T b)
        {
            T t = a;
            a = b;
            b = t;
        }

        static readonly int MOD10E9 = (1000000000 + 7);
        static bool isInt(double d) { return (int)d == d; }
        static string Cin() { return ReadLine(); }
        static string[] CinAr() { return ReadLine().Split(' '); }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return S2i(x); }).ToArray(); }
        static long CinL() { return S2L(Cin()); }
        static long[] CinLAr() { return CinAr().Select((x, i) => { return S2L(x); }).ToArray(); }
        static double CinD() { return S2D(Cin()); }
        static double[] CinDAr() { return CinAr().Select((x, i) => { return S2D(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static long S2L(string s) { return long.Parse(s); }
        static double S2D(string s) { return double.Parse(s); }
        static void Cout(object s) { WriteLine(s); }
        static int[] yakusuu(int n)
        {
            if (n == 1) { return new int[] { 1 }; }
            HashSet<int> res = new HashSet<int>();
            for (int i = 1; i < Math.Ceiling(n / 2.0); i++)
            {
                if (n % i == 0)
                {
                    res.Add(i);
                    res.Add(n / i);
                }
            }
            return res.ToArray();
        }
        static void CoutAr<Type>(IEnumerable<Type> types)
        {
            string text = string.Join(" ", types);
            WriteLine(text);
        }

        public static long nCr(int n, int r)
        {
            // naive: return Factorial(n) / (Factorial(r) * Factorial(n - r));
            return nPr(n, r) / Factorial(r);
        }

        public static long nPr(int n, int r)
        {
            // naive: return Factorial(n) / Factorial(n - r);
            return FactorialDivision(n, n - r);
        }

        private static long FactorialDivision(int topFactorial, int divisorFactorial)
        {
            long result = 1;
            for (int i = topFactorial; i > divisorFactorial; i--)
                result *= i;
            return result;
        }

        private static long Factorial(int i)
        {
            if (i <= 1)
                return 1;
            return i * Factorial(i - 1);
        }
    }
}


Measured memory_bytes: 13140
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
void read(int &x) {
	char ch; bool ok;
	for(ok=0,ch=getchar(); !isdigit(ch); ch=getchar()) if(ch=='-') ok=1;
	for(x=0; isdigit(ch); x=x*10+ch-'0',ch=getchar()); if(ok) x=-x;
}
#define rg register
const int maxn=1e5+10;bool vis[maxn];
int n,k,dep[maxn],ans,f[maxn],cnt,pre[maxn*2],nxt[maxn*2],h[maxn];
void add(int x,int y){
	pre[++cnt]=y,nxt[cnt]=h[x],h[x]=cnt;
}
void dfs(int x){
	vis[x]=1;
	for(rg int i=h[x];i;i=nxt[i])
		if(!vis[pre[i]])dfs(pre[i]),dep[x]=max(dep[pre[i]]+1,dep[x]);
	if(dep[x]>=k-1&&f[x]!=1)dep[x]=-1,ans++;
}
int main()
{
	read(n),read(k);scanf("%d",&f[1]);
	for(rg int i=2;i<=n;i++)read(f[i]),add(f[i],i);
	if(f[1]!=1)ans++,f[1]=1;dfs(1);
	printf("%d\n",ans);
}

Measured memory_bytes: 5376
#include<stdio.h>
#include <iostream>
#include <cmath>

using namespace std;

int hukuri(double r , int a,int n ,int t){
	 int i;
	for(i = 0;i < n;i++){
		int s=0;
		s = s + floor(r*a);
		a = a + s - t;
	}
	return a ;
}

int tanri(double r,int a, int n,int t)
	{
		int s = 0; int i;
		for(i = 0; i < n;i++)
					{ s = s + (int)(r*a);
					a-=t;
					}
		return a+s;
	}
		
	
int main(void)
{ 
	//int m ,a ,n;
	int set;
	cin >> set;
	for(int i=0;i<set;i++){
		int money,year;
		cin >> money >> year;
		int nowmax=0;
		int dn;
		cin >> dn;
		for(int k=0;k<dn;k++){
			int which;
			double m;
			int t;
			cin >> which >> m >> t;
			int ret ;
			if(which){
				 ret=hukuri(m,money,year,t);
			}else{
				ret=tanri(m,money,year,t);
			}
			nowmax=max(nowmax,ret);
		}
		cout << nowmax << endl;
	
	}
}			

Measured memory_bytes: 0
#include<stdio.h>
int main(void){
    int n, S[10000], q, flag = 1, T[10000], i, count = 0, key, j, Q, N;
    scanf("%d", &n);
    i = 0;
    N = n;
    while ( n-- ) {
        scanf("%d", &S[i]);
        i++;
    }
    scanf("%d ", &q);
    Q = q;
    i = 0;
    while ( q-- ) {
        scanf("%d", &T[i]);
        i++;
    }
    while ( flag == 1) {
        flag = 0;
        for ( j = n - 1; j >= 1; j-- ) {
            if ( S[j] < S[j - 1] ) {
                key = S[j];
                S[j] = S[j - 1];
                S[j - 1] = key;
                flag = 1;
            }
        }
    }
    for ( i = 0; i < Q; i++ ) {
        for ( j = 0; j < N; j++ ) {
            if ( S[j] == T[i]) break;
        }
        if ( j < N ) count++;
    }
    printf("%d\n", count);
}



Measured memory_bytes: 2096
#!/usr/bin/env python3

import numpy as np


# def input():
#     return sys.stdin.readline().rstrip()


def main():
    n, k = map(int, input().split())

    warps = list(map(int, input().split()))
    warps = [0] + warps
    warps = np.array(warps, dtype=int)

    dp = np.zeros((k.bit_length() + 1, n + 1), dtype=int)

    dp[0, :] = warps

    for h in range(1, len(dp)):
        # dp[h] = dp[h - 1][dp[h - 1]]
        dp[h] = np.take(dp[h - 1], dp[h - 1])

    node = 1
    # for i in reversed(range(k.bit_length())):
    for i in range(k.bit_length(), -1, -1):
        if k >> i & 1:
            node = dp[i][node]

    print(node)


main()


Measured memory_bytes: 126164
// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define INFLL 1000000000000000000LL
#define MOD 1000000007
#define PI acos(-1)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>

using namespace std;

// clang-format on

main {
  string s;
  cin >> s;
  string t[] = {"dream", "dreamer", "erase", "eraser"};
  while (s.size()) {
    bool f = true;
    rep(i, 4) {
      string u = s.stlice(max<int>(0, s.size() - t[i].size()), s.size() - 1);
      if (u == t[i]) {
        rep(j, t[i].size()) s.pop_back();
        f = false;
        break;
      }
    }
    if (f) {
      cout << "NO" << endl;
      bye;
    }
  }
  cout << "YES" << endl;
  bye;
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getF() float64 {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return float64(i)
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	W, H, x, y := getF(), getF(), getF(), getF()

	flg := x+x == W && y+y == H
	c := 0
	if flg {
		c = 1
	}
	fmt.Printf("%12.12f %d\n", H*W/2.0, c)
}


Measured memory_bytes: 640
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define inf 1e9
#define eps 1e-10
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll p[20],b[20];

inline double S(ll x)
{
	ll tmp=0,tmp2=x;
	while(x) tmp+=(x%10),x/=10;
	//cout<<tmp2<<" "<<(double)tmp2/(double)tmp<<endl;
	return (double)tmp2/(double)tmp;
}

int main()
{
	//freopen("t1.in","r",stdin);
	ll k=read(); p[0]=0; b[0]=1;
	for(int i=1;i<=15;i++) p[i]=(p[i-1]+1)*10-1;
	for(int i=1;i<=15;i++) b[i]=b[i-1]*10;
	int nw=0,c1=1,cnt=0;
	while(cnt<k)
	{
		if(S(c1*b[nw]+p[nw])<=S((c1+1)*b[nw]+p[nw]))
		{
			cout<<c1*b[nw]+p[nw]<<endl; c1++; cnt++;
		}
		else nw++,c1=c1/10;
	}
	return 0;
}

Measured memory_bytes: 256
#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;
  cin >> N;
  if( N%2 == 0) cout << N/2 << endl;
  else if( N%2 != 0) cout << (N/2)+1 << endl;
}

Measured memory_bytes: 256
let pi = 4. *. atan 1.

let degree_to_radian d = pi *. d /. 180.

let () =
  let rec doit (x, y) r =
    let (d, t) = Scanf.scanf "%f,%f " (fun d t -> d, t) in
    if d = 0. && t = 0. then (truncate x, truncate y)
    else
      let z = degree_to_radian r in
      doit (x +. d *. cos z, y +. d *. sin z) (r -. t) in
  let (x, y) = doit (0., 0.) 90. in
  Printf.printf "%d\n%d\n" x y

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

int main() {
    int R;
    cin >> R;
    if(R < 1200) {
        cout << "ABC" << endl;
    } else if (R < 2800) {
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    M, D = map(int, input().split())
    #D10 = int(D[0])
    #D1 = int(D[1])

    count = 0
    for m in range(1,M+1):
        for d in range(1,D+1):
            if d>=10:
                d_ = str(d)
                D10 = int(d_[0])
                D1 = int(d_[1])
                D_ = D10 * D1
                if m == D_ and D10>=2 and D1>=2:
                    count += 1
                else:
                    D_ = 0

    print(count)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long num = 0;
        long numB = 0;
        long numA = 0;
        if (k % 2 == 1) {
            num = n / k;
            System.out.println((long) Math.pow(num, 3));
        } else {
            numA = n / k;
            if (numA * k + k / 2 <= n)
                numB = numA + 1;
            else
                numB = numA;
            System.out.println((long) Math.pow(numA, 3) + (long) Math.pow(numB, 3));
        }
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define ll long long
#define pub push_back
#define mp make_pair
#define MAX 
#define ull unsigned ll
 
using namespace std;

ifstream fin("input.txt");
string str;


int main()
{
  ios :: sync_with_stdio(false);
  
  int t ; 
  cin >> t ; 
  cin >> str ;
  
  int l = 0 , r = t - 1 , cnt = 0 ;
  
  while ( l < r )
  {
      if ( str[l] != 'W' )
      l++ ;
     
      if ( str[r] != 'R')
      r-- ;
      
      
      if (str[l] == 'W' && str[r] == 'R')
      {
        cnt += 1;
        l += 1 ;
        r -= 1 ;
      }
      
  }
  cout<<cnt<<endl ;
  
}

Measured memory_bytes: 3760
N = int(input())
yakusu = 0
ans = 0
for i in range(1,N+ 1):
    if i % 2 == 1:
        yakusu = 0
        for i2 in range(1,i + 1):
            if i % i2 == 0:
                yakusu += 1
        if yakusu == 8:
            ans += 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <queue>

using namespace std;

void solve()
{
	priority_queue<int> PQue;
	for(int i = 0; i < 10; ++i)
	{
		int temp;
		cin >> temp;
		PQue.push(temp);
	}
	for(int i = 0; i < 3; ++i)
	{
		cout << PQue.top() << endl;
		PQue.pop();
	}
}

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

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

#define fs first
#define sc second

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


// std::vector Declaration
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "[";
    bool a = 1;
    for (auto e : v) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "]";
    return os;
}

// std::deque Debug
template<typename T>
ostream& operator<<(ostream& os, const deque<T>& d) {
    os << "[";
    bool a = 1;
    for (auto e : d) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "]";
    return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << " " << p.second << ")";
    return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
    os << "{";
    bool a = 1;
    for (auto e : st) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "}";
    return os;
}

// std::multiset Debug
template<typename T>
ostream& operator<<(ostream& os, const multiset<T>& st) {
    os << "{";
    bool a = 1;
    for (auto e : st) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "}";
    return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
    os << "{";
    bool a = 1;
    for (auto e : mp) {
        os << (a ? "" : " ");
        os << e.first << ":" << e.second;
        a = 0;
    }
    os << "}";
    return os;
}

// std::tuple Debug
template<int N, class Tuple>
void out(ostream& os, const Tuple& t){}
template<int N, class Tuple, class H, class ...Ts>
void out(ostream& os, const Tuple& t) {
    if (N) os << " ";
    os << get<N>(t);
    out<N+1,Tuple,Ts...>(os, t);
}
template<class ...Ts>
ostream& operator<<(ostream& os, const tuple<Ts...>& t) {
    os << "(";
    out<0,tuple<Ts...>,Ts...>(os, t);
    os << ")";
    return os;
}

// Debug
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl


struct edge { int to, cost; };
ostream& operator<<(ostream& os, const edge& e) {
    os << "(" << e.to << ", " << e.cost << ")";
    return os;
}

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

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

    int cnt = 0;
    for (int i = 1; i < n; ++i) {
        if (s[i-1] != s[i]) {
            ++cnt;
        }
    }
    int ans = n-1 - max(0, cnt - 2*k);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <string>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

int cnt[111];
int k, t, cur, ans;

int gogo(void)
{
	int i;
	bool pos=false;
	for(i=1 ; i<=t ; i++)
	{
		if(cnt[i]>=1 && i!=cur)
		{
			pos=true;
		}
	}
	if(pos==false)
	{
		return cur;
	}
	int ret;
	int curmax=0;
	for(i=1 ; i<=t ; i++)
	{
		if(cnt[i]>curmax && i!=cur)
		{
			ret=i;
			curmax=cnt[i];
		}
	}
	return ret;
	
}
int main(void)
{
	cin>>k>>t;
	for(int i=1 ; i<=t ; i++)
	{
		scanf("%d",&cnt[i]);
	}
	for(int i=1 ; i<=k ; i++)
	{
		int nxt=gogo();
		cnt[nxt]--;
		if(cur==nxt)
		{
			ans++;
		}
		cur=nxt;
	}
	cout<<ans;
}

Measured memory_bytes: 256
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if (i+j) % 2 == 0:
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()


Measured memory_bytes: 7000
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

result = 'NO'

if a == b:
    result = 'YES'
elif a < b and b + w * t <= a + v * t:
    result = 'YES'
elif b < a and b - w * t >= a - v * t:
    result = 'YES'

print(result)


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

int n, k, a[104];
int dp[100004];

bool canWin(int piles){
	int& ret = dp[piles];
	if(ret != -1)	return ret;
	for(int i = 0;i<n;i++)
		if(piles>=a[i] && !canWin(piles-a[i]))
			return ret = true;
	return ret = false;
}
int main() {
	cin>>n>>k;
	memset(dp,-1,sizeof(dp));
	for(int i = 0;i<n;i++){	
		cin>>a[i];
		dp[a[i]] = true;
	}
	if(canWin(k))	cout<<"First";
	else	cout<<"Second";
	return 0;
}

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

int main(){
	int N;
	bool N_Flag;
	int first, second, current;
	cin>>N;
	for(int i=0;i<N;i++){
		N_Flag = false;
		first = -1;
		second = -1;
		for(int k=0;k<10;k++){
			cin>>current;
			if(current>first){
				first = current;
			}else{
				if(current>second){
					second = current;
				}else{
					N_Flag = true;
//					break;  去掉break的目的是完成循环，耗尽多余的数字，以便下一循环的数据正确 
				}
			}
		}
		if(N_Flag){
			cout<<"NO"<<endl;
		}else{
			cout<<"YES"<<endl;
		}
	}
}


Measured memory_bytes: 3092
#include<stdio.h>
int main(void){
    int a,b,c,i,x=0;
    scanf("%d %d",&a,&b);
    c=b-a;
    for(i=1; i<=c; i++){
        x+=i;
    }
    x=x-b;
    printf("%d\n",x);
    return 0;
}

Measured memory_bytes: 128
package main
 
import (
  "fmt"
)
 
func main() {
  var a, b int
  fmt.Scanf("%d %d", &a, &b)
  
  ans := b
  if a <= 12 {
    ans = b / 2
  }
  if a <= 5 {
    ans = 0
  }
  fmt.Printf("%d\n", ans)
}

Measured memory_bytes: 1832
import sys
n,m=map(int,input().split())
d=dict()
if n==1 and m==0:
  print("0")
  sys.exit()
l=[-1]*n
for _ in range(m):
  s,c=map(int,input().split())
  s-=1
  if (s in d.keys() and d[s]!=c) or s>=n:
    print("-1")
    sys.exit()
  d[s]=c
  l[s]=c
if l[0]==0 and n>1:
  print("-1")
  sys.exit()
for i in range(n):
  if i==0 and l[0]==-1:
    l[0]=1
  else:
    if l[i]!=-1:
      continue
    else:
      l[i]=0
print(*l,sep='')





Measured memory_bytes: 3064
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		String str = sc.next();
		String ans = sc.next();
		int count = 0;
		int max = 0;
		LinkedList<String> word = new LinkedList<String>();
		LinkedList<String> Ans = new LinkedList<String>();

		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		}
		for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}


Measured memory_bytes: 23252
#include<stdio.h>

int main(void){
int W,H;
int x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
if(x-r>=0&&y-r>=0&&x+r<=W&&y+r<=H) printf("Yes\n");
else printf("No\n");
return 0;
}

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

int main() {
  int A, B, C, m, s, ans;
  cin >> A >> B >> C;

  m = max(max(A, B), max(B, C));
  s = A + B + C;
  if (m * 3 % 2 == s % 2) ans = (m * 3 - s) / 2;
  else ans = (m * 3 + 3 - s) / 2;

  cout << ans << endl;
  return 0;
}


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

int f(int n){

  if(n%4==0)return n;
  if(n%4==1)return 1;
  if(n%4==2)return n+1;
	return 0;
}

signed main(){
  
  int a,b;
  cin >> a >> b;

  cout << (int)(f(max(0LL, a-1))^f(b)) << endl;
  
  
  return 0;
}
    
  


Measured memory_bytes: 256
#ifndef ___Geometry_Library
#define ___Geometry_Library

// ------ Includes ------ //
#include <cmath>
#include <complex>
#include <utility>
#include <algorithm>

// ------ Defines ------ //
typedef long double GType;
typedef std::complex<GType> Point;
typedef std::pair<Point, Point> Segment;

// ------ Constants ------ //
const GType EPS = 1.0e-10L;

// ------ Functions Level 1 ------ //
GType dot(const Point& p1, const Point& p2) {
	return (std::conj(p1) * p2).real();
}
GType cross(const Point& p1, const Point& p2) {
	return (std::conj(p1) * p2).imag();
}
int ccw(const Point& p1, const Point& p2, const Point& p3) {
	Point v1 = p2 - p1, v2 = p3 - p1;
	if (cross(v1, v2) > EPS) return +1;
	if (cross(v1, v2) < -EPS) return -1;
	if (dot(v1, v2) < -EPS) return +2;
	if (std::norm(v1) < std::norm(v2)) return -2;
	return 0;
}

// ------ Functions Level 2 ------ //
bool intersect(const Segment& s1, const Point& p1, bool segflag) {
	if (!segflag) return std::abs(cross(s1.second - p1, s1.first - p1)) < EPS;
	return (std::abs(s1.first - p1) + std::abs(s1.second - p1) - std::abs(s1.second - s1.first)) < EPS;
}
bool intersect(const Segment& s1, const Segment& s2, bool segflag) {
	if (!segflag) return cross(s1.second - s1.first, s2.first - s1.first) * cross(s1.second - s1.first, s2.second - s1.first) < EPS;
	return (ccw(s1.first, s1.second, s2.first) * ccw(s1.first, s1.second, s2.second)) <= 0 && (ccw(s2.first, s2.second, s1.first) * ccw(s2.first, s2.second, s1.second)) <= 0;
}

#endif

#include <iostream>
using namespace std;
int q, xa, ya, xb, yb; Segment s1, s2;
int main() {
	cin >> q;
	while (q--) {
		cin >> xa >> ya >> xb >> yb; s1 = make_pair(Point(xa, ya), Point(xb, yb));
		cin >> xa >> ya >> xb >> yb; s2 = make_pair(Point(xa, ya), Point(xb, yb));
		if (intersect(s1, s2, true)) cout << 1 << endl;
		else cout << 0 << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

const int mod = 1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	int ans = 0;
	vector<int> v(n+1);
	for(int i=0;i<n;i++) cin >> v[i];
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			ans += v[i]*v[j];
		}
	}
	cout << ans << "\n";
	
	return 0;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())
k = int(input())
al = [a, b, c]
bl = [a, b, c]
cl = [a, b, c]

for i in range(k):
    al[0] = al[0] * 2
    bl[1] = bl[1] * 2
    cl[2] = cl[2] * 2

sm = [sum(al), sum(bl), sum(cl)]
print(max(sm))


Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i=(a); i<(n); ++i)
#define rrep(i,a,n) for(ll i=(a); i>(n); --i)
#define erep(i,a,n) for(ll i=(a); i<=(n); ++i)
#define rerep(i,a,n) for(ll i=(a); i>=(n); --i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int) x.size())
#define print (X) cout << (X) << endl
#define _ << " " <<
static const int INF = 1e+9+7;
ll n,m,l;
str s,t;

int main(){

  cin >> n;
  vi A;
  rep(i,0,n){
    int x;
    cin >> x;
    A.pb(x);
  }
  sort(all(A));
  map<int,int> res;
  vi vc;
  rep(i,0,n-1){
    vc.pb(abs(A[i]-(A[n-1]-A[i])));
    res[abs(A[i]-(A[n-1]-A[i]))] = A[i];
  }

  sort(all(vc));
  int min_vc = vc[0];
  
  cout << A[n-1] _ res[min_vc] << endl; 

  return 0;
}





Measured memory_bytes: 5752
#include<bits/stdc++.h>
using namespace std;
#define N (int)1e5
typedef long long LL;
int tree[N + 1];
bool marked[N + 1];
LL Query(int now){
    if(marked[now]){
        return now;
    }
    else{
        return Query(tree[now]);
    }
}
void Mark(int index){
    marked[index] = true;
}
int main(){
    int n, q, arg;
    LL sum;
    char com;
    while(cin >> n >> q && n && q){
        sum = 0;
        memset(marked, 0, sizeof(marked));
        marked[1] = true;
        for(int i = 2; i <= n; i++){
            cin >> tree[i];
        }
        for(int i = 0; i < q; i++){
            cin >> com >> arg;
            if(com == 'Q'){
                sum += Query(arg);
            }
            else{
                Mark(arg);
            }
        }
        cout << sum << endl;
    }
}


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

class Program
{
    static void Main()
    {
        var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int N = NK[0], K = NK[1];

        var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

        for(int k=0; k<K; ++k) {
            var B = new int[N+1];
            for(int i=0; i<N; ++i) {
                int a = A[i];
                B[Math.Max(0, i-a  )]++;
                B[Math.Min(N, i+a+1)]--;
            }
            int v = 0;
            bool exist_not_N = false;
            for(int i=0; i<N; ++i) {
                v += B[i];
                A[i] = v;
                exist_not_N = exist_not_N || (v!=N);
            }
            if(!exist_not_N) break;
        }

        Console.WriteLine(string.Join(" ", A));
    }
}


Measured memory_bytes: 53212
#include <bits/stdc++.h>
#define ll long long
#define rgi register int
#define pii pair<int,int>
#define mkp make_pair
#define fi first
#define se second
#define pb push_back
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
using namespace std;
const int maxn=17;
int n,a[maxn],x[maxn][maxn],ch[maxn],tans,fans;
bool y[maxn][maxn],book[maxn];
inline bool check()
{
	memset(ch,-1,sizeof(ch));
	for(rgi i=1;i<=n;++i)
		if(book[i])
			for(rgi j=1;j<=a[i];++j)
			{
				int t=x[i][j];
				if(y[i][j]!=book[t])
					return 0;
				if(ch[t]==-1)
					ch[t]=y[i][j];
				else if(ch[t]!=book[t]||ch[t]!=y[i][j]||book[t]!=y[i][j])
					return 0;
			}
	return 1;
}
void dfs(int x)
{
	if(x==n+1)
	{
		if(check())
			fans=max(fans,tans);
		return;
	}
	book[x]=1;
	++tans;
	dfs(x+1);
	book[x]=0;
	--tans;
	dfs(x+1);
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n;
	for(rgi i=1;i<=n;++i)
	{
		cin>>a[i];
		for(rgi j=1;j<=a[i];++j)
			cin>>x[i][j]>>y[i][j];
	}
	dfs(1);
	cout<<fans<<endl;
	return 0;
}


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

#define int long long
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 d[10000010];

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

	int ans = 0;
	for(int i = 1;i <= n;i++){
		for(int j = i;j <= n;j+=i){
			d[j] += 1;
		}
		ans += d[i]*i;
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 81760