akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LL long long
#define db double
using namespace std;
 
const int MAXN = (1 << 17 | 3);
const int MAXE = 400400;
const int INF = 0x3f3f3f3f;
 
template<typename T> inline void CheckMax(T &A, T B) {
	A < B ? A = B : A;
}
 
template<typename T> inline void CheckMin(T &A, T B) {
	A > B ? A = B : A;
}
 
template <typename T> inline void read(T &x) {
    int c = getchar();
    bool f = false;
    for (x = 0; !isdigit(c); c = getchar()) {
        if (c == '-') {
            f = true;
        }
    }
    for (; isdigit(c); c = getchar()) {
        x = x * 10 + c - '0';
    }
    if (f) {
        x = -x;
    }
}
 
LL n, m;
LL P[MAXN], cnt;

const LL mod = 1000000007;

LL qpow(LL a, LL b) {
	LL ret = 1;
	while(b) {
		if(b & 1) ret *= a;
		ret %= mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ret;
}

#define inv(x) qpow(x, mod - 2)
LL fac[MAXN + 10];

void init() {
	fac[0] = 1;
	for(LL i = 1; i <= MAXN; i++) fac[i] = fac[i - 1] * i % mod;
}

LL C(LL a, LL b) {
    return (fac[a] * inv(fac[b]) % mod * inv(fac[a - b]) % mod);
}

void solve(LL x) {
	for(LL i = 2; i * i <= x; i++) {
		if(x % i == 0) {
			LL cur = 0;
			while(x % i == 0) {
				x /= i;
				cur++;
			}
			P[++cnt] = cur;
		}
	}
	if(x > 1) P[++cnt] = 1;
}
 
signed main() {
	cin >> n >> m;
	solve(m);
	LL ans = 1LL;
	init();
	for(LL i = 1; i <= cnt; i++) {
		ans *= (LL) C(P[i] + n - 1LL, n - 1LL) % mod;
		ans %= mod;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;

int main()
{
	ll a,b,k;
	cin>>a>>b>>k;
	if(a<k)
	{
		b-=k-a;
		a-=k;
	}
	else a-=k;
	a=max(0LL,a);
	b=max(0LL,b);
	cout<<a<<" "<<b<<'\n';
}


Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))
def inpl_str():
    '''
    一行に複数の文字
    '''
    return list(input().split())

n = inp()
a = inpl()
ans = defaultdict(lambda: 0)
for i in a:
    ans[i-1] += 1
for i in range(n):
    print(ans[i])

Measured memory_bytes: 41748
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let n: usize = read_line().trim().parse().unwrap();
    let mut ps: Vec<i64> = Vec::with_capacity(n);
    let mut qs: Vec<i64> = Vec::with_capacity(n);
    let mut rs: Vec<(i64, usize)> = Vec::with_capacity(n);
    for i in 0..n {
        let pq: Vec<i64> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();

        ps.push(pq[0]);
        qs.push(pq[1]);
        rs.push((pq[0] + pq[1], i));
    }
    rs.sort_by(|l, r| r.cmp(l));

    let mut tsum = 0i64;
    let mut asum = 0i64;
    for i in 0..n {
        if i%2==0 {
            tsum += ps[rs[i].1];
        } else {
            asum += qs[rs[i].1];
        }
    }

    println!("{}", tsum - asum);
}


Measured memory_bytes: 8444
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(m)]
h1=list(True for _ in range(n))
for i in range(m):
    if h[ab[i][0]-1]>=h[ab[i][1]-1]:
         h1[ab[i][1]-1]=False
    if h[ab[i][0]-1]<=h[ab[i][1]-1]:
         h1[ab[i][0]-1]=False
        
print(sum(h1))

Measured memory_bytes: 31952
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define pi pair<int, int>
#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N=3e3+10;
const ll mod=998244353;
int a[N],n,s,len;
ll dp[N][N],f[N];

int main()
{
    cin>>n>>s;
    rep(i,1,n)
    {
        cin>>a[i];
    }

    //dp[0][0]=1;
    for(int i=1;i<=n;++i){
        dp[i][a[i]]=i;
        for(int j=0;j<=s;++j){
            if(j+a[i]>s) continue;
            dp[i][j+a[i]]+=f[j];
            dp[i][j+a[i]]%=mod;;
        }
        for(int j=0;j<=s;++j) f[j]+=dp[i][j],f[j]%=mod;
    }
    //printf("dp[]:%d\n",dp[3][4]);

    ll ans=0;
    for(int i=1;i<=n;++i){
        ans+=(1ll*n-i+1)*dp[i][s]%mod;
        ans%=mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 70784
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
#define nan Too_Difficult
int n,dep[SZ],vv[SZ],fa[SZ],ov[SZ]; Edg
const int nan=1.001e9;
namespace spfa
{
Edgc
int qs[SZ],inq[SZ];
void run()
{
	int h=0,t=0;
	for(int i=1;i<=n;++i)
		if(vv[i]!=nan)
			qs[t++]=i,inq[i]=1;
	while(h^t)
	{
		int x=qs[h++];
		for esb(x,e,b)
		{
			if(vv[b]<=vv[x]+vc[e]) continue;
			vv[b]=vv[x]+vc[e];
			if(!inq[b]) inq[b]=1,qs[t++]=b;
		}
		inq[x]=0;
	}
}
}
void dfs(int x,int f=0)
{
	fa[x]=f;
	if(f)
	{
		spfa::ad_de(x,f,1);
		spfa::ad_de(f,x,0);
	}
	for esb(x,e,b) if(b!=f)
		dep[b]=dep[x]+1,dfs(b,x);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) vv[i]=ov[i]=nan;
	for(int i=2,a,b;i<=n;++i)
		scanf("%d%d",&a,&b),adde(a,b);
	dfs(1); int k; scanf("%d",&k);
	int rr=nan;
	for(int i=1;i<=k;++i)
	{
		int p,q;
		scanf("%d%d",&p,&q);
		ov[p]=q;
		q-=dep[p];
		int s=q&1;
		if(s!=rr&&rr!=nan)
		{
			puts("No");
			return 0;
		}
		rr=s; vv[p]=q>>1;
	}
	spfa::run();
	for(int i=2;i<=n;++i)
	{
		if(vv[fa[i]]!=vv[i]&&vv[fa[i]]!=vv[i]+1)
		{
			puts("No");
			return 0;
		}
	}
	for(int i=1;i<=n;++i)
		if(ov[i]!=nan&&vv[i]*2+dep[i]+rr!=ov[i])
		{
			puts("No");
			return 0;
		}
	puts("Yes");
	for(int i=1;i<=n;++i)
		printf("%d\n",vv[i]*2+dep[i]+rr);
}


Measured memory_bytes: 36864
#include <iostream>

const int MAXN = (int)1e5 + 1;
const int P = (int)1e9 + 7;

int64_t f[MAXN];  // gcd为i的倍数的方案数.
int64_t g[MAXN];  // gcd恰好为i的方案数.

int64_t pow(int64_t x, int y) {
  int64_t ans = 1;
  while (y > 0) {
    if (y & 1) ans = ans * x % P;
    x = x * x % P;
    y >>= 1;
  }
  return ans;
}

int64_t solve(int n, int k) {
  for (int i = 1; i <= k; ++i) {
    f[i] = pow(k / i, n);
  }
  for (int i = k; i >= 1; --i) {
    g[i] = f[i];
    for (int j = 2; j <= k / i; ++j) {
      g[i] = (g[i] - g[j * i] + P) % P;
    }
  }

  int64_t ans = 0;
  for (int i = 1; i <= k; ++i) {
    ans = (ans + g[i] * i % P) % P;
  }
  return ans;
}

int main() {
  int n, k;
  std::cin >> n >> k;
  std::cout << solve(n, k) << std::endl;
  return 0;
}


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

int N, A[100005];

int main() {
    scanf("%d", &N);

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

    for(int i = 1; i <= N; i++) {
        printf("%d ", A[i]);
    }

    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int n;
    in(n);
    vector<int> vec(n);
    in(vec);
    int sum,minv=1000000000;
    for(int i=-100;i<=100;i++){
        sum=0;
        rep(j,vec.size()){
            sum+=(vec[j]-i)*(vec[j]-i);
        }
        minv=min(minv,sum);
    }
    out(minv);
}


Measured memory_bytes: 3756
#include "bits/stdc++.h"
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2740&lang=jp
typedef long long ll;
#define INF 1<<30
using namespace std;

void solve(int& i1, int& i2, string& S1, string& S2, bool f1 = true, bool f2 = true) {
	/* "(" ~ )[x]( ~ ) */
	if (f1 && S1[i1] == '(') i1++;
	if (f2 && S2[i2] == '(') i2++;
	if (f1 && f2)cout << '(';

	/* ( "~" )[x]( ~ ) */
	if (S1[i1] == '(' || S2[i2] == '(') {
		solve(i1, i2, S1, S2, S1[i1] == '(', S2[i2] == '(');
	}

	/* ( ~ ")"[x]( ~ )  */
	if (f1 && S1[i1] == ')') i1++;
	if (f2 && S2[i2] == ')') i2++;
	if (f1&&f2) cout << ')';

	/* ( ~ )"[x]"( ~ ) */
	// "["
	if (f1)i1++;
	if (f2)i2++;
	// "x"
	int x1 = 0;
	while (f1 && S1[i1] != ']') {
		x1 = x1 * 10 + (S1[i1] - '0');
		i1++;
	}
	int x2 = 0;
	while (f2&& S2[i2] != ']') {
		x2 = x2 * 10 + (S2[i2] - '0');
		i2++;
	}
	// "]"
	if (f1)i1++;
	if (f2)i2++;

	if (f1&&f2) { cout << '[' << x1 + x2 << ']'; }

	/* ( ~ )[x]"(" ~ ) */
	if (f1&&S1[i1] == '(') i1++;
	if (f2&&S2[i2] == '(') i2++;
	if (f1&&f2)cout << '(';

	/* ( ~ )[x]( "~" )*/
	if (S1[i1] == '(' || S2[i2] == '(') {
		solve(i1, i2, S1, S2, S1[i1] == '(', S2[i2] == '(');
	}

	/* ( ~ )[x]( ~ ")"*/
	if (f1&&S1[i1] == ')') i1++;
	if (f2&&S2[i2] == ')') i2++;
	if (f1&&f2)cout << ')';
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	/* input */
	string A, B; cin >> A >> B;

	/* solve */
	int i1 = 0, i2 = 0;
	solve(i1, i2, A, B);
	cout << endl;

	return 0;
}

Measured memory_bytes: 3256
from itertools import permutations
n=int(input())
p=tuple(int(i)for i in input().split())
q=tuple(int(i)for i in input().split())
permutation_n=list(permutations(range(1,n+1)))
a=b=0
for i in permutation_n:
    if i<p:a+=1
    if i<q:b+=1
print(abs(a-b))

Measured memory_bytes: 13900
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int C = sc.nextInt();
    int K = sc.nextInt();
    int[] T = new int[N];
    for (int i = 0; i < N; i++) {
      T[i] = sc.nextInt();
    }
    Arrays.sort(T);
    int ans = 0;
    int end = 0;
    int carry = 0;
    for (int i = 0; i < N; i++) {
      if (T[i] > end || carry >= C) {
        ans++;
        end = T[i]+K;
        carry = 0;
      }
      carry++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 50008
import sys
readline = sys.stdin.readline
write = sys.stdout.write
N, K = map(int, readline().split())

R = []
v = (1 << K) - 1
while v < (1 << N):
    R.append(v)
    x = v & -v; y = v + x
    v = ((v & ~y) // x >> 1) | y
R.sort()
for i in R:
    write("%d: %s\n" % (i, " ".join(str(j) for j in range(N) if i & (1 << j))))



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


int main(){
    int n, l; cin >> n >> l;
    vector<int> v(n);
    rep(i,n) v[i] = l+i;
    int sum=0;
    rep(i,n) sum += v[i];
    int ans=1e9;
    rep(i,n){
        int t = sum-v[i];
        if(abs(t-sum) < abs(ans-sum)) ans=t;
    }
    cout << ans;

}

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

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

int main() {
	int k;
	cin >> k;
	if(k % 7 == 0)
		k /= 7;
	// else {
	// 	cout << -1 << '\n';
	// 	return 0;
	// }
	// int i = 1, cur = 1;
	// for(; k % cur != 0; cur = cur + pow(10, i), i++);
	// if(cur > k)
	// 	cout << -1 << '\n';
	// else
	// 	cout << i << '\n';

	for(long long cur = 1, i = 1, pw = 10; i < 2000100; cur = (cur + pw) % k, pw = (pw * 10) % k, i++) {
		if(cur % k == 0) {
			cout << i << '\n';
			return 0;
		}
	}
	cout << -1 << '\n';
	return 0;
}


Measured memory_bytes: 3624
local mod = 1000000007
local function bmul(x, y) return (x * y) % mod end
local n = io.read("*n")
local ret = 1
local t = {}
for i = 1, n do t[i] = true end
for i = 2, n do
  if t[i] then
    local c = 0
    for j = i, n, i do
      t[j] = false
      while j % i == 0 do
        c = c + 1
        j = j // i
      end
    end
    ret = bmul(ret, (c + 1))
  end
end
print(ret)


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

int N, M;
int A[333][333];
int ng[333];

// もっとも多くの人が参加するスポーツとそのスポーツに参加する人数を調べる
// その後、そのスポーツを候補から除外する
int solve() {
    vector<int> cnt(M);
    rep(i, 0, N) {
        rep(j, 0, M) {
            if(ng[A[i][j]]) continue;
            cnt[A[i][j]]++;
            break;
        }
    }
    int mx = 0;
    int sp = 0;
    rep(i, 0, M) {
        if(mx < cnt[i]) {
            mx = cnt[i];
            sp = i;
        }
    }
    ng[sp] = 1;
    return mx;
}

int main() {
    cin >> N >> M;
    rep(i, 0, N) rep(j, 0, M) {
        cin >> A[i][j];
        A[i][j]--;
    }
    int ans = N;
    rep(i, 0, M) ans = min(ans, solve());
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
from itertools import product as pr
n=int(input())
if n<357:
  print(0)
  exit()

l=[]
for i in range(3,len(str(n))+1):
  l+=list(pr('753',repeat=i))

ans=0

for x in l:
  if int(''.join(x))>n:
    continue
  if x.count('3')>0 and x.count('5')>0 and x.count('7')>0:
    ans+=1
print(ans)

Measured memory_bytes: 7028
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
mw = wv[0][0]
wv.sort(key=lambda x: -x[1])
values = [[] for _ in range(4)]
for w, v in wv:
    values[w-mw].append(v)


def solve(n, w, c):
    if n >= 4 or w >= W or c >= N:
        return 0
    r = 0
    for i in range(len(values[n])+1):
        cw = w + (mw + n) * i
        cc = c + i
        if cw <= W and cc <= N:
            r = max(r, sum(values[n][0:i]) + solve(n+1, cw, cc))
    return r


print(solve(0, 0, 0))


Measured memory_bytes: 3064
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);Long[]h=new Long[10];for(int i=10;i-->0;)h[i]=s.nextLong();Arrays.sort(h, Collections.reverseOrder());System.out.printf("%d\n%d\n%d\n",(Object[])h);}}

Measured memory_bytes: 12000
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;

struct test{
  int as;
  int bs;
  int cs;
  int kekka;
};

int a,b,c,part[300],n;
struct test check[1001];

void solve(){
  for(int i=0;i<n;i++){
    if(check[i].kekka==1){
      part[check[i].as-1]=1;
      part[check[i].bs-1]=1;
      part[check[i].cs-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    if(check[i].kekka==0){
      if(part[check[i].as-1]+part[check[i].bs-1]+part[check[i].cs-1]==1){
	if(part[check[i].as-1]==-1) part[check[i].as-1]=0;
	else if(part[check[i].bs-1]==-1) part[check[i].bs-1]=0;
	else if(part[check[i].cs-1]==-1)part[check[i].cs-1]=0;
      }
    }
  }
}

int main(){
  while(1)
    {scanf("%d%d%d",&a,&b,&c);
      if(c==0) return 0;
  scanf("%d",&n);
  for(int i=0;i<n;i++) scanf("%d%d%d%d",&check[i].as,&check[i].bs,&check[i].cs,&check[i].kekka);
  memset(part,-1,sizeof(int)*300);
  solve();
  for(int i=0;i<a+b+c;i++){
    if(part[i]!=-1) printf("%d\n",part[i]);
    else printf("2\n");
  }}
}

Measured memory_bytes: 0
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+" << endl;
    }
    else if (a * b == 15) {
        cout << "*" << endl;
    }
    else {
        cout << "x" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
'use strict';
(function(stdin) {
  var inputs = stdin.toString().trim().split('\n');
  var params = inputs[0].split(' ').map(Number);
 
  (function(a, b) {
      console.log(f(a,b));
      function f(a,b){
        if (a > b){return 'a > b';}
        if (a < b){return 'a < b';}
        return 'a == b';
      }
  }(params[0], params[1]));
 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15584
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 2e5 + 7;
const int maxm = 1e6 + 7;
const int ALP = 26;
const long long mod = 1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-8;

long long n,a,b;
long long ans=llINF;
long long tmp_a,tmp_b;
int main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	if(abs(a-b)%2==0)
	{
		printf("%lld\n",abs(a-b)/2);
		return 0;
	}
	if(a>b)
		swap(a,b);
	//turn a to 1
	long long res_a=a-1+1;
	tmp_b=b-(a-1)-1;
	res_a+=(tmp_b-1)/2;

	long long res_b=n-b+1;
	tmp_a=a+(n-b)+1;
	res_b+=(n-tmp_a)/2;
	
	printf("%lld\n",min(res_a,res_b));
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
using namespace std;
using ll=long long;

int main(){
    int n;
    cin>>n;
    vector<int> d(n);
    for(int i=0;i<n;i++) cin>>d[i];
    sort(d.begin(),d.end());
    int res=0;
    int abc=0;
    for(int k=0;k<=1e6;k++){
        while(abc<d.size() && d[abc]<k) abc++;
        if(abc==n/2) res++;
    }
    cout<<res<<endl;
    
    return 0;
}

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

int main() {
    
  string N;
  char n;
  cin >> N;
  n = N.at(N.size()-1);
  if (n =='3'){
    cout << "bon" << endl;
  }else if (n =='0' or n =='1' or n =='6' or n =='8'){
    cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }
  
}


Measured memory_bytes: 3624
N,A,B,C=map(int,input().split())
l_list=[]
for i in range(N):
    l_list.append(int(input()))
def f(i,a,b,c):
    if i==N:
        if a*b*c==0:
            return 10**10
        else:
            return abs(a-A)+abs(b-B)+abs(c-C)-30
    else:
        addno=f(i+1,a,b,c)
        addA=f(i+1,a+l_list[i],b,c)+10
        addB=f(i+1,a,b+l_list[i],c)+10
        addC=f(i+1,a,b,c+l_list[i])+10
        return(min(addno,addA,addB,addC))
print(f(0,0,0,0))

Measured memory_bytes: 41944
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
template <class T> void corner(bool flg, T hoge) {
    if(flg) {
        cout << hoge << endl;
        exit(0);
    }
}
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
struct edge {
    ll to, cap, rev;
};

vector<vector<edge> > G;
vector<bool> used;

void add_edge(ll from, ll to, ll cap) {
    G[from].emplace_back((edge) { to, cap, ll(G[to].size()) });
    G[to].emplace_back((edge) { from, 0, ll(G[from].size()) - 1 });
}

ll dfs(ll v, ll t, ll f) {
    if (v == t) return f;
    used[v] = true;
    for (auto& e : G[v]) {
        if (!used[e.to] && e.cap > 0) {
            ll d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

ll max_flow(ll s, ll t) {
    ll flow = 0;
    while (1) {
        fill(used.begin(), used.end(), false);
        ll f = dfs(s, t, INF);
        if (f == 0) break;
        flow += f;
    }
    return flow;
}

int main() {
    ll V, E;
    cin >> x >>y>> E;
    V = x + y + 2;
    G.resize(V);
    used.resize(V);
    for (ll i = 0; i < E; i++) {
        cin >>  a>> b;
        add_edge(a+1, b+1 + x, 1);
    }
    rep(i, x) {
        add_edge(0, 1 + i, 1);
    }
    rep(i, y) {
        add_edge(x + i + 1, x + y + 1, 1);
    }
    cout << max_flow(0, V - 1) << endl;
    return 0;
}




Measured memory_bytes: 3372
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

// 文字数 最後から3,2,1番目の文字,のDP配列
// A -> 0
// G -> 1
// C -> 2
// T -> 3
int dp[100][4][4][4];

int main() {

  int N;
  cin >> N;

  int mod = 1000000007;

  // TはNGパターンに対して意味を持たないので、
  // 初期条件で1としても問題がない
  dp[0][3][3][3] = 1;

  for (int len = 0; len < N; len++) {
    // 最後から1番目の文字
    for (int c1 = 0; c1 < 4; c1++) {
      // 最後から2番目の文字
      for (int c2 = 0; c2 < 4; c2++) {
        // 最後から3番目の文字
        for (int c3 = 0; c3 < 4; c3++) {
          // 当てはまるものがなければスキップ
          if (dp[len][c3][c2][c1] == 0) continue;

          // 1文字足す
          for (int a = 0; a < 4; a++) {
            // AGC(012)
            if (a == 2 && c1 == 1 && c2 == 0) continue;
            // GAC(102)
            if (a == 2 && c1 == 0 && c2 == 1) continue;
            // ACG(021)
            if (a == 1 && c1 == 2 && c2 == 0) continue;
            // AxGC(0x12)
            if (a == 2 && c1 == 1 && c3 == 0) continue;
            // AGxC(01x2)
            if (a == 2 && c2 == 1 && c3 == 0) continue;

            dp[len + 1][c2][c1][a] += dp[len][c3][c2][c1];
            dp[len + 1][c2][c1][a] %= mod;
          }
        }
      }
    }
  }

  int ans = 0;
  // 最後から1番目の文字
  for (int c1 = 0; c1 < 4; c1++) {
    // 最後から2番目の文字
    for (int c2 = 0; c2 < 4; c2++) {
      // 最後から3番目の文字
      for (int c3 = 0; c3 < 4; c3++) {
        ans += dp[N][c3][c2][c1];
        ans %= mod;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
s=list(input())
s=s[::-1]
l=len(s)
mod=2019
count=[0]*2019
count[0]=1
num=0
seki=1
for i in range(l):
    num+=int(s[i])*seki
    num=num%mod
    count[num]+=1
    seki=(seki*10)%mod
ans=0
for i in range(2019):
    N=count[i]
    ans+=N*(N-1)//2
print(ans)

Measured memory_bytes: 79216
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String str1 = scan.nextLine();
        String str2[] = new String[str1.length()];
        boolean flag = true;
        for(int i = 0 ; i < str1.length() ; i++){
            str2[i] = str1.substring(i,i+1);
            if (i % 2 == 0 && !str1.substring(i,i+1).equals("R") && !str1.substring(i,i+1).equals("U") && !str1.substring(i,i+1).equals("D")){
                flag = false;
            } 
            else if(i % 2 == 1 && !str1.substring(i,i+1).equals("L") && !str1.substring(i,i+1).equals("U") && !str1.substring(i,i+1).equals("D")){
                flag = false;
            }
        }
        if(flag){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
    }
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){//yがいくつ集まったらx以上になるか
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	ll A,B,C,D; cin>>A>>B>>C>>D;
	cout<<(A*B>C*D?A*B:C*D);
}

Measured memory_bytes: 256
N,*A=*$<;p A.count{|x|c=*0..N.to_i;r=->a{a==c[a]?a:r[c[a]=c[c[a]]]};(A-[x]).map{|s|eval"c[r[%d]]=%d"%s.split};(c.map(&r)|[])[2]}

Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>

using namespace std;

#define rep(i,n) for(int i=0;i<n;++i)

int main(){
	string a, b;
	cin >> a >> b;
	bool flg=false;
	rep(i, a.size()){
		a = a[a.size()-1] + a.substr(0, a.size() - 1);
		flg |= a == b;
	}

		if (flg)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;


}

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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){
	ll n, i, ans = 0;
	cin >> n;
	rep(i,0,n+1){
		if(i%3 and i%5)
			ans += i;
	}
	cout << ans << nl;
}

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input1.txt","r",stdin);
//    freopen("output1.txt","w",stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    ll t = 1;
//	 cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<algorithm>
using namespace std; 
struct f{
	int a,b;
}a[1000000];
bool cmp(f d,f e)
{
	return d.b<e.b;
}
int main()
{
	 int n,i,p=0;
	 scanf("%d",&n);
	 for(i=0;i<n;i++)
	 {
	 	scanf("%d%d",&a[i].a,&a[i].b);
	 }
	 sort(a,a+n,cmp);
	 long long int s=0;
	 for(i=0;i<n;i++)
	 {
	 	s+=a[i].a;
	 	if(s>a[i].b)
	 	{
		 p=1;
		 break;
		}
     }
     if(p==0)
     printf("Yes\n");
     else
     printf("No\n"); 
	 
}

Measured memory_bytes: 1664
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define gcd __gcd
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define mp make_pair
#define pb push_back
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define sbits(a) __builtin_popcount(a)
#define lcm(a, b) ((a * b) / gcd(a, b))
#define nani(x) cerr << #x << " is " << x << endl;
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000000
#define mod 1000000007

typedef long long ll;

const int N = 1e5 + 5;

int A[N];

int main()
{
    fast;

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

    ll n;
    cin >> n;
    ll ans = inf;

    for (ll i = 1; i * i <= n; i++) 
        if (n % i == 0)
            smin(ans, i + (n / i));
    

    cout << ans - 2;

    return 0;
}


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

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

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

bool chkmax(int &x,int y){return x<y?x=y,true:false;}
bool chkmin(int &x,int y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int cys=998244353;
int n,tot,pcnt; ll ans=0;
int c[200005],lst[200005],prm[200005],mu[200005];
ll k[200005];
bool notp[200005];
char s[200005];

ll mod(ll x){return x>=cys?x-cys:x;}

ll check(ll x){
	ll now=0,cnt=0;
	for(int i=1;i<=x;i++) now=mod(now*2+s[i]-'0');
	cnt=now;
	int fl=0;
	for(int i=x+1,t=1;i<=n;i+=x,t++){
		for(int j=1;j<=x;j++){
			if(s[i+j-1]>((s[j]-'0')^(t&1))+'0') fl=2;
			else if(s[i+j-1]<((s[j]-'0')^(t&1))+'0') fl=1;
			if(fl>0) break;
		}
		if(fl==2) cnt++;
		if(fl>0) break;
	}
	if(!fl) cnt++;
//	cout<<"check "<<x<<' '<<cnt<<endl;
	return cnt;
}

void getprime(){
	notp[1]=mu[1]=1;
	for(int i=2;i<=n;i++){
		if(!notp[i]) prm[++pcnt]=i,mu[i]=-1;
		for(int j=1;j<=pcnt&&i*prm[j]<=n;j++){
			notp[i*prm[j]]=1;
			if(i%prm[j]==0){
				mu[i*prm[j]]=0;
				break;
			}
			mu[i*prm[j]]=-mu[i];
		}
	}
}

int main(){
	n=readint();
	getprime();
	scanf("%s",s+1);
	for(int i=1;i<=sqrt(n);i++){
		if(n%i==0){
			if(i&1) c[++tot]=n/i;
			if(i*i==n) continue;
			if((n/i)&1) c[++tot]=i;
		}
	}
	sort(c+1,c+tot+1);
	for(int i=tot;i>=1;i--) k[i]=check(c[i]);
	for(int i=tot;i>=1;i--){
		for(int j=1;j<i;j++) if(c[i]%c[j]==0) k[i]=(k[i]+mu[c[i]/c[j]]*k[j])%cys;
		k[i]=mod(k[i]+cys);
		ans=mod(ans+1ll*k[i]*mod(c[i]<<1)%cys);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2816
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>
#include <bitset>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

template<class T>
inline bool chmin(T &a, const T b) { return a > b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int H, W;
	cin >> H >> W;

	vector<vector<int>> A(H, vector<int>(W));
	vector<vector<int>> B(H, vector<int>(W));
	for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> A[i][j];
	for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> B[i][j];

	const int offset = 6500;
	vector<vector<bitset<offset * 2 + 1>>> dp(H, vector<bitset<offset * 2 + 1>>(W + 1));
	dp[0][0][offset] = 1;
	for (int i = 0; i < H; i++) {

		for (int j = 0; j < W; j++) {

			for (int k = 0; k <= 2 * offset; k++) {

				if (0 <= k + A[i][j] - B[i][j] && k + A[i][j] - B[i][j] <= 2 * offset) {
					dp[i][j + 1][k] = dp[i][j + 1][k] | dp[i][j][k + A[i][j] - B[i][j]];
				}
				if (0 <= k - A[i][j] + B[i][j] && k - A[i][j] + B[i][j] <= 2 * offset) {
					dp[i][j + 1][k] = dp[i][j + 1][k] | dp[i][j][k - A[i][j] + B[i][j]];
				}
				
			}

		}
		DMP(dp);

		if (i == H - 1) break;
		for (int j = 1; j <= W; j++) {
			for (int k = 0; k <= 2 * offset; k++) {
				if (0 <= k + A[i + 1][j - 1] - B[i + 1][j - 1] && k + A[i + 1][j - 1] - B[i + 1][j - 1] <= 2 * offset) {
					dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i][j][k + A[i + 1][j - 1] - B[i + 1][j - 1]];
				}
				if (0 <= k - A[i + 1][j - 1] + B[i + 1][j - 1] && k - A[i + 1][j - 1] + B[i + 1][j - 1] <= 2 * offset) {
					dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i][j][k - A[i + 1][j - 1] + B[i + 1][j - 1]];
				}
			}
		}

		DMP(dp);

	}

	int ans = INF;
	for (int i = 0; i <= 2 * offset; i++) {
		if(dp[H - 1][W][i]) chmin(ans, abs(i - offset));
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 12924
function Main(input) {
    input = input.split(" ").map(Number);
    var sum = 0;
    for(var i=Math.min(input[0],input[1]);true;i--){
        if(input[0]%i==0&&input[1]%i==0) sum++;
        if(sum == input[2]){
            console.log(i);
            break;
        }
    }
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
//BELIEVE IN YOURSELF
//next_permutation

#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pob pop_back
#define vi vector<ll>
#define mp make_pair
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define maxx 2*100005
#define se second
#define fi first
#define be begin()
#define en end()
#define sortv(v) sort(v.begin(),v.end());
#define w() ll _;cin>>_;while(_--)
#define edge pair<ll,ll>
#define pq priority_queue<ll>
#define mod 1000000007
#define Endl "\n"
#define cy cout<<"YES"<<endl;
#define cn cout<<"NO"<<endl;
#define lb(v,x) std::lower_bound(v.begin(),v.end(),x)
#define ub(v,x) std::upper_bound(v.begin(),v.end(),x)

using namespace std;


vector<ll> prime_factors(ll n)
{
		vector<ll>ans;
	if(n==0 || n==1)
	{
		return ans;
	}
	ll x=n;
	ll i;
	for(i=2;i*i<=x;i++)
	{
		if(n%i==0)
		{
			ans.pb(i);
			while(n%i==0)
			{
				n/=i;
			}
		}
		if(n==1)
		{
			break;
		}
	}
	if(n!=1)
	{
		ans.pb(n);
	}
	return ans;
	
}


 
int main()
{
	fast;
	ll n;
	cin>>n;
	ll a[n];
	
	ll i;
	
	set<ll>s;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	ll fuck=0;
	
	vector<vector<ll> >pri;
	
	for(i=0;i<n;i++)
	{
		 pri.pb(prime_factors(a[i]));
		 for(ll j=0;j<pri[i].size();j++)
		 {
		 	if(s.count(pri[i][j]))
		 	{
		 		fuck++;
		 		break;
		 	}
		 	else
		 	{
		 		s.insert(pri[i][j]);
		 	}
		 }
		 if(fuck)
		 {
		 	break;
		 }
	}
	
	if(fuck)
	{
		ll x=0;
		for(i=0;i<n;i++)
		{
			x=__gcd(x,a[i]);
		}
		if(x==1)
		{
			cout<<"setwise coprime"<<endl;
		}
		else
		{
			cout<<"not coprime"<<endl;
		}
	}
	else
	{
		cout<<"pairwise coprime"<<endl;
	}
	
	
		
	return 0;
}
     
 
     

Measured memory_bytes: 35500
#include <stdio.h>
#include <string.h>
#include "math.h"
#include <stdlib.h>


struct Person {
  int x;
  int y;
};


int compare_person_id(const void *a, const void *b) {
  struct Person *A = (struct Person *)a;
  struct Person *B = (struct Person *)b;
  return A->x - B->x;
}


int main() {
  int i;
  char s[101];
  int N;
  scanf("%d", &N);

  struct Person p[N];

  for(i=0; i<=N-1; i++){
    scanf("%d ", &p[i].x);
    p[i].y = i;
  }


  qsort(p, N, sizeof(struct Person), compare_person_id);
  for(i=0; i<=N-1; i++){
    printf("%d ", p[i].y + 1);
  }
  printf("\n");

}


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
using namespace std;
 
 ll mod=1e9 +7;
 
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

const ll M=200006;
ll f[M],inv[M];

void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2,mod);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

bool compare(vector<ll>&a,vector<ll>&b)
{
  return a[3]>b[3];
}

ll n,m;
vector<vector<ll>>vv;
void generate(vector<ll>&cur,ll start)
{
  if(cur.size()==n) {vv.pb(cur);return;}
  for(ll i=start;i<=m;i++)
  {
    cur.pb(i);
    generate(cur,i);
    cur.pop_back();
  }
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // compute();
    // Sieve();
    
   ll tests=1;
  // cin>>tests;
    while(tests--)
    {
      ll i,j,q;
      cin>>n>>m>>q;
      vector<vector<ll>>v(q,vector<ll>(4));
      for(i=0;i<q;i++)
      {
        cin>>v[i][0]>>v[i][1]>>v[i][2]>>v[i][3];
      }
      vector<ll>cur;
      for(i=1;i<=m;i++)
      {
        generate(cur,i);
      }

      ll global=0;
      ll ans=0;
      for(auto z:vv)
      {
        ans=0;
        for(i=0;i<q;i++)
        {
          ll a,b,c,d;
          a=v[i][0];b=v[i][1];
          c=v[i][2];d=v[i][3];
          if(z[b-1]-z[a-1]==c) ans+=d;
        }
        global=max(global,ans);
      }
      cout<<global;

    }
    return 0;
   }

Measured memory_bytes: 33952
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  vector<int> B(N);
  for( int i = 0; i < N; i++ ) cin >> A.at(i) >> B.at(i);
  
  int ans = 0;
  for( int i = N-1; i >= 0; i-- ){
    if( (A.at(i)+ans) % B.at(i) > 0 ){
      ans += B.at(i) - ( (A.at(i)+ans) % B.at(i) );
    }
  }
  cout << ans << endl;
      
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int []a = new int [n];
		int []b = new int [n];
		
		long asum = 0;
		long bsum = 0;
		
		for(int i = 0  ; i < n ; i++) {
			a[i] = Integer.parseInt(sc.next());
			asum += (long)a[i];
		}
		for(int i = 0 ;i < n ;i++) {
			b[i] = Integer.parseInt(sc.next());
			bsum += (long)b[i];
		}
		
		long cnt = bsum - asum;
		if(cnt < 0) {
			System.out.println("No");
			return;
		}
		
		long acnt = 0;
		long bcnt = 0;
		
		for(int i = 0 ; i < n ;i++) {
			if(a[i] > b[i]) {
				acnt += (long)a[i] - b[i];
			}
			else {
				bcnt += (long)(b[i] - a[i])/2;
			}
		}
	//	System.out.println(cnt +" "+acnt+" "+bcnt);
		if(acnt <= bcnt) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}

}


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

long long n, sum = 0;

int main() {
  cin >> n;
  long long now = 1;
  while (now <= n) {
    if (now % 3 != 0 && now % 5 != 0) {
      sum += now;
    }
    ++now;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3600
s=input()
count=0
if s[0]=='R' and s[1]=='R' and s[2]=='R':
    print('3')
if s[0]=='R' and s[1]=='R' and s[2]=='S':
    print('2')
if s[0]=='R' and s[1]=='S' and s[2]=='R':
    print('1')
if s[0]=='S' and s[1]=='R' and s[2]=='R':
    print('2')
if s[0]=='R' and s[1]=='S' and s[2]=='S':
    print('1')
if s[0]=='S' and s[1]=='R' and s[2]=='S':
    print('1')
if s[0]=='S' and s[1]=='S' and s[2]=='R':
    print('1')
if s[0]=='S' and s[1]=='S' and s[2]=='S':
    print('0')





Measured memory_bytes: 9164
// AtCoder template
// sabaより胡蝶しのぶさんの方が可愛いのではないか？
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)


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

    int n; cin >> n;
    int l, lmax = 0, lsum = 0; rep(i,n){
        cin >> l;
        lmax = max(lmax, l);
        lsum += l;
    }
    if(lsum > 2*lmax) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while(true){
            int H =sc.nextInt();
            int W =sc.nextInt();
            if(H==0 && W==0){
                break;
            }
            for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    System.out.printf("#");
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
    }
}


Measured memory_bytes: 60648
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n, m, k = map(int, input().split())
    fgraph = [list() for i in range(n)]
    bgraph = [list() for i in range(n)]
    cgraph = [list() for i in range(n)]
    
    rks = [None] *n
    sys.setrecursionlimit(10**9)
    # r: どの連結成分に存在するかをメモするid
    def dfs(graph,s,r):
        if rks[s] is None:
            rks[s] = r
        for i in range(len(graph[s])):
            if rks[graph[s][i]-1] is not None:
                continue
            dfs(graph, graph[s][i]-1,r)

    for i in range(m):
        a,b = map(int, input().split())
        fgraph[a-1].append(b)
        fgraph[b-1].append(a)

    # print(fgraph)
    #print(bgraph)
    # 連結成分に対してid的なindexをつける
    c = -1
    for i in range(n):
        if rks[i] is None:
            c += 1
            dfs(fgraph, i, c)
    
    for i in range(k):
        c,d = map(int, input().split())
        if rks[c-1] == rks[d-1]:
            bgraph[d-1].append(c)
            bgraph[c-1].append(d)

    counter = Counter(rks)
    for i in range(n):
        # counter[rks[i]] 連結成分のサイズ
        # len(fgraph[i]) 友達の数
        # len(bgraph[i]) 連結成分内のブロックの数
        # 1 自分
        print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 66768
// abc132c.cpp : Divide the Problems
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;

#define rep(i,n) for(int i=0;i<(n);i++)
#define upto(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define in(x) cin>>(x)
#define oute(x) cout<<(x)<<endl

#define DMAX 100000

int main(){
  int N; in(N);

  vi D(DMAX+1);
  int c,d,dmax=0;
  rep(i,N){
    in(d); D[d]++;
    dmax = max(dmax, d);
  }

  c=d=0;
  upto(i,1,dmax+1,1){
    if(d<N/2){
      d+=D[i];
      c = 0;
    }else{
      if(d>N/2) break;
      if(D[i]==0) c++; else{ c++; break; }
    }
  }
  oute(c);

}

Measured memory_bytes: 640
#include <stdio.h>
#define N 100

int m[101][101], p[101], n;

void matrixChain()
{
    int i, j, k, l;
    
    for (i = 1; i <= n; i++){
        m[i][i] = 0;
    }
    
    for (l = 2; l <= n; l++){
        for (i = 1; i <= n - l + 1; i++){
            j = i + l - 1;
            m[i][j] = 100000000;
            for (k = i; k < j; k++){
                if (m[i][j] > m[i][k] + m[k + 1][j] + p[i - 1]*p[k]*p[j])
                    m[i][j] = m[i][k] + m[k + 1][j] + p[i - 1]*p[k]*p[j];
            }
        }
    }
}

int main()
{
    int i;
    
    scanf("%d", &n);
    for (i = 1; i <= n; i++){
        scanf("%d %d", &p[i-1], &p[i]);
    }
    
    matrixChain();
    
    printf("%d\n", m[1][n]);
    
    return 0;
}


Measured memory_bytes: 2096
def resolve():
    import itertools
    n, m, q = map(int, input().split())
    cond = [list(map(int, input().split())) for _ in range(q)]
    ans = 0
    for i in itertools.combinations_with_replacement(range(1, m+1), n):
        point = 0
        for j in range(q):
            if i[cond[j][1]-1] - i[cond[j][0]-1] == cond[j][2]:
                point += cond[j][3]
        ans = max(ans, point)
    print(ans)
resolve()

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

int main()
{
    int R, C; cin >> R >> C;

    auto stones = 0;
    for (auto r = 0; r < R; r++) for (auto c = 0; c < C; c++)
    {
        char ch; cin >> ch;
        stones += ch == '#';
    }

    cout << (stones == R+C-1 ? "Possible" : "Impossible") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb emplace_back
#define mp make_pair
#define MOD (int) 1e9+7
#define for0(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define endl "\n"
#define bits(n) __builtin_popcount(n)
#define ini(a, i) memset(a, i, sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	// cin >> t;
	t  = 1;
	while (t--)
	{
		ll n;
		cin >> n;
		if (n >= 400 && n <= 599)
			cout << "8" << endl;
		else if (n >= 600 && n <= 799)
			cout << "7" << endl;
		else if (n >= 800 && n <= 999)
			cout << "6" << endl;
		else if (n >= 1000 && n <= 1199)
			cout << "5" << endl;
		else if (n >= 1200 && n <= 1399)
			cout << "4" << endl;
		else if (n >= 1400 && n <= 1599)
			cout << "3" << endl;
		else if (n >= 1600 && n <= 1799)
			cout << "2" << endl;
		else if (n >= 1800 && n <= 1999)
			cout << "1" << endl;
	}
	return 0;
}


Measured memory_bytes: 3608