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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(s == u) --a;
    else if(t == u) --b;
    cout << a << " " << b << endl;
    return 0;
}



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

int main() {
    int n;
    cin >> n;
    vector<int> an(n),cn(n-1);
    int ans=0;
    rep(i,n){
        int a;
        cin >> a;
        an[i] = --a;
    }
    rep(i,n){
        int b;
        cin >> b;
        ans = ans + b;
    }
    rep(i,n-1){
        int c;
        cin >> c;
        cn[i] = c;
    }
 
    rep(i,n-1){
        if(an[i]+1==an[i+1]){
            ans = ans + cn[an[i]];
        }
    }

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

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# xor shift（F_2上の多項式）に関する gcd を計算する

from functools import reduce

X = int(readline().split()[1],2)
A = [int(x,2) for x in readlines()]

MOD = 998244353

def gcd(a,b):
    if a < b:
        a,b = b,a
    while b:
        LA = a.bit_length()
        LB = b.bit_length()
        a ^= b << (LA - LB)
        if a < b:
            a,b = b,a
    return a

g = reduce(gcd,A)

# g の "倍数" で、X以下のものを作る方法の数を数える
# 上位の桁を決めると、gの倍数は一意に決まる。
# よって、上位の桁がXに一致するときのみが問題

LX = X.bit_length()
Lg = g.bit_length()
answer = X >> (Lg - 1)

prod = 0
x = X; Lx = LX
while Lx >= Lg:
    prod ^= g << (Lx - Lg)
    x ^= g << (Lx - Lg)
    Lx = x.bit_length()

if prod <= X:
    answer += 1

answer %= MOD
print(answer)


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

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int n;
    cin >> n;
    vector<int64> a(n);
    vector<int64> sum(n+1, 0);
    for (int i=0; i<n; i++) cin >> a[i];

    int64 mod = 1e9 + 7;
    for (int i=n-1; i>=0; i--)  {
        sum[i] = sum[i+1] + a[i];
        sum[i] %= mod;
    }

    int64 ans = 0;
    for (int i=0; i<n; i++) {
        ans += (sum[i] + mod - a[i]) % mod * a[i];
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5892
#include<cstdio>
#include<iostream>

using namespace std;

int main(void) {
	int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	int dx = x2 - x1, dy = y2 - y1;	
	int x3 = x2 - dy, y3 = y2 + dx;
	int x4 = x3 - dx, y4 = y3 - dy;
	printf("%d %d %d %d\n", x3, y3, x4, y4);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
map<string,int>ha;
int n;ll ans;
string st; 
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){cin>>st;sort(st.begin(),st.end());ans+=ha[st];ha[st]++;}
	cout<<ans<<endl;
}

Measured memory_bytes: 11136
#include<cstdio>
int main()
{
	long long a,b,k;
	scanf("%lld%lld%lld",&a,&b,&k);
	if(k<=a)
		printf("%lld %lld",a-k,b);
	else if(k>a&&k<=a+b)
		printf("0 %lld",a+b-k);
	else
		printf("0 0");
}

Measured memory_bytes: 128
N = int(input())
l = [ list(map(int,input().split(" "))) for i in range(N)]

#print(l[1][1])
Nroot = 0
Nsta = 0
Nkai = 1
Nre = 0
ans =0

for m in range(N):
    Nroot += m
#    print(Nroot)

for o in range(N):
    Nkai = Nkai * (o+1)
#    print(Nkai)

Nre = (Nkai * (N-1)) / Nroot

for j in range(N-1):
    for k in range(N-(j+1)):
        dis = ((l[j][0]-l[k+j+1][0])**2 + (l[j][1]-l[k+j+1][1])**2)**0.5
#        print("j",j, "k", k, dis)
        ans += (dis * Nre) / Nkai

print(ans)

                 


Measured memory_bytes: 3064
#include<iostream>

using namespace std;


int main()
{

	int N;
	cin >> N;
	int A[210];

	int i;
	int hantei;
	int counter = 0;

	for(i=1;i<=N;i++){
		cin >> A[i];
	}
	
	do {
		hantei = 0;
		for (i = 1;i <= N;i++) {
			if (A[i] % 2 == 0) {
				hantei = hantei + 1;
				A[i] = A[i] / 2;
			}
		}
		counter++;
	} while (hantei == N);

	counter--;

	cout << counter << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

int xs[101];
int ys[101];
int hs[101];

int calc_height(int x, int y, int cx, int cy, int h){
  return max(h - abs(x - cx) - abs(y - cy), 0);
}

int main(){
  int N = 0;
  scanf("%d", &N);
  int maxhdata = -1;
  for(int i=0; i < N; i++){
    scanf("%d %d %d", xs + i, ys + i, hs + i);
    maxhdata = max(maxhdata, hs[i]);
  }
  int res_cx = -1;
  int res_cy = -1;
  int res_h = -1;
  for(int cx=0; cx <= 100; cx++){
    for(int cy=0; cy <= 100; cy++){
      for(int h=maxhdata; h <= maxhdata + 100; h++){
        bool ok = true;
        for(int i=0; i < N; i++){
          if (calc_height(xs[i], ys[i], cx, cy, h) != hs[i]){
            ok = false;
            break;
          }
        }
        if(ok){
          res_cx = cx;
          res_cy = cy;
          res_h = h;
          goto FOUND;
        }
      }
    }
  }
FOUND:
  printf("%d %d %d\n", res_cx, res_cy, res_h); 
  
  return 0;
}


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

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

ll n,m,k;

int main(){
    cin >> n >> m >> k;
    UnionFind tree(n);
    vector<set<ll>> memo(n);
    for(ll i=0;i<m;i++){
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        memo[a].insert(b);
        memo[b].insert(a);
        tree.merge(a,b);
    }
    for(ll i=0;i<k;i++){
        ll c,d;
        cin >> c >> d;
        c--;
        d--;
        if(!tree.issame(c,d)) continue;
        memo[c].insert(d);
        memo[d].insert(c);
    }
    for(ll i=0;i<n;i++){
        ll res=tree.size(i)-1;
        res -= memo[i].size();
        cout << res << " ";
    }
    cout << endl;
    return 0;
}  


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

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

using namespace std;

bool check(string s) {
  if( s.size() < 2 ) return false;
  bool phase = false; // f --> A, t --> Z
  rep(i,s.size()){
    if( s[i] != 'A' && s[i] != 'Z' ) return false;
    if( !phase && s[i] != 'A' ) return false;
    if(  phase && s[i] != 'Z' ) return false;
    phase = !phase;
  }
  if( s[0] != 'A' || s[(int)s.size()-1] != 'Z' ) return false;
  return true;
}

int main(){
  string s;
  cin >> s;
  int len = s.size();
  string ans = "";
  rep(i,(1<<len)){
    string t = "";
    rep(j,len) if( (i>>j) & 1 ) t += string(1,s[j]);
    if( check(t) ) {
      if( ans.size() < t.size()  ) ans = t;
    }
  }
  if( ans.empty() ) puts("-1");
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define REP(i, s, e) for(int i = (int)(s); i < (int)(e); ++i)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using ll = long long int;
int main() {
  int n, m;
  while(cin >> n >> m) {
    if(n == 0 && m == 0) break;
    vector<ll> x(n), y(m);
    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];
    REP(i, 1, n) x[i] += x[i-1];
    REP(i, 1, m) y[i] += y[i-1];
    map<ll, int> X, Y;
    rep(i, n) X[x[i]]++;
    rep(i, m) Y[y[i]]++;
    rep(i, n) rep(j, i) X[x[i] - x[j]]++;
    rep(i, m) rep(j, i) Y[y[i] - y[j]]++;
    ll ans = 0LL;
    for(auto&& p : X) {
      ans += p.second * Y[p.first];
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 44792
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar(‘\n‘)
#define space putchar(‘ ‘)
#define eps 1e-8
#define mo 974711
#define MAXN 1000005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
const int MOD = 1000000007;
int N,K,C[1005][1005],L[75],fac[1005],invfac[1005],cnt;
int sum[75],pos[75],tot,ans,matc[75];
char s[75];
bool vis[75];
int inc(int a,int b) {
	return a + b >= MOD ? a + b - MOD : a + b;
}
int mul(int a,int b) {
	return 1LL * a * b % MOD;
}
void update(int &x,int y) {
	x = inc(x,y);
}
int fpow(int x,int c) {
	int res = 1,t = x;
	while(c) {
		if(c & 1) res = mul(res,t);
		t = mul(t,t);
		c >>= 1;
	}
	return res;
}
bool check() {
	if(tot < cnt) return false;
	memset(sum,0,sizeof(sum));
	int p = 1;
	for(int i = cnt ; i >= 1 ; --i) {
		sum[pos[i]]++;
		if(L[p] >= 2) {
			if(!matc[pos[i]]) return false;
			sum[matc[pos[i]]] += L[p] - 1;
		}
		++p;
	}
	for(int i = K ; i >= 1 ; --i) {
		sum[i] += sum[i + 1];
		if(sum[i] > K - i + 1) return false;
	}
	return true;
}
bool dfs(int pre,int dep,int len) {
	cnt = dep;
	if(!check()) return false;
	int k = 1 + cnt;
	for(int i = 1 ; i <= cnt ; ++i) {
		if(L[i] == 1) ++k;
		else k += 2 * L[i] - 1;
	}
	int res = C[N - len + k - 1][k - 1];
	res = mul(res,fac[cnt]);
	int t = 0;
	for(int i = 1 ; i <= cnt ; ++i) {
		if(L[i] != L[i - 1]) {
			res = mul(res,invfac[t]);
			t = 0;
		}
		++t;
	}
	res = mul(res,invfac[t]);
	update(ans,res);
	if(dep + 1 > tot) return true;
	for(int i = pre ; i <= 70 ; ++i) {
		int tl = len;
		if(dep != 0) ++tl;
		if(i == 1 || i == 2) tl += 1;
		else tl += i - 2 + i - 1;
		if(tl > N) break;
		L[dep + 1] = i;
		if(!dfs(i,dep + 1,tl)) break;
	}
	return true;
}
void Solve() {
	cin >> N >> K;
	scanf("%s",s + 1);
	C[0][0] = 1;
	for(int i = 1 ; i <= 1000 ; ++i) {
		C[i][0] = 1;
		for(int j = 1 ; j <= i ; ++j) {
			C[i][j] = inc(C[i - 1][j - 1],C[i - 1][j]);
		}
	}
	fac[0] = 1;
	for(int i = 1 ; i <= 1000 ; ++i) fac[i] = mul(fac[i - 1],i);
	invfac[1000] = fpow(fac[1000],MOD - 2);
	for(int i = 999 ; i >= 0 ; --i) invfac[i] = mul(invfac[i + 1],i + 1);
	tot = 0;
	for(int i = 1 ; i <= K ; ++i) {
		if(s[i] == 'r') {
			pos[++tot] = i;

			for(int j = i + 1 ; j <= K ; ++j) {
				if(s[j] == 'b' && !vis[j]) {
					matc[i] = j;
					vis[j] = 1;
					break;
				}
			}
		}
	}
	dfs(1,0,0);
	cout << ans << endl;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
	return 0;
}

Measured memory_bytes: 4224
#include <iostream>


using namespace std;

int A,B,C,D;

int main()
{
	cin >> A >> B>>C>>D;

	int L = A + B;
	int R = C + D;

	
	if (L>R) {
		cout << "Left" << endl;
	}
	else if (L<R){
		cout << "Right" << endl;
	}
	else {
		cout << "Balanced" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

ll n;
vector<ll> a,b;

bool can(ll x){
    for(int i=0;i<n;i++){
        b[i]=a[i]+x;
    }
    ll cnt=0;
    for(auto &I:b){
        cnt+=(I+1)/(n+1);
    }
    return cnt<=x;
}


int main(){
    cin>>n;
    a.resize(n);
    b.resize(n);
    ll cnt=0;
    for(auto &I:a){cin>>I; cnt+=I;}
    for(ll i=max(cnt-n*n,0LL);;i++){
        if(can(i)){cout<<i<<endl; return 0;}
    }
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int n, k,p[1000];
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}
	int box,sum=0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (p[i] > p[j]) {
				box = p[i];
				p[i] = p[j];
				p[j] = box;
			}
		}
	}
	for (int i = 0; i < k; i++) {
		sum += p[i];
	}
	printf("%d", sum);

	return 0;
}

Measured memory_bytes: 2172
use v5.18;
use warnings;
sub read_line { chomp(my $str = <STDIN>); $str }
sub splited_read_line { split / /, read_line }
my ($cat, $cat_or_dog, $x) = splited_read_line;
say $cat + $cat_or_dog >= $x && $cat <= $x ? 'YES' : 'NO';


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

using namespace std;

#define MOD 1000000007

int n, ia, ib = 1;
char x[100005];
long long dp[4] = {1}, tmp[4];
int ta;

int main() {	dp[0] ;
	scanf("%s", x);
	n = strlen(x);
	for (int i = 0; i < n; i++) {
		if (x[i] == '?') {
			memcpy(tmp, dp, sizeof(dp));
			memset(dp, 0, sizeof(dp));
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 4; k++)
					dp[k] = (dp[k] + tmp[k]) % MOD;
				dp[j + 1] = (dp[j + 1] + tmp[j]) % MOD;
			}
		} else {
			ta = x[i] - 'A';
			dp[ta + 1] = (dp[ta + 1] + dp[ta]) % MOD;
		}
		// for (int j = 0; j < 4; j++) printf("%lld%c", dp[j], j == 3 ? '\n' : ' ');
	}
	printf("%lld\n", dp[3]);
	return 0;
}


Measured memory_bytes: 384
import math

n, d = map(int, input().split())
points = [list(map(int, input().split())) for _ in range(n)]

def dist(x, y):
    tmp = 0.0
    for i in range(d):
        tmp += (x[i] - y[i]) ** 2
    return math.sqrt(tmp)


count = 0
for i, elm in enumerate(points):
    for j in range(i+1, n):
        if dist(elm, points[j]).is_integer():
            count += 1

print(count) 


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <map>

using namespace std;

string verd[] = { "AC", "WA", "TLE", "RE" };

int main() {
  int n; cin >> n;
  map<string, int> freq;
  while(n--) {
    string s; cin >> s;
    freq[s]++;
  }
  for(int i = 0; i < 4; ++i) {
    cout << verd[i] << " x " << freq[verd[i]] << endl;
  }
  return 0;
}


Measured memory_bytes: 3192
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b,h,w = inpl()
x,y = 30*(h+(w/60)), 6*w
C = min(abs(x-y),360-abs(x-y))
tmp = a**2 + b**2 - 2*a*b*math.cos(math.radians(C))
print(math.sqrt(tmp))

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

string S;
ll ans = 0;

void dfs(int i, string subS) {
    if (i == S.length() - 1) {
        string tmp = "";
        for (int j = 0; j < subS.length(); j++) {
            if (subS[j] == '+') {
                ans += stoll(tmp);
                tmp = "";
            }
            else {
                tmp += subS[j];
            }
        }
        ans += stoll(tmp);
    }
    else {
        dfs(i+1, subS + S[i+1]);
        dfs(i+1, subS + "+" + S[i+1]);
    }
    return;
}

int main() {
    cin >> S;
    
    dfs(0, string(1, S[0]));

    cout << ans << endl;

    return 0;
}


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


int main(){
  int N;
  cin >>N;
  int c0=0,c1=0,c2=0,c3=0;
  REP(i,N){
    string s;
    cin >>s;
    if (s == "AC"){
     c0 ++ ;
    }else if(s == "WA"){
     c1 ++ ;
    }else if (s == "TLE"){
     c2 ++ ;
    }else{
     c3 ++ ;
    }
  }
  
  cout <<"AC x "<<c0<<endl;
  cout<<"WA x "<<c1<<endl;
  cout<<"TLE x "<<c2<<endl;
  cout<<"RE x "<<c3<<endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
	int n, i, score=0, hit=0, out=0;
	string s;
	
	cin >> n; cin.get();
	
	for (i=0; i<n;) {
		getline(cin, s);
		if (s == "HIT") {if (++hit == 4) {score++; hit--;}}
		else if (s == "HOMERUN") {score += hit+1; hit = 0;}
		else if (s == "OUT") {if (++out == 3) {out=0; hit = 0; cout << score << endl; score=0; i++;}}
	}
	return 0;
}

Measured memory_bytes: 0
// Aaradhya Beri
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}
 
void solve() {
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    rep(i,0,n)
    {
        cin>>w[i]>>v[i];
    }
    ll dp[n+1][W+1];
    fr(i,0,n)
    {
        fr(j,0,W)
        {
            if( i == 0|| j == 0)
                dp[i][j] = 0;
            else if(j >= w[i-1])
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]] + v[i-1]);        
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout<<dp[n][W];
}
 
signed main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    int t = 1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 79232
// Enjoy your stay.

#include <bits/stdc++.h>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

typedef istringstream iss;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef stringstream sst;
typedef vector<ll> vi;

string s;
string vw="aiueo",cn="kstnhmyrwgzdbp",cho="aiu",cn2="ksthp@";

bool isvowel(char c){
	return vw.find(c)!=-1;
}
bool isconso(char c){
	return cn.find(c)!=-1;
}
bool isconso2(char c){
	return cn2.find(c)!=-1;
}
bool isC(char c){
	return cho.find(c)!=-1;
}

int main2(){
	vi v;
	vector<string> t;
	int cur=0;
	while(s[cur]!='@'){
		if(isvowel(s[cur])){
			if(isC(s[cur]) && cur>=1 &&  isvowel(s[cur-1])){
				v.pb(6);
			}else{
				v.pb(1);
			}
			string st;
			st+=s[cur];
			t.pb(st);
			cur+=1;
		}
		else if(isconso(s[cur])){
			if(isvowel(s[cur+1])){
				v.pb(2);
				string st;
				st+=s[cur];
				st+=s[cur+1];
				t.pb(st);
				cur+=2;
			}
			else if(s[cur]!='y' && s[cur]!='w' && s[cur+1]=='y' && isvowel(s[cur+2])){
				v.pb(3);
				string st;
				st+=s[cur];
				st+=s[cur+1];
				st+=s[cur+2];
				t.pb(st);
				cur+=3;
			}
			else if(s[cur]!='n' && s[cur]==s[cur+1]){
				v.pb(4);
				string st;
				st+=s[cur];
				t.pb(st);
				cur+=1;
			}else{
				assert(s[cur]=='n');
				v.pb(5);
				string st;
				st+=s[cur];
				t.pb(st);
				cur+=1;
				if(s[cur]=='\''){
					t[sz(t)-1]+='\'';
					cur+=1;
				}
			}
		}
	}
	//rep(i,sz(v))cout<<v[i]<<","<<t[i]<<" ";cout<<endl;
	v.pb(7);
	t.pb("@@@");
	int pre=0;
	rep(i,sz(v)-1){
		string m=t[i];
		if(v[i]==2 || v[i]==3){
			if(pre){
				cout<<m;
				pre=0;
			}
			else if(m[sz(m)-1]=='i' || m[sz(m)-1]=='u'){
				if(isconso2(m[0]) && isconso2(t[i+1][0])){
					cout<<m.substr(0,sz(m)-1)<<"("<<m[sz(m)-1]<<")";
					pre=1;
				}
				else{
					cout<<m;
				}
			}
			else if(m[sz(m)-1]=='a' || m[sz(m)-1]=='o'){
				if(isconso2(m[0]) && isconso2(t[i+1][0])
				&& m[sz(m)-1] == t[i+1][sz(t[i+1])-1]){
					cout<<m.substr(0,sz(m)-1)<<"("<<m[sz(m)-1]<<")";
					pre=1;
				}
				else{
					cout<<m;
				}
			}
			else{
				cout<<m;
			}
		}
		else if(v[i]==1 || v[i]==6){
			pre=0;
			cout<<m;
		}
		else if(v[i]==4 || v[i]==5){
			cout<<m;
		}
	}
	cout<<endl;
	return 0;
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	while(cin>>s,s!="#"){
		s+="@@";
		main2();
	}
}

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

int main() {
	int h, r;

	cin >> h >> r;

	if(h > - r)
		cout << 1 << endl;
	else if (h + r == 0)
		cout << 0 << endl;
	else
		cout << -1 << endl;

	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
using namespace std;
int n, m, a[12], b[12], dp[1 << 12];
int main() {
	while (cin >> n >> m, n + m) {
		for (int i = 0; i < n; i++) cin >> a[i];
		for (int i = 0; i < m; i++) cin >> b[i];
		if (n < m) swap(n, m), swap(a, b);
		fill(dp, dp + (1 << n), 0);
		for (int i = 1; i < (1 << n); i++) {
			int r = __builtin_popcount(i);
			if (r > m) continue;
			for (int j = 0; j < n; j++) {
				if (i & (1 << j)) {
					int p = abs(a[j] - b[r - 1]);
					dp[i] = max(dp[i], dp[i - (1 << j)] + p * (p - 30) * (p - 30));
				}
			}
		}
		cout << *max_element(dp, dp + (1 << n)) << endl;
	}
	return 0;
}

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

// 2つの整数の場合
long long GetLeastCommonMultiple(long long a, long long b) {
	long long m = a;
	long long n = b;
	long long temp;
	while (m % n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}
	return a / n * b;
}

int main() {

    ll a, b; cin >> a >> b;
	cout << GetLeastCommonMultiple(a, b) << endl;
    return 0;
}

Measured memory_bytes: 3536
import collections
 
def primes(n): #試し割り法で各素因数とその指数を求める
 cnt=collections.defaultdict(int)
 for i in range(2,int(n**0.5)+1):
   if n%i==0:
     while n%i==0:
       cnt[i]+=1
       n//=i
 if n!=1:
   cnt[n]+=1
 return cnt
 
n=int(input())
cnt=primes(n)
ans=0
for key in cnt.keys():
    val=cnt[key]
    for i in range(100): #各素因数の指数について、k(k+1)//2<=(指数)を満たす最大のkを求める
        if (i*(i+1))//2>val:
            ans+=i-1
            break
print(ans)

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

public class Hello
{
    public static void Main()
    {
        // Your code here!
        int N = int.Parse(Console.ReadLine());
        if(solve(N) == true)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }

       
    }
    
     public static bool solve(int N)
    {
        //再帰の終了条件
        if(N == 0) return true;
        else if(N < 0) return false;
        
        //部分問題に分割
        bool t = solve(N - 4) || solve(N - 7);
        return t;
        
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <set>

using namespace std;

int h, w;
vector<string> s;

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

int main()
{
    cin >> h >> w;
    s.resize(h);
    for (auto &&i : s)
    {
        cin >> i;
    }
    set<tuple<int, int>> checked;
    int ans = 0;
    for (int sx = 0; sx < h; sx++)
    {
        for (int sy = 0; sy < w; sy++)
        {
            if (s[sx][sy] == '#')
                continue;
            checked.clear();
            queue<tuple<int, int, int>> q;
            q.push(make_tuple(sx, sy, 0));
            while (!q.empty())
            {
                auto status = q.front();
                int x = get<0>(status), y = get<1>(status), moved = get<2>(status);
                q.pop();
                if (checked.count(make_tuple(x, y)))
                {
                    continue;
                }
                checked.insert(make_tuple(x, y));
                ans = max(ans, moved);
                for (int i = 0; i < 4; i++)
                {
                    if (x + dx[i] < 0 || y + dy[i] < 0 || x + dx[i] == h || y + dy[i] == w)
                    {
                        continue;
                    }
                    if (s[x + dx[i]][y + dy[i]] == '#')
                    {
                        continue;
                    }
                    q.push(make_tuple(x + dx[i], y + dy[i], moved + 1));
                }
            }
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner stdIn = new Scanner(System.in);
		
		int N = stdIn.nextInt();
		
		int y = stdIn.nextInt();
		int min = y;
		int max = y;
		long sum = y;
		
		for(int i=1;i<N;i++)
		{
			int x = stdIn.nextInt();
			sum+=x;
			if(min>x)
			{
				min = x;
			}
			else if(max<x)
			{
				max = x;
			}
		}
		
		System.out.println(min+" "+max+" "+sum);
	}

}

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

int main()
{
    int r,c;
    cin >> r >> c;

    int table[r+1][c+1];

    for(int i=0; i<r; i++)
    {
        for(int j=0; j<c; j++)
        {
           cin >> table[i][j];
        }
    }

    for(int i=0; i<r+1; i++)
    {
        table[i][c] = 0;

        for(int j=0; j<c; j++)
        {
            table[i][c] += table[i][j];
        }
    }

    for(int i=0; i<c+1; i++)
    {
        table[r][i] = 0;

        for(int j=0; j<r; j++)
        {
            table[r][i] += table[j][i];
        }
    }

    for(int i=0; i<r+1; i++)
    {
        for(int j=0; j<c; j++)
        {
           cout << table[i][j] << " ";
        }
        cout << table[i][c] << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7


N = int(input())
lst = [50] * 26
for _ in range(N):
    S = list(input())
    tmp = [0] * 26
    for s in S:
        tmp[ord(s) - ord('a')] += 1
    for i in range(26):
        lst[i] = min(lst[i], tmp[i])

for i in range(26):
    if lst[i] > 0:
        s = chr(ord('a') + i) * lst[i]
        print (s, end = '')

print ()

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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    int n, k;
    cin >> n >> k;
    cout << (n + k - 3) / (k - 1);
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 1000005;

int n;
char a[N];

int sum[N], suf[N];

int solve(int mn) {
	int mx = 0, d = 0;
	for (int i = 1; i <= n; ++i) {
		if (a[i] == '?' && suf[i] - d - 2 >= mn) {
			d += 2;
		}
		mx = std::max(mx, sum[i] - d);
	}
	return mx - mn;
}

int main() {
	n = readStr(a + 1);
	for (int i = 1; i <= n; ++i) {
		sum[i] = sum[i - 1] + (a[i] == '0' ? -1 : 1);
	}
	suf[n] = sum[n];
	for (int i = n - 1; i >= 0; --i) {
		suf[i] = std::min(suf[i + 1], sum[i]);
	}
	print(std::min(solve(suf[0]), solve(suf[0] - 1)));
}


Measured memory_bytes: 13416
using System;

namespace abab145
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            string b;
            a = int.Parse(Console.ReadLine());
            b = Console.ReadLine();
            
            int len = b.Length;
            var n = (len / 2)-1;
            var g = len-1;
            var c = n + 1;
            var l = len / 2;
            var str1 = b.Substring(0, l);
            var str2 = b.Substring(l,l);

            if (a >= 2 && a % 2 == 0)

                if (str1 == str2)
                {
                    Console.WriteLine("Yes");
                }
                else
                    Console.WriteLine("No");



            else
                Console.WriteLine("No");
 

        }
    }
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll A,B,K; cin >> A >> B >> K;
    for(ll X = A; X <= B; X++){
        if(abs(X-A) < K || abs(X-B) < K) cout << X << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, i, cnt=0;
    string s;

    cin >> s;

    N = s.size();

    for(i=0; i<N; i++){
        if(s[i]=='p'){
            cnt++;
        }
    }

    cout << N/2-cnt << endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	int n,ans=0;
	cin>>n;
	vector<int> d(n);
	rep(i,n) cin>>d.at(i);
	rep(i,n){
		for(int j=i+1;j<n;j++){
			ans+=d.at(i)*d.at(j);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a,b=0,c,k,p=0,q=0;
cin>>a>>b>>c>>k;
p=k-a;
q=k-a-b;
if(a>=k)
cout<<k<<endl;
else if(b+a==k&&b>=k-a)
cout<<a<<endl;
else if(q+a+b==k)
cout<<a+q*(-1)<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<utility>
#include<queue>
using namespace std;
#define LL long long
#define MOD 1000000007

int a, b, c, d, n, m, A[10000] = {}, ans = 0;
string s;

int main() {
	cin >> a >> b;
	for (int i = 0; i <= 1000; i++) {
		if (i)A[i] = A[i - 1];
		A[i] += i;
	}
	for (int i = 1; i <= 1000; i++) {
		if (b - a == i) {
			cout << A[i - 1] - a << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

#define endl '\n'
#define ll long long

using namespace std;

int main() {
    ll v[3], menor, n;

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

    for(int i = 0; i < 2; i++) {
        n = v[i] + v[i + 1];
        
        if(n < menor) {
            menor = n;
        }
        
        n = v[(i + 1) % 3] + v[(i + 2) % 3];

        if(n < menor) {
            menor = n;
        }
    } 

    cout << menor << endl;

    return 0;
}

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

int main() {
    vector<string> day{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < 7; i++){
      if(s==day.at(i))
        ans = i;
    }
    cout << 7 - ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
using ll = long long ;
int main()
{ long long x, m = 100, ans = 0;
  cin >> x;
  while(m < x)
  {
    m += m/100;
    ans++;
  }

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


Measured memory_bytes: 3632
use proconio::input;

fn main() {
	input!(n: usize);

	let nmax: usize = (n as f64).sqrt() as usize + 1;

	let mut ans = 99999999;
	for i in 1..nmax {
		if n % i != 0 {
			continue;
		}
		let j = n / i;
		let si: String = i.to_string();
		let sj: String = j.to_string();
		let dmax = std::cmp::max(si.len(), sj.len());
		if dmax < ans {
			ans = dmax;
		}
	}
	println!("{}", ans);
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10 , OO = 0x3f3f3f3f ;
const int mod = 1e9 + 7;
 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

int r , c , k;
string s[7];

int main()
{
   // startTime = (double)clock();
    #ifndef ONLINE_JUDGE
        //freopen("in.in", "r", stdin);
        //freopen("out.in", "w", stdout);
    #endif
	//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    cin >> r >> c >> k;

    for(int i = 0 ; i < r ; ++i)
        cin >> s[i];

    int ans = 0;
    for(int mskR = 0 ; mskR < (1 << r) ; ++mskR){
        for(int mskC = 0 ; mskC < (1 << c) ; ++mskC){
            int cnt = 0;
            for(int i = 0 ; i < r ; ++i){
                if(mskR & (1 << i)){
                    for(int j = 0 ; j < c ; ++j){
                        if(mskC & (1 << j))
                            cnt += (s[i][j] == '#');
                    }
                }
            }
            ans += (cnt == k);
        }
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3600
//ABC142C
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;
 
int main(){
  float N;
cin >>  N;
int am = int(N)%2;  
  if (am==0){cout << 0.5<<endl;}
if (am==1){
  float ans=((N+1)/2) /N;
  cout <<ans<<endl;}



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int n;
  cin>>n;
  vector<string>tasu(n);
  for(int i=0;i<n;i++){
    cin>>tasu[i];
  }
  int m;
  cin>>m;
  vector<string>hiku(m);
  for(int i=0;i<m;i++){
    cin>>hiku[i];
  }
  map<string,int>mp;
  for(string x:tasu){
    if(mp.count(x))mp.at(x)++;
    else mp[x]=1;
  }
  for(string x:hiku){
    if(mp.count(x))mp.at(x)--;
    else mp[x]=-1;
  }
  int saidai=0;
  auto begin=mp.begin(),end=mp.end();
  for(auto iter=begin;iter!=end;iter++){
    int i=iter->second;
    saidai=max(saidai,i);
  }
  cout<<saidai<<endl; 
  return 0;
}

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

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

    int cnt = 0;
    bool can_divide = true;
    while (true) {
        for (int i = 0; i < n; i++) {
            if (A[i] % 2 == 0) {
                A[i] /= 2;
            }
            else {
                can_divide = false;
                break;
            }
        }
        if (can_divide == true) {
            cnt++;
        }
        else {
            break;
        }
    }

    cout << cnt << endl;

    return 0;
}


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

namespace AtCoderTest
{
    class KagamiMochi
    {
        static int numUniqueElements(List<int> inData)
        {
            return inData.Distinct().Count();
        }

        public static string core()
        {
            int numElem = int.Parse(Console.ReadLine());
            var inData = new List<int>();

            for (int i = 0; i < numElem; ++i)
                inData.Add(int.Parse(Console.ReadLine()));

            var retStr = numUniqueElements(inData).ToString();
            return retStr;
        }

        class Program
        {
            static void Main(string[] args)
            {
                Console.Write(KagamiMochi.core());
            }
        }
    }
}


Measured memory_bytes: 13268
n = int(input())
l = list(map(int, input().split()))
a, b = l[0], sum(l)-l[0]
ans = abs(a-b)

for i in range(1, n-1):
  a += l[i]
  b -= l[i]
  if abs(a-b) < ans:
    ans = abs(a-b)

print(ans)


Measured memory_bytes: 24936
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void doIt() {
		StringBuilder s = new StringBuilder(sc.next());
		if(s.length() != 2)s.reverse();
		System.out.println(s);
	}
	Main(){doIt();}
	public static void main(String[] args) {
		new Main();
	}

}


Measured memory_bytes: 21844
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] a = new long[n];
        long[] sub = new long[n];
        for (int i = 0; i < n; i++) {
            long temp = Long.parseLong(sc.next());
            a[i] = temp;
            sub[i] = temp - (i + 1);
        }
        Arrays.sort(sub);
        long center = 0;
        if (n % 2 != 0) {
            center = sub[n / 2];
        } else {
            center = (sub[n / 2] + sub[n / 2 - 1]) / 2;
        }
        long ans = 0;
        for (int i = 0; i < n; i++) {
            ans += Math.abs(a[i] - (center + i + 1));
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 65440
#include <stdio.h>

int main(void){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if((a+b)==c){
        printf("Yes\n");
    }else if((b+c)==a){
        printf("Yes\n");
    }else if((c+a)==b){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
use std::io;


fn main() {
    let s = read_one::<String>().chars()
        /*
        .filter(|&c| c == 'C' || c == 'F')
        */
        .collect::<Vec<char>>();

    let mut flg = false;
    let mut ans = false;
    for c in s {
        if c == 'C' { flg = true; }
        if c == 'F' && flg { ans = true; }
    }
    if ans { println!("Yes"); }
    else { println!("No"); }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int h[110010];
int f[11000];
int jd(int a)
{
	if(a>=0)
		return a;
	else 
		return -a;
}
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>h[i];
	}
	f[1]=0;
	f[2]=jd(h[2]-h[1]);
	for(int i=3;i<=n;i++)
	{
		f[i]=min(f[i-1]+jd(h[i]-h[i-1]),f[i-2]+jd(h[i]-h[i-2]));
	}
	cout<<f[n];
	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main()
{
    IOS;
    ll n;
    cin >> n;
    ll t = n % 1000;
    ll ans =  1000 - t;
    cout << ans%1000 << endl;

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, m, n) for (int i = m; i < n; i++)
#define repr(i, m, n) for (int i = m; i >= n; i--)
#define db(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF 1000000007
#define MOD 998244353
#define PI (acos(-1))
#define EPS 1e(-9);
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N, M;
    cin >> N >> M;
    string S;
    cin >> S;
    vector<int> ans;
    int now = N;

    while (now != 0) {
        repr(i, M, 1) {
            if (now-i < 0) continue;
            if (S[now - i] == '0') {
                ans.emplace_back(i);
                now -= i;
                break;
            }
            if (i == 1) {
                cout << -1 << "\n";
                return;
            }
        }
    }
    repr(i,ans.size()-1,0){
        cout<< ans[i]<<" ";
    }
    cout<<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 1096
n, m = map(int, input().split())
mod = 1000000007
fact = [1]
for i in range(max(n, m)):
  fact.append(fact[-1] * (i + 1) % mod)
if n == m:
  print(2 * fact[n] * fact[m] % mod)
elif abs(n - m) == 1:
  print(fact[n] * fact[m] % mod)
else:
  print(0)


Measured memory_bytes: 7060
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	int A, B;
	cin >> A >> B;
	set<int>st;
	for (int i = 1; i <= 3; i++)st.insert(i);
	st.erase(A);
	st.erase(B);
	puts(*st.begin());

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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(){
   int n, m, k; cin >> n >> m >> k;
   ll sum = 0;
   vector<ll> A(n); rep(i, n) {cin >> A[i]; sum += A[i];}
   vector<ll> B(m); rep(i, m) cin >> B[i];

   ll res = 0, ib = 0;
   for(int ia = n; ia >= 0; ia--){
       if(sum <= k){
           while(sum + B[ib] <= k && ib < m){
               sum += B[ib];
               ib++;
           }
           chmax(res, ia + ib);
       }
       if(ia) sum -= A[ia-1];
   }
   

   cout << res << ln;
}


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

namespace Library
{
    //標準装備
    class LongInput
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }
        public static long[] Read(long row)
        {
            return (new long[row]).Select(j => long.Parse(Console.ReadLine())).ToArray();
        }
        public static long[] ReadMulti()
        {
            return Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
        }
        public static long[][] ReadMulti(long row)
        {
            return (new long[row][]).Select(j => Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray()).ToArray();
        }
    }
}
namespace AtCoder
{
    using Library;

    class ABC051_B
    {
        static void Main(string[] args)
        {
            var input = LongInput.ReadMulti();
            var K = input[0];
            var S = input[1];
            long count = 0;
            for(int i = 0; i <= K; i++)
            {
                for (int j = 0; j <= K; j++)
                {
                    if(0 <= S - (i + j) && S - (i + j) <= K)
                    {
                        count++;
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 13396