akhauriyash/Code-Regression huggingface dataset:
// Problem : B - ... (Triple Dots)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define REP(i,n) for (ll i = 0; i < n; i++)
#define REPR(i,n) for(ll i = n-1; i >= 0; i--)
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define FORR(i,a,b) for(ll i = a-1; i>= b; i--)
#define ff first
#define ss second
#define MAXN (ll)1000002
#define MODN (ll)1000000007
#define mp make_pair
#define pb push_back
#define LN(x) (ll)x.length()
#define SZ(x) (ll)x.size()
#define bg(x) (x.begin())
#define rbg(x) (x.rbegin())
#define ENDL cout<<endl
ll n,t=1,tmp;
int main() {
    string s;
	cin>>n>>s;
	if(LN(s) <= n) cout<<s<<endl;
	else {
		cout<<s.substr(0,n)<<"...";
	}
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main(){
        int n,a,next;
        scanf("%d",&n);
        a = (int)n/100;
        next = a*100 + a*10 + a;
        if ( n <= next ) printf("%d\n",next);
        else printf("%d\n",next+111);
        return 0;
}


Measured memory_bytes: 128
def main():
  import sys
  input = sys.stdin.readline
  
  N = int(input())
  E = [[] for _ in range(N)]
  for i in range(N-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    E[a].append((b,i))
    E[b].append((a,i))
  
  EG = []
  def dfs(u,v,p):
    if u == v:
      return True
    for t,i in E[u]:
      if t == p:
        continue
      if dfs(t,v,u):
        EG.append(i)
        return True
    return False
  
  M = int(input())
  EM = []
  for i in range(M):
    u,v = map(int,input().split())
    u -= 1
    v -= 1
    EM.append((u,v))
  
  ES = []
  for i in range(M):
    u,v = EM[i]
    EG = []
    dfs(u,v,-1)
    ES.append((u,v,EG))
  
  ans = 0
  for i in range(1<<M):
    EG2 = []
    bc = 0
    for j in range(M):
      if (i>>j)&1 == 1:
        bc += 1
        EG2 += ES[j][2]
    p = len(set(EG2))
    if bc%2 == 0:
      ans += 2**(N-1-p)
    else:
      ans -= 2**(N-1-p)
  print(ans)

if __name__ == '__main__':
  main()


Measured memory_bytes: 45148
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    int n, a, b;
    cin >> n >> a;

    rep1(i, n){
        int b;
        cin >> b;
        a ^= b;
    }
    if(a) puts("No");
    else puts("Yes");

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1e9 + 7;

struct BIT{
    int n;
    VL bit;

    BIT(){}
    BIT(int x){
        n = x;
        bit.assign(n+1, 0);
    }

    void init(int x){
        n = x;
        bit.assign(n+1, 0);
    }

    void add(int i, ll x){
        i++;
        while (i <= n){
            bit[i] += x;
            i += i & -i;
        }
    }

    // [0, i]
    ll sum(int i){
        i++;
        ll ret = 0;
        while (i > 0){
            ret += bit[i];
            i -= i & -i;
        }
        return ret;
    }

    // [l, r)
    ll sum(int l, int r){
        if (l >= r) return 0;
        return sum(r-1) - sum(l-1);
    }
};

ll powll(ll x, ll y){
    x %= mod;
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    x %= mod;
    return (x * powll(y,mod-2)) % mod;
}

int main() {
    ll n;
    cin >> n;
    BIT bit(n), bit2(n);
    REP(i,n) bit2.add(i, 1);
    VL p(n), q;
    REP(i,n){
        p[i] = in() - 1;
        if (p[i] >= 0) bit2.add(p[i], -1);
    }
    ll qs = 0;
    REP(i,n){
        if (bit2.sum(i, i + 1)){
            q.push_back(i);
            qs = (qs + i) % mod;
        }
    }
    ll m = bit2.sum(n - 1);
    VL fact(n + 1, 1);
    REP(i,n) fact[i + 1] = (fact[i] * (i + 1)) % mod;
    ll ans = 0, c = 0, del = 0, past = -1;
    REP(i,n-1){
        if (p[i] >= 0){
            ll x = p[i] - bit.sum(p[i]);
            if (m) x = (x + mod - divll(bit2.sum(p[i]) * c, m)) % mod;
            ans = (ans + x * fact[n - i - 1]) % mod;
            bit.add(p[i], 1);
            ll tmp = q.end() - lower_bound(ALL(q), p[i]);
            del = (del + tmp) % mod;
        }else{
            ll s = (qs - divll(m * c, 2) - del + 2 * mod) % mod;
            s = divll(s, m);
            ans = (ans + s * fact[n - i - 1]) % mod;
            c++;
        }
        // cout << i << " " << ans << endl;
    }
    ans = ((ans + 1) * fact[m]) % mod;
    cout << ans << endl;

    return 0;
}


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

using namespace std;
using ll = long long;


int main()
{
	string s; cin >> s;
	int n = s.size(), k; cin >> k;
	for(auto &i : s) i -= 'a';

	for(int i = 0; i < n - 1; i++) {
		//cerr << k <<" :" << endl;
		if(s[i] == 0)continue;
		if(26 - (int)s[i] <= k) {
			k -= (26 - (int)s[i]);
			s[i] = 0;
		}
		//cerr << k << endl;
	}

	s[n - 1] = (s[n - 1] + (k % 26)) % 26;
	for(auto i : s)cout << (char)(i + 'a');
	cout << endl;

}

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

#define el '\n'

const int MOD = 1e9+7;
const int MAXN = 21;

int a[MAXN][MAXN];

void tambah(int& a, int b){
  a += b;
  if(a>=MOD){
    a -= MOD;
  }
}

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

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

  vector<int> dp(1<<n); // number of ways to match subset of women
  dp[0] = 1;
  for(int mask = 0; mask < (1<<n)-1; mask++){
    int nguy = __builtin_popcount(mask);
    for(int ngirl = 0; ngirl < n; ngirl++){
      if(a[nguy][ngirl] && !(mask & (1<<ngirl))){
        int newmask = mask^(1<<ngirl);
        tambah(dp[newmask],dp[mask]);
      }
    }
  }

  cout << dp[(1<<n)-1] << el;

  
  return 0;
}

Measured memory_bytes: 8448
n,t=map(int,input().split())
lsx=[]
lsh=[]
for i in range(n):
    x,h=map(int,input().split())
    lsx.append(x)
    lsh.append(h)

tam=0
for j in range(n):
    if lsh[j]/lsx[j]>tam:
        tam=lsh[j]/lsx[j]
print(t*tam)



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

using namespace std;

class mergeSort{
public:
  mergeSort(int _N, int *_data): N(_N), data(_data){
    tree.resize(N * 4);
    build(0, 0, N - 1);
  }
  int query(int sq, int eq, int k){
    return query(0, 0, N - 1, sq, eq, k);
  }
private:
  int N, *data;
  vector < vector <int> > tree;
  void build(int node, int s, int e){
    if(s == e){
      tree[node].push_back(data[s]);
    }else{
      int lc = node * 2 + 1;
      int rc = node * 2 + 2;
      int mid = s + (e - s) / 2;
      build(lc, s, mid);
      build(rc, mid + 1, e);
      tree[node].resize(e - s + 1);
      merge(tree[lc].begin(), tree[lc].end(),
            tree[rc].begin(), tree[rc].end(),
            tree[node].begin()
      );
    }
  }

  inline int query(int node, int s, int e, int sq, int eq, int k){
    if(s > eq || e < sq)return 0;
    if(s >= sq && e <= eq)return tree[node].end() - lower_bound(tree[node].begin(), tree[node].end(), k);
    int lc = node * 2 + 1;
    int rc = node * 2 + 2;
    int mid = s + (e - s) / 2;
    return query(lc, s, mid, sq, eq, k) + query(rc, mid + 1, e, sq, eq, k);
  }
};


int main(){
  cin.tie(0);
  cin.sync_with_stdio(0);
  int N, Q;
  cin >> N >> Q;
  vector <int> c(N);
  for(int &i : c){
    cin >> i;
  }
  vector <int> lastOcc(N + 1, N + 1);
  vector <int> a(N);
  for(int i = N - 1; i >= 0; i--){
    a[i] = lastOcc[c[i]];
    lastOcc[c[i]] = i;
  }
  mergeSort ms(N, a.data());
  for(int i = 0; i < Q; i++){
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    cout << ms.query(l, r, r + 1) << '\n';
  }
  return 0;
}


Measured memory_bytes: 119284
#include <bits/stdc++.h>
using namespace std;
int n = 50;
vector<vector<int>> e(n+1, vector<int>(n+1));
vector<int> tmp(n+1);

bool check(int a, int goal, vector<int> d)
{
    if (e[a][goal] == 1) return true;
    for(int i = 1; i < n+1; i++)
    {
        if(e[a][i] == 1 && d[i] == 0)
        {
            d[i] = 1;
            if(check(i, goal, d)) return true;
            d[i] = 0;
        }
    }
    return false;
}
int main()
{
    int m;
    cin >> n >> m;
    
    for(int i = 0; i < m; i++)
    {
        for(int j = 0; j < m; j++)
        {
            int a, b;
            cin >> a >> b;
            e[a][b] = 1;
            e[b][a] = 1;
        }
    }

    int count = 0;
    for(int i = 1; i < n + 1; i++)
    {
        for(int j = 1; j < n + 1; j++)
        {
            if (e[i][j] == 1)
            {
                tmp[i] = 1;
                e[i][j] = 0;
                if(!check(i, j, tmp)) count++;
                e[i][j] = 1;
                tmp[i] = 0;
            }
        }
    }
    cout << count / 2 << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    #define endl '\n'
    #define int long long 
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
    //#include "debug.cpp"


    int32_t main() 
    { 
        boost;
        
        string s;
        cin>>s;
        string front="",back="";
        int q,cnt=0;
        cin>>q;
        while(q--){
            int t;
            cin>>t;
            if(t==1)
                cnt++;
            else{
                int f;
                char c;
                cin>>f>>c;
                if(f==1){
                    if(cnt%2)
                        back+=c;
                    else
                        front+=c;
                }
                else{
                    if(cnt%2)
                        front+=c;
                    else
                        back+=c;
                }
            }
        }
        reverse(front.begin(),front.end());
        s=front+s+back;
        if(cnt%2)
            reverse(s.begin(),s.end());
        cout<<s<<endl;    
    }


Measured memory_bytes: 1200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null){
int a=Integer.parseInt(line);
BigInteger x=BigInteger.valueOf(a);
System.out.println(prevProbablePrime(a)+" "+x.nextProbablePrime());
}
}
public static int prevProbablePrime(int a){
BigInteger y=BigInteger.valueOf(a);
y=y.subtract(BigInteger.valueOf(1));
while(true){
if(y.isProbablePrime(1)){
return y.intValue();
}
y=y.subtract(BigInteger.valueOf(1));
}
}
}

Measured memory_bytes: 21216
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int M =scan.nextInt();
		int a[][]= new int[N+1][N+1];
		int count =0;
		int c =0;
		int v[] = new int[N+1];
		v[1]=1;
		int red = 0;
		for(int i=0;i<M;i++){
			a[scan.nextInt()][scan.nextInt()]=1;
		}
		for(int i=0;i<N+1;i++){
			for(int j=0;j<i;j++){
				a[i][j]=a[j][i];
			}
		}
		c = dfs(1,N,count,red,a,v);
		System.out.println(c);
	}
	
	public static int dfs(int l,int N,int t,int red,int a[][],int v[]){
		if(red==N-1){
			t++;
		}for(int j=1;j<=N;j++){
			if(a[l][j]==1 && v[j]==0){
				v[j]=1;
				red++;
				t = dfs(j,N,t,red,a,v);
				v[j]=0;
				red--;
			}
		}return t;
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
#include <set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
  ll n, a, b;
  cin >> n >> a >> b;
  cout << min(n * a, b) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

static const int MAX = 100;

int selectionSort(int A[], int N);
void output(int A[], int N);

int main() {

	int A[MAX], N;
	int ans;

	//input
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	ans = selectionSort(A, N);
	cout << ans << endl;
	return 0;
}

int selectionSort(int A[], int N) {
	int minj;
	int tmp;
	int count = 0;
	int flag = 0;
	for (int i = 0; i < N; i++)
	{
		minj = i;
		for (int j = i; j < N; j++)
		{
			if (A[j] < A[minj]) {
				minj = j;
				flag = 1;
			}
		}
		if (flag == 1) {
			tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			count++;
			flag = 0;
		}
	}
	output(A, N);
	return count;
}

void output(int A[], int N) {
	for (int i = 0; i < N - 1; i++)
	{
		cout << A[i] << " " << flush;
	}
	cout << A[N - 1] << endl;
}


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

typedef long long ll;
#define nl "\n"
#define ff first
#define ss second
#define mod 1e9+7
#define lb lower_bound
#define ub upper_bound
#define eb emplace_back
#define pp pop_back
#define bs binary_search
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define sll stack<ll>
#define qll queue<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define vc vector <char>
#define vvll vector<vector<ll>>
#define mod 1e9+7
#define mxn 9e18
#define all(x) x.begin(),x.end()
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define test ll t ; cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);

ll m,x,ans=9e18;

void rec_cost(ll cost,vector<pair<ll,vll>>& books,vll algo,ll n)
{
    //BASE CONDITION
    if(n==0)
    {
        loop(i,0,m)     if(algo[i]<x)   return;
 
        ans=min(ans,cost);
        return;
    }
    
    //DO NOT PICK THE BOOK
    rec_cost(cost,books,algo,n-1);
    
    //PICK THE BOOK
    loop(i,0,m)     algo[i]+=books[n-1].ss[i];
    rec_cost(cost+books[n-1].ff,books,algo,n-1);
}
void solve()
{
    ll n,c,d;
    cin>>n>>m>>x;
    vector<pair<ll,vll>> books;
    vll algo(m);
    loop(i,0,n+1)
    {
        cin>>c;
        loop(j,0,m)
        {
            cin>>d;
            algo[j]=d;
        }
        books.push_back({c, algo});
    }
    loop(i,0,m)     algo[i]=0;
    rec_cost(0,books,algo,n);
    if(ans==9e18)   ans=-1;
    cout<<ans;
}

int main() {
	fast_io;
	
	    solve();
	return 0;
}


Measured memory_bytes: 3680
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;long long a,b,c,d;scanf("%d%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	n--;
	for(int i=0;i<=n;i++)
	{
		if((n-i)%2==0)
		{
			long long A=a+i*c;
			long long min=(c-d)*(n-i)/2;
			long long max=(d-c)*i+(d-c)*(n-i)/2;
			if(min<=b-A&&b-A<=max)return 0*puts("YES");
		}
		if((n-i)%2==0)
		{
			long long A=a-i*c;
			long long min=(c-d)*i+(c-d)*(n-i)/2;
			long long max=(d-c)*(n-i)/2;
			if(min<=b-A&&b-A<=max)return 0*puts("YES");
		}
	}
	return 0*puts("NO");
}

Measured memory_bytes: 256
using System;
using System.Collections;

namespace ABC072C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            Hashtable table = new Hashtable(N + 2);

            string[] bufs = Console.ReadLine().Split();

            for (int i = 0; i < N; i++)
            {
                int a = int.Parse(bufs[i]);
                for (int j = -1; j <= 1; j++)
                {
                    int key = a + j;
                    if (table.ContainsKey(key))
                    {
                        table[key] = (int)table[key] + 1;
                    }
                    else
                    {
                        table[key] = 1;
                    }
                }
            }

            int res = 0;

            foreach (DictionaryEntry item in table)
            {
                int count = (int)item.Value;
                if (res < count)
                {
                    res = count;
                }
            }

            Console.WriteLine(res);
        }
    }
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int a, b;

int main() {
	cin >> a >> b;
	
	cout << max(max(a + b, a - b), a * b) << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		int k = sc.nextInt();

		int x[] = new int[n];
		int y[] = new int[n];
		int worb[] = new int[n];

		for (int i = 0; i < n; i++) {
			x[i] = (sc.nextInt()) % (2 * k);
			y[i] = (sc.nextInt()) % (2 * k);
			worb[i] = sc.next().startsWith("W") ? 1 : -1;
		}

		int nn = k * 2;
		int mapW[][] = new int[nn][nn];
		int mapB[][] = new int[nn][nn];
		for (int i = 0; i < n; i++) {
			mapW[x[i]][y[i]] += worb[i] == 1 ? 1 : 0;
			mapB[x[i]][y[i]] += worb[i] == -1 ? 1 : 0;
		}

//		System.out.println(Arrays.deepToString(mapW));
//		System.out.println(Arrays.deepToString(mapB));
		
		int m2[][] = new int[nn][nn];

		for (int i = 0; i < nn; i++) {

			int init = 0;
			for (int j = 0; j < nn; j++) {
				init += (j < k) ? mapW[i][j] : mapB[i][j];
			}

			m2[i][0] = init;

			for (int j = 0; j < nn - 1; j++) {
				int j2 = (j + k) % nn;
				m2[i][j + 1] = m2[i][j] - mapW[i][j] + mapB[i][j] + mapW[i][j2] - mapB[i][j2];
			}
		}
		
//		System.out.println(Arrays.deepToString(m2));
		

		int m3[][] = new int[nn][nn];

		for (int j = 0; j < nn; j++) {
			int init = 0;
			for (int i = 0; i < nn; i++) {
				int j2 = (i < k ? j : j + k) % nn;
				init += m2[i][j2];
			}
			m3[0][j] = init;

			for (int i = 0; i < nn - 1; i++) {
				int i2 = (i + k) % nn;
				int j2 = (j + k) % nn;
				m3[i + 1][j] = m3[i][j] - m2[i][j] + m2[i][j2] + m2[i2][j] - m2[i2][j2];
			}
		}
//		System.out.println(Arrays.deepToString(m2));

		int max = 0;
		for (int i = 0; i < nn; i++) {
			for (int j = 0; j < nn; j++) {
				max = Math.max(max, m3[i][j]);
			}
		}
		System.out.println(max);

	}

}


Measured memory_bytes: 142152
//
// Created by tac on 2016/10/14.
//

#include <cstdlib>
#include <iostream>

namespace {

int count_comb(int n, int x) {
    int count = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            for (int k = j + 1; k <= n; ++k) {
//                std::cout << std::endl << "(" << i << ", " << j << ", " << k << ")";
                if (i + j + k == x) {
//                    std::cout << "=> OK" << std::endl;
                    ++count;
                }
            }
        }
    }
    return  count;
}

}

int main() {
    int n, x;

    while (true) {
        std::cin >> n >> x;
        if (n <= 0 && x <= 0) {
            break;
        }
        std::cout << count_comb(n, x) << std::endl;
    }

    return EXIT_SUCCESS;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << max(a - b, 0);
}


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

using namespace std;

template <typename T> class UFT{
public:
    vector<T> data;
    vector<int> parent;

    UFT(int N) : data(N), parent(N, -1){}

    T root(int n){
        while(parent[n] != -1){
            int old_parent = parent[n];
            int new_parent = parent[parent[n]];
            if(new_parent != -1) parent[n] = new_parent;
            n = old_parent;
        }
        return n;
    }

    bool unite(int l, int r){
        int root_l = root(l);
        int root_r = root(r);
        if(root_l != root_r){
            parent[root_r] = root_l;
        }
    }

    bool common(int l, int r){
        return root(l) == root(r);
    }
};

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> p(N+1);
    vector<int> x(M);
    vector<int> y(M);

    UFT<int> *uft = new UFT<int>(N+1);

    for(int i=0; i<N; i++){
        cin >> p[i+1];
    }

    for(int i=0; i<M; i++){
        cin >> x[i] >> y[i];
    }

    for(int i=0; i<M; i++){
        uft->unite(x[i], y[i]);
    }

    int count = 0;
    for(int i=1; i<=N; i++){
        if(uft->common(i, p[i])) count++;
    }

    cout << count << endl;
}


Measured memory_bytes: 2176
# AtCoder Beginner Contest 058 - B
# -*- encoding: UTF-8 -*-
o = list(input())
e = list(input())

s = []
for i in o:
  s.append(i)
  if len(e) > 0:
    s.append(e.pop(0))

result = "".join(s)

print(result)


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

class Program
{
    static void Main()
    {
        int[] input = Utils.ReadInts();

        List<int> result = new List<int>();
        result.Add(input[1]);
        for(int i = 1; i < input[0]; i++)
        {
            result.Add(input[1] + i);
            result.Add(input[1] - i);
        }

        int[] res = result.ToArray();
        Array.Sort(res, IntComparetor.Instance);
        string resultStr = string.Join(" ", res);
        Utils.Return(resultStr);
    }
    private static int Solve(int a, int b )
    {
        List<int> list = new List<int>() { a + b, a - b, a * b };
        return list.Max();
    }
}

static class Utils
{
    /// <summary>
    /// int入力を取得する
    /// </summary>
    /// <returns></returns>
    public static int[] ReadInts()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    /// <summary>
    /// 最初に条件ヒットした配列のindexを取得する
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="source"></param>
    /// <param name="func"></param>
    /// <param name="start"></param>
    /// <returns></returns>
    public static int FindFirstIndex<T>(IList<T> source, Func<T, bool> func, int start)
    {
        for(int i = start; i < source.Count; i++)
        {
            if (func(source[i]))
            {
                return i;
            }
        }
        return -1;
    }
    /// <summary>
    /// Yes or Noの文字列を返却する
    /// </summary>
    /// <param name="result"></param>
    public static void ReturnYesOrNo(bool result)
    {
        Console.WriteLine(result ? "Yes" : "No");
        Console.ReadLine();
    }

    internal static void Return(object result)
    {
        Console.WriteLine(result);
    }
}
/// <summary>
/// ソートクラス
/// </summary>
class IntDisComparetor : IComparer<int>
{
    public static IComparer<int> Instance { get; } = new IntDisComparetor();
    private IntDisComparetor() { }
    public int Compare(int x, int y)
    {
        return Comparer<int>.Default.Compare(y, x);
    }
}
/// <summary>
/// ソートクラス
/// </summary>
class IntComparetor : IComparer<int>
{
    public static IComparer<int> Instance { get; } = new IntComparetor();
    private IntComparetor() { }
    public int Compare(int x, int y)
    {
        return Comparer<int>.Default.Compare(x, y);
    }
}

Measured memory_bytes: 13396
n,k = map(int,input().split())
la = list(map(int,input().split()))
l1 =[]
l2 =[]
for i in range(0,n):
    l1.append(len([la[j] for j in range(0,n) if la[j]<la[i]]))
    l2.append(len([la[j] for j in range(i,n) if la[j]<la[i]]))
c = k*sum(l2) + (k*(k-1)//2)*sum(l1)
print(c%(10**9 + 7))

Measured memory_bytes: 3188
#include<stdio.h>
#include<string.h>
#define MAX 2000000
#define INF 100000000
int heap[MAX+1],H;

void maxHeapify(int i){
  int temp;
  int l,r,largest;
  l = 2*i;
  r = 2*i+1;

  if(l<=H && heap[l] > heap[i]) largest = l;
  else largest = i;
  if(r<=H && heap[r]>heap[largest]) largest = r;
  if(largest != i){
    temp = heap[i];
    heap[i] = heap[largest];
    heap[largest] = temp;
    maxHeapify(largest);
  } 
}

void increaseKey(int i,int key){
  int temp;
  
  heap[i] = key;
  while(i>1 && heap[i/2]<heap[i]){
    temp = heap[i];
    heap[i] = heap[i/2];
    heap[i/2] = temp;
    i /= 2;
  }
}


void insert(int key){
  H++;
  heap[H] = -INF;
  increaseKey(H,key);
}

void extract(){
  printf("%d\n",heap[1]);
  heap[1] = heap[H--];
  maxHeapify(1);
}

int main(){
  int k;
  char s[10];

  while(1){
    scanf("%s",s);
    if(s[0]=='e' && s[1]=='n') break;
    if(s[0]=='i'){
      scanf("%d",&k);
      insert(k);
    }
    if(s[0]=='e') extract();
  }

  return 0;
}





Measured memory_bytes: 5608
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

unsigned gcd(unsigned a, unsigned b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

const UINT mod = 1000000007;

UINT PowMod(UINT x, UINT y)
{
	if (y == 0)
	{
		return 1;
	}
	else if (y == 1)
	{
		return x % mod;
	}
	else if (y % 2 == 0)
	{
		auto tmp = PowMod(x, y / 2);
		return tmp * tmp % mod;
	}
	else
	{
		auto tmp = PowMod(x, y / 2);
		return (tmp * tmp % mod) * x % mod;
	}
}

UINT getModInv(UINT N)
{
	return PowMod(N, mod - 2);
}

int main()
{
	INT r;
	cin >> r;
	cout << 3 * r * r << endl;
}


Measured memory_bytes: 256
import sys
import itertools
f = sys.stdin

nhm, mkg = [map(int, f.readline().split()) for _ in range(2)]
n = next(nhm)
m = next(mkg)

goto_iimoriyama = list(zip(*[nhm]*2))
goto_turugajyo = list(zip(*[mkg]*2))

mixed = sorted(list(set(goto_iimoriyama + goto_turugajyo)))

mixed = ['{}:{:02d}'.format(h, m) for h,m in mixed]
print(*mixed)

Measured memory_bytes: 6724
n = int(input())
li = list(map(int,input().split()))
li.insert(0,0)
li.insert(n+1,0)
lidiff = [0]*(n+1)
for i in range(n+1):
  lidiff[i] = abs(li[i+1]-li[i])
li2diff = [0]*n
for i in range(n):
  li2diff[i] = abs(li[i+2]-li[i])
s = sum(lidiff)
for i in range(n):
  print(s-lidiff[i]-lidiff[i+1]+li2diff[i])

Measured memory_bytes: 16376
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,cnt[5],ans;
string s;
int32_t main(){
CODE_START;
cin>>n;
for(ll i=0;i<n;i++)
{
    cin>>s;
    if(s[0]=='M'){
        cnt[0]++;
    }
    if(s[0]=='A'){
        cnt[1]++;
    }
    if(s[0]=='R'){
        cnt[2]++;
    }
    if(s[0]=='C'){
        cnt[3]++;
    }
    if(s[0]=='H'){
        cnt[4]++;
    }
}
for(ll i=0;i<5;i++)
    for(ll j=i+1;j<5;j++)
    for(ll k=j+1;k<5;k++)
    ans=ans+cnt[i]*cnt[j]*cnt[k];
cout<<ans;
}


Measured memory_bytes: 256
nums = gets.chomp.split('')

total = 0
[0 , 1].repeated_permutation(nums.length-1) do |bits|
    arr = [nums[0]]
    arr_i = 0
    0.upto(nums.length-2) do |i|
        if bits[i] == 0
            arr[arr_i] += nums[i+1]
        else
            arr_i += 1
            arr[arr_i] = nums[i+1]
        end
    end
    total += arr.map(&:to_i).inject(:+)
end
puts total


Measured memory_bytes: 1916
n,d=map(int,input().split())
x=[list(map(int,input().split())) for k in range(n)]
count=0
for i in range(n):
    for j in range(n):
        a=0
        for dim in range(d):
            a += (x[i][dim]-x[j][dim])**2
        if (a**0.5).is_integer():
                count += 1
print((count-n) // 2)


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

inline int adjust(int x, int n) {
    if (x < 0) {
        return n - 1;
    }
    else if (x >= n) {
        return x % n;
    }
    return x;
}

int main() {
    int n;
    while (cin >> n, n) {
        int s[15][15] = {0};
        int r, c, m, n2;
        r = n / 2 + 1;
        c = n / 2;
        s[r][c] = 1;
        m = 2;
        n2 = n * n;
        while (m <= n2) {
            r = adjust(r + 1, n);
            c = adjust(c + 1, n);
            while (s[r][c] > 0) {
                r = adjust(r + 1, n);
                c = adjust(c - 1, n);
            }
            s[r][c] = m;
            m++;
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                printf("%4d", s[i][j]);
            }
            printf("\n");
        }

    }
    return 0;
}

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

using namespace std;

int n, a[200005], ans[200005], ans_cnt;
bool mark[200005];

int main(void)
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
    for (int i = n; i >= 1; --i)
    {
        int tmp = 0;
        for (int j = i; j <= n; j += i)
            if (mark[j]) tmp ^= 1;
        if (tmp != a[i])
        {
            int label = true;
            for (int j = i; j <= n; j += i)
                if (!mark[j])
                {
                    mark[j] = true;
                    ans[++ans_cnt] = j;
                    label = false;
                    break;
                }
            if (label)
            {
                printf("-1\n");
                return 0;
            }
        }
    }
    printf("%d\n", ans_cnt);
    for (int i = ans_cnt; i >= 1; --i)
        printf("%d\n", ans[i]);
    return 0;
}


Measured memory_bytes: 2432
import sys
input = sys.stdin.readline

base = 27
mod = (1 << 61) - 1

N = int(input())
S = [input().rstrip()[::-1] for _ in range(N)]
S.sort(key=lambda s: -len(s))
cnt = {}
ans = 0
one = [0] * 26
for s in S:
    n = len(s)
    if n == 1:
        ans += one[ord(s[0]) - ord('a')]
        continue
    hashes = [0] * (n - 1)
    hashes[0] = ord(s[0]) - ord('a') + 1
    for i in range(1, n - 1):
        hashes[i] = (hashes[i-1] * base + ord(s[i]) - ord('a') + 1) % mod
    if hashes[-1] in cnt:
        ans += cnt[hashes[-1]][ord(s[-1]) - ord('a')]
    found = [0] * 26
    found[ord(s[-1]) - ord('a')] = 1
    for i in range(n - 2, 0, -1):
        found[ord(s[i]) - ord('a')] = 1
        if hashes[i-1] not in cnt:
            cnt[hashes[i-1]] = [0] * 26
        for c in range(26):
            cnt[hashes[i-1]][c] += found[c]
    found[ord(s[0]) - ord('a')] = 1
    for c in range(26):
        one[c] += found[c]
print(ans)


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

int main(){
    int n, m, ac, wa;
    ac = 0;
    wa = 0;
    cin >> n >> m;
    vector<P> problems(n, {0, 0});
    rep(i, m){
        int x;
        string y;
        cin >> x >> y;
        if (y == "AC") {
            if (problems[x-1].first == 0) problems[x-1].first++;
        }
        else {
            if (problems[x-1].first == 0) problems[x-1].second++;
        }
    }

    rep(i, n){
        if (problems[i].first == 1){
            ac++;
            wa += problems[i].second;
        }
    }
    cout << ac << " " << wa <<endl;
    return 0;
}

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

int main(){
    LL(n,h);
    vector<pair<ll,ll>> vec(n);
    vector<ll> a(n),b(n);
    ll maxv=0,nagev=0;
    rep(i,n){
        in(vec[i].first,vec[i].second);
        a[i]=vec[i].first;
        b[i]=vec[i].second;
    }
    sort(rall(a));
    sort(rall(b));
    int i=0,ans=0;
    while(b[i]>=a[0]&&h>0){
        h-=b[i];
        ans++;
        i++;
    }
    while(h>0){
        h-=a[0];
        ans++;
    }
    out(ans);
}


Measured memory_bytes: 6436
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
#define all(obj) obj.begin(), obj.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

const long long INF = 1LL << 60;

using namespace std;

typedef unsigned long long ull;
typedef int long long ll;
constexpr ll bigNum = 1000000007;

// 比較+dpテーブル更新　最大問題
// 更新する方の参照をaに渡すこと.
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
// 比較+dpテーブル更新 最小問題// 更新する方の参照をaに渡すこと.　
// 最小問題なので, 更新される側にある数字が比較されてる数字よりも大きければ更新する.こうすることで, 常に小さいものが選ばれていく.
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
// このdpTableのイメージとしては, 中身に入っているのは価値の大きさ, 最初の配列はindex,次の配列はその時の合計の重さである
//long long dp[110][1000010] = {0};
long long weight[110];
long long value[110];
signed main()
{
    fast;
    int N, W = 0;
    cin >> N >> W;
    vector<vector<long long int>> dp(N + 1, vector<long long int>(W + 1, 0));

    REP(i, N)
    {
        cin >> weight[i] >> value[i];
    }
    // DPループ
    for (int i = 0; i < N; ++i)
    {
        for (int sum_w = 0; sum_w <= W; ++sum_w)
        {
            // i 番目の品物を選ぶ場合
            // 0 になってはいけない
            // イメージ: インデクスが１ずれて, それから重さがWのマスに飛んでいくイメージ
            if (sum_w - weight[i] >= 0)
            {
                chmax(dp[i + 1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
            }

            // i 番目の品物を選ばない場合
            // ただindexを１ずらす.
            chmax(dp[i + 1][sum_w], dp[i][sum_w]);
        }
    }

    // 最適値の出力
    // 最後はindexN, 重さWのマスの値を出力すればよい.
    // (けどindexが最後のマスにおいても重さWを使い切らない方が返って価値が高くなる時があるような気がするので一応最後の段について全て比較した方がいいのかもしれない.)
    cout << dp[N][W] << endl;
}


Measured memory_bytes: 80256
import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if sum(a) > sum(b):
  print ('No')
  exit()
elif sum(a) == sum(b):
  for i in range(n):
    if a[i] != b[i]:
      print ('No')
      exit()
  print ('Yes')
  exit()

s = sum(b)-sum(a)
c = 0
for i in range(n):
  if a[i] < b[i]:
    c += math.ceil((b[i]-a[i])/2)
if c > s:
  print ('No')
else:
  print ('Yes')

Measured memory_bytes: 10580
//Name: Planetary Exploration
//Level: 2
//Category: DP,動的計画法,累積和
//Note:

/*
 * J,O,Iそれぞれについて，(0,0)と(r,c)を対角に持つ矩形内の個数を持っておく．
 * (a,b)と(c,d)を対角に持つ矩形内の個数は
 *   acc[c,d] - acc[c,b-1] - acc[a-1,d] + acc[a-1,b-1]
 * として算出できる．
 */
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int acc[3][1000][1000];
int R, C;
int get(int buf[1000][1000], int r, int c) {
    if(r < 0 || r >= R || c < 0 || c >= C) return 0;
    return buf[r][c];
}

void calc_acc(const vector<string> &field, char ch, int buf[1000][1000]) {
    for(int r = 0; r < R; ++r) {
        for(int c = 0; c < C; ++c) {
            buf[r][c] = get(buf, r-1, c) + get(buf, r, c-1) - get(buf, r-1, c-1);
            if(field[r][c] == ch) ++buf[r][c] ;
        }
    }
}

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

    int K;
    cin >> R >> C >> K;
    vector<string> field(R);
    for(int i = 0; i < R; ++i) {
        cin >> field[i];
    }
    calc_acc(field, 'J', acc[0]);
    calc_acc(field, 'O', acc[1]);
    calc_acc(field, 'I', acc[2]);
    for(int i = 0; i < K; ++i) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        --a; --b; --c; --d;
        for(int j = 0; j < 3; ++j) {
            if(j > 0) cout << ' ';
            cout << get(acc[j], c, d) - get(acc[j], c, b-1) - get(acc[j], a-1, d) + get(acc[j], a-1, b-1);
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 13000
S = input()
flag = True

for x in range(len(S)):
    if x % 2 == 0:
        if S[x] != "R" and S[x] != "U" and S[x] != "D":
            flag = False
            break
    else:
        if S[x] != "L" and S[x] != "U" and S[x] != "D":
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <iostream>
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int n, k, a = 0;
	cin >> n >> k;
	vector<int> l(n);
	for(int i = 0; i < n; i++){
		cin >> l.at(i);
	}
	std::sort(l.begin(), l.end(), std::greater<int>() );
	for(int i = 0; i < k; i++){
		a += l.at(i);
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n + 1];//添え字で１～ｎまでにしているので、１つ要素を多く持たせる
		int b[] = new int[n + 1];
		int cnt = 0;

		//pos以降はa[i]をb[i]にコピーすればよい（pos以降のiの倍数は１つしか存在しないため、a[i]の値と一致する）
		int pos = n / 2 + n % 2;
		for (int i = 1; i <= n; i++) {
			a[i] = sc.nextInt();

			if (i > pos) {
				b[i] = a[i];
				if (a[i] == 1)
					cnt++;
			}
		}
		for (int i = pos; i >= 1; i--) {
			int ballCnt = 0;
			for (int j = i; j <= n; j += i)
				ballCnt += b[j];
			if (ballCnt % 2 != a[i]) {
				b[i] = 1;
				cnt++;
			}
		}
				System.out.println(cnt);
		for (int i = 1; i <= n; i++) {
			if (b[i] == 1)
				System.out.println(i);
		}
	}
}


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

using namespace std;

const int N = 1e2;
int a[N],b[N];

int main () {
    string s, t;
    cin >> s >> t;
    for(int i = 0 ; i < s.size() ; i++ ) {
        a[s[i]-'a']++;
        b[t[i]-'a']++;
    }
    sort(a,a+26);
    sort(b,b+26);
    for(int i = 0 ; i < 26 ; i++ ) {
        if(b[i]!=a[i])
            return cout << "No",0;
    }
    cout << "Yes";
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int mod = 1000000007;

int main(){
    int x,a;
    cin >> x >> a;
    if(x < a) cout << 0 << endl;
    else cout << 10 << endl;
}

Measured memory_bytes: 3556
package main

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

func main() {
	fsc := NewFastScanner()
	K, S := fsc.NextInt(), fsc.NextInt()
	result := 0
	for X := 0; X <= K; X++ {
		for Y := 0; Y <= K; Y++ {
			Z := S - (X + Y)
			if Z >= 0 && Z <= K {
				result++
			}
		}
	}
	fmt.Println(result)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if((a+b)%2==0){
      cout<<(a+b)/2<<endl;
    }else{
      cout<<(a+b)/2+1<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#include<cctype>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repp(i,j,n) for (int i = (j); i < (n); i++)
#define Reo(i,j,n) for(int i=(j); i <= (n); i++)
using namespace std;
typedef long long ll;
int main() {
	int n, k;
	cin >> n >> k;
	vector<int>d(k);
	int a[120][120];
	vector<int>ans(n + 1 , 0);
	rep(i, k) {
		cin >> d[i];
		rep(j, d[i]) {
			cin >> a[i][j];
			ans[a[i][j]]++;
		}
	}
	int cnt = 0;
	rep(i, n + 1) {
		if (ans[i] != 0) {
			cnt++;
		}
	}
	cout << n - cnt << endl;
	return 0;
}


Measured memory_bytes: 3644
var input: string = require('fs').readFileSync('/dev/stdin', 'utf8');
var inputLines: string[] = input.trim().split("\n");
var parts = inputLines[0].split(" ");

var A = parseInt(parts[0]);
var B = parseInt(parts[1]);
var C = parseInt(parts[2]);
var satisfy: boolean = C >= A && C <= B;
console.log(satisfy ? "Yes" : "No");

Measured memory_bytes: 7372
n, m, l = gets.split.map(&:to_i)
a = []
b = []

n.times do
  a << gets.split.map(&:to_i)
end

m.times do
  b << gets.split.map(&:to_i)
end

bt = b.transpose

c = a.map do |row_a|
  bt.map { |row_b| row_a.zip(row_b).inject(0) { |s, e| s += e[0] * e[1] } }
end

c.each do |r|
  puts r.join("\s")
end

Measured memory_bytes: 9428
#include<bits/stdc++.h>
using namespace std;
//#define ull unsigned  long  long
#define int long long int
//#define lld long double
#define endl "\n"
#define S second
#define F first
#define pir      pair<int,int>
#define vtr      vector<int>
#define mpp      map<int,int>
#define pb       push_back
#define popb     pop_back()
#define mk       make_pair
#define stc      set<char>
#define st       set<int>
#define stk      stack<int>
#define ctn      continue
#define MOD      1000000007
#define fr(i,a,b)   for(int i=a;i<b;i++)
#define rfr(i,a,b)  for(int i=a-1;i>=b;i--)
#define must        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
int lcm(int a, int b)
 {
    return (a*b)/gcd(a, b);
 }

int myfun(int x,int y)
{
    return x*y;
}
void primeFactors(int n)
{
    while (n%2 == 0)
    {
        cout<<2<<endl;
        n = n/2;
    }
    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            cout<<i<<endl;
            n = n/i;
        }
    }
    if (n > 2)
        cout<<n<<endl;
}

void fillPrefixSum(int arr[], int N, int prefixSum[])
{
    prefixSum[0] = arr[0];

    for (int i = 1; i < N; i++)
        prefixSum[i] = prefixSum[i-1] + arr[i];
}

int factorial(int n)
{
    return (n==1 || n==0) ? 1: n * factorial(n - 1);
}

int power(int x,  int y, int p){
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1;
            x = (x*x) % p;
    }
    return res;
}




void solve()
{
    int n;
    cin>>n;
    int a[n],cnt=0;
    for(int i=0;i<n;i++) cin>>a[i];
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			for (int k = j + 1; k < n; k++)
			{
				if (a[i] == a[j] || a[i] == a[k] || a[j] == a[k]) {
					continue;
				}
				else {
					if (
					    a[i] + a[j] > a[k]
					    && a[i] + a[k] > a[j]
					    && a[k] + a[j] > a[i]) {

						cnt++;
					}

				}
			}
		}
	}
	cout << cnt<<endl;
}



signed main()
{
	must;
    int tt=1;
    //cin >> tt;
	while(tt--)solve();
	return 0;
}


Measured memory_bytes: 3696
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
double abs(double a,double b){
    return  a - b > 0 ? a - b : b - a;
}
int main(){
    int n;
    std::cin >> n;
    double t,a;
    double minn = 1000000;
    int mindex = 0;
    std::cin >> t >> a;
    double tmp;
    for (int i = 1 ; i <= n; i++){
        std::cin >> tmp;
        tmp = t - tmp * 0.006;
        if (fabs(tmp - a) < minn){
            minn = fabs(tmp - a) ;
            mindex = i;
        }
    }
    std::cout << mindex << std::endl;
}

Measured memory_bytes: 256