akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>
#include<atcoder/convolution.hpp>

using namespace std;
//using namespace atcoder;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int n,m;cin>>n>>m;
  vector<long long> a(n);
  vector<long long> b(m);
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];
  vector<long long> c;
  c=atcoder::convolution(a,b);
  rep(i,n+m-1){
    cout<<c[i]<<" ";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 27272
def main():
    a, b, c = map(int, input().split())
    k = int(input())
    for i in range(k):
        if a >= b:
            b *= 2
            continue
        elif b >= c:
            c *= 2
    if a < b and b < c:
        print("Yes")
    else:
        print("No")


main()


Measured memory_bytes: 9172
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#define VIZ2 {printf("graph G{\n"); for(int i=1;i<=n;i++) for es(i,e) if(vb[e]>=i)printf("%d--%d;\n",i,vb[e]); puts("}");}
#define SZ 666666
int n,k,a[SZ]; ll ans=1e18;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	for(int i=0;i<(1<<n);i++)
	{
		int cnt=0;
		for(int j=0;j<n;j++) cnt+=bool(i&(1<<j));
		if(cnt!=k) continue;
		int ls=-1; ll cst=0;
		for(int j=0;j<n;j++)
		{
			if(i&(1<<j));else
			{
				ls=max(ls,a[j]);
				continue;
			}
			int nx=max(a[j],ls+1);
			cst+=nx-a[j];ls=nx;
		}
		ans=min(ans,cst);
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair {
	int first;
	int second;

	Pair(int first, int second) {
		this.first = first;
		this.second = second;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		int arr[] = new int[5];
		for (int i = 0; i < 5; i++) {
			arr[i] = in.nextInt();
			if (arr[i] == 0) {
				pw.println(i + 1);
			}
		}

	}

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

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 32948
S = input()
Q = int(input())
QL = [input().split() for _ in range(Q)]

h = ''
t = ''
reverse = False

for q in QL:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            if reverse:
                t = '{}{}'.format(t, q[2])
            else:
                h = '{}{}'.format(q[2], h)
        else:
            if reverse:
                h = '{}{}'.format(q[2], h)
            else:
                t = '{}{}'.format(t, q[2])

s = '{}{}{}'.format(h, S, t)
if reverse:
    print(s[::-1])
else:
    print(s)


Measured memory_bytes: 40672
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};



//#define int ll
signed main(){
    int n,ans=0;
    cin>>n;
    repe(i,1,n){
        int x=8;
        if(i%2==0)continue;
        repe(j,1,n){
            if(i%j==0)x--;
        }
        if(x==0)ans++;
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
from bisect import bisect_left

INF = 10**18


def calc(data, p, q):

    ret = INF
    for k in data.keys():
        for i in range(len(data[k][p])):
            now = data[k][p][i]
            j = bisect_left(data[k][q], now)

            if j < len(data[k][q]):
                next = data[k][q][j]
                ret = min(ret, (next - now) * 10)

    return ret


def main():

    N = int(input())

    X = defaultdict(lambda: [[] for _ in range(4)])
    Y = defaultdict(lambda: [[] for _ in range(4)])
    XY_plus = defaultdict(lambda: [[] for _ in range(4)])
    XY_minus = defaultdict(lambda: [[] for _ in range(4)])
    URDL = ['U', 'R', 'D', 'L']

    for i in range(N):
        x, y, u = input().split()
        x, y = int(x), int(y)
        u = URDL.index(u)

        X[y][u].append(x)
        Y[x][u].append(y)
        XY_plus[x + y][u].append(x)
        XY_minus[x - y][u].append(x)

    for s in (X, Y, XY_plus, XY_minus):
        for k in s.keys():
            for i in range(4):
                s[k][i].sort()

    ans = INF
    ans = min(ans, calc(X, 1, 3) // 2)
    ans = min(ans, calc(Y, 0, 2) // 2)
    ans = min(ans, calc(XY_plus, 1, 0))
    ans = min(ans, calc(XY_plus, 2, 3))
    ans = min(ans, calc(XY_minus, 1, 2))
    ans = min(ans, calc(XY_minus, 0, 3))

    if ans >= 5000000:
        print('SAFE')
    else:
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 276236
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; cin >> n;
	int cnt[13] = {};
	rep(i, n) {
		int d; cin >> d; cnt[d]++;
	}
	bool f = true;
	vector<int> v; v.push_back(0);
	rep(i, 13) {
		rep(j, cnt[i]) {
			if (f)v.push_back(i);
			else v.push_back(24 - i);
			f = !f;
		}
	}
	int len = v.size();
	int out = 30;
	rep(i, len) {
		Rep(j, i + 1, len) {
			int t = abs(v[i] - v[j]);
			t = min(t, 24 - t);
			out = min(out, t);
		}
	}
	cout << out << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
import math
ans = 0
for k in range(1, int(math.sqrt(N) + 1)):
    # print(k - 1, N // k - 1)
    m = N // k - 1
    if m != 0:
        if N % k == 0 and N // m == N % m:
            ans += m

print(ans)


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

int X, Y, Z;
int main() {
    std::cin >> X >> Y >> Z;

    int ans = X / (Y+Z);
    int res = X % (Y+Z);
    if(res < Z) {
        --ans;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;
char s1[3005], s2[3005];
int dp[3005][3005];
char sol[3005];

int main()
{
    int n1, n2, i, j, x;
    cin >> s1 + 1;
    cin >> s2 + 1;
    n1 = strlen (s1 + 1);
    n2 = strlen (s2 + 1);
    for (i = 1; i <= n1; i++)
        for (j = 1; j <= n2; j++)
        {
            if (s1[i] == s2[j])
                dp[i][j] = max(dp[i][j - 1] , max(dp[i - 1][j], dp[i - 1][j - 1] + 1));
            else
                dp[i][j] = max(dp[i][j - 1] , max(dp[i - 1][j], dp[i - 1][j - 1] ));
        }
    x = dp[n1][n2];
    i = n1;
    j = n2;
    while (x)
    {
        if (s1[i] == s2[j])
        {
            sol[x] = s1[i];
            i--;
            j--;
            x--;
        }
        else
        {
            if (dp[i][j - 1] > dp[i - 1][j])
                j--;
            else
                i--;
        }

    }
    for (i = 1; i <= dp[n1][n2]; i++)
        cout << sol[i];
    
    return 0;
}


Measured memory_bytes: 35456
#include <stdio.h>
int main(void)
{
 
 char str[5];
  scanf("%s",str);
  if(strcmp(str,"A")==0)
    printf("T");
  if(strcmp(str,"T")==0)
    printf("A");
  if(strcmp(str,"G")==0)
    printf("C");
  if(strcmp(str,"C")==0)
    printf("G");

  return 0;
}

Measured memory_bytes: 128
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    use std::collections::HashMap;
    let mut map: HashMap<usize, Vec<usize>> = HashMap::new();
    for _ in 0..N {
        let v: usize = read();
        let entry = map.entry(v).or_insert(vec![]);
        entry.push(v);
    }
    let mut ans = 0;
    for (key, value) in map {
        if key == value.len() {
            continue;
        } else if key < value.len() {
            ans += value.len() - key;
        } else {
            ans += value.len();
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 16016
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Char (digitToInt)

main :: IO ()
main = do
  [x,y] <- getl words
  unless (x == "0" && y == "0") $ do
    putStrLn . unwords . map show $ solve x y
    main
    
solve :: String -> String -> [Int]
solve x y = [h, length (intersect qs as) - h]
  where
    f = map digitToInt
    hit xs ys = sum $ zipWith (\a b -> if a == b then 1 else 0) xs ys
    qs = f x
    as = f y
    h = hit qs as
      
getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 3992
// Author: Mrigank
// Science is what we understand well enough to explain to a computer, Art is everything else we do - Donald E. Knuth
#include <bits/stdc++.h>
#include <iostream>
#include <unordered_map>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <string> 
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, int> PLI;
typedef pair<int, int> PII;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < pair < ll , ll > > vpl;
typedef vector < pair < ll , bool > > vpb;
typedef vector < vector < int > > vvi;
typedef vector < vector < ll > > vvl;


#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x , val) memset(x , val , sizeof(x))
#define deb1(x) cout << x << endl
#define deb2(x , y) cout << x << " " << y << endl
#define deb3(x , y , z) cout << x << " " << y << " " << z << endl
#define all(x) x.begin() , x.end()
#define alls(x , y) x.begin() , x.end() , y
#define fastIO                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);


const ll mxsize = 5e6 + 5;
const ll linf = 1e9;
const ld inf = 10000000000.0;
const ll mod = 1e9 + 7;
 
/******************************************** CODE STARTS FROM HERE *************************************************/ 

int main()
{
    ll n;
    cin >> n;
    ll i , j , k;
    ll sum = 0;
    Fo(i , 1 , n + 1)
    {
        Fo(j , 1 , n + 1)
        {
            Fo(k , 1 , n + 1)
            {
                sum += __gcd(i , __gcd(j , k));
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		long ans = 0;
		
		for(int i=1; i<=N; i++) {
			long num = N/i;
			ans += i*(num+1)*(num)/2;
		}
		
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 27208
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// conversion
#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) (INT((x).size()))
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
const ll MOD = 1e9 + 7;
// const int INF = 1<<25;
// const ll INF = 1LL<<50;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;

#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------

VL factdp(200010, 0);

// n! mod MODを計算
ll fact(ll n) {
  if (factdp[n] > 0) {
    return factdp[n];
  }

  factdp[n] = fact(n - 1) * n % MOD;
  return factdp[n];
}

// 繰り返し二乗法でn^timesを計算
ll powMOD(ll n, ll times) {
  if (times == 1) {
    return n % MOD;
  }

  if (times % 2 > 0) {
    return powMOD(n, times - 1) * n % MOD;
  } else {
    return powMOD(n * n % MOD, times / 2);
  }
}

// factの逆元を計算
ll invfact(ll n) {
  return powMOD(fact(n), MOD - 2);
}

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

  factdp[0] = 1;

  ll H, W, A, B;
  cin >> H >> W >> A >> B;

  fact(50000);

  ll sum = 0;
  for (ll i = 0; i < W - B; i++) {
    // 図を書けば分かる
    ll former = fact(B + H - A - 1 + i) * invfact(B + i) % MOD * invfact(H - A - 1) % MOD;
    ll later = fact(A + W - B - 2 - i) * invfact(W - B - 1 - i) % MOD * invfact(A - 1) % MOD;
    sum += former * later % MOD;
    sum %= MOD;
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 5248
#include<stdio.h>
int main()
{
    int d, l, r, i, count=0;
    scanf("%d %d %d", &l, &r, &d);
    for(i=l; i<=r; i++)
    {
        if(i%d==0) count++;
        else continue;
    }
    printf("%d\n", count);


    return 0;
}


Measured memory_bytes: 1676
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, k;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    if (k == 1) {
        cout << "0\n";
        return 0;
    }
    int tmp = n - k;
    cout << tmp << "\n";
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
 		Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int [][] input = new int[n][3];
      	for(int i = 0; i < n; i++){ 
          input[i] = new int[3];
          for(int j = 0; j < 3; j++)
          input[i][j] = scan.nextInt();
        }
      	scan.close();
      	System.out.println(solve( input));
	}
  
  	private static int solve(int[][] input){
    	if(input.length == 0) return 0;
        int[][] memo = new int[input.length][3];
        memo[0] = input[0];
        for(int i = 1; i < input.length; i++){
          memo[i] = new int[3];
          memo[i][0] = Math.max(memo[i-1][1], memo[i-1][2]) + input[i][0];
          memo[i][1] = Math.max(memo[i-1][0], memo[i-1][2]) + input[i][1];
          memo[i][2] = Math.max(memo[i-1][0], memo[i-1][1]) + input[i][2];
          
        }
      	int n = input.length - 1;
        return Math.max(memo[n][0], Math.max(memo[n][1], memo[n][2]));
  	}
}

Measured memory_bytes: 104520
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);
const int mx=500001;
int bit[26][mx];
void update(int type,int index,int value){
    for(;index<mx;index+=(index&(-index))){
        bit[type][index]+=value;
    }
}
int get(int type,int index){
    int ans=0;
    for(;index>0;index-=(index&(-index))){
        ans+=bit[type][index];
    }
    return ans;
}

void solve() {
    int n;cin>>n;
    string s;cin>>s;
    for(int i=0;i<n;i++){
        int type=s[i]-'a';
        update(type,i+1,1);
    }
    int q;cin>>q;
    for(int i=0;i<q;i++){
        int t;cin>>t;
        if(t==1){
            int index;cin>>index;
            char c;cin>>c;
            int ogtype=s[index-1]-'a';
            s[index-1]=c;
            update(ogtype,index,-1);
            update(c-'a',index,1);
        } else{
            int ans=0;
            int l,r;cin>>l>>r;
            for(int j=0;j<26;j++){
                int temp=get(j,r)-get(j,l-1);
                if(temp>0)ans++;
            }
            cout<<ans<<endl;
        }
    }
}

int32_t main() {
    IOS;
    int test = 1;
    //cin >> test;
    while (test--) {
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N, K, Q;
    ll k = 0;
    vector<ll> A;
    cin >> N >> K >> Q;
    A.resize(N, K - Q);
    for(ll i = 0;i < Q;i++) {
        ll temp;
        cin >> temp;
        A[temp - 1]++;
    }
    for(auto &i: A) {
        if(i > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e3 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll x;
    cin >> x;
    for (ll i = -N; i <= N; i++)
        for (ll j = -N; j <= N; j++)
            if (i * i * i * i * i - j * j * j * j * j == x)
                return cout << i << ' ' << j, 0;
}

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

long long a, n, sum=0;

int main(){
	cin >> a >> n;
	for (int i=0;i<n;i++){
		long long b;
		cin >> b;
		sum+=b;
	}
	if (sum>=a) cout << "Yes" << "\n";
	else cout << "No\n"; 
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
typedef pair<int,int> P;
int a[1000001] = {0};
int main(){
  priority_queue<P>que;
  int n,q;
  cin >> n >> q;
  que.push(P(0,0));
  for(int i = 0 ; i < q ; i++ ){
    int num,fish;
    cin >> num >> fish;
    a[num] += fish;
    que.push(P(a[num],-num));
    P top = que.top();
    while( top.first != a[-top.second]  ){
      que.pop();
      top = que.top();
    }
    cout << -top.second << " " << top.first << endl;
  } 
}

Measured memory_bytes: 6008
#include<iostream>
#include<queue>
using namespace std;
char a[22][22];
int n,m;
struct pos{
	int x;
	int y;
	int step;
};
pos make_pos(int a,int b,int c){
	pos ret;
	ret.x=a;
	ret.y=b;
	ret.step=c;
	return ret;
}

int bfs(int sx,int sy,int ex,int ey){
	bool vis[n+2][m+2];
	for(int i=0;i<=n+1;++i)
		for(int j=0;j<=m+1;++j)
			if(a[i][j]=='#')
				vis[i][j]=true;
			else
				vis[i][j]=false;
	queue<pos> q;
	q.push(make_pos(sx,sy,0));
	vis[sx][sy]=true;
	int move[2][4]={{0,0,-1,1},{-1,1,0,0}};
	while(!q.empty()){
		pos fr=q.front();
		q.pop();
		if(fr.x==ex&&fr.y==ey)
			return fr.step;
		pos newpo;
		for(int i=0;i<4;++i){
			int nx=fr.x+move[0][i];
			int ny=fr.y+move[1][i];
			if(vis[nx][ny])
				continue;
			vis[nx][ny]=true;
			newpo=make_pos(nx,ny,fr.step+1);
			q.push(newpo);
		}
	}
	return 0;
}
int main(){
	for(int i=0;i<22;++i)
		for(int j=0;j<22;++j)
			a[i][j]='#';
	cin>>n>>m;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			cin>>a[i][j];
	int maxv=0;
	for(int i1=1;i1<=n;++i1)
		for(int j1=1;j1<=m;++j1){
			if(a[i1][j1]=='#')
				continue;
			for(int i2=1;i2<=n;++i2)
				for(int j2=1;j2<=m;++j2){
					if(a[i2][j2]=='#')
						continue;
					if(i1==i2&&j1==j2)
						continue;
					
					maxv=max(maxv,bfs(i1,j1,i2,j2));
				}
		}
	
	cout<<maxv<<endl;
	return 0;
}

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

count = 0
out = 0
for _ in range(N):
  a, b = map(int, input().split())
  if a == b:
    count += 1
  else:
    count = 0
  if count >= 3:
    out = 1
    break

if out == 1:
  print("Yes")
else:
  print("No")
    

Measured memory_bytes: 62484
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
     if(i==N-1){
      cout << A[i] << endl;
      break;
    }
    cout << A[i] << " ";
  }
  for(int i=1;i<=N-1;i++){
    int v=A[i];
    int j=i-1;
     while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
      A[j+1]=v;
     }
    for(int i=0;i<N;i++){
      if(i==N-1){
      cout << A[i] << endl;
      break;
    }
    cout << A[i] << " ";
    }
  }
}


Measured memory_bytes: 3052
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
#include <math.h>
#include <queue>
 
using namespace std;
 
int main(){
 
    int from,to,table[101] = {0};
    bool FLG;
 
    while(scanf("%d %d",&from,&to) != EOF){
        if(from == 0 && to == 0){
            if(table[1]%2 == 1 && table[2] %2 == 1){
                FLG = true;
                for(int i = 3; i <= 100; i++){
                    if(table[i] % 2 == 1){
                        FLG = false;
                        break;
                    }
                }
                if(FLG)printf("OK\n");
                else{
                    printf("NG\n");
                }
            }else{
                printf("NG\n");
            }
            for(int i = 0; i < 101;i++)table[i] = 0;
            continue;
        }else{
            table[from]++;
            table[to]++;
        }
    }
 
 
    return 0;
}




Measured memory_bytes: 3112
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
ll pars[200100], part[200100];
string s, t;
vector<ll> S[30], T[30];
int main(void){
    // Your code here!
    cin >> s >> t;
    for (ll i = 0; i < s.length(); i++){
        S[s[i] - 'a'].push_back(i);
    }
    for (ll i = 0; i < t.length(); i++){
        T[t[i] - 'a'].push_back(i);
    }
    for (ll i = 0; i < 26; i++){
        for (ll j = 0; j < S[i].size(); j++){
            pars[S[i][j]] = S[i][0];
        }
        for (ll j = 0; j < T[i].size(); j++){
            part[T[i][j]] = T[i][0];
        }
    }
    bool ans = true;
    for (ll i = 0; i < s.length(); i++){
        if (pars[i] != part[i]) ans = false;
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 8308
N, M = map(int, input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]

for i in range(N - M + 1):  # tate
    for j in range(N - M + 1):  # yoko
        ans = 1
        for k in range(M):
            if B[k] != A[i + k][j:j+M]:
                ans = 0
        if ans == 1:
            print('Yes')
            exit()
print('No')


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

#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
int main(void){
    
    int a, b, c;
    cin >> a >> b >> c;
    
    cout << abs(MAX(a, MAX(b, c)) - MIN(a, MIN(b, c))) << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e11;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i,s.length()){
        if (s[i] - 'A' + n >= 26){
            s[i] = s[i] + n - 26;
        }
        else{
            s[i] = s[i] + n;
        }
    }
    PRINT(s);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

//verified AOJ GRL_1
#define MAX_V 10000
struct edge{int to,cost;};

void dijkstra(int s, vector<int> &d, vector<edge> G[MAX_V]){
	priority_queue< pii,vector<pii>,greater<pii> > que;
	rep( i,d.size() )d[i]=INF;
	d[s] = 0;
	que.push( pii(0,s) );
	
	while( que.size() ){
		pii p=que.top();
		que.pop();
		
		int v=p.second;
		if(d[v]<p.first)continue;
		
		rep(i,G[v].size()){
			edge e=G[v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(pii(d[e.to],e.to));
			}
		}
	}
}

//??¨?????´??? verified AOJ GRL_5_A

pii dfs(int prev, int v, const vector<edge> graph[MAX_V]){   //searching farthest node
	pii r(0,v);
	
	rep(i,graph[v].size()){
		struct edge e = graph[v][i];
		if(e.to == prev) continue;
		pii tmp = dfs(v,e.to,graph);
		tmp.first += e.cost;
		if(r.first < tmp.first) r = tmp;
	}
	return r;
}


pii diameter( const vector<edge> graph[MAX_V] ) {
	pii r = dfs(-1, 0, graph);
	pii t = dfs(-1, r.second, graph);
	return pii(r.second,t.second);
}

int main(){
	int v;
	cin>>v;

	vector<edge> G[MAX_V];
	rep(i,v-1){
		int s,t,c;
		cin>>s>>t>>c;
		G[s].pb({t,c});
		G[t].pb({s,c});
	}
	pii res = diameter(G);
	
	vector<int> d1(MAX_V),d2(MAX_V);
	dijkstra(res.first ,d1,G);
	dijkstra(res.second,d2,G);
	
	
	rep(i,v){
		cout<<max(d1[i],d2[i])<<endl;
	}
}

Measured memory_bytes: 4712
//
//  main.cpp
//  temp
//
//  Created by tolemy on 2019/08/04.
//  Copyright © 2019 tolemy. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>

using namespace std;

int main(int argc, const char * argv[]) {
    
    
    int n = 0;
    cin >> n;
    
    int *a = new int[n];
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    
    double answer = 0;
    for(int i=0;i<n;i++)
    {
        answer += 1/(double)a[i];
    }
    
    answer = 1/answer;
    
    cout << fixed;
    cout << setprecision(5) << answer << endl;
    
    return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let s = read::<String>();
    let date = vec!["SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"];
    for i in 0..date.len() {
        if s == date[i] {
            println!("{}", i + 1);
        }
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

void operation(vector<int> &a) {
    vector<int> b(a.size(), 0);
    for (int i = 0; i < (long long)a.size(); i++) {
        int start = i - a[i];
        int end = i + a[i] + 1;
        if (start < 0) start = 0;
        b[start]++;
        if (end < (long long)a.size()) b[end]--;
    }

    for (int i = 1; i < (long long)a.size(); i++) {
        b[i] += b[i - 1];
    }

    a = b;
}

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    for (int i = 0; i < k; i++) {
        operation(a);
        if (a == vector<int>(n, n)) break;
    }

    for (auto &&ai : a) {
        cout << ai << " ";
    }
    cout << endl;
}


Measured memory_bytes: 6352
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
void solve()
{
  int n,i;cin>>n;
  ll A[n],SS[n+1];SS[n]=0;
  fo(i,0,n)cin>>A[i];
  for(i=n-1;i>=0;i--)SS[i]=(SS[i+1]+A[i])%MOD7;
  
  ll ans=0;
  fo(i,0,n)
  {
      ll a=(A[i]*SS[i+1])%MOD7;
      if(a<0)a+=MOD7;
      ans=(ans+a)%MOD7;
  }
  cout<<ans<<"\n";
  
}
int main()
{
   fastio
   //Test_cases
   solve();
  return 0;
}
//**always check if you are not killing input in between
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//string2=string1.substr(pos,length);if len no specified then till end
//void fill (ForwardIterator first, ForwardIterator last, const T& val);
//The range filled is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.


//If wrong on pretest 2 means logically wrong
/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 6740
#include <bits/stdc++.h>
#include <stdio.h>
#include <cmath>
#include <tgmath.h>

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {
    int n,m;
    cin>>n>>m;

    cout<<(n*(n-1)/2)+(m*(m-1))/2<<endl;


}


Measured memory_bytes: 256
N, K = [int(i.strip()) for i in input().split(' ')]
MOD = 10 **9 + 7
count = 0
for i in range(K,N+2):
    MIN = i * (i-1)/2
    MAX = N * i -MIN
    c = MAX -MIN + 1
    count += int(c)

print(count%MOD)

Measured memory_bytes: 9192
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>
#include<cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 998244353;


int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 ios_base::sync_with_stdio(false);
 cin.tie(NULL);

 int n;
 cin>>n;
 vector<int> A(n+1, 0);
 for(int i = 1;i <= n;i++) {
   int j = i;
   while(j <= n) {
     A[j] += 1;
     j += i;
   }
 }

 ll ans = 0;
 for(int i = 1;i <= n;i++) {
   ans += (1LL*i)*A[i];
 }
 cout << ans << endl;

 return 0;
}


Measured memory_bytes: 42264
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define inf 1000000000000000000
#define ff first
#define ss second
void checkpoint1()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif*/
}
int main()
{
	checkpoint1();
	ll n;
	cin>>n;
	ll a[n];
	ll x=0;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		x^=a[i];
	}
	for(ll i=0;i<n;i++)
		cout<<(x^a[i])<<" ";
	return 0;
}

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

typedef long long ll;
typedef pair <int , int> pii;

const int N = 2e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   char c;
   cin >> c;
   if(c >= 'a' && c <= 'z')
      cout << "a";
   else
      cout << "A";
   return 0;
}


Measured memory_bytes: 3596
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	setp(10);
	ld r;
	cin >> r;
	co(2 * r * PI);
	return 0;
}


Measured memory_bytes: 3788
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

void Show(vector<vector<int>> Ns) {
	for (int i = 0; i < Ns.size(); i++) {
		for (int j = 0; j < Ns[i].size(); j++) {
			if (j == Ns[i].size() - 1) {
				cout << Ns[i][j] << endl;
			} else {
				cout << Ns[i][j] << ",";
			}
		}
	}
}

void Show(vector<int> N) {
	for (int i = 0; i < N.size(); i++) {
		cout << N[i];
		if (i != N.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


int main() {
	int N;
	cin >> N;
	vector<int> As;
	As.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> As[i];
	}
	int answer = 0;
	while (true) {
		for (int i = 0; i < N; i++) {
			if (As[i] % 2 != 0) {
				cout << answer << endl;
				return 0;
			}
			As[i] /= 2;
		}
		answer++;
	}
}

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

int selectionSort(int* A, int n){
	int cnt = 0;
	for(int i=0; i<n; i++){
		int minj = i;
		for(int j=i; j<n; j++){
			if(A[j] < A[minj]){
				minj = j;
			}
		}
		if(i != minj){
			cnt++;
			swap( A[i], A[minj] );
		}
	}
	return cnt;
}
int main(){
	int n;
	cin >> n;
	
	int A[100];
	for(int i=0; i<n; i++) cin >> A[i];
	
	int cnt = selectionSort(A, n);
	
	cout << A[0];
	for(int i=1; i<n; i++) cout << " " << A[i];
	cout << "\n" << cnt << endl;
	return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

#define Pair pair<int,int>
#define List pair<int, Pair>


int N, M;

int P[100010];
int Y[100010];
int ID[100010];
vector<List> lst;

bool compare(List x, List y){
	if(x.second.first == y.second.first){
		return x.second.second < y.second.second;
	}else{
		return x.second.first < y.second.first;
	}
}

int solve(){
	sort(lst.begin(), lst.end(), compare);
	int current=1;
	int count=0;
	for(int i=0; i<M; i++){
		if(current != lst[i].second.first) count=1;
		else count++;
		ID[lst[i].first] = count;
		current = lst[i].second.first;
	}

	for(int i=0;i<M;i++){
		printf("%06d%06d\n", P[i], ID[i]);
	}
	return 0;
}


int main(){
	cin >> N >> M;
	for(int i=0;i<M;i++){
		cin >> P[i] >> Y[i];
		lst.push_back({i,{P[i],Y[i]}});
	}
	solve();
	return 0;
}

Measured memory_bytes: 3956
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
#define int long long
struct Edge {
  int a, b, s, t, cost;
  Edge() {}
  Edge(int a_, int b_, int s_, int t_, int cost_) : a(a_), b(b_), s(s_), t(t_), cost(cost_) {}
};
struct State {
  int v, t, cost;
  State(int v_, int t_, int cost_) : v(v_), t(t_), cost(cost_) {}
  bool operator >(const State &other) const {
    return cost > other.cost;
  }
};
signed main() {
  int N, M, S, T; cin >> N >> M >> S >> T;
  S--, T--;
  vector<Edge> E(M);
  REP(i,M) {
    cin >> E[i].a >> E[i].b >> E[i].s >> E[i].t;
    E[i].a--;
    E[i].b--;
    E[i].t += E[i].s;
    E[i].cost = 0;
  }
  vector<vector<int>> TIME(N);
  TIME[S].push_back(0);
  REP(i,M) {
    TIME[E[i].a].push_back(E[i].s);
    TIME[E[i].b].push_back(E[i].t);
  }
  vector<map<int, vector<Edge>>> G(N);
  REP(i,N) {
    sort(TIME[i].begin(), TIME[i].end());
    REP(j,(int)TIME[i].size()-1) {
      if(TIME[i][j] != TIME[i][j+1]) {
        G[i][TIME[i][j]].emplace_back(i, i, TIME[i][j], TIME[i][j+1], TIME[i][j+1] - TIME[i][j]);
      }
    }
  }
  REP(i,M) {
    G[E[i].a][E[i].s].push_back(E[i]);
  }
  //REP(i,N) {
  //  for(const pair<int, vector<Edge>> &pp : G[i]) {
  //    for(const Edge &e : pp.second) {
  //      cerr << e.a << " => " << e.b << " (" << e.s << "," << e.t << ") C=" << e.cost << endl;
  //    }
  //  }
  //}
  vector<map<int, int>> D(N);
  priority_queue<State, vector<State>, greater<State>> Q;
  Q.emplace(S, 0, 0);
  D[S][0] = 0;
  while(!Q.empty()) {
    State s = Q.top(); Q.pop();
    if(D[s.v].count(s.t) && s.cost > D[s.v][s.t]) continue;
    for(const Edge &e : G[s.v][s.t]) {
      if((D[e.b].count(e.t) == 0) || (D[e.b][e.t] > s.cost + e.cost)) {
        D[e.b][e.t] = s.cost + e.cost;
        Q.emplace(e.b, e.t, D[e.b][e.t]);
      }
    }
  }
  int ans = (int)1e18;
  for(pair<int, int> iter : D[T]) {
    ans = min(ans, iter.second);
  }
  cout << ans << endl;
}

Measured memory_bytes: 105508
#include<bits/stdc++.h>
using namespace std;
bool b[15][1005];
int main()
{
    int h,w,m;
    cin>>h>>w>>m;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            char c;
            cin>>c;
            if(c=='1')
                b[i][j]=1;
            else b[i][j]=0;
        }
    }
    int ans=1e9;
    for(int k=0;k<(1<<h);k+=2)
    {
        vector<int> v;
        {
            for(int i=1;i<h;i++)
            {
                if((1<<i)&k)
                    v.push_back(i);
            }
        }

        v.push_back(h);
        int vs=v.size();
        vector<int> cnt;
        for(int i=0;i<vs;i++)
        {
            cnt.push_back(0);
        }
        int tmp=0;
        int prev=0;
        set<int> s;
        bool flag=1;
        for(int i=1;i<=w;i++)
        {
            int now=0;
            for(int j=1;j<=h;j++)
            {
                int cnt2=0;
                if(b[j][i])
                    cnt[now]++;
                if(cnt[now]>m)
                {
                    for(int l=0;l<cnt.size();l++)
                        cnt[l]=0;
                    if(s.count(i)) flag=0;
                    s.insert(i);
                    i--;
                    //cout<<"CUT"<<i<<'\n';
                    tmp++;
                    break;
                }
                if(v[now]==j)
                    now++;
                assert(now<=vs);
            }
            if(tmp+v.size()-1>=ans)
                break;
            if(!flag) break;
        }
        if(!flag) continue;
        //cout<<tmp<<' '<<v.size()<<'\n';
        ans=min(ans,tmp+(int)v.size()-1);
    }
    cout<<ans<<'\n';
}


Measured memory_bytes: 256
import math
n=int(input())
n1=n
b=int(math.sqrt(n))+1

phai=1

if n!=1:
    for i in range(2,b):
        i_count=0
        while n%i==0:
            i_count+=1
            n=n//i
        if i_count!=0:
            phai=phai*(1-1/i)

    if n!=0 and n!=1:
        phai=phai*(1-1/n)

    phai=phai*n1
    if phai-int(phai)>0.8:
        phai=int(phai)+1
    else:
        phai=int(phai)
else:
    phai=0
print(phai)



Measured memory_bytes: 5668
#include<bits/stdc++.h>
using namespace std;
double a,b,x;
int main(){
    scanf("%lf%lf%lf",&a,&b,&x);
    double y,z;
    if (a*a*b>=2*x){
        y=a*b*b/2.0/x;
        z=atan(y);
    }else {
        y=2.0*(b-x/(a*a));
        z=atan(y/a);
    }
  //  printf("%.2f %.2f",y,z);
    printf("%.8f\n",z*double(45.0)/atan(1));
    return 0;
}

Measured memory_bytes: 256