akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  
  for (int i = 0; i < H; i++) {
    cin >> S.at(i);
  }
  
  vector<vector<int>> R(H, vector<int>(W));
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S.at(i).at(j) == '#'){
        if (0 < i   && 0 < j  )  R.at(i-1).at(j-1) ++;
        if (0 < i             )  R.at(i-1).at(j  ) ++;
        if (0 < i   && j < W-1)  R.at(i-1).at(j+1) ++;
        if (           0 < j  )  R.at(i  ).at(j-1) ++;
        if (           j < W-1)  R.at(i  ).at(j+1) ++;
        if (i < H-1 && 0 < j  )  R.at(i+1).at(j-1) ++;
        if (i < H-1           )  R.at(i+1).at(j  ) ++;
        if (i < H-1 && j < W-1)  R.at(i+1).at(j+1) ++;
      }
    }
  }
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S.at(i).at(j) == '.') {
        if (R.at(i).at(j) == 0)  S.at(i).at(j) ='0';        
        if (R.at(i).at(j) == 1)  S.at(i).at(j) ='1';
        if (R.at(i).at(j) == 2)  S.at(i).at(j) ='2';
        if (R.at(i).at(j) == 3)  S.at(i).at(j) ='3';
        if (R.at(i).at(j) == 4)  S.at(i).at(j) ='4';
        if (R.at(i).at(j) == 5)  S.at(i).at(j) ='5';
        if (R.at(i).at(j) == 6)  S.at(i).at(j) ='6';
        if (R.at(i).at(j) == 7)  S.at(i).at(j) ='7';
        if (R.at(i).at(j) == 8)  S.at(i).at(j) ='8';
      }
    }
  }   

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << S.at(i).at(j);
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc161/tasks/abc161_c

use proconio::fastout;
use proconio::input;

#[fastout]
fn main() {
    input! { n: i64, k: i64 }
    let a = n % k;
    let ans = if a < k - a { a } else { k - a };
    println!("{}", ans);
}


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

const int MAX = 1e6;
const int MOD = 1e9 + 7;

long long f[MAX], finv[MAX], inv[MAX];

void CombInit() {
  f[0] = f[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    f[i] = f[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long Perm(int n, int k) {
  if (n < k || k < 0) return 0;
  return f[n] * finv[n - k] % MOD;
}

long long Comb(int n, int k) {
  if (n < k || k < 0) return 0;
  return f[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int X, Y; cin >> X >> Y;
  if ((X + Y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  int n = (X + Y) / 3;
  CombInit();
  cout << Comb(n, X - n) << endl;
}

Measured memory_bytes: 23680
#include<iostream>
using namespace std;
int main()
{
	long long n,k,q,a[10000000],t;
	cin>>n>>k>>q;
	for(int i=1;i<=q;i++)
	{
		cin>>t;
		a[t]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(k-(q-a[i])<=0)
		cout<<"No"<<endl;
		else
		cout<<"Yes"<<endl;
	}
	return 0;
} 

Measured memory_bytes: 3328
import java.util.*;
import java.math.BigInteger;

public class Main{
public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    BigInteger a = new BigInteger(scan.next());
    scan.close();

    int[] alpha = new int[26];
    int cnt = 0;
    int tmp;
    BigInteger bi26 = new BigInteger("26");
    BigInteger bi1 = new BigInteger("1");
    BigInteger bi0 = new BigInteger("0");
    while(a.compareTo(bi0) == 1) {
        BigInteger rem = a.remainder(bi26);
        String strrem = rem.toString();
        tmp = Integer.parseInt(strrem);
        if (tmp == 0) {
            alpha[cnt] = 26;
            a = a.divide(bi26);
            a = a.subtract(bi1);
        } else {
            alpha[cnt] = tmp;
            a = a.divide(bi26);
        }
        cnt++;
    }
//for(int i=0;i<cnt;i++) {
//    System.out.println(alpha[i]);
//}

//System.out.println(cnt);
    byte[] ascii = new byte[cnt];
    for(int i=0;i<cnt;i++) {
        ascii[cnt - i -1] = (byte)(97 + alpha[i] - 1);
    }

    String outstr = new String(ascii);
    System.out.println(outstr);

}
}



Measured memory_bytes: 35732
local function upper_bound(key,ary)
    local n=#ary
    if n==0 then
        return 1 
    end
    if key<ary[1] then
        return 1
    end
    if key>=ary[n] then
        return n+1
    end
    local min,max=1,n
    while 1<max-min do
        local mid=(min+max)//2
        if key>=ary[mid] then
            min=mid
        else
            max=mid
        end
    end
    return max
end

local function lower_bound(key,ary)
    local n=#ary
    if n==0 then
        return 1 
    end
    if key<=ary[1] then
        return 1
    end
    if key>ary[n] then
        return n+1
    end
    local min,max=1,n
    while 1<max-min do
        local mid=(min+max)//2
        if key>ary[mid] then
            min=mid
        else
            max=mid
        end
    end
    return max
end

local n=io.read("n")
local a,b,c={},{},{}
for i=1,n do
    a[i]=io.read("n")
end
for i=1,n do
    b[i]=io.read("n")
end
for i=1,n do
    c[i]=io.read("n")
end
table.sort(a)
table.sort(c)

local combination=0
for i=1,n do
    ab=lower_bound(b[i],a)-1
    bc=n-upper_bound(b[i],c)+1
    combination=combination+ab*bc
end
print(combination)

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 16;
int n;
int a[MAX_N][MAX_N];
ll memo[1<<MAX_N];
ll vis[1<<MAX_N];
ll memo2[1<<MAX_N];
ll vis2[1<<MAX_N];

ll score(int st) {
  if (vis2[st]) return memo2[st];
  ll res = 0;
  forn(i,n) for (int j = i+1; j < n; j++)
    if ((st & (1<<i)) && (st & (1<<j)))
      res += a[i][j];
  vis2[st] = true;
  return memo2[st] = res;
}

ll rec(int st, int i) {
  if (st == 0) return 0;
  if (vis[st]) return memo[st];

  ll res = 0;

  if (st & (1<<i)) {
    int sub = st & ~(1<<i);
    do {
      if (sub != 0) {
        int sub2 = sub | (1<<i);
        chmax(res, score(sub2) + rec(st & ~sub2, i+1));
      }
      sub = (sub - 1) & st;
    } while (sub != st);
  } else {
    res = rec(st, i+1);
  }

  vis[st] = true;

  return memo[st] = res;
}

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n;

  forn(i,n) forn(j,n) cin >> a[i][j];

  cout << rec((1<<n)-1,0) << endl;

  return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

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

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

int main()
{
	int n, a;

	cin >> n >> a;

	string s[100];

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

	sort(s, s + n);

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

	return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define ld long double
#define MOD 1000000007
#define nl cout << bl
#define rt ll Q[100005] = {0}
#define mp make_pair
#define test() \
    ull t;     \
    cin >> t;  \
    while (t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define s(ar, n) sort(ar, ar + n)
#define rs(ar, n) sort(ar, ar + n, greater<ll>())
#define oa(a, n)               \
    for (ll i = 0; i < n; i++) \
        cout << a[i] << " ";
#define cn(a, n)               \
    for (ll i = 0; i < n; i++) \
        cin >> a[i];
#define ov(a, n)                    \
    for (ll i = n - 1; i >= 0; i--) \
        cout << a[i] << " ";        \
    nl
#define ovp(a, n)              \
    for (ll i = 0; i < n; i++) \
        cout << a[i].ff << " " << a[i].ss << bl;
#define maxa(ar, N) *max_element(ar, ar + N)
#define mina(ar, N) *min_element(ar, ar + N)
#define present(c, x) ((c).find(x) != (c).end())
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
typedef pair<int, int> pii;
ll fast_exp(ll base, ll exp)
{
    ll res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res % MOD;
}
ll fib(ll n)
{
    if (n < 2)
        return n;
    ll a = 0, b = 1, pre;
    int i = 1;
    while (i < n)
    {
        pre = (a + b) % MOD;
        a = b;
        b = pre;
        i++;
    }
    return pre;
}
ll fac(ll n)
{
    if (n % 2 == 0)
        return 2;

    for (ll i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
            return i;
    }

    return n;
}
ll fact(ll n)
{
    if (n > 1)
        return n * fact(n - 1);
    else
        return 1;
}
bool sortbysec(const tuple<int, int, int> &a,
               const tuple<int, int, int> &b)
{
    return (get<1>(a) < get<1>(b));
}

int main()
{
    ll n;
    cin >> n;
    vector<char> str;
    while (n > 0)
    {
        ll rem = n % 26;
        if (rem == 0)
        {
            str.pb('z');
            n = (n / 26) - 1;
        }
        else
        {
            str.pb(rem - 1 + 'a');
            n /= 26;
        }
    }
    reverse(all(str));
    for (int i = 0; i < str.size(); i++)
    {
        cout << str[i];
    }
}

Measured memory_bytes: 3600
import numpy as np
N, M=map(int, input().split())
PY=np.array([list(map(int, input().split()))+[i] for i in range(M)])
PY=PY[np.argsort(PY[:, 1])]
kenorder=[1]*(N+1)
output=[0]*M
temporder=[0]*M
for i in range(M):
  temp=PY[i, :]
  a='{:06d}'.format(temp[0])
  b='{:06d}'.format(kenorder[temp[0]])
  output[i]=a+b
  temporder[i]=temp[2]
  kenorder[temp[0]]+=1
  
output2=[0]*M
for i in range(M):
  output2[temporder[i]]=output[i]

for i in range(M):
  print(output2[i])

Measured memory_bytes: 34480
"""
NTC here
"""
 
 
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

profile = 0
pypy = 1
 
 
def iin(): return int(input())


def lin(): return list(map(int, input().split()))


def main():
    n, m, k = lin()
    a = lin()
    b = lin()
    a1 = []
    sm = 0
    a2 = []
    for i in a:
        if sm+i<=k:
            a1.append(i)
            sm += i
        else:
            break
    ans = len(a1)
    for i in b:
        while a1 and sm+i>k:
            x = a1.pop()
            sm -= x
        if sm+i<=k:
            a2.append(i)
            sm += i
        else:
            break
        ans = max(ans, len(a1)+len(a2))
        # print(a1, a2)
    print(ans)
        










    




                

        

 
 
 
 
 
 
# region fastio
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
if pypy:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
    input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
if __name__ == "__main__":
    if profile:
        import cProfile
        cProfile.run('main()')
    else:
        main()

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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  int s = 0;
  for (auto x : a) s += x;
  vector<int> div;
  for (int i = 1; i * i <= s; i++) {
    if (s % i == 0) {
      div.push_back(i);
      div.push_back(s / i);
    }
  }
  sort(div.rbegin(), div.rend());
  for (auto d : div) {
    vector<int> r(n);
    for (int i = 0; i < n; i++) r.at(i) = a.at(i) % d;
    sort(r.rbegin(), r.rend());
    int rsum = 0;
    for (auto x : r) rsum += x;
    for (int i = 0; i < rsum / d; i++) {
      r.at(i) = d - r.at(i);
    }
    int steps = 0;
    for (auto x : r) steps += x;
    steps /= 2;
    if (steps <= k) {
      cout << d << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 384
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005];
ll dp[100005];
#define ALL(v)  (v).begin(),(v).end()
std::set<int> st;
//#define MAX(a,b) if(a>b)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

    /*  ペア関連
    //vector<pair<long long, long long> > pairs(N);
    for(long long i=0; i<N; i++){
        long long a, b;
        cin >> a >> b;
        pairs[i] = make_pair(a, b);
    }
    
    //sort(pairs.begin(), pairs.end(),greater<pair<int,int> >());
	sort(pairs.begin(), pairs.end());
    */

 	//stack<int> sta;   
    //queue<int> que;


int main(){
	
	long long N,M,K;
	string s;
    
	//std::cin >> N;
    std::cin >> N >> M;
    //std::cin >> N >> M >> K;
    
	//std::vector<long long> v(N);
	//std::vector<long long> w(N);
    //std::cin >> s;
    
    
    // 配列入力
    /*
    for(long long i=0; i<N; i++){
		std::cin >> v[i];
	}
	*/
	/*
	for(long long i=0; i<N; i++){
		std::cin >> w[i];
	}
	*/
	
	
	//ソート
    //std::sort(v.begin(),v.end());//昇順ソート
    //std::sort(v.begin(),v.end(),std::greater<long long>());//降順ソート
    //std::sort(w.begin(),w.end());//昇順ソート
    //std::sort(w.begin(),w.end(),std::greater<long long>());//降順ソート
    /*
    
    //S.substr(i, 5);
    //S.size();
    
    for(long long i=0; i<N; i++){
		std::cin >> v[i];
		if(st.find(v[i])==st.end()){
			st.insert(v[i]);
		}
		else{
			st.erase(v[i]);
		}
	}
	*/

    
    long long sum,sum1;
	sum=0;
	sum1=0;
	int flg,flg1,cnt,cnt1;
	flg=0;
	flg1=0;
	cnt=0;
	cnt1=0;
	int max;
	int max1;
	max=0;
	max1=0;
	int min;
	int min1;
	min=INF;
	min1=INF;

	int work1,work2,work3,work4;
	work1=0;
	work2=0;
	work3=0;
	work4=0;

	int a[4];
	int value;
	value=0;
	/*
	a[0] = (value % 10); 
	value /= 10;// 1桁目を取り出す
	a[1] = (value % 10); 
	value /= 10;// 2桁目を取り出す
	a[2] = (value % 10); 
	value /= 10;// 3桁目を取り出す
	a[3] = (value % 10); 
	value /= 10;// 4桁目を取り出す
    work1=a[0]+10*a[1];
    work2=a[2]+10*a[3];
    */
	
	
	//文字列入力
	/*
	for(long long i=0; i<s.length(); i++){
		
		if(s[i]!='1'){
	}
	*/
    if(N>=13){
    	printf("%d",M);
    	//puts("Yes");
    	//printf("%d",st.size());
    	//文字列の出力
    	//std::cout << s << std::endl;
    	//printf("%.12f\n",ret);
    	//cout << sum << endl;
	}
	else if(6<=N && N<=12){
		printf("%d",M/2);
	}
	
	else{
			printf("%d",0);
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n+1);
  rep(i, n+1) cin >> a[i];
  
  vector<ll> node(n+1);
  
  node[0] = 1 - a[0];
  if (node[0] < 0) {
    cout << -1 << endl;
    return 0;
  }
  
  reps1(i, n) {
    node[i] = node[i-1] * 2 - a[i];
    chmin(node[i], INF);
    if (node[i] < 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  
  node[n] = 0;
  if (a[n] > 2 * node[n-1]) {
    cout << -1 << endl;
    return 0;
  }
  
  for(ll i = n-1; i >= 0; i--) {
    chmin(node[i], node[i+1] + a[i+1]);
  }
  
  cout << accumulate(node.begin(), node.end(), 0ll) + accumulate(a.begin(), a.end(), 0ll) << endl;
  
  return 0;
}


Measured memory_bytes: 4756
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
using namespace std;
#define int long long
typedef pair<int, int> P;

int a[2][114];

signed main() {
	int n;
	cin >> n;
	for (int i = 1; i <= 2; i++)
		for (int j = 1; j <= n; j++)cin >> a[i][j];

	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < n; j++) {
			a[i + 1][j + 1] += max(a[i][j + 1], a[i + 1][j]);
		}
	}
	cout << a[2][n] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k; cin >> k;
  cout << a[k-1] << endl;
  return 0;
}


// EOF


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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)
#define fi first
#define se second

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

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

    int n;
    cin >> n;
    FOR(i, 1, 3501) FOR(j, 1, 3501) {
        if(4 * i * j - j * n - i * n < 1) continue;
        if(n * i * j % (4 * i * j - j * n - i * n) == 0) {
            cout << i << " " << j << " " << n * i * j / (4 * i * j - j * n - i * n) << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
int n;
int main(void){
	cin>>n;
	cout<<n*n<<endl;
}


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

int main(void){

  int count = 0;
  int n;
  cin >> n ;

  for(int i = 1;i<=n;i++){

    if(10<=i&&99>=i){
      
    }
    else if(1000<=i&&9999>=i){
      
    }
    else if(100000<=i&&999999>=i){
      
    }
    else{
      count ++;
    }
  }

  cout << count << endl;
  return 0;
}

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

using namespace std;

#define f(a, b) ((1 << (a)) * (b))

int n, p[200005], pp[2][200005],/* x[19][200005],*/ y[2][19][200005], z[200005], at[200005], ma[200005], ta;
vector< int > to[200005];
priority_queue< int, vector< int >, greater< int > > q;
bool fi = 1;

/*
int f1(int a, int b, int c, int d) {
	if (f(c, d) == a && f(c, d + 1) == b)
		return x[c][d];
	c--, d = d * 2 + 1;
	if (b <= f(c, d))
		return f1(a, b, c, d - 1);
	if (a >= f(c, d))
		return f1(a, b, c, d);
	int aa = f1(a, f(c, d), c, d - 1);
	int bb = f1(f(c, d), b, c, d);
	return p[aa] <= p[bb] ? aa : bb;
}
*/

int f2(int a, int b, int c, int d) {
	if (f(c, d) == a && f(c, d + 1) == b)
		return y[ta][c][d];
	c--, d = d * 2 + 1;
	if (b <= f(c, d))
		return f2(a, b, c, d - 1);
	if (a >= f(c, d))
		return f2(a, b, c, d);
	int aa = f2(a, f(c, d), c, d - 1);
	int bb = f2(f(c, d), b, c, d);
	return pp[ta][aa] <= pp[ta][bb] ? aa : bb;
}

int go(int a, int b) {
	ta = a & 1;
	int tb = f2(a, b - 1, 18, 0);
	ta = 1 - ta;
	int tc = f2(tb + 1, b, 18, 0);
	z[tb] = tc;
	if (tb != a)
		to[tb].push_back(go(a, tb));
	if (tb + 1 != tc)
		to[tb].push_back(go(tb + 1, tc));
	if (tc + 1 != b)
		to[tb].push_back(go(tc + 1, b));
	return tb;
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		ta = i & 1;
		scanf("%d", p + i);
		ma[p[i]] = i;
		pp[ta][i] = p[i];
		pp[1 - ta][i] = INT_MAX;
		// x[0][i] = i;
		y[0][0][i] = i;
		y[1][0][i] = i;
		at[i] = i;
	}
	for (int i = 1; i < 19; i++)
		for (int j = 0; f(i, j) < n; j++)
			if (f(i - 1, j * 2 + 1) < n) {
				// x[i][j] = (p[x[i - 1][j * 2]] <= p[x[i - 1][j * 2 + 1]] ? x[i - 1][j * 2] : x[i - 1][j * 2 + 1]);
				y[0][i][j] = (pp[0][y[0][i - 1][j * 2]] <= pp[0][y[0][i - 1][j * 2 + 1]] ? y[0][i - 1][j * 2] : y[0][i - 1][j * 2 + 1]);
				y[1][i][j] = (pp[1][y[1][i - 1][j * 2]] <= pp[1][y[1][i - 1][j * 2 + 1]] ? y[1][i - 1][j * 2] : y[1][i - 1][j * 2 + 1]);
			} else {
				// x[i][j] = x[i - 1][j * 2];
				y[0][i][j] = y[0][i - 1][j * 2];
				y[1][i][j] = y[1][i - 1][j * 2];
			}
	q.push(p[go(0, n)]);
	while (!q.empty()) {
		ta = ma[q.top()];
		q.pop();
		for (int i = 0; i < to[ta].size(); i++)
			q.push(p[to[ta][i]]);
		if (fi)
			fi = 0;
		else
			printf(" ");
		printf("%d %d", p[ta], p[z[ta]]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 49920
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = (ll)1e10;

int main(){
    ll n=0;
  	cin >> n;
    auto a = vector<ll>(n,0);
    for(auto &i:a) cin >> i;
    auto ans = 0;
    for(auto &i:a) ans^=i;
    cout << (ans==0?"Yes":"No");
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int A, B;
  char op;
  cin >> A >> op >> B;
  int ans = 0;

  if (op == '+')
    ans = A + B;
  else
    ans = A - B;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const K = parseInt(arg[0].split(" ")[0]);
    
    // lunlun数の集合を受け取り、次の桁のlunlun数の州法を返す
    const calcNext = (lunluns) => {
        let result = [];
        
        for(let lunlun of lunluns) {
            for(let j=-1; j<=1; j++) {
                let add = (lunlun % 10) + j;
                if(add >= 0 && add <= 9) {
                    result.push(lunlun * 10 + add)
                }
            }
        }
 
        return result;
    }
    
    let all = []; // 全列挙したもの
    let current = []; 
    
    // 1桁のとき
    for(let v=1; v<10; v++) {
        current.push(v);
        all.push(v);
    }
    
    // 10桁のlunlun数まで出す
    for(let d=1; d<10; d++) {
        current = calcNext(current);
        
        for(let val of current) {
            all.push(val);
        }
    }
    
    // console.log("all:" + all);
    // console.log("cur:" + current);
    
    console.log(all[K-1]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 43280
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,r=0;
  cin >> n;
  for(int i=0;i<n;i++){
    char in;
    cin >> in;
    if(in=='R')r++;
  }
  if(r>(n-r))cout<<"Yes"<<endl;
  else cout << "No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k,ans;
  cin>>n;
  ans=0;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  for(int i=0; i< n; i++){
    for(int j=i+1; j<n; j++){
      ans=ans+vec.at(i)*vec.at(j);
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B, C);

// ===

fn main() {
    let (a, b, x): (i32, i32, i32) = read();
    if a <= x && x <= a + b {
        println!("YES");
    } else {
        println!("NO");
    }
}



Measured memory_bytes: 4352
#include <cstdio>
#include <cctype>
#include <algorithm>
#define int long long

struct Monster {
    int x, h, dam;
} a[200010];

int n, d, s, ans = 0;

int read() {
    int ret, f = 1;
    char ch;
    while(!isdigit(ch = getchar())) (ch == '-') && (f = -1);
    for(ret = ch - '0'; isdigit(ch = getchar()); ret *= 10, ret += ch - '0');
    return ret * f;
}

void print(int x) {
    if(x < 0) putchar('-'), x = -x;
    if(x > 9) print(x / 10);
    putchar(x % 10 + '0');
}

bool cmp(Monster a, Monster b) {
    return a.x < b.x;
}

signed main() {
    n = read(), d = read(), s = read();
    for(int i = 1; i <= n; ++i) a[i].x = read(), a[i].h = read();
    std::sort(a + 1, a + n + 1, cmp);
    for(int i = 1; i <= n; ++i) {
        a[i].dam += a[i - 1].dam;
        int l = i, r = i + (d << 1);
        if(r > n) r = n;
        while(l < r) {
            int mid = (l + r + 1) >> 1;
            if(a[mid].x <= a[i].x + (d << 1)) l = mid;
            else r = mid - 1;
        }
        int tmp = (a[i].h - a[i].dam * s + s - 1) / s;
        if(tmp < 0) continue;
        ans += tmp, a[i].dam += tmp, a[l + 1].dam -= tmp;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 4864
#include "bits/stdc++.h"
using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> cnt(26);
    for (int i = 0; i < N; i++) {
        cnt[S[i] - 'a']++;
    }
    long long ans = 1;
    long long MOD = pow(10, 9) + 7;
    for (int i = 0; i < 26; i++) {
        ans *= cnt[i] + 1;
        ans %= MOD;
    }
    if (ans > 0) cout << ans - 1 << endl;
    else cout << pow(10, 9) + 6 << endl;
}

Measured memory_bytes: 512
K, N = gets.chomp.split(" ").map(&:to_i)

A = gets.chomp.split(" ").map(&:to_i)

ary = []

(N-1).times do |i|
    ary << (A[i] - A[i + 1]).abs
end
ary << (A[0] + K - A[-1]).abs

puts K - ary.max

Measured memory_bytes: 18364
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define lli             long long int
#define pb              push_back
#define pf              push_front
#define mkp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<int>
#define mii             map<lli,lli>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define endl            "\n"
const double PI = acos(-1);

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

lli maxm(lli a, lli b)
{
  return (a >= b ? a : b);
}


lli minm(lli a, lli b)
{
  return (a <= b ? a : b);
}

lli power(lli x, lli y, lli p)
{
  lli res = 1;

  x = x % p;
  if (x == 0)
    return 0;

  while (y > 0)
  {

    if (y & 1)
      res = (res * x) % p;


    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}

lli nCrmodp(lli n, lli r, lli p)
{
  if (r == 0)
    return 1;
  if (r == 1)
    return n;


  lli pro = 1, k = n;
  while (k > r)
  {
    pro *= k;
    pro %= p;
    --k;
  }

  k = 2;
  while (k <= (n - r))
  {
    pro *= power(k, (p - 2), p);
    pro %= p;
    ++k;
  }

  return pro;
}


lli first_big(lli n, lli k, vector<lli> arr)
{
  lli l, r, ans = n;
  l = 0;
  r = n - 1;

  while (l <= r) {
    lli m = l + (r - l) / 2;

    if (arr[m] > k) {
      ans = m;
      r = m - 1;
    }

    else
      l = m + 1;
  }

  return ans;
}

lli last_small(lli n, lli k, vector<lli> arr)
{
  lli l, r, ans = -1;
  l = 0;
  r = n - 1;

  while (l <= r)
  {
    lli mid = (l + r) / 2;

    if (arr[mid] <= k)
    {
      ans = mid;
      l = mid + 1;
    }
    else
      r = mid - 1;
  }

  return ans;
}

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int main()
{
  c_p_c();

  lli s;

  cin >> s;
  lli k = s, ans = 0;
  k /= 3;

  for (lli i = 1; i <= k; ++i)
  {
    ans += nCrmodp(s - 2 * i - 1, i - 1, mod);
    ans %= mod;
  }

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

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

int main() {
    int sum = 0;
    int a;
    for(int i = 0;  i < 3; i++){
        cin >> a;
        sum += a;
    }
    if(sum >= 22){
        cout << "bust" << endl;
    }else{
        cout << "win" << endl;
    }

  return 0;
}

Measured memory_bytes: 256
let h, w = Scanf.scanf " %d %d" @@ fun a b -> a, b
let a_ss = Array.init h @@ fun _ -> Scanf.scanf " %s" @@ fun s -> s
let s = String.make (w + 2) '#'
let _ = print_endline s; Array.iter (Printf.printf "#%s#\n") a_ss; print_endline s

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

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    deque<ll> b;
    for(ll i = 0; i < n; i++){
        if(i%2 == 0) b.push_back(a[i]);
        else b.push_front(a[i]);
    }
    if(n%2 == 0){
        for(int i = 0; i < n; i++){
            cout << b[i] << ' ';
        }
        cout << endl;
    }
    else{
        for(int i = n - 1; i >= 0; i--){
            cout << b[i] << ' ';
        }
        cout << endl;
    }
}

Measured memory_bytes: 6384
while True:
    a, b = map(int, raw_input().split())
    if a | b == 0:
        break
    v = [map(int, raw_input().split()) for _ in xrange(input())]
    dp = [[0] * (a + 2) for _ in xrange(b + 2)]
    dp[1][1] = 1
    for y in xrange(1, b + 1):
        for x in xrange(1, a + 1):
            if not [x, y] in v:
                dp[y + 1][x] += dp[y][x]
                dp[y][x + 1] += dp[y][x]
    print dp[b][a]

Measured memory_bytes: 4236
package main

import (
	"fmt"
	"sort"
)

// func min(nums []float64) (float64, int) {
// 	res := nums[0]
// 	if res < 0 {
// 		res = 1000000
// 	}
// 	id := 0
// 	for i := 0; i < len(nums); i++ {
// 		if res > nums[i] && nums[i] >= 0.0 {
// 			res = nums[i]
// 			id = i
// 		}
// 	}
// 	return float64(res), id
// }

func main() {
	var n int
	fmt.Scan(&n)
	v := make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&v[i])
	}

	for {
		sort.Sort(sort.Float64Slice(v))
		v[1] = (v[0] + v[1]) / 2
		v = v[1:]
		if len(v) == 1 {
			break
		}
	}
	fmt.Println(v[0])

	// for {
	// 	nokori := 0
	// 	for i := 0; i < n; i++ {
	// 		if v[i] > 0 {
	// 			nokori++
	// 		}
	// 	}
	// 	if nokori == 1 {
	// 		break
	// 	}
	// 	min1, id := min(v)
	// 	v[id] = -1.0
	// 	min2, id := min(v)
	// 	v[id] = (min1 + min2) / 2
	// }
	// for i := 0; i < n; i++ {
	// 	if v[i] > 0 {
	// 		fmt.Println(v[i])
	// 	}
	// }
}


Measured memory_bytes: 512
#include<iostream>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;

int main() {
	int N;
	int a[100000];
	int sum = 0;

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

	rep(i, 0, N) {
		if (i + 1 == a[a[i]-1]) sum++;
	}
	cout << sum / 2 << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <bitset>
#include <string>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <list>
#include <deque>
using namespace std;
#define INF 10000000
#define LLINF 100000000000000
typedef pair<int, int> P;
typedef long long ll;
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define VSORT(v) sort(v.begin(), v.end());
#define fi first
#define se second
#define out(x) cout << x << endl;
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0,1,0,-1 };
ll MOD = 1000000007;
ll ha[1000005] = { 0 };

int main() {
	while (true) {
		ll n, m;
		ll p[1005] = { 0 };
		ll res = 0;
		int cnt = 0;
		cin >> n >> m;
		if (n == 0 && m == 0) return 0;
		for (ll i = 1; i <= n; i++) cin >> p[i];
		for (ll i = 0; i <= n; i++) {
			for (ll j = i; j <= n; j++) {
				ha[cnt++] = p[i] + p[j];
			}
		}
		sort(ha, ha + cnt);
		for (int i = 0; i < cnt; i++) {
			ll sum = ha[i];
			int a = upper_bound(ha, ha + cnt, m - sum) - ha;
			//out(m-sum);
			if (a >= 1) if (sum + ha[a - 1] <= m) res = max(res, sum + ha[a - 1]);
		}
		out(res);
	}
	return 0;
}



Measured memory_bytes: 6956
// https://atcoder.jp/contests/abc130/tasks/abc130_b

#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define FORR(i, m, n) for (int(i) = (n); (i) >= (m); i--)
#define rep(...) _overload3(__VA_ARGS__, FOR, REP, )(__VA_ARGS__)
#define repr(...) _overload3(__VA_ARGS__, FORR, REPR, )(__VA_ARGS__)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main()
{
  int N, X, l, d = 0, cnt = 1;
  cin >> N >> X;

  REP(i, N)
  {
    cin >> l;
    d += l;
    if (d <= X)
      cnt++;
  }

  cout << cnt << '\n';

  return 0;
}


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

namespace agc002_a
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            string result = "";

            int a = input[0];
            int b = input[1];


            if (a > 0 && b > 0)
            {
                result = "Positive";
            }

            if (a == 0 || b == 0 )
            {
                result = "Zero";
            }

            if (a < 0 && b > 0)
            {
                result = "Zero";
            }

            if (a < 0 && b < 0)
            {
                int diff = b - a;
                if (diff%2 ==0)
                {
                    result = "Negative";
                }
                else
                {
                    result = "Positive";
                }

                
            }




            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#define rep(i, n) for(int i=0;i<(n);i++)
#define MAX_A 7368792
using namespace std;

int n, m;
bool a[MAX_A];
/*
int prime(int t) {
	int p=t;
    while(1) {
    	bool f=true;
        for(int i=2;i<p;i++) {
        	if(p%i==0) {
        		f=false;
        		break;
        	}
        }
        if(f)return p;
        p++;
    }
}
*/
int main() {
	while(cin>>m>>n,n|m) {
		rep(i, MAX_A)a[i] = true;
		int c=0, k=m;
		while(c<n) {
			if(a[k]) {
				for(int j=k;j<MAX_A;j+=k) {
					a[j]=false;
				}
				c++;
			}
			k++;
		}
		bool f=false;
		rep(i, MAX_A) {
			if(f && a[i]) {
			    cout<<i<<endl;
			    break;
			}else if(!f && !a[i])f=!f;
		}
	}
	return 0;
}

Measured memory_bytes: 10272
using System;
using System.Text.RegularExpressions;

namespace Key
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] rs = new string[2] { "[qwertasdfgzxcvb]", "[yuiophjklnm]"};
            string n;
            while (( n = Console.ReadLine()) != "#")
            {
                for(int i = 0; i < 2; i++)
                    n = new Regex(rs[i] + '+').Replace(n, "0");
                Console.WriteLine("{0}", n.Length - 1);
            }
        }
    }
}

Measured memory_bytes: 11192
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<iostream>
#define pb push_back
#define fi first
#define se second
#define sz(x)  x.size()
#define cl(x)  x.clear()
#define all(x)  x.begin() , x.end()
#define r(x)  scanf("%d", &x)
#define rr(x , y)  scanf("%d%d" , &x , &y)
#define rst(s)  scanf("%s" , s)
#define rl(x)  scanf("%lld" , &x)
#define rrl(x , y)  scanf("%lld%lld" , &x , &y)
#define w(x)  printf("%d" , x)
#define ww(x , y)  printf("%d %d" , x , y)
#define wl(x)  printf("%lld" , x)
#define wwl(x , y)  printf("%lld %lld" , x , y)
#define sp()  printf(" ")
#define en()  puts("")
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++) 
#define per(i , n , x)  for(int i = n ; i >= x ; i --) 
#define mem0(x)  memset(x , 0 , sizeof(x))
#define mem_1(x)  memset(x , -1 , sizeof(x))
#define mem_inf(x)  memset(x , inf , sizeof(x))
#define mem__inf(x)  memset(x , -inf , sizeof(x))
#define p_queue priority_queue
#define debug(x)  cout << x << '\n'
#define ddebug(x , y)  cout << x << ' ' << y << '\n'
using namespace std ;
//mt19937  rnd(chrono::high_resolution_clock::now().time_since_epoch().count()) ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int , int> pii ;
typedef pair<ll , ll> pll ;
typedef pair<int , ll> pil ;
typedef pair<ll , int> pli ;
const int inf = 0x3f3f3f3f ;
const int maxn = 105 ;
const int maxm = 30 ;
const ll mod = 1e9 + 7 ; 
int main()
{
	double pi = acos(-1.0) ;
	int r ;
	r(r) ;
	printf("%.12f\n" , double(r) * pi * 2) ;
	return 0 ;
}

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

int main() {
    int n;
    cin >> n;
    if(n % 2 == 0)
        cout << n << endl;
    else
        cout << n * 2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string s;
	cin>>n>>s;
	n %= 26;
	if(n==0)
	{
		cout<<s<<endl;
		return 0;
	}
	for(int i=0;i<s.size();i++)
	{
		if((int)s[i]+n>'Z')	s[i]=(int)s[i]-26;
		s[i]=(int)s[i]+n;
		cout<<s[i];
	}
	return 0;	
}

Measured memory_bytes: 256
package main

import "fmt"

func is_odd(n int) bool {
  var cnt int
  for n != 0 {
    n /= 10
    cnt++
  }
  if cnt % 2 == 1 {
    return true
  } else {
    return false
  }
}

func main() {
  var n, ans int
  fmt.Scan(&n)

  for i := 1; i <= n; i++ {
    if is_odd(i) { ans++ }
  }

  fmt.Println(ans)
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <numeric>

int main(){
    using namespace std;
    int n;
    cin >> n;
    vector<int> w;
    for(int i=0; i<n; i++){
        int t;
        cin >> t;
        w.push_back(t);
    }
    int sum = accumulate(w.begin(),w.end(),0);
    int tmp0 = sum;
    int tmp1 = sum;
    int cnt = 0;
    while(tmp1 > 0){
        tmp0 = tmp1;
        tmp1 -= 2*w[cnt];
        cnt++;
    }
    tmp1 = -tmp1;
    cout << ((tmp0 < tmp1) ? tmp0 : tmp1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int i,j,n,k,a[100000],x,max;
	while(scanf("%d%d",&n,&k),n!=0 && k!=0){
		max=0;
		for(i=0;i<n;i++)scanf("%d",&a[i]);
		for(i=0;i<n-k+1;i++){
			x=0;
			for(j=i;j<k+i;j++)x+=a[j];
			if(max==0 || x>max)max=x;
		}
		printf("%d\n",max);
	}
	return 0;
}


Measured memory_bytes: 2136
import heapq
import itertools
n=int(input())
edges=[[] for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int, input().split())
    a,b=a-1,b-1
    edges[a].append((b,c))
    edges[b].append((a,c))

def dijkstra(x,route):
    d=[float('inf')]*n
    d[x]=0
    visited={x}
    hq=[(0,x)]
    while hq:
        u=heapq.heappop(hq)[1]
        visited.add(u)
        for node,cost in route[u]:
            if (node not in visited) and d[node]>d[u]+cost:
                d[node]=d[u]+cost
                heapq.heappush(hq,(d[node],node))
    return d
q,k=map(int,input().split())
k-=1
dist=dijkstra(k,edges)
for _ in range(q):
    start,goal=map(int,input().split())
    print(dist[start-1]+dist[goal-1])

Measured memory_bytes: 51460
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    E = []
    
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            if N % 2 == 0 and i+j == N+1:
                continue
            if N % 2 == 1 and i+j == N:
                continue
            E.append((i, j))

    return E


def main():
    N = read_int()
    E = slv(N)
    print(len(E))
    for e in E:
        print('%d %d' % e)


if __name__ == '__main__':
    main()


Measured memory_bytes: 7216
#include <iostream>
#include <math.h>

using namespace std;

double dig2rad(double dig){return dig*M_PI/180.0;}

int main(void){
	int step,rot;
	char delim;
	double x=0,y=0,ang=90;

	while(cin >> step >> delim >> rot,step||rot){
		x+=step*cos(dig2rad(ang));
		y+=step*sin(dig2rad(ang));
		ang-=rot;
	}
	cout << (int)x << endl << (int)y << endl;

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
#define pb push_back
typedef long long ll;
const ll INF = 1LL << 60;
ll bigp = 1000000007;

int main()
{
    ll n;
    string s1,s2;
    cin >> n;
    cin >> s1 >> s2;

    vector<ll> rl;
    ll l = s1.size();
    rep(i,l){
        if(i>=1 && s1[i]==s1[i-1]){
            rl[rl.size()-1] ++;
        }else{
            rl.pb(1);
        }
    }
    ll ans = 1;
    if(rl[0]==1){
        ans = 3;
    }else{
        ans = 6;
    }
    reps(i,1,rl.size()){
        if(rl[i-1]==1 && rl[i]==1){ans = (ans*2)%bigp;}
        if(rl[i-1]==1 && rl[i]==2){ans = (ans*2)%bigp;}
        if(rl[i-1]==2 && rl[i]==2){ans = (ans*3)%bigp;}
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < (ll) b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= (ll) b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const ll MAX= 3e5+100;

ll dp[MAX],n,ans[MAX],siz[MAX],fac[MAX],mod=1e9+7;
vi adj[MAX];

ll bp(ll a,ll e){
	if(e==0) return 1;
	if(e&1) return (bp(a,e-1)*a)%mod;
	ll x = bp(a,e>>1);
	return (x*x)%mod; 
}

ll inv(ll a){
	return bp(a,mod-2);
}

void dfs(int u,int f){
	dp[u]=1,siz[u]=1;
	f(i,0,adj[u].size()){
		ll v=adj[u][i];
		if(v==f) continue;
		dfs(v,u);
		siz[u]+=siz[v];
		(dp[u]*=dp[v])%=mod;
		(dp[u]*=inv(fac[siz[v]]))%=mod;
	}
	(dp[u]*=fac[siz[u]-1])%=mod;
}

void dfs1(int u,int f){
	f(i,0,adj[u].size()){
		ll v=adj[u][i];
		if(v==f) continue;
		ans[v]=(ans[u]*((siz[v]*inv(n-siz[v]))%mod))%mod;
		dfs1(v,u);
	}
}

int main(){
	fastio;
	ll u,v;
	fac[0]=1;
	f(i,1,MAX) (fac[i]=i*fac[i-1])%=mod;
	cin>>n;
	f(i,1,n){
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	dfs(1,0);
	ans[1]=dp[1];
	dfs1(1,0);
	f(i,1,n+1) cout<<ans[i]<<endl;
	return 0;	
}

Measured memory_bytes: 26352