akhauriyash/Code-Regression huggingface dataset:
//Author : Sidiq Tri Pratikto
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(v) v.begin(), v.end()

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
//order_of_key(x) = number of elements stricly smaller than x
//find_by_order(x) = return x-th largest element
typedef long long LL;
const LL MOD = 1e9 + 7;
const double PI = 2 * acos(0);
vector<pair<int, pair<int, LL> > > adjlist[55];
int C[55], D[55];

int main() {
	int N, M, S, uang = 0;
	scanf("%d%d%d", &N, &M, &S);
	for (int i = 0; i < M; i++) {
		int u, v, a, b;
		scanf("%d%d%d%d", &u, &v, &a, &b);
		adjlist[u].pb(mp(v, mp(a, b)));
		adjlist[v].pb(mp(u, mp(a, b)));
		uang += a;
	}
	for (int i = 1; i <= N; i++) {
		scanf("%d%d", &C[i], &D[i]);
	}
	if (S >= uang) {
		priority_queue<pair<LL, int> > pq;
		LL dist[N + 1];
		for (int i = 2; i <= N; i++) dist[i] = 1e14;
		pq.push(mp(0, 1));
		dist[1] = 0;
		while (!pq.empty()) {
			LL val = -pq.top().fi;
			int nod = pq.top().se;
			pq.pop();
			if (dist[nod] < val) continue;
			for (auto i : adjlist[nod]) {
				int ttg = i.fi;
				int x = i.se.se;
				if (dist[ttg] > dist[nod] + x) {
					dist[ttg] = dist[nod] + x;
					pq.push(mp(dist[ttg], ttg));
				}
			}
		}
		for (int i = 2; i <= N; i++) {
			printf("%lld\n", dist[i]);
		}
	} else {
		priority_queue<pair<LL, pair<int, int> > > pq;
		LL dist[N + 1][uang + 5];
		for (int i = 1; i <= N; i++) {
			for (int j = 0; j <= uang; j++) {
				dist[i][j] = 1e16;
			}
		}
		pq.push(mp(0, mp(S, 1)));
		dist[1][S] = 0;
		while (!pq.empty()) {
			LL val = -pq.top().fi;
			int duit = pq.top().se.fi;
			int nod = pq.top().se.se;
			//printf("jejak %lld %d %d\n", val, duit, nod);
			pq.pop();
			if (dist[nod][duit] < val) continue;
			//tukar uang
			if (duit < uang) {
				int duit2 = duit + C[nod];
				duit2 = min(duit2, uang);
				LL val2 = val + D[nod];
				if (dist[nod][duit2] > val2) {
					dist[nod][duit2] = val2;
					pq.push(mp(-val2, mp(duit2, nod)));
				}
			}
			//jalan
			for (auto i : adjlist[nod]) {
				int ttg = i.fi;
				int x = i.se.se;
				if (duit >= i.se.fi && dist[ttg][duit - i.se.fi] > val + x) {
					dist[ttg][duit - i.se.fi] = val + x;
					pq.push(mp(-dist[ttg][duit - i.se.fi], mp(duit - i.se.fi, ttg)));
				}
			}
		}
		for (int i = 2; i <= N; i++) {
			LL mini = dist[i][0];
			for (int j = 1; j <= uang; j++) mini = min(mini, dist[i][j]);
			printf("%lld\n", mini);
		}
	}
}

Measured memory_bytes: 6232
//#pragma GCC         optimize("O3")
#include            <bits/stdc++.h>
#include            <ext/pb_ds/assoc_container.hpp>
#include            <ext/pb_ds/tree_policy.hpp>
#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define mp          make_pair
#define mem(x,i)    memset(x,i,sizeof(x))
#define ff          first
#define ss          second
#define popcount(x) __builtin_popcount(x)
#define all(x)      x.begin(),x.end()
#define Case(t)     for(int ks=1;ks<=t;ks++)
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define D(x)        cerr<< __LINE__ <<": "<< #x << " = "<<(x) <<'\n';
#define endl        '\n'

using namespace std;
using namespace __gnu_pbds;

using ll  = long long;
using ld  = long double;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;

const int INF    = 0x3f3f3f3f;
const ll LL_INF  = 0x3f3f3f3f3f3f3f3f;
const double PI  = acos(-1);
const double eps = 1e-4;
const int mod    = 1e9+7;
const int mx     = 1e5+5;
template <typename T>  using orderedSet =
    tree<T, null_type, less_equal<T>,
    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key*/

/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

//ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(; b; b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
/*----------------------BitMask-----------------------------------------*/
//inline int setBit(int N,int pos){return N=N | (1<<pos);}
//inline int resetBit(int N,int pos){return N= N & ~(1<<pos);}
//inline bool checkBit(int N,int pos){return (bool) (N& (1<<pos));}


int main()
{
    string s,t;
    cin>>s>>t;
    int ans=0;
    for(int i=0,n=s.size();i<n;i++)
        if(s[i]!=t[i]) ans++;
    cout<<ans<<endl;
}


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

int main(void){
  int n,ans=0;
  cin >> n;
  
  for (int i=1; i<=n; i+=2){
    int cnt=1;
    for (int j=1; j<i; j++){
      if (i%j==0) cnt++;
    }
    //cout << cnt << endl;
    if (cnt==8) ans++;
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 256
N, M = map(int, input().split())
a = set(int(input()) for _ in range(M))
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
    dp[1] = 1

for i in range(2, N + 1):
    if i - 2 not in a:
        dp[i] += dp[i-2]
    if i - 1 not in a:
        dp[i] += dp[i-1]
    dp[i] %= 1000000007

print(dp[N])


Measured memory_bytes: 58200
#include <stdio.h>
#define S_MAX 100000
#define T_MAX 50000

int main(){
  int ns,nt,i,j,mid,count = 0;
  int s[S_MAX],t[T_MAX];

  scanf("%d" ,&ns);
  for(i = 0; i < ns; i++){
    scanf("%d", &s[i]);
  }

  mid = s[ns/2];

  scanf("%d" ,&nt);
  for(i = 0; i < nt; i++){
    scanf("%d", &t[i]);
  }

  j = 0;
  for(i = 0; i < nt; i++){
    if(t[i] < mid){
      for(j = 0; j < ns; j++){
        if(s[j] == t[i]){
          count++;
          break;
        }
      }
    }else{
      for(j = ns; j >= 0; j--){
        if(s[j] == t[i]){
          count++;
          break;
        }
      }
    }
  }

  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

void solve() {
    int n;
    scanf("%d", &n);
    int d[n];
    rep(i, n) scanf("%d", &d[i]);
    int ans = 0;
    rep(i, n) repeat(j, i + 1, n) {
        ans += d[i] * d[j];
    }
    printf("%d\n", ans);
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int mod;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n >> mod;
    vector<int> a(n), sum(n+1);
    rep(i, n) {
        cin >> a[i];
        sum[i+1] = sum[i] + a[i] - 1;
        sum[i+1] %= mod;
    }

    //rep(i, n) cout << sum[i+1] << (i == n-1?'\n':' ');

    unordered_map<int, int> mp;
    ll ans = 0;
    vector<int> check(n);
    rep(i, n) {
        check[i] = sum[i];
        mp[sum[i]]++;
        if(i >= mod-1) {
            mp[check[i-mod+1]]--;
        }
        ans += mp[sum[i+1]];
    }

    cout << ans << endl;
}

Measured memory_bytes: 13752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<int> A(N),B(N),L(N+1),R(N+1);
    for(int i=0;i<N;i++){
        cin >> A[i];
        L[i+1] = L[i]+A[i];
    }
    for(int i=0;i<N;i++) cin >> B[i];
    for(int i=N-1;i>=0;i--){
        R[i] = R[i+1]+B[i];
    }
    int ans = 0;
    for(int i=0;i<N;i++){
        ans = max(ans,L[i+1]+R[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();
		int x=sc.nextInt();
		int p1,p2,p3;
		int cnt=0;
		while(n!=0 || x!=0){
			for(p1=1;p1<=n;p1++){
				for(p2=(p1+1);p2<=n;p2++){
					if(((p1+p2)>=x) ||(p1==p2)) break;
					for(p3=(p2+1);p3<=n;p3++){
						if(((p1+p2+p3)>x)||(p2==p3)){
							break;
						}else if((p1+p2+p3)==x){
							cnt++;
						}
					}//for	
				}//for
			}//for
			System.out.println(cnt);
			cnt=0;
			n=sc.nextInt();
			x=sc.nextInt();
		}//while
	}
}

Measured memory_bytes: 19748
#include <iostream>
#include <string>
#include <stack>
#include <sstream>

using namespace std;

static bool isOperator(const string& st) {
  return st[0] == '+' || st[0] == '-' || st[0] == '*' || st[0] == '/';
}

int main() {
  stack<string> st;
  string  in, op1, op2, op, line, elem;
  int op1_i, op2_i, ans;
  
  // input line.
  getline(cin, line);
  stringstream ss(line);
  
  // sprit.
  while (getline(ss, line, ' ')) {
    st.push(line);
    elem = st.top();
    if (isOperator(elem)) {
      op = st.top();
      st.pop();
      op2 = st.top();
      st.pop();
      op1 = st.top();
      st.pop();
      op1_i = stoi(op1);
      op2_i = stoi(op2);
      
      switch (op[0]) {
      case '+':
         ans = op1_i + op2_i;
         break;
      case '-':
         ans = op1_i - op2_i;
         break;
      case '*':
         ans = op1_i * op2_i;
         break;
      case '/':
         ans = op1_i / op2_i;
         break;
      }
      st.push(to_string(ans));
    }
  }
  cout << st.top() << endl;
  return 0;
}



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


int main()
{
	char a[1200];
	cin.getline(a, 1200);
	for (int i = 0;i < 1200;i++) {
		if ('a' <= a[i] && a[i] <= 'z') {
			a[i] = a[i] -32;
		}
		 else if ('A' <= a[i] && a[i] <= 'Z') {
			a[i] = a[i] + 32;
		}
	}
	cout << a << endl;
    return 0;
}



Measured memory_bytes: 3096
//بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيم

#include <bits/stdc++.h>
using namespace std;

typedef  long long i64;
#define el cout << '\n';
#define lcm(a, b) a / __gcd(a, b) * b
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define max(a,b,c) max(max(a,b),max(a,c))

template <class... Args>auto &see(const Args &... args){return ((cerr << " " << args), ...) << '\n';}
#define bug(...)   cerr << "[ " #__VA_ARGS__ " ] = "; see(__VA_ARGS__) << '\n';



void solve(){
    
    int n  ; i64 s = 0; cin >> n ;
  
    for (int i = 1; i <= n; i++)
    {
      if(i%3 == 0 || i % 5 == 0) continue ; s += i ;
       
    }

    cout << s ; el
    


}






int main()
{
  int t = 1, n ,m ; solve() ;
 
  

}
                            

Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int K, A, B;

void load(void);
void output(void);

int main(void){
	load();
	output();
}

void load(void){
	cin >> K >> A >> B;
}

void output(void){
	unsigned int i = 0, j = 0;
	for(i = 0;i < 1000;i++){
    	if(K*i >= A && K*i <= B){
        	j++;
        }
    }
	if(j != 0){
    	cout << "OK";
    }else{
    	cout << "NG";
    }
}

Measured memory_bytes: 3636
import numpy as np
N = int(input())
A = np.array([int(x) for x in input().split()])
B = np.array([int(x) for x in input().split()])
I = B.argsort()
A = A[I]
B = B[I]
calc = max(A) <= max(B)
if not calc:
    print("No")
    exit(0)
if any(np.sort(A)[1:] <= B[:-1]):
    print('Yes')
    exit()
p = A.argsort().tolist()
x = 0
c = 0
while True:
    c += 1
    x = p[x]
    if x == 0:
        break
print("Yes" if c != N else "No")


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

 bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }

 signed main(){
 int x;
 cin>>x;

 int p=x;
 while(!is_prime(p)) p++;

 cout<<p<<endl;
 return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
using namespace std;
int n,num,maxn,minn;
int a[100001];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+1+n);
    minn=a[1],maxn=a[n];
    if(minn<maxn-1||maxn>=n) {cout<<"No";return 0;}
    if(maxn==minn) 
    {
        if(minn+1==n) cout<<"Yes";
        else
        {
            if(minn*2>n) cout<<"No";
            else cout<<"Yes";
        }
        return 0;
    }
    for(int i=1;i<=n;i++) if(a[i]==minn) num++;
    n-=num; maxn-=num;
    if(minn<num) cout<<"No";
    else if(maxn*2>n) cout<<"No";
    else cout<<"Yes";
    return 0;
}

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

using namespace std;

int main()
{
    int N;
    while (cin >> N, N) {
        vector<int> a(N), b(N);
        for (int i = 0; i < N; i++) {
            cin >> a[i];
        }
        for (int i = 0; i < N; i++) {
            cin >> b[i];
        }
        
        sort(a.rbegin(), a.rend());
        sort(b.rbegin(), b.rend());
        
        bool found = 0;
        int aw = 0, bw = 0, bidx = 0;
        for (int i = 0; i < N-1; i++) {
            if (a[i] > b[bidx]) {
                aw++;
            } else {
                bw++;
                bidx++;
            }
            if (aw > bw) {
                found = 1;
                cout << i+1 << endl;
                break;
            }
        }
        if (!found) {
            cout << "NA" << endl;
        }
    }        
    return 0;
}

Measured memory_bytes: 1436
#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;
    if(s[0]==s[1] && s[1]==s[2]){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

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

int main(){
    int ans=0,m=10;
    for(int i=0;i<5;i++){
        int a; cin>>a;
        if(a%10!=0){
            ans+=(a/10+1)*10;
            m=min(m,a%10);
        }else{
            ans+=a;
        }
    }
    if(m!=10)ans-=(10-m);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  char s[3];
  int sum=700;
  scanf("%s",s);
  for(int i=0;i<3;i++){
    if(s[i]=='o'){
      sum+=100;
    }
  }
  printf("%d",sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;


const double EPS = 1e-6;
const double PI = acos(-1.0);

struct PT {
  ll x, y;
  int id;
  PT() {}
  PT(ll x_, ll y_): x(x_), y(y_), id(-1) {}
  ll len2() const {
    return x * x + y * y;
  }
  double len() const {
    return sqrt(len2());
  }
  PT operator - (const PT &b) const {
    return PT(x - b.x, y - b.y);
  }
  ll operator * (const PT &b) const {
    return x * b.x + y * b.y;
  }
  ll operator % (const PT &b) const {
    return x * b.y - y * b.x;
  }
  bool operator < (const PT &b) const {
    return tie(x, y) < tie(b.x, b.y);
  }
};

const int MAXN = 123;
PT in[MAXN];
double ans[MAXN];

int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    in[i].x = x;
    in[i].y = y;
    in[i].id = i;
  }
  sort(in, in + N);
  vector<PT> st;
  for (int i = 0; i < N; i++) {
    while (SZ(st) >= 2 && (st[SZ(st) - 1] - st[SZ(st) - 2]) % (in[i] - st[SZ(st) - 1]) < 0)
      st.pop_back();
    st.PB(in[i]);
  }
  for (int i = N - 2; i >= 0; i--) {
    while (SZ(st) >= 2 && (st[SZ(st) - 1] - st[SZ(st) - 2]) % (in[i] - st[SZ(st) - 1]) < 0)
      st.pop_back();
    st.PB(in[i]);
  }
  for (int i = 0; i < N; i++)
    ans[i] = 0;
  st.PB(st[1]);
  for (int i = 1; i < SZ(st) - 1; i++) {
    PT A = st[i - 1] - st[i];
    PT B = st[i + 1] - st[i];
    double tmp = A * B / (A.len() * B.len());
    //double ang = PI - acos(clamp(tmp, -1.0, 1.0)); // C++ 17 required
    double ang = PI - acos(min(max(tmp, -1.0), 1.0));
    ans[st[i].id] = ang / (2 * PI);
  }
  for (int i = 0; i < N; i++)
    printf("%.10f\n", ans[i]);
  double sum = 0;
  for (int i = 0; i < N; i++)
    sum += ans[i];
  assert(fabs(sum - 1.0) < EPS);
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
const int maxn=1e6+5;
ll t,n,a[maxn],flag,res;
map<int,int> m;
void f(int n)
{
    for(ll i=2; i*i<=n; i++)
    {
        if(n==1)
        {
            break;
        }
        if(n%i==0)
        {
            if(m[i]==0)
                m[i]++;
            else
            {
                flag=1;
                return;
            }
            while(1)
            {
                if(n%i==0)
                {
                    n/=i;
                }
                else
                {
                    break;
                }
            }
        }
    }
    if(n > 1)
    {
        if(m[n]==0)
            m[n]++;
        else
        {
            flag=1;
            return;
        }
    }
}
signed main()
{
    //IOS;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    res=a[1];
    for(int i=2; i<=n; i++)
    {
        res=gcd(res,a[i]);
        if(res!=1)
        {
            flag=1;
        }
    }
    if(res!=1)
    {
        cout<<"not coprime"<<endl;
    }
    else
    {
        for(int i=1; i<=n; i++)
        {
            f(a[i]);
            if(flag==1)
            {
                break;
            }
        }
        if(flag==1)
        {
            cout<<"setwise coprime"<<endl;
        }
        else
        {
            cout<<"pairwise coprime"<<endl;
        }
    }
    return 0;
}
/*

*/


Measured memory_bytes: 11408
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
signed main() {
	int n, q, h[1234];
	cin >> n; for (int i = 0; i < n; i++)cin >> h[i];
	cin >> q;
	for (int wq = 0; wq < q; wq++) {
		int a, b; cin >> a >> b; b--;
		while (a < b) swap(h[a++], h[b--]);
	}
	for (int i = 0; i < n; i++) {
		if (i)cout << ' ';
		cout << h[i];
	}cout << endl;
}


Measured memory_bytes: 3112
#include <iostream> 
using namespace std; 
#define int long long
void printString(int n) 
{ 
    int arr[10000]; 
    int i = 0; 

    // Step 1: Converting to number assuming 
    // 0 in number system 
    while (n) { 
        arr[i] = n % 26; 
        n = n / 26; 
        i++; 
    } 

    // Step 2: Getting rid of 0, as 0 is 
    // not part of number system 
    for (int j = 0; j < i - 1; j++) { 
        if (arr[j] <= 0) { 
            arr[j] += 26; 
            arr[j + 1] = arr[j + 1] - 1; 
        } 
    } 

    for (int j = i; j >= 0; j--) { 
        if (arr[j] > 0) 
            cout << char('a' + arr[j] - 1); 
    } 

    cout << endl; 
} 

// Driver program to test above function 
int32_t main() 
{ 
    #ifndef ONLINE_JUDGE
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
        #endif
    int n;cin>>n;
    printString(n);
} 

// This code is contributed by Ankur Goel 


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
int t[100005],x[100005],y[100005];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>t[i]>>x[i]>>y[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(int(fabs(t[i]-t[i-1]))<int(fabs(x[i]-x[i-1])+fabs(y[i]-y[i-1])))
		{
			cout<<"No";
			return 0;
		}
		if(int(fabs(t[i]-t[i-1]))%2!=int(fabs(x[i]-x[i-1])+fabs(y[i]-y[i-1]))%2)
		{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
}


Measured memory_bytes: 1408
mod = 10**9+7
n =int(input())
A = list(map(int,input().split()))
tmp = []
for i in range(n):
    tmp.append(abs(n-2*i-1))
A.sort()
tmp.sort()
for a,t in zip(A,tmp):
    if a!=t:
        print(0);exit()
from collections import Counter
from math import factorial
ans = 1
cnt_a = Counter(A)
for k,v in cnt_a.items():
    ans *= factorial(v)
    ans %=mod
print(ans)

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int64 N;
vector<int64> A;

int64 dfs(int64 l, int64 r, int64 xl, int64 xr) {
    int64 ret = INF_LL;
    if (l == r) return 0;
    FOR(i, l, r) {
        chmin(ret, (xl+xr)*A[i] + dfs(l, i, xl, xl+xr) + dfs(i+1, r, xl+xr, xr));
    }
    return ret;
}

int main(void) {
    cin >> N;
    A.resize(N);
    for (auto &x : A) cin >> x;
    cout << dfs(1, N-1, 1, 1) + A[0] + A.back() << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    ll n, m;
    cin >> n >> m;
    if (n == 1) {
        cout << max(1LL, m - 2) << endl;
        return 0;
    }
    if (m == 1) {
        cout << max(1LL, n - 2) << endl;
        return 0;
    }

    cout << max(0LL, (n - 2) * (m - 2)) << endl;

    return 0;
}


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

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

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

  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);

  ll sum = 0;
  rep(i,n) sum+=a.at(i);
  
  ll sunuke = a.at(0);
  ll arai = 0;
  ll ans = abs(sum-2*a.at(0));
  for(int i=1; i<n-1; i++){
    sunuke += a.at(i);
    arai = sum - sunuke;
    ans = min(abs(sunuke-arai), ans);
  }

  cout << ans;
}

Measured memory_bytes: 4840
#include<bits/stdc++.h>
#include <chrono>
#define ll long long
#define N 1000000007
using namespace std;
using namespace std::chrono; 

void solve()
{
    string s;
    cin>>s;
    ll ans=0;
    for(auto i:s)
        ans+=(i-'0');
    if(ans%9==0)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    for(int i=1;i<=t;++i)
    {
        //cout<<"Case #"<<i<<": ";
        solve();
        //cout<<'\n';
    }
}

Measured memory_bytes: 3680
import sys
import fractions
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int(): return int(input())

def map_int_input(): return map(int, input())

MII = map_int_input

def MII_split(): return map(int, input().split())

def MII_to_index(): return map(to_index, input())

def MII_split_to_index(): return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs(): return list(map(int, input()))

LII = list_int_inputs

def LII_split(): return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number): return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number): return [LII_split() for _ in range(rows_number)]

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B = MII_split()

print(lcm(A, B))

Measured memory_bytes: 5684
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1000000001
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
struct edge{int to,cost;};
vector<edge> G[100];
int d[100];
int N;
void dijkstra(int s){
      priority_queue<P,vector<P>,greater<P> > Q;
      REP(i,100)d[i]=INF;
      d[s]=0;
      Q.push(P(0,s));
      while(!Q.empty()){
            P p=Q.top();Q.pop();
            int v=p.second;
            if(d[v]<p.first)continue;
            REP(i,G[v].size()){
                  edge e=G[v][i];
                  if(d[e.to]>d[v]+e.cost){
                        d[e.to]=d[v]+e.cost;
                        Q.push(P(d[e.to],e.to));
                  }
            }
      }
}
int main(){
      int k;
      while(cin>>N>>k&&N&&k){
            for(int i=0;i<100;i++)G[i].clear();
            REP(i,k){
                  int x,a,b,c;
                  cin>>x;
                  if(x==0){
                        cin>>a>>b;a--;b--;
                        dijkstra(a);
                        if(d[b]>=INF)cout<<-1<<endl;
                        else cout<<d[b]<<endl;
                  }else{
                        cin>>a>>b>>c;a--;b--;
                        G[a].PB((edge){b,c});
                        G[b].PB((edge){a,c});
                  }
            }
      }
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;



int main(){FIN
    
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;

    if(s[0]=='0')k--;
    int m=0,p=0;
    vector<int>x(1,-1);
    for(int i=0;i<n;i++){
        if(k<0){
            k++;
            p++;
        }
        if(s[i]=='1' && s[i+1]=='0') k--;
        if(s[i]=='0' && s[i+1]=='1') x.push_back(i);
        m=max(m,i-x[p]);
    }
    cout<<m<<endl;
    return 0;
}

Measured memory_bytes: 768
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int A = sc.nextInt();
			final int B = sc.nextInt();
			
			if(B == 1) {
				System.out.println(0);
			}else if(B <= A) {
				System.out.println(1);
			}else {
				System.out.println(1 + ((B - A) + (A - 1) - 1) / (A - 1));
			}
			
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21204
#include<stdio.h>
int main()
{
	char a[3][3];
	int i,j;
	for(i=0;i<3;i++)
	{
		for(j=0;j<3;j++)
		{
			scanf("%c",&a[i][j]);	
		}
		getchar();
	}
	printf("%c%c%c",a[0][0],a[1][1],a[2][2]);
	return 0;
}

Measured memory_bytes: 128
/*
                                                                           __                _________
                                                                          /  \              /  ______/
                                                                         /    \            /  /
                                                                        /  __  \          /  /
                                                                       /  /  \  \         |  |
                                                                      /  /____\  \        \  \
                                                                     /  ________  \        \  \______
                                                                    /__/        \__\        \________\
	
	I_love_Hacked;
	I_hate_pretest past;
	I_love_STP
	
    coder:xxjAc
    date:2018/7/18 
		    
    I_love_Ac;
    I_hate_WA;
    I_hate_Tle;
    I_hate_RE;
    I_hate_CE;
    I_hate_Mle;
    
    I love Accepts very much;
    
    I_don't_love_I_love_zzq
	I_hate_zzq
       
    cd Desktop
    g++ xxjAc.cpp -o std
    ./std
    
    #prag\
    ma GCC optimize("Ofast")
    (O2,O3,Ofast)
*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#define ll long long 
using namespace std;
const int inf=2e9+7;
ll dp[107][307][107];
int N,W;
ll w[107],v[107];
ll go(int n,ll c,int k){
	if (n==N){
		return 0;
	}
	if (dp[n][c][k]!=-1){
		return dp[n][c][k];
	}
	ll ans=0;
	for (int i=n;i<N;i++){
		if (c+w[i]-w[0]+(k+1)*w[0]<=W){
			ans=max(ans,go(i+1,c+w[i]-w[0],k+1)+v[i]);
			/*
			if (n==0){
				cout<<ans<<endl;
			}
			*/
		}
	}
	dp[n][c][k]=ans;
	return ans;
}
int main(){
	memset(dp,-1,sizeof(dp));
	scanf("%d%d",&N,&W);
	for (int i=0;i<N;i++){
		scanf("%I64d%I64d",w+i,v+i);
	}
	printf("%I64d\n",go(0,0,0));
	return 0;
}

Measured memory_bytes: 27904
n, m = [int(i) for i in input().split()]
left = 1
right = n
for i in range(m):
	l, r = [int(j) for j in input().split()]
	left = max(left, l)
	right = min(right, r)
ret = right - left + 1 if right - left + 1 > 0 else 0
print (ret)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;

int main(){
  int n; cin >> n;
  vector<ll> dam(n);
  int x_1 = 0;  // x_1 = \sum_i^N (-1)^(i-1)*A_i
  for(int i=0; i<n; i++){
    cin >> dam[i];
    if(i%2==0){
      x_1 += dam[i];
    }else{
      x_1 -= dam[i];
    }
  }
  
  int x_prev = 0;
  for(int i=0; i<n; i++){
    if(i==0){
      x_prev = x_1;
    }else{
      x_prev = 2*dam[i-1] - x_prev;
    }
    cout << x_prev << " ";
  }
}

Measured memory_bytes: 2048
#include<iostream>
#include<set>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long li;
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define yn(i) print((i)?"Yes":"No")
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// pair 型
template<class S,class T>
std::ostream& operator<<(std::ostream& os, const pair<T,S>& p){
  cout << "(" << p.first << "," << p.second << ")";
  return os;
}

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}
// map 型
template<class S,class T>
std::ostream& operator<<(std::ostream& os, const map<S,T>& mp){
  for(const pair<S,T>& x: mp){
    cout << "[" << x.first << "]=" << x.second << " ";
  }
  return os;
}

int main(){
  int x,y; cin >>x >>y;
  print(x%y?x:-1);
}





Measured memory_bytes: 3612
import time
import  random
def main():
    start = time.time()
    for d in range(D):
        res[d] = d%26
    ma = check(res)
    
    while 1:
        idx1 = random.randint(0,D-1)
        idx2 = random.randint(0,D-1)
        if idx1==idx2:
            continue
        taihi = res[idx1]
        res[idx1] = res[idx2]
        res[idx2] = taihi
        tmp = check(res)
        if tmp > ma:
            ma = tmp
        if time.time() - start > 1.75:
            break
    return res

def check(res):
    last = [0] * 26
    score = 0
    for d in range(D):
        sd = s[d]
        score += sd[res[d]]
        last[res[d]] = d+1
        for i in range(26):
            score -= c[i]*(d+1-last[i])
    return score

if __name__ == '__main__':
    D = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for _ in range(D)]
    res = [0] * D
    ans = main()
    for val in ans:
        print(val+1)

Measured memory_bytes: 86332
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);
    	
    	int x=sc.nextInt();
    	int A=sc.nextInt();
    	int B=sc.nextInt();
    	
    	int d1=Math.abs(A-x);
    	int d2=Math.abs(B-x);
    	
    	if(d1<d2) {
    		System.out.println("A");
    	}else {
    		System.out.println("B");
    	}
    }
}


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

#define ll long long

ll max(ll a, ll b){
    
    return (a > b) ? a : b;
    
}

int main(){
 
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  
  ll res = b * d;
  res = max(res, b * c);
  res = max(res, a * c);
  res = max(res, a * d);
  
  cout << res << "\n";
  
}

Measured memory_bytes: 3656
import math

def distance(a, b):
    dx = abs(a[0]-b[0])
    dy = abs(a[1]-b[1])
    return math.sqrt(dx*dx + dy*dy)

if __name__ == '__main__':
    x1, y1, x2, y2 = map(float, input().split())
    print(distance((x1, y1), (x2, y2)))



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

int main() {
  char c;
  cin >> c;

  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  else cout << "consonant" << endl;

return 0;

}


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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using ld = long double;

template <typename T>
int sz(T &x) {
  return (int)(x.size());
}

const int inf = 1'000'000'007;

void solve() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1, x; i <= n; ++i) {
    cin >> x;
    ans += (x % 2 && i % 2);
  }
  cout << ans << "\n";
}

int main() {
  #ifndef LOCAL58
    // don't forget to remove if interactive
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
  #endif

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

  return 0;
}


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

void dump(auto peaks) {
    cout << endl;
    for(auto a : peaks) {
        cout << a << endl;
    }
    cout << endl;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> peaks(n+1);
    vector<bool> goodpeaks(n+1, true);
    for(int i=1; i<=n; i++) {
        int h;
        cin >> h;
        peaks[i] = h;
    }

    for(int i=1; i<=m; i++) {
        int a, b;
        cin >> a >> b;
        if(peaks[a] > peaks[b]) {
            goodpeaks[b]=false;
        } else if(peaks[a] < peaks[b]) {
            goodpeaks[a]=false;
        } else {
            goodpeaks[a] = goodpeaks[b] = false;
        }
    }
    int sum = 0;
    for(int i=1; i<=n; i++) {
        if(goodpeaks[i] == true) sum++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3788
n=int(input())
s=str(input())
ans=0
for i in range(n):
    k=0
    arr=[]
    for j in range(i+1):
        if(s[j] in s[i+1:] and s[j] not in arr):
            k+=1
            arr.append(s[j])
    if(k>ans):
        ans=k
print(ans)

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

bool vis[30];

char s[100005];

int main()
{
    scanf("%s",s);

    for (int i = 0;i < strlen(s);i++)
    {
        vis[s[i]-'a'] = 1;
    }

    int ans = -1;

    for (int i = 0;i <= 'z' - 'a';i++)
    {
        if (!vis[i])
        {
            ans = i;
            break;
        }
    }

    if (ans == -1)printf("None");
    else printf("%c",ans+'a');

    return 0;
}


Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

xn, yn = 0, 0
price = 0

if A >= 2*C and X > xn:
    ammount = X - xn
    price += C * X * 2
    xn += X
    yn += X

if B >= 2*C and Y > yn:
    ammount = Y - yn
    price += C * ammount * 2
    xn += ammount
    yn += ammount

if (A+B) >= 2*C and (X - xn) >= 1 and (Y - yn) >= 1:
    ammount = min(X, Y)
    price += C * ammount * 2
    xn += ammount
    yn += ammount


if X - xn >= 1:
    price += A * (X - xn)

if Y - yn >= 1:
    price += B * (Y - yn)

print(price)


# min_price = 1 << 32 
# for i in range(max(X, Y)+1):
#     xn, yn = i, i
#     price = (2*C) * i
#     price += (max(0, X - xn)) * A
#     price += (max(0, Y - yn)) * B
#     min_price = min(min_price, price)
# 
# print(min_price)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    System.out.println(n == m ? "Yes" : "No");
  }
}

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

int main(){
  int a[10],b[4]={0,0,0,0};
  for(int i=0;i<6;i++){
    cin >> a[i];
  }
  for(int i=0;i<6;i++){
    if(a[i]==1){
      b[0]+=1;
    }
    if(a[i]==2){
      b[1]+=1;
    }
    if(a[i]==3){
      b[2]+=1;
    }
    if(a[i]==4){
      b[3]+=1;
    }
    
  }
  int v=0;
  for(int i=0;i<4;i++){
    if(b[i]==0){
      v++;
    }else if(b[i]==3){
      v++;
    }
  }
  if(v>0){
    cout << "NO" << endl;
  }else{
    cout << "YES" << endl;
  }
  
} 

Measured memory_bytes: 256
import itertools

n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))

l = []
a, b,num = 0,0,0

for m in range(1,n+1):
	l.append(m)

for i in itertools.permutations(l):
	num += 1
	if i == p:
		a = num
	if i == q:
		b = num
print(abs(a-b))

Measured memory_bytes: 9156
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;cin >> n >> k;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        a[i]--;
    }
    int logk=1;
    while((1LL<<logk)<k){
        logk++;
    }
    vector<vector<int>> d(logk+1,vector<int>(n));
    rep(i,n){
        d[0][i]=a[i];
    }
    rep(i,logk){
        rep(j,n){
            d[i+1][j]=d[i][d[i][j]];
        }
    }
    int now=0;
    int cnt=0;
    while(k){
        if(k&1){
            now=d[cnt][now];
        }
        cnt++;
        k>>=1;
    }
    cout << now+1 << endl;
}

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

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

left_gcd = [0]*(n+1)
right_gcd = [0]*(n+1)
left_gcd[1] = a[0]
right_gcd[1] = a[-1]

for i in range(1,n):
    left_gcd[i+1] = gcd(left_gcd[i],a[i])
    right_gcd[i+1] = gcd(right_gcd[i],a[-1-i])

ans = right_gcd[n-1]
for i in range(n):
    ans = max(ans,gcd(left_gcd[i],right_gcd[n-1-i]))
print(ans)


Measured memory_bytes: 14428
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long long int
#define ld long double
#define f(t) for(ll i =0;i<t;i++)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define inf 4e18
#define EPS 1e-3
#define PI 3.1415926535897932385
#define display(v) f(v.size())cout << v[i]<<" "
const double h = 1e-6;
const int MAX_  = 200005;
#define all(v) v.begin(),v.end()

inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > MOD) c -= MOD; return c; }
ll sqr(ll x)
{
    return x*x;
}
 //////////////////////*********CODE***********/////////////////////
 //////////////////////////////////////////////////////////////////


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   int n,x;  cin>>n>>x;
   vi v(n+1,0);  f(n)cin>>v[i+1];
   int jm = 1;
   for(int i =1;i<=n;i++){
       v[i]+=v[i-1];
       if(v[i] <= x)jm++;
   }cout << jm;
   
   
    return 0;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    // Your code here!
  int x,y;
  while(1){
      cin>>x>>y;
      if(x==0&&y==0){
          break;
      }
      cout<<min(x,y)<<" "<<max(x,y)<<endl;
  }
}  




Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;
const int mod1=998244353;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	double ans=0;
	for(int i=1;i<=n;++i){
		int t=i,cnt=0;
		while(t<k){
			t*=2;
			cnt++;
		}
		ans+=(double)1/n*pow(0.5,cnt);
	}
	cout << setprecision(20) << fixed << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>

using namespace std;

int countDigit(int num){
	int i;
	for(i=1;pow(10,i)<=num;i++);
	return i;
}

int main(){
    int i,a,b;
    while(cin >> a >> b){
    	cout << countDigit(a+b) << endl;
    }
    return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int w, h, n;
  cin >> w >> h >> n;
  
  vector<vector<int>> a(n, vector<int>(3));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a.at(i).at(j);
    }
  }
  
  //残っている白い領域の左下の座標をbに　右上の座標をcに代入
  vector<int> b = {0,0}, c = {w,h};
  for (vector<int> d : a) {
    
    if (d.at(2) == 1) {
      if (d.at(0) > b.at(0)) {
        if (d.at(0) <= c.at(0)) b.at(0) = d.at(0);
        else b.at(0) = c.at(0);
      }
    }
    
    if (d.at(2) == 2) {
      if (d.at(0) < c.at(0)) {
        if (d.at(0) >= b.at(0)) c.at(0) = d.at(0);
        else c.at(0) = b.at(0);
      }
    }
    
    if (d.at(2) == 3) {
      if (d.at(1) > b.at(1)) {
        if (d.at(1) <= c.at(1)) b.at(1) = d.at(1);
        else b.at(1) = c.at(1);
      }
    }
    
    if (d.at(2) == 4) {
      if (d.at(1) < c.at(1)) {
        if (d.at(1) >= b.at(1)) c.at(1) = d.at(1);
        else c.at(1) = b.at(1);
      }
    }
  }
  
  cout << (c.at(0)-b.at(0))*(c.at(1)-b.at(1));
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


ll n, p;

ll jou(ll a, ll b){
	ll c = 1;
	for(int i = 0; i < b; i++){
		c *= a;
		if(c > p) return LINF;
	}
	return c;
}

int main(){
	cin >> n >> p;
	
	if(n == 1){ cout << p << endl; return 0;}
	if(n > p){cout << 1 << endl; return 0;}
	ll a = 1;
	for(ll i = 2; jou(i,n) <= p; i++){
		if(p % jou(i,n) == 0) a = i;
	}
	cout << a << endl;
	
	return 0;
}

Measured memory_bytes: 384
<?php
$a = fgets(STDIN);
$b = fgets(STDIN);
$c = fgets(STDIN);
$d = fgets(STDIN);
$e = fgets(STDIN);
$k = fgets(STDIN);
 
 
if (($e-$a) > $k) {
	echo ":(";
} else {
	echo "Yay!";
}

Measured memory_bytes: 4728