akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    a, b, c = mi()
    L = [a, b, c]
    L.sort()
    print(L[-1] - L[0])


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include <stdio.h>

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

Measured memory_bytes: 584
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <queue>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

// #define FL fflush(stdout)

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
  return scanf("%lld", &x);
}

int GI(int& x) {
  return scanf("%d", &x);
}

#define maxn 100010
int N;
vector<vector<int> > adj;
queue<PII> q1;
bool visited[maxn];
priority_queue<PII> q2;

int main() {
  GI(N);
  adj.resize(N);
  memset(visited, 0, sizeof visited);

  FORN(i, N-1) {
    int a, b;
    GI(a); GI(b);
    a--; b--;
    adj[a].PB(b);
    adj[b].PB(a);
  }

  PII root = MP(0, 0);
  q1.push(root);
  q2.push(root);

  while (q1.size() > 0) {
    PII node = q1.front(); q1.pop();
    visited[node.SS] = true;
    for (auto child : adj[node.SS]) {
      if (!visited[child]) {
        q1.push(MP(node.FF+1, child));
        q2.push(MP(node.FF+1, child));
      }
    }
  }

  memset(visited, 0, sizeof visited);
  while (q2.size() > 0) {
    PII leaf = q2.top(); q2.pop();
//    printf("leaf: %d at depth %d\n", leaf.SS, leaf.FF);

    if (visited[leaf.SS]) continue;

    visited[leaf.SS] = true;
    int n_mark = 0;
    for (auto node: adj[leaf.SS]) {
      if (!visited[node]) {
        visited[node] = true;
        n_mark++;
      }
    }
    assert(n_mark < 2);
//    printf("num marked: %d\n", n_mark);
    if (n_mark == 0) {
      printf("First\n");
      return 0;
    }
  }
  printf("Second\n");
  return 0;
}


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

int N, M, Q;
int buildSum(vector<int>, vector<int>);
int getSum(int, int);
vector<vector<int>> LRmap;
int main()
{
	cin >> N >> M >> Q;
	vector<int> L(M);
	vector<int> R(M);
	for (int i = 0; i < M; i++)
	{
		cin >> L[i] >> R[i];
	}

	vector<int> p(Q);
	vector<int> q(Q);
	for (int i = 0; i < Q; i++)
	{
		cin >> p[i] >> q[i];
	}


	buildSum(L, R);

	for (int i = 0; i < Q; i++)
	{
		int ans = getSum(p[i], q[i]);
		cout << ans << endl;
	}

	return 0;
}

int buildSum(vector<int> L, vector<int> R) {
	LRmap = vector<vector<int>>(N + 1, vector<int>(N + 1, 0));
	for (int i = 0; i < M; i++)
	{
		LRmap[L[i]][R[i]]++;
	}

	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= N; j++)
		{
			LRmap[i][j] += LRmap[i][j - 1];
			LRmap[i][j] += LRmap[i - 1][j];
			LRmap[i][j] -= LRmap[i - 1][j - 1];
		}
	}
}
int getSum(int p, int q) {
	int a = LRmap[q][q] - LRmap[p - 1][q] - LRmap[q][p - 1] + LRmap[p - 1][p - 1];
	return a;
}

Measured memory_bytes: 5120
#include<cstdio>
#include<iostream>
int main()
{
    int n,k,ans=0,x;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        if(x<=k/2)
            ans+=x*2;
        else
            ans+=(k-x)*2;
    }
    printf("%d\n",ans);
} 


Measured memory_bytes: 256
#include<stdio.h>
#include<cstring>
 
int main()
{
	int a,b,c,ap=0,bp=0,cp=0,t=1;
	char A[110],B[110],C[110],tmp;
	
	scanf("%s%s%s",A,B,C);
	a=strlen(A);b=strlen(B);c=strlen(C);
	
	while(a+1!=ap && b+1 != bp && c+1 != cp)
	{
		if(t == 0)
		{
			t = A[ap]-'a';
			ap++;
		}
		else if( t == 1){
			t = B[bp]-'a';
			bp++;
		}
		else{
			t = C[cp]-'a';
			cp++;
		}
	}
	
	if(a+1 == ap)puts("A"); else if( b+1 == bp)puts("B");
	else puts("C");
	
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
signed main() {
	int n, m, a = 0; string s; cin >> s >> n;
	for (int h = 0; h < s.size(); h++) {
		if (h == s.size() - 1) {
			n %= 26;
			if ((int)s[h] + n >= 123) { n -= 26; }
			s[h] = (char)((int)s[h] + n);
		}
		else if (123 - (int)s[h] <= n && s[h] != 'a') { n -= 123 - (int)s[h]; s[h] = 'a'; }
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 512
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  s = input() + "X"
  TMP = ['A','C','G','T']
  Nya = 0
  flag = False
  i = 0
  first = 0
  last = 0
  while i != len(s):
    if s[i] in TMP:
      if not flag:
        #print(i,'Change!')
        flag = True
        first = i
    else:
      if flag:
        #print(i,'End!')
        flag = False
        last = i
    Nya = max(Nya,abs(first-last))
    i += 1
  LIST = list(s)
  print(Nya)
if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
#define PI 3.141592653589793
using namespace std;

bool sortbysec(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 

ll maxSubArraySum(ll a[], ll size) 
{ 
    ll max_so_far = INT_MIN, max_ending_here = 0; 
  
    for (ll i = 0; i < size; i++) 
    { 
        max_ending_here = max_ending_here + a[i]; 
        if (max_so_far < max_ending_here) 
            max_so_far = max_ending_here; 
  
        if (max_ending_here < 0) 
            max_ending_here = 0; 
    } 
    return max_so_far; 
} 

ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
{
    unordered_map<ll, ll> prevSum;
    ll res = 0;
    ll currsum = 0;
    for (ll i = 0; i < n; i++)
    {
        currsum += arr[i];
        if (currsum == sum) res++;
        if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
        prevSum[currsum]++;
    }
    return res; 
} 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
ll powmp(ll x, ll y, ll p) 
{ 
    ll res = 1;     x = x % p;   
    while (y > 0) 
    {  
        if (y & 1)  res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    FAST
    ll n;cin>>n;
    map<ll,ll> cn;
    while(n%(2LL)==0)
    {
        cn[2]++;
        n/=2;
    }
    for(ll i=3;i*i<=n;i+=2)
    {
        while(n%i==0)
        {
            cn[i]++;
            n/=i;
        }
    }
    if(n>1) cn[n]=1;
    ll ans=0;
    for(auto k:cn)
    {
        ll s=k.S;
        ll curr=1;
        while(s-curr>=0)
        {
            ans++;
            s-=curr;
            curr++;
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl

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

void inputList(vector<ll>* list, ll n, int sortType = 0)
{
  repl(i, n)
  {
    ll tmp;
    cin >> tmp;
    list->push_back(tmp);
  }
  if(sortType == 1)
  {
    sort(list->begin(), list->end());
  }
  else if(sortType == 2)
  {
    sort(list->begin(), list->end(), greater<ll>());
  }
}

int main()
{
  ll x, a, b;
  cin >> x >> a >> b;
  string ans;
  ll y = a % x;
  if(y == 0 || a + (x - y) <= b)
  {
     ans = "OK";
  }
  else
  {
    ans = "NG";
  }
  
  cout << fixed << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  int s=a+b;
  if(s==3){cout<<"3";return 0;
  }
  if(s==4){cout<<"2";return 0;
  }
  if(s==5){cout<<"1";return 0;
  }
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        a: [i64; n+1],
    }
    if n == 0 {
        if a[0] == 0 {
            println!("0",);
        } else if a[0] == 1 {
            println!("1");
        } else {
            println!("-1");
        }
        return;
    }
    if a[0] != 0 {
        println!("-1");
        return;
    }
    let mut back = vec![0; n + 2];
    for i in (0..n).rev() {
        back[i] = back[i + 1] + a[i + 1];
    }
    let mut res = 0;
    let mut node = 1;
    for i in 0..n + 1 {
        // println!("{} {}", i, node);

        res += node;
        node -= a[i];
        if node < 0 {
            println!("-1");
            return;
        }
        if node * 2 <= back[i] {
            node *= 2;
        } else if node <= back[i] {
            node = back[i];
        } else {
            println!("-1");
            return;
        }
    }
    // println!("{:?}", back);
    println!("{}", res);
}


Measured memory_bytes: 4404
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod(ll x, ll n) {
  ll ans = 1;
  for(ll i = 0; i < n; i++) {
    ans *= x;
    ans = ans % 1000000007;
  }
  return ans;
}
int main() {
  ll N;
  cin >> N;
  ll q_10, q_9, q_8;
  q_10 = mod(10, N);
  q_9 = mod(9, N);
  q_8 = mod(8, N);
  ll ans = q_10 - 2 * q_9 + q_8;
  if(ans >= 0) {
    cout << ans % 1000000007 << endl;
  }
  else {
    if(ans + 1000000007 > 0) {
      cout << ans + 1000000007 << endl;
    }
    else {
      cout << ans + 1000000007 * 2 << endl;
    }
  }
}

Measured memory_bytes: 3620
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
// #define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 200005
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 200005;
const long double epsilon = 1e-9;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {

	fast
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	ll m = 0;
	while (b <= a)
	{
		b *= 2;
		++m;
	}
	while (c <= b)
	{
		c *= 2;
		++m;
	}
	// cout << m << END;
	if (m > k)
		cout << "No" << END;
	else
		cout << "Yes" << END;





// #ifndef ONLINE_JUDGE
// 	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include<iomanip>
#include <cstdint>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int abs( int a ) { return a < 0 ? -a : a; }

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

Measured memory_bytes: 256
import java.util.*;

// String
public class Main {
	public static void main(String[] args) {
		new Main().AOJ0039();
	}
	
	Scanner sc = new Scanner(System.in);
	void AOJ0039(){	// ローマ数字 -> 10進数
		HashMap<Character,Integer> dic = new HashMap<Character,Integer>();
		dic.put('I', 1);	dic.put('V', 5);	dic.put('X', 10);	dic.put('L', 50);
		dic.put('C', 100);	dic.put('D', 500);	dic.put('M', 1000);
		while(sc.hasNext()){
			char[] c = sc.next().toCharArray();
			int ans=0,last=dic.get(c[0]);
			for(int i=0; i<c.length; i++){
				if(last>=dic.get(c[i])){
					ans+=dic.get(c[i]);
					last=dic.get(c[i]);
				}else{
					ans+=dic.get(c[i])-last-last;
					last=dic.get(c[i]);
				}
			}
			System.out.println(ans);
		}
	}
	
	void AOJ0020(){	// 大文字変換
		while(sc.hasNext())	System.out.println(sc.nextLine().toUpperCase());
	}
	
}

Measured memory_bytes: 12000
n,*a=gets.split.map &:to_i
l=(1..n).map{gets.to_i}
m=1e5
[*0..3].repeated_permutation(n){|x|
    s=[q=0,0,0]
    n.times{|i|x[i]<3&&(s[x[i]]+=l[i])>l[i]&&q+=10}
    (0..2).each{|i|q+=(a[i]-s[i]).abs}
    s.all?{|i|i>0}&&q<m&&m=q
}
p m

Measured memory_bytes: 1788
/*  ex3_2
    UMAboogie */
#include <stdio.h>

int main(void){
  int num;
  scanf("%d",&num); //鉛筆の本数を入力
  int unit_1 = num % 10; //本数の一の位の数をunit_1と定義
  if (unit_1 == 3) {
    printf("bon\n"); //一の位の数が3の時、bonを出力
  } else if (unit_1 == 0 || unit_1 == 1 || unit_1 == 6 || unit_1 == 8){
    printf("pon\n"); //一の位の数が0,1,6,8のいずれかの時、ponが出力
  } else {
    printf("hon\n"); //一の位がそれ以外の数の時、honを出力
  }
  return 0;
}


Measured memory_bytes: 1624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll i,N,a=0,b=0,c=0,d=0;cin>>N;
  REP(i,N){
    string S;cin>>S;
    if(S=="AC")a++;
    if(S=="WA")b++;
    if(S=="TLE")c++;
    if(S=="RE")d++;
  }
  cout<<"AC x "<<a<<endl<<"WA x "<<b<<endl<<"TLE x "<<c<<endl<<"RE x "<<d<<endl;
  return 0;
}

Measured memory_bytes: 3624
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n;
    cin >> n;
    vvi G(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    vector<bool> check(n);
    function<bool(int, int)> dfs = [&](int i, int j) {
        if(i == n-1) {
            check[i] = true;
            return true;
        }
        bool res = false;
        for(int ne:G[i]) {
            if(ne == j) continue;
            if(dfs(ne, i)) {
                res = true;
                check[i] = true;
                break;
            }
        }
        return res;
    };
    dfs(0, -1);


    vi snuke(n);
    snuke[0] = 1;
    snuke[n-1] = -1;
    int i = 0, j = n-1;
    queue<int> que;
    que.push(0);
    que.push(n-1);
    vector<bool> ch(n);
    ch[0] = true;
    ch[n-1] = true;
    while(true) {
        
        for(int ne:G[i]) {
            if(ne == j) i = j;
            if(check[ne] and !ch[ne]){
                snuke[ne] = 1;
                ch[ne] = true;
                i = ne;
                que.push(i);
                break;
            }
        }
        if(i == j) break;
        
        for(int ne:G[j]) {
            if(check[ne] and !ch[ne]) {
                snuke[ne] = -1;
                ch[ne] = true;
                j = ne;
                que.push(j);
                break;
            }
        }
    }

    

    int fennec = 0;
    while(!que.empty()) {
        int now = que.front();
        que.pop();

        for(int ne:G[now]) {
            if(!snuke[ne]) {
                snuke[ne] = snuke[now];
                que.push(ne);
            }
        }
        if(snuke[now] == 1) fennec++;
    }
    

    cout << (fennec > n-fennec ? "Fennec":"Snuke") << endl;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

ll N, neg, m = infll, sum, zero;

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        ll a;
        cin >> a;
        if (a == 0)
        {
            zero++;
            continue;
        }
        if (a < 0)
            neg++;
        m = min(abs(a), m);
        sum += abs(a);
    }
    if (zero > 0 || neg % 2 == 0)
        cout << sum << endl;
    else
        cout << sum - m * 2 << endl;
}

Measured memory_bytes: 768
#include <iostream>

using namespace std;

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

  bool app[26];
  for(int i = 0; i < 26; i++){
    app[i] = false;
  }
  for(int i = 0; S[i] != '\0'; i++){
    app[S[i] - 'a'] = true;
  }
  for(int i = 0; i < 26; i++){
    if(!app[i]){
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("2 16");
            //9
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("0 3");
            //IMPOSSIBLE
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("998244353 99824435");
            //549034394
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();

        int A = wkArr[0];
        int B = wkArr[1];

        int Sum = A + B;
        if (Sum % 2 == 1) {
            Console.WriteLine("IMPOSSIBLE");
        }
        else {
            Console.WriteLine(Sum / 2);
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b > c+d){
        cout << "Left" << endl;
    }
    else if(a+b == c+d){
        cout << "Balanced" << endl;
    }
    else{
        cout << "Right" << endl;
    }
}

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

struct Node
{
	int parent;
	int child_left;
	int sibling_right;
};

int get_depth(int key, const vector<Node>& t)
{
	int depth = 0;
	while (t[key].parent != -1) {
		key = t[key].parent;
		depth++;
	}
	return depth;
}

string get_node_type(int key, const vector<Node>& t)
{
	if (t[key].parent == -1) return "root";
	else if (t[key].child_left == -1) return "leaf";
	else return "internal node";
}

string get_child_list(int key, const vector<Node>& t)
{
	int k = t[key].child_left;
	if (k == -1) return "[]";
	string str = "[";
	while (true) {
		str += to_string(k);
		str += ", ";
		k = t[k].sibling_right;
		if (k == -1) break;
	}
	str.pop_back();
	str.pop_back();
	str += "]";
	return str;
}

void print(int n, const vector<Node>& t)
{
	for (int i = 0; i < n; i++) {
		printf("node %d: parent = %d, depth = %d, %s, %s",
			i, t[i].parent, get_depth(i, t), get_node_type(i, t).c_str(), get_child_list(i, t).c_str());
		cout << endl;
	}
}

int main()
{
	int n;
	cin >> n;
	vector<Node> t(n);
	for (int i = 0; i < n; i++) {
		t[i].parent = -1;
		t[i].child_left = -1;
		t[i].sibling_right = -1;
	}

	for (int i = 0; i < n; i++) {
		int key, dim;
		cin >> key >> dim;
		int left;
		for (int j = 0; j < dim; j++) {
			int child;
			cin >> child;
			if (j == 0) {
				left = child;
				t[key].child_left = child;
			}
			else t[left].sibling_right = child;
			left = child;
			t[child].parent = key;
		}
	}

	print(n, t);
}


Measured memory_bytes: 5080
import math
def gcd(a,b,c):
    return math.gcd(math.gcd(a,b),c)
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(a,K+1):
        for c in range(b,K+1):
            if a==b==c: sum+=a
            elif a!=b!=c: sum+=gcd(a,b,c)*6 
            else: sum+=gcd(a,b,c)*3
print(sum)

Measured memory_bytes: 9196
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a = ni()
b = ni()
c = ni()
x = ni()

ans = 0

for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            if 500*ai + 100*bi + 50*ci == x:
                ans += 1
                
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>

using namespace std;
using ll = long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n, W, H;
  cin >> n >> W >> H;
  vector<int> hori(W+1, 0);
  vector<int> vert(H+1, 0);
  for(int i = 0; i < n; i++){
    int x, y, w; cin >> x >> y >> w;
    hori[max(0, x-w)]++;
    hori[min(W, x+w)]--;
    vert[max(0, y-w)]++;
    vert[min(H, y+w)]--;
  }
  bool f1 = true, f2 = true;
  for(int i = 0; i < W; i++){
    hori[i+1] += hori[i];
    if(hori[i] == 0){
      f1 = false;
    }
  }
  for(int i = 0; i < H; i++){
    vert[i+1] += vert[i];
    if(vert[i] == 0){
      f2 = false;
    }
  }
  if(f1 || f2) cout << "Yes" << endl;
  else cout << "No" << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}



Measured memory_bytes: 3624
h,w = map(int, input().split())
n = int(input())
a = list(map(int, input().split( )))
ans = []

for i in range(n):
    for _ in range(a[i]):
        ans.append(i+1)
for i in range(h):
    if not i%2:
        print(*ans[w*i:w*i+w])
    else:
        print(*ans[w*i+w-1:w*i-1:-1])
        



Measured memory_bytes: 42480
#include<bits/stdc++.h>
//"谷は0にすることが可能"
int main()
{
    int n,x = -1;
    std::cin >> n;
    for(int i = 0; i <= n; i++){
        if(std::floor((double)i * 1.08) == n){
            x = i;
            std::cerr << std::floor((double)i * 1.08) << std::endl;
            break;
        }
    }
    std::cout << (x == -1 ? ":(" : std::to_string(x)) << std::endl;
}
// 0<3>2>1>0<1<2>0<1<2<3<4<5>2>1>0<

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			// 整数の入力
			long a = sc.nextLong();
			long b = sc.nextLong();
			System.out.println(a == b ? "Yes" : "No");
		}
	}

	/**
	 * 最小公倍数
	 */
	static long lcm(long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while ((temp = a % b) != 0) {
			a = b;
			b = temp;
		}
		return c / b;
	}

	/**
	 * 最大公約数
	 */
	static long gcd(long a, long b) {
		long temp;
		while ((temp = a % b) != 0) {
			a = b;
			b = temp;
		}
		return b;
	}
}


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

ll lcm(ll a,ll b){
    ll c=1,p=a,q=b;
    if(a<b)swap(a,b);
    while(c){
        c=a-b*(ll)(a/b);
        a=b;
        b=c;
    }
    
    return p/a*q;
}

int main(){
    int N;cin>>N;
    vector<ll> a(N);
    for(int i=0;i<N;i++)cin>>a.at(i);

    ll ans=a.at(0);
    for(ll i=0;i<N-1;i++){
        ans=lcm(ans,a.at(i+1));
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
    int N, K;
    cin >> N >> K;
    for(int i=0;i<1000000000;i++){
        if(pow(K,i) > N){
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 384
n,k = gets.chomp.split(" ").map(&:to_i)
p_sum = 0.0
n.times do |i|
  sum = i+1
  count = 0
  p = 1.0 / n.to_f
  while sum < k
    sum = sum * 2
    count += 1
    p = p / 2.0
  end
  p_sum += p
end
puts p_sum

Measured memory_bytes: 14380
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    string a, b, c;
    cin >> a >> b >> c;
    int ret = 0;
    rep(i, N) {
        if(a[i] != b[i] &&  b[i] != c[i] &&  c[i] != a[i]) ret += 2;
        else if(a[i] != b[i] ||  b[i] != c[i] || c[i] != a[i]) ret += 1;
    }
    output(ret);
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin>>N;
    int A[1001];
    int i,j,v,k;
    
    for(i=0;i<N;i++)
    {
        cin>>A[i];
    }
    
    for(i=0;i<N-1;i++)
    {
        cout<<A[i]<<" ";
    }
    cout<<A[i]<<endl;
    
    for(i=1;i<N;i++)
    {
        v=A[i];
        j=i-1;
        while (j>=0 && A[j]>v)
        {
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
        for(k=0;k<N-1;k++)
        {
            cout<<A[k]<<" ";
        }
        cout<<A[k]<<endl;
    }
    
}


Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cstring>

using namespace std;

int main()
{
    char c;
    int alpha[26] = {};

    while (scanf("%c", &c) != EOF) { 
        if (c >= 'A' && c <= 'Z') {
            c += 0x20;
        }
        if (c >= 'a' && c <= 'z') {
            alpha[c-'a']++;
        }
    }

    for (int i = 0; i < 26; i++) {
        printf("%c : %d\n", 'a'+i, alpha[i]);
    }
}



Measured memory_bytes: 3208
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N;
  std::cin >> N;
  std::vector< ll > vw(N, 0LL);


  for (ll i = 0; i < N; i++) {
    std::cin >> vw[i];
  }
  ll all_sum = std::accumulate(vw.begin(), vw.end(), 0LL);

  ll ans = INF;
  for (ll t = 0; t < N; t++) {
    ll sum = std::accumulate(vw.begin(), vw.begin()+t, 0LL);
    ans = std::min(ans, std::abs(all_sum - sum * 2));
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 256
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll N,K;string S;
	cin >> N>>K>>S;
 
	// 解法
	string ans = S.substr(0,K-1);
	if (S[K-1]=='A'){
		ans += "a";
	}
	else if (S[K-1]=='B'){
		ans += "b";
	}
	else if (S[K-1]=='C'){
		ans += "c";
	}
	ans += S.substr(K, N-K);
	
	//出力
	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 a, b;
	cin >> a >> b;
	cout << (a * b % 2 == 0 ? "Even" : "Odd") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
/*---------------------------------------*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<long long> l(n+1);
  l[0] = 2; l[1] = 1;
  FOR(i, 2, n+1) l[i] = l[i-1] + l[i-2];
  cout << l[n] << "\n";
  return 0;
}


Measured memory_bytes: 256
import java.lang.*;
import java.io.*;
import java.util.*;


public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {
	
	
	public void solve(InputReader in, PrintWriter out) {
		int x = in.nextInt();
		
		if (x < 1200)
			out.println("ABC");
		else
			out.println("ARC");
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;
	
	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}
	
	public String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}

}


Measured memory_bytes: 23252
import scala.io.StdIn.readInt

object Main {
  val r = Array(2,3,5,7)

  def twoPow(d:Int,s:Int):(Int,Int) = {
    if(d%2 == 1) (d,s)
    else twoPow(d>>1,s+1)
  }

  def maybePrime(i:Int,d:Int,s:Int, n:Int):Boolean = {
    if(i>3) true
    else {
      val a = r(i)
      val x = BigInt(a).modPow(d,n).toLong

      if(x==1 || x==n-1) maybePrime(i+1,d,s,n)
      else repeat(s-1,BigInt(x).modPow(2,n).toLong, i, d, s, n)
    }
  }

  def repeat(j:Int, x:Long, i:Int, d:Int, s:Int, n:Int):Boolean = {
    if(j==0) false
    else if(x==1) false
    else if(x==n-1) maybePrime(i+1,d,s,n)
    else repeat(j-1,BigInt(x).modPow(2,n).toLong,i,d,s,n)
  }

  def isPrime(n:Int):Boolean = {
    if(n<5000) (2 to Math.sqrt(n).toInt).forall(n%_ != 0)
    else if(n%2==0) false
    else {
      val (d,s) = twoPow(n-1,0)
      maybePrime(0,d,s,n)
    }
  }

  def main(args:Array[String]) = {
    val n = readInt
    println((0 until n).count{ _=> isPrime(readInt) })
  }
}

Measured memory_bytes: 68080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N, K; cin >> N >> K;
    vector<int> a(N), cnt(N+1, 0);

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

    sort(cnt.begin(), cnt.end(), greater<int>());

    int unchange = 0;
    for(int i=0; i<K; i++) unchange += cnt[i];

    cout << N - unchange << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
  int n;
  cin >> n;
  vector<int> v(5);
  rep(i,n) {
    string s;
    cin >> s;
    if(s[0]=='M') v[0]++;
    if(s[0]=='A') v[1]++;
    if(s[0]=='R') v[2]++;
    if(s[0]=='C') v[3]++;
    if(s[0]=='H') v[4]++;
  }
  ll ans = 0;
  rep(i,3) {
    srep(j,i+1,4) {
      srep(k,j+1,5) {
        ans += (ll)v[i]*v[j]*v[k];
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
    int[] buf = readln.chomp.split.to!(int[]);
    sort(buf);
    int K = readln.chomp.to!(int);
    int ans = buf[2];
    for (int i = 0; i < K; i++) ans *= 2;

    writeln(ans + buf[0] + buf[1]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    vector<int> a(3);
    cin >> n >> a[0] >> a[1] >> a[2];
    vector<string> s(n);
    string ss = "ABC";
    rep(i, n){
        cin >> s[i];
        rep(j, 2){
            if(s[i][j] == 'A')s[i][j] = '0';
            else if(s[i][j] == 'B')s[i][j] = '1';
            else s[i][j] = '2';
        }
    }
    vector<char> ans(n);
    rep(i, n){
        if(a[s[i][0]-'0'] == 0 && a[s[i][1]-'0'] == 0){
            cout << "No" << endl;
            return 0;
        }else if(a[s[i][0]-'0'] == 1 && a[s[i][1]-'0'] == 1){
            if(i < n - 1 && s[i] != s[i+1]){
                vector<int> b = a;
                b[s[i][0]-'0']--;
                b[s[i][1]-'0']++;
                if(b[s[i+1][0]-'0']==0 && b[s[i+1][1]-'0']==0){
                    a[s[i][0]-'0']++;
                    a[s[i][1]-'0']--;
                    ans[i] = ss[s[i][0]-'0'];
                }else{
                    a = b;
                    ans[i] = ss[s[i][1]-'0'];
                }
            }else{
                a[s[i][0]-'0']++;
                a[s[i][1]-'0']--;
                ans[i] = ss[s[i][0]-'0'];
            }
        }else{
            if(a[s[i][0]-'0'] > a[s[i][1]-'0']){
                a[s[i][0]-'0']--;
                a[s[i][1]-'0']++;
                ans[i] = ss[s[i][1]-'0'];
            }else{
                a[s[i][0]-'0']++;
                a[s[i][1]-'0']--;
                ans[i] = ss[s[i][0]-'0'];
            }
        }
    }
    cout << "Yes" << endl;
    rep(i, n)cout << ans[i] << endl;
}

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

int main()
{
	int n,m;
	int i, j;
	int A[100][100],  B[100], C[100]={0};
	
	cin >> n >>m;
	
	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			cin >> A[i][j];
		}
	}
	
	for(j = 0; j < m; j++){
		cin >> B[j];
	}
	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			C[i] += A[i][j] * B[j];
		}
	}

	for(i = 0; i < n; i++){
		cout << C[i] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

// a^n mod pを計算　O(log n)
long long int pow_mod(long long int a, long long int n, long long int p) {
    if (n == 0) {
        return 1;
    } else {
        long long int temp = pow_mod(a, n / 2, p);
        return n & 1 ? (((temp * temp) % p) * a) % p : (temp * temp) % p;
    }
}

int main() {
    lint mod = 998244353;
    int n;
    cin >> n;
    vector<lint> d(n, 0);
    int d0;
    cin >> d0;
    if (d0 != 0) {
        cout << 0 << endl;
        return 0;
    }
    int d_max = 0;
    for (int i = 0; i < n - 1; i++) {
        int temp;
        cin >> temp;
        if (temp == 0) {
            cout << 0 << endl;
            return 0;
        }
        d[temp]++;
        d_max = max(d_max, temp);
    }
    lint ans = 1;
    for (int i = 2; i <= d_max; i++) {
        ans *= pow_mod(d[i - 1], d[i], mod);
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
static const int MAX = 100000;
static const ll INF = 1e15;
static const int white = 0;
static const int gray = 1;
static const int black = 2;

int n, m;
vector<pair<int, int>> adj[MAX];

void dijkstra() {
    priority_queue<pair<ll, ll>> pq;
    int color[MAX];
    ll d[MAX];
    for (int i = 0; i < n; i++) {
        d[i] = INF;
        color[i] = white;
    }

    d[0] = 0;
    pq.push(make_pair(0, 0));
    color[0] = gray;

    while (!pq.empty()) {
        pair<int, int> f = pq.top(); pq.pop();
        int u = f.second;
        color[u] = black;

        if (d[u] < f.first * (-1)) continue;

        for (int j = 0; j < adj[u].size(); j++) {
            int v = adj[u][j].first;
            if (color[v] == black) continue;
            if (d[v] > d[u] + adj[u][j].second) {
                d[v] = d[u] + adj[u][j].second;
                pq.push(make_pair(d[v] * (-1), v));
                color[v] = gray;
            }
        }
    }

    cout << (d[n - 1] == INF ? -1: d[n - 1]) << endl;
}

int main() {
    int l, r, c;
    cin >> n >> m;

    for (int i = 1; i < n; i++) adj[i].push_back(make_pair(i - 1, 0)); 
    for (int i = 0; i < m; i++) {
        cin >> l >> r >> c;
        l--; r--;
        adj[l].push_back(make_pair(r, c));
        adj[r].push_back(make_pair(l, c));
    }

    dijkstra();

    return 0;
}

Measured memory_bytes: 10872
#include<stdio.h>

int main(){
  int n,a[100],d;
  int i,j,k;
  int flag=1,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  while(flag){
    flag=0;
    for(j=n-1;j>0;j--){
      if(a[j]<a[j-1]){
	d=a[j];
	a[j]=a[j-1];
	a[j-1]=d;
	count++;
	flag=1;
      }
    }
  }

  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i<n-1)
      printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}

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

namespace ABC085B_KagamiMochi
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<int> list = new List<int>();
            for(int i = 0; i < n; i++)
            {
                int input = int.Parse(Console.ReadLine());
                if (!list.Contains(input))
                {
                    list.Add(input);
                }
            }
            Console.WriteLine(list.Count);
        }
    }
}


Measured memory_bytes: 13268
#include "bits/stdc++.h"
using namespace std;
#define debug(var) cout << #var << ": " << var << endl;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
using ll = long long;
using ull = unsigned long long;
using vvint = vector<vector<int>>;
constexpr ll mod = 1e9 + 7;

int main() {

  int N; cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++)cin >> H[i];
  vector<int> upordown(N - 1, 0);//upordown[i] -> iとi + 1の関係
  for (int i = 0; i < N - 1; i++) {
	if (H[i] >= H[i + 1])upordown[i] = 1;
	else upordown[i] = 0;
  }
  vector<int> anses(N, 0);

  for (int i = N - 2; i >= 0; i--)
  {
	if (upordown[i] == 0)anses[i] = 0;
	else anses[i] = anses[i + 1] + 1;
  }

  int ans = INT_MIN;

  for (int i = 0; i < N; i++) {
	ans = max(ans, anses[i]);
  }

  cout << ans;


  //int A, B; cin >> A >> B;
  //int sum = A;
  //if (B == 1) {
	//cout << 0;
	//return 0;
  //}
  //int i = 0;
  //for (i = 0; sum < B; i++)sum += (A - 1);
  //cout << i + 1;

  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(obj) (obj).begin(), (obj).end()

int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    rep(i,n) cin >> x[i];
    int a = 0, b = 0;
    rep(i,n){
        a += x[i]*x[i];
        b += x[i];
    }
    int p1 = ceil(b/(double)n);
    int p2 = floor(b/(double)n);
    auto calc = [&](int p){ return a - 2*p*b + n*p*p;};
    int ans_1 = calc(p1);
    int ans_2 = calc(p2);
    cout << min(ans_1,ans_2)<< endl;
}

Measured memory_bytes: 256