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

int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    for (int i=0; i<n; i++){
        cin >> vec.at(i);
    }
    reverse(vec.begin(), vec.end());
    for (int i=0; i<n; i++){
        cout << vec.at(i);
        if (i==n-1) {cout << endl;}
        else {cout << " ";}
    }
}


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

#define ll long long
#define pll pair<ll,ll>
#define all(x) x.begin(), x.end()

#define MAX 1000005

ll d[MAX];

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

	ll n;
	cin >> n;

	for(int i=1;i<MAX;i++)
	{
		for(int j=i;j<MAX;j+=i)
		{
			d[j]++;
		}
	}

	ll ans = 0;
	for(int c=1;c<n;c++)
	{
		ll N = n-c;

		ans+= d[N];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 11468
/*
    AUTHOR : TANMAY SINHA
    INORMATION TECHNOLOGY
    BIT MESRA ,RANCHI
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define rep(i,L,R) for(i=L;i<R;i++)
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll pow1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}
const ll INF = 1e18l+10,N = 1e5+10,MAX = 500500;
#define sq(X) ((X)*(X))

int main()
{
    ll h,n,i;
    cin>>h>>n;
    ll a;
    ll s=0;
    for(i = 0;i<n;i++)
    {
        cin>>a;
        s+=a;
    }
    if(s>=h)
    cout<<"Yes\n";
    else
    {
        cout<<"No\n";
    }
    
}

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

int main() {
  string s;
  string result="";
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s.at(i)!='B')result.push_back(s.at(i));
    else if(s.at(i)=='B' && result.size()!=0)result.pop_back();
  }
  cout<<result<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
i64 n;

int main() {
  cin >> n;
  i64 ba = 0, a = 0, b = 0;
  i64 ans = 0;
  for(int i = 0;i < n;i++) {
    string s;
    cin >> s;
    for(int j = 0;j < s.size() - 1;j++) {
      if(s[j] == 'A' && s[j + 1] == 'B') ans++;
    }
    if(s.front() == 'B' && s.back() == 'A') ba++;
    else if(s.front() == 'B') b++;
    else if(s.back() == 'A') a++;
  }
  if(a == 0 && ba > 0) {
    a++;
    ba--;
  }
  if(a > 0) {
    a--;
    ans += ba;
    ba = 0;
    if(b > 0) {
      ans++;
      b--;
    }
    ans += min(a, b);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*
author: shah_entrance
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll temp,flag=0;
    map<ll,ll>m1;
    for(int i=0;i<6;i++){
        cin>>temp;
        m1[temp]+=1;
    }
    for(int i=1;i<=4;i++){
        if(m1[i]<1 || m1[i]==3){
            flag=1;
            break;
        }
    }
    if(flag==1)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


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

public class Main {
	private static void solve(){
		//Implement solution here.
		int n = ni();
		int len = Integer.toString(n).length();
		int result = 0;
		
		result = dfs(1, 3, n) + dfs(1, 5, n) + dfs(1, 7, n);
		
		System.out.println(result);
	}
	
	private static int dfs(int dig, int cur, int max) {
		int result = 0;	
		if(dig >= 3) {
			if(dig <= Integer.toString(max).length()) {
				if(cur <= max) {
					if(is753(cur))result++;
				} else {
					return 0;
				}
			} else {
				return 0;
			}
		}	
		dig++;
		result += dfs(dig, cur * 10 + 3, max) + dfs(dig, cur * 10 + 5, max) + dfs(dig, cur * 10 + 7, max);
		return result;
	}

	private static boolean is753(int in) {
		boolean[] flags = new boolean[3];
		char[] inca = Integer.toString(in).toCharArray();
		for(char c:inca) {
			if(c == '3')flags[0] = true;
			if(c == '5')flags[1] = true;
			if(c == '7')flags[2] = true;
		}
		
		return flags[0] && flags[1] && flags[2];
	}
	//Switch input source (stdin/file)
	private static Scanner scanner = new Scanner(System.in);
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath)))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(scanner.nextLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 31168
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
char a[10][10];
long long int n, m, k;
long long num=0, ans=0;
int used[10] = { 0 };
void dfs(int r, int c, int sum)//行 列 涂去的黑色
{
	int add = 0;
	if (r == n && c == m)
	{
		if (num - sum == k)
			ans++;
		return;
	}
	if (r == n)
	{
		for (int i = 0; i < n; i++)
		{
			if (a[i][c] == '#' && (!used[i]))
			{
				add++;
			}
		}
		dfs(r, c + 1, sum + add);
		dfs(r, c + 1, sum);
	}
	else
	{
		for (int i = 0; i < m; i++)
		{
			if (a[r][i] == '#')
			{
				add++;
			}
		}
		used[r] = 1;
		dfs(r + 1, c, sum + add);
		used[r] = 0;
		dfs(r + 1, c, sum);
	}
	
}
int main()
{
	cin >> n >> m >> k;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if (a[i][j] == '#')
				num++;
		}
	}
	dfs(0, 0, 0);
	cout << ans << endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N];
  map<int, int> table;

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

  for(int i=0; i<N; i++){
    cout << table[i] << ' ';
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 5504
n,a,b = map(int,input().split(" "))
res = []
for i in range(1,n + 1):
    string = str(i)
    string = list(string)
    string = list(map(int,string))
    t = 0
    for j in string:
        t += j
    if a <= t <= b:
        res.append(i)

total = 0
for i in res:
    total += i
print(total)
        

Measured memory_bytes: 3552
from collections import OrderedDict
n = int(input())
a = list(map(int, input().split()))

key_value = {}
for i in range(1, n + 1):
	key_value[i] = a[i-1]
sorted_key_value = OrderedDict(sorted(key_value.items(), key=lambda x:x[1]))
stu_num_order = list(sorted_key_value.keys())
print(*stu_num_order)

Measured memory_bytes: 109352
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>

using namespace std;

vector<vector<int>> road={{}};
vector<int> dp={0};
int ans=0;

int dfs(int x){
    if(dp[x])return dp[x];

    for(int i=0; i<road[x].size(); i++){
        dp[x]=max(dfs(road[x][i])+1,dp[x]);
    }
    if(ans<dp[x])ans=dp[x];
    return dp[x];
}


int main(){
    int N,M;
    cin >> N >> M;
    
    for(int i=0; i<N-1; i++){
        road.push_back({});
        dp.push_back(0);
    }

    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        road[a].push_back(b);
    }
    for(int i=0; i<N; i++){
        dfs(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 8208
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define dpr(x) cerr<<#x<<": "<<x<<endl;
#define dprc(c) do{cerr<<#c<<":";for(auto&_i:(c)){cerr<<" "<<_i;}cerr<<endl;}while(0)
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int INF = 1e9+7;
#define all(c) begin(c), end(c)
#define tr(i,c) for(auto i=begin(c);i!=end(c);i++)
#define rtr(i,c) for(auto i=(c).rbegin();i!=(c).rend();i++)
#define rep(i,b) for(auto i=0;i<(b);i++)
#define pb push_back
#define sz(c) int((c).size())

void dump(vi& A) {
  string sp = "";
  for (auto& x:A) {
    cout << sp << x;
    sp = " ";
  }
  cout << endl;
}

void insertionSort(vi& A, int N) {
  for (int i = 1; i < N; 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;
    dump(A);
  }
}

int main(int argc, char **argv)
{
  vi A;
  int n;
  cin >> n;
  A = vi(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  dump(A);
  insertionSort(A, n);
  return 0;
}

Measured memory_bytes: 3124
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, L: "List[int]", R: "List[int]"):
    print(max(0, min(R)-max(L)+1))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]"
    R = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
    solve(N, M, L, R)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10868
N = int(input())
S = input()
R = 0
G = 0
B = 0
nsum = 0
for s in S:
    if s == "R":
        R += 1
    elif s == "G":
        G += 1
    else:
        B += 1
count = 0
for i in range(N):
    for k in range(i+1,N):
        if not S[i] == S[k]:
            if 2*k - i <= N - 1:
                if S[i] != S[2*k - i] and S[k] != S[2*k - i]:
                    count += 1
print(R*G*B - count)

Measured memory_bytes: 68112
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
  int a,b;
  char op;
  cin >> a >> op >> b;
  while(op!='?'){
    int c;
    if(op=='+') c=a+b;
    if(op=='-') c=a-b;
    if(op=='*') c=a*b;
    if(op=='/') c=a/b;
    cout << c << endl;
    cin >> a >> op >> b;
  }
  return 0;
}



Measured memory_bytes: 3080
import numpy as np
import math
A, B, C, D = [int(i) for i in input().split()]
 
large = np.max([C, D])
small = np.min([C, D])
 
while small != 0:
    large, small = small, large % small
gcd = large

large = np.max([C, D])
small = np.min([C, D])

lcm = C * D // gcd
 
num_B_1 = B // C
num_B_2 = B // D
num_B_3 = B // lcm
 
num_A_1 = (A-1) // C
num_A_2 = (A-1) // D
num_A_3 = (A-1) // lcm
 
numB = num_B_1 + num_B_2 - num_B_3
numA = num_A_1 + num_A_2 - num_A_3
 
print((B-A+1) - (numB - numA))

Measured memory_bytes: 12512
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int> 


int main(){
  ll A, B, C, D; cin >> A >> B >> C >> D;
  
  ll cntB = B - B/C - B/D + B/(C*D/__gcd(C,D));
  ll cntA = A-1 - (A-1)/C - (A-1)/D + (A-1)/(C*D/__gcd(C,D));
  ll cnt = cntB - cntA;




  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N, M, A, B;
    scanf("%d%d", &N, &M);

    int H[N], L[N];
    for(int i = 0; i < N; i++){
        scanf("%d", &H[i]);
        L[i] = 1;
    }

    for(int i = 0; i < M; i++){
        scanf("%d%d", &A, &B);
        if(H[A-1] == H[B-1])
            L[A-1] = L[B-1] = 0;
        else if(H[A-1] < H[B-1])
            L[A-1] = 0;
        else
            L[B-1] = 0;
    }

    int cnt = 0;
    for(int i = 0; i < N; i++){
        if(L[i] == 1)
            cnt++;
    }
    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 2508
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
vector<vector<int>> a(100010);
map<P,int> m;
vector<int> ans(100010,-1);
void dfs(int x){
  for(auto au:a[x]){
    if(ans[au]!=-1)continue;
    ans[au]=(m[P(x,au)]%2?!ans[x]:ans[x]);
    dfs(au);
  }
}
int main(){
  int n;cin>>n;
  rep(i,n-1){
    int x,y,z;
    cin>>x>>y>>z;
    x--,y--;
    a[x].push_back(y);
    a[y].push_back(x);
    m[P(x,y)]=z;
    m[P(y,x)]=z;
  }
  ans[0]=0;
  dfs(0);
  rep(i,n){
    cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 23168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int main() {
  int n;
  cin>>n;
  int d[100005];
  for (int i=0; i<n; i++) {
    cin>>d[i];
  }
  sort(d,d+n);
  
  cout<<d[n/2]-d[n/2-1]<<endl;
  return 0;
}



Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>

char A[105],B[105],C[105];
int dp[105][2],d,c,i,j,a,b;
const int M=1000000007;
int main()
{
	for(;scanf("%s%s%s",A,B,C),A[0]!='0';)
	{
		memset(dp,0,sizeof(dp));
		dp[strlen(A)][0]=1;
		for(d=strlen(A)-1;d>=0;d--)
			for(c=0;c<2;c++)
			{
				if(A[d]=='?')
				{
					for(a=d==0?1:0;a<=9;a++)
						if(B[d]=='?')
						{
							for(b=d==0?1:0;b<=9;b++)
							{
								if(C[d]=='?'||C[d]-'0'==(a+b+c)%10)
									dp[d][a+b+c>9?1:0]=(dp[d][a+b+c>9?1:0]+dp[d+1][c])%M;
							}
						}
						else
						{
							b=B[d]-'0';
							if(C[d]=='?'||C[d]-'0'==(a+b+c)%10)
								dp[d][a+b+c>9?1:0]=(dp[d][a+b+c>9?1:0]+dp[d+1][c])%M;
						}
				}
				else
				{
					a=A[d]-'0';
					if(B[d]=='?')
					{
						for(b=d==0?1:0;b<=9;b++)
						{
							if(C[d]=='?'||C[d]-'0'==(a+b+c)%10)
								dp[d][a+b+c>9?1:0]=(dp[d][a+b+c>9?1:0]+dp[d+1][c])%M;
						}
					}
					else
					{
						b=B[d]-'0';
						if(C[d]=='?'||C[d]-'0'==(a+b+c)%10)
							dp[d][a+b+c>9?1:0]=(dp[d][a+b+c>9?1:0]+dp[d+1][c])%M;
					}
				}
			}
		printf("%d\n",dp[0][0]);
	}
	return 0;
}

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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

 			var inputArray = retreiveLongArray();
			var inputCount = 3;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			long M = inputArray[1];
			long Q = inputArray[2];


			var infoList = new List<long[]>();

			for (int i = 0; i < Q; i++) {
				var list = retreiveLongArray();
				infoList.Add(list);
			}


			var nums = Enumerable.Repeat(1, (int)N).ToArray(); 
			

			long max = 0;
			max = DFS(infoList,nums, 0,max,M);

			//答えの出力
			var ans = max;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// DFS
		/// </summary>
		/// <param name="infoList"></param>
		/// <param name="array">A=長さNの整数列</param>
		/// <param name="position"></param>
		/// <param name="max"></param>
		/// <param name="M"></param>
		/// <returns></returns>
		private static long DFS(List<long[]> infoList, int[] array, int position, long max, long M) {

			//一番深いところを調べている場合、採点して返す
			if (position == array.Length - 1) {
				var calc = saiten(infoList, array);
				max = max < calc ? calc : max;
				return max;
			}

			//それ以外の場合、自分より一つ深い階層をループで調べる
			for (int i = array[position]; i <= M; i++) {
				var newArray = array.Select(x => x).ToArray();//参照渡しにならないように
				newArray[position + 1] = i;
				var calc = DFS(infoList, newArray, position + 1, max, M);
				max = max < calc ? calc : max;
			}

			return max;
		}


		/// <summary>
		/// 得点を計算
		/// </summary>
		/// <param name="infoList"></param>
		/// <param name="array"></param>
		/// <returns></returns>
		private static long saiten(List<long[]> infoList, int[] array) {

			long tokuten = 0;
			foreach (var list in infoList) {
				if (array[list[1] - 1] - array[list[0] - 1] == list[2]) {
					tokuten += list[3];
				}
			}
			return tokuten;
		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}

		
	}
}


Measured memory_bytes: 38240
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    a = kwargs["a"]
    b = kwargs["b"]
    n = kwargs["n"]

    for i in range(min(b, n), -1, -1):
        res = a * i // b - a * (i // b)

        if res > 0:
            break

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["a"], kwargs["b"], kwargs["n"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Measured memory_bytes: 31172
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }

string S;

signed main()
{
	cin >> S;

	if(S == "ABC")
	{
		cout << "ARC" << endl;
	}
	else
	{
		cout << "ABC" << endl;
	}
}





Measured memory_bytes: 3672
function Main(input) {
  input = input.replace(/\n/g, ' ');
  input = input.split(" ");
  var A = input[0];
  var B = input[1];
  var i=0;
  while(true){
    if(B<=(A*i-(i-1))){
      break;
    }
    i++;
  }
  console.log(i);

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)

int main() {
  int N;
  cin >> N;
  if (N == 100000) {
    cout << 90909 << endl;
  } else {
    int ans;
    if (N >= 10000) {
      ans = N - 9090;
    } else if (N >= 1000) {
      ans = 909;
    } else if (N >= 100) {
      ans = N - 90;
    } else if (N >= 10) {
      ans = 9;
    } else {
      ans = N;
    }
    cout << ans;
  }
};


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w;
    int n;
    vector<int> a;
    cin >> h >> w;
    cin >> n;
    for(int i=0; i<n; i++){
        int _a;
        cin >> _a;
        a.push_back(_a);
    }

    int c[h][w];
    fill(c[0],c[h],0);
    int hi=0,wi=0,d=0;
    int dr[4][2] = {
        {0,1},
        {1,0},
        {0,-1},
        {-1,0}
    };
    int ai=0;
    for(int cnt=0; cnt<h*w; cnt++){
        if(a.at(ai)==0)ai++;
        c[hi][wi] = ai+1;
        a.at(ai)--;
        if(hi+dr[d][0]<0 || hi+dr[d][0]>=h || wi+dr[d][1]<0 || wi+dr[d][1]>=w){
            d++;
            d%=4;
        } else if(c[hi+dr[d][0]][wi+dr[d][1]]>0){
            d++;
            d%=4;
        }
        hi+=dr[d][0];
        wi+=dr[d][1];
    }

    // output
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cout << c[i][j];
            if (j!=w-1) cout << ' ';
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 384
import numpy as np

        
n = int(input())

a = np.zeros(n,dtype=int)
b = np.zeros(n,dtype=int)

for i in range(n):
    a[i],b[i] = map(float, input().split())

#listをsortする
a.sort()
b.sort()
                    
if n%2 == 1:
    a0cen = a[(n-1)//2]
    b0cen = b[(n-1)//2]
    nn = b0cen - a0cen + 1
else:
    a0cen1 = a[(n-2)//2]+a[n//2]
    b0cen1 = b[(n-2)//2]+b[n//2]
    nn = int(b0cen1 -a0cen1 +1)

print(nn)           


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

int main()
{
	int a, b, c,t;
	cin >> a >> b >> c;
	if (a > b) {
		t = a;
		a = b;
		b = t;
	}
	if (b > c) {
		t = b;
		b = c;
		c = t;
	}
	if (a > b) {
		t = a;
		a = b;
		b = t;
	}
	cout << a <<" "<< b <<" "<< c<<endl;

	return 0;
}

Measured memory_bytes: 3000
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

X = INT()

def is_prime(num):
   """ 素数判定 """
   from math import sqrt
   if num < 2:
       return False
   if num in [2, 3, 5]:
       return True
   if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
       return False
   # 疑似素数(2でも3でも割り切れない数字)で次々に割っていく
   prime = 7
   step = 4
   num_sqrt = sqrt(num)
   while prime <= num_sqrt:
       if num % prime == 0:
           return False
       prime += step
       step = 6 - step
   return True

while 1:
	if is_prime(X):
		print(X)
		break
	else:
		X += 1


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<int>> A(N,vector<int>(M));
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < M; ++j){
      cin >> A[i][j];
      --A[i][j];
    }
  }
  int ans = N;
  vector<bool> C(M,false);
  for(int i = 0; i < M; ++i){
    vector<int> P(M,0);
    for(int j = 0; j < N; ++j){
      for(int k = 0; k < M; ++k){
        if(C[A[j][k]]) continue;
        ++P[A[j][k]];
        break;
      }
    }
    int idx = max_element(P.begin(), P.end()) - P.begin();
    //cerr << i << " " << P[idx] << endl;
    ans = min(ans,P[idx]);
    C[idx] = true;
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
import sys
import numpy as np 

n = int(sys.stdin.readline().rstrip())
a = np.array(sys.stdin.read().split(), dtype=np.int64)

def main():
    b = np.sort(a)
    m1 = b[-1]
    m2 = b[-2]
    res = np.zeros(n, dtype=np.int64)
    res[a <= m2] = m1
    res[a == m1] = m2
    return res
    
if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

Measured memory_bytes: 33988
#include <iostream>
using namespace std;
int main(void){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    int ox, oy, w, h;
    ox = r;
    oy = r;
    w = W - r;
    h = H - r;
    if(x >= ox && x <= w){
        if(y >= oy && y <= h){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else {
        cout << "No" << endl;
    }
    
}


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

#define ll long long

using namespace std;

ll n, m, a, b;
vector< vector<int> > A;
vector<ll> B, C;

void DFS_one(int v, int p) {
    B[v] = 1;
    for(auto c : A[v])
        if(c != p) {
            DFS_one(c, v);
            B[v] = (B[v] * (B[c] + 1)) % m;
        }
}

void DFS_two(int v, int p, ll up) {
    vector<ll> pre(A[v].size() + 2),
               suf(A[v].size() + 2);
    pre[0] = 1;
    suf[A[v].size() + 1] = 1;
    for(int i = 0; i < A[v].size(); i++) {
        int c = A[v][i];
        if(c != p) {
            pre[i + 1] = (pre[i] * (B[c] + 1)) % m;
        } else {
            pre[i + 1] = pre[i];
        }
    }
    for(int i = A[v].size() - 1; i >= 0; i--) {
        int c = A[v][i];
        if(c != p) {
            suf[i + 1] = (suf[i + 2] * (B[c] + 1)) % m;
        } else {
            suf[i + 1] = suf[i + 2];
        }
    }
    C[v] = (B[v] * up) % m;
    for(int i = 0; i < A[v].size(); i++) {
        int c = A[v][i];
        if(c != p) {
            ll mul = (pre[i] * suf[i + 2]) % m;
            mul = (mul * up + 1) % m;
            DFS_two(c, v, mul);
        }
    }
}

int main() {
    std::ios::sync_with_stdio(false);
    cin >> n >> m;
    A.resize(n);
    B.resize(n);
    C.resize(n);
    for(int i = 0; i < n - 1; i++) {
        cin >> a >> b;
        a--; b--;
        A[a].push_back(b);
        A[b].push_back(a);
    }
    DFS_one(0, -1);
    DFS_two(0, -1, 1);
    for(int i = 0; i < n; i++)
        cout << C[i] << "\n";
#if 0
    cout << "\n\n";
    for(int i = 0; i < n; i++)
        cout << B[i] << "\n";
#endif
    return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;

  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());

  if (s < t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 10;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
ll n,k,a[maxn],f[maxn];
bool check(ll x){
	ll sum = 0;
	for(int i = 0;i < n;i++){
		ll b = a[i],c = f[i];
		if(b * c > x){
			sum += (b - x / c);
		}
	}
	return sum <= k;
}
void calc(){
	ll l = 0,r = 1e18,ans = 0;
	while(l <= r){
		ll mid = (l + r) >> 1;
		if(check(mid)) r = mid - 1,ans = mid;
		else l = mid + 1;
	}
	cout << ans << endl;
}
void solve(){
	sort(a,a+n);
	sort(f,f+n,greater<ll>());
	calc();	
}
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	rep(i,0,n-1) cin >> a[i];
	rep(i,0,n-1) cin >> f[i];
	solve();
}
//do smt instead of nothing! never give up!


Measured memory_bytes: 5888
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

void y() {
	puts("Yes");
	exit(0);
}
void n() {
	puts("No");
	exit(0);
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

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

	if (mp.size() >= 4)n();
	else if (mp.size() == 3) {
		if (N % 3 != 0)n();
		int ok = 1;
		fore(x, mp)if (x.second != N/3)ok = 0;
		if (!ok)n();
		ll sum = 0;
		fore(x, mp)sum ^= x.first;
		if (sum != 0)n();
		else y();
	}
	else if (mp.size() == 1) {
		fore(x, mp) {
			if (x.first == 0)y();
			else n();
		}
	}else{
		if (N % 3 != 0)n();
		int ma = -1;
		int mi = -1;
		fore(x, mp) {
			if (x.second == (N / 3) * 2)ma = x.first;
			else if (x.second == (N / 3))mi = x.first;
		}
		if (ma == -1 || mi == -1)n();
		if (mi == 0)y();
		n();
	}


	return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <cmath>
using namespace std;

int main() {
	string S; cin >> S;
	if (S <= "2019/04/30") cout << "Heisei" << endl;
	else cout << "TBD" << endl;
	return 0;
}

Measured memory_bytes: 256
s = list(str(input()))
t = list(reversed(s))
#print(s)
#print(t)

n = len(s)

r = []
temp = 0
for i in range(n):
    if s[i] == 'R':
        temp += 1
    else:
        if i >=1  and s[i-1] == 'R' and s[i] == 'L':
            r.append(temp)

l = []
temp = 0
for i in range(n):
    if t[i] == 'L':
        temp += 1
    else:
        if i >=1  and t[i-1] == 'L' and t[i] == 'R':
            l.append(temp)
#print(r)
#print(l)

r_ = []
l_ = []
for i in range(len(r)):
    if i == 0:
        r_.append(r[i])
        l_.append(l[i])
    else:
        r_.append(r[i]-r[i-1])
        l_.append(l[i]-l[i-1])
l_ = list(reversed(l_))
#print(r_)
#print(l_)

ans = [0]*n
cnt = 0
for i in range(n):
    if i==n-1:
        continue
    if s[i] == 'R' and s[i+1] == 'L':
        ans[i] = l_[cnt]//2+(r_[cnt]+1)//2
        ans[i+1] = (l_[cnt]+1)//2+r_[cnt]//2
        cnt += 1
print(*ans)


Measured memory_bytes: 54648
#include <bits/stdc++.h>
using namespace std;
int a[100001],b[100001];
int main(void){
	int n;
	int ans;
	cin >> n;
	for(int i=0;i<n/2;i++){
		int c,d;
		cin >> c >> d;
		a[c]++;
		b[d]++;
	}
	int a1=0,a2=0,b1=0,b2=0;
	//iが何個含まれているかはa[i]に保存されている
	//b[i]にiの個数が保存されている
	for(int i=0;i<=100000;i++){
		if(a[i]>a[a1]){
			a2 = a1;
			a1 = i;
		}else if(a[i]>a[a2])a2=i;
		if(b[i]>b[b1]){
			b2 = b1;
			b1 = i;
		}else if(b[i]>b[b2])b2=i;
	}
	if(a1!=b1)ans = n - a[a1] - b[b1];
	else ans = min(n-a[a1]-b[b2],n-a[a2]-b[b1]);
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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 D pi = acos(-1.0);

int main(){
    D a,b,h,m; cin >> a >> b >> h >> m;
    D hh = 30.0*h + m / 2.0;
    D mm = 6.0*m;
    D diff = abs(hh - mm);
    D theta = min(diff, 360.0-diff);
    D ans = a*a + b*b - 2*a*b*cos(theta*pi/180.0);
    ans = sqrt(ans);
    printf("%.12f", ans);
}


Measured memory_bytes: 4164
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
t=lin(n)


def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(t))



Measured memory_bytes: 63468
N=int(input())
G=[[] for _ in [0]*(N+1)]
for _ in [0]*(N-1):
    u,v,w=map(int,input().split())
    G[u].append((v,w))
    G[v].append((u,w))

c=[0]*(N+1)
stack=[1]
c[1]=1
while stack:
    r=stack.pop()
    for nr,nw in G[r]:
        if c[nr]==0:
            stack.append(nr)
            if nw%2:
                c[nr]=-c[r]
            else:
                c[nr]=c[r]
for i in c[1:]:
    print((i+1)//2)

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

using namespace std;

int main() {
  int n,k;
  cin>>n>>k;
  int temp;
  vector<int> v;
 for(int i=0;i<n;i++)
 {
     cin>>temp;
     
     v.push_back(temp);
 }
 int count=0;
 for(int i=0;i<n;i++)
 {
    if(v[i]>=k)
    {
        count++;
    }
 }
 cout<<count;
 
}

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

int main() {
    string s;
  	cin >> s;
  	int start, end;
  	rep(i, s.length()) {
    	if(s[i] == 'A'){
        	start = i;
          	break;
        }
    }
  	for(int i = s.length() - 1; 0 <= i; i--){
    	if(s[i] == 'Z'){
        	end = i;
          	break;
        }
    }
  	cout << s.substr(start, end - start + 1).length() << endl;
    return 0;
}

Measured memory_bytes: 772
#include <stdio.h>
#include <string.h>

int main() {
    char a[4];
    
    scanf("%s", a);
    
    int l = strlen(a);
    
    if (a[l-1] == '2'|| a[l-1] == '4' || a[l-1] == '5' || a[l-1] == '7' || a[l-1] == '9')
        printf("hon\n");
    else if (a[l-1] == '0' || a[l-1] == '1' || a[l-1] == '6' || a[l-1] == '8')
        printf("pon\n");
    else 
        printf("bon");
    
    
    return 0;
}


Measured memory_bytes: 1680
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin >> A.at(i);
    double tmp = 0;
    for(int i=0;i<N;i++) tmp = tmp +  1.0/A.at(i);
    cout << 1.0/tmp << endl;
}


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

int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> a(n + 1);
  for (int i = 0; i < n - 1; i++) {
    a[i + 1] = s[i] == 'A' && s[i + 1] == 'C';
  }
  for (int i = 0; i < n; i++) {
    a[i + 1] += a[i];
  }
  for (; q > 0; q--) {
    int l, r;
    cin >> l >> r;
    l--;
    cout << a[r] - a[l] - (r < n && s[r - 1] == 'A' && s[r] == 'C') << endl;
  }
}


Measured memory_bytes: 1408
import java.util.Scanner

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]) = {
    val sc = new Scanner(System.in)
    val S = sc.nextLine()

    @tailrec
    def search(ch: Char, str: String, subStr: String = ""): String = {
      val n = ch match {
        case 'A' | 'C' | 'G' | 'T' => ch.toString
        case _ => ""
      }
      if (str.isEmpty) subStr + n
      else if(n.isEmpty) subStr
      else search(str.head, str.tail, subStr + n)
    }

    val a = S.tails.map {s =>
      if (s.isEmpty) ""
      else search(s.head, s.tail)
    }.toList
    val r = a.map(_.length).sortWith((a, b) => a > b).head

    println(s"$r")
  }
}


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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

int main(){
    string a,b;
    cin >> a >> b;
    
    if(a.size()>b.size()){
        cout << "GREATER" << endl;
    }else if(a.size()<b.size()){
        cout << "LESS" << endl;
    }else{
        if(a==b)    cout << "EQUAL" << endl;
        else if(a>b){
            cout << "GREATER" << endl;
        }else{
            cout << "LESS" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3568
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int[] a = new int[n];
		
		for(int i = 0; i < a.length; i++) {
			a[i] = scanner.nextInt();
		}
		
		for(int i = 0;  i < a.length; i++) {
			for(int j = a.length-1; j > i ; j--) {
				if(a[j-1] > a[j]) {
					int tmp = a[j-1];
					a[j-1] = a[j];
					a[j] = tmp;
				}
			}
		}
		
		System.out.println(a[n-1] - a[0]);
	}

}


Measured memory_bytes: 23124
// inputに入力データ全体が入る
function Main(input) {
	input = input.split("\n");
	rangeLineString = input[1].split(" ");
	//入力値を取得
	var k = parseInt(input[0], 10);
	var a = parseInt(rangeLineString[0], 10);
	var b = parseInt(rangeLineString[1], 10);
	var canClear = false;
  	//割り切れるかチェック
  	for(a; a <= b; a++){
      if(a % k == 0){
        canClear = true;
      }
    }
  	//出力
  	if(canClear){
      console.log('OK');
    }else{
      console.log('NG');
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29640
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

map<ll, ll> prime_factorization(ll n){
    map<ll,ll> ret;
    for(ll i=2;i*i<=n+1;i ++){
        while(n%i==0){
            ret[i] ++;
            n /= i;
        }
    }
    if(n!=1) ret[n]=1;
    return ret;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(10);
    //start = chrono::system_clock::now();
    ll A, B;
    cin >> A >> B;
    ll div = gcd(A,B);
    auto divs = prime_factorization(div);
    cout << divs.size()+1 << endl;
    //end = chrono::system_clock::now();
    //cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main(){
  int n,m,d,p,o;
  typedef pair<int,int> ma;
  
  int i,j,k;
  cin >> n >> m;
  while(n!=0||m!=0){
    vector <ma> map;
    ma b;
    for(i=0;i<n;i++) {
      cin >> d >> p;
      b.first=p;b.second=d;
      map.push_back(b);
    }
    sort(map.begin(),map.end(),greater<ma>());
    o=0;
    for(i=0;i<map.size();i++){
      if(m>=map[i].second) m-=map[i].second;
      else if(m>0) {
	o+=(map[i].second-m)*map[i].first;
	m=0;
      }else o+=map[i].first*map[i].second;
    }
    cout << o << endl;
    cin >> n >> m;
  }
  return 0;
}

Measured memory_bytes: 1328
def main():
    N, K = list(map(int, input().split(' ')))
    A = list(map(int, input().split(' ')))
    if K >= 42:
        print(' '.join([str(N) for _ in range(N)]))
        return
    for _ in range(K):
        cumsum = [0 for _ in range(N)]
        for i, a in enumerate(A):
            left = max(0, i - a)
            cumsum[left] += 1
            right = i + 1 + a
            if right <= N - 1:
                cumsum[right] -= 1
        for i in range(1, N):
            cumsum[i] += cumsum[i - 1]
        A = cumsum
    print(' '.join(map(str, A)))
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 167644
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

long long beki(long long a,int n)
{
  long long s=1LL;
  while(n){
    if(n%2)s=(s*a)%MOD;
    a=(a*a)%MOD;
    n/=2;
  }
  return s;
}
int main(void) {
  int i,j;
  int n;
  cin>>n;
  int x=beki(2,n);
  vi a(x);
  rep(i,x)cin>>a[i];
  rep(i,n){
    int tmp=beki(2,i);
    for(j=0;j<x;j+=tmp)
      if(a[j]!=a[j+tmp])
        a[j]=max(a[j],a[j+tmp])-min(a[j],a[j+tmp]);
  }
  cout<<a[0]<<endl;
}


Measured memory_bytes: 1280
#include <stdio.h>
#define SIZ 1400
int A[SIZ][SIZ],m[SIZ][SIZ];
int main(){
	int i,j,k,x,y,r,M=0;
	scanf("%d%d",&y,&x);
	for(j=0;j<y;j++)for(r=i=0;i<x;m[j][i]=r,i++){
		int t;
		scanf("%d",&t);
		r=t==0?r+1:0;
	}
	for(r=i=0;i<x;i++)for(j=0;j<y;j++)for(M=x,k=j;k<y;k++){
		if(M>m[k][i])M=m[k][i];
		int z=k-j+1;
		if(M<z)break;
		if(r<z)r=z;
	}
	printf("%d\n",r*r);
	return 0;
}

Measured memory_bytes: 9772
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define ll long long
using namespace std;
int n,m,r;
int x,y,c;
int a[300];
ll w[300][300];
int flag[300];
int ans;


void dfs(int now,int p,int tans)
{
    if (now==r)
    {
        ans=min(ans,tans);
    }else
    {
        for (int i=1; i<=r; ++i)
            if (flag[i]==0)
            {
                flag[i]=1;
                dfs(now+1,i,tans+w[a[i]][a[p]]);
                flag[i]=0;
            }
    }
}




int main()
{

    cin>>n>>m>>r;
    for (int i=1; i<=n; ++i)
        w[0][i]=w[i][0]=0;
    for (int i=1; i<=n; ++i)
        for (int j=1; j<=n; ++j)
            if (i==j) w[i][j]=0;else
            w[i][j]=300000000;

    for (int i=1; i<=r; ++i)
        cin>>a[i];

    for (int i=1; i<=m; ++i)
    {
        scanf("%d%d%d",&x,&y,&c);
        w[x][y]=w[y][x]=c;
    }
    ans=50000000;
    for (int k=1; k<=n; ++k)
    for (int i=1; i<=n; ++i)
        for (int j=1; j<=n; ++j)
                if (w[i][k]+w[k][j]<w[i][j])
                    w[i][j]=w[i][k]+w[k][j];

    dfs(0,0,0);
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ll long long
#define str string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define mod 1000000007
#define inf 1000000000 
#define llinf 1000000000000000000
#define eps 1e-6
#define pi atan(1) * 4
using namespace std;
vector<int> pos;
int main () {
	int a, b, c, d, e, f, g, h, i, j, k, m, n, o, p, q;
	str A, B, C;
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> A;
	a = A.length();
	for (i = 0; i < a; i++) {
		if (A[i] != 'x') {
			B += A[i];
			pos.pb(i);
		}
	}
	b = B.length();
	if (b == 0) {
		printf("0\n");
		return 0;
	}
	for (i = 0; i < b; i++) {
		if (B[i] != B[b - 1 - i]) {
			printf("-1\n");
			return 0;
		}
	}
	int ans = 0;
	int l, r;
	if (b & 1) {
		l = pos[b >> 1] - 1; r = pos[b >> 1] + 1;
	} else {
		l = pos[(b >> 1) - 1]; r = pos[(b >> 1)];
	}
	for (i = l, j = r; i >= 0; i--, j++) {
		int m = 0, m2 = 0;
		while (i >= 0 && A[i] == 'x') m++, i--;
		while (j < A.length() && A[j] == 'x') m2++, j++;
		ans += abs(m - m2);
	}
	ans += abs((i + 1) - (a - j));
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=1;i<n;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
int main() {
    intc(n);
    vector<int> x(n),y(100);
    r1(i, n) cin >> x.at(i);
    int a=0;
    r1(j, 100) {
      r1(i, n) y.at(j)+=(x.at(i)-j)*(x.at(i)-j);
    }
    a=*min_element(y.begin(),y.end());
    cout << a << endl;
}

Measured memory_bytes: 256
a = list(map(int,input().split()))

t1 = a[0] + a[1]
t2 = a[0] + a[2]
t3 = a[1] + a[2]

if t1 <= t2 and t1 <= t3:
    print(t1)
elif t2 <= t1 and t2 <= t3:
    print(t2)
else:
    print(t3)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a;

signed main() {
	while (scanf("%d",&a)!=EOF) {
		vector<int> r;
		rep(i,30) if (a>>i&1) r.push_back(1<<i);
		rep(i,r.size()) cout << r[i] << bln(i,r.size());
	}
}



Measured memory_bytes: 3184