akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//inline int in() { int x; scanf("%d",&x); return x;}
inline ll in() { ll x; cin >> x; return x; }
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

int main() {
  int a = in();
  int b = in();
  int c = in();
  if (b + c > a) {
    cout << b + c - a << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


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

int main(){
	int S;
	int h,m,s;
	cin >> S;
	h = S / 60 / 60;
	m = S / 60 - h * 60;
	s = S - h*60*60 - m*60;

	cout << h << ":" << m << ":" << s << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    if (a > b)
        swap(a, b);
    if (b > c)
        swap(b, c);
    for (int i = 0; i < k; i++) {
        c *= 2;
    }
    cout << a + b + c << endl;
    return 0;
}

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

int calc(int x){
    int ans = 0;
    while(x > 0){
        ans += x % 10;
        x /= 10;
    }
    return ans;
}


int main(){
    int n,a,b,x;
    int cnt=0;
    cin >> n >> a >> b;
    for(int i = 0;i <= n;i++){
        x = calc(i);
        if(x >= a && x <= b)cnt += i;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
/*input
777
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s; cin >> s;
    for(int i = 0; i < s.size(); i++) if(s[i] == '7')
    {
    	cout << "Yes";
    	return 0;
    }
    cout << "No";

    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>

using namespace std;

int solve (int n, int x)
{
    int cnt=0, t;
    for (int i=1; i<=n; i++)
    {
        for (int j=i+1; j<=n; j++)
        {
            t=x-i-j;
            if (j!=t && i!=t && t<=n && t>j) cnt++;
        }
    }
    return cnt;
}

int main()
{
    int n,x;
    vector<int> ans(0);
    while (1)
    {
        cin>>n>>x;
        if (n==0 && x==0) break;
        ans.push_back(solve(n,x));
    }
    for (int i=0; i<ans.size(); i++) cout<<ans[i]<<'\n';
    return 0;
}



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

int main(){ 
	int a,b;
	cin>>a>>b;
	int A[]={0,1,3,1,2,1,2,1,1,2,1,2,1};
	if(A[a]==A[b]){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


int main() {
    int x, y;
    cin >> x >> y;
    int ans = (x == 1 && y == 1 ? 400000 : 0);
    if(x == 1) ans += 300000;
    if(x == 2) ans += 200000;
    if(x == 3) ans += 100000;

    if(y == 1) ans += 300000;
    if(y == 2) ans += 200000;
    if(y == 3) ans += 100000;
    cout << ans << endl;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    string w;
    cin >> w;

    vector<int> res(26);
    for(int is=0;is<w.size();is++) {
        res.at(w.at(is)-'a')++;
    }
    for(auto ires:res) {
        if(ires%2==1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>

using namespace std;

class UnionFind{//UnionFind木
 private:
    vector<int> Parent;
 public:
    UnionFind(int N){
        vector<int> Parent(N,-1);
    }

    int root(int A){
        if(Parent[A]<0) return A;
        return Parent[A]=root(Parent[A]);
    }

    int size(int A){
        return -Parent[root(A)];
    }

    bool connect(int A,int B){
        A=root(A);
        B=root(B);
        if(A==B) return false;
        if(size(A)<size(B)) swap(A,B);
        Parent[A]-=Parent[B];
        Parent[B]=A;
    }
};

typedef pair<string, int> P;
typedef long long ll;
const int division = 1000000007;


ll mpow(ll x, ll n){ //x^n(mod division) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % division;
        x = x*x % division;
        n = n >> 1;
    }
    return ans;
}

ll cmb(ll a, ll b){ //aCbをmod計算
    vector<ll> fac; //n!(mod division)
    vector<ll> ifac; //k!^{M-2} (mod division)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    fac.push_back(1);
    ifac.push_back(1);
    for(ll i = 0; i<a; i++){
        fac.push_back(fac[i]*(i+1) % division); // n!(mod division)
        ifac.push_back(ifac[i]*mpow(i+1, division-2) % division); // k!^{M-2} (mod division) ←累乗にmpowを採用
    }
    ll tmp = ifac[a-b]* ifac[b] % division;
    return tmp * fac[a] % division;
}
int gcd(int x,int y){return y ? gcd(y,x%y) : x;};//xとyの最大公約数

int main(){
    int N;
    cin >> N;
    pair<P,int> p[110];
    for(int i=0;i<N;i++){
        string s;
        int p1;
        cin >> s >> p1;
        p[i]=make_pair(P(s,-p1),i);
    }
    sort(p,p+N);
    for(int i=0;i<N;i++) cout << p[i].second+1 << endl;

}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int n;
int sum[5000];
int ans;

void serch(int s_i,int s_ans)
{
	if(s_i==n)
		return ;
	
	s_ans+=sum[s_i];
	
	if(ans<s_ans)
		ans=s_ans;
	
	serch(s_i+1,s_ans);
}
int main()
{
	
	for(;;)
	{
		ans=-10000000;
		
		cin >> n ;
		if(n==0)
			break;
		
		for(int i=0;i<n;i++)
		{
			cin >> sum[i] ;
		}
		
		for(int i=0;i<n;i++)
		{
			serch(i,0);
		}
		
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
N = int(input())
h = [int(x) - 1 for x in input().split()]
a = [int(x) for x in input().split()]

l2N = 0
n = N
while n > 1:
    n = -(-n//2)
    l2N += 1
N = 2**l2N

seg = [0] * (2 * 2**l2N - 1)

def update(H, x):
    H += 2**l2N - 1
    seg[H] = x
    while H > 0:
        H = (H - 1) // 2
        seg[H] = max(seg[H*2+1], seg[H*2+2])

def maxSrch(a, b, k, l, r):
    if r <= a or b <= l:
        return 0
    if a <= l and r <= b:
        return seg[k]
    else:
        vl = maxSrch(a, b, k*2+1, l, (l+r)//2)
        vr = maxSrch(a, b, k*2+2, (l+r)//2, r)
        return max(vl, vr)

for H,A in zip(h,a):
    update(H, maxSrch(0,H,0,0,N) + A)
print(seg[0])

Measured memory_bytes: 122960
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define deb(x) cout << #x << "=" << x << endl;
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

map<ll, int> mp;

int main() {
    fastio
    int n;
    cin>>n;
    vector<ll> vec(n);
    for(auto& it : vec) cin>>it;
    sort(all(vec));

    bool pc = true;
    for(int i = 0; i<n && pc; ++i) {
        ll temp = vec[i];
        if(temp%2==0) {
            if(mp[2]) {
                pc = false;
                break;
            }
            mp[2] = 1;
        }
        while(temp%2==0) {
            temp /= 2;
        }
        
        for(ll j = 3; j*j<=temp && pc; j+=2) {
            if(temp%j==0) {
                if(mp[j]) {
                    pc = false;
                    break;
                }
                else {
                    mp[j] = 1;
                }
            }
            while(temp%j==0) {
                temp/=j;
            }
        }

        if(temp>2) {
            if(mp[temp]) {
                pc = false;
                break;
            }
            mp[temp] = 1;
        }
    }

    if(!pc) {
        ll g = vec[0];
        for(int i = 1; i<n; ++i) {
            g = __gcd(g, vec[i]);
        }
        if(g == 1) {
            cout<<"setwise coprime"<<endl;
            return 0;
        }
        else {
            cout<<"not coprime"<<endl;
            return 0;
        }
    }
    cout<<"pairwise coprime"<<endl;
}

Measured memory_bytes: 11052
#include<iostream>

#include<cstdio>

#include<cstring>

#include<string>

#include<stack>

#include<queue>

#include<set>

#include<map>

#include<vector>

#include<list>

#include<cmath>

#include<algorithm>

#include<bitset>

#define lson node<<1,st,mid

#define rson node<<1|1,mid+1,ed

#define mem(a,x) memset(a,x,sizeof(a))

#define me(a) memset(a,0,sizeof(a))

#define IOS ios::sync_with_stdio(false)

#define lowbit(x) x&(-x)

#define up(i,x,y) for(long long i=x;i<y;i++)

#define down(i,x,y) for(long long i=x;i>=y;i--)

#define in freopen("in.txt","r",stdin)

#define out freopen("out.txt","w",stdout)   

typedef long long ll;

typedef unsigned long long ull;

const ll mod = 1e9+7;

const ll INF = 0x3f3f3f3f;

const ll maxn = 5e5 + 5;

const ll N=1e3+5;

const double pi = acos(-1.0);

const double eps=1e-9;

using namespace std;

int n=0,q=0;

struct Query{

	int id, l, r;

	bool operator< (Query a) const{

		return r < a.r;

	}

}query[maxn];

int v[maxn], sum[maxn], ans[maxn];

void change(int i, int a){

	while(i <= n){

		sum[i] += a;

		i += lowbit(i);

	}

}

int getsum(int i){

	int sum_t = 0;

	while(i > 0){

		sum_t += sum[i];

		i -= lowbit(i);

	}

	return sum_t;

}

int main() {

		scanf("%d%d", &n,&q);

		memset(v, 0, sizeof(v));

		memset(sum, 0, sizeof(sum));

		memset(ans, 0, sizeof(ans));

		

		int t = 0;

		for(int i = 1; i <= n; i++){

			scanf("%d", &v[i]);

		}

		

		for(int i = 1; i <= q; i++){

			scanf("%d%d", &query[i].l, &query[i].r);

			query[i].id = i;

		}

		sort(query + 1, query + q + 1);

		

		int pre = 1;

		map<int, int> mymap;

		for(int i = 1; i <= q; i++){

			for(int j = pre; j <= query[i].r; j++){

				//已存在 

				if(mymap[v[j]]){

					change(mymap[v[j]], -1);

				}

				mymap[v[j]] = j;

				change(j, 1);

			}

			pre = query[i].r + 1;

			ans[query[i].id] = getsum(query[i].r) - getsum(query[i].l - 1);

		}

		

		for(int i = 1; i <= q; i++){

			cout << ans[i] << endl;

		}

	

	return 0;

}

 

Measured memory_bytes: 38984
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
#define mmm 1000000007
#define pb push_back
									//nestedcode


 int main(){
	ios::sync_with_stdio(false);
  	cin.tie(0); cout.tie(0);
  	ll n,i;
  	cin>>n;
  	ll a[n+5],aa[n+5];
  	for(i=0;i<n;i++){
  		cin>>a[i];
  		aa[a[i]] = i+1;
	  }
	  for(i=1;i<=n;i++){
	  	cout<<aa[i]<<" ";
	  }
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

void makePrimeTable(vector<bool> &isPrime, int n) {
    isPrime.resize(n + 1, true);
    isPrime[0] = false;
    isPrime[1] = false;
    for(int i = 2; i * i <= n; i++) {
        if(isPrime[i]) {
            for(int j = 2; i * j <= n; j++) {
                isPrime[i * j] = false;
            }
        }
    }
}

vector<bool> isPrime;

void solve(ll a, ll d, ll n) {
    ll cnt = 0;
    ll x = 0;
    while(cnt < n) {
        ll now = a + d * x;
        if(isPrime[now]) {
            cnt++;
        }
        x++;
    }
    cout << a + d * (x - 1) << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    makePrimeTable(isPrime, 1000100);
    while(1) {
        ll a, d, n;
        cin >> a >> d >> n;
        if(a == 0 && d == 0 && n == 0) {
            break;
        }
        solve(a, d, n);
    }
}


Measured memory_bytes: 3284
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a!=c&&b!=c||a==c&&a!=b&&b!=c||b==c&&a!=b&&a!=c)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
ll  a[maxn];
ll b[maxn];
int n;
ll ans=0;
struct node
{
    int id;
    ll sum;
    bool operator<(const node &t) const
    {
        return sum<t.sum;
    }
};
priority_queue<node>que;
int slove( node no)
{
    int ids=no.id;
    int t1=ids+1;
    int t2=ids-1;
    if(t2==0)
        t2=n;
    if(t1==n+1)
        t1=1;
    ll   sum=b[t1]+b[t2];
    if(sum+a[ids]>no.sum)
        return 0;
    ans=ans+(ll)(no.sum-a[ids])/sum;
    no.sum=(no.sum-a[ids])%sum+a[ids];
    b[ids]=no.sum;
    if(no.sum>a[ids])
        que.push(no);
    else if(no.sum<a[ids])
        return 0;
    return 1;
}
int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%lld",&a[i]);
    for(int i=1; i<=n; i++){
        scanf("%lld",&b[i]);
        if(a[i]!=b[i])
        que.push({i,b[i]});
    }
    int flag;
    while(!que.empty())
    {
        if(que.top().sum>a[que.top().id])
        {

            flag=slove(que.top());
            que.pop();
            if(flag==0)
            {
                puts("-1");
                return 0;
            }
        }
        else
        {
            puts("-1");
            return 0;
        }
    }
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 8816
N = int(input())
button = [int(input()) for _ in range(N)]
flag = [0] * N
current = 0
count = 0
while 1:
    if current == 1:
        break
    if flag[current] != 0:
        count = -1
        break
    else:
        flag[current] = button[current]
        current = flag[current] - 1
        count += 1
print(count)

Measured memory_bytes: 7852
#include <iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
#define P pair<int,int>
int n;
string t[1111];
vector<P>ta;

int A=1000000;
int K=10000001;


vector<P> calc(vector<P>tmp,int n){
    vector<P>ret(0);
    int scoreA=0,scoreK=1;
    bool flagA=0,flagK=0;
    
    // for(int i=0;i<tmp.size();i++){
    //     cout<<tmp[i].first<<" "<<tmp[i].second<<endl;
    // }
    // cout<<endl;
    
    int pos=0;
    int ts=tmp.size();
    
    for(;;){
        //cout<<n<<" "<<pos<<endl;
        
        if(pos>=ts)break;
        int a=tmp[pos].first,b=tmp[pos].second;
        
        if(a!=n||(a==n&&b!=A&&b!=K)){
            ret.push_back(tmp[pos++]);
            continue;
        }
        
        if(b==A){
            int res=0;
            pos++;
            while(pos<ts&&tmp[pos].first==n+1&&tmp[pos].second<100000)res+=tmp[pos++].second;
            ret.push_back(make_pair(n,res));
        }
        if(b==K){
            int res=1;
            pos++;
            while(pos<ts&&tmp[pos].first==n+1&&tmp[pos].second<100000)res*=tmp[pos++].second;
            ret.push_back(make_pair(n,res));
        }
    }
    
    //cout<<"OK";
    return ret;
}
int main(void){
    // Your code here!
    while(cin>>n,n){
        for(int i=0;i<n;i++)cin>>t[i];
        vector<P>score(0);
        for(int i=0;i<n;i++){
            int a=0,b=0;
            while(t[i][a]=='.')a++;
            if(t[i][a]=='+')b=A;
            else if(t[i][a]=='*')b=K;
            else b=(t[i][a]-'0');
            
            score.push_back(make_pair(a,b));
        }
        
        for(int i=100;i>=0;i--){
            score=calc(score,i);
        }
        
        cout<<score[0].second<<endl;
    }
    
    return 0;
}






Measured memory_bytes: 3224
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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






std::vector<long long> primeFactor(long long n){
    std::vector<long long> vec;
    for(long long i(2); i * i <= n; ++i){
        if(!(n % i)){
            vec.push_back(i);
            while(!(n % i)){
                n /= i;
            }
        }
    }
    if(n > 1) vec.push_back(n);
    return vec;
}

int main(){
    int N; std::cin >> N;
    std::vector<int> A(N);
    for(int i(0); i < N; ++i) std::cin >> A[i];
    int r(std::accumulate(std::begin(A), std::end(A), 0, [](int m, int n){
        return std::gcd(m, n);
    }));
    if(r != 1){
        std::cout << "not coprime" << std::endl;
        return 0;
    }
    std::set<long long> pm;
    for(int i(0); i < N; ++i){
        std::vector<long long> p(primeFactor(A[i]));
        for(int j(0), j_len(p.size()); j < j_len; ++j){
            if(pm.find(p[j]) != std::end(pm)){
                std::cout << "setwise coprime" << std::endl;
                return 0;
            }
            pm.emplace(p[j]);
        }
    }
    std::cout << "pairwise coprime" << std::endl;
    return 0;
}


Measured memory_bytes: 7304
/* ITP1_7_C */
import java.io.*;

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String[] input = br.readLine().split(" ");
      int row = Integer.parseInt(input[0]);
      int column = Integer.parseInt(input[1]);
      int[][] matrix = new int[row + 1][column + 1];
      int all_sum = 0;

      // input & row sum
      for(int i = 0; i < row; i++){
        input = br.readLine().split(" ");
        for(int j = 0; j < column; j++){
          matrix[i][j] = Integer.parseInt(input[j]);
          matrix[i][column] += matrix[i][j];
          all_sum += matrix[i][j];
        }
      }
      // column sum
      for(int j = 0; j < column; j++){
        for(int i = 0; i < row; i++){
          matrix[row][j] += matrix[i][j];
        }
      }
      matrix[row][column] = all_sum;

      // output
      for(int i = 0; i < (row+1); i++){
        for(int j = 0; j < (column+1); j++){
          if(j != 0) sb.append(" ");
          sb.append(matrix[i][j]);
        }
        sb.append("\n");
      }
      System.out.print(sb);

    }catch(Exception e){
      System.out.println(e);
    }
  }
}

Measured memory_bytes: 27848
import heapq

A = []
while True:
    line = input().rstrip().split()
    if line[0] == "end":
        break
    elif line[0] == "insert":
        heapq.heappush(A, -int(line[1]))
    else:
        print(-heapq.heappop(A))
        
# これさー、heapq自体を実装することに意味があるんじゃないの？
# heqpq使ったらあんまり意味がない気がする
# Pythonだと間に合わないのだろうかーーーー


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

public class Main {
    void run() {
        while (true) {
            int N = readInt();
            if (N == 0) break;
            ArrayList<Score> scores = new ArrayList<Score>();
            for (int i = 0; i < N; i++) {
                String[] tokens = readLine().split(" ");
                int id = Integer.parseInt(tokens[0]);
                int[] p = new int[tokens.length - 1];
                for (int j = 1; j < tokens.length; j++) {
                    p[j - 1] = Integer.parseInt(tokens[j]);
                }
                scores.add(new Score(id, computeScore(p)));
            }
            Collections.sort(scores);
            for (Score s : scores) {
                sysout.println(s.id + " " + s.point);
            }
        }
    }

    int computeScore(int[] p) {
        int sum = 0;
        int ptr = 0;
        for (int i = 0; i < 9; ++i) {
            if (p[ptr] == 10) {
                sum += 10 + p[ptr + 1] + p[ptr + 2];
                ptr += 1;
            } else if (p[ptr] + p[ptr + 1] == 10) {
                sum += 10 + p[ptr + 2];
                ptr += 2;
            } else {
                sum += p[ptr] + p[ptr + 1];
                ptr += 2;
            }
        }
        if (p[ptr] == 10) {
            sum += 10 + p[ptr + 1] + p[ptr + 2];
        } else if (p[ptr] + p[ptr + 1] == 10) {
            sum += 10 + p[ptr + 2];
        } else {
            sum += p[ptr] + p[ptr + 1];
        }
        return sum;
    }

    class Score implements Comparable<Score> {
        public int id, point;

        public Score(int id, int point) {
            this.id = id;
            this.point = point;
        }

        @Override
        public int compareTo(Score o) {
            if (point != o.point) return o.point - point;
            return id - o.id;
        }
    }

    public static void main(String[] args) {
        new Main().run();
    }

    // flush automatically iff you call `println` or `printf` or `format`.
    PrintWriter sysout = new PrintWriter(System.out, true);

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer buffer = null;

    String readLine() {
        buffer = null;
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    String read() {
        if (buffer == null || !buffer.hasMoreTokens()) {
            buffer = new StringTokenizer(readLine());
        }
        return buffer.nextToken();
    }

    int readInt() {
        return Integer.parseInt(read());
    }

    long readLong() {
        return Long.parseLong(read());
    }

    double readDouble() {
        return Double.parseDouble(read());
    }
}

Measured memory_bytes: 20144
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) (a).begin(), (a).end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { assert(x > 0); return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { assert(x > 0); return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { assert(x > 0); return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { assert(x > 0); return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
// const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll n; cin >> n;
  Vll a(n); cin >> a;

  Vll b(n-1);
  rep(i, n-1) b[i] = a[i+1] - a[i];

  Vll c = {b[0]};
  rep2(i, 1, n-1) {
    if (c.back() * b[i] >= 0) c.back() += b[i];
    else c.push_back(b[i]);
  }

  int k = sz(c);
  Vll d(k+1);
  d[0] = a[0];
  rep(i, k) d[i+1] = d[i] + c[i];


  ll x = 1000;
  ll y = 0;
  rep(i, k) {
    if (d[i+1] > d[i]) {
      y += x / d[i];
      x -= x / d[i] * d[i];
    }
    else {
      x += y * d[i];
      y = 0;
    }
  }

  ll ans = x + y * a.back();
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3552
import java.util.*;

public class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
      	String b = sc.next();
		
		sc.close();

		int multiply = Integer.parseInt(a + b);
		boolean isSquared = false;

		for (int i = 0; i * i <= multiply; i++){
			if (i * i == multiply){
				System.out.println("Yes");
				isSquared = true;
				break;
			}
		}

		if ( ! isSquared){
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
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;}
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007 //998244353


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

    // solution comes here

    ll A, B, C;
    cin >> A >> B >> C;

    if(A+B+C >= 22) cout << "bust" << nl;
    else            cout << "win" << nl;
}


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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


const int N = 5e5+5;
int dp[N],de[N];

int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}


int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}

int ncr(int x, int y){
   return divide(dp[x],dp[y]*dp[x-y]%mod);
}

int f(int x){
   return x*x%mod;
}

void solve() {

  int n,m,ans=0;
  cin>>n>>m;
  dp[0]=1;
  fr(i,1,m){
    dp[i]=dp[i-1]*i%mod;
  }
  fr(i,0,n){
    int x = i&1?-1:1;
    int y = ncr(n,i)*ncr(m,i)%mod*dp[i]%mod;
    y = y*f(ncr(m-i,n-i)*dp[n-i]%mod)%mod;
    ans = (ans + x*y%mod + mod)%mod;
  }
  cout<<ans;
  

}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
   //cin >> t;

    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}






int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 7452
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  //vector<int> vec(N);
  //rep(i, N) cin >> vec[i];

  //int ans = 0;

  cout << N+N*N+N*N*N << endl;

}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define INF 2e9
typedef pair<int,int> P;
int n, m, ans, cnt;
int group[200];
P h[200];
int bridge[200][200];
vector<tuple<int, int, int>> vec;
void init(int N){
    for(int i = 0; i < N; i++){
        group[i] = i;
    }
}
int root(int a){
    if(group[a] == a) return a;
    return (group[a] = root(group[a]));
}
bool is_same_set(int a, int b){
    return root(a) == root(b);
}
void unite(int a, int b){
    group[root(a)] = root(b);
}
int main(){

    while(cin >> n >> m && n && m){
        init(n);
        vec.clear();
        ans = 0;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                bridge[i][j] = 0;
            }
        }
        for(int i = 0; i < n; i++){
            cin >> h[i].F;
            h[i].F *= -1;
            h[i].S = i;
        }
        sort(h, h+n);
        for(int i = 0; i < m; i++){
            int a, b, c;
            cin >> a >> b >> c;
            a--; b--;
            bridge[a][b] = c;
            bridge[b][a] = c;
        }
        for(int i = 1; i < n; i++){
            for(int j = 0; j < n; j++){
                if(bridge[h[i].S][h[j].S]){
                    vec.push_back(MT(bridge[h[i].S][h[j].S], i, j));
                }
            }
            if(i + 1 < n && h[i].F == h[i + 1].F){
                continue;
            }
            sort(vec.begin(), vec.end());
            for(int j = 0; j < vec.size(); j++){
                if(!is_same_set(get<1>(vec[j]), get<2>(vec[j])) && get<1>(vec[j]) <= i && get<2>(vec[j]) <= i){
                    unite(get<1>(vec[j]), get<2>(vec[j]));
                    ans += get<0>(vec[j]);
                }
            }
            cnt = 0;
            for(int j = 0; j <= i; j++){
                if(group[j] == j){
                    cnt++;
                }
            }
            if(cnt!=1){
                init(n);
                ans = 0;
            }

        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3956
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class Main {

	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(
					System.in));

			String[] strs = br.readLine().split(" ");
			List<Integer> l = new ArrayList<Integer>();
			for(String s:strs){
				l.add(Integer.parseInt(s));
			}
			Collections.sort(l);
			StringBuilder sb = new StringBuilder();
			for(int i:l){
				sb.append(i);
				sb.append(" ");
			}
			System.out.println(sb.substring(0,sb.length()-1));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}

Measured memory_bytes: 17096
// C - XYZ Triplets
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n; cin>>n;
	vector<int> f(n);
	for(int x=1; x<100; ++x)
		for(int y=1; y<100; ++y)
			for(int z=1; z<100; ++z){
				int k = x*x + y*y + z*z + x*y + y*z + z*x;
				if(k <= n) f[k]++;
			}
	for(int i=1; i<=n; ++i) cout<< f[i] <<endl;
}


Measured memory_bytes: 3536
#include<set>  
#include<map>  
#include<stack>  
#include<cmath>  
#include<cstdio>  
#include<queue>  
#include<vector>  
#include<cstring> 
#include<climits>
#include<iostream>
#include<algorithm> 
using namespace std; 
#define MOD 1000000007
#define MAXN 100000
#define LL long long
#define INF 0x3f3f3f3f
LL read(){ 
    LL f=1,x=0; 
    char c=getchar(); 
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();} 
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();} 
    return f*x; 
}
LL n,h,w,a,b,s[2*MAXN+5]={1},inv[2*MAXN+5];
LL QuPow(LL x,LL y){
	LL ret=1;
	while(y){
		if(y&1) ret=ret*x%MOD;
		x=x*x%MOD;
		y>>=1;
	}
	return ret;
}
void Prepare(){
	for(int i=1;i<=2*MAXN;i++) s[i]=s[i-1]*i%MOD;
	inv[0]=1;
	inv[2*MAXN]=QuPow(s[2*MAXN],MOD-2);
	for(int i=2*MAXN-1;i>=1;i--)
		inv[i]=inv[i+1]*(i+1)%MOD;
	return ;
}
LL C(LL m,LL n){
	return s[m]*inv[n]%MOD*inv[m-n]%MOD;
}
int main(){
	LL ans=0;
	Prepare();
	h=read(),w=read(),a=read(),b=read();
	for(int i=b+1;i<=w;i++)//(zuhe(h-a+i-2, h-a-1)%mod*zuhe(w-i+a-1, w-i)%mod)%mod
		ans=(ans+C(h-a+i-2,i-1)*C(a+w-i-1,a-1)%MOD)%MOD;
	printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 3328
<?php
$n = trim(fgets(STDIN));
$aArray = explode(" ", trim(fgets(STDIN)));
$sum = 0;
$dp[] = 0;
foreach($aArray as $a){
    $sum += $a;
    $dp[] = $sum;
}
foreach($dp as $sum){
    @$c[$sum]++;
}
$total = 0;
foreach($c as $d){
    $total+=$d*($d-1)/2;
}
echo $total;


Measured memory_bytes: 41968
#include <iostream>
#include <vector>

using namespace std;

int N;
int cnt[13];
vector<int> task;

int dif(int i, int j)
{
	int d = max(i, j) - min(i, j);
	return min( d, 24-d);
}

bool check(int d)
{
	if(d <= 1) return true;
	bool used[24];
	for(int i = 0; i < 24; i++) used[i] = false;
	
	int t;
	for(int i = 0; i < task.size(); i++){
		if(!used[task[i]]) t = task[i];
		else if(!used[24-task[i]]) t = 24 - task[i];
		else return false;
		for(int j = 0; j < 24; j++){
			if(dif(j, t) <= d-1) used[j] = true;
		}
	}
	return true;
}

int main(void)
{
	cin >> N;
	
	int D;
	for(int i = 1; i <= N; i++){
		cin >> D;
		cnt[D]++;
	}
	cnt[0]++;
	
	for(int i = 1; i <= 11; i++){
		if(cnt[i] >= 3){
			cout << 0 << endl;
			return 0;
		}
	}
	if(cnt[0] >= 2 || cnt[12] >= 2){
		cout << 0 << endl;
		return 0;
	}
	
	for(int i = 0; i <= 12; i++){
		for(int j = 0; j < cnt[i] ; j++)
		task.push_back(i);
	}
	
	
	int ub = 25, lb = -1, mid;
	while(ub - lb > 1){
		mid = (ub + lb) / 2;
		if(check(mid))lb = mid;
		else ub = mid;
	}
	
	cout << lb << endl;
	return 0;
}
	

Measured memory_bytes: 256
import math
x = int(input())
def prime(n):
  ans = 0
  for i in range(2,int(math.sqrt(n))+1):
    if n % i == 0:
      ans = 1
      break
  return ans
for i in range(x,1000000):
  if prime(i) == 0:
    print(i)
    break

Measured memory_bytes: 9140
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define MAXN 100000
using namespace std;
int numbers;
 
 
long long results;
 
int main()
{
	cin >> numbers;
	for(int a = 1; a <= numbers; ++a)
	{
		for(int b = 1; b <= numbers; ++b)
		{
			for(int c = 1; c <= numbers; ++c)
			{
				results += __gcd(a, __gcd(b, c));
			}	
		}
 
	}
	cout << results << endl;
	return 0;
}


Measured memory_bytes: 3636
import random
import numpy as np
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
    temp = list(map(int, input().split()))
    s.append(temp)
s = np.array(s)
#print(s)
for i in range(d):
    print(s[i].argmax()+1)

Measured memory_bytes: 27404
n,c=gets.split.map(&:to_i)
d=Array.new(c)
g=Array.new(n)
c.times{|i|d[i]=gets.split.map(&:to_i)}
n.times{|i|g[i]=gets.split.map(&:to_i)}
list=[]
arr=Array.new(3).map{Array.new(c,0)}
  c.times{|q|
    n.times{|x|
      n.times{|y|
        arr[(x+y)%3][q]+=d[g[y][x]-1][q]
      }
    }
  }
[*0...c].permutation(3){|x,y,z|list.push(arr[0][x]+arr[1][y]+arr[2][z])}
p list.min

Measured memory_bytes: 4732
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;



int main() {
    string s, t;
    int a, b;
    string u;
    cin >> s >> t >> a >> b >> u;
    if(u == s) a--;
    else b--;
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
a,b,c,d=map(int,input().split())
count1=0
count2=0
while (c-b)>0:
    count1 =count1+1
    c=c-b
while (a-d)>0:
    count2 =count2+1
    a=a-d
if count1<=count2:
    print("Yes")
else:
    print("No") 

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

int main(){
  int num[128],tempn,index[128][128],i,j,k,l,m,alc,count;
  char word[128][128],tempw[128],dict[128][128];
  i=0;
  while(~scanf("%s %d",word[i],&num[i]))i++;

  i=i-1;//入力の最後のあれを補正

  j=0;
   while(j<i)
    {
      if(strcmp(word[j],word[j+1])>0)
	{
	  strcpy(tempw,word[j]);
	  strcpy(word[j],word[j+1]);
	  strcpy(word[j+1],tempw);
	  tempn=num[j];
	  num[j]=num[j+1];
	  num[j+1]=tempn;
	  j=0;
	}
      else
	j++;
    }
 
   l=0;//dictの番号
   alc=0;//総重複カウント
   count=0;//個別重複カウント

     for(k=0;k<=i;k++)
     {
       if(k==0)
	 {
	   strcpy(dict[0],word[0]);
	   index[0][0]=num[0];
	   l++;
	   // printf("__%d\n",k);
	 }
       else
	 {
	   if(strcmp(dict[l-alc-1],word[k]) != 0)//新語出現
	     {
	       count=0;
	       strcpy(dict[l-alc],word[k]);
	       index[l-alc][0]=num[k];
	       l++;
	       //   printf("!!%d\n",k);
	     }
	   else//重複語
	     {
	       count++;
	       alc++;
	       index[l-alc][count]=num[k];
	       l++;
	       //   printf("!!!!%d\n",k);
	     }
	 }
     }

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

     for(k=0;k<i;k++)
       {
	 m=0;
	 while(index[k][m+1] != 0)
	   {
	     if(index[k][m]>index[k][m+1])
	       {
		 tempn=index[k][m];
		 index[k][m]=index[k][m+1];
		 index[k][m+1]=tempn;
		 m=0;
	       }
	     else
	       m++;
	   }
       }



     //printf("--------------------\n");

     /* for(k=0;k<5;k++)
   {
     for(m=0;m<5;m++)
       {
	 if(m<4)
	   printf("%d ",index[k][m]);
	 else
	   printf("%d\n",index[k][m]);
       }
       }*/



  for(k=0;k<l-alc;k++)
    {
      m=0;
      printf("%s\n",dict[k]);
      while(index[k][m+1] != 0)
	{
	  printf("%d ",index[k][m]);
	  m++;
	}
      printf("%d\n",index[k][m]);
    }

  return 0;
}

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

typedef long long ll;

ll gcd(ll a, ll b){
    if(a<b){
        return gcd(b,a);
    }
    ll r;
    while(r=a%b){
        a = b;
        b = r;
    }
    return b;
}

int main(){
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0; i < N; i++){
        cin >> v.at(i);
    }
    sort(v.begin(), v.end());

    // j>k, v[j] <= v[k] < v[j] + v[i] のxの個数
    long long ans = 0;
    for(int i = 0; i < N-2; i++){
        for(int j = i+1; j < N-1; j++){
            auto it = lower_bound(v.begin(), v.end(), v[i]+v[j]); // v[i] + v[j] 以上
            int dist = distance(v.begin(), it);
            ans += dist - j - 1;
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        
        int i = 0;
        while(true){
            if(i%2 == 0){
                c -= b;
            }else{
                a -= d;
            }
            if(a <= 0){
                System.out.println("No");
                break;
            }
            if(c <= 0){
                System.out.println("Yes");
                break;
            }
            i++;
        }
    }
}

Measured memory_bytes: 35668
#include <bits/stdc++.h>
using namespace std;
template<typename T>void read(T &x){
	x = 0; int f(1); char c = getchar();
	for(;!isdigit(c);c = getchar()) if(c == '-') f = -1;
	for(;isdigit(c);c = getchar()) x = (x<<3)+(x<<1)+c-'0';
	x *= f;
}
const int maxn = 200005;
int n,k,a[maxn];
bool judge(int);
int main(){
	read(n); read(k);
	int L = 1,R = 0,ans;
	for(int i(1);i <= n;++i)
		read(a[i]),R = max(R,a[i]);
	ans = R;
	while(L <= R){
		int mid = (L+R)>>1;
		if(judge(mid))	ans = mid,R = mid-1;
		else L = mid+1;
	} printf("%d\n",ans);
	return 0;
}
bool judge(int tans){
	int ret = 0;
	for(int i(1);i <= n;++i){
		if(a[i]%tans == 0)	ret += (a[i]/tans-1);
		else	ret += a[i]/tans;
	}
	return (ret <= k);
}

Measured memory_bytes: 4428
#include<iostream>
#include<math.h>
using namespace std;

int main(){
    int n, k;
    unsigned long long ans = 0;
    cin >> n >> k;

    if(k % 2 == 1){
        ans = powl(n/k, 3);
    }else{
        ans = powl(n/k, 3) + pow((n-k/2)/k+1, 3)*(k/2 <= n);
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

int n;

main()
{
    cin>>n;

    cout<<n*n<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String t = sc.nextLine();
		int ans=0;

		for(int i=0; i<s.length() ; i++) {

			if(s.charAt(i) != t.charAt(i)) {
				ans++;
			}

		}

		System.out.println(ans);

		sc.close();

	}

}


Measured memory_bytes: 42552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    int train, bus;
    train = min(a, b);
    bus = min(c, d);
    
    int ans = train + bus;
    
    cout << ans << endl;
    return 0;
}


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

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

ll pw(ll a, ll b) {
    ll r = 1;
    for( ; b ; b >>= 1, a = a * a % mod) {
        if(b & 1) {
            r = r * a % mod;
        }
    }
    return r;
}

ll getinv(ll n) {
    return pw(n, mod - 2);
}

void upd(int &a, int b) {
    a = (a + b) % mod;
}

int f[3010][3010][2];
int n, m;

int main() {
    scanf("%d%d", &n, &m);
    f[0][0][1] = 1;
    for(int i = 1 ; i <= n ; ++ i) {
        f[0][i][0] = 1;
    }
    for(int i = 0 ; i < m ; ++ i) {
        for(int j = 0 ; j <= n ; ++ j) {
            for(int k = 0 ; k <= 1 ; ++ k) {
                if(j) {
                    upd(f[i + 1][j - 1][k | (j == 1)], f[i][j][k]);
                    upd(f[i + 1][j][k | (j == 1)], f[i][j][k]);
                }
                if(n - j) {
                    upd(f[i + 1][j + 1][k], f[i][j][k]);
                    upd(f[i + 1][j][k], f[i][j][k]);
                }
            }
        }
    }
    int ans = 0;
    for(int i = 0 ; i <= n ; ++ i) {
        upd(ans, f[m][i][1]);
    }
    printf("%d\n", (ans % mod + mod) % mod);
}


Measured memory_bytes: 70784