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

using namespace std;
typedef long long int lli;
typedef vector<int> iv;
typedef vector<bool> bv;
typedef vector<string> sv;
typedef vector<long long int> llv;
typedef vector<double> dv;
#define debug_ printf("OK\n")

#define sor_(vec) sort(vec.begin(),vec.end())
#define rev_(vec) reverse(vec.begin(),vec.end())
#define rep(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define reps(i,n,s) for(int i=static_cast<int>(s);i<static_cast<int>(n);i++)
#define isposi(num) if(num>0)

const long long mod = 1000000007;

#define MAX_H 20
#define MAX_W 20

/*
 *4 4 4 4
 *1 1 1
 *1 0 0
 *1 1 0
 *1 0 1
 *0
 */

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int R,G,B,N,ans=0,ct=0,sct=0,tct=0,base=0,secbase=0;
    bool flag=false;
    cin>>R>>G>>B>>N;
    if(R==N==G==B){cout<<"3";return 0;}
    if(R==N){
        ans++;
        if(G!=N&&B!=N){
            while (true) {
                base=G*ct;
                if(base>N)break;
                /*while (true){
                    if(base+(B*sct)==N){ans++;flag=true;}
                    else if(base+(B*sct)>N)break;
                    sct++;
                }*/if((N-base)%B==0)ans++;
                ct++;
                sct=0;
            }
        }
        else if(G==N){
            ans++;
            if(N%B==0)ans++;
        }
        else if(B==N){
            ans++;
            if(N%G==0)ans++;
        }
    }
    else if(G==N){
        ans++;
        if(B!=N){
            while (true) {
                base=R*ct;
                if(base>N)break;
                /*while (true){
                    if(base+(B*sct)==N){ans++;flag=true;}
                    else if(base+(B*sct)>N)break;
                    sct++;
                }*/if((N-base)%B==0)ans++;
                //if(flag)break;
                ct++;
                sct=0;
            }
        }
        else if(B==N){
            ans++;
            if(N%R==0)ans++;
        }
    }
    else if(B==N){
        ans++;
        while (true) {
            base=R*ct;
            if(base>N)break;
            /*while (true){
                if(base+(G*sct)==N){ans++;flag=true;}
                else if(base+(G*sct)>N)break;
                sct++;
            }*/if((N-base)%G==0)ans++;
            //if(flag)break;
            ct++;
            sct=0;
        }
    }
    else {
        while (true) {
            base=R*ct;
            if(base==N){ans++;break;}
            if(base>N)break;
            while (true) {
                secbase=G*sct;
                if(base+secbase>N)break;
                /*while (true) {
                    if(base+secbase+(B*tct)==N){ans++;}
                    else if(base+secbase+(B*tct)>N)break;
                    tct++;
                }*/if((N-base-secbase)%B==0)ans++;
                tct=0;
                sct++;
            }
            tct=0;
            sct=0;
            ct++;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int bits = 32;
int main() {
	int N;
	cin >> N;
	int bit = 0;
	vector<int> X(N), Y(N);
	for (int i = 0; i < N; ++i) {
		cin >> X[i] >> Y[i];
		bit |= 1 << ((X[i] ^ Y[i]) & 1);
	}
	if (bit == 3) {
		cout << -1 << endl;
	}
	else {
		cout << bits + (bit == 1 ? 1 : 0) << endl;
		vector<long long> d;
		if (bit == 1) cout << 1 << ' ';
		for (int i = bits - 1; i >= 0; --i) {
			cout << (1LL << i);
			if (i) cout << ' ';
			else cout << endl;
		}
		for (int i = 0; i < N; ++i) {
			string ans;
			if (bit == 1) {
				ans += "R"; --X[i];
			}
			for (int j = bits - 1; j >= 0; --j) {
				long long vl = abs(X[i] + (1LL << j)) + abs(Y[i]);
				long long vr = abs(X[i] - (1LL << j)) + abs(Y[i]);
				long long vd = abs(X[i]) + abs(Y[i] + (1LL << j));
				long long vu = abs(X[i]) + abs(Y[i] - (1LL << j));
				long long vm = min({ vl, vr, vd, vu });
				if (vl == vm) X[i] += 1LL << j, ans += "L";
				if (vr == vm) X[i] -= 1LL << j, ans += "R";
				if (vd == vm) Y[i] += 1LL << j, ans += "D";
				if (vu == vm) Y[i] -= 1LL << j, ans += "U";
			}
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int n, numr = 0, r = 0;
    cin >> n;
    vector<char> c(n);
    for(int i = 0; i < n; ++i){
        cin >> c.at(i);
        if(c.at(i) == 'R') numr++;
    }
    for(int i = 0; i < numr; ++i){
        if(c.at(i) == 'R') r++;
    }
    cout << numr - r << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	int n, a;
	vector<int> v;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a;
		v.push_back(a);
	}

	sort(v.begin(), v.end());

	
	cout << v[n -1] - v[0] << endl;
	return 0;


}

Measured memory_bytes: 256
class Union():
  def __init__(me,N):
    me.N = N
    me.up = [-1]*N
    me.down = [ [] for i in range(N) ]
  def union(me,a,b):
    ua = me.up[a] if me.up[a]!=-1 else a
    ub = me.up[b] if me.up[b]!=-1 else b
    if (ua == ub):
      return
    if ( len(me.down[ua]) < len(me.down[ub]) ):
      ub,ua = ua,ub
    for v in me.down[ub]:
      me.up[v] = ua
    me.down[ua].extend( me.down[ub] )
    me.down[ub] = []
    me.up[ub] = ua
    me.down[ua].append( ub )
  def count(me,a):
    ua = me.up[a] if me.up[a]!=-1 else a
    return len(me.down[ua])+1

N,M= [ int(it) for it in input().split() ]
li = [[ int(it)-1 for it in input().split() ] for i in range(M)]
li.reverse()
si = []

uni = Union(N)
S = N*(N-1)//2
for a,b in li:
  ua = uni.up[a] if uni.up[a]!=-1 else a
  ub = uni.up[b] if uni.up[b]!=-1 else b
  si.append(S)
  if (ua != ub):
    S -= uni.count(ua)*uni.count(ub)
    uni.union(a,b)
    
si.reverse()
print ( "\n".join( map(str,si) ) )




Measured memory_bytes: 121304
import java.util.Scanner;
public class Main {
	void doIt() {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();

		for(int r = 0; r < n; r++) {
			int bath = stdIn.nextInt();
			int pool = stdIn.nextInt();
			int bathN = stdIn.nextInt();
			int poolN = stdIn.nextInt();
			int ans1, ans2;
			if(bathN >= 5 && poolN >= 2) {
				System.out.println((int)(((bath * bathN) + (pool * poolN)) * 0.8)); 
			} else {
				if(bathN >= 5 && poolN < 2) {
					ans1 = (bath * bathN) + (pool * poolN);
					poolN = 2;
					ans2 = (int)(((bath * bathN) + (pool * poolN)) * 0.8); 
					System.out.println((int)Math.min(ans1, ans2));
				} else if(bathN < 5 && poolN >= 2) {
					ans1 = (bath * bathN) + (pool * poolN);
					bathN = 5;
					ans2 = (int)((((bath * bathN) + (pool * poolN)) * 0.8));
					System.out.println((int)Math.min(ans1, ans2));
				} else {
					ans1 = (bath * bathN) + (pool * poolN);
					bathN = 5;
					poolN = 2;
					ans2 = (int)((((bath * bathN) + (pool * poolN)) * 0.8));
					System.out.println((int)Math.min(ans1, ans2));
				}
			}
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().doIt();
	}
}

Measured memory_bytes: 23392
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)

int main(void){
  string s;
  cin>>s;
  vector<int> a(27);
  //cout<<s.at(0)-'A'<<endl;

  r(i,s.size()){
    a.at(s.at(i)-'A')++;
  }
  int cnt=0;
  r(i,a.size()){
    if(a.at(i)==2)cnt++;
    //cout<<a.at(i)<<endl;
  }
  if(cnt==2)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;



  return 0;
}


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

#define ris   return *this
#define tmplt template<class T
#define dbgo  debug& operator<<
tmplt > struct rge { T b, e; };
tmplt > rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
~debug(){cerr<<endl;}
tmplt > dbgo(T x){cerr<<boolalpha<<x;ris;}
tmplt, class C > dbgo(pair<T, C> x){ris<<"("<<x.first<<", "<<x.second<<")";}
tmplt > dbgo(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}ris<<"]";}
tmplt > dbgo(vector<T> x){ris<<range(x.begin(),x.end());}
#else
tmplt > dbgo(const T&){ris;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define ford(i, n) for(int i = n-1; i >= 0; i--) 

template<typename T> 
void min_self(T& a, T b) { 
    a = min(a, b); 
}
template<typename T>
void max_self(T& a, T b) { 
    a = max(a, b); 
}

int calc(vector<int> a, vector<int> b, int bit) {
    int n = a.size();
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    debug() nav(a);
    debug() nav(b);
    ll ans = 0;
    int target = 1<<bit;
    for(int i = 0; i < n; i++) {
        int r = lower_bound(b.begin(), b.end(), 2*target - a[i]) - b.begin();
        r--;
        int l = lower_bound(b.begin(), b.end(), target - a[i]) - b.begin();
        //$ debug() nav(l) nav(r);
        ans += r - l + 1;
        l = lower_bound(b.begin(), b.end(), 3*target - a[i]) - b.begin();
        ans += n - l;
    }
    
    return ans & 1;
}

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

    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        cin >> b[i];
    }
    int ans = 0;
    for(int bit = 0; bit < 30; bit++) {
        vector<int> na(n), nb(n);
        for(int i = 0; i < n; i++) {
            na[i] = a[i] % (1<<(bit+1));
            nb[i] = b[i] % (1<<(bit+1));
        }
        //$ debug() nav(bit) nav(calc(na, nb, bit));
        ans |= calc(na, nb, bit)<<bit;
    }
    
    cout << ans << endl;
}













// Don't worry, you're getting better

// Read statement carefully
// Solve on paper first!
// Make your infinity big enough
// Overflows (long long)

// Author: blondie


Measured memory_bytes: 5016
import itertools
n,m=map(int,input().split())
path=[]
for i in range(m):
    a,b=map(int,input().split())
    path.append([a,b])
    path.append([b,a])
ans=0
factorial=list(itertools.permutations(list(range(1,n+1))))

for i in range(len(factorial)):
    if factorial[i][0]!=1:
        continue
    flag=True
    for j in range(1,n):
        if [factorial[i][j-1],factorial[i][j]] not in path:
            flag=False
    ans+=flag
print(ans)

Measured memory_bytes: 13984
from collections import defaultdict

def main():
    num = int(input())
    count = defaultdict(int)
    for i in range(num):
        data = int(input())
        count[data] += 1

    ans = 0
    for i, v in count.items():
        if v % 2 == 1:
            ans += 1
    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 55384
#import sys
#input = sys.stdin.readline
import random
import bisect
#from statistics import mean, median, variance, stdev

#template input

def IT(): #整数1個
    return int(input())
def IL(): #整数複数
    return [int(_) for _ in input().split()]
def IS(): #文字列複数
    return [_ for _ in input().split()]
def ILS(n): #整数1つ　縦にズラーってなってるやつ
    return [int(input()) for _ in range(n)]
def SLS(n): #文字列　縦にズラーってなってるやつ
    return [input() for _ in range(n)]
def ILSS(n): #整数複数　縦にズラーってなってるやつ
    return [[int(_) for _ in input().split()] for j in range(n)]

#template technique
def bit_full_search(ss):
    n = len(ss)
    for i in range(1 << n):
        s = ""
        for j in range(n + 1):
            if ((1 & i >> j) == 1):
                s += ss[j]
        print(s)
def bit_full_search2(A):
    #https://blog.rossywhite.com/2018/08/06/bit-search/
    value = []
    for i in range(1 << len(A)):
        output = []

        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                #output.append(A[j])
                output.append(A[j])
        value.append([format(i, 'b').zfill(16), sum(output)])

    value.sort(key=lambda x:x[1])
    bin = [value[k][0] for k in range(len(value))]
    val = [value[k][1] for k in range(len(value))]
    return bin, val
def matching_bisect(list1_val, list2_val, n):
    #2分探索
    j = 0
    for i in range(len(list1_val)):
        j = bisect.bisect_left(list2_val, n - list1_val[i])
        if j < len(list2_val):
            if list1_val[i] + list2_val[j] == n:
                #ans = list2_bin[j] + list1_bin[i]
                break
    return j

"""ここからメインコード"""

def main():

    s = input()
    one = s.count("1")
    two = s.count("0")
    print(len(s) - abs(one-two))


main()


Measured memory_bytes: 3572
#include <bits/stdc++.h> 
  
using namespace std; 
  
void Solve(){
    int h1, m1, h2, m2, x;
    cin>>h1>>m1>>h2>>m2>>x;
    int getup = h1 * 60 + m1;
    int sleepp = h2 * 60 + m2;
    int day = 24 * 60;
    int diff = sleepp - getup;
    if(diff < 0) diff = day - getup + diff;
    int res = diff - x;
    cout<<res<<'\n';

} 
int main() 
{ 
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    Solve();
}

  

Measured memory_bytes: 3608
K, A, B = map(int, input().split())
if K < A:
    print(K + 1)
else:
    if A + 1 < B:
        P = K - A + 1
        print((P // 2) * (B - A) + int(P % 2 != 0) + A)
    else:
        print(K + 1)

Measured memory_bytes: 2940
#include<stdio.h>
int main()
{
    char c;
    while(scanf("%c",&c)!=EOF) {
        if ('A'<=c&&c<='Z') printf("%c",c-'A'+'a');
        else if ('a'<=c&&c<='z') printf("%c",c-'a'+'A');
        else printf("%c", c);
    }
    return 0;
}


Measured memory_bytes: 1752
X = int(input())

divisor = []
for i in range(1, int(X ** 0.5) + 1):
    if X % i == 0:
        divisor.append(i)
        if i != X // i:
            divisor.append(X // i)

ok = False
for d in divisor:
    if ok:
        break

    for x in range(-1000, 1000):
        v = x ** 5 - (x - d) ** 5
        if v == X:
            print(x, x - d)
            ok = True
            break


Measured memory_bytes: 68148
s = input()
YYMM = False
MMYY = False

if 1 <= int(s[:2]) <= 12:
    MMYY = True
if 1 <= int(s[2:]) <= 12:
    YYMM = True

ans = ''
if YYMM and MMYY:
    ans = 'AMBIGUOUS'
elif YYMM:
    ans = 'YYMM'
elif MMYY:
    ans = 'MMYY'
else:
    ans = 'NA'

print(ans)

Measured memory_bytes: 3060
# ALDS1_2_B: Selection Sort 
#N = 6
#A = [int(x) for x in "5 6 4 2 1 3".split()]

N = int(input())
A = list(map(int, input().split())) 


def selectionSort(A, N):
    e = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            A[i], A[minj] = A[minj], A[i]
            e += 1
            #print(A)
    print(" ".join(map(str, A)))
    print(e)
    
selectionSort(A, N)


Measured memory_bytes: 5600
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Ford(i,a,b) for(int i=(a);i>=(b);--i)
#define fio(s) freopen(s".inp","r",stdin)
#define foo(s) freopen(s".out","w",stdout)
#define task "test"
using namespace std;
typedef long long LL;
const LL N=3009,OO=1e9+7;
LL n,k,f[409][409],a[N],ans,s[N];
LL calculating(LL i,LL j){
    if(f[i][j]!=-1) return f[i][j];
    if(i==j){f[i][j]=0; return f[i][j];}
    For(z,i,j-1){
        if(f[i][j]==-1) f[i][j]=calculating(i,z)+calculating(z+1,j)+s[j]-s[i-1];
            else f[i][j]=min(f[i][j],calculating(i,z)+calculating(z+1,j)+s[j]-s[i-1]);
    }
    return f[i][j];
}
int main(){
    //fio(task); foo(task);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    memset(f,255,sizeof(f));
    For(i,1,n) {cin>>a[i]; s[i]=s[i-1]+a[i];}
    ans=calculating(1,n);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1664
n = int(input())

restaurants = {}
for i in range(1, n+1):
    s, p = input().split()
    restaurants.setdefault(s, []).append((int(p), i,))

for s, points in sorted(restaurants.items(), key=lambda x: x[0]):
    for p, i in sorted(points,key=lambda x: x[0], reverse=True):
        print(i)

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

int main(){
  int count = 0;
  vector<char> s(3);
  cin >> s.at(0) >> s.at(1) >> s.at(2);
  
  for(int i = 0;i < 3;i++){
	if(s.at(i) == '1'){
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;

const int MAX_N = 105;
const int MAX_K = 100005;

int n, k;
int a[MAX_N];
bool canWin[MAX_K][2];

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i <= k; i++)
		for (int j = 0; j < 2; j++)
		{
			for (int x = 0; x < n; x++)
				if (i - a[x] >= 0 && !canWin[i - a[x]][1 - j])
				{
					canWin[i][j] = true;
					break;
				}
		}

	cout << (canWin[k][0] ? "First" : "Second") << endl;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int t;

int main()
{
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    cin>>t;
    int tmp;
    bool flag = true;
    for(int i=0;i<t;++i) {
        cin>>tmp;
        if((tmp&1)==0) {
            if(tmp%3!=0 && tmp%5!=0) flag = false;
        }
    }
    if(flag) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll s;
set<ll> st;
int main() {
    cin>>s;

    st.insert(s);
    REP(i, 1, 1010101){
        if(s%2==0) s/=2;
        else s=3*s+1;
        st.insert(s);

        if(st.size()==i){
            cout<<i+1<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
k=int(input())
 
from math import gcd
s6=0
for i in range(2,k-1):
    for j in range(i+1,k):
        for jj in range(j+1,k+1):
            s6+=gcd(gcd(i,j),jj)
 
s3=0
for i in range(2,k):
    for j in range(i+1,k+1):
        s3+=gcd(i,j)
 
s1=int((k+1)*k/2)
 
 
print(s1+s3*6+s6*6+(k-1)*6+(k-2)*(k-1)*3)

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; 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 FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

ll ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n;
int x, y;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;
    cin >> s;
    cout << s[0] << s.length() - 2 << s[s.length() - 1] << endl;
    return 0;
}


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

typedef vector<vector<double>> matrix;


matrix inv(matrix a) {
    int n = a.size();
    matrix ret(n, vector<double>(n, 0));
    for (int i = 0; i < n; ++i)
        ret[i][i] = 1;

    for(int i = 0; i < n; ++i) {
        double buf = 1 / a[i][i];
        for(int j = 0; j < n; ++j){
            a[i][j] *= buf;
            ret[i][j] *= buf;
        }
        for(int j = 0; j < n; ++j){
            if(i != j){
                buf = a[j][i];
                for(int k = 0; k < n; ++k){
                    a[j][k] -= a[i][k] * buf;
                    ret[j][k] -= ret[i][k] * buf;
                }
            }
        }
    }
    return ret;
}

vector<double> mul(matrix a, vector<double> v) {
    int n = a.size(), m = a[0].size();
    vector<double> ret(n, 0);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            ret[i] += a[i][j] * v[j];

    return ret;
}

int main() {
    while (1) {
        int d;
        cin >> d;
        if (!d) return 0;

        vector<double> v(d + 3);
        for (int i = 0; i < d + 3; ++i)
            cin >> v[i];

        for (int i = 0; i < d + 3; ++i) {
            vector<double> vec;
            matrix mat;
            for (int j = 0; j < d + 3; ++j) {
                if (i == j) continue;

                vec.push_back(v[j]);
                vector<double> p(d + 2);
                p[0] = 1;
                for (int k = 1; k < d + 2; ++k)
                    p[k] = p[k - 1] * j;

                mat.push_back(p);
            }
            vector<double> ret = mul(inv(mat), vec);
            if (ret[d + 1] < 1e-5 && ret[d + 1] > -1e-5) {
                cout << i << "\n";
                break;
            }
        }
    }
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using P = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
int INF = 1e9+7;

int main() {
    int N;
    cin >> N;
    vi A(N);

    int input, count;
    for (int i=0; i<N; i++) {
        count = 0;
        cin >> input;
        while(input%2==0) {
            count += 1;
            input /= 2;
        }
        A[i] = count;
    }
    sort(A.begin(),A.end());
    cout << A[0] << endl;
}


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

using namespace std;

int n;
int c[55];
long long dp[55][55][2505];
int md;

long long solve(int pos, int k, int v) {
	if (pos == n) {
		if (v == 0 && k == 0) return 1ll;
		return 0ll;
	}
	if (k < 0 || v < 0) return 0;
	if (dp[pos][k][v] != -1) return dp[pos][k][v];                                 
	long long ans = solve(pos + 1, k - 1, v - c[pos]) + solve(pos + 1, k, v);
	return dp[pos][k][v] = ans;
}

int main() {
	int a;
	scanf("%d %d", &n, &a);
	for (int i = 0; i < n; i++) {
		scanf("%d", c + i);
	}
	long long ans = 0;
	for (int k = 1; k <= n; k++) {
		memset(dp, -1, sizeof dp);
		ans += solve(0, k, a * k);
	}
	printf("%lld\n", ans);  
	return 0;
}                    	

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

using namespace std;

#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"

#define DEBUG(x) cout << "> " << #x << ": " << x << endl;

typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
const int inf = 1e9+7;
const ll longinf = 1LL<<60;

// Start Coding...

void solve() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll div = N / (A + B);
    ll div_left = N % (A + B);
    if (div_left > A) div_left = A;
    cout << A * div + div_left << endl;
    return;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 2; i <= n; i++) {
            int x = i;
            for (int j = 2; j * j <= x; j++) {
               while (x % j == 0) {
                    if (map.containsKey(j)) {
                        map.put(j, map.get(j) + 1);
                    } else {
                        map.put(j, 1);
                    }
                    x /= j;
                }
            }
            if (x != 1) {
                if (map.containsKey(x)) {
                    map.put(x, map.get(x) + 1);
                } else {
                    map.put(x, 1);
                }
            }
        }
        long ans = 1;
        for (int x : map.values()) {
            ans *= x + 1;
            ans %= MOD;
        }
		System.out.println(ans);
	}
}


Measured memory_bytes: 21716
import sys

input = sys.stdin.readline
N = int(input())

A = []
for _ in range(N):
    A.append(int(input()))

for i, a in enumerate(sorted(A, reverse=True)):
    if i == 0:
        first = a
    elif i == 1:
        second = a
    else:
        break
# print(first, second)

for a in A:
    if a == first:
        print(second)
    else:
        print(first)

Measured memory_bytes: 19028
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define mod 1000000007
#define vll vector<ll>

ll ti[100001];
vll g[100001];ll vis[100001];


ll n,m;

void dfs(ll n)
{
    vis[n]=1;
    for(auto child:g[n])
    {
        if(vis[child]==0)
            dfs(child);

        ti[n]=max(ti[n],1+ti[child]);
    }
}

ll func(ll v)
{
    if(g[v].size()==0)
        return 0;

    if(ti[v]!=-1) return ti[v];

    ll mx=0;
   for(ll i=0;i<g[v].size();i++)
   {
       mx=max(mx,1+func(g[v][i]));
   }
   return ti[v]=mx;
}


int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    memset(ti,0,sizeof ti);
	//ll n;
	cin>>n>>m;
	ll a,b;

	for(ll i=0;i<m;i++){
        cin>>a>>b;
        g[a].pb(b);
	}

	for(ll i=1;i<=n;i++)
    {
        if(vis[i]!=1)
            dfs(i);
    }
    ll mx=0;
    for(ll i=1;i<=n;i++)
        mx=max(mx,ti[i]);

    cout<<mx<<endl;

	return 0;
}



Measured memory_bytes: 9344
#include<iostream>
#include<vector>

using namespace std;

class DisjointSet{
    public:
        vector<int> rank, p;

//        DisjointSet(){}
        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for(int i=0; i<size; i++) makeSet(i);
        }

        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x, int y){
            return findSet(x) == findSet(y);
        }

        void unite(int x, int y){
            link(findSet(x), findSet(y));
        }

        void link(int x, int y){
            if(rank[x] > rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x] == rank[y]){
                    rank[y]++;
                }
            }
        }

        int findSet(int x){
            if(x != p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};

int main(){
    int n, a, b, q;
    int t;

    cin >> n >> q;
    DisjointSet ds = DisjointSet(n);

    for(int i=0; i<q; i++){
        cin >> t >> a >> b;
        if(t == 0) ds.unite(a, b);
        else if(t == 1){
            if(ds.same(a, b)) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }

    return 0;
}


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

int main() {
  int N ,K ,x ,dst=0;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (x<(K-x))
      dst += x*2;
    else
      dst += (K-x)*2;
  }
    cout << dst << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            int n = scan.nextInt();
            if(n == 0){
                break;
            }
            int max = scan.nextInt();
            int res = max;
            for(int i = 1,t = 0;i < n;i++){
            	max = maximum(t=scan.nextInt(),t+max);
            	res = maximum(res,max);
            }
            System.out.println(res);
        }
    }
    public static int maximum(int a,int b){
        return (a > b)?a:b;
    }
}

Measured memory_bytes: 26472
def solve():
    n = int(input())
    lst = list(map(int,input().split()))
    if 0 in lst:
        print(0)
        return
    mul = 1
    for ele in lst:
        mul = mul * ele
        if mul > 1e18:
            print(-1)
            return
    
    print(mul)
    
solve()

Measured memory_bytes: 21640
use std::io;
use std::io::Read;

fn main() {
    let mut stdin = io::stdin();
    let mut lines = String::new();
    let _ = stdin.read_to_string(&mut lines);
    let vec = lines.lines().collect::<Vec<&str>>();
    let ab = vec[0].split(' ').collect::<Vec<&str>>();
    let a :usize = ab[0].trim().parse().unwrap();
    let b :usize = ab[1].trim().parse().unwrap();
    let a0 :usize = (a + 11) % 13;
    let b0 :usize = (b + 11) % 13;
    if a0 == b0 {
        println!("Draw");
    } else if a0 > b0 {
        println!("Alice");
    } else {
        println!("Bob");
    }
}


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

int main(){
  string s;
  cin>>s;
  int q,rev=0;
  cin>>q;
  string t;
  rep(i,q){
    
    int y;
    cin>>y;
    if(y==1){
       swap(t,s);
    }else if(y==2){
       char x;
       int y;
       cin>>y>>x;
       //s dpn
       //t blkng
       if(y==1){//dr dpn
         t+=x;
       }else if(y==2){ //dr blkgn
         s+=x;
       }

       
    }
  }
  reverse(t.begin(),t.end());
    t+=s;
      //reverse(s.begin(),s.end());
    cout<<t<<endl;
  }




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

//1,...,12をグループ１
//4,...11をグループ9
//1+1 or 9+9 ならyes

int group(int a){
    if(a==1 || a==3 || a==5 || a==7 || a==8 ||a==10 || a==12) return 1;
    else if(a==4 || a==6 || a==9 || a==11) return 9;
    else return 0;
}
int main(){
    int x, y;
    cin >> x >> y;
    
    int a1 = group(x);
    int a2 = group(y);

    if(a1 + a2 == 2 || a1+a2 == 18) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
	int k;
  cin>>k; 
  string palabra;
  cin>>palabra;
  int tamano;
  tamano=palabra.size();
    if (tamano>k){
          for(int i=0;i<k;i++){
          cout<<palabra[i];
          }
          cout<<"...";
      }
      else{
        cout<<palabra<<endl;
    }
      
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
    
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, n) for (int i = 0; i < n; i++)
#define repn(i, a, b) for (int i = a;i<=b;i++)
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mem(x) memset(x, 0, sizeof(x))
#define ritr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define pai pair < int, int> 
#define pal pair < ll, ll> 
#define vi vector <int> 
#define vl vector < ll > 
#define vpai vector < pii > 

const int mod = 1e9+7;
const int INF = INT_MAX;
const int sze = 3005;

void solve() {
    int n,m;
    cin>>n>>m;
    ll time;
    cin>>time;

    ll a[n],b[m];
    
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];

    vl aa(n+1,0),bb(m+1,0);
    //aa[0]=a[0],bb[0]=b[0];

    repn(i,1,n) aa[i]=a[i-1]+aa[i-1];
    repn(i,1,m) bb[i]=b[i-1]+bb[i-1];

    // rep(i,n+1) cout<<aa[i]<<" ";
    // cout<<endl;
    // rep(i,m+1) cout<<bb[i]<<" ";
    // cout<<endl;

    int count=0;
    ll curr=0,mx=0;
    ll temp=time;
    for(int i=0;time-aa[i]>=0&&i<=n;i++){
        ll x=lower_bound(all(bb),time-aa[i])-bb.begin();
        if(time-aa[i]<bb[x]) x--;
        if(x<0) continue;
        mx=max(mx,min(x,(ll)m)+i);
    }
    time=temp;
    for(int i=0;time-bb[i]>=0&&i<=m;i++){
        ll x=lower_bound(all(aa),time-bb[i])-aa.begin();
        if(time-bb[i]<aa[x]) x--;
        if(x<0) continue;
        mx=max(mx,min(x,(ll)n)+i);
    }
    cout<<mx<<endl;
}

int main() {
    IOS;

    int t = 1;
    // cin >> t;
    while (t--) {
       solve();
    }

  return 0;
}

Measured memory_bytes: 9464
#include <iostream>
using namespace std;
typedef long long int LLI;
LLI power(LLI pods, LLI wykl)
{
	LLI wynik = 1;
	for(int i = 0; i < wykl; i++)
		wynik *= pods;
	return wynik;
}
int main()
{
	LLI n, k;
	cin >> n >> k;
	cout << k*power((LLI)(k-1),(LLI)(n-1));
}

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

typedef long long ll;

const int mod=1000000007;

int n;
ll dp[100005][2];
vector<int> g[100005];

ll dfs(int x,int p){
    dp[x][0]=dp[x][1]=1;
    for(int i=0;i<g[x].size();i++){
        int y=g[x][i];
        if(y!=p){
            dfs(y,x);
            dp[x][0]=dp[x][0]*(dp[y][0]+dp[y][1])%mod;
            dp[x][1]=dp[x][1]*dp[y][0]%mod;
        }
    }
    return (dp[x][0]+dp[x][1])%mod;
}

int main(){

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

    cin>>n;
    for(int i=1;i<n;i++){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    cout<<dfs(1,-1)<<endl;

    return 0;
}

Measured memory_bytes: 14208
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

void solve(void){
	int N, M;
	cin >> N >> M;
	vector <int> accs(1000);
	accs[0] = 0;
	rep(1000, i) accs[i] = i;
	Rep(1, 999, i)
	{
		accs[i] += accs[i-1];
	}

	rep(1000, x)
	{
		if (accs[x+1] - accs[x] == M - N)
		{
			cout << accs[x] - N << endl;
			return;
		}
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long

int S,W;

int main() {
	cin>>S>>W;
	cout<<(S>W?"safe":"unsafe")<<endl;

	return 0;
}



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

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        String[] S = new String[H];
        char[][] s = new char[H][W];
        for (int i = 0; i < H; i++) {
            S[i] = sc.next();
        }
        for (int i = 0; i < H; i++) {
            s[i] = S[i].toCharArray();
        }
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (s[i][j] == '.') {
                    continue;
                } else if (i < H - 1 && s[i + 1][j] == '#') {
                    continue;
                } else if (i > 0 && s[i - 1][j] == '#') {
                    continue;
                } else if (j < W - 1 && s[i][j + 1] == '#') {
                    continue;
                } else if (j > 0 && s[i][j - 1] == '#') {
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 21844
object Main extends App {
    val Seq(_, x, y) = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt)).toSeq
    val z = (x zip y).map(p => math.abs(p._1-p._2))
    def f(n: Int) = math.pow(z.map(math.pow(_, n)).sum, 1.0/n)
    (1 to 3).foreach(n => println(f(n)))
    println(z.max)
}

Measured memory_bytes: 44584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,d;
    cin>>n>>d;
    cout<<(n-1)/(2*d+1)+1<<endl;
}

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

class P
{
    static void Main()
    {
        int[] NCK = Console.ReadLine().Split().Select(int.Parse).ToArray();
        List<int> tourist = new List<int>();
        for (int i = 0; i < NCK[0]; i++) tourist.Add(int.Parse(Console.ReadLine()));
        tourist.Sort();
        int buslim = -1;
        int busnin = 0;
        int res = 0;
        foreach (var i in tourist)
        {
            if (buslim < i || busnin == NCK[1])
            {
                buslim = i + NCK[2];
                busnin = 1;
                res++;
            }
            else
            {
                busnin++;
            }
        }

        Console.WriteLine(res);
    }
}

Measured memory_bytes: 17452
#include<iostream>
using namespace std;
int main(){
  double N,s=0;
  cin >> N;
  double a[10000];
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int i=0;i<N;i++){
    s += 1/a[i];
   
  }
  cout << 1/s <<endl;
}

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

int main(){
	int A,B,ans=0;
	cin>>A>>B;
	for(int i=0;i<2;i++){
		if(A>=B){
			ans+=A;
			A--;
		}else{
			ans+=B;
			B--;
		}
    }
  cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

div = make_divisors(N)


min_m = 0
if len(div)%2 == 1:
    min_m = int((len(div)+1)/2)
if len(div)%2 == 0:
    min_m = int(len(div)/2)
    if div[min_m] - div[min_m-1] < 2:
        min_m += 1

print(sum(div[min_m:])-(len(div)-min_m))

Measured memory_bytes: 38768
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define li 100005
//typedef pair<int,int> PII;
typedef long long int lo;
using namespace std;
int n,m,cev,a;
int main(){
	scanf("%d",&n);
	if(n==1){
		printf("Hello World");
		return 0;
	}
	scanf("%d %d",&m,&a);
	printf("%d",m+a);
	return 0;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	int n, l;
	scanf("%d %d", &n, &l);
	vector<int> a(n);
	rep(i, n)scanf("%d", &a[i]);
	int aa = -1;
	rep(i, n - 1) {
		if (a[i] + a[i + 1] >= l)aa = i + 1;//i番目の切れ目
	}
	printf("%s\n", aa == -1 ? "Impossible" : "Possible");
	if (aa == -1)return 0;
	else {
		int j = 1;
		while (j < aa) {
			printf("%d\n", j);
			++j;
		}
		j = n - 1;
		while (j > aa) {
			printf("%d\n", j);
			--j;
		}
		printf("%d\n", aa);
	}

	return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var happinessForA = new long[n];
        var happinessForB = new long[n];
        for (int i = 0; i < n; i++)
        {
            var ab = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            happinessForA[i] = ab[0];
            happinessForB[i] = ab[1];
        }

        var happinessOfAvsB = E.Range(0, n)
            .Select(i => happinessForA[i] + happinessForB[i])
            .OrderByDescending(x => x)
            .Where((_, i) => i % 2 == 0)
            .Sum() - happinessForB.Sum();
        Console.WriteLine(happinessOfAvsB);
    }
}


Measured memory_bytes: 20028
import  math
hour_hari , minute_hari , hour , minute = map(int,input().split())
hour *= 5.0
hour_deg = 6*hour
hour_deg += 0.5*minute
minute_deg = 6*minute
hour_rad = math.radians(hour_deg)
minute_rad = math.radians(minute_deg)
if hour_rad >= minute_rad :
    dif_rad = hour_rad - minute_rad
    if dif_rad > math.pi :
        dif_rad = 2*math.pi - dif_rad
    hari_cos = math.cos(dif_rad)
    x_2_jou = hour_hari*hour_hari + minute_hari*minute_hari \
              - 2*hour_hari*minute_hari*hari_cos
    print(math.sqrt(x_2_jou))
else :
    dif_rad = minute_rad - hour_rad
    if dif_rad > math.pi :
        dif_rad = 2*math.pi - dif_rad
    hari_cos = math.cos(dif_rad)
    x_2_jou = hour_hari * hour_hari + minute_hari * minute_hari \
              - 2 * hour_hari * minute_hari * hari_cos
    print(math.sqrt(x_2_jou))



Measured memory_bytes: 9548
(n,m,),*a=$<.map{|z|z.split.map &:to_i}
r=[*0..n]
s=[1]*-~n
c=s.dup
f=->x{x=r[x]=r[r[x]]while x!=r[x];x}
a.map{|u,v|x=f[u];y=f[v]
(m-=1)>=0&&x!=y&&[s[x]+=s[y],y=r[y]=x]
x==y&&[c[u]+=1,c[v]+=1]}
(1..n).map{|i|p s[f[i]]-c[i]}

Measured memory_bytes: 48764
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll long long
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=1e5+10;
const ll MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
vector<int>adj[MAX];
int coun(int x){
	return __builtin_popcount(x);
}
ll dp[MAX][3];
void dfs(int u , int par){
	dp[u][0]=1;
	dp[u][1]=1;
	ll b=1 , w=1;
	ll f=0;
	for(auto v:adj[u]){
		if(v!=par){
			dfs(v,u);
			f=1;
			w=(w*(dp[v][1]+dp[v][0]+MOD)+MOD)%MOD;
			b=(b*(dp[v][0])+MOD)%MOD; 
		}
	}
	if(f)
	{
		dp[u][0]=w%MOD;
		dp[u][1]=b%MOD;
	}

}
int main() 
{ 
	//ios_base::sync_with_stdio(false);
  //  cin.tie(NULL);	
//	#ifndef ONLINE_JUDGE
//	freopen("inp.txt" ,"r", stdin );
//	freopen("out.txt", "w", stdout);
//	#endif
	int n ;
	cin>>n;
	for(int i=0;i<n-1;i++){
		int x, y;
		cin>>x>>y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	dfs(1,-1);
	cout<<(dp[1][0]+dp[1][1])%MOD;
	
}

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

long long n, mod = 1e9+7, ans;
long long s, a[1000010];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	if(n == 1){
		cout << 1 << "\n";
		return 0;
	}
	a[0] = a[1] = a[2] = s = 1;
	for(int i=3; i<n; ++i){
		a[i] = a[i-1] + s;
		a[i] %= mod;
		s += a[i-2];
		s %= mod;
	}
	for(int i=1; i<n; ++i){
		long long t = a[i] * (n-1) % mod;
		if(i < n-1){
			t *= n-1;
			t %= mod;
		}
		ans += t;
		ans %= mod;
//		cout << i << " " << ans << "\n";
	}
	for(int i=0; i<=n-2; ++i){
		ans += (n-1) * a[i] % mod;
		ans %= mod;
	}
	ans += (1 + (n-1) * (n-1)) % mod;
	ans %= mod;
	cout << ans << "\n";
}

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

int main() {
	int a1, a2, a3; cin >> a1 >> a2 >> a3;

	if ((a1 + a2 + a3) >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long 
#define ULL unsigned long long 

const int N = 2e5+11;
const int M = 1e6+11;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const LL inff = 0x3f3f3f3f3f3f3f3f;


/*-----------------------------------------*/


int t[N],x[N],y[N];
int main(){
  	int n;scanf("%d",&n);
  	for(int i=1;i<=n;i++){ scanf("%d%d%d",&t[i],&x[i],&y[i]); }
	int X,Y; X=Y=0; 
	int flag=1;
	for(int i=1;i<=n;i++){
		int step=abs(x[i]-X)+abs(y[i]-Y); 
		int cha;
		//printf("%d\n",step);
		if(i==1) cha=t[i]-step;  
		else cha=(t[i]-t[i-1])-step; 
		
		if(cha<0) {
			flag=0;break;
		}
		if(cha%2==0){
			X=x[i]; Y=y[i];continue;
		}else {
			flag=0;
			break;
		}
	}
	
	if(flag) puts("Yes");
	else puts("No");
return 0;
}


Measured memory_bytes: 1408