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

vector<int> init_spf(int n){
    vector<int> spf(n+1);
    for (int i = 0; i < n+1; i++){
        spf[i]=i;
    }
    for (int i = 2; i*i<=n; i++){
        if(spf[i]==i){
            for (int j = i*i; j <= n; j+=i){
                if(spf[j]==j)spf[j]=i;
            }
        }
    }
    return spf;
}
bool is_pairwise_coprime(const vector<int> &A,const vector<int> &spf,int Amax){
    vector<bool> factor_appeared(Amax+1,false);
    for(auto Ai:A){
        while(Ai!=1){
            int smallest_factor=spf[Ai];
            if(factor_appeared[smallest_factor])return false;
            factor_appeared[smallest_factor]=true;
            while(Ai%smallest_factor==0)Ai/=smallest_factor;
        }
    }
    return true;
}
int gcd(int x, int y) {
    if(x % y == 0) {
        return y;
    } else {
        return gcd(y, x % y); 
    }
}
bool is_setwise_coprime(const vector<int> &A){
    int gcds=A[0];
    for (int i = 1; i < A.size(); i++){
        gcds=gcd(gcds,A[i]);
    }
    if(gcds==1)return true;
    else return false;
}
int main() {
    int N;cin>>N;
    vector<int> A(N);
    int Amax=0;
    for (int i = 0; i < N; i++){
        cin>>A[i];
        Amax=max(Amax,A[i]);
    }
    auto spf=init_spf(Amax);
    if(is_pairwise_coprime(A,spf,Amax))
        cout<<"pairwise coprime"<<endl;
    else if(is_setwise_coprime(A))
        cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;
    
}

Measured memory_bytes: 11364
#include <stdio.h>
int main(){
    int y=0,m=0,s;
    scanf("%d",&s);
    if(s%100>0&&s%100<13)y=1;
    if(s/100>0&&s/100<13)m=1;
    if(y&&m)printf("AMBIGUOUS");
    else if(y)printf("YYMM");
    else if(m)printf("MMYY");
    else printf("NA");
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  	int N = sc.nextInt(); //2<=A<=20
	int[] H = new int[N];
  	int cnt = 0;
  	int max = 0;
  	for (int i=0;i<N;i++){
      	H[i] = sc.nextInt();
    }
/*
N <= 100000
H <= 10^9
左右一列に N 個のマスが並んでいます。
左から i 番目のマスの高さは Hi です。
あなたは好きなマスに降り立ち、右隣のマスの高さが
今居るマスの高さ以下である限り右隣のマスへ移動し続けます。
最大で何回移動できるでしょうか。
*/	
  	int k=0,j=0;
  	for(k=0;k<N-1;k++){
	  	for (j=k;j<N-1;j++){
          	
    	 	if(H[j] >= H[j+1]){
        	 	cnt++; 
       		}else{
              	if (cnt == N-1){
                  	System.out.println(cnt); 
                  	System.exit(0);
                }
				else if(max < cnt){
                  	max = cnt;
                }
              	cnt = 0;
          		break;
        	}
        }
      	if (cnt == N-1){
			System.out.println(cnt);   
			System.exit(0);
        }else if(max < cnt){
          	max = cnt;
        }
      	cnt = 0;
      
    }
  	System.out.println(max);                           
}
}

Measured memory_bytes: 50328
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,w,z;
    char ca,cb,cc;
    cin>>n;
    a=n;
    while(a>0){
        sum+=a%10;
        a/=10;
    }
    if(n%sum==0) Yes;
    else No;
    return 0;
}


Measured memory_bytes: 3576
a,b,c,d = map(int,input().split())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

def nonbaisu(n):
    return n-(n//c + n//d - n//lcm(c,d))
print(nonbaisu(b) - nonbaisu(a-1))


Measured memory_bytes: 2940
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		String s = sc.next();
		BigDecimal a= new BigDecimal(A);
		BigDecimal b = new BigDecimal(s);
		a = a.multiply(b);
		System.out.println(a.longValue());
	}
}

Measured memory_bytes: 36024
#include <iostream>
#include <cstdio>
#include <queue>
#define int long long
#define ll long long
using namespace std;
const int N = 2105;
const int inf = 1e18;
queue<int> q;
int n, s, t, p1, p2, p3, p4, head[N], tot = 1, pre[N], last[N], vis[N], flow[N];
ll dis[N];
struct node{int to, nex, val, cost;}a[500005];
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
void add(int x, int y, int z, int w)
{
	a[++ tot].to = y; a[tot].nex = head[x]; a[tot].val = z; a[tot].cost = w; head[x] = tot;
	a[++ tot].to = x; a[tot].nex = head[y]; a[tot].val = 0; a[tot].cost = -w; head[y] = tot;
}
int spfa()
{
	for(int i = s; i <= p4; i ++) dis[i] = - inf, flow[i] = inf;
	dis[s] = 0; q.push(s); vis[s] = 1; pre[t] = -1;
	while(!q.empty())
	{
		int x = q.front(); q.pop(); vis[x] = 0;
		for(int i = head[x]; i; i = a[i].nex)
		{
			int y = a[i].to;
			if(dis[y] < dis[x] + a[i].cost && a[i].val)
			{
				dis[y] = dis[x] + a[i].cost; last[y] = i;
				pre[y] = x; flow[y] = min(flow[x], a[i].val);
				if(!vis[y]) vis[y] = 1, q.push(y);
			}
		}
	}
	return pre[t] != -1;
}
ll mcmf()
{
	ll mxcost = 0;
	while(spfa())
	{
		mxcost += flow[t] * dis[t]; int now = t;
		while(now != s)
		{
			a[last[now]].val -= flow[t];
			a[last[now] ^ 1].val += flow[t];
			now = pre[now];
		}
	}
	return mxcost;
}
signed main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read(); s = 0; t = 2 * n + 1;
	p1 = t + 1; p2 = p1 + 1; p3 = p2 + 1; p4 = p3 + 1;
	for(int i = 1, x, y, z; i <= n; i ++)
	{
		x = read(); y = read(); z = read(); add(s, i, z, 0);
		add(i, p1, inf, x + y); add(i, p2, inf, x - y);
		add(i, p3, inf, y - x); add(i, p4, inf, - x - y);
	}
	for(int i = 1, x, y, z; i <= n; i ++)
	{
		x = read(); y = read(); z = read(); add(i + n, t, z, 0);
		add(p1, i + n, inf, - x - y); add(p2, i + n, inf, y - x);
		add(p3, i + n, inf, x - y); add(p4, i + n, inf, x + y);
	}
	printf("%lld\n", mcmf());
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int N,K;cin>>N>>K;
    string S;cin>>S;
    vector<int> v01,v10;

    v01.push_back(-1);
    for(int i=0;i<N-1;i++){
        if(S[i]=='0'&&S[i+1]=='1')
            v01.push_back(i);
        if(S[i]=='1'&&S[i+1]=='0')
            v10.push_back(i);
    }
    v10.push_back(N-1);
    
    int i=0,ans=0;
    if(S[0]=='0'){
        if(K>=v10.size()+1)ans=N;
        else{
            while(i+K-1<v10.size()&&i<v01.size()){
                int m=v10[i+K-1]-v01[i];
                ans=max(ans,m);
                i++;
            }
        }
    }
    if(S[0]=='1'){
        if(K>=v10.size())ans=N;
        else{
            while(i+K<v10.size()&&i<v01.size()){
                int m=v10[i+K]-v01[i];
                ans=max(ans,m);
                i++;
            }
        }
    }

    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 1020
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int[] state=new int[]{0,0,2,0,1,0,1,0,0,1,0,1,0};
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		if(state[x]==state[y])System.out.println("Yes");
		else System.out.println("No");
	}
	
}

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

int main()
{
    int w,a,b;
    scanf("%d%d%d",&w,&a,&b);
    if(w+a<b)
     printf("%d\n",b-a-w);
    else
     if(w+b<a) printf("%d\n",a-b-w);
    else printf("0\n");

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX;
constexpr long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//constexpr ll P = 1000000007;
	//constexpr ll P = 998244353;

	ll x;
	cin >> x;
	cout << (x ^ 0 ^ 1) << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};


const int MAX_N=100100;

int par[MAX_N];
int ran[MAX_N];

void init(int n){
	for(int i=0;i<n;i++){
		par[i]=i;
		ran[i]=0;
	}
}

int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}

void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y)return;
	
	if(ran[x]<ran[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(ran[x]==ran[y])ran[x]++;
	}
}

bool same(int x,int y){
	return find(x)==find(y);
}

int n,m;

int a[55],b[55];

int main(){
	cin>>n>>m;
	REP(i,m){
		cin>>a[i]>>b[i];
		a[i]--,b[i]--;
	}
	int ans=0;
	for(int i=0;i<m;i++){
		init(55);
		for(int j=0;j<m;j++){
			if(i!=j){
				unite(a[j],b[j]);
			}
		}
		for(int j=0;j<n-1;j++){
			if(!same(j,j+1)){
				//cout<<i<<endl;
				ans++;
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-6;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair
const int MAX_N = 1e5+5;
int v[MAX_N];
int ce[MAX_N], co[MAX_N];
int N;

void solve()
{
	if(N==2){
		if(v[0] != v[1]) cout << 0 << endl;
		else cout << 1 << endl;
		return;
	}
	for(int i=0;i<N;i+=2) ce[v[i]]++;
	for(int i=1;i<N;i+=2) co[v[i]]++;
	vector<pair<int,int>> ve, vo;
	for(int i=0; i<MAX_N;++i) if(ce[i]) ve.emplace_back(ce[i],i);
	for(int i=0; i<MAX_N;++i) if(co[i]) vo.emplace_back(co[i],i);
	sort(ve.begin(), ve.end(), greater<pair<int,int>>());
	sort(vo.begin(), vo.end(), greater<pair<int,int>>());
	int e=0, o=0;
	if(ve[e].second == vo[o].second){//most common
		if(ve[e].first + vo[o+1].first >= ve[e+1].first + vo[o].first){
			o++;
		}else{
			e++;
		}
	}
	int ans;
    if(e>=ve.size()) ans = N-vo[o].first;
    else if(o >=vo.size()) ans = N-ve[e].first;
	else ans = N-ve[e].first-vo[o].first;
	cout << ans << endl;
}

int main()
{
	cin >> N;
	for(int i=0;i<N;++i) cin >> v[i];
	solve();
}

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

typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define ii pair <int,int>
#define ever (;;)

const int N = 100100;

ll n,k,a[N],mod=1e9+7,Dec,inc,cntinc,cntdec,ans,fact[N];

ll po(ll x,ll os)
{
    if( os == 0 )
        return 1;

    ll z = po(x,os/2);

    if( os&1 )
        return z*z%mod*x%mod;

    return z*z%mod;
}

ll modInv(ll x) { return po(x,mod-2); }

ll c(ll n,ll r) { return fact[n]*modInv(fact[r]*fact[n-r]%mod)%mod; }

int main()
{
    fact[0] = 1;
    for(int i=1;i<=100000;i++)
        fact[i] = fact[i-1] * i %mod;

    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);

    sort(a+1,a+n+1);

    if( k == 1 )
    {
        printf("0\n");
        return 0;
    }

    cntinc = cntdec = k-2;

    for(int i=k;i<=n;i++)
    {
        Dec = ( Dec + c(cntdec,k-2) )%mod;
        if( i != n )
            cntdec++;
    }

    for(int i=1;i<=n;i++)
    {
        if( i <= n-k+1 )
        {
            ans = ( ( ans - Dec*a[i]%mod  )%mod + mod ) %mod;

            Dec = ( ( Dec - c(cntdec,k-2) )%mod + mod ) %mod;
            cntdec--;
        }
        if( i >= k )
        {
            inc = ( inc + c(cntinc,k-2) )%mod;
            cntinc++;

            ans = ( ans + inc*a[i]%mod )%mod;
        }
    }

    printf("%lld\n",ans);
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cmath>
struct Point{
	double x,y;
	Point(){
	}
	Point(double _x,double _y):x(_x),y(_y){
	}
};
void koch(int n,Point left,Point right){
	if(n<1)return;
	Point s(Point((left.x*2+right.x)/3,(left.y*2+right.y)/3));
	Point t(Point((left.x+right.x*2)/3,(left.y+right.y*2)/3));
	Point u;
	u.x=(t.x-s.x)/2-(t.y-s.y)/2*sqrt(3)+s.x;
	u.y=(t.x-s.x)*(sqrt(3)/2)+(t.y-s.y)/2+s.y;
	koch(n-1,left,s);
	printf("%.8f %.8f\n",s.x,s.y);
	koch(n-1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	koch(n-1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	koch(n-1,t,right);
}
int main(){
	int n;
	scanf("%d",&n);
	printf("%.8f %.8f\n",0,0);
	koch(n,Point(0,0),Point(100,0));
	printf("%.8f %.8f\n",100.0,0);
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    int count;
    int num;
    int ans = 1;
    int max = 0;
    for(int i = 1; i <= n; i++){
        count = 0;
        num = i;
        while(1){
            if(num % 2 == 0){
                num /= 2;
                count++;
            }else{
                break;
            }
        }
        if(max < count){
            ans = i;
            max = count;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def main():
    K = int(input())
    if 0<=K<=10:
        print(K)
        exit()

    lunlun = [i for i in range(1,10)]
    m = 0

    while len(lunlun) < K:
        x = lunlun[m]
        btm = x % 10

        if btm - 1 >= 0:
            lunlun.append(10*x+btm-1)

        lunlun.append(10*x+btm)

        if btm + 1 < 10:
            lunlun.append(10*x+btm+1)

        m += 1

    print(lunlun[::-1][len(lunlun)-K])

if __name__ == "__main__":
  main()


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

int main(void) {
  long long N, M;
  cin >> N >> M;
  vector<long long> ans(N, 0);
  vector<long long> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  vector<long long> A(M), B(M);
  for (int i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
    ans[A[i]] = max(ans[A[i]], H[B[i]]);
    ans[B[i]] = max(ans[B[i]], H[A[i]]);
  }

  long long cnt = 0;
  for (int i = 0; i < N; i++) {
    cnt += H[i] > ans[i];
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 6420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int main(){
    ll N;
    cin >> N;

    vector<ll> A(N);
    ll total_move = 0;
    for(int i=0;i<N;i++){
        cin >> A[i];
        total_move += A[i];
    }

    if(total_move % (N * (N+1) / 2) != 0){
        cout << "NO" << endl;
        return 0;
    }
    total_move /= N * (N+1) / 2;

    vector<ll> d(N);
    d[0] = A[0] - A[N-1] - total_move;
    for(int i=1;i<N;i++){
        d[i] = A[i] - A[i-1] - total_move;
    }

    ll move = 0;
    bool ok = true;
    for(int i=0;i<N;i++){
        if(d[i] > 0 || (-d[i]) % N != 0){
            ok = false;
            break;
        }
        move += (-d[i]) / N;
    }

    if(ok && move == total_move) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    set<char> st;
    bool ok = 1;
    REP(i,s.size()){
        if(st.count(s[i])) ok = 0;
        st.insert(s[i]);
    }
    yn(ok);

    return 0;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
h = [0]*N
for i in range(N):
    h[i] = int(input())
h = sorted(h)
ans = 10**10
for i in range(N-(K-1)):
    tmp = h[i+K-1] - h[i]
    ans = min(tmp,ans)
print(ans)

Measured memory_bytes: 13940
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a<b)
	{
		if(b<c)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
		
	}
	else
	{
		printf("No\n");
	}
	
	return 0;
	
}

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

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) > (0) ? (a) : -(a))
#define ALLOC(size,type) ((type*) calloc ((size), sizeof (type)))

const i32 f = 10;

i64 max_diff;
i64 max_val;
void calc (i32 k, i32 *a, i64 v, i32 len) {
  if (k == f - 1) {
    i64 t = 0;
    i64 p = 1;
    for (i32 i = 0; i < len; ++i) {
      t = 10 * t + a[i];
      p *= 10;
    }
    i64 diff = MIN (ABS (t - v), p - ABS(t - v));
    if (diff > max_diff || (diff == max_diff && max_val > t)) {
      max_diff = diff;
      max_val = t;
    }
    return;
  }
  calc (k + 1, a, v, len);
  for (i32 i = k + 1; i < f; ++i) {
    i32 swap = a[k];
    a[k] = a[i];
    a[i] = swap;
    calc (k + 1, a, v, len);
  }
  i32 q = a[k];
  for (i32 i = k + 1; i < f; ++i) {
    a[i - 1] = a[i];
  }
  a[f - 1] = q;
}

void run (void) {
  char s[11];
  scanf ("%s", s);
  i32 len = strlen (s);
  i64 v = 0;
  for (i32 i = 0; i < len; ++i) {
    v = 10 * v + s[i] - '0';
  }
  i32 a[10];
  for (i32 i = 0; i < f; ++i) {
    a[i] = i;
  }
  max_diff = 0;
  max_val = 1000000000000;
  calc (0, a, v, len);
  i64 p = 1;
  for (i32 i = 1; i < len; ++i) {
    p *= 10;
  }
  if (max_val < p) putchar ('0');
  printf ("%" PRIi64 "\n", max_val);
}

int main (void) {
  run();
  return 0;
}



Measured memory_bytes: 2060
fun main(args: Array<String>) {
    val numberOfEmployees = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }.sorted()

    var searedAt = 0
    (1..numberOfEmployees).forEach { employeeId ->
        var sum = 0
        for (i in searedAt until A.size) {
            if (A[i] == employeeId) {
                sum ++
            } else {
                println(sum)
                searedAt = i
                return@forEach
            }

            if (i == A.size - 1) {
                println(sum)
                searedAt = i
            }
        }
    }
}


Measured memory_bytes: 78300
import java.util.*;
import static java.lang.System.*;
	public class Main {
		public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			int r = Integer.parseInt(sc.next());
			int g = Integer.parseInt(sc.next());
			int b = Integer.parseInt(sc.next());
			
			if( (r * 100 + g * 10 + b) % 4 == 0 ) {
				System.out.println("YES");
			
			} else {
				System.out.println("NO");
			
		}
	}
}

Measured memory_bytes: 21076
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
  int a;
  int b;
  cin >> a >> b;
  while(a!=0&&b!=0){
      for(int i=0;i<a;i++){
          for(int j=0;j<b;j++){
              putchar('#');
          }
          putchar('\n');
      }
      cin >> a >> b;
      putchar('\n');
  }
  return 0;
}


Measured memory_bytes: 3076
use proconio::input;
use proconio::marker::Usize1;

fn main() {
    input! {
        n: usize,
        m: usize,
        h: [usize; n],
        edges: [(Usize1, Usize1); m],
    }

    // let mut graph = vec![vec![]; n];
    // for &(a, b) in &edges {
    //     graph[a].push(b);
    //     graph[b].push(a);
    // }
    // let graph = graph;

    let mut v_good = vec![true; n];
    for &(a, b) in &edges {
        if h[a] >= h[b] {
            v_good[b] = false;
        }
        if h[a] <= h[b] {
            v_good[a] = false;
        }
    }

    let ans = v_good.iter().filter(|x| **x).count();
    println!("{}", ans);
}


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

using namespace std;

long long a[100100];

int main()
{
    int n,i;
    long long ans=2,sum=2;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        cin >> a[i];
    }
    for(i=n;i>0;i--)
    {
        if(ans%a[i])
        {
            ans/=a[i];
            ans=ans*a[i]+a[i];
        }
        sum=(sum/a[i]+1)*a[i]-1;
    }
    if(ans>sum) cout << -1 << endl;
    else cout << ans << " " << sum << endl;
    return 0;
}

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

int point,a,b;

int main (){
  a=0;
  b=0;
  for(int i=0;i<4;i++){
    scanf("%d",&point);
    a = a + point;
  }

  for(int i=0;i<4;i++){
    scanf("%d",&point);  
    b = b + point;
  }

  if(a>b){
    printf("%d\n",a);
  }
  else{
    printf("%d\n",b);
  }
}

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

int main(){
    int n; cin >> n;
    vector<int> l(n);
    rep(i,n){
        cin >> l[i];
    }
    sort(l.begin(),l.end());

    ll res = 0;
    for(int i=n-1;i>=0;i--){
        for(int j=i-1;j>=0;j--){
            auto it = lower_bound(l.begin(),l.end(),l[i]+l[j]);
            ll ng = distance(it, l.end());
            res += (n-1-i)-ng;
        }
    }
    cout << res << endl;
}

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

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	int ans = 0;
	if(b >= 10 && b <= 99) a = a * 100 + b;
	else if(b < 10) a = a * 10 + b;
	else a = a * 1000 + b;
	int p = sqrt((double)a);
	if(p * p == a) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

template <class T>
inline void relax(T &a, const T &b)
{
	if (b > a)
		a = b;
}
template <class T>
inline void tense(T &a, const T &b)
{
	if (b < a)
		a = b;
}

const int MaxN = 200000;
const int MaxM = 200000;
const int MaxNF = 18;

int n, m;
int a[MaxN + 1];

int nF = 0;
int d[MaxNF + 1];

int f[1 << MaxNF], vl[MaxN + 1][MaxNF + 1];
int g[1 << MaxNF], vr[MaxN + 1][MaxNF + 1];

int h[MaxN + 1];

int main()
{
	ios::sync_with_stdio(false);

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

	while (1 << nF <= m)
		++nF;
	for (int i = nF; i >= 0; --i)
		d[i] = m, m >>= 1;

	for (int i = 0; i <= nF; ++i)
		vl[0][i] = 0, vr[n + 1][i] = n + 1;
	for (int i = 1; i <= n; ++i)
		for (int j = 0; j <= nF; ++j)
			vl[i][j] = a[i] - a[i - 1] <= d[j] ? vl[i - 1][j] : i - 1;
	for (int i = n; i; --i)
		for (int j = 0; j <= nF; ++j)
			vr[i][j] = a[i + 1] - a[i] <= d[j] ? vr[i + 1][j] : i + 1;

	for (int s = 0; s < 1 << nF; ++s)
	{
		f[s] = 1, g[s] = n;
		for (int i = 0; i < nF; ++i)
		{
			if (~s >> i & 1)
				continue;
			relax(f[s], vr[f[s ^ 1 << i]][i]);
			tense(g[s], vl[g[s ^ 1 << i]][i]);
		}
	}

	for (int s = 0; s < 1 << nF; ++s)
		relax(h[g[s]], f[s ^ ((1 << nF) - 1)]);
	for (int i = 1; i <= n; ++i)
		relax(h[i], h[i - 1]);

	for (int i = 1; i <= n; ++i)
		puts(h[vr[i][nF] - 1] > vl[i][nF] ? "Possible" : "Impossible");

	return 0;
}

Measured memory_bytes: 35712
import collections
a=int(input())
s=[input()for _ in range(a)]
c=collections.Counter(s)
m=0 
for v in c.values(): 
    m=max(m,v)
ans=[]
for k,v in c.items():
    if m == v:
        ans.append(k)
ans.sort()
for i in ans:
    print(i)


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	vector<ll> a(2*N);
	REP(i, 2*N) cin >> a[i];
	sort(a.begin(), a.end());
	ll res = 0;
	REP(i, N){
		res += a[2*i];
	}
	cout << res << endl;
    return 0;
}

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

const int mn=1e5+7;

int main()
{
	LL n;double t;
	cin>>n>>t;
	LL a=(t+0.001)*100;

	printf("%lld",n*a/100);
}

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

string S;

int main(){
	cin>>S;
	int c;
	if(S=="RRR")c=3;
	if(S=="RRS")c=2;
	if(S=="SRR")c=2;
	if(S=="SRS")c=1;
	if(S=="RSR")c=1;
	if(S=="SSR")c=1;
	if(S=="RSS")c=1;
	if(S=="SSS")c=0;
	cout<<c<<endl;
}


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

#define ll long long

const ll MOD = 1000000007;
int main() {
  int H, W;
  cin >> H >> W;
  
  char a[1010][1010];
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> a[i+1][j+1];
    }
  }
  
  ll dp[1010][1010];
  memset(dp, 0, sizeof(dp));
  
  for (int i = 1; i <= H; i++) {
    if (a[i][1] == '.') {
      dp[i][1] = 1;
    } else break;
  }
  for (int j = 1; j <= W; j++) {
    if (a[1][j] == '.') {
      dp[1][j] = 1;
    } else break;
  }
  

  
  for (int i = 1; i<= H-1; i++) {
    for (int j = 1; j <= W-1; j++) {
      if (a[i+1][j+1] == '#') continue;
      dp[i+1][j+1] = dp[i][j+1] + dp[i+1][j];
      
      if (dp[i+1][j+1] >= MOD) dp[i+1][j+1] -= MOD;
    }
  }
  

  
  cout << dp[H][W] << endl;
  
  
}

Measured memory_bytes: 9216
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)((n>>m)&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,m=INF,mi;
ll a[110];
int main(){
	scanf("%lld",&n);
	ll s=0;
	rep(i,0,n){
		scanf("%lld",a+i);
		s+=a[i];
	}
	rep(i,0,n){
		if(abs(a[i]*n-s)<m){
			mi=i;
			m=abs(a[i]*n-s);
		}
	}
	printf("%d",mi);
}

Measured memory_bytes: 128
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_E
# Elementary Number Theory - Extended Euclid Algorithm

def ext_gcd(a, b)
  if (b == 0)
    [1, 0]
  else
    q, t = a.divmod(b)
    x, y = ext_gcd(b, a % b)
    [y, x - q * y]
  end
end

a, b = gets.split.map(&:to_i)
x, y = ext_gcd(a, b)
puts "#{x} #{y}"



Measured memory_bytes: 6864
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n;
	scanf("%d", &n);
	printf("%d\n", 800*n - 200*(n/15));
	return 0;
}



Measured memory_bytes: 3780
// A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>

using namespace std;
int main()
{
    int a, b, c, d, e, k;

    cin >> a >> b >> c >> d >> e >> k;

    if (e - a <= k) {
        cout << "Yay!" << endl;
    }
    else {
        cout << ":(" << endl;
    }

    return 0;
}



Measured memory_bytes: 3548
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
using namespace std;

const double pi = acos(-1);
#define nyan cout << "(=^•ω•^=)" << endl;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop while(true)

int p[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int cnt[15];
int ans;

void generate(int n){
    loop{
        int start=n;
        for(int i=0;i<15;i++){
            if(n%p[i]==0){
                n/=p[i];
                cnt[i]++;
            }
        }
        if(start==n)break;
    }
}

signed main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++)generate(i);
    for(int i=0;i<15;i++)if(cnt[i]>=74)ans++;
    for(int i=0;i<15;i++){
        for(int j=0;j<15;j++){
            if(i==j)continue;
            if(cnt[i]>=24&&cnt[j]>=2)ans++;
        }
    }
    for(int i=0;i<15;i++){
        for(int j=0;j<15;j++){
            if(i==j)continue;
            if(cnt[i]>=14&&cnt[j]>=4)ans++;
        }
    }
    for(int i=0;i<15;i++){
        for(int j=i+1;j<15;j++){
            for(int k=0;k<15;k++){
                if(k==i||k==j)continue;
                if(cnt[i]>=4&&cnt[j]>=4&&cnt[k]>=2)ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
(r, c) = [int(i) for i in input().split()]
src = []
for _ in range(r):
    row = [int(i) for i in input().split()]
    row.append(sum(row))
    src.append(row)
 
last_row = [0 for _ in range(c + 1)]
for rc in range(r):
    for cc in range(c+1):
        last_row[cc] += src[rc][cc]
 
src.append(last_row)
 
 
for rc in range(r + 1):
    print(' '.join([str(a) for a in src[rc]]))

Measured memory_bytes: 7744
#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000
int L[MAX/2 + 2], R[MAX/2 +2];
int count = 0;

void merge(int A[], int left, int mid, int right)
{
	int i, j, k;
	int n1 = mid - left;
	int n2 = right - mid;
	for(i = 0; i < n1; i++)
		L[i] = A[left+i];
	for(i = 0; i < n2; i++)
		R[i] = A[mid+i];
	L[n1] = SENTINEL;
	R[n2] = SENTINEL;
	i = 0;
	j = 0;
	for(k = left; k < right; k++) {
		count++;
		if(L[i] <= R[j]) {
			A[k] = L[i++];
		}
		else {
			A[k] = R[j++];
		}
	}
}

void mergeSort(int A[], int left, int right)
{	
	if(left + 1 < right) {
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}
int main()
{	
	int A[MAX];
	int i, n;

	scanf("%d", &n);
	for(i = 0; i < n; i++)
		scanf("%d", &A[i]);

	mergeSort(A, 0, n);

	for(i = 0; i < n; i++) {
		if(i == n-1)
			printf("%d\n", A[i]);
		else
			printf("%d ", A[i]);
	}

	printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 4504
N = int(input())
nums = []

for i in range(1, int(N**0.5)+1):
    if not N % i:
        n = N // i
        if i == n:
            nums.append(i-1)
        else:
            nums.extend([i-1, n-1])

print(sum([n for n in nums[1:] if N // n == N % n]))

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

int main()
{
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    s1[0] = toupper(s1[0]);
    s2[0] = toupper(s2[0]);
    s3[0] = toupper(s3[0]);

    cout << s1[0] << s2[0] << s3[0] << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second
vector<P>v1,v2;
int a[101],dp1[100001],dp2[100001],n,t1,t2,t;
string s;
main(){
	while(cin>>n,n){
		int ans=1e8;
		r(i,100001)dp1[i]=dp2[i]=1e6;
		dp1[0]=dp2[0]=0;
		v1.clear();
		v2.clear();
		r(i,n)cin>>a[i];
		cin>>t;
		r(i,t){
			cin>>s>>t1>>s>>t2;
			if(t2>100000)t2=100000;
			if(s=="All")v1.push_back(P(t1,t2));
			else v2.push_back(P(t1,t2));
		}
		r(i,v1.size())r(j,100001)if(j+v1[i].S<=100001)
		  dp1[j+v1[i].S]=min(dp1[j+v1[i].S],dp1[j]+v1[i].F);
		  else dp1[100000]=min(dp1[100000],dp1[j]+v1[i].F);
		r(i,v2.size())r(j,100001)if(j+v2[i].S<=100001)
		  dp2[j+v2[i].S]=min(dp2[j+v2[i].S],dp2[j]+v2[i].F);
		  else dp2[100000]=min(dp2[100000],dp2[j]+v2[i].F);
		for(int i=99999;i>=0;i--){
			dp1[i]=min(dp1[i],dp1[i+1]);
			dp2[i]=min(dp2[i],dp2[i+1]);
		}
		r(i,100001)if(dp1[i]!=1e8){
			int sum=0;
			r(j,n)if(a[j]-i>0)sum+=dp2[a[j]-i];
			ans=min(ans,sum+dp1[i]);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3804
# 入力部
N = int(input())

s = list()
for i in range(0, N):
  val = str(input())
  s.append(val)
  
# 計算部
result_dic = {}

for i in range(0, len(s)):
  sorted_val = ''.join(sorted(s[i]))
  if sorted_val in result_dic:
    result_dic[sorted_val] += 1
  else:
    result_dic[sorted_val] = 1

result_count = 0
for val in result_dic.values():
  result_count += val * (val - 1) // 2

print(result_count)

Measured memory_bytes: 24988
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<double>a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    a.at(i)=1/a.at(i);
  }
  double k=0;
  for(int i=0;i<n;i++)k+=a.at(i);
  k=1/k;
  cout<<k<<endl;
}
  
  
  
  

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<map>
#include<string>

using namespace std;

int main() {
	int q_cnt, ans_cnt;
	cin >> q_cnt >> ans_cnt;
	set<int> cleared;
	map<int, int> wa_cnts;

	for (int i = 0; i < ans_cnt; i++) {
		int q;
		string result;
		cin >> q >> result;
		if (result == "AC") {
			cleared.insert(q);
		}
		else {
			if (cleared.count(q) == 0) {
				if (wa_cnts.count(q) == 0) {
					wa_cnts[q] = 1;
				}
				else {
					wa_cnts[q]++;
				}
			}
		}
	}

	int wa_cnt = 0;
	for (auto it = wa_cnts.begin(); it != wa_cnts.end(); it++) {
		if (cleared.count(it->first) > 0) {
			wa_cnt += it->second;
		}
	}

	cout << cleared.size() << " " << wa_cnt << endl;

	return 0;
}

Measured memory_bytes: 4992
s=[]
while True:
    tmp=list(map(int,input().split()))
    if tmp==[0,0]:
        break
    else:
        s.append(tmp)

for si in s:
    H,W=si[0],si[1]
    for i in range(H):
        for j in range(W):
            if i%2==0:
                if j%2==0:
                    print("#",end="")
                else:
                    print(".",end="")
            else:
                if j%2==0:
                    print(".",end="")
                else:
                    print("#",end="")
        print()
    print()



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

ll janken(char c, ll r, ll s, ll p)
{
  if (c == 'r') return p;
  if (c == 's') return r;
  if (c == 'p') return s;
  return 0;
}

int main()
{
  ll N;
  cin >> N;
  ll K;
  cin >> K;
  ll R;
  cin >> R;
  ll S;
  cin >> S;
  ll P;
  cin >> P;
  string T;
  cin >> T;

  ll ans = 0;
  for (int i=0; i<N; i++) {
    if (i < K || T[i-K] != T[i]) ans += janken(T[i], R, S, P);
    else T[i] = 'a';
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
n=int(input())
l=list(map(int,input().split()))
if n==1:
    print(l[0])
    if l[0]==1:print(1)
    exit()
ans=[0]*(n//2)+l[n//2:n]
for i in range(n//2-1,-1,-1):
    s= sum([ans[j] for j in range((i+1)*2-1,n,i+1)])%2
    ans[i]=(l[i]+s)%2
lans=[]
for i in range(n):
    if ans[i]==1:lans.append(i+1)
print(sum(ans))
if sum(ans)>0:print(*lans)

Measured memory_bytes: 14132
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

LL lcm(LL a,LL b){
	return a*b/gcd(a,b);
}

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int n;
	cin>>n;
	int ans = 0;
	for(int a = 1;a<=n;a++){
		for(int b=1;b<=n;b++){
			if(a*b<n){
				ans++;
			}else{
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int a,b,c;
	cin >> a >> b >> c;
	if (a+b < c){
		cout << "No";
		return 0;
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int w, h,x,y,r;
	scanf("%d", &w);
	scanf("%d", &h);
	scanf("%d", &x);
	scanf("%d", &y);
	scanf("%d", &r);
	if ((x - r) < 0 || (x + r) > w || (y - r) < 0 || (y + r) > h) {
		printf("No\n");
	} else {
		printf("Yes\n");
	}

	return 0;
}

Measured memory_bytes: 584
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
using namespace std;

int main()
{
	int a, sum;
	char op;
	cin >> a;
	sum = a;
	a = 0;
	for (int i = 1; i < 100000000; i++) {
		if (i % 2 == 0) {
			cin >> a;
			if (op == '+') {
				sum += a;
			}
			else if (op == '-') {
				sum -= a;
			}
			else if (op == '*') {
				sum *= a;
			}
			else {
				sum /= a;
			}
			a = 0;
		}
		else {
			cin >> op;
			if (op == '=') break;
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#define INF 0x3f3f3f3f
#define lowbit(x) x & -x
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=3e3+5;
int mp[N][N];
ll dp[N][N][5];
int main(){
#ifdef Mizp
    freopen("in.txt","r",stdin);
#endif
    int n,m,kk;
    scanf("%d%d%d",&n,&m,&kk);
    for(int i=1;i<=kk;i++){
        int x,y,val;
        scanf("%d%d%d",&x,&y,&val);
        mp[x][y]=val;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            dp[i][j][0]=dp[i][j-1][0];
            for(int k=0;k<=3;k++){
                dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][k]);
                if(mp[i][j])
                    dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][k]+mp[i][j]);
            }
            for(int k=1;k<=3;k++){
                dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k]);
                if(mp[i][j])
                    dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+mp[i][j]);
                
            }
        }
    }
    
    printf("%lld\n",max(max(dp[n][m][0],dp[n][m][1]),max(dp[n][m][2],dp[n][m][3])));
    return 0;
}


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

using namespace std;

const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;

int n, m, head[maxn], cnt, dis[maxn], vis[maxn];
struct Graph{int to, nt, C;}e[maxn << 1];
set<int>S[maxn];
priority_queue<pair<int, int> >q;

inline int read() {
	char ch = getchar(); int u = 0, f = 1;
	while(!isdigit(ch)){if(ch == '-')f = -1; ch = getchar();}
	while(isdigit(ch)){u = u * 10 + ch - 48; ch = getchar();} return u * f;
}

inline void ini(int x, int y, int C) {e[++cnt] = (Graph){y, head[x], C}; head[x] = cnt;}

inline void Dij(int s) {
	memset(dis, 0x3f, sizeof(dis));
	memset(vis, 0, sizeof(vis));
	q.push(make_pair(dis[s] = 0, s));
	while(!q.empty()) {
		int now = q.top().second; q.pop();
		if(vis[now])continue; vis[now] = 1;
		for(register int i = head[now]; i; i = e[i].nt) {
			int v = e[i].to, w;
			w = S[now].count(e[i].C) ? 0 : 1;
			if(dis[v] > dis[now] + w) {
				dis[v] = dis[now] + w;
				q.push(make_pair(-dis[v], v));
				S[v].clear();
				S[v].insert(e[i].C);
			}
			else if(dis[v] == dis[now] + w) S[v].insert(e[i].C);
		}
	}
}

int main(){
	n = read(); m = read();
	for(register int i = 1; i <= m; i++){
		int x = read(), y = read(), C = read();
		ini(x, y, C); ini(y, x, C);
	}
	Dij(1);
	cout << (dis[n] == inf ? -1 : dis[n]);
	return 0;
}

Measured memory_bytes: 44792
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	int n, s;
	
	while(cin>>n){
		if(n < 3){
			s = n;
		} if(n%2 == 0){
			s = 0;
			for(int i = 0; i < n/2; i++){
				s += 2*pow(3.0, (double)i);
			}
		} else {
			s = 0;
			for(int i = 0; i <= n/2; i++){
				s += 2*pow(3.0, (double)i);
			}
			s -= pow(3.0, (double)((int)(n/2)));
		}
		cout << s << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;


int main(){
  
  string x,y,z; cin>>x>>y>>z;
  cout<<x.at(0)<<y.at(1)<<z.at(2)<<endl;
  
  
}


Measured memory_bytes: 3608
N = int(input())
l = [[0] * 10 for i in range(10)]

for i in range(1, N+1):
    s = len(str(i))
    if s == 1:
        l[i][i] += 1
    else:
        l[i//(10**(s-1))][i%10] += 1

ans = 0

for i in range(1, 10):
    for j in range(1, 10):
        ans += l[i][j] * l[j][i]

#for i in range(10):
#    print(l[i])

print(ans)

Measured memory_bytes: 9188
import java.util.Scanner;

public class Main {

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

        int x = s.nextInt();
        int a = s.nextInt();
        int b = s.nextInt();

        int res = x - a;
        int res2 = res % b;
        System.out.println(res2);

    }
}


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

int main() {
  int w, h, n; cin >> w >> h >> n;
  vector<bool> bx(w, true);
  vector<bool> by(h, true);
  for (int k = 0; k < n; k++) {
    int x, y, a; cin >> x >> y >> a;
    if      (a == 1) for (int j = 0; j < x; j++) bx.at(j) = false;
    else if (a == 2) for (int j = x; j < w; j++) bx.at(j) = false;
    else if (a == 3) for (int j = 0; j < y; j++) by.at(j) = false;
    else if (a == 4) for (int j = y; j < h; j++) by.at(j) = false;
  }
  int cntx = 0, cnty = 0;
  for (bool e: bx) if (e) cntx++;
  for (bool e: by) if (e) cnty++;

  int ans = cntx * cnty;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
const int X=20;
const int Y=20;
int main(){
    int n,m,dp[X][Y],s[X][Y],k,ans;
    while(true){
        scanf("%d%d",&m,&n);
        if(n==0&&m==0)return 0;
        ans=0;
        for(int i=0;i<n+2;i++)for(int j=0;j<m;j++)dp[i][j]=s[i][j]=0;
        for(int i=0;i<m;i++)dp[0][i]=1;
        for(int i=0;i<n;i++)for(int j=0;j<m;j++){
            scanf("%d",&k);
            if(k==0){
                dp[i][j]+=s[i][j];
                if(i==n-1)continue;
                dp[i+1][j]+=dp[i][j];
                if(j!=0)s[i+1][j-1]+=dp[i][j];
                if(j!=m-1)s[i+1][j+1]+=dp[i][j];
            }
            else if(k==2){
                s[i][j]=0;
                dp[i+2][j]+=dp[i][j];
            }
            else dp[i][j]=0;
        }
        for(int i=0;i<m;i++)ans+=dp[n][i]+dp[n-1][i];
        printf("%d\n",ans);
    }
}


Measured memory_bytes: 2580
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n, m = i_map()
    num_list = i_list()

    for i in range(n):
        num_list[i] *= -1

    heapify(num_list)

    for _ in range(m):
        pop_num = heappop(num_list) * -1
        heappush(num_list, pop_num//2 * -1)

    print(sum(num_list)*-1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 93016
import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */

public class Main{
	
	

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		
		if(a<(b*2)) {
			System.out.println(0);
		}
		else {
			System.out.println((a)-(b*2));
		}

	}
}

Measured memory_bytes: 25300