akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);

#define F first
#define S second
#define pb push_back
#define int long long
#define maxn 200000
#define mod 1000000007
#define inf 1000000000000000000

#define fr(i,a,b) for(int i=a;i<b;i++)
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); //freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);
#define all(x) begin(x), end(x)
#define PII pair<int, int>
#define VI vector<int>
#define VII vector<PII>

using namespace std;

int n, dp[3001][3001], pref_sum[3001];
string s;

signed main()
{
    FLASH

    cin>>n>>s;
    dp[1][1] = 1;
    fr(j, 1, n + 1) pref_sum[j] = pref_sum[j  - 1] + dp[1][j];

    fr(i, 2, n + 1){
    	fr(j, 1, i + 1){
    		if(s[i - 2] == '<'){
    			dp[i][j] = pref_sum[j - 1];
    		}
    		else dp[i][j] = pref_sum[i] + mod - pref_sum[j - 1];
    		dp[i][j] %= mod;
    	}
    	fr(j, 1, n + 1) pref_sum[j] = (pref_sum[j - 1] + dp[i][j])%mod;
    }

    int ans = 0;
    fr(j, 1, n + 1) ans += dp[n][j], ans %= mod;
    cout<<ans<<'\n';
}

Measured memory_bytes: 68992
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        // 変数宣言
        String result = "No";

        // 入力処理
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        // 演算処理
        if( a == b || a == c || b == c ){
            if( !( a==b && b==c ) ){
                result = "Yes";
            }
        }
        
        // 出力
        System.out.println( result );
    }
}

Measured memory_bytes: 21844
using System;
using System.Linq;
using System.Collections.Generic;

namespace TaskC
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] A = System.Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();
            int[] B = System.Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();
            IDictionary<int, int> upper_bound = new Dictionary<int, int>();
            IDictionary<int, int> lower_bound = new Dictionary<int, int>();

            int[][] c_A = Enumerable.Range(0, n).Select(x => new [] { A[x], x }).ToArray();
            int[][] c_B = Enumerable.Range(0, n).Select(x => new [] { B[x], x }).ToArray();

            Func<int[], int[], int> cmp = (x, y) =>
            {
                return x[0] - y[0];
            };

            Array.Sort(c_A, (x, y) => x[0] - y[0]);
            Array.Sort(c_B, (x, y) => x[0] - y[0]);

            for(int i = 0; i < n; ++i)
            {
                if(c_A[i][0] > c_B[i][0])
                {
                    System.Console.WriteLine("No");
                    return;
                }
            }
            
            for(int i = 0; i < n - 1; ++i)
                if(c_A[i + 1][0] <= c_B[i][0])
                {
                    System.Console.WriteLine("Yes");
                    return;
                }

            int[] pos = new int[n];
            for(int i = 0; i < n; ++i)
                pos[c_A[i][1]] = c_B[i][1];
            
            int cycles = 0;
            HashSet<int> mrk = new HashSet<int>();
            for(int i = 0; i < n; ++i)
            {
                if(mrk.Contains(i))
                    continue;
                ++cycles;   
                int x = pos[i];
                while(x != i)
                {
                    mrk.Add(x);
                    x = pos[x];
                }
            }
            if(cycles > 1)
                System.Console.WriteLine("Yes");
            else
                System.Console.WriteLine("No");
        }
    }
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main()
{
    double n, k;
    cin >> n >> k;
    double res = 0;
    rep(i, n)
    {
        double now = 1.0 / n;
        ll pp = i + 1;
        while (pp < k)
        {
            pp *= 2;
            now /= 2.0;
        }
        res += now;
    }
    cout << setprecision(15) << res << endl;

    return 0;
}

Measured memory_bytes: 3788
[O,E]=[list(input()) for i in range(2)]
pas=["z" for i in range(len(O)+len(E))]
for i in range(len(pas)):
    if i%2==0:#奇数番目
        pas[i]=O[i//2]
    else:
        pas[i]=E[i//2]
print("".join(pas))

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

using namespace std;

typedef long long ll;

int main()

{


    ll k,n;
    cin>>k>>n;

    ll arr[n];

    ll maax ;

    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }

     maax= k- (arr[n-1]-arr[0]);
     for(int i=1;i<n;i++)
    {
        maax = max(arr[i]-arr[i-1],maax);
    }
   // cout<<maax<<endl;

    cout<<k-maax<<endl;





    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int>P;

#define INF 2<<29
#define F first
#define S second

int main(){
  int a,b;

  for(int i=0;i<7;i++){
    scanf("%d %d",&a,&b);
    printf("%d\n",a-b);
  }
  
  
  return (0);
}



Measured memory_bytes: 3204
#define _USE_MATH_DEFINES
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main()
{
    double r;

    cin >> r;

    cout << fixed;
    cout << setprecision(6) << M_PI * r * r << " " << 2 * M_PI * r << endl;

    return 0;
}


Measured memory_bytes: 3188
# 累積和
N = int(input())
S = list(input())
c = [0] * (N+1)
for i in range(N):
    c[i+1] = c[i]
    if S[i] == 'W':
        c[i+1] += 1

ans = N
for i in range(1,N+1):
    ans = min(ans, c[i-1] + ((N - i) - (c[N] - c[i])))
print(ans)

Measured memory_bytes: 17484
n = int(input())
H = list(map(int,input().split()))
H[0] -= 1
ans = "Yes"
for i in range(1,n):
    if H[i] < H[i-1]:
        ans = "No"
        break
    if H[i]-1 >= H[i-1]:
        H[i]-=1
print(ans)

Measured memory_bytes: 14396
import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String aa[]=sc.nextLine().split(" ");
		int a=Integer.parseInt(aa[0]);
		int b=Integer.parseInt(aa[1]);
		int v=Integer.parseInt(aa[2]);

		System.out.println(b/v-a/v+(a%v==0?1:0));
	}
}

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

using namespace std;
typedef long long ll;

int H,W,K;
int m[40][40];
int n[40][40];
string s[40];

void printn(){
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cout << n[i][j] << ' ';
        }
        cout << endl;
    }
    cout << "-----------------------" << endl;
}

int sc(int t){
    int score = 0;
    for(int i=0;i<H;i++){
        int now = 0;
        int l = 0;
        for(int j=0;j<W;j++){
            if(n[i][j] == 0){
                if(l >= K){
                    score += now * l;
                    for(int k=0;k<l;k++) n[i][j-1-k] = 0;
                }
                now = 0;
                l = 0;
                continue;
            }
            if(n[i][j] == now){
                l++;
                continue;
            }
            if(l >= K){
                score += now * l;
                for(int k=0;k<l;k++) n[i][j-1-k] = 0;
            }
            now = n[i][j];
            l = 1;
        }
        if(l >= K){
            score += now * l;
            for(int k=0;k<l;k++) n[i][W-1-k] = 0;
        }        
    }
    return score * t;
}

void fall(){
    for(int i=0;i<W;i++){
        vector<int> v;
        for(int j=H-1;j>=0;j--){
            if(n[j][i] != 0) v.push_back(n[j][i]);
        }
        for(int j=0;j<H;j++) n[j][i] = 0;
        for(int j=0;j<v.size();j++) n[H-1-j][i] = v[j];
    }
}

int calc(int h, int w){
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            n[i][j] = m[i][j];
        }
    }
    n[h][w] = 0;
    //printn();
    fall();
    int score = 0;
    int turn = 1;
    while(true){
        //printn();
        int s = sc(turn);
        score += s;
        //printn();
        if(s == 0) break;
        fall();
        turn *= 2;
    }
    return score;
}

int main(){
    cin >> H >> W >> K;
    for(int i=0;i<H;i++) cin >> s[i];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            m[i][j] = s[i][j] - '0';
        }
    }
    int max_p = 0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            max_p = max(max_p, calc(i,j));
        }
    }
    cout << max_p << endl;
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

ll xor_sum(ll n)
{
    ll ans;
    n += 1;
    if (n % 2 == 0)
    {
        if (n % 4 == 0)
            ans = 0;
        else
            ans = 1;
    }
    else
    {
        if ((n - 1) % 4 == 0)
            ans = n - 1;
        else
            ans = n;
    }

    return ans;
}

int main()
{
    ll a, b;
    cin >> a >> b;

    ll c = xor_sum(a - 1) ^ xor_sum(b);
    OP(c);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll a, b, c, i;
    cin >> a >> b >> c; 
	i = abs(a-c);
	if(c>(a+b)){
	cout<<0<<' '<<0;
	}else if(c>a){
		cout<<0<<' '<<(b-i);
	}else{
	
	cout<<i<<' '<<b;
	}
	
	
	
	


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n;
long long f[N][3], a[N], b[N], c[N];
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        scanf("%lld%lld%lld", &a[i], &b[i], &c[i]);
        f[i][0] = f[i][1] = f[i][2] = - 1e9;
    }
    f[1][0] = a[1], f[1][1] = b[1], f[1][2] = c[1];
    for (int i = 2; i <= n; i++)
    {
        f[i][0] = max(f[i - 1][1], f[i - 1][2]) + a[i];
        f[i][1] = max(f[i - 1][0], f[i - 1][2]) + b[i];
        f[i][2] = max(f[i - 1][1], f[i - 1][0]) + c[i];
    }
    long long ans = max(f[n][0], max(f[n][1], f[n][2]));
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
long long n,t=0,ans=0;
int main(){
    cin>>n;
    for(int i=sqrt(n);i>0;--i)
        if(n%i==0){
            t=n/i;
            break;
        }
    while(t>0){
        ans++;
        t/=10;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<iostream>
//#include<cmath>
#define rep(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll;
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=1e5+10;
void io(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
int main()
{
	io();
	ll n;cin>>n;
	if(n==1){
		cout<<"0"<<endl;
		return 0;
	}n--;
	ll ans;
	if(n%2==0){
		ans=n/2;
		ans=ans*(n+1);
	}else{
		ans=(n+1)/2;
		ans=ans*n;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------
 
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
 
int main(void) {
    int n; cin >> n;
 
    while(n>0) {
        if(n%10==7) {
            cout << "Yes" << endl;
            return 0;
        }
        n /= 10;
    }
    cout << "No" << endl;
    return 0;
}

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

class Main {

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		long H;
		H = sc.nextLong();
		long A;
		A = sc.nextLong();
		System.out.println(H / A + ((H % A > 0) ? 1 : 0));
	}
}


Measured memory_bytes: 23764
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int n = in.nextInt();
        int y = in.nextInt();
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                if (i * 10000 + j * 5000 + (n - (i + j)) * 1000 == y) {
                    out.printf("%d %d %d", i, j, n - (i + j));
                    return;
                }
            }
        }

        out.println("-1 -1 -1");
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

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

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

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

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Measured memory_bytes: 22996
# -*- coding: utf-8 -*-
"""



"""
import sys


def solve(N, X, L):
    ans = 0
    pos = 0
    while pos <= X and L:
        pos += L.pop(0)
        ans += 1
    return ans+1 if pos <= X else ans


def main(args):
    N, X = map(int, input().split())
    L = [int(l) for l in input().split()]
    ans = solve(N, X, L)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

void Main()
{
  ll n; cin >> n;
  string c; cin >> c;
  ll cnt = 0;
  ll nw = 0;
  rep(i,n-1) {
    if (c[i] == 'W' and c[i+1] == 'R') cnt++;
    if (c[i] == 'W') nw++;
  }
  if (c[n-1] == 'W') nw++;
  ll nr = n - nw;
  if (cnt == 0) {cout << 0 << endl; return;}
  ll ans = 0;
  rep(i, nr) {
    if (c[i] == 'W') {
      ans++;
    }
  }
  cout << ans << endl;
} 

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 3772
a, b, c = gets.split.map(&:to_i)
count = 0

if [a, b, c].any?(&:odd?)
  puts 0
  exit
elsif a == b && b == c
  puts -1
  exit
end

while a.even? && b.even? && c.even?
  a, b, c = (b + c) / 2, (c + a) / 2, (a + b) / 2
  count += 1
end

puts count

Measured memory_bytes: 1788
solve :: Int -> Int -> Int -> Int -> Int -> Int
solve a b c x y
  | a + b <= 2 * c = a * x + b * y
  | x < y = 2 * c * x + (y - x) * (min b (2 * c))
  | True = 2 * c * y + (x - y) * (min a (2 * c))

main :: IO ()
main = do
  a:b:c:x:y:_ <- fmap (\x -> read x :: Int) <$> words <$> getLine
  print $ solve a b c x y


Measured memory_bytes: 508
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<functional>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<bitset>
#define rp(i,l,r) for(int i=l;i<r;i++)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void open(const char *s){
#ifdef ONLINE_JUDGE
    char str[100];sprintf(str,"%s.in",s);freopen(str,"r",stdin);sprintf(str,"%s.out",s);freopen(str,"w",stdout);
#endif
}
void open2(const char *s){
#ifdef DEBUG
    char str[100];sprintf(str,"%s.in",s);freopen(str,"r",stdin);sprintf(str,"%s.out",s);freopen(str,"w",stdout);
#endif
}
template <class T>
int upmin(T &a, const T &b){return (b<a?a=b,1:0);}
template <class T>
int upmax(T &a, const T &b){return (b>a?a=b,1:0);}
namespace io
{
    const int SIZE=(1<<20)+1;
    char ibuf[SIZE],*iS,*iT;
    char obuf[SIZE],*oS=obuf,*oT=oS+SIZE-1;
    int getc()
    {
        (iS==iT?iS=ibuf,iT=ibuf+fread(ibuf,1,SIZE,stdin):0);
        return iS==iT?EOF:*(iS++);
    }
    int f;
    char c;
    template <class T>
    void get(T &x)
    {
        f=1;
        for(c=getc();(c<'0'||c>'9')&&c!='-';c=getc());
        (c=='-'?f=-1,c=getc():0);
        x=0;
        for(;c>='0'&&c<='9';c=getc())
            x=x*10+c-'0';
        x*=f;
    }
    void flush()
    {
        fwrite(obuf,1,oS-obuf,stdout);
        oS=obuf;
    }
    void putc(char x)
    {
        *(oS++)=x;
        if(oS==oT)
            flush();
    }
    int a[55],t;
    template <class T>
    void put(T x)
    {
        if(!x)
            putc('0');
        x<0?putc('-'),x=-x:0;
        while(x)
        {
            a[++t]=x%10;
            x/=10;
        }
        while(t)
            putc(a[t--]+'0');
    }
    void space()
    {
        putc(' ');
    }
    void enter()
    {
        putc('\n');
    }
    struct flusher
    {
        ~flusher()
        {
            flush();
        }
    }
    io_flusher;
}
inline void close(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
using namespace std;
const int mod=1e9+7;
const int maxn=3010;
ll f[maxn][maxn][2];
int n,m;
int main(){
    close();
    cin>>n>>m;
    f[0][0][1]=1;
    rep(i,1,n){
        f[0][i][0]=1;
    }
    rp(i,0,m){
        rep(j,0,n){
            rep(k,0,1){
                if(j) (f[i+1][j-1][!(j-1)|k]+=f[i][j][k])%=mod;
                if(n-j) (f[i+1][j+1][k]+=f[i][j][k])%=mod;
                if(j) (f[i+1][j][k|(j==1)]+=f[i][j][k])%=mod;
                if(n-j) (f[i+1][j][k]+=f[i][j][k])%=mod;
            }
        }
    }
    ll ans=0;
    rep(i,0,n){
        (ans+=f[m][i][1])%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 141568
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
ll pow1(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
		{
			ans=ans*a;
		}
		a=a*a;
		b=b>>1;
	}
	return ans;
}
int main()
{
	ll i,j,n;
	cin>>n;
	n--;
	ll ans = (n*(n+1))/2ll;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;



int main()
{
	string a, b, x;
	cin >> x >> a >> b;
	cout << x[0] << a[1] << b[2] << endl;
	return 0;
}

Measured memory_bytes: 256
package main
 
import (
	"fmt"
)
 
var n int
var s string
func main() {
	fmt.Scan(&n)
	m := map[string]int { "AC": 0, "WA": 0, "TLE": 0, "RE": 0  }
	for i:= 0; i < n; i++ { 
		fmt.Scan(&s)
		m[s]++
	} 
    fmt.Printf("AC x %v\n", m["AC"])
    fmt.Printf("WA x %v\n", m["WA"])
    fmt.Printf("TLE x %v\n", m["TLE"])
    fmt.Printf("RE x %v\n", m["RE"])
}


Measured memory_bytes: 6332
#include<stdio.h>
int main(){
  int n,x[26],i,j,r=0,k;
  char s[101];
  scanf("%d%s",&n,s);
  for(i=1;i<n-1;i++){k=0;for(j=0;j<26;j++)x[j]=0;for(j=0;j<i;j++)x[s[j]-'a']=1;for(j=i;j<n;j++){k+=x[s[j]-'a'];x[s[j]-'a']=0;}r=r<k?k:r;}
  printf("%d",r);
}


Measured memory_bytes: 1732
require 'prime'

MAX = 10 ** 6
n = gets.to_i
a_n = gets.split.map(&:to_i)

# 全GCDが1でない場合どちらでもない
all_gcd = a_n[0]
1.upto(n-1) do |i|
    all_gcd = all_gcd.gcd(a_n[i])
end
if all_gcd > 1
    puts "not coprime"
    exit 0
end

## ============
## 以下は全GCDは常に1前提
## ============

memo = Array.new(MAX + 1, 0)
primes = Array.new(MAX + 1, 0)
Prime.each(MAX) do |i|
    primes[i] = 1
end

a_n.sort!
a_n.each do |a|
    # 素数はすでに計算済みなので素因数分解を省略
    if primes[a] == 1
        if memo[a] == 1
            puts "setwise coprime"; exit 0
        end

        memo[a] = 1
    else
        Prime.prime_division(a).each do |x, cnt|
            if memo[x] == 1
                puts "setwise coprime"; exit 0
            end
            memo[x] = 1
        end
    end
end

puts "pairwise coprime"


Measured memory_bytes: 98244
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a=sc.nextInt(),b=sc.nextInt();
    String  str = sc.next();
    String[] strarr = str.split("");
    if(strarr[b-1].equals("A")){
      strarr[b-1] = "a";
    }
    else if(strarr[b-1].equals("B")){
      strarr[b-1] = "b";
    }
    else if(strarr[b-1].equals("C")){
      strarr[b-1] = "c";
    }
    String str2 = String.join("",strarr);
    System.out.println(str2);
  }
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=200001,w[200005]={};
	int b[200005]={};
	string s;
	cin>>n>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='#'){
			b[i]++;
		}
		else{
			w[i]++;
		}
		b[i]+=b[i-1];
		w[i]+=w[i-1];
	}

	for(int i=0;i<n;i++){
		ans=min(ans,b[i-1]+w[n-1]-w[i]);
	}
	cout<<ans<<endl;
  return(0);
}

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

typedef pair<int,int> P;
const int TOP = 0;
const int UNDER = 5;
const int FRONT = 1;
const int BACK = 2;
const int LEFT = 3;
const int RIGHT = 4;

const int DIR[] = {FRONT, LEFT, BACK, RIGHT, TOP, UNDER};

const int Left[6][6] = {
    {0,3,5,2,4,0},
    {4,0,1,6,0,3},
    {2,6,0,0,1,5},
    {5,1,0,0,6,2},
    {3,0,6,1,0,4},
    {0,4,2,5,3,0},
};

struct Dice {
    int n[6];

    void SOUTH () {
        int tmp_ = n[TOP]; n[TOP] = n[BACK]; n[BACK] = n[UNDER]; n[UNDER] = n[FRONT]; n[FRONT] = tmp_;
    }

    void NORTH () {
        int tmp_ = n[TOP]; n[TOP] = n[FRONT]; n[FRONT] = n[UNDER]; n[UNDER] = n[BACK]; n[BACK] = tmp_;
    }

    void EAST () {
        int tmp_ = n[TOP]; n[TOP] = n[RIGHT]; n[RIGHT] = n[UNDER]; n[UNDER] = n[LEFT]; n[LEFT] = tmp_;
    }

    void WEST () {
        int tmp_ = n[TOP]; n[TOP] = n[LEFT]; n[LEFT] = n[UNDER]; n[UNDER] = n[RIGHT]; n[RIGHT] = tmp_;
    }
};

const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};

int main () {
    int n;
    while (cin >> n, n) {
        vector<vector<int> > higth(n * 2 + 1, vector<int>(n * 2 + 1, 0));
        vector<vector<int> > number(n * 2 + 1, vector<int>(n * 2 + 1, 0));

        for (int i = 0; i < n; i++) {
            int t, f;
            cin >> t >> f;
            Dice d;

            d.n[TOP] = t;
            d.n[UNDER] = 7 - t;
            d.n[FRONT] = f;
            d.n[BACK] = 7 - f;
            d.n[LEFT] = Left[t-1][f-1];
            d.n[RIGHT] = 7 - Left[t-1][f-1];

            queue<P> q;
            q.push(P(n,n));

            while (q.size()) {
                P p = q.front(); q.pop();
                int x = p.first, y = p.second;
                bool flag = true;

                for (int j = 6; flag && j >= 4; j--) {
                    for (int k = 0; flag && k < 4; k++) {
                        int nx = x + dx[k], ny = y + dy[k];
                        if(d.n[DIR[k]] == j && higth[x][y] > higth[nx][ny]) {
                            q.push(P(nx,ny));
                            if (k == 0) d.SOUTH();
                            else if (k == 1) d.EAST();
                            else if (k == 2) d.NORTH();
                            else if (k == 3) d.WEST();
                            flag = false;
                        }
                    }
                }

                if (flag) {
                    number[x][y] = d.n[TOP];
                    higth[x][y]++;
                }
            }
        }

        vector<int> res(7);
        for (auto i : number) {
            for (auto j : i) {
                res[j]++;
            }
        }

        for (int i = 1; i < 6; i++) {
            cout << res[i] << " " ;
        } cout << res[6] << endl;
    }

    return 0;
}

Measured memory_bytes: 1524
N=int(input())
T=0
X=0
Y=0
s=0
for i in range(N):
    t,x,y=map(int,input().split())
    if (x+y+T)>(X+Y+t):
        print('No')
        break
    else:
        if (X+Y+t-x-y-T)%2==1:
            print('No')
            break
        else:
            T=t
            X=x
            Y=y
            s+=1
if s==N:
    print('Yes')


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

typedef long long ll;

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


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

    int a, b; cin >> a >> b;
    int tmp = b-a;
    cout << tmp*(tmp+1)/2 -b << '\n';
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define forabr(i, a, b) for(int i = int(b)-1; i >= int(a); i--)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a, b;
    cin >> a >> b;
    forn(i, 10001) {
        int x = (8 * i) / 100;
        int y = (10 * i) / 100;
        if (x == a && y == b) {
            cout << i << "\n";
            return 0;
        }
    }
    cout << "-1\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv,  digitDP//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal ,RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = 0; ll z = 0, o = 1;
vl flag; vll path; vll D;
//***********//
ll binarySearch(vl V, ll key) {
	ll left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	ll right = V.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は V.size()
	while (right - left > 1) {
		ll mid = left + (right - left) / 2;
		if (V[mid] >= key) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
int main() {
	ll V, P;
	cin >> N >> M >> V >> P;
	vl A(N);
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());
	ll left = -1;
	ll right = N;
	while(right-left>1) {
		ll mid = left + (right - left) / 2;
		ll valid = 1;
		if (mid < P) valid = 1;
		else {
			if (A[mid] + M >= A[P - 1]) {
				ll pre = M * P;
				for (j = P-1; j < N; j++) {
					if (j == mid) continue;
					pre += min(M, A[mid] + M - A[j]);
				}
				if (pre >= M * V) valid = 1;
				else valid = 0;
			}
			else {
				valid = 0;
			}
		}
		if (valid) left = mid;
		else right = mid;
	}
	cout << left + 1;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

ll foo[110][5];
ll bar[110][5];

void solve() {
  string STR;
  cin >> STR;
  ll K;
  cin >> K;
  ll N = STR.size();

  rep (i, 110) rep (j, 5) foo[i][j] = 0;
  rep (i, 110) rep (j, 5) bar[i][j] = 0;

  foo[0][0] = 1;

  rep (i, N) {
    rep (num, 10) {
      if (num == 0) {
        rep (j, 4) {
          if (num < STR[i] - '0') {
            bar[i+1][j] += foo[i][j];
          } else if (num == STR[i] - '0') {
            foo[i+1][j] += foo[i][j];
          }
          bar[i+1][j] += bar[i][j];
        }
      } else {
        rep (j, 3) {
          bar[i+1][j+1] += bar[i][j];
          if (num < STR[i] - '0') {
            bar[i+1][j+1] += foo[i][j];
          } else if (num == STR[i] - '0') {
            foo[i+1][j+1] += foo[i][j];
          }
        }
      }
    }
  }

  ll ans = foo[N][K] + bar[N][K];
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = in.nextInt();
		if(n <1200) out.println("ABC");
		else out.println("ARC");
		//for (int i = 1 ; i <= m; i++) {
		//	out.println(ans[i]);
		//}
		out.flush();
	}

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

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int next() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public char nextChar() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
				return (char) c;
			}
			throw new InputMismatchException();
		}

		public String nextToken() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			StringBuilder res = new StringBuilder();
			do {
				res.append((char) c);
				c = next();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public int nextInt() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = next();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c-'0';
				c = next();
			} while (!isSpaceChar(c));
			return res*sgn;
		}

		public long nextLong() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = next();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c-'0';
				c = next();
			} while (!isSpaceChar(c));
			return res*sgn;
		}

		public double nextDouble() {
			return Double.valueOf(nextToken());
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		//public interface SpaceCharFilter {
		//	public boolean isSpaceChar(int ch);
		//}
	}
	// template
	static int gcd(int n, int r) { return r == 0 ? n : gcd(r, n%r);  }
	static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n%r);  }

	static <T> void swap(T[] x, int i, int j) { T t = x[i]; x[i] = x[j]; x[j] = t;  }
	static void swap(int[] x, int i, int j) { int t = x[i]; x[i] = x[j]; x[j] = t;  }
}


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

using namespace std;

typedef long long ll;

int main(){
    vector<int> cnt(3, 0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (x % 4 == 0) ++cnt[2];
        else if (x % 2 == 0) ++ cnt[1];
        else ++cnt[0];
    }

    if (cnt[0] + (cnt[1]?1:0) <= cnt[2] + 1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static int S = sc.nextInt();

    public static void main(String[] args) {
        int hour = S / 3600;
        int min = (S % 3600) / 60;
        int sec = (S % 3600) % 60;
        System.out.println(hour + ":" + min + ":" + sec);

    }
}


Measured memory_bytes: 26196
a,b=[int(x) for x in input().split()]
ans=0

if a==1:
  ans+=300000
elif a==2:
  ans+=200000
elif a==3:
  ans+=100000
if b==1:
  ans+=300000
elif b==2:
  ans+=200000
elif b==3:
  ans+=100000
if ans==600000:
  ans+=400000
print(ans)
  

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
Y = [list(map(int, input().split())) for _ in range(N)]

def gen_graph(s, t, n, m):
    graph = [[] for _ in range(n + m + 2)]
    def add_edges(u, v, c):
        graph[u].append([v, c, len(graph[v])])
        graph[v].append([u, 0, len(graph[u]) - 1])

    for i in range(n):
        add_edges(s, i, 1)
    
    for i in range(m):
        add_edges(i + n, t, 1)
        
    for i, (a, b) in enumerate(X):
        for j, (c, d) in enumerate(Y):
            if a < c and b < d:
                add_edges(i, j + n, 1)
                
    return graph


def dfs(u, t, f):
    if u == t:
        return f
    
    used[u] = True
    for i in range(len(graph[u])):
        v, c, r = graph[u][i]
        if not used[v] and c > 0:
            d = dfs(v, t, min(f, c))
            if d > 0:
                graph[u][i][1] -= d
                graph[v][r][1] += d
                return d

    return 0


s = 2 * N
t = s + 1
graph = gen_graph(s, t, N, N)
flow = 0
while True:
    used = [False] * (2 * N + 2)
    f = dfs(s, t, 10 ** 9 + 7)
    flow += f
    if f == 0:
        break
        
print(flow)


Measured memory_bytes: 47068
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author LUCIANO.
 */
import java.util.*;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long k = in.nextLong();
        if(n == k) System.out.println(0);
        else if(n < k) {
            System.out.println(Math.min(n, (k - n)));
        }else {
            long rem = n % k;
            System.out.println(Math.min(rem, Math.abs(rem - k)));
        }
    }
}

Measured memory_bytes: 23764
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <math.h> // sqrt()


using namespace std;

int main(){
    int n, m , c;
    cin >> n >> m >> c;
    int var[n+ 1][m + 1];
    int b[m + 1];
    for ( int i = 1 ; i <= m; i++)
        cin >> b[i];
    for ( int i = 1 ; i <= n; i++){
        for ( int j = 1; j <= m; j++)
            cin >> var[i][j];
    }
    int count = 0;
    for ( int i = 1 ; i <= n; i++){
        int s = 0;
        for ( int j = 1; j <= m; j++){
            s += b[j] * var[i][j];
        }
        if ( (s + c) > 0) count++;
        
    }
    cout << count << endl;
    
}

Measured memory_bytes: 3644
// Problem : C - XYZ Triplets
// Contest : AtCoder - AIsing Programming Contest 2020
// URL : https://atcoder.jp/contests/aising2020/tasks/aising2020_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()
#define inf 1000000000
#define mod 1000000007

void dbg(){
	cerr << endl;
}
template<typename Head , typename... Tail>
void dbg(Head h , Tail... t){
	cerr << h << " ";
	dbg(t...);
}

#ifdef EMBI_DEBUG
#define debug(...) cerr << "(" << #__VA_ARGS__  << "): ", dbg(__VA_ARGS__)
#else 
#define debug(...)
#endif

const int max_n = 1e5 + 9;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
void solve(){
	int n;
	cin >> n;
	map<int,int> m;
	for(int i = 1 ; i <= 100 ; i++){
		for(int j = 1 ; j <= 100 ; j++){
			for(int k = 1 ; k <= 100 ; k++){
				m[((i + j) * (i + j) + (i + k) * (i + k) + (k + j) * (k + j))/2]++;
			}
		}
	}
	
	for(int i = 1 ; i <= n ; i++){
		cout << m[i] << "\n";
	}
}
int main()
{
	speed;
	int t = 1;
	// cin >> t;
	for(int i = 1 ; i <= t ; i++){
		// cout << "Case #" << i << ": ";
		solve();
	}
    return 0;
}

Measured memory_bytes: 5444
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	numString := strings.Split(sc.Text(), " ")

	l, _ := strconv.Atoi(numString[0])
	r, _ := strconv.Atoi(numString[1])

	var flg bool
	var rem, min int
	var count int
	for i := l; i < r; i++ {
		if i%2019 == 0 {
			min = 0
			break
		}
		for j := i + 1; j <= r; j++ {
			if flg == false {
				min = i * j
				flg = true
			}
			rem = (i * j) % 2019
			if rem < min {
				min = rem
			}
			count++
			if count > 2019 {
				count = 0
				break
			}
		}
	}
	fmt.Println(min)
}

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

signed main(){
  double L;
  cin>>L;
  double le=L/3;
  double wi=L/3;
  double hi=L/3;
  
  double ans=le*wi*hi;
  cout<<fixed<<setprecision(12)<<ans<<endl;
}

Measured memory_bytes: 256
//#include "bits\stdc++.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
typedef long long LL;

int main()
{
    int a, b, x = 1;
    cin >> a >> b;

    for (int i = 0; i < a; ++i)
    {
        if (x * 2 > x + b) { x += b; }
        else { x *= 2; }
    }

    cout << x << endl;

    return 0;
}

Measured memory_bytes: 256
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = [0]*N
put = []

for i in reversed(range(N)):
    if A[i] != B[i]:
        put.append(i+1)
        # iを素因数分解して、約数に1をxorしていく
        tmp = 1
        n = i+1
        while tmp*tmp <= n:
            if n % tmp == 0:
                B[tmp-1] ^= 1
                if tmp != n//tmp:
                    B[n//tmp-1] ^= 1
            tmp += 1


if len(put) > 0:
    print(len(put))
    print(*put)
else:
    print(0)


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 21;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 62;

string s;
ll ans;

int main(){
  cin >> s;
  for(ll i = 0;i < s.size();i++){
    for(ll j = i+1;j <= s.size();j++){
      bool flag = true;
      for(ll k = i;k < j;k++){
        if(s[k] == 'A' || s[k] == 'T' || s[k] == 'G' || s[k] == 'C') continue;
        else{
          flag = false;
          break;
        }
      }
      if(flag){
        ans = max(ans,j-i);
      }
    }
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
using vs= vector<string>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

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

  if(s==u){
    a--;
  }else{
    b--;
  }
  cout << a << " " << b << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
# A→0,G→1,C→2,T→3
dp = [[[[0]*4 for _ in range(4)] for _ in range(4)] for _ in range(n+1)]
for i in range(4):
    for j in range(4):
        for k in range(4):
            if (i==0 and j==1 and k==2) or (i==0 and j==2 and k==1) or (i==2 and j==0 and k==1):
                pass
            else:
                dp[3][i][j][k] = 1

for a in range(3,n):
    for i in range(4):
        for j in range(4):
            for k in range(4):
                # lは新しい桁
                for l in range(4):
                    if (j==0 and k==1):
                        if l==2:
                            continue
                    if (j==0 and k==2):
                        if l==1:
                            continue
                    if (j==2 and k==0):
                        if l==1:
                            continue

                    if (i==0 and k==2):
                        if l==1:
                            continue
                    if (i==0 and j==2):
                        if l==1:
                            continue
                    dp[a+1][j][k][l] += dp[a][i][j][k]
                    dp[a+1][j][k][l] %= 10**9+7
                    #print(i,j,k,l,dp[a+1][j][k][l])
ans = 0
for i in range(4):
    for j in range(4):
        for k in range(4):
            ans += dp[n][i][j][k]
            ans %= 10**9+7
print(ans)

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main() {
    int n;cin >>n;
    vector<int>a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    ll ans=0;
    for (int i = 0; i < n; ++i) {
        if(i%2==0&&a[i]%2==1)ans++;
    }
    cout <<ans <<endl;
}


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

int main(){
  int N,W;
  cin >> N >> W;
  vector<long long> w(N),v(N);
  for (int i = 0; i < N; i++)
  {
    cin >> w[i] >> v[i];
  }

  const long long INF = 1e10;
  vector<vector<long long>> dp(N+1,vector<long long>(100001,INF));
  dp[0][0] = 0;
  for (int i = 1; i <= N; i++)
  {
    for (int j = 0; j <= 100000; j++)
    {
      if(j>=v[i-1]) dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i-1]]+w[i-1]);
      else dp[i][j] = dp[i-1][j];
    }
  }

  int maxv = 0;
  for (int i = 0; i <= N; i++)
  {
    for (int j = 0; j <= 100000; j++)
    {
      if(dp[i][j]<=W) maxv = max(maxv,j);
    }
  }
  cout << maxv << endl;
}

Measured memory_bytes: 80256
import Data.Bits
import Data.List
import Control.Monad
import Data.Graph
import qualified Data.Vector.Unboxed as V
--import qualified Data.Vector.Unboxed.Mutable as VM
import Control.Monad.ST
import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Lazy.Char8 as B
--import Debug.Trace

main :: IO ()
main = do
  n <- readLn :: IO Int
  vs <- map read.words <$> getLine :: IO [Double]
  ans <- forM (zip [0..n-1] $ sort vs) $ \(i,v) -> if i == 0 then return $ v/2^(n-1) else return $ v/2^(n-i)
  print $ sum ans


Measured memory_bytes: 892
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		int ans=0;
		for(; sc.hasNext();){
			String s=sc.next();
			if(s.equals(new StringBuffer(s).reverse().toString()))
				ans++;
		}
		println(ans+"");
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 12000
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	long double A, B;
	cin >> A >> B;
	cout << (ll)(A*B) << endl;
	return 0;
}


Measured memory_bytes: 3720