akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

typedef   signed long long int slli;
typedef unsigned long long int ulli;
const slli MAX_SLLI = 0x7FFFFFFFFFFFFFFF;
const slli MIN_SLLI = 0x8000000000000000;
const ulli MAX_ULLI = 0xFFFFFFFFFFFFFFFF;
const ulli MIN_ULLI = 0x0000000000000000;

#define N_TIMES(i, n)     for (ulli i = 0;     i <  n; ++i)
#define N_TIMES_REV(i, n) for (slli i = n - 1; i >= 0; --i)

#ifdef __DEBUG__
template<typename T>
std::ostream& operator<<(std::ostream &os, const std::list<T> &list)
{
  const std::string delim = ", ";
  typename std::list<T>::const_iterator itr = list.begin();
  while (itr != list.end()) {
    os << *itr;
    ++itr;
    if(itr != list.end()) os << delim;
  }
  return os;
}

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &v)
{
  const std::string delim = ", ";
  for (unsigned n = 0; n < v.size(); ++n) {
    os << v[n];
    if((n + 1) < v.size()) os << delim;
  }
  return os;
}
#endif /* __DEBUG__ */

int main(int argc, char **argv)
{
  unsigned N, X;
  std::cin >> N >> X;
  
  std::vector<unsigned> m(N);
  N_TIMES(n, N) std::cin >> m[n];
  
  N_TIMES(n, N) X -= m[n];
  
  std::sort(m.begin(), m.end());
  
  std::cout << (N + (X / m[0])) << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;


int main(){
    ll n;
    cin>>n;
    vector<ll>prime;
    ll tmp = n;
    for(ll i=2;i*i<=n;i++){
        bool flag = false;
        while(tmp%i==0){
            flag=true;
            tmp/=i;
        }
        if(flag)prime.push_back(i);
    }
    if(tmp>1)prime.push_back(tmp);
    ll len = prime.size();
    ll ans = 0;
    for(ll i=1;i<(1<<len);i++){
        ll t =1;
        ll parity = 0;
        for(ll j=0;j<len;j++){
            if((i>>j)&1){
                t*=prime[j];
                parity++;
            }
        }
        if(parity%2==0){
            ans -= (n/t);
        }
        else ans +=(n/t);
    }
    cout<<n-ans<<endl;
    return 0;
}


Measured memory_bytes: 3148
# ABC055D - Menagerie (ARC069D)
def check(a: int, b: int) -> list:
    ret, cur, prev = [], a, b
    for i in S:
        ret += [cur]
        if cur ^ (i == "o"):
            prev, cur = cur, prev ^ 1  # both are different
        else:
            prev, cur = cur, prev  # both neighbors are the same
    flg = cur == a and prev == b  # check the consistency of input and result
    return ret if flg else []


def main():
    global S
    N = int(input())
    S = input().rstrip()
    for a in range(2):
        for b in range(2):
            ans = check(a, b)
            if ans:
                print(*["S" if i else "W" for i in ans], sep="")
                return
    print(-1)


if __name__ == "__main__":
    main()

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

#define ll long long int
#define pii pair<int, int>
#define PII pair<ll, ll>
#define llu long long unsigned
#define ld long double

const ll MAX = 1e18 + 100;
const int Max = 1e9 + 500;

const int sz=1e5+100;
int pos[sz];
int par[sz], ran[sz];

void init(int n)
{
   for(int i=0;i<=n;i++) par[i]=i, ran[i]=1;
}

int Find(int x)
{
   if(par[x]==x) return x;
   else return (par[x] = Find(par[x]));
}

void Union(int x,int y)
{
   int p=Find(x);
   int q=Find(y);

   if(p == q ) return ;
   else{
       if(ran[p]> ran[q]) ran[p]+=ran[q], par[q]=p;
       else ran[q]+=ran[p], par[p]=q;
   }
}


int main()
{
   int t, i, j, k, p, q, a, b, c, mx, n, m, x;
   
   cin>>n>>m;

   init(n+1);
   for(i=1;i<=n;i++){
      cin>>x;
      pos[x]=i;
   }

   int ct=0;

   for(i=1;i<=m;i++){
      cin>>p>>q;
      Union(p, q);
   }

   for(i=1;i<=n;i++){
      if(pos[i]==i) ++ct;
      else{
          if(Find(i)==Find(pos[i])){
             ++ct;
          }
      }
   }
   
   cout<<ct<<'\n';
}

Measured memory_bytes: 4796
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,a[100010],b[100010],i=1,j,saidai=0,m=0,L=0,ans=0;
    cin >> n;
    for(i=0;i<n+1;i++)
    {
        cin >> a[i];
    }
    for(i=0;i<n;i++)
    {
        cin >> b[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]>=b[i])
        {
            ans+=b[i];
            continue;
        }
        if(b[i]-a[i]>=a[i+1])
           {
                ans+=a[i+1];
                ans+=a[i];
                a[i+1]=0;
                a[i]=0;
                continue;
           }
        if(a[i]<=b[i])
        {
            ans+=b[i];
            a[i+1]-=b[i]-a[i];
        }
    }
    cout << ans << endl;
    
    return 0;

}


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

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

using namespace std;

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

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

//typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		40010

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//


//
int main(){
	ll N,K;cin>>N>>K;
	V A(N);
	REP(i,N)cin>>A[i];

	ll cnt = 0;
	REP(i,N)REP(j,i){
		if(A[j] > A[i])cnt++;
	}

	sort(ALL(A));
	ll acnt=0;
	for (int i = 0; i < N; i++){
		acnt += (lower_bound(ALL(A), A[i]) - A.begin());
	}

	ll ans = 0;

	ans = ((K*K-K)/2) % MOD;
//	cout << ans << endl;
	ans = ((ll)acnt * ans) % MOD;
	ans = (((ll)cnt * K)%MOD + ans)%MOD;

//	cout << cnt << " " << acnt << endl;
	cout << ans << endl;


	return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
const int maxn = 1<<20;

struct edge {
	int u, v, w;
};
int main(){
	int l;
	cin >> l;
	l--;
	int b = 0;
	while((1<<b) - 1 <= l) b++;
	b--;
	vector<edge> ans;
	int frt = 2, lst = 1;
	for(int e = 0; e < b; e++){
		ans.push_back({lst, frt, (1<<(b - e - 1))});
		ans.push_back({lst, frt, 0});
		lst = frt;
		frt++;
	}
	if((1<<b) - 1 < l){
		int gg = lst;
		int bo = 23;
		while(!(l&(1<<bo))) bo--;
		int mlst = 1;
		int gcn = 1;
		int sum = 0;
		for(int e = bo; e >= 0; e--){
			if(l&(1<<e)){
				if(sum){
					ans.push_back({1, (frt - 1) - e, sum});
				}
				sum += 1<<e;
			}
			gcn++;
		}
		ans.push_back({1, frt - 1, sum});
	}
	// cout << g0 << " " << g1 << endl;
	cout << frt - 1 << " " << ans.size() << endl;
	for(auto e : ans) cout << e.u << " " << e.v << " " << e.w << endl;
	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

vector<int> dp[1ll << 10];
int v[1ll << 18];
int w[1ll << 18];

int n, q;

const int INF = 1ll << 28ll;

void f(int pos, int depth) {
    if (pos > n) return;
    if (pos >= (1ll << 10)) return;

    dp[pos].resize(100001, 0);
    for (int i = 100000; i > 0; i--) {
        dp[pos][i] = dp[pos / 2][i];
        if (i >= w[pos]) {
            dp[pos][i] = max(dp[pos][i], dp[pos / 2][i - w[pos]] + v[pos]);
        }
    }

    f(pos * 2, depth + 1);
    f(pos * 2 + 1, depth + 1);
}

int dfs(int pos, int lim) {
    if (lim < 0) return -INF;
    if (pos < (1ll << 10)) {
        return dp[pos][lim];
    }

    return max(dfs(pos / 2, lim), dfs(pos / 2, lim - w[pos]) + v[pos]);
}

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> v[i] >> w[i];
    }

    dp[0].resize(100001, 0);
    f(1, 0);

    cin >> q;
    while (q--) {
        int u, lim;
        cin >> u >> lim;
        cout << dfs(u, lim) << '\n';
    }
}

Measured memory_bytes: 406628
h,w = map(int, input().split())
L = [list(input()) for _ in range(h)] 
for i in range(h):
  for k in range(w):
    if L[i][k]=="#":
      continue
    count=0
    for v in range(-1, 2):
      if i+v < 0 or i+v > h-1:
        continue
      for t in range(-1, 2):
        if k+t < 0 or k+t > w-1:
          continue
        if L[i+v][k+t]=="#":
          count+=1
    L[i][k] = str(count)
for c in range(h):
  print("".join(L[c]))

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

class E
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var s = read();
		int h = s[0], w = s[1];
		var a = new int[h].Select(_ => read()).ToArray();
		var b = new int[h].Select(_ => read()).ToArray();
		var m = a.Zip(b, (u, v) => u.Zip(v, (x, y) => x - y).ToArray()).ToArray();

		var M = 80 * (h + w);
		var dp = new bool[h, w, M];
		dp[0, 0, Math.Abs(m[0][0])] = true;
		for (int k = 0; k < h + w - 2; k++)
		{
			for (int i = 0, j = k; i <= k; i++, j--)
			{
				if (i >= h || j >= w) continue;

				for (int v = 0; v < M; v++)
				{
					if (!dp[i, j, v]) continue;

					if (j + 1 < w)
					{
						dp[i, j + 1, Math.Abs(v + m[i][j + 1])] = true;
						dp[i, j + 1, Math.Abs(v - m[i][j + 1])] = true;
					}
					if (i + 1 < h)
					{
						dp[i + 1, j, Math.Abs(v + m[i + 1][j])] = true;
						dp[i + 1, j, Math.Abs(v - m[i + 1][j])] = true;
					}
				}
			}
		}
		Console.WriteLine(Enumerable.Range(0, M).First(i => dp[h - 1, w - 1, i]));
	}
}


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

long long int H, W, c[11][11], A;

int main(){
    scanf("%lld%lld", &H, &W);
    for(int i = 0; i < 10; ++i){
        for(int j = 0; j < 10; ++j){
            scanf("%lld", c[i] + j);
        }
    }
    for(int i = 0; i < 10; ++i){
        for(int j = 0; j < 10; ++j){
            for(int k = 0; k < 10; ++k){
                c[j][k] = min(c[j][k], c[j][i] + c[i][k]);
            }
        }
    }
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            scanf("%lld", &A);
            if(A >= 0)c[10][10] += c[A][1];
        }
    }
    cout << c[10][10] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i<(n);i++)
#define fore(i,a) for(auto &i:a)
#define debug(a,b) cout << "debug : " << a << " , "<< b << endl
using ll=long long;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
const ll INF=1LL<<60;
const ll mod=1E9+7;



int main(){
  int n;cin>>n;
  for(ll k=1;k<=n;k++){ 
    ll ans=0;
    for(ll x=1;x*x<=k;x++){
      ll p=0;
      p=x*x;
      for(ll y=1;(p+y*y+x*y)<=k;y++){
	p+=y*y+x*y;
	for(ll z=1;(p+z*z+z*x+z*y)<=k;z++){
	  p+=z*z+z*x+z*y;
	  //if(k==n)debug(p,k);
	  if(p==k)ans++;
	  //if(k==n)cout << x<<y<<z<<endl;
	  p-=z*z+z*x+z*y;
	}
	p-=y*y+y*x;
      }
    }
   cout << ans << endl;
  }
}


Measured memory_bytes: 3548
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <queue>
#include <list>
#include <limits>
#include <string>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 998244353;


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

int main()
{
  int N,K;
  string s;
  cin >> N >> K;
  cin >> s;
  s[K-1] = s[K-1] + 0x20;
  cout << s;
}


Measured memory_bytes: 888
N, K = map(int, input().split())
MOD = 998244353

lr = []
for _ in range(K):
    l, r = map(int, input().split())
    lr.append((l, r))
lr.sort()

dp = [0]*(N+1)
dpsum = [0]*(N+1)
dp[1] = 1
dpsum[1] = 1
for i in range(2, N+1):
    for l, r in lr:
        lj = max(1, i-r)
        rj = i-l

        if rj < 1:
            continue

        dp[i] += dpsum[rj]-dpsum[lj-1]
        dp[i] %= MOD
    dpsum[i] = dp[i]+dpsum[i-1]

print(dp[N])


Measured memory_bytes: 27844
def kth_substring(s: str, K: int) -> str:
    kth_word = ''     # K 番目の文字列
    kth_word_len = 0  # K 番目の文字列の長さ
    n = len(s)        # s の文字列の長さ

    # 最初の文字から順番に決定していく。
    while K > 0:
        # 探索した文字列を格納する。
        d = set()
        # 例えば 'c' で始まる文字列に対して、'a'、 'b'で
        # 始まる文字列の総数
        prev_count = 0
        # 探索に使う用の文字列
        temp = ''
        for c in 'abcdefghijklmnopqrstuvwxyz':
            temp = kth_word + c
            # s の頭から temp で始まる文字列を探し、
            # それが見つかれば、それをそのまま伸ばして
            # 全て d に入れる
            for i in range(n):
                if s[i:].startswith(temp):
                    for j in range(i, n):
                        d.add(s[i:j+kth_word_len+1])
                        if len(d) >= K:
                            break
                if len(d) >= K:
                    break
            if len(d) >= K:
                break
            # 次の文字に探索対象が変わるとき、現在保持している
            # 文字列の数を保持しておく
            prev_count = len(d)

        # temp から始まる文字列は prev_count 番目以降なので
        # 目標を temp から始まる文字列の K - prev_count 番目
        # の文字列に変更する
        K -= prev_count + 1
        kth_word = temp
    return kth_word


if __name__ == "__main__":
    s = input()
    K = int(input())
    ans = kth_substring(s, K)
    print(ans)


Measured memory_bytes: 3064
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝

*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n>>m;
    l(i,1,max(m,n))
    {

        if(abs(m-i)==abs(n-i))
        {
            cout<<i;
            return 0;
        }


    }
    cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <string>
#include <string.h>

using namespace std;

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  int train = a<b?a:b;
  int bus = c<d?c:d;
  cout << train + bus << endl;
}

Measured memory_bytes: 3612
import Data.Char

main :: IO()
main = do
    [n, k] <- map read . words <$> getLine
    s <- getLine
    let f = take (k-1) s
    let c = s !! (k-1)
    let lowerc = toLower c
    let cs = [lowerc]
    let b = drop k s
    let o = f ++ cs ++ b
    putStr o

Measured memory_bytes: 508
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, m = LI()
co_to_ind = {}
A = []
B = []
for _ in range(n):
    a, b = LI()
    A += [a]
    B += [b]

S = sorted(A)
co_to_ind = {x:i for i, x in enumerate(S)}
X = [0] * (n + 1)
G = [[] for _ in range(n + 1)]

for i in range(n):
    X[co_to_ind[A[i]]] += B[i]

for i in range(n, 0, -1):
    X[i] ^= X[i - 1]

for i in range(m):
    l, r = LI()
    l = bisect_left(S, l)
    r = bisect_left(S, r + 1)
    G[l] += [(r, i)]
    G[r] += [(l, i)]

ans = []
visited = [0] * (n + 1)
def dfs(u):
    visited[u] = 1
    for v, e in G[u]:
        if visited[v]: continue
        dfs(v)
        if X[v]:
            ans.append(e + 1)
            X[u] ^= 1


for i in range(n + 1):
    if visited[i]: continue
    dfs(i)
    if X[i]:
        print(-1)
        exit()


ans.sort()
print(len(ans))
print(*ans)







Measured memory_bytes: 151128
//
//  abc114_b.cpp
//
//
//  Created by Yoshida Satoshi on 2018/12/02.
//

#include <stdio.h>
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

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


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 998244353
//priority_queue<int,vector<int>, greater<int> > q2;
int modpow(int a, int p) {
	if (p == 0) return 1;
	if (p % 2 == 0) {

		int halfP = p / 2;
		int half = modpow(a, halfP);

		return half * half % mod;
	}
	else {

		return a * modpow(a, p - 1) % mod;
	}
}

ll comb(ll N_, ll C_) {
	const int NUM_ = 400001;
	static ll fact[400002], factr[400002], inv[400002];
	if (fact[0] == 0) {
		inv[1] = fact[0] = factr[0] = 1;
		for (int i = 2; i <= NUM_; ++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
		for (int i = 1; i <= NUM_; ++i) fact[i] = fact[i - 1] * i%mod, factr[i] = factr[i - 1] * inv[i] % mod;
	}
	if (C_<0 || C_>N_) return 0;
	return factr[C_] * fact[N_] % mod*factr[N_ - C_] % mod;
}

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

	int N, M, K;
	cin >> N >> M >> K;

	int ans = 0;

	for (int i = 0; i <= K; i++) {
		int cnt = 0;
		cnt += M * modpow(M - 1, N - i - 1);
		cnt %= mod;
		cnt *= comb(N - 1, i);
		ans += cnt;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 13044
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    k=int(input())
    x='ACL'
    ans=''
    for i in range(k):
        ans+=x
    print(ans)
      
      
if __name__ == '__main__':
    resolve()

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int ans = 0;
  for(int i = 0; i < N; i++) {
    int temp;
    cin >> temp;
    ans += temp - 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int r = 0;
		int l = 0;
		while (sc.hasNextLine() == true) {
			String[] params = sc.nextLine().split(",");
			
			int a = Integer.parseInt(params[0]);
			int b = Integer.parseInt(params[1]);
			int c = Integer.parseInt(params[2]);

			
			if ((a * a + b * b) == (c * c)) r++;
			else if (a == b) l++;
		}

		System.out.println(r);
		System.out.println(l);
	}
}

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

namespace keyence2020_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var K = CIn.ReadInt();
      var S = CIn.ReadInt();

      var A = new int[N];

      for (int i = 0; i < N; i++)
      {
        if (i < K)
        {
          A[i] = S;
        }
        else
        {
          if (S != 1) A[i] = S - 1;
          else A[i] = 2;
        }
      }

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

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(long n)
    {
      var array = new string[n];
      for (var i = 0L; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(long n)
    {
      var array = new int[n];
      for (var i = 0L; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(long n)
    {
      var array = new long[n];
      for (var i = 0L; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(long n)
    {
      var array = new double[n];
      for (var i = 0L; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(long h, long w)
    {
      var array = new char[h, w];
      for (var i = 0L; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0L; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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

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

  if (op == '+') cout << a + b << endl;
  else cout << a - b << endl;
}

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

int main() {
  string w;
  cin >> w;
  int count = 0;
  bool flag = true;
  
  for (int i = 0; i < w.size(); i++) {
    for (int j = 0; j < w.size(); j++) {
      if (w[i] == w[j]) {
        count++;
      }
    }
    if (count % 2 == 1) {
      flag = false;
      break;
    }
  }
  if(flag == true) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

    

Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>

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

using namespace std;

typedef long long int lli;
typedef vector<int> vi;

int main() {
	lli n, i, j, k, x;
	vector<lli> a;
	lli ans;

	ans = 0;

	cin >> n >> x;
	a.resize(n);

	rep(i, n) {
		cin >> a[i];
	}

	rep(i, n - 1) {
		if (a[i] + a[i + 1] > x) {
			j = a[i] + a[i + 1] - x;
			ans += j;
			if (a[i + 1] < j) {
				k = j - a[i + 1];
				a[i + 1] = 0;
				a[i] -= k;
			}
			else {
				a[i + 1] -= j;
			}
		}
	}

	cout << ans;

	return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

int N;

void dfs(vector<double> v, double &val){
	if(v.size() <= 1) return;
	if(v.size() == 2){
		val = (v[0] + v[1]) / 2;
		return;
	}

	vector<double> w = v;
	int e = v.size() - 1;
	w.erase(w.begin() + e );
	double t = 0.0;
	dfs(w, t);
	val = (t + v[e]) / 2;
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	vector<double> v;

	cin >> N;
	for(int i=1; i<=N; i++){
		double t;
		cin >> t;
		v.push_back(t);
	}
	sort(v.begin(), v.end());

	double ans = 0.0;
	dfs(v, ans);
	printf("%.6lf\n", ans);
	return 0;
}


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

int main() {
  int h; cin >> h;
  int w; cin >> w;
  
  string foo = "";
  for (int i = 0; i < w + 2; i++) {
    foo += "#";
  }
  
  cout << foo << endl;
  for (int i = 0; i < h; i++) {
    string input; cin >> input;
    cout << "#" << input << "#" << endl;
  }
  cout << foo << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define  fill(st,et,val,arr) for(int i=st;i<=et;i++)arr[i]=val;
#define all(v) v.begin(),v.end()
template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = ch == '-', ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}
 
const int M=1e9 + 7;
const int MAX=1e5+7;
using namespace std;
bool comp(pair<int,int> &a,pair<int,int> &b)
{
	if(a.first!=b.first)
	   return a.first<b.first;
	else
		return a.second>b.second;
}
void printQ(deque<int> q)
{
	for(int i=0;i<q.size();i++)
	{
		cout<<q[i]<<" ";
	}
	cout<<endl;
}

int32_t main() 
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int a,b;cin>>a>>b;
	int ans=(a*b)/__gcd(a,b);
	cout<<ans<<endl;
	return 0;
}






















Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

long gcd_mul(long * a, int N){
    long g = a[0];
    for (int i=0; i<N; i++){
        g = gcd(g, a[i]);
    }
    return g;
}

int main(){
    int N;
    cin >> N;
    long A[N];
    for(int i=0; i<N; i++) cin >> A[i];
    cout << gcd_mul(A, N) << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    H = [int(h) for h in input().split()]
    ans = 1
    maxH = H[0]
    for i in range(1, N):
        if H[i] >= maxH:
            ans += 1
            maxH = H[i]
    print(ans)

    return  0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a>b) swap(a,b);
	if(b>c) swap(b,c);
	if(a>c) swap(a,c);
	if(a==5&&b==5&&c==7) cout<<"YES";
	else cout<<"NO";
}

Measured memory_bytes: 3632
#!/usr/bin/env python3
import sys


def solve(N: int):
    print( N if N % 2 == 0 else 2*N )


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;

class UnionFind {
private:
    vector<int> parent, height,size;
public:
    UnionFind(const int node_size)
        : parent(node_size), height(node_size, 0),size(node_size,1){
        for(int i = 0; i < node_size; ++i){
            parent[i] = i;
        }
    }
    int Find(const int x){
        if(parent[x] == x){
            return x;
        }else{
            return parent[x] = Find(parent[x]);
        }
    }
    void Union(int x, int y){
        x = Find(x), y = Find(y);
        if(x == y){
            return;
        }
        if(height[x] < height[y]){
            parent[x] = y;
            size[y] += size[x];
        }else{
            parent[y] = x;
            if(height[x] == height[y]){
                ++height[x];
            }
            size[x] += size[y];
        }
    }
    int siz(int x){
        x = Find(x);
        return size[x];
    }
};

int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int n,m;
    cin>>n>>m;
    UnionFind uf(n);
    for(int i=0;i<m;++i){
        int a,b;
        cin>>a>>b;
        a--;b--;
        uf.Union(a,b);
    }
    int ret = 0;
    for(int i=0;i<n;++i)if(i == uf.Find(i)){
        ret = max(ret,uf.siz(i));
    }
    cout << ret << endl;
    return 0;
    
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;


int L;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    cin>>L;

    int hi=0;

    const int N = 20;


    vector<pair<int,int>> v;

    for (int i=2; i<=N; i++) {
	int ways = 1<<(N-i);
	while (hi+ways<=L) {
	    v.push_back({i, hi});
	    hi += ways;
	}
    }


    int nodes = N;
    int edges = (N-2)*2 + (int)v.size();

    cout<<nodes<<" "<<edges<<"\n";

    for (int i=2; i<N; i++) {
	int wei = 1<<(N-1-i);
	cout<<i<<" "<<i+1<<" "<<wei<<"\n";
	cout<<i<<" "<<i+1<<" "<<0<<"\n";
    }


    for (auto ed: v) {
	cout<<1<<" "<<ed.first<<" "<<ed.second<<"\n";
    }


    return 0;
}


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

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

    string str;
    if (a < b)
    {
        for (size_t i = 0; i < b; i++)
        {
            cout << a;
        }
    }
    else
    {
        for (size_t i = 0; i < a; i++)
        {
            cout << b;
        }
    }

    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<map>
#include<stack>
#include<queue>
#include<math.h>


#define square(x) x*x;
#define ll long long;



using namespace std;




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

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif


    string str;
    cin >> str;
    if (str[str.length() - 1] != 's')
    {
        str += 's';

    }
    else {
        str += "es";
    }
    cout << str << endl;

    return 0;
}



Measured memory_bytes: 3664
n,a,b=map(int,input().split())
if a == 0:
  print(0)
  exit()
  
d = n//(a+b)
o = n-(d*(a+b))
if o == 0:
  print(d*a)
elif o < a:
  print(d*a+o)
else:
  print(d*a+a)
  

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

// ½ÔÚðÝÄé©,cèà,saÌ,stdÌ
int dp[2][1001][3][101];

void solve(){
    
    int limit,n,m,x;
    string secn[101];
    int sece[101];
    int secs[101];
    string stdn[101];
    int stde[101];
    int stds[101];
    while(cin>>limit>>n>>m>>x&&!(n==0&&m==0&&limit==0)){
        for(int i = 0; i < n; i++)
            cin>>secn[i]>>sece[i]>>secs[i];
        for(int i = 0; i < m; i++)
            cin>>stdn[i]>>stde[i]>>stds[i];
        // ÔÉ©Ä¢­
        memset(dp,-1,sizeof(dp));
        dp[0][0][0][0]=0;
        for(int i = 0; i < n+m; i++){
            memset(dp[(i+1)%2],-1,sizeof(dp[(i+1)%2]));
            for(int money=0; money<=limit; money++){
                // secret artistÌ¡ñÌl(IÔ©IÎÈ¢©Åêí¯)
                for(int j = 0; j < 3; j++){
                    // standard artistÌ¡ñÌl
                    for(int k = 0; k <= m; k++){
                        if(i<n){
                            if(j-1>=0&&money-sece[i]>=0&&dp[i%2][money-sece[i]][j-1][k]!=-1){
                                dp[(i+1)%2][money][j][k]=max(dp[i%2][money][j][k]
                                ,dp[i%2][money-sece[i]][j-1][k]+secs[i]);
                            }
                            else
                                dp[(i+1)%2][money][j][k]=dp[i%2][money][j][k];
                        }
                        else{
                            if(k-1>=0&&money-stde[i-n]>=0&&dp[i%2][money-stde[i-n]][j][k-1]!=-1){
                                dp[(i+1)%2][money][j][k]=max(dp[i%2][money][j][k]
                                ,dp[i%2][money-stde[i-n]][j][k-1]+stds[i-n]);
                            }
                            else
                                dp[(i+1)%2][money][j][k]=dp[i%2][money][j][k];
                        }
                    }
                }
            }
        }
        int maxSat=0;
        // ðð½·àÌ©çÅåÌ«xðÂàÌðTõ
        for(int i = 0; i <= limit; i++)
            for(int j = 1; j <= 2; j++)
                for(int k = x; k <= m; k++)
                    maxSat=max(maxSat,dp[(n+m)%2][i][j][k]);
        cout<<maxSat<<endl;
    }

}


int main(){

    solve();

    return 0;
}

Measured memory_bytes: 3296
#include <iostream>
using namespace std;
int main() 
{
	int a, b, tmp, count;
    while (1) {
    	cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        }
        if(a < b) { 
                    tmp = b; 
                    b = a; 
                    a = tmp; 
                    } 
        count = 0; 
        do {
            a = a % b;
            tmp = b;
            b = a;
            a = tmp;
            count++;
        } while (b != 0);
        cout << a << " " << count << endl;
    }
	return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std; 
ll N = pow(10,10);
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	char c;cin>>c;
	cout<<char(int(c)+1)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll a[5];
    rep(0,i,5)cin>>a[i];
    ll mina=15,sum=0;
    rep(0,i,5){
        mina=min(mina,(a[i]-1)%10);
        sum+=(a[i]+9)/10;
    }
    ++mina;
    sum*=10;
    cout<<sum-(10-mina)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
double map[98][21];
int main(void){
    int n,i,line[100],o;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&line[i]);
    }
    map[0][line[0]]=1;
    for(i=1;i<n-1;i++){
        for(o=0;o<21;o++){
            if(o-line[i]>=0)
                map[i][o-line[i]]+=map[i-1][o];
            if(o+line[i] < 21)
                map[i][o+line[i]]+=map[i-1][o];
        }
    }
    printf("%.0f\n",map[n-2][line[n-1]]);
    return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

const ll MOD = 1000000007;
const long double EPS = 1e-10;

class BIT {
    public:
    int n;
    int bit[1000001];
    
    BIT(int n){
        this->n = n;
        fill(bit, bit+n, 0);
    }

    void add(int idx, int x){
        for(int i=idx;i<=this->n;i+=i&-i) bit[i] += x;
    }

    //bit[1]からbit[end]までの和 (閉区間)
    int sum(int end){
        int ret = 0;
        for(int i=end;i>=1;i-=i&-i) ret += bit[i];
        return ret;
    }

    int count_swap(vector<int> v){
        int ret = 0;
        reppp(i, 1, n){
            add(v[i], 1);
            ret += i - sum(v[i]);
        }
        return ret;
    }
};


int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;

    vector<Pii> v;
    map<Pii, int> mp;
    char c;
    int num;
    rep(2*n){
        cin >> c >> num;
        Pii p = make_pair(num, (c=='W'?0:1));
        v.emplace_back(p);
        mp[p] = i+1;
    }

    int dp[n+1][n+1];
    dp[0][0] = 0;

    rep(n+1){
        BIT tree = BIT(2*n+1);
        reppp(ii, 1, i+1) tree.add(mp[Pii(ii, 0)], 1);
        repp(j, n+1){
            if(i == 0 && j == 0) continue;
            int tmp1 = INT_MAX, tmp2 = INT_MAX;
            if(j) tree.add(mp[Pii(j, 1)], 1);

            if(i){
                if(i) tree.add(mp[Pii(i, 0)], -1);
                tmp1 = dp[i-1][j] + (i+j-1 - tree.sum(mp[Pii(i, 0)]));
                if(i) tree.add(mp[Pii(i, 0)], 1);
            }
            if(j){
                if(j) tree.add(mp[Pii(j, 1)], -1);
                tmp2 = dp[i][j-1] + (i+j-1 - tree.sum(mp[Pii(j, 1)]));
                if(j) tree.add(mp[Pii(j, 1)], 1);
            }

            if(tmp1 > tmp2){
                dp[i][j] = tmp2;
            }else{
                dp[i][j] = tmp1;
            }
        }
    }


    cout << dp[n][n] << endl;
}

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

int main(){
string s,t;
  cin >>s>>t;
  string ss = s;
  int tlong = t.size();
  int64_t ans =0;
  int64_t x =0;
  rep(i ,tlong){
    x = ss.find_first_of(t.at(i));
    ss.erase(ss.begin(),ss.begin()+x+1);
    if(ss.size()<s.size()) ss +=s;
    //cout <<x+1<<endl;
    if(x>=0) ans +=x+1;
    else{
    ans = -1;
      break;
    }
  }
  cout << ans;
}

Measured memory_bytes: 768
#include<iostream>
using namespace std;
typedef long long ll;
struct person{ll s,e,d;};
int main(){
  ll n,i,j,k,t,q;
  cin >> n >> t >> q;
  person ps[100001];
  ll p1=-1,p2=-1;
  for(i=0;i<n;i++){
    cin >> ps[i].s >> ps[i].d;
    if(ps[i].d==1) p1=i;
    else{
      ps[i].e=ps[i].s-t;
      if(p1==-1){
      }else if(p2!=-1){
        if(ps[p1].s<ps[p2].s) 
          ps[i].e=max(ps[i].e,ps[p2].e);
        else 
          ps[i].e=max(ps[i].e,(ps[i].s+ps[p1].s)/2);
      }else{
        ps[i].e=max(ps[i].e,(ps[i].s+ps[p1].s)/2);
      }
      p2=i;
    }
  }
  p1=-1;p2=-1;
  for(i=n-1;i>=0;i--){
    if(ps[i].d==2) p2=i;
    else{
      ps[i].e=ps[i].s+t;
      if(p2==-1){
      }else if(p1!=-1){
        if(ps[p1].s<ps[p2].s) 
          ps[i].e=min(ps[i].e,ps[p1].e);
        else 
          ps[i].e=min(ps[i].e,(ps[i].s+ps[p2].s)/2);
      }else{
        ps[i].e=min(ps[i].e,(ps[i].s+ps[p2].s)/2);
      }
      p1=i;
    }
  }
  //cout<<endl;
  /*
  for(i=0;i<n;i++){
    cout << ps[i].e << endl;
  }
  cout << endl;
  */
  for(i=0;i<q;i++){
    cin >> k;
    cout << ps[k-1].e << endl;
  }
  return 0;
}

Measured memory_bytes: 3500
n=int(input())
a=[[] for i in range(n)]
for i in range(n-1):
  b=[int(j)-1 for j in input().split()]
  a[b[0]].append(b[1])
  a[b[1]].append(b[0])

def dfs(v):
    d=[-1 for i in range(n)]
    q=[]
    d[v]=0
    q.append(v)
    while len(q):
        v=q.pop()
           
        for i in a[v]:
            if d[i]==-1:
                d[i]=d[v]+1
                q.append(i)
    return d
c1=dfs(0)
c2=dfs(n-1)
c=0
for i in range(n):
 if c1[i]>c2[i]:
    c+=1
if c>=n/2:
  print("Snuke")
else:
  print("Fennec")


Measured memory_bytes: 29168
N=int(input())
L=list(map(int,input().split()))
M=sum(L)//N
ans=float("inf")
tmp=0
for i in range(N):
	tmp+=(L[i]-M)**2
ans=min(ans,tmp)
tmp=0
for i in range(N):
	tmp+=(L[i]-(M+1))**2
ans=min(ans,tmp)
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
using namespace std;
int main(){

  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  if( x <= W-r && x >= r && y <= H-r && y >= r ) cout << "Yes\n";
  else cout << "No\n";
  return 0;

}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
typedef long long lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()

using namespace std;

void execute()
{
	string sentence;
	cin >> sentence;
	if (sentence[0] == sentence[2])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    static int[][] map = new int[12][12];

    static void removeIslands(int i, int j){
        if(i < 0 || i > 11 || j < 0 || j > 11) return;
        if(map[i][j] == 1){
            map[i][j] = 0;
            removeIslands(i-1,j);
            removeIslands(i+1,j);
            removeIslands(i,j+1);
            removeIslands(i,j-1);
        }else{
            return;
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;

        while ((line = br.readLine()) != null) {
            // initialize map
            for (int i = 0; i < 12; i++) {
                char[] c = line.toCharArray();
                for (int j = 0; j < 12; j++) {
                    if (c[j] == '1') {
                        map[i][j] = 1;
                    } else {
                        map[i][j] = 0;
                    }
                }
                line = br.readLine();
            }

            int answer = 0;
            // counting islands
            for (int i = 0; i < 12; i++) {
                for (int j = 0; j < 12; j++) {
                    if (map[i][j] == 1) {
                        answer++;
                        removeIslands(i, j);
                    }
                }
            }

            System.out.println(answer);

        }
    }
}


Measured memory_bytes: 24080
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	char s[102];
	string ans = "Three";
	for(int i=0;i<n;i++){
		cin >> s[i];
		if(s[i]=='Y'){
			ans = "Four";
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import numpy as np

N, D = map(int, input().split())
X = [np.array(list(map(int, input().split()))) for _ in range(N)]

count = 0
while X:
  Xt = X.pop()
  for Xi in X:
    if np.linalg.norm(Xt-Xi).is_integer():
      count += 1
    
print(count)

Measured memory_bytes: 12408
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        int c;
        cin >> c;
        if (c >= K) ans++;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	cin>>s;
	long long count=0,k=0;
	for(int i=0;i<s.length();i++)
		if(s[i]=='W'){
			count+=i-k;
			k++;
		} 	
	cout<<count<<endl;
} 

Measured memory_bytes: 640
using System;
class harmony{
  public static void Main(){
    String[] str = Console.ReadLine().Split(' ');
    if((int.Parse(str[0])+int.Parse(str[1]))%2 == 0){
      Console.WriteLine((int.Parse(str[0])+int.Parse(str[1]))/2);
    }
    else{
      Console.WriteLine("IMPOSSIBLE");
    }
  }
}


Measured memory_bytes: 13140
'use strict';(function(input){

  input=input.trim().split(/\s+/).map(x=>x-0);
  
  const N = input[0];
  var counter = 0;
  for(let i=1;i<=N;i++){
    if(i!==input[i]){
      counter++;
    }
  }
  if(counter<=2){
    console.log('YES');
  }else{
    console.log('NO');
  }
})(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p = sorted(p, reverse=True)[:x]
q = sorted(q, reverse=True)[:y]
r = sorted(r, reverse=True)
ans = p + q + r
ans.sort(reverse=True)
print(sum(ans[:x + y]))

Measured memory_bytes: 22720
#define _CRT_SECURE_NO_DEPRECATE
#define rep(i, b, e) for (auto i = b; i < e; ++i)
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#ifndef __GNUC__
#include <intrin.h>
#endif // !__GNUC__
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstring>
#include <complex>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <functional>

int bsf(int x) {
#ifdef __GNUC__
    return __builtin_ctz(x);
#else
    unsigned long i;
    _BitScanForward(&i, x);
    return i;
#endif
}
int bsr(int x) {
#ifdef __GNUC__
    return 31 - __builtin_clz(x);
#else
    unsigned long i;
    _BitScanReverse(&i, x);
    return i;
#endif
}

using namespace std;
typedef long long int64;
const double pi = 3.14159265358979323846;
const int inf = (int)2e+9 + 2;
const int mod = (int)1e+7;
const double eps = 1e-8;
const int N = 100001;

int n, m, k;  
int a[N + 1]; 

void solve()
{
    cin >> n;
    int ans = 0;
    rep(i, 0, n) {
        cin >> a[i];
    }
    a[n] = -1;
    rep(i, 0, n + 1) {
        int c = 0;
        while (i == a[i] - 1) {
            ++i;
            ++c;
        }
        ans += (c + 1) / 2;
    }
    cout << ans;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int test = 1;
    //cin >> test;
    for (; test; --test)
        solve();
    return 0;
}

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

int main() {
    int x; cin >> x;
    if(x == 3 || x == 5 || x == 7){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

int main() {
	int a;
	scanf("%d",&a);
	if (a == 25) {
		std::cout << "Christmas";
	}
	else if (a == 24) {
		std::cout << "Christmas Eve";
	}
	else if (a == 23) {
		std::cout << "Christmas Eve Eve";
	}
	else if (a == 22) {
		std::cout << "Christmas Eve Eve Eve";
	}
	
	return 0;
}


Measured memory_bytes: 256
while 1:
  h,w = map(int, raw_input().split())
  if h==w==0:
    break

  for i in range(0,h/2):
    print ("#." * (w/2) + "#" * (w%2))
    print (".#" * (w/2) + "." * (w%2))

  if h % 2 == 1:
    print ("#." * (w/2) + "#" * (w%2))

  print ""

Measured memory_bytes: 4212
N,M,X,Y = gets.split.map(&:to_i)
Xm = gets.split.map(&:to_i).max
YM = gets.split.map(&:to_i).min
if X < Y
  if Xm < YM
    if Xm < Y && X < YM
      puts "No War"
      exit
    end
  end
end
puts "War"


Measured memory_bytes: 1788