akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 0x3f3f3f
#define PB push_back
#define F first
#define S second
#define FOR(i,k) for(int i=0; i<k; i++)
#define RFOR(i,k) for(int i=k; i>=0; i--)
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
#define DEBUGV(x) cout<<#x<<": "; for(auto &d:x) cout<<d<<" "; cout<<endl
#define DEBUGM(x) for(auto &p:x) cout<<p.F<<":"<<p.S<<" "; cout<<endl;
#define OUT(x) cout<<(x)<<endl

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VPII;
typedef vector<VI> VVI;
typedef map<char,int> MC;
typedef map<int,int> MI;
typedef map<string,int> MS;

template<typename T, typename U> void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> void amax(T &x, U y) { if(x < y) x = y; }
VPII neighbors = {{0,1}, {1,0}, {0,-1}, {-1,0}};
PII operator+(PII &l, PII &r) { return {l.F+r.F, l.S+r.S}; }
bool IsValid(PII p, int Y, int X) { 
  return p.F >=0 && p.F < Y && p.S >=0 && p.S < X; }
bool IsPrime(int n) {
  if (n <= 1)  return false;
  if (n <= 3)  return true;
  if (n%2 == 0 || n%3 == 0) return false;
  for (int i=5; i*i<=n; i=i+6)
    if (n%i == 0 || n%(i+2) == 0)
      return false;
  return true;
}

int main() {
  int a, b, x;
  cin>>a>>b>>x;
  if(a+b >= x && a<=x)
    OUT("YES");
  else
    OUT("NO");
}

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

int main() {
    int X; cin >> X;
    int ans;
    if (400 <= X && X <= 599) ans = 8;
    else if (600 <= X && X <= 799) ans = 7;
    else if (800 <= X && X <= 999) ans = 6;
    else if (1000 <= X && X <= 1199) ans = 5;
    else if (1200 <= X && X <= 1399) ans = 4;
    else if (1400 <= X && X <= 1599) ans = 3;
    else if (1600 <= X && X <= 1799) ans = 2;
    else ans = 1;
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<stdio.h>
int n, m;
int a[2000][2000];
int b[2000][2000];
int c[2000][2000];
int e[2000][2000];
int sx[1000005];
int sy[1000005];
int p[1000005];
void prime()
{
	int i, j;
	p[1] = 1;
	for(i=2;i<=1000000;i++)
	{
		if(p[i] == 0)
		{
			for(j=2*i;j<=1000000;j+=i)
			{
				p[j] = 1;
			}
		}
	}
}
void inil()
{
	int i, j;
	prime();
	int x,y,d;
	int dx[4]={1,0,-1,0};
	int dy[4]={0,1,0,-1};
	d = 0;
	x = y = 1000;
	int k=1;
	int td;
	while(k<=1000000)
	{
		a[x][y] = k;
		sx[k] = x;
		sy[k] = y;
		if(p[k] == 0)
			b[x][y] = 1;
		td = (d+1)%4;
		if(a[dx[td] + x][dy[td] + y] == 0)
			d = td;
		x = x+dx[d];
		y = y+dy[d];
		k++;
	}
}
void process()
{
	int i, j, k;
	int x,y;
	x = sx[m];
	y = sy[m];
	for(i=0;i<2000;i++)
		for(j=0;j<2000;j++)
			c[i][j] = e[i][j]=0;
	if(p[a[x][y]]==0)
	{
		c[x][y]=1;
		e[x][y] = a[x][y];
	}
	for(i=x+1;i<1888;i++)
	{
		for(j=y-i+x;j<=y+i-x;j++)
		{
			if(j<0)continue;
			if(j>1888)continue;
			if(a[i][j] == 0 || a[i][j] > n) continue;
			//printf("%d %d  %d %d\n",x,y,i,j);
			k = (p[a[i][j]]==0);
			if(c[i][j] < c[i-1][j-1] + k)
			{
				c[i][j] = c[i-1][j-1]+k;
				e[i][j] = e[i-1][j-1];
			if(k)e[i][j] = a[i][j];
			}
			else if(c[i][j] == c[i-1][j-1]+k)
			{
				e[i][j] = e[i-1][j-1];
			if(k)e[i][j] = a[i][j];
			}
			if(c[i][j] < c[i-1][j] + k)
			{
				c[i][j] = c[i-1][j]+k;
				e[i][j] = e[i-1][j];
			if(k)e[i][j] = a[i][j];
			}
			else if(c[i][j] == c[i-1][j]+k)
			{
				e[i][j] = e[i-1][j];
			if(k)e[i][j] = a[i][j];
			}
			if(c[i][j] < c[i-1][j+1] + k)
			{
				c[i][j] = c[i-1][j+1]+k;
				e[i][j] = e[i-1][j+1];
			if(k)e[i][j] = a[i][j];
			}
			else if(c[i][j] == c[i-1][j+1]+k)
			{
				e[i][j] = e[i-1][j+1];
			if(k)e[i][j] = a[i][j];
			}
		}
	}
	int max=0;
	int mi = 0;
	for(i=n;i>0;i--)
	{
		if(max < c[sx[i]][sy[i]])
		{
			max = c[sx[i]][sy[i]];
			mi = e[sx[i]][sy[i]];
		}
		else if(max == c[sx[i]][sy[i]])
		{
			if(mi < e[sx[i]][sy[i]])
				mi = e[sx[i]][sy[i]];
		}
	}
	if(max==0)mi=0;
	printf("%d %d\n",max,mi);
}
int main()
{
	inil();
	while(1)
	{
		scanf("%d %d",&n,&m);
		if(n+m==0)break;
		process();
	}
}

Measured memory_bytes: 66560
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
using namespace std;

string s = "0123456789AB";
string goal = "0123456789AB0";

vector<vector<int>> adj = {
    {2},
    {2,5},
    {0,1,3,6},
    {2,7},
    {5},
    {1,4,6,9},
    {2,5,7,10},
    {3,6,8,11},
    {7},
    {5,10},
    {6,9,11,12},
    {7,10},
    {10}
};

int solve(string stat) {
    if (stat == goal) return 0;
    map<string, int> dist;
    dist[stat] = 0;
    queue<string> q;
    q.push(stat);
    while ( ! q.empty()) {
        string s = q.front();
        q.pop();
        for (int i=0; i<13; ++i) {
            if (s[i] != '0') continue;
            for (int j : adj[i]) {
                string next = s;
                next[i] = s[j];
                next[j] = s[i];
                int diff = 0;
                for (int k=0; k<13; ++k) {
                    diff += next[k] != goal[k];
                }
                if ( ! diff) {
                    return dist[s] + 1;
                }
                if (dist.find(next) == dist.end() && dist[s] + diff - 1 <= 20) {
                    q.push(next);
                    dist[next] = dist[s] + 1;
                }
            }
        }
    }
    return 21;
}

int main() {
    while (1) {
        string stat = "";
        int k;
        for (int i=0; i<13; ++i) {
            if (cin >> k && !~k) return 0;
            stat += s[k];
        }
        int ans = solve(stat);
        if (ans <= 20) {
            cout << ans << endl;
            continue;
        }
        cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 7864
#include <stdio.h>
int main(void){
  int a;
  char wo[100];
  scanf("%s",&wo);
  for(int i=0;i<=2;i++){
    //printf("%c\n",line[i] );
    if (wo[i] == '9'){
        printf("1");
    }else{

        printf("9");
    }




  }
printf("\n");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
#define mod2 1000000006
#define inf 1000000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<lli>
#define vii vector<int>
#define is indexed_set
#define eps 0.000001
#define endl '\n'
#define mo 998244353
#define pi 3.141592653589793
 
using namespace std ;

const lli dx4[] = {-1, 0, 1, 0};
const lli dy4[] = {0, 1, 0, -1};
const lli dx8[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const lli dy8[] = {0, 1, 0, -1, -1, 1, -1, 1};
 
typedef tree<pair<pll,lli>,null_type,less<pair<pll,lli>>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
 
#define N 1000005

int main()
{
/////////////////////////////////////
    
    fastio;
 
/////////////////////////////////////  

    lli n;
    cin>>n;

    lli a[n];
    loopl(i,0,n) cin>>a[i];

    loopl(i,0,n)
    {
    	if(a[i]%2 == 0)
    	{
    		if(a[i]%3 !=0 && a[i]%5!=0)
    		{
    			cout<<"DENIED";
    			return 0;
    		}
    	}
    }

    cout<<"APPROVED";
}
        
 

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		for(long a = -1250; a <= 1250; a++){
			for(long b = -1250; b <= 1250; b++){
				if(a * a * a * a * a - b * b * b * b * b == X){
					Console.WriteLine("{0} {1}",a, b);
					return;
				}
			}
		}
		
		
		
		Console.WriteLine("0 0");
	}
	long X;
	public Sol(){
		X = rl();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 27396
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

const int MAX_N = 110;
int N, K;
int V[MAX_N];

int calc(int L, int R) {
    std::vector<int> vec;
    for (int i = 1; i <= L; i++) {
        vec.push_back(V[i]);
    }
    for (int i = N; N - R + 1 <= i; i--) {
        vec.push_back(V[i]);
    }
    std::sort(vec.begin(), vec.end(), std::greater<int>());
    for (int i = 0; i < K - L - R; i++) {
        if (vec.size() == 0) {
            break;
        }
        if (vec.back() < 0) {
            vec.pop_back();
        } else {
            break;
        }
    }
    int ret = 0;
    for (int i : vec) {
        ret += i;
    }
    //std::cout << L << " " << R << " " << ret << std::endl;
    return ret;
}

int main(int argc, char **argv) {
    std::cin >> N >> K;

    for (int i = 1; i <= N; i++) {
        std::cin >> V[i];
    }

    int ret = 0;
    for (int L = 0; L <= std::min(N, K); L++) {
        for (int R = 0; R + L <= std::min(N, K); R++) {
            ret = std::max(ret, calc(L, R));
        }
    }

    std::cout << ret << std::endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int N = 0;
    scanf("%d", &N);
    double x = 0; char u[4];
    double sum = 0;
    for(int i = 0; i < N; i++){
        scanf("%lf %s", &x, u);
        if(u[0] == 'J' && u[1] == 'P' && u[2] == 'Y'){
            sum += x;
        }else {
            sum += 380000.0 * x;
        }
    }
    printf("%f\n", sum);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>

using namespace std;

int main(int argc, char const *argv[])
{
	int n;
	cin >> n;

	long long int l[n];

	l[0] = 2;
	l[1] = 1;

	for (int i = 2; i < n+1; ++i)
	{
		l[i] = l[i-1]+l[i-2];
	}

	cout << l[n] << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	long long a,b;
	scanf("%lld%lld",&a,&b);
	long long sum=0;
	for(long long i=a;i<=b;i*=2) {
		++sum;
	}
	long long ano=0,i;
	for(i=1;i<a;i*=2);
	for(;i<=b;i*=2) {
		++ano;
	}
	sum=max(sum,ano);
	printf("%lld\n",sum);
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int k,q;
ll d[5010];

void solve(){
  cin >> k >> q;
  rep(i,k){
    cin >> d[i];
  }
  rep(i,q){
    ll x,m,n;
    cin >> n >> x >> m;
    n--;
    ll S=x%m;
    ll num=0;
    rep(j,k){
      if(j<(n%k)) {
        S+=(n/k+1)*(d[j]%m);
        if(d[j]%m==0) num+=(n/k+1);
      }
      else {
        S+=(n/k)*(d[j]%m);
        if(d[j]%m==0) num+=n/k;
      }
    }
    //cout << S << " " << num << endl;
    cout << n-S/m-num << endl;
  }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int main() {
    int n;
    cin >> n;
    set<string> st;
    bool ok = true;
    char last = 0;
    while (n--) {
        string s;
        cin >> s;
        ok = ok && st.count(s) == 0 && (last == 0 || last == s[0]);
        st.insert(s);
        last = s.back();
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

// π M_PI
// deg = rad*180/M_PI

const ll MOD = 1e9 + 7;

ll Mod(ll a, ll mod) {
    return (a%mod + mod)%mod;
}

ll pow_mod(ll x, ll n, ll mod) {
    ll res = 1;
    while(n > 0) {
        if (n & 1) {
            res = res*x%mod;
        }
        x = x*x%mod;
        n >>= 1;
    }
    return res;
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}

ll modinv(ll a, ll mod) {
    ll x, y;
    extGCD(a, mod, x, y);
    return Mod(x, mod);
}

ll nCr_mod(ll n, ll r, ll mod) {
    if ( n == r || n == 1 ) {
        return 1;
    }

    r = min(r, n-r);
    if ( r == 1 ) {
        return n;
    } else {
        ll n_to_n_r = n;
        ll r_to_1 = r;
        rep2(i, r-1) {
            n_to_n_r *= n-i;
            n_to_n_r %= mod;
            r_to_1 *= r-i;
            r_to_1 %= mod;
        }
        r_to_1 = modinv(r_to_1, MOD);
        return n_to_n_r*r_to_1%mod;
    }
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    
    ll ans = pow_mod(2, n, MOD)-1;
    ans = Mod(ans-nCr_mod(n, a, MOD), MOD);
    ans = Mod(ans-nCr_mod(n, b, MOD), MOD);
    cout << ans << endl;
    return 0;
}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N;
int m [100000];
ll dp [100001];
const ll MOD = 1e9 + 7;

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

	cin >> N;
	vector<ll> T(N),A(N);
	FOR(i,0,N){
		cin >> T [i];
	}
	FOR(i,0,N){
		cin >> A [i];
	}

	for(int i = 0;i < N;i++){
		if(i == 0 || T [i - 1] < T [i]){
			if((m [i] == 0 || m [i] == T [i]) && T [i] <= A [i]){
				m [i] = T [i];
			}
			else{
				cout << 0 << endl;
				return 0;
			}
		}
	}
	for(int i = N - 1;i >= 0;i--){
		if(i == N - 1 || A [i + 1] < A [i]){
			if((m [i] == 0 || m [i] == A [i]) && A [i] <= T [i]){
				m [i] = A [i];
			}
			else{
				cout << 0 << endl;
				return 0;
			}
		}
	}

	dp [0] = 1;
	FOR(i,0,N){
		dp [i + 1] = dp [i];
		if(m [i] == 0){
			(dp [i + 1] *= min(T [i],A [i])) %= MOD;
		}
	}

	cout << dp [N] << endl;

	return 0;
}


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

int main(){
	int a, b, c;
	while(scanf("%d%d%d", &a, &b, &c) == 3){
		int t[11] = {};
		t[a] = t[b] = t[c] = 1;
		int u = 0;
		for(int i = 1; i <= 10; ++i){
			if(!t[i] && a + b + i <= 20){ ++u; }
		}
		puts(u > 3 ? "YES" : "NO");
	}
}

Measured memory_bytes: 1008
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int mod = 1e+7;

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

  int n;
  cin >> n;
  vector<int> t(n);
  vector<int> x(n);
  vector<int> y(n);
  rep(i,n) cin >> t[i] >> x[i] >> y[i];

  bool res = true;
  rep(i,n) {
    int xy = x[i] + y[i];
    if(t[i] < xy) res = false;
    if(t[i]%2 != xy%2) res = false;
  }
  reps(i,1,n) {
    int tdiff = t[i] - t[i-1];
    int xydiff = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);
    if(tdiff < xydiff) res = false;
  }
  YesorNo(res);
  return 0;
}

Measured memory_bytes: 1408
import collections

n = int(input())
s = input()
l1 = []
l2 = []
ans = 0
for i in range(1,n):
  l1 = set(list(s[0:i:]))
  l2 = set(list(s[i::]))
  ans = max(ans,len(l1&l2))
#  print(l1,l2,ans)
  
print(ans)

Measured memory_bytes: 3316
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n+1)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 1; i <= n; i++ { // 1-indexed
		a[i] = nextInt(sc)
	}
	box := make([]int, n+1)
	for i := n; i >= 1; i-- { // 大きい方から(Nから降順に)見ていく
		sum := 0
		for j := i; j <= n; j += i { // i<=nの間にiの倍数は何個あるか？
			sum += box[j] // iの倍数に対応する箱に入っているボールの数を追跡する
		}
		//fmt.Println("sum[", i, "]", sum, "a[", i, "]=", a[i])
		if (a[i] == 1 && sum%2 == 0) ||
			(a[i] == 0 && sum%2 == 1) {
			// fmt.Println("put ball into box[", i, "]")
			box[i]++
		}
	}
	// fmt.Println("box", box)
	ans := 0
	for i := 1; i < len(box); i++ {
		if box[i] == 1 {
			ans++
		}
	}
	fmt.Println(ans)
	if ans > 0 {
		for i := 1; i < len(box); i++ {
			if box[i] == 1 {
				fmt.Printf("%d ", i)
			}
		}
		fmt.Println()
	}
}


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


void showMatrix(int matrix[][10], int n){
	for(int i=0; i<n; ++i){
		for(int j=0; j<n; ++j){
			cout.width(3);
			cout << matrix[i][j];
		}
		cout << endl;
	}
}

void moveNextPosition(int *x, int *y, int n){
	// - - 3
	// - * 5
	// 6 7 - 
	static int state = 0;
	

	switch(state){
		case 3: //右上
			--*x;
			++*y;
			if(!*x) state=5;	// →
			if(*y==n-1) state=7; //↓
			break;
		case 5: //右
			++*y;
			if(!*x) state=6; //左下
			if(*x==n-1) state=3; //右上
			if(*x==*y && *x==n-1) state=0;
			break;
		case 6: // 左下
			++*x;
			--*y;
			if(!*y) state=7; // ↓
			if(*x==n-1) state=5; // →
			break;
		case 7: //下
			++*x;
			if(!*y)state=3; //右上
			if(*y==n-1) state=6;
			if(*x==*y && *x==n-1) state=0;
			break;
		default:
			//initial state
			state=5;
			break;
	}
}

//1007
int main(){
	int n;
	int count=1;

	while(cin >> n ,n){
		int matrix[10][10]={0};
		int x, y, i;

		x = y = 0;
		i=1;
		matrix[0][0]=1;
		while(x!=n-1 || y!=n-1){
			moveNextPosition(&x, &y, n);
			matrix[x][y] = i++;
		}

		cout << "Case " << count++ << ":" << endl;
		showMatrix(matrix, n);
	}

	return 0;
}

Measured memory_bytes: 0
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });

            var S = ReadLine();
            var chars = new bool[26];
            foreach(var c in S)
                chars[c - 'a']= true;
            for (var i = 0; i < 26; ++i)
                if (!chars[i])
                {
                    WriteLine((char)('a' + i));
                    return;
                }
            WriteLine("None");
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 11232
//
//AtCoder Beginner Contest 079
//B
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int n;
    cin >> n;
    
    vector<ll> ln(100);
    ln[0]=2;
    ln[1]=1;
    FOR(i, 2, n){
        ln[i] = ln[i-1]+ln[i-2]; 
    }
    cout << ln[n] << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };



int main() {
	int n, k;
	cin >> n >> k;
	hei(int) d(k);
	hei(bool) s(n);
	rep(i, 0, k) {
		cin >> d[i];
		rep(j, 0, d[i]) {
			int z;
			cin >> z;
			z--;
			s[z] = true;
		}
	}
	int ans = 0;
	rep(i, 0, n) {
		if (!s[i])ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()

int main(){
	double W,H,x,y;cin>>W>>H>>x>>y;
	cout<<setprecision(10)<<W*H/2<<" ";
	if(x==W/2&&y==H/2){
		cout<<1<<endl;
	}else{
		cout<<0<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long ll;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second
const lint MOD = (lint) 1e9 + 7;
signed main(){
    int a, p; cin>>a>>p;
    int res=0;
    a = a*3 + p;
    res = a/2;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;

int main(){
    ll n, d;
    cin >> n >> d;
    ll ans = 0;
    REP(i, n){
        ll xi, yi;
        cin >> xi >> yi;
        if((xi * xi + yi * yi) <= d * d){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//int n = sc.nextInt();
		//String[][] array = new String[100][500];
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		List<Integer> list=new ArrayList<Integer>();
		int k = sc.nextInt();
		int x = sc.nextInt();

		list.add(x);

		for(int i=1;k>i;i++) {
			list.add(x-i);
		}

		for(int i=1;k>i;i++) {
			list.add(x+i);
		}

		Collections.sort(list);

		for(int i=0;list.size()>i;i++) {
			System.out.print(list.get(i));
			if((i+1)!=list.size()) {
				System.out.print(" ");
			}
		}

	}

}

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

int main(){
  string s1,s2,s3 ;
  cin>>s1>>s2>>s3;
  char n1 =toupper(s1[0]);
  char n2 =toupper(s2[0]);
  char n3 =toupper(s3[0]);
cout<<n1<<n2<<n3;

}

Measured memory_bytes: 256
n = int(input())

from math import factorial
def comb(n, r):
    if n < r:
        return 0
    return factorial(n) // factorial(r) // factorial(n - r)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

d = {}

for i in range(1, n+1):
    for m, cnt in factorization(i):
        if m == 1:
            continue
        if m in d:
            d[m] += cnt
        else:
            d[m] = cnt

cnt = [0 for i in range(100)]

for k in d:
    cnt[d[k]] += 1

print(
    sum(cnt[74:]) + # 75
    sum(cnt[4:14]) * sum(cnt[14:]) + sum(cnt[14:]) * (sum(cnt[14:])-1) + # 5 * 15
    sum(cnt[2:24]) * sum(cnt[24:]) + sum(cnt[24:]) * (sum(cnt[24:])-1) + # 3 * 25
    sum(cnt[2:4]) * comb(sum(cnt[4:]), 2) + sum(cnt[4:]) * comb(sum(cnt[4:])-1, 2) # 3 * 5 * 5
)


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

#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif

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

#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vb = vector<bool>;

const ll INF = 1e18;
const ll MOD = 1e9+7;

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

int N, M;
vector<vi> G;

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    cin >> N >> M;
    G.resize(N);
    vi ans(N, -1); ans[0] = 0;
    REP(i, M)
    {
        int A, B; cin >> A >> B;
        A--; B--;
        G[A].pb(B);
        G[B].pb(A);
    }

    queue<int> q;
    q.push(0);
    while(!q.empty())
    {
        int p = q.front(); q.pop();
        for(int n : G[p])
        {
            if(ans[n] == -1)
            {
                ans[n] = p;
                q.push(n);
            }
        }
    }

    REP(i, N)
    {
        if(ans[i] == -1)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 1; i < N; i++) cout << ans[i]+1 << endl;
}

Measured memory_bytes: 10324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n, c, k;
int main(void){
	cin>> n >> c >> k;
	vint t(n);
	rep(i, n) cin >> t[i];
	sort(all(t));
	ll ans = 0;
	int l = 0, r = 1; //[l, r)
	while(l < n){
		// printf("1 : %d %d\n", l, r);
		while(r - l < c and r < n and t[l] + k >= t[r]) r++;
		// printf("2 : %d %d\n", l, r);
		ans++;
		l = r;
		r++;
		// printf("3 : %d %d\n", l, r);

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

Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <stack>
#include <map>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <string.h>
#define sf(n) scanf("%d",&n)
#define sff(n,m) scanf("%d%d",&n,&m)
#define ll long long
#define mod 1000000007
#define INF 400000
using namespace std;
int main(){
    int n,k;
    sff(n,k);
    string x;cin>>x;
    int a[100005]={0};
    int cnt=0,num=0;
    int fl=1;
    for(int i=0;i<n;i++){
        if(x[i]==fl+'0'){
            a[cnt]++;
        }
        else{
            cnt++;
            a[cnt]++;
            fl=1-fl;
        }
    }
    int sum=0,flag=1;
    for(int i=0;i<=cnt;i++){
        sum+=a[i];
        if(i>=2*k){flag=0;break;}
    }
    if(flag){printf("%d\n",n);return 0;}
    int mmax=sum;
    //printf("%d\n",sum);
    for(int i=2*k+1;i<=cnt;i+=2){
        sum=sum+a[i]+a[i+1]-a[i-2*k-1]-a[i-2*k];
        //printf("%d\n",sum);
        mmax=max(mmax,sum);
    }
    printf("%d\n",mmax);
}


Measured memory_bytes: 896
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;

int main() {
  int n, m; cin >> n >> m;
  vector<int> a(n);
  rep(i, m) {
    int k; cin >> k;
    rep(j, k) {
      int s; cin >> s; s--;
      a[s] |= 1<<i;
    }
  }
  int p = 0;
  rep(i, m) {
    int x; cin >> x;
    p |= x << i;
  }
  int ans = 0;
  rep(s, (1<<n)) {
    int t = 0;
    rep(i, n) {
      if(s >> i & 1) {
        t ^= a[i];
      }
    }
    if(t == p) {
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;

int[10][10] CS;

void main()
{
    int H = readln.split.to!(int[])[0];

    foreach (i; 0..10) CS[i][] = readln.split.to!(int[])[];

    foreach (_; 0..10)
        foreach (i; 0..10)
            foreach (j; 0..10)
                foreach (k; 0..10)
                    if (CS[i][j] > CS[i][k] + CS[k][j])
                        CS[i][j] = CS[i][k] + CS[k][j];

    int c;
    foreach (_; 0..H) {
        auto l = readln.split.to!(int[]);
        foreach (e; l) if (e != -1) c += CS[e][1];
    }
    writeln(c);
}

Measured memory_bytes: 3964
#include <iostream>
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
 
int main()
{
  char S[4];
  scanf("%s", S);
  if(S[1] == 'B')
  {
  	printf("ARC");
  }
  else
  {
  	printf("ABC");
  }
  return 0;
}

Measured memory_bytes: 3792
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define inl(...)  \
  ll __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

#define inc(...)      \
  char __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

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

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

inline bool in_board(int H, int W, int x, int y) {
  return 2 <= x && x <= H - 1 && 2 <= y && y <= W - 1;
}

typedef pair<int, int> P;

struct hash_pair {
  template <class T1, class T2> size_t operator()(const pair<T1, T2> &p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ (hash2 << 15);
  }
};

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

void solve() {
  inl(H, W, N);
  unordered_map<P, int, hash_pair> map;
  map.reserve(N);

  ll ret[] = {0LL, 0LL, 0LL, 0LL, 0LL, 0LL, 0LL, 0LL, 0LL, 0LL};
  ret[0] = (H - 2) * (W - 2);

  rep(i, N) {
    ini(a, b);
    for (auto i : dx) {
      for (auto j : dy) {
        if (in_board(H, W, a + i, b + j)) {
          if (map.find({a + i, b + j}) == map.end())
            map[P({a + i, b + j})] = 0;
          auto tmp = ++map[P({a + i, b + j})];
          ret[tmp - 1]--;
          ret[tmp]++;
        }
      }
    }
  }

  rep(i, 10) { out(ret[i]); }
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    if (n % getDigSum(n) == 0) {
      cout << "Yes" << '\n';
    } else {
      cout << "No" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

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

int deg[100100];

int main(void){
	int n,m,a,b,i;
	cin >> n >> m;
	for(i=0; i<m; ++i){
		cin >> a >> b;
		--a; --b;
		++deg[a];
		++deg[b];
	}
	for(i=0; i<n; ++i){
		if(deg[i]%2){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 1148
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可
//乗算の際にオーバーフローに注意せよ！！（適切にmodをとれ）
//制約をよく読め！

const ll INF=1e18;

int h,w;

int a[85][85];
int b[85][85];
int c[85][85];

bool dp[85][85][128005];

signed main(){
    cin>>h>>w;
    rep(i,h){
        rep(j,w) cin>>a[i][j];
    }
    rep(i,h){
        rep(j,w) cin>>b[i][j];
    }
    rep(i,h){
        rep(j,w) c[i][j]=abs(a[i][j]-b[i][j]);
    }
    dp[0][0][c[0][0]]=1;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            for(int k=0;k<=128000;k++){
                if(dp[i][j][k]){
                    dp[i+1][j][k+c[i+1][j]]=1;
                    dp[i][j+1][k+c[i][j+1]]=1;
                    dp[i+1][j][abs(k-c[i+1][j])]=1;
                    dp[i][j+1][abs(k-c[i][j+1])]=1;
                }
            }
        }
    }
    int ans;
    for(int i=0;i<=128005;i++){
        if(dp[h-1][w-1][i]){
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
}

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

#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define endl '\n'
// #define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, l;
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> n >> l;
	int sum = 0;
	for(int i=0; i<n; i++) sum += l+i;
	int mn = INF, ans;
	for(int i=0; i<n; i++){
		int flavor = 0;
		for(int j=0; j<n; j++){
			if (j == i) continue;
			flavor += l+j;
		}
		if (abs(sum - flavor) < mn) {
			mn = abs(sum - flavor);
			ans = flavor;
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
// import java.io.*;
// import java.time.*;

public class Main {
    static StringBuilder sb;

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

        int n = sc.nextInt();

        TreeSet<Integer> set = new TreeSet<>();

        for (int i = 0; i < n; i++) {
            set.add(sc.nextInt());
        }

        int m = sc.nextInt();

        for (int i = 0; i < m; i++) {
            set.add(sc.nextInt());
        }

        while (!set.isEmpty()) {
            sb.append(set.pollFirst()).append("\n");
        }

        System.out.print(sb);
        
        sc.close();
    }
}



Measured memory_bytes: 193296
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    map<int,int> mp;
    rep(i,n){
        mp[a[i]]++;
    }
    int cnt=0;
    for(auto x:mp){
        cnt+=x.sc*(x.sc-1)/2;
    }
    rep(i,n){
        int memo=mp[a[i]];
        memo--;
        cout<<cnt-memo<<endl;
    }
}

Measured memory_bytes: 11136
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program {
    static void Main(string[] args) {
        //入力
        int N = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        int[] a = new int[N];

        for (int i = 0; i < N; i++) {
            a[i] = int.Parse(s.Split(' ')[i]);
        }

        //ソート
        int[] a_sort = a.OrderBy(x => -x).ToArray();

        //回答となる数値
        int ans = 0;

        //検証
        for (int i = 0; i < N; i++) {
            ans += (int)Math.Pow(-1, i) * a_sort[i];
        }

        //出力
        Console.WriteLine(ans);
    }
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n,d,a; cin >> n >> d >> a;
  vector<P<int,int>> v(n);
  for(int i = 0; i < n; ++i)cin >> v[i].first >> v[i].second;
  sort(v.begin(), v.end());
  vector<int> x(n),h(n);
  for(int i = 0; i < n; ++i)tie(x[i],h[i]) = v[i];
  ll total = 0;
  ll ans = 0;
  heaP<P<int,ll>> hp;
  for(int i = 0; i < n; ++i){
    while(!hp.empty()&&hp.top().first == i){
      total -= hp.top().second;
      hp.pop();
    }
    h[i] -= total;
    ChangeMax(h[i],0);
    ll c = (h[i]+a-1)/a;
    ans += c;
    total += c*a;
    int pos = upper_bound(x.begin(), x.end(), x[i]+2*d)-x.begin();
    hp.push({pos,c*a});
  }
  cout << ans << endl;
  return 0;
}


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


int main(){
  ll n;
  cin >> n;
  vector<string> s(n);
  map<string, ll> ma;
  
  for(int i=0; i<n; i++){
    cin >> s[i];
    ma[s[i]]++;
  }
  
  ll max_num = ma[s[0]];
  for(int i=1; i<n; i++){
    if(max_num<ma[s[i]]){
      max_num = ma[s[i]];
    }
  }
  
  for(auto i:ma){
    if(i.second==max_num){
      cout << i.first << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 25104
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n,T;
  cin >>n>>T;
     vector<int> c(n);
       vector<int> t(n);
   for (int i = 0; i < n; i++) {
    cin >> c.at(i) >> t.at(i);
  }
int max =100000000;
  int ans =max;
  for (int i = 0; i < n; i++) {
 if(t[i]<=T){
   ans =min(ans,c[i]);
 }
}
 
  if(ans<max){
    cout<<ans<<endl;
  }
  else{
    cout <<"TLE"<<endl;
  }
  
}

Measured memory_bytes: 256
using System;

namespace AtCorder100_B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int D = int.Parse(input[0]);
            int N = int.Parse(input[1]);
            if (N == 100) N++;
            Console.WriteLine(Math.Pow(100, D) * N);
        }
    }
}


Measured memory_bytes: 11092
n = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

# error1: ペアができない場合。ただし、nが奇数のときは0が1個だけ。nが偶数のときは普通通り
from collections import defaultdict
flag = True
if n % 2 == 0:
  dic = defaultdict(int)
  for a in A:
    dic[a] += 1
  for k, v in dic.items():
    if k % 2 == 0:
      flag = False
    if v != 2:
      flag = False
else:
  dic = defaultdict(int)
  for a in A:
    dic[a] += 1
  for k, v in dic.items():
    if k % 2 == 1:
      flag = False
    if k == 0:
      if v != 1:
        flag = False
    elif v != 2:
      flag = False

ans = (2 ** (n //2)) % mod
if flag:
  print(ans)
else:
  print(0)

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

long long nCr(int n, int r) {
    long long ans = 1;
    for (int i = n; i > n - r; i--) ans *= i;
    for (int i = r; i >= 1; i--) ans /= i;
    return ans;
}

int main() {
    int n, m, a[100000];
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] %= m;
    }

    map<int, int> rest_num_table;
    rest_num_table[0] = 1;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum = (sum + a[i]) % m;
        if (rest_num_table.find(sum) == rest_num_table.end()) {
            rest_num_table[sum] = 1;
        } else {
            rest_num_table[sum]++;
        }
    }

    long long ans = 0;
    for (auto rest_num_table_i : rest_num_table) {
        if (rest_num_table_i.second >= 2) ans += nCr(rest_num_table_i.second, 2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584