akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

const int INF = 1001001001;

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

    int n, m;
    cin >> n >> m;
    vi cost(m), to(m);
    rep(i, m) {
        int b;
        cin >> cost[i] >> b;
        rep(j, b) {
            int c;
            cin >> c;
            c--;
            to[i] |= 1<<c;
        }
    }
    vi dp(1<<n, INF);
    dp[0] = 0;
    rep(bit, 1<<n) {
        rep(i, m) {
            chmin(dp[bit | to[i]], dp[bit] + cost[i]);
        }
    }
    cout << (dp[(1<<n)-1] == INF ? -1 : dp[(1<<n)-1]) << endl;
}


Measured memory_bytes: 256
import math
n = list(map(int, input().split()))
n = n[0]
v = list(map(int, input().split()))

for i in range(n):
    v.append(v[i])
    
total = sum(v[0:n])
    
temp = 0
odd1 = [0]
for i in range((n//2)):
    temp += 2*v[2*i]
    odd1.append(temp)
    
temp = 0
even1 = [0]
for i in range((n//2)):
    temp += 2*v[2*i+1]
    even1.append(temp)

temp = 0
odd2 = [0]
for i in range(n//2):
    ii = n//2 - i
    temp += 2*v[2*ii]    
    odd2.append(temp)
odd2.reverse()    

temp = 0
even2 = [0]
for i in range(n//2):
    ii = n//2 - 1 - i
    temp += 2*v[1 + 2*ii]    
    even2.append(temp)
even2.reverse()
    
#print([odd1,even1,odd2,even2])
#print(total)

ans=[]
for i in range(n):
    if(i%2)==0:
        ans.append(total-odd1[i//2]-even2[i//2])
        #print(odd1[i//2],even2[i//2])
    else:
        ans.append(total-even1[i//2]-odd2[i//2])
        #print(even1[i//2],odd2[i//2])

ansstr=str(ans[0])
for i in range(n-1):
    ansstr += ' ' + str(ans[i+1])

print(str(ansstr))

Measured memory_bytes: 24436
#include <stdio.h>
#include <stdlib.h>

int a[1000000];

int compare_int(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}

int main(void)
{
	int i;
	
	for (i = 0; i < 10; i++){
		scanf("%d", &a[i]);
	}
	
	qsort(a, 10, sizeof(int), compare_int);
	
	for (i = 0; i < 3; i++){
		printf("%d\n", a[i]);
	}
	
	return (0);
}

Measured memory_bytes: 604
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    int H, W; cin >> H >> W;
    vvi A(H, vi(W));
    REP(i, H)
        REP(j, W) cin >> A[i][j];

    vector<pii> from, to;
    REP(i, H) {
        REP(j, W) {
            if (j<W-1 && A[i][j] % 2 == 1) {
                A[i][j]--;
                from.push_back(pii(i, j));
                A[i][j + 1]++;
                to.push_back(pii(i, j + 1));                
            }
        }
        if (i<H-1 && A[i][W-1]%2==1) {
            A[i][W - 1]--;
            from.push_back(pii(i, W-1));
            A[i + 1][W - 1]++;
            to.push_back(pii(i + 1, W - 1));
        }
    }

    int N = from.size();
    cout << N << endl;
    REP(i,N) {
        cout << from[i].first+1 << " " << from[i].second+1  << " "
             << to[i].first+1 << " " << to[i].second+1 << endl;
    }

    return 0;
}

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

using namespace std;
#define lint long long


int main() {
    int N, H, W;
    cin >> N >> H >> W;
    
    lint A[N], B[N];
    
    for(int i = 0; i < N; ++i){
        cin >> A[i] >> B[i];
    }
    int cnt = 0;
    for(int i = 0; i < N; ++i){
        if(A[i] >= H && B[i] >= W){
            ++cnt;
        }
    }
    
    cout << cnt << endl;
}

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

using namespace std;

const int limit = 7369791;

int main()
{
  int M, N;
  bitset< limit + 1 > dp;
  while(cin >> M >> N, M) {
    dp.reset();
    for(int i = M; i <= limit; i++) {
      if(!dp[i]) {
        if(--N < 0) {
          cout << i << endl;
          break;
        }
        for(int j = i + i; j <= limit; j += i) dp[j] = true;
      }
    }
  }
}

Measured memory_bytes: 3912
from collections import defaultdict

N, P = map(int, input().split())
S = input().strip()[::-1]

if P in [2, 5]:
    ans = 0
    for r in range(N):
        if int(S[r]) % P == 0:
            ans += N - r
    print(ans)
    exit()

cum = [0] * (N + 1)
for i in range(N):
    now = int(S[i]) * pow(10, i, P)
    cum[i + 1] = (cum[i] + now) % P

cnt = defaultdict(int)
for _cum in cum:
    cnt[_cum] += 1

ans = 0
for k, v in cnt.items():
    ans += v * (v - 1) // 2

print(ans)


Measured memory_bytes: 11992
h,w = map(int,input().split())
h_0 = 0
ans = 0
if h == 1 or w == 1:
    ans = 1
else:
    if h % 2 == 0:
        h_0 = h/2
        h_1 = h - h_0
    else:
        h_0 = (h//2) + 1
        h_1 = h - h_0

    if w % 2 == 0:
        ans = h * (w/2)
    else:
        ans = h * (w//2) + h_0
print(int(ans))


Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>
#include <iostream>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
inline char nc()
{
    return getchar();
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x)
{
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f;
}
typedef long long ll;
ll S;
void solve()
{
    int x = 1e9;
    int y = (S + x - 1) / x;
    int a = 1;
    int b = (ll)x * y - S;
    printf("%d %d %d %d %d %d\n", 0, 0, a, y, x, b);
}
int main()
{
    read(S);
    solve();
    return 0;
}


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


int main(){
  long sum = 0;
  int N;
  cin >> N;


  map<int, int> numMap;

  for(int i=0; i < N; i++){
    int inputx;
    cin >> inputx;
    if(numMap.find(inputx) != numMap.end()){
      numMap[inputx] += 1;
    }
    else{
      numMap[inputx] = 1;
    }
    sum += inputx;
  }

  int Q;
  cin >> Q;
  for(int i=0; i< Q; i++){
    int b,c;
    cin >> b >> c;
    int bNum = numMap[b];
    if(numMap.find(c) != numMap.end()){
      numMap[c] += bNum;
    }
    else{
      numMap[c] = bNum;
    }
    numMap[b] = 0;

    sum += (c-b) * bNum;

    cout << sum << endl;
  }
}

Measured memory_bytes: 7988
#include<bits/stdc++.h>
using namespace std;
long long a,b,c;
int main()
{
	cin>>a>>b;
	for(int i=1;i<=b;i++)
	{
		if(a*i%b==0)
		{
			cout<<a*i;return 0;
		}
	}
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var A, B, K int
	fmt.Scanf("%d %d %d", &A, &B, &K)
	for i := 100; i >= 1; i-- {
		if A%i == 0 && B%i == 0 {
			K--
			if K == 0 {
				fmt.Println(i)
			}
		}
	}

}


Measured memory_bytes: 512
n,m=map(int,input().split())
l=[]
for s in range(n):
    a,b=map(int,input().split())
    l.append([a,b])

l=sorted(l,key=lambda x:x[0])
#print(l)
ans=0
for s in l:
#    print(s,m)
    if m>s[1]:
        ans+=s[0]*s[1]
        m-=s[1]
    else:
        ans+=s[0]*m
        break
print(ans)

Measured memory_bytes: 21976
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    string s, t;
    cin>>s>>t;
    
    
    vector<vector<int>> dp(s.length()+1, vector<int>(t.length()+1));
    
    for(int i = 0;i<=s.length();i++){
        for(int j = 0;j<=t.length();j++){
            if(i==0||j==0)dp[i][j] = 0;
            else if(s[i-1] == t[j-1]) dp[i][j] = dp[i-1][j-1] + 1;
            else {
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    
    
    int len = dp[s.length()][t.length()];
    char result[len+1];
    result[len] = '\0';
    
    int i = s.length();
    int j = t.length();
    
    int index = len-1;
    //cout<<"check"<<endl;
    while(i>0 && j>0){
        if(s[i-1] == t[j-1]){
            result[index] = s[i-1];
            i--;
            j--;
            index--;
        }
        else if(dp[i-1][j]>dp[i][j-1]){
            i--;
        }
        else j--;
    }
    
    cout<<result;
	return 0;
}

Measured memory_bytes: 35584
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar
#define putchar putchar
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

char s[100001];
int a[100001], A;
int bs(int x){
	int l=0, r=A-1;
	while(l<=r){
		int m=(l+r)/2;
		if(a[m]<=x) r=m-1; else l=m+1;
	}
	return l;
}
int main(void){
	int n=nextint();
	int m=nextint();
	nextstr(s);
	a[0]=n;
	A=1;
	for(int i=n-1; i>=0; i--){
		if(s[i]=='0'){
		int k=bs(i+m);
		if(k==A){
			puts("-1");
			return 0;
		}
		if(k+2>A) A=k+2;
		a[k+1]=i;
		}
	}
	for(int i=A-2; i>=0; i--){
		printf("%d ", a[i]-a[i+1]);
	}
	putchar(10);
}


Measured memory_bytes: 2008
//============================================================================
// Name        : Hello5.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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


int main() {
int n;
cin>>n;
string s;
cin>>s;
if (n%2==1){
	cout<<"No"<<endl;
	return 0;
}
string a=s.substr(0,n/2);
string b=s.substr(n/2);
if(a==b)
 cout<<"Yes"<<endl;
else cout<<"No"<<endl;

return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;

int N, x, d[200200];

signed main()
{
    cin >> N >> x;
    int M = (2 * N - 1) / 2 + 1;
    if(x == 1 || x == 2 * N - 1){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    for(int i = 1; i <= 2 * N - 1; i++){
        d[i] = i;
    }
    swap(d[x], d[M]);
    swap(d[1], d[M - 1]);
    swap(d[2 * N - 1], d[M + 1]);
    for(int i = 1; i <= 2 * N - 1; i++){
        printf("%d\n", d[i]);
    }

    return 0;
}
/*


*/


Measured memory_bytes: 2304
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int main() {
  int h, n;
  cin >> h >> n;
  ll sum = 0;

  bool yes = false;
  rep(i, n) {
    int a;
    cin >> a;
    sum += a;
    if (sum >= h) {
      yes = true;
      break;
    }
  }
  if (yes) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>


using namespace std;


int main() {


    int K;
    cin >> K;
    string S;
    cin >> S;
    int N = S.size();

    if (N <= K) {
        cout << S << endl;
    } else {
        cout << S.substr(0, K) + "..." << endl;
    }

    return 0;

}

Measured memory_bytes: 3604
import java.util.*;
public class Main{
	private static Scanner sc=new Scanner(System.in);
	public static void  main(String[]agrs){
		while(sc.hasNextDouble()){
			double j=sc.nextDouble();
			double t=j/9.8;
			double y=4.9*Math.pow(t,2);
			double N=(y+5)/5;
			int ans=(int) N;
			if(ans<N)System.out.println(ans+1);
			else System.out.println(ans);
		}   
	}
}

Measured memory_bytes: 18676
SP_list = []
N = int(input())

for i in range(N):
    items = input().split(' ')
    SP_list.append([i+1, items[0], int(items[1])])

SP_list.sort(key=lambda i:i[2], reverse=True)
SP_list.sort(key=lambda i:i[1])

for i in SP_list:
    print(i[0])

Measured memory_bytes: 8668
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
int main(){
    
	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    int x=n%10;
    if(x==2 || x==4 || x==5|| x==7 || x==9)
    	cout<<"hon\n";
    else if(x==0 || x==1 || x==6|| x==8)
    	cout<<"pon\n";
    else cout<<"bon\n";
	return 0;
}

Measured memory_bytes: 3652
#include<cstdint>
#include<limits>
#include<cstdbool>
#include<cmath>
#include<iostream>
#include<vector>
#include<array>
#include<list>
#include<string>
#include<sstream>
#include<algorithm>

int main(){
	int a,b,c,d;
	std::cin>>a>>b>>c>>d;
	bool flag=false;
	if(a == 4||a == 6||a == 9||a == 11){
		if(b == 30)
			flag =true;}
	else if(a == 2){
		if(b == 28)
			flag =true;}
	else{
		if(b == 31)
			flag =true;}
	std::cout<<(flag?1:0);

}


Measured memory_bytes: 256
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t N, A[(int)2e5];
    intmax_t ans[(int)2e5] = {};

    scanf("%jd", &N);
    for (size_t i = 0; i < (N - 1); i++) {
        scanf("%jd", &A[i]);
    }

    for (size_t i = 0; i < (N - 1); i++) {
        ans[A[i] - 1]++;
    }

    for (size_t i = 0; i < N; i++) {
        printf("%jd\n", ans[i]);
    }

    return 0;
}


Measured memory_bytes: 5276
import math
import itertools

n = int(input())
a = list(map(int, input().split()))
pf = [0]*(n+1)
pb = [0]*(n+1)
p = a[0]
for i in range(n):
  p = math.gcd(p, a[i])
  pf[i+1] = p
p = a[-1]
for i in range(-1, -n-1, -1):
  p = math.gcd(p, a[i])
  pb[i-1] = p
ans = [0]*n
for i in range(n):
  ans[i] = math.gcd(pf[i], pb[i+1])
print(max(ans))

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

using ll = long long;
using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(false)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YN(x)         cout << ((x) ? "YES" : "NO") << endl
#define Yn(x)         cout << ((x) ? "Yes" : "No") << endl
#define yn(x)         cout << ((x) ? "yes" : "no") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;

ll gcd(ll a, ll b) { return __gcd(a, b); }
ll lcm(ll a, ll b) { return (a == 0 || b == 0) ? 0 : (a / __gcd(a, b) * b); }

int main(int argc, const char* argv[]) {
	string s;
	cin >> s;

	if(s == "Sunny" ) cout << "Cloudy" << endl;
	if(s == "Cloudy") cout << "Rainy"  << endl;
	if(s == "Rainy" ) cout << "Sunny"  << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main implements Runnable{
    private HashMap<Integer, List<Integer>> graph;
    private int time;
    public static void main(String[] args) throws Exception {
        new Thread(null, new Main(), "bridge", 16 * 1024 * 1024).start();
    }

    @Override
    public void run() {
        Scanner scanner = new Scanner(System.in);
        int V = scanner.nextInt();
        int E = scanner.nextInt();

        graph = new HashMap<>(V);
        for(int i = 0; i < V; ++i){
            graph.put(i, new LinkedList<>());
        }

        for(int i = 0; i < E; ++i){
            int u = scanner.nextInt();
            int v = scanner.nextInt();

            graph.get(u).add(v);
            graph.get(v).add(u);
        }

        boolean[] visited = new boolean[V];
        int[] parent = new int[V];
        int[] disc = new int[V];
        int[] low = new int[V];
        List<int[]> bridges = new LinkedList<>();

        Arrays.fill(parent, -1);
        time = 0;

        for(int i = 0; i < V; ++i){
            if(!visited[i]){
                BridgeUtil(i, parent, disc, low, visited, bridges);
            }
        }

        Collections.sort(bridges, new Comparator<int[]>() {
            @Override
            public int compare(int[] a, int[] b) {
                if(a[0] != b[0]){
                    return a[0] - b[0];
                }
                else {
                    return a[1] - b[1];
                }
            }
        });

        for(int[] bridge : bridges){
            System.out.println(bridge[0] + " " + bridge[1]);
        }
    }
    
    private void BridgeUtil(int u, int[] parent, int[] disc, int[] low, boolean[] visited, List<int[]> bridges){
        if(visited[u]){
            return;
        }

        visited[u] = true;
        disc[u] = low[u] = ++time;

        for(Integer v : graph.get(u)){
            if(!visited[v]){
                parent[v] = u;
                BridgeUtil(v, parent, disc, low, visited, bridges);

                low[u] = Math.min(low[u], low[v]);

                if(low[v] > disc[u]){
                    int min = Math.min(u, v);
                    int max = Math.max(u, v);
                    bridges.add(new int[] {min, max});
                }
            }
            else if(v != parent[u]){
                low[u] = Math.min(low[u], disc[v]);
            }
        }
    }
}

Measured memory_bytes: 75120
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int H = scanner.nextInt(), W = scanner.nextInt();
			int h = scanner.nextInt(), w = scanner.nextInt();
			System.out.println((H - h) * (W - w));
		}
	}
}


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

ll a[55];

ll solve() {
    ll res = 0;
    while (true) {
        ll tr = -1;
        for (int i = 0; i < 50; i++) {
            tr = max(tr,a[i]);
        }
        if (tr < 50) break;
        res++;
        pair<ll,int> mx = {-1,-1};
        for (int i = 0; i < 50; i++) {
            mx = max(mx,{a[i],i});
        }
        for (int i = 0; i < 50; i++) {
            if (i != mx.second) a[i]++;
            else a[i] -= 50;
            assert(a[i] >= 0);
        }
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll k; cin >> k;
    ll d = k/50;
    ll r = k%50;
    for (int i = 0; i < 50; i++) {
        a[i] = d+i;
    }
    int i = 0;
    while (r--) {
        for (int j = 0; j < 50; j++) {
            if (j == i) a[j] += 50;
            else a[j]--;
        }
        i = (i+1)%50;
    }
    cout << 50 << '\n';
    for (int j = 0; j < 50; j++) {
        cout << a[j] << ' ';
    }
    cout << '\n';
    //assert(solve() == k);
}



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

using namespace std;

//DEFINE---{{{
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b); i > (a); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
//end.DEFINE---}}}

//end.template ---}}}

int main() {
  int N;

  cin >> N;

  if (N < 1000) {
    cout << "ABC" << endl;
    return (0);
  }
  else if (N > 999) {
    cout << "ABD" << endl;
    return (0);
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
//int p = 998244353;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2);
	x *= x; x %= p;
	if (n % 2 == 1) { x *= a; x %= p; }
	return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
	for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
	inv_kai = kai;
	rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
	int a = kai[n] * inv_kai[r]; a %= p;
	a *= inv_kai[n - r]; a %= p;
	return a;
}
int inf = 6000000000000;
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) {pa[x] = y;}
}
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
V<vvel> dp(2,vvel(15, vel(15, -1)));
veb can_use_f(15,false);
veb can_use_s(15,false);
int nan1 = 100;
int solve(int s, int t,int is_first) {//is_first=0 ha tebangasente to douti
	int x = is_first;
	if (dp[x][s][t] == -1) {
		int count_use = 0;
		veb can_use = can_use_f;
		if (is_first==1) { can_use = can_use_s; }
		for (int i = s + 1; i < t; i++) {
			if (can_use[i]) { count_use++; }
		}
		if (count_use == 7) { dp[x][s][t] = 1; }
		else if (t - s - 1 - count_use == 7) { dp[x][s][t] = 0; }
		else {
			if (!can_use[s] && !can_use[t]) {dp[x][s][t]=1-solve(s, t, 1-is_first);}
			if (s != 0) {
				if (can_use[s] && (solve(s - 1, t, 1-is_first) == 0)) { dp[x][s][t] = 1; }
			}
			if (t != 14) {
				if(can_use[t] && (solve(s, t + 1, 1-is_first) == 0)) { dp[x][s][t] = 1; }
			}
			if (dp[x][s][t] == -1) { dp[x][s][t] = 0; }
		}
	}
	return dp[x][s][t];
}
signed main(){
	int nanika; cin >> nanika;
	rep(ind, nanika) {
		dp= V<vvel>(2, vvel(15, vel(15, -1)));
		can_use_f = veb(15, false);
		can_use_s = can_use_f;
		rep(i, 6) {
			int x; cin >> x;
			can_use_f[x] = true;
		}
		for (int i = 1; i <= 13;i++) {
			can_use_s[i] = (!can_use_f[i]);
		}
		can_use_s[7] = false;
		if (solve(6,8,0)==1) {
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}
	return 0;
}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define REP(i,n) for(int i=0; i < (n); ++i)
#define SIZE(c) (int) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define ST first
#define ND second
#define FWD(i,a,b) for (int i=(a); i<(b); ++i)
#define BCK(i,a,b) for (int i=(a); i>(b); --i)
#define PI 3.14159265358979311600
#define pb push_back
#define mp make_pair
#define st first
#define nd second

using namespace std;

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

typedef vector < int > VI;
typedef vector<ll> VL;

typedef long double K;

#define int long long

const int N = 200005;
const int M = 1<<22;
const int inf = 1e18;

int n, v, cnt, bound;
int a[N], f[M], g[M];
int goLeft[23][N], goRight[23][N];
vector<int> b;

struct SegTree {
	int n;
	vector<int> tree;

	SegTree(int n): n(n), tree(4*n, inf) {}

	void update(int pos, int val) {
		update(1, 0, n - 1, pos, val);
	}

	int go(int l, int r) {
		return go(1, 0, n - 1, l, r);
	}

	void update(int v, int tl, int tr, int pos, int val) {
		if (tl == tr) {
			tree[v] = min(tree[v], val);
			return;
		}
		int tm = (tl + tr) / 2;
		if (pos <= tm) {
			update(2*v, tl, tm, pos, val); 
		} else {	
			update(2*v+1, tm+1, tr, pos, val);
		}
		tree[v] = min(tree[2*v], tree[2*v+1]);
	}

	int go(int v, int tl, int tr, int l, int r) {
		if (l > tr || r < tl) return inf;
		if (l <= tl && r >= tr) return tree[v];
		int tm = (tl + tr) / 2;
		return min(go(2*v, tl, tm, l, r), go(2*v+1, tm+1, tr, l, r));
	}
};

void calc() {
	REP(i, cnt) {
		REP(j, n) {
			goLeft[i][j] = j;
			if (j > 0 && a[j] - a[j - 1] <= b[i]) {
				goLeft[i][j] = goLeft[i][j - 1];
			}
		}
		for (int j = n - 1; j >= 0; --j) {
			goRight[i][j] = j;
			if (j < n - 1 && a[j + 1] - a[j] <= b[i]) {
				goRight[i][j] = goRight[i][j + 1];
			}
		}
	}
}

int go(int pos, int x, int side) {
	if (side < 0) {
		return goLeft[x][pos];
	} 
	return goRight[x][pos];
}

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

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

	sort(a, a + n);

	while (v > 0) {
		b.push_back(v);
		v /= 2;
	}

	b.push_back(0);
	cnt = (int)b.size();
	bound = (1 << cnt);

	calc();

	REP(i, bound) f[i] = 0, g[i] = n - 1;

	REP(i, bound) {
		REP(j, cnt) if (~i & (1 << j)) {
			f[i ^ (1 << j)] = max(f[i ^ (1 << j)], min(go(f[i], j, +1) + 1, n - 1));
			g[i ^ (1 << j)] = min(g[i ^ (1 << j)], max(go(g[i], j, -1) - 1, 0LL));
		}
	}

	int all = 0;

	SegTree tree(n);

	REP(mask, bound) {
		int comp = (bound - 1) ^ mask;
		int a = (mask & 1) ? (mask ^ 1) : mask;
		int b = (comp & 1) ? (comp ^ 1) : comp;
		if (f[a] > g[b]) {
			all = 1;
			break;
		}
		tree.update(f[a], g[b]);
	}

	REP(i, n) {
		if (all) {
			cout << "Possible\n";
			continue;
		}
		int lb = go(i, 0, -1);
		int rb = go(i, 0, +1);
		if (tree.go(lb, rb) <= rb) {
			cout << "Possible\n";
		} else {
			cout << "Impossible\n";
		}
	}

	return 0;
}

Measured memory_bytes: 86016
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int N, Q; cin >> N >> Q;
  string S; cin >> S;
  vi l(Q), r(Q); rep(i,Q) cin >> l.at(i) >> r.at(i);

  vi sum(N+1,0);

  //ACが出る可能性があるのは2文字目から(0-indexedで1から)
  repf(i,1,N) {
    sum.at(i+1) = sum.at(i);
    if(S.at(i-1) == 'A' && S.at(i) == 'C') {
      sum.at(i+1)++;
    }
  }

  //0 1 2 3 4 5 6
	// A C A C A C
	// 1 2 3 4 5 6

  rep(i,Q) {
    int ans = sum.at(r.at(i)) - sum.at(l.at(i));
    cout << ans << endl;
  }
}

Measured memory_bytes: 2176
a,b,c = map(int, input().split( ))

a2,b2,c2 = a,b,c
cnt = 0
while True:
    if a2%2 or b2%2 or c2%2:
        print(cnt)
        exit()
    else:
        a = (b2+c2)//2
        b = (c2+a2)//2
        c = (a2+b2)//2
        
        cnt += 1
        if {a,b,c}=={a2,b2,c2}:
            print(-1)
            exit()
        a2 = a
        b2 = b
        c2 = c

Measured memory_bytes: 38256
from collections import deque
n = int(input())
a = list(map(int,input().split()))
b = deque([])
for i in range(n):
    if i%2==0:
        b.appendleft(a[i])
    else:
        b.append(a[i])
else:
    if n%2==0:
        b = list(b)
        b = b[::-1]
print(*b)

Measured memory_bytes: 25412
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=998244353;

ll mod_pow(ll x,ll n){
    x%=MOD;
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n/=2;
    }
    return res;
}

void add(ll &a,ll b){
    a=(a+b)%MOD;
}

void mul(ll &a,ll b){
    a=a*b%MOD;
}

int N;
vector<ll> X;


int main(){
  cin>>N;
  X.resize(N);
  rep(i,N) cin>>X[i];

  ll ans=0;
  for(int i=0;i<N;i++){
      ll res=0;
      res=mod_pow(X[i]+1,i);
      mul(res,X[i]);
      mul(res,mod_pow(2ll,N-(i+1)));
      add(ans,res);
  }

  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 10372
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1;
const ll inf=2*hell;
const ld PI = 3.1415926535897932384626433832795, eps = 1e-8;
inline ll mult(ll x,ll y){return (x*y)%hell;}
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll powMod(ll base,ll expo){
	ll ans=1;
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base);
		expo>>=1;
	}
	return ans;
}
inline ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
void solve(){
	string s;
	cin>>s;
	ll n=sz(s), f=1, ans=0, mod=2019;
	vector<ll> v(n+5,0);
	map<ll,ll> mapa;
	mapa[0]=1;
	for(ll i=n-1;i>=0;i--){
		v[i+1]=(((s[i]-'0')*f)%mod+v[i+2])%mod;
		f=(f*10)%2019;
		ans+=mapa[v[i+1]];
		mapa[v[i+1]]++;
	}
	cout<<ans;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 //  	cin>>t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 5060
"""
強連結成分分解（Kosarju）
グラフ g, 逆辺グラフ rg の強連結成分分解をする

gp[i] = 頂点 i が属するグループ番号
g_scc: sccされたグラフ（辺はsetでとっていることに注意）
   g_scc は,N-1,N-2,..の順で見るとDAGになる
"""
def StrongConnectedComponent(g,rg):
    S = [] #帰りがけが遅い順にpopされるスタック
    #まず逆辺でDFS、帰りがけに S に積む
    q = []
    n = len(g)
    gp = [0]*n # -1なら使用済
    for i in range(n):
        if not gp[i]:
            gp[i] = -1
            q.append(i)
            while q:
                v = q.pop()
                if v >= 0:
                    q.append(-v-1)
                    for c in rg[v]:
                        if not gp[c]: 
                            gp[c] = -1
                            q.append(c)
                else:
                    S.append(-v-1)
    # Sのpop順にDFS
    #この段階で gp = [-1]*n（使いまわす）
    g_scc = []
    cnt = 0
    while S:
        v = S.pop()
        if gp[v] == -1:
            q.append(v)
            #gp[v] = v
            gp[v] = cnt
            sv = set()
            while q:
                w = q.pop()
                for c in g[w]:
                    if gp[c] == -1:
                        q.append(c)
                        gp[c] = gp[w]
                    else:
                        if gp[c] != cnt:
                            sv.add(gp[c])
            cnt += 1
            g_scc.append(sv)

    return gp, g_scc

###########################################################################                        
# AOJ GRL_3_C
# http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4130328#1
###########################################################################                        

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,*w = [int(i) for i in read().split()]

n,m = [int(i) for i in readline().split()]

g = [[] for _ in range(n)]
rg = [[] for _ in range(n)]
for _ in range(m):
    a,b = [int(i) for i in readline().split()]
    g[a].append(b)
    rg[b].append(a)

gp, scc = StrongConnectedComponent(g,rg)
q = int(readline())
for _ in range(q):
    a,b = [int(i) for i in readline().split()]
    if gp[a] == gp[b]: print(1)
    else: print(0)








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

int main(){
  int n;
  int min,max;
  long sum;
  sum = 0;
  cin >> n;
  cin.ignore();
  int a[n];
  for(int i = 0;i <n;i++){
    cin >> a[i];
    sum = sum + a[i];
    if(i == 0){
      min = a[i];
      max = a[i];
    }else{
      if(min > a[i]){
	min = a[i];
      }
      if(max < a[i]){
	max = a[i];
      }
    }
  }
  cout << min << " " << max << " " << sum << endl;
  return 0;
}



Measured memory_bytes: 3104
let () = Scanf.scanf "%d\n" @@ fun n ->
  let aa = Array.init n @@ fun _ -> Scanf.scanf " %d" (fun e -> e - 1) in
  let bb = Array.init n @@ fun _ -> Scanf.scanf " %d" Fun.id in
  let cc = Array.init (n - 1) @@ fun _ -> Scanf.scanf " %d" Fun.id in
  let ans = ref 0 in
  for i = 0 to n - 1 do
    if i = 0 then ans := !ans + bb.(aa.(i))
    else if aa.(i) = aa.(i - 1) + 1 then ans := !ans + bb.(aa.(i)) + cc.(aa.(i - 1))
    else ans := !ans + bb.(aa.(i))
  done;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;
ll inv[10000100];
ll FactorialInv[10000100];
ll Factorial[10000100];

ll mymod(ll a,ll b){
    a%=MOD;
    ll result=1;
    while(b>0){
        if(b&1){
            result=(result*a)%MOD;
        }
        a=(a*a)%MOD;
        b>>=1;
    }
    return result;
    
}
ll modInverse(ll n){
    return mymod(n,MOD-2);
}

void init_combination(){
    const int MAX = 10000002;   //1e6+2
    Factorial[0]=1;
    inv[0]=1;
    for(int i=1;i<=MAX;i++){
        Factorial[i]=(Factorial[i-1]*i)%MOD;
    }
    FactorialInv[MAX]=modInverse(Factorial[MAX]);
    for(int i=MAX-1;i>=0;i--){
        FactorialInv[i]=FactorialInv[i+1]*(i+1)%MOD;
    }
    for(int i=1;i<=MAX;i++){
        inv[i]=(FactorialInv[i]*FactorialInv[i-1])%MOD;
    }
}

ll combination(ll n,ll k){
    if(n==k||k==0){
        return 1;
    }
    if(n<k){
        return 0;
    }
    ll ans=(Factorial[n]*FactorialInv[k])%MOD;
    ans=(ans*FactorialInv[n-k])%MOD;
    return ans;
}



int main(){
    ll N,K;
    cin>>N>>K;
    vl A(N);
    F0R(i,N){
        cin>>A[i];
    }
    sort(all(A));
    ll count=0;
    init_combination();
    for(int i=K-1;i<N;i++){
        count+=((combination(i,K-1)*A[i]));
        count%=MOD;
    }
    //cout<<count<<endl;
    for(int i=0;i<N-K+1;i++){
        count-=((combination(N-i-1,K-1)*A[i]));
        count%=MOD;
        count+=MOD;
        count%=MOD;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 235392
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for (int i = 0; i < T; i++) {
			int N = sc.nextInt();
			Main main = new Main();
			List<Number> a = new ArrayList<Number>();
			List<Number> b = new ArrayList<Number>();
			for (int j = 0; j < N; j++) {
				Number temp = main.new Number();
				temp.K = sc.nextInt();
				temp.L = sc.nextLong();
				temp.R = sc.nextLong();
				temp.sa = Math.abs(temp.L - temp.R);
				if (temp.L > temp.R) {
					temp.b = true;
					a.add(temp);
				} else {
					temp.b = false;
					b.add(temp);
				}
			}
			Collections.sort(a);
			Collections.sort(b);
			long sum = 0;
			TreeSet<Integer> set = new TreeSet<Integer>();
			for (int j=1;j<=N;j++) {
				set.add(j);
			}
			for (int j = a.size()-1; j >=0 ; j--) {
				Number temp = a.get(j);
				int k = temp.K;
				if (k>a.size()) {
					k = a.size();
				}
				sum +=temp.R;
				Integer e=set.floor(k);
				if (e!=null) {
					sum +=temp.sa;
					set.remove(e);
				}
			}
			for (int j = b.size()-1; j >=0 ; j--) {
				Number temp = b.get(j);
				int k = temp.K + 1;
				if (k<= a.size()) {
					k =  a.size()+1;
				}
				sum +=temp.L;
				Integer e=set.ceiling(k);
				if (e!=null) {
					sum +=temp.sa;
					set.remove(e);
				}
			}
			System.out.println(sum);
		}
	}

	public class Number implements Comparable<Number> {
		int K;
		long L;
		long R;
		long sa;
		boolean b;

		@Override
		public int compareTo(Number o) {
			if (this.sa > o.sa) {
				return 1;
			} else if (this.sa == o.sa ) {
				return 0;
			}
			return -1;
		}
	}
}

Measured memory_bytes: 78140
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits>
#include <numeric>
#include <cmath>

using namespace std;

template<class T>
class Input {
public:
    auto operator()() const {
        T v;
        cin >> v;
        return v;
    }
};

template<class L, class R>
class Input<pair<L, R>> {
public:
    auto operator()() const {
        L l;
        R r;
        cin >> l >> r;
        return make_pair(l, r);
    }
};

template<class U>
class Input<vector<U>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        return (*this)(n);
    }
    auto operator()(size_t n) const {
        vector<U> v;
        v.reserve(n);
        Input<U> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in();
            v.emplace_back(move(u));
        }
        return v;
    }
};

template<class U>
class Input<vector<vector<U>>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        auto m = in();
        return (*this)(n, m);
    }
    auto operator()(size_t n, size_t m) const {
        vector<vector<U>> v;
        v.reserve(n);
        Input<vector<U>> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in(m);
            v.emplace_back(move(u));
        }
        return v;
    }
};

class InputType
{
public:
    template<class T>
    operator T() const {
        Input<T> i{};
        return i();
    }
};

class InputType2
{
public:
    InputType2(size_t n)
        : n_(n)
    {}
    template<class T>
    operator T() const {
        Input<T> i{};
        return i(n_);
    }
private:
    size_t n_;
};

auto input() {
    return InputType();
}

template<class... Args>
auto input(Args&&... args) {
    return InputType2(std::forward<Args>(args)...);
}

size_t bitcount(size_t n) {
    size_t c = 0;
    while (n) {
        if (n & 1ull)
            ++c;
        n >>= 1;
    }
    return c;
}

auto make_order(size_t n) {
    vector<size_t> a(n, 0);
    iota(begin(a), end(a), 0);
    return a;
}

template<class T>
auto next_permutation(T&& x) {
    using std::begin;
    using std::end;
    return next_permutation(begin(x), end(x));
}

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

auto gcd(size_t l, size_t r) {
    if (r == 0)
        return l;
    return gcd(r, l % r);
}

auto gcd(size_t a, size_t b, size_t c) {
    return gcd(a, gcd(b, c));
}

constexpr const double pi = 3.14159265358979323846264338327950288;

int main() {
    double a = input();
    double b = input();
    double h = input();
    double m = input();
    auto min = 60.0 * h + m;
    auto hr = min / (12.0 * 60.0);
    auto mr = m / 60.0;
    auto xa = a * cos(2.0 * pi * hr);
    auto ya = a * sin(2.0 * pi * hr);
    auto xb = b * cos(2.0 * pi * mr);
    auto yb = b * sin(2.0 * pi * mr);
    auto x = xa - xb;
    auto y = ya - yb;
    printf("%.10f", hypot(x, y));
    return 0;
}


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

int main()
{
    int x,y,z;
    cin>>x>>y;
    //cout<<x<<" "<<y;

    if((x==1 && y==2) || (x==2 && y==1)){
        cout<<"3\n";
    }
    else if((x==1 && y==3) || (x==3 && y==1)){
        cout<<"2\n";
    }
    else if((x==3 && y==2) || (x==2 && y==3)){
        cout<<"1\n";
    }




    return 0;
}


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

vector<int> divisor(int n) {
  vector<int> ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  // sort(begin(ret), end(ret));
  return (ret);
}

int count(vector<int>& a, int n) {
  auto itr_1 = lower_bound(a.begin(), a.end(), n);
  auto itr_2 = upper_bound(a.begin(), a.end(), n);
  return itr_2 - itr_1;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int ans = 0;
  sort(a.begin(), a.end());
  rep(i, n) {
    vector<int> divs = divisor(a[i]);
    // printf("divs: %d, size → %d\n", a[i], divs.size());
    vector<int> divs_in;
    for(auto d : divs) {
      int cnt = count(a, d);
      if(d == a[i] && cnt == 1) continue;
      if(cnt > 0) {
        divs_in.push_back(d);
      };
    }
    if(divs_in.size() == 0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4044
#include<iostream>
using namespace std;
int main(int argc, char const *argv[]) {
    int a,b;
    cin >> a >> b;
    int tou[1000];
    int sum=0;
    for(int i=1;i<1000;i++){
        sum += i;
        tou[i] = sum;
    }
    
    cout << tou[b-a-1] - a << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    int n;cin >> n;
    vector<LL> a(n);
    LL s = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s ^= a[i];
    }
    for (int i = 0; i < n; i++) {
        cout << (a[i] ^ s) << (i + 1 == n ? "\n" : " ");
    }
    return 0;
}


Measured memory_bytes: 4740
N = int(input())
As = [int(n) for n in input().split()]

vals = {}
for A in As:
    if A in vals:
        vals[A] += 1
    else:
        vals[A] = 1

#print(vals)

choose2 = {}
for val in vals:
    num = vals[val]
    choose2[val] = num*(num - 1) // 2

#print(choose2)

total = 0
for k in choose2:
    total += choose2[k]
#print("total: " + str(total))

for Ak in As:
    print(total - (vals[Ak] - 1))


Measured memory_bytes: 32512
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            d = C[i][k] + C[k][j]
            if d < C[i][j]:
                C[i][j] = d

ans = 0
cost = [C[i][1] for i in range(10)]

for _ in range(H):
    for n in map(int, input().split()):
        if n == -1:
            continue
        ans += cost[n]

print(ans)


Measured memory_bytes: 3064
// A.cpp

#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
	bool flag;
	cin >> s;
	if (s.size() % 2 == 1) {
		cout << "No" << endl;
		return 0;
	}
	string st;
	for (int i = 0; i != s.size(); i += 2) {
		st += "hi";
	}
	if (s == st) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool f1,f2;
string s;
int w;
int main()
{
	cin>>s;
	while(w<s.size() && s[w]!='C') w++;
	if(s[w]=='C') f1=1;
	while(w<s.size() && s[w]!='F') w++;
	if(s[w]=='F') f2=1;
	if(f1 && f2) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

typedef long long int ll;
using namespace std;

ll calc(ll num){
  ll ret = 0;
  while(num!=0){
    ll cnt = __builtin_popcount(num);
    num %= cnt;
    ret++;
  }
  return ret;
}
int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  string s;std::cin >> s;
  ll cnt = 0;

  // mod = cnt + 1 or cnt -1
  for(int i=0;i<n;i++) if(s[i]=='1') cnt++;
  ll l = cnt - 1, r = cnt + 1;
  if(cnt==1) l = 1;
  vector<ll> ans(n, -1);
  //(2) no 2^x mod
  vector<ll> L(n, 1%l), R(n, 1%r);
  for(int i=1;i<n;i++) L[i] = (L[i-1]*2)%l, R[i] = (R[i-1]*2)%r;
  // l or r no x no mod
  ll y = 0, z = 0;

  for(int i=0;i<n;i++){
    if(s[n-1-i]=='1'){
      y = (y + L[i])%l;
      z = (z + R[i])%r;
    }
  }
  ll only = -1;
  for(int i=0;i<n;i++){
    if(only==-1&&s[i]=='1') only = i;
    else if(only>=0&&s[i]=='1') only = -2;
  }

  if(only>=0) ans[only] = 0;

  for(int i=0;i<n;i++){
    if(ans[i]!=-1) continue;
    ll num = 0;
    if(s[i]=='1'){
      num = y;
      num = (num - L[n-1-i] + l)%l;
    }else{
      num = z;
      num = (num + R[n-1-i])%r;
    }
    ll ret = 1 + calc(num);
    ans[i] = ret;
  }
  for(int i=0;i<n;i++) std::cout << ans[i] << '\n';
  return 0;
}


Measured memory_bytes: 7712