akhauriyash/Code-Regression huggingface dataset:
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n;
  vector<int> t(n);
  REP(i,n) cin >> t[i];
  cin >> m;
  int sum = accumulate(t.begin(), t.end(),0);
  REP(j,m) {
    int p, x;
    cin >> p >> x;
    int ans = sum - t[p-1] + x;
    cout << ans << endl;
  }
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

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

	cout << (a * b % 2 ? "Odd" : "Even") << endl;
}

Measured memory_bytes: 256
S = list(input())
K = int(input())
H=S[0]

flag=0
if(S[0]==S[len(S)-1]):
    flag=1
count=0
if(flag==0):
    for i in range(len(S)-1):
        if(S[i]==S[i+1]):
            S[i+1]="#"
            count+=1        
    print(count*K)
    exit()

flag2=0
for i in range(len(S)-1):
    if(S[i]!=S[i+1]):
        flag2=1
if(flag2==0):
    print((len(S)*K)//2)
    exit()

S1=S[:]
S2=S[:]+S[:]
S3=S[:]+S[:]+S[:]
RS=S[:]

count1=0
for i in range(len(S1)-1):
    if(S1[i]==S1[i+1]):
        S1[i+1]="#"
        count1+=1
count2=0
for i in range(len(S2)-1):
    if(S2[i]==S2[i+1]):
        S2[i+1]="#"
        count2+=1
count3=0
for i in range(len(S3)-1):
    if(S3[i]==S3[i+1]):
        S3[i+1]="#"
        count3+=1

N=count3-count2
E=count2-N

while(True):
    if(RS[0]==H):
        RS.pop(0)
    elif(RS[len(RS)-1]==H):
        RS.pop(len(RS)-1)
    else:
        break
rcount=0
for i in range(len(RS)-1):
    if(RS[i]==RS[i+1]):
        RS[i+1]="#"
        rcount+=1

print(count1+(K-1)*(count2-count1))

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
#define el endl
#define INF 1e8
typedef long long ll;
typedef long double ld;
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    int n;
    cin >> n;
    vector<ll> x(n);
    rep(i, n) cin >> x[i];
    ll ans = INF;
    for(int i = 1; i <= 100; i++){
        ll t = 0;
        for(int j = 0; j < n; j++){
            t += pow((i - x[j]), 2);
        }
        ans = ans < t ? ans : t;
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
class NormalInput {
  input: string[];
  pointer: number;
  constructor(raw: string) {
    this.input = raw.split(/ |\n/);
    this.pointer = 0;
  }
  int = (): number => {
    const ret = parseInt(this.input[this.pointer], 10);
    this.pointer++;
    return ret;
  };
  str = (): string => {
    const ret = this.input[this.pointer];
    this.pointer++;
    return ret;
  };
  strs = (length: number): string[] => {
    let ret: string[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.str());
    }
    return ret;
  };
  ints = (length: number): number[] => {
    let ret: number[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.int());
    }
    return ret;
  };
}
function rep(a: number, b: number) {
  let arr = [];
  for (let i = a; i < b; i++) arr.push(i);
  return arr;
}
function gcd(a: number, b: number) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
function Main({ int, str, strs, ints }: NormalInput) {
  const K = int();
  let sum = 0;
  for (let a = 0; a < K; a++)
    for (let b = 0; b < K; b++) {
      const gcdAB = gcd(a+1, b+1);
      for (let c = 0; c < K; c++) {
        const gcdABC = gcd(gcdAB, c+1);
        sum += gcdABC;
      }
    }
  console.log(sum);
}

//DO NOT EDIT
Main(new NormalInput(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 31696
n, m, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_, b_ = [0], [0]

for i in range(n):
    a_.append(a_[i] + a[i])
for i in range(m):
    b_.append(b_[i] + b[i])

ans = 0
j = m

for i in range(n+1):
    
    if a_[i] > k:
        break
    while b_[j] > k - a_[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

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

int gcd(int a,int b){
    if(a<b) gcd(b,a);
    while(a%b){
        int r=a%b;
        a=b;b=r;
    }
    return b;
}

int main() {
  
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++){
    cin >> A.at(i);
  }
  
  vector<int> pre(N); //累積GCD（前から）
  vector<int> suf(N); //累積GCD（後から）
  pre.at(0) = A.at(0);
  suf.at(N-1) = A.at(N-1);
  for (int i=1; i<N; i++){
    pre.at(i) = gcd(pre.at(i-1), A.at(i));
  }
  for (int i = N-2; i>=0; i--){
    suf.at(i) = gcd(suf.at(i+1), A.at(i));
  }
  
  int ans = suf.at(1); // 2番目以降の累積GCD
  
  for (int i=1; i<N-1; i++){
    ans = max(ans, gcd(pre.at(i-1), suf.at(i+1)));
  }
  ans = max(ans, pre.at(N-2)); // 一番後ろ以外の累積GCD
  
  cout << ans << endl; 
}


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

int main(){
	int a, b, c, x, counter=0;
	cin >> a >> b >> c >> x;
  	vector<int> A(++a, 500), B(++b, 100), C(++c, 50);
  	A[0]=0; B[0]=0; C[0]=0;
  	for(int i=2; i<a; i++) A[i]+=A[i-1];
  	for(int i=2; i<b; i++) B[i]+=B[i-1];
  	for(int i=2; i<c; i++) C[i]+=C[i-1];
  	for(int ac: A){
      for(int bc: B){
        for(int cc: C){
          if(ac+bc+cc==x) counter++;
        }
      }
    }
  	cout << counter << endl;
  	return 0;
}


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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef long double LD;
typedef pair<LD, LD> PLDLD;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()

const double eps=1e-5;
const LL INF=(LL)1e9*(LL)1e9;


int main()
{
    LL k;
    cin>>k;
    LL n=50;
    vector<LL> a(n,(k/n)+n-1);
    k%=n;
    REP(i,n)
    {
        if(i<k)
            a[i]+=n-k+1;
        else
            a[i]+=-k;
    }
    cout<<n<<endl;
    REP(i,n)
        cout<<a[i]<<" \n"[i==n-1];
    
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N, Q = map(int, input().split())
    S = input()
    appear = [0] * N # appear[i] = (0からi文字目までにACの出現した回数)

    prev = False
    if S[0] == 'A': prev = True
    for i in range(1, N):
        c = S[i]
        if c == 'A':
            prev = True
            appear[i] = appear[i - 1]
        elif prev and c == 'C':
            prev = False
            appear[i] = appear[i - 1] + 1
        else:
            prev = False
            appear[i] = appear[i - 1]
    #print(appear)
    
    for _ in range(Q):
        l, r = map(int, input().split())
        l, r = l - 1, r - 1
        if l == 0:
            print(appear[r])
        elif S[l-1:l+1] == "AC":
            print(max(0, appear[r] - appear[l - 1] - 1))
        else:
            print(appear[r] - appear[l - 1])


if __name__ == "__main__":
    main()


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

int main() {
	int x, y;
	for(;;){
		cin >> x >> y;
		if(x || y){
			if(x < y){
				cout << x << " " << y << endl;
			}else{
				cout << y << " " << x << endl;
			}
			continue;
		}
		return 0;
	}
}

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

int main(void) {
	int n,x;

	while (true)
	{
		int cnt = 0;

		cin >> n >> x;

		if (n == 0 && x == 0)
		{
			break;
		}

		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j < i; j++)
			{
				for (int k = 1; k < j; k++)
				{
					if ((i + j + k) == x)
					{
						cnt++;
						break;
					}
				}
			}
		}
		cout << cnt << endl;
	}


	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
ll ans;
string s;
void rec(ll i,ll val,ll pre){
    if(i==s.length()){
        ans+=val+pre;
    }
    else{
        rec(i+1,val,pre*10+s[i]-'0');
        rec(i+1,val+pre,s[i]-'0');
    }
}
int main(){
    cin >> s;
    rec(1,0,s[0]-'0');
    cout << ans << endl;
    return 0;
}

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

dic={}
for i in range(n):
    if dic.get(a[i])==None:
        dic[a[i]]=1
    else:
        dic[a[i]]+=1

ans=0
for key,number in dic.items():
    if number<key:
        ans+=number
    else:
        ans+=number-key
print(ans)


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

using namespace std;

#define ll long long

const int mxN = 403;
const ll nul = 1e18 + 5;

int n;
ll dp[mxN][mxN], val[mxN][mxN];
ll a[mxN];

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

    cin >> n;

    //for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { dp[i][j] = nul; } }

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

    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            val[i][j] = 0;
            for (int k = i; k <= j; k++) {
                val[i][j] += a[k];
            }
        }
    }

    for (int dis = 1; dis < n; dis++) {
        for (int start = 0; start < n - dis; start++) {
            ll tmp = nul;
            for (int cut = 0; cut < dis; cut++) {
                tmp = min(tmp, dp[start][start + cut] + dp[start + cut + 1][start + dis]);
            }
            dp[start][start + dis] = tmp + val[start][start + dis];
        }
    }

    //for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cout << val[i][j] << ' '; } cout << endl; }

    cout << dp[0][n - 1] << endl;
}


Measured memory_bytes: 2816
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[200010];


signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	int ans=0;
	int r=0;
	int sum=0;
	for(int i=0;i<N;i++){
		while(r<N&&(sum^A[r])==(sum+A[r])){
			sum+=A[r];
			r++;
		}
		ans+=r-i;
		if(i==r){
			r++;
		}
		else{
			sum-=A[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var p = o.l();
  var ans = 0;
  for(var i = 1; i < n-1; i++){
    if(p[i-1] > p[i] && p[i] > p[i+1])ans++;
    if(p[i-1] < p[i] && p[i] < p[i+1])ans++;
  }
  return ans;
}

Measured memory_bytes: 7372
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const double pi = 3.14159265358979323846;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    vector<int>a(5);
    rep(i,5){
        cin>>a[i];
    }
    rep(i,5){
        if(a[i]==0){
            cout<<i+1<<endl;
        }
    }

}


    









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

using namespace std;

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

	map<int, int> hash;

	for(int x=1; x<=100; x++)
	{
		for(int y=1; y<=100; y++)
		{
			for(int z=1; z<=100; z++)
			{
				int ans = x*x + y*y + z*z + x*y + y*z + z*x;
				hash[ans]++;
			}
		}
	}

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

Measured memory_bytes: 5464
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,ans = 0;
    cin >> n;
    vector<string> a(n);
    int cnt = 1;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(i != 0 && a[i - 1] != a[i])
        cnt++;
    }
    vector<string> b(cnt, "00");
    vector<int> c(cnt,0);
    int k = 0,l = 0;
    sort(a.begin(),a.end());
    b[0] = a[0];
    for(int i = 0; i < n; i++){
        if(b[k] != a[i])
        {
            k++;
            b[k] = a[i];
            ans = max(ans,c[l]);
            l++;
        }
        if(b[k] == a[i])
        {
            c[l]++;
        }
    }
    ans = max(ans,c[l]);
    for(int i = 0; i < cnt; i++){
        if(c[i] == ans)
        cout << b[i] << endl;
    }
}



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

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

	if(s=="SUN"){
		cout<<7<<endl;
	}
	if(s=="MON"){
		cout<<6<<endl;
	}
	if(s=="TUE"){
		cout<<5<<endl;
	}
	if(s=="WED"){
		cout<<4<<endl;
	}
	if(s=="THU"){
		cout<<3<<endl;
	}
	if(s=="FRI"){
		cout<<2<<endl;
	}
	if(s=="SAT"){
		cout<<1<<endl;
	}

	return 0;
}

Measured memory_bytes: 768
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = 0;
        int w = 0;
        while(true){
            h = sc.nextInt();
            w = sc.nextInt();
            if(h == 0 && w == 0){break;}
            for(int i = 1; i <= h;i++){
                for(int j = 1; j <= w;j++){
                    System.out.print("#");
                }
                System.out.println("");
            }
            System.out.println("");
       }
    }
}


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

int main()
{
	int A, B, X;
	cin >> A >> B >> X;
	if ( A <= X && X <= A + B ) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return ( 0 );
}


Measured memory_bytes: 256
def insertionSort(A, N):
    print " ".join([str(t) for t in A])
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print " ".join([str(t) for t in A])

if __name__ == "__main__":
    N = input()
    A = map(int, raw_input().split())
    insertionSort(A, N)

Measured memory_bytes: 6332
n, m = map(int, input().split())
a = set([int(input()) for _ in range(m)])
mod = 1000000007

dp = [1] + [0] * n
for i in range(1, n + 1):
    if i == 1:
        dp[i] = 1
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % mod
    if i in a:
        dp[i] = 0

print(dp[-1] % mod)

Measured memory_bytes: 57688
<?php
fscanf(STDIN,"%s",$str);
$result="Yes";
for($i=0; $i<strlen($str); $i++)
{
    $chars[$i] = $str[$i];
}
sort($chars);
if(strlen($str)%2==0)
{
    for($i=0; $i<strlen($str); $i+=2)
    {
        if($chars[$i] != $chars[$i+1])
        {
            $result="No";
        }
    }
}
else
{
    $result = "No";
}
echo($result);

Measured memory_bytes: 3704
#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 set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#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 vecsize(b,size) vector<int> (b)((size));
#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 pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007


int main()
{
int N;
	cin >> N;
	bool flag = true;
	fx(N) {
		int a;
		cin >> a;
		if (a%2!=0) {
			flag = false;
		}
	}

	if (!flag) {
		ce("first")
	}
	else {
		ce("second")
	}


    return 0;
}



Measured memory_bytes: 384
#include<iostream>
using namespace std;
int n,a[22];
int cnt[2001]={};

void es(){
  for(int i=0;i<(1<<n);i++){
    int sum=0;
    for(int j=0;j<n;j++){
      if(i>>j&1)sum+=a[j];
    }
    cnt[sum]++;
  }
}

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

  es();
  
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int x;
    cin>>x;
    cout<<(cnt[x]?"yes":"no")<<endl;
  }
  return 0;
}



Measured memory_bytes: 3104
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a,b;
	cin>>a>>b;
	cout<<a+(b/2)<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	string s;
	cin >> s;
	int n = s.length(), i, j, k;
	for (i = 0; (i < n) && (s[i] != 'C'); i++);
	for (; (i < n) && (s[i] != 'F'); i++);

	if (i < n) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

 
int main() {

    int n;
    cin >> n;
    vector<int> v(n);
    int sum=0,sum1=0,sum2=0;
    rep(i,n) {
        cin >> v.at(i);
        sum+=v[i];
    }

    int ans=100000000;
    rep(i,n-1) {
        for(int j=i+1;j<n;j++) {
            sum2+=v[j];
        }
        sum1=sum-sum2;
        ans=min(ans,abs(sum2-sum1));
        sum2=0;
    }

    cout<<ans<<endl;

 return 0;
}

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

int main()
{
    int n, k, q;
    cin >> n >> k >> q;

    vector<int> cnt(n, 0);
    rep(i, 0, q)
    {
        int a;
        cin >> a;
        --a;
        ++cnt[a];
    }
    rep(i, 0, n)
    {
        int score = k - q + cnt[i];
        if (score > 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
for i in range(n//7 + 1):
  t = n-7*i
  if t % 4 == 0:
    print('Yes')
    exit()
print('No')
















Measured memory_bytes: 26904
x = int(input())


if x < 600:
    print("8")
elif x < 800:
    print("7")
elif x < 1000:
    print("6")
elif x < 1200:
    print("5")
elif x < 1400:
    print("4")
elif x < 1600:
    print("3")
elif x < 1800:
    print("2")
elif x < 2000:
    print("1")

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

typedef long long ll;

const int inf = 1000000;

int main() {
    ll N;
    string s = "abcdefghijklmnopqrstuvwxyz";
    cin >> N;
    N--;

    vector<ll>v;
    ll i = 0;
    ll p;
    ll r;
    while (true) {
        p = N/26;
        r = N%26;
        N = p;
        N--;
        v.push_back(r);
        if (p == 0) {
            break;
        }
    }
    ll len = v.size();
    string ans = "";
    for (int k = len-1; k >= 0; k--) {
        ans += s[v[k]];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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

__attribute__ ((constructor))
void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> dis(n, vector<int>(n, inf));
    vector<int> to[n];
    map<pair<int, int>, int> mii;
    rep(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        a--;
        b--;
        mii[{a, b}] = c;
        mii[{b, a}] = c;
        dis[b][a] = c;
        dis[a][b] = c;
    }
    rep(k,n){
        rep(i,n){
            rep(j,n){
                chmin(dis[i][j],dis[i][k]+dis[k][j]);
                if(i == j)
                    dis[i][j] = 0;
            }
        }
    }
    int cnt = 0;
    for(auto u : mii){
        if(dis[u.first.first][u.first.second] < u.second)
            cnt++;
    }
    cout << cnt/2 << endl;
    return 0;
}


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

const int mxn = 100005;
int n,m,vis[mxn];
vector<int>adj[mxn];
void dfs(int u)
{
    vis[u] = 1;
    for(auto v : adj[u])
    {
        if(!vis[v])dfs(v);
    }
}
int main()
{
    cin >> n >> m;
    for(int i=1; i<=m; i++)
    {
        int p,q; cin >> p >> q;
        adj[p].push_back(q);
        adj[q].push_back(p);
    }
    int cnt = 0;
    for(int i=1; i<=n; i++)
    {
        if(vis[i]==0)
        {
            cnt++;
            dfs(i);
        }
    }
    cout << cnt-1 << "\n";
    return 0;
}


Measured memory_bytes: 9996
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
using ll=long long;

int n,m;

ll gcl(ll x,ll y){
    if(x<y) swap(x,y);
    while(y>0){
        ll t=x%y;
        x=y;
        y=t;
    }
    return x;
}

ll fac(int n){
    if(n==0||n==1) return 1;
    return n*fac(n-1)%1000000007;
}

int main(){
    cin>>n>>m;
    long long a;
    if(n==m) a=2;
    else if(abs(n-m)==1) a=1;
    else a=0;

    ll ans=a*(fac(n)*fac(m));
    cout<<ans%1000000007<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define cases long long t;cin>>t;while(t--)
#define f_io ios::sync_with_stdio(false); cin.tie(0)
#define foi(a,n) for(long long i=a;i<n;i++)
#define foj(a,n) for(long long j=a;j<n;j++)
#define fok(a,n) for(long long k=a;k<n;k++)
#define ll long long
#define MOD 1000000007
#define INF 1000000000
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int main()
{
    f_io;
    ll n,m;
    cin >> n >> m;
    n=n%m;
    n = min(n,abs(n-m));
    cout << n;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int

using namespace std;


int main(){

// #ifndef ONLINE_JUDGE
//     // for getting input from input.txt
//     freopen("input.txt", "r", stdin);
//     // for writing output to output.txt
//     freopen("output.txt", "w", stdout);
// #endif
    int n;
    int sum;
    cin>>n;
    cin>>sum;
    ll dp[n+1][sum+1];
    vector<int>w(n);
    vector<int>val(n);
    for(int i=0;i<n;i++){
    	cin>>w[i];
    	cin>>val[i];
    }
    for(int i=0;i<=n;i++){
    	for(int j=0;j<=sum;j++){
    		if(i==0||j==0)
    			dp[i][j] = 0;
    		else{
    			if(w[i-1]<=j)
    				dp[i][j] = max(dp[i-1][j],val[i-1]+
    								dp[i-1][j-w[i-1]]);
    			else
    				dp[i][j] = dp[i-1][j];
    			
    		}
    	}
    }
    cout<<dp[n][sum];
}
		

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a;
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputDoubleArray(a,N) double a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
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; }

int main(){
  //accumulateを用いる時は、第3引数がint型かどうか注意しましょう！！（自戒）
  
  //input
  inputInt(N);
  vector<int> H(N,0);
  fN(i,N) cin >> H[i];
  priority_queue<int> pq;
  
  for(int i=0; i<N; i++){
    if(i == 0){//左端
      if(H[i] >= H[i+1]){
        pq.push(i);
      }
    }else if(i==N-1){//右端
      if(H[i-1] < H[i]){
        pq.push(i);
      }
    }else{
      if(H[i-1] < H[i] && H[i] >= H[i+1]){//左より高く右以上の高さ。
        //次のiまでは右の方が高いor左の方が高い。
        pq.push(i);
      }
    }
  }
  
  //output
  int ans = 0;
  
  int n = pq.size();
  for(int i=0; i<n; i++){
    if(i==0){
      int h1 = pq.top();
      int count = 0;
      while(H[h1+count] >= H[h1+count+1] && h1+count < N-1){
        count++;
        ans = max(ans,count);//h1から右端まで何回移動できるか 
      }
    }else{
      int h1 = pq.top();pq.pop();
      int count = 0;
      while(H[h1+count] >= H[h1+count+1] && h1+count < N-1){
        count++;
        ans = max(ans,count);//h1から右端まで何回移動できるか 
      }
    }
  }
  
  output(ans);
  
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL){
    x=x->left;
  }
  return x;

}

Node treeMaximum(Node x){
  while(x->right!=NIL){
    x=x->right;
  }
  return x;
}

Node treeSearch(Node u, int k){
  if(u==NIL||k==u->key){
    return u;
  }
  if(k<u->key){
    return treeSearch(u->left,k);
  }else{
    return treeSearch(u->right,k);
  }
}

Node treeSuccessor(Node x){
  if(x->right!=NIL){
    return treeMinimum(x->right);
  }
  Node y=x->parent;
  while(y!=NIL&&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left==NIL||z->right==NIL){
    y=z;
  }else{
    y=treeSuccessor(z);
  }
  if(y->left!=NIL){
    x=y->left;
  }else{
    x=y->right;
  }
  if(x!=NIL){
    x->parent=y->parent;
  }
  if(y->parent==NIL){
    root=x;
  }else if(y==y->parent->left){
    y->parent->left=x;
  }else{
    y->parent->right=x;
  }
  if(y!=z){
    z->key=y->key;
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }else if(z->key<y->key){
    y->left=z;
  }else{
    y->right=z;
  }
}

void inorder(Node u){
  if(u==NIL){
    return;
  }
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL){
    return ;
  }
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20488
N = int(input())
H = list(map(int,input().split()))

a = 0
for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1] -= 1
        continue
    elif H[i] == H[i+1]:
        continue
    else:
        print("No")
        exit()
print("Yes")




Measured memory_bytes: 14224
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>

#define MAX_N (100000)
#define MAX_M (100000)

using namespace std;

int dps[MAX_N];

void init_dp(int N) {
  for (int i = 0; i < N; i++) {
    dps[i] = -1;
  }
}

int longest_path(const vector<vector<int>> &adj_lists, int i) {
  if (adj_lists[i].size() == 0) {
    return 0;
  }
  if (dps[i] < 0) {
    int dp = 0;
    for (int j : adj_lists[i]) {
      dp = max(dp, longest_path(adj_lists, j) + 1);
    }
    dps[i] = dp;
  }
  return dps[i];
}

int main() {
  // read inputs
  int N, M, xs[MAX_M], ys[MAX_M];
  scanf("%d %d", &N, &M);
  for (int k = 0; k < M; k++) {
    scanf("%d %d", &xs[k], &ys[k]);
    xs[k]--;  // NOTE : modified input
    ys[k]--;  // NOTE : modified input
  }

  // create graph
  vector<vector<int>> adj_lists(N, vector<int>());
  for (int k = 0; k < M; k++) {
    const int x = xs[k], y = ys[k];
    adj_lists[x].push_back(y);
  }
//   for (int i = 0; i < N; i++) {
//     printf("i = %d: ", i);
//     for (int j : adj_lists[i]) {
//       printf("%d ", j);
//     }
//     printf("\n");
//   }

  // solve
  int ans = 0;
  init_dp(N);
  for (int i = 0; i < N; i++) {
    ans = max(ans, longest_path(adj_lists, i));
    // printf("i = %d, max = %d\n", i, longest_path(adj_lists, i));
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define forall(it, v) for(auto it = v.begin(); it != v.end(); ++it)
#define dforn(i, n) for(int i = ((int) n) - 1; i >= 0; i--)
#define db(v) cerr << #v << " = " << v << endl
#define pb push_back
typedef long long ll;
const int MAXN = 1000050;

int n, m, ok[MAXN], a[MAXN], b[MAXN];
bool ans;

int main() {
  scanf("%d %d", &n, &m);
  forn(i, m){
    scanf("%d %d", &a[i], &b[i]);
    if(b[i] == n){
      ok[a[i]] = true;
    }
  }
  forn(i, m){
    if(a[i] == 1){
      if(ok[b[i]]){
        ans = true;
      }
    }
  }
  printf("%s\n", ans ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}


Measured memory_bytes: 9216
require 'matrix'
q = gets.to_i

def cross(p1, p2)
  return p1[0] * p2[1] - p1[1] * p2[0]
end

q.times do
  p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y = gets.split.map &:to_i
  p0 = Vector[ p0x, p0y ]
  p1 = Vector[ p1x, p1y ]
  p2 = Vector[ p2x, p2y ]
  p3 = Vector[ p3x, p3y ]

  if cross(p1-p0, p2-p0) * cross(p1-p0, p3-p0) < 0 &&
    cross(p3-p2, p0-p2) * cross(p3-p2, p1-p2) < 0
    puts 1
  elsif  ( cross(p1-p0, p2-p0) == 0 && (p1-p0).inner_product(p2-p0) >= 0 && (p2-p0).norm <= (p1-p0).norm ) ||
    ( cross(p1-p0, p3-p0) == 0 && (p1-p0).inner_product(p3-p0) >= 0 && (p3-p0).norm <= (p1-p0).norm )
    puts 1
  elsif  ( cross(p3-p2, p0-p2) == 0 && (p3-p2).inner_product(p0-p2) >= 0 && (p0-p2).norm <= (p3-p2).norm ) ||
    ( cross(p3-p2, p1-p2) == 0 && (p3-p2).inner_product(p1-p2) >= 0 && (p1-p2).norm <= (p3-p2).norm )
    puts 1
  else
    puts 0
  end
end

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n,a,b;
  cin >> n >> a >> b;
  cout << n/(a+b) * a + min(n%(a+b),a) << "\n";
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI acos(-1)
#define EPS 1e-12
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define bitCount __builtin_popcount
#define forn(i, n) for(i = 0; i < (ll)n; i++)
#define for1(i, n) for(i = 1; i <= (ll)n; i++)
#define forv(i, v) for(i = 0; i < v.size(); i++)
#define forab(i, a, b) for(i = a; i <= (ll)b; i++)
#define Sort(v) sort(v.begin(), v.end())
#define bend(v) v.begin(), v.end()
#define sz(v) v.size()
#define trace(x) cout<<"x = "<<x<<"\n"
#define trace2(x, y) cout<<"x = "<<x<<" y = "<<y<<"\n"
#define trace3(x, y, z) cout<<"x = "<<x<<" y = "<<y<<" z = "<<z<<"\n"
#define trace4(w, x, y, z) cout<<"w = "<<w<<" x = "<<x<<" y = "<<y<<" z = "<<z<<"\n"
#define ln "\n"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef set<int>::iterator sit;
typedef set<ll>::iterator sllt;
typedef set<char>::iterator sct;
typedef map<int, int>::iterator mit;
typedef vector<int>::iterator vit;
typedef multiset<int>::iterator msit;
const int maxn = 1e5+5;
const ll mod = 1e9+7;
const int alphabet = 26;
const int inf = INT_MAX;
const ll linf = 1e18+9;
namespace util{
	inline ll cnm(char ch){ return (ch-'0'); }
	inline ll cap(char ch){ return (ch-'a'); }
	inline void instr(string& s, ll& n){ cin>>s;    n = s.length(); }
	inline void instr(string& s){ cin>>s; }
	template<typename T> T gcd(T a, T b){ if(a==0) return b; return gcd(b%a, a); }
	template<typename T> bool min(T a, T b, T c){
		return  std::min(a, std::min(b, c));
	}
}
using namespace util;


void solve(int tc)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	ll i, j, k, m, n;
	string s;
	cin>>k;
	instr(s, n);

	if(n > k) s = s.substr(0, k) + "...";
	cout<<s;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int t = 1;
	int i = 1;
	// cin>>t;
	while(i <= t){
		solve(i);
		i++;
	}

	return 0;
}



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

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

    ll n;
    cin >> n;
    vector<ll> a(n);
    ll s = 0, t = n * (n + 1) / 2;
    rep(i, n)
    {
        cin >> a[i];
        s += a[i];
    }

    if (s % t != 0)
    {
        cout << "NO" << endl;
        return 0;
    }

    s /= t;

    rep(i, n) if ((a[(i + 1) % n] - a[i % n] - s) % n != 0 || a[(i + 1) % n] - a[i % n] > s)
    {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;

  

    return 0;
}


Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll k; cin>>k;
    vector<ll> a(50,49+(k/50));
    k%=50;
    rep(i,50){
        if(i<k) a[i]+=50-k+1;
        else a[i]-=k;
    }
    cout<<50<<endl;
    rep(i,49) cout<<a[i]<<" ";
    cout<<a[49]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;

int main() {
    string a,ans;
    cin >> a;
    sort(a.begin(),a.end());
    for (ll i=0;i<a.size();++i){
        ll x=count(a.begin(),a.end(),a[i]);
        if (x%2==0){
            i+=x;
            continue;
        }
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;
class Main {
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static boolean check_lunlun(long n){
        if(n<=10){
            return  true;
        }
        long prev=n%10;
        n=n/10;
        while(n>0){
            long curr=n%10;
            if(Math.abs(prev-curr)>1){
                return false;
            }
            prev=curr;
            n=n/10;
        }
        return true;
    }
    public static void main(String[] args) {
        FastReader ob = new FastReader();
        int k = ob.nextInt();
        Queue<Long> q  = new LinkedList<>();
        for (int i = 1; i <10 ; i++) {
            q.add((long)i);
        }
        for (int i = 0; i <k-1 ; i++) {
            long num = q.poll();
            if(num%10!=0){
                q.add(10*num+(num%10)-1);
            }
            q.add(num*10+(num%10));
            if(num%10!=9){
                q.add(num%10+10*num+1);
            }
        }
        System.out.println((long)q.peek());
    }
}

Measured memory_bytes: 33876
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

template <typename T>
T extgcd(T a, T b, T& x, T& y) {
    T s = a, t = b,
      xs = 1, ys = 0,
      xt = 0, yt = 1;

    while (t != 0) {
        T div = s / t;

        s -= t * div;
        xs -= xt * div;
        ys -= yt * div;

        std::swap(s, t);
        std::swap(xs, xt);
        std::swap(ys, yt);
    }

    x = xs;
    y = ys;
    return s;
}

struct Prime {
    int max_n;
    std::vector<int> primes;
    std::vector<bool> isp;

    explicit Prime(int max_n)
        : max_n(max_n), isp(max_n + 1, true) {
        isp[0] = isp[1] = false;
        for (int i = 2; i * i <= max_n; ++i) {
            if (isp[i]) {
                for (int j = i; i * j <= max_n; ++j) {
                    isp[i * j] = false;
                }
            }
        }

        for (int p = 2; p <= max_n; ++p) {
            if (isp[p]) primes.push_back(p);
        }
    }

    template <class T>
    bool isprime(T n) const {
        if (n <= max_n) return isp[n];
        for (T p : primes) {
            if (p * p > n) break;
            if (n % p == 0) return false;
        }
        return true;
    }

    template <class T>
    std::vector<std::pair<T, int>> factorize(T n) const {
        std::vector<std::pair<T, int>> facts;
        for (T p : primes) {
            if (p * p > n) break;
            if (n % p != 0) continue;
            int exp = 0;
            while (n % p == 0) {
                n /= p;
                ++exp;
            }
            facts.emplace_back(p, exp);
        }
        if (n > 1) {
            facts.emplace_back(n, 1);
        }
        return facts;
    }

    template <class T>
    static std::vector<T> divisors(T n) {
        std::vector<T> ret;
        for (T p = 1; p * p <= n; ++p) {
            if (n % p != 0) continue;
            ret.push_back(p);
            if (n / p == p) continue;
            ret.push_back(n / p);
        }
        return ret;
    }
};

using lint = long long;
const Prime P(40000000);

void solve() {
    lint n;
    std::cin >> n;

    auto fs = P.factorize(n * 2);
    std::vector<lint> ds;
    for (auto f : fs) {
        ds.push_back(1);
        while (f.second--) ds.back() *= f.first;
    }
    int k = ds.size();

    lint ans = n * 2;
    for (int b = 0; b < (1 << k); ++b) {
        lint d = 1;
        for (int i = 0; i < k; ++i) {
            if ((b >> i) & 1) d *= ds[i];
        }

        lint e = n * 2 / d;
        if (std::gcd(d, e) != 1) continue;

        lint x, y;
        extgcd(d, e, x, y);
        x *= -1;

        while (x <= 0) {
            x += e;
            y += d;
        }

        ans = std::min(ans, d * x);
    }

    std::cout << ans << "\n";

    // lint sum = 0;
    // for (lint x = 1;; ++x) {
    //     sum += x;
    //     if (sum % n == 0) {
    //         std::cerr << x << "\n";
    //         break;
    //     }
    // }
}

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

    solve();

    return 0;
}


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

int main(void){
  int a,b,c;
  cin >> a >> b >> c;
  if((a == b && a != c) || (a == c && a != b) || (c == b && c != a)){
    cout << "Yes" << endl;
  }
  else cout << " No" << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    
    ###################################
    #0~Nまで逆元などを事前計算
    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]
    
    for i in range(2, max(N,M) + 3):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)
    ###################################
    
    """
    Aは固定．
    
    「1つもない」は数え辛い，「少なくともk個ある」は数えやすい
    i=Piがk個以上ある
        kこ選ぶ：NCK
        残りを適当に並べる：(M-K)PK
        係数：(-1)^k
    
    """
    ans=0
    for k in range(N+1):
        cm=cmb(N,k,mod)
        rem=(fact[M-k]*factinv[M-N])%mod
        if k%2==0:
            c=1
        else:
            c=-1
        ans=(ans+c*cm*rem)%mod
        
    ans=(ans*fact[M]*factinv[M-N])%mod
    print(ans)
    
    


        
    

main()


Measured memory_bytes: 184416
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <queue>
 
using namespace std;
 
 
 
int main(){
 
    int n,tmp,row_sum,col_sum[11];
 
    while(true){
        scanf("%d",&n);
        if(n == 0)break;
 
        for(int i=0; i < 11; i++)col_sum[i] = 0;
 
        for(int i=0; i < n; i++){
            row_sum = 0;
            for(int k=0; k < n; k++){
                scanf("%d",&tmp);
                printf("%5d",tmp);
                row_sum += tmp;
                col_sum[k] += tmp;
            }
            printf("%5d\n",row_sum);
            col_sum[n] += row_sum;
        }
        for(int i=0; i <= n; i++)printf("%5d",col_sum[i]);
        printf("\n");
    }
 
    return 0;
}


Measured memory_bytes: 2648
#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

double kyori(int x, int y) {
    return sqrt(x*x + y*y);
}

int main()
{
    int d, e;
    while(cin >> d >> e, d) {
        double ans = 10000000000;
        loop(d/2 + 1, i) {
            int j = d - i;
            double zure = abs(kyori(i,j)-e);
            ans = min(ans, zure);
        }
        cout << ans << endl;
    } 
}

Measured memory_bytes: 3108
import numpy as np
n = int(input())

ans = 1e12
for i in range(1,int(((np.sqrt(n))+1)//1)+1):
    if n%i == 0:
        tmp = len(str(n//i))
        if ans > tmp:
            ans = tmp
        else:
            continue
            
print(ans)

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

int main() {
    int N,K;
    cin >> N>>K;
    int count=0;
    for (int i = 0; i < N; ++i) {
        int d = 0;
        cin >> d;
//        cout << i << endl;
        if(d >= K){
            count++;
//            cout << d << endl;
        }
    }
    cout << count<<endl;


    return 0;
}


Measured memory_bytes: 256