akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		
		String[] tmpArray = br.readLine().split(" ");
		
		int input[] = new int[n];
		
		for(int i = 0; i < n; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		}
		
		int times = 0;
		
		ArrayList<Operation> op = new ArrayList<Operation>();

		boolean allPositive = true;
		boolean allNegative = true;
		for(int i = 0; i < n; i++){
			if(input[i] < 0){
				allPositive = false;
			}
			else if(input[i] > 0){
				allNegative = false;
			}
		}
		
		if(allPositive){
			times = calcArray(input, op, true);
		}
		else if(allNegative){
			times = calcArray(input, op, false);
		}
		else {
			//この場合すべて非負かすべて負にする必要がある
			int maxI = 0;
			int minI = 0;
			
			for(int i = 1; i < n; i++){
				if(input[i] > input[maxI]){
					maxI = i;
				}
				if(input[i] < input[minI]){
					minI = i;
				}
			}
			
			int fixI = 0;
			if(input[maxI] >= -input[minI]){
				fixI = maxI;
			}
			else {
				fixI = minI;
			}
			
//			int tmpTimes = 0;
			for(int i = 0; i < n; i++){
				if(i == fixI){
					continue;
				}
				input[i] += input[fixI];
				op.add(new Operation(fixI, i));
			}
			
			if(input[0] >= 0){
				calcArray(input, op, true);
			}
			else {
				calcArray(input, op, false);
			}
		}
		
//		for(int i = 1; i < n; i++){
//			if(input[i] >= input[i - 1]){
//				continue;
//			}
//			
//			//i番目が負で
//		}
		
		System.out.println(op.size());
		for(int i = 0; i < op.size(); i++){
			System.out.println(op.get(i).toString());
		}
	}
	
	static int calcArray(int[] array, ArrayList<Operation> op, boolean forward){
		int n = array.length;
		int times = 0;
		if(forward){
			for(int i = 1; i < n; i++){
				array[i] += array[i-1];
				op.add(new Operation(i-1, i));
				times++;
			}
		}
		else {
			for(int i = n - 2; i >= 0; i--){
				array[i] += array[i + 1];
				op.add(new Operation(i+1, i));
				times++;
			}
		}
		
		return times;
	}

}

class Operation {
	int x;
	int y;
	
	public Operation (int x, int y){
		this.x = x + 1;
		this.y = y + 1;
	}
	
	public String toString(){
		return x+" "+y;
	}
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

class minCostFlow {

	struct edge { int to, cap, cost, rev; };

	int V;
	vector<vector<edge>> G;
	vector<int> dist;
	vector<int> prevv;
	vector<int> preve;

public:

	minCostFlow(int n): G(n+10), dist(n+10), prevv(n+10), preve(n+10), V(n){
	}

	void addEdge(int from, int to, int cap, int cost) {
		G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
		G[to].push_back((edge){from, 0, -cost, (int)G[from].size() - 1});
	}

	int solve(int s, int t, int f) {
		int ret = 0;
		while(f > 0) {
			fill(dist.begin(), dist.end(), INF);
			dist[s] = 0;
			bool update = true;
			while(update) {
				update = false;
				for(int v = 0;v < V;v++) {
					if(dist[v] == INF)continue;
					for(int i = 0;i < G[v].size();i++) {
						edge &e = G[v][i];
						if(e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
							dist[e.to] = dist[v] + e.cost;
							prevv[e.to] = v;
							preve[e.to] = i;
							update = true;
						}
					}
				}
			}
			if(dist[t] == INF) {
				return -1;//流せない
			}

			int d = f;
			for(int v = t;v != s;v = prevv[v]) {
				d = min(d, G[prevv[v]][preve[v]].cap);
			}
			f -= d;
			ret += d * dist[t];
			for(int v = t;v != s;v = prevv[v]) {
				edge &e = G[prevv[v]][preve[v]];
				e.cap -= d;
				G[v][e.rev].cap += d;
			}
		}
		return ret;
	}

};

int main(){

	int v,e,f;cin >> v >> e >> f;
	minCostFlow mcf(v);

	REP(i,e) {
		int a,b,c,d;cin >> a >> b >> c >> d;
		mcf.addEdge(a, b , c, d);
	}

	cout << mcf.solve(0, v-1, f) << endl;

	return 0;
}



Measured memory_bytes: 3220
#include <stdio.h>
int main(){
    int n,a[10],temp;
    while(1){
        scanf("%d",&n);
        if(n==0)return 0;
        for(int i=0;i<10;i++)a[i]=0;
        while(n--){
            scanf("%d",&temp);
            a[temp]++;
        }
        for(int i=0;i<10;i++){
            if(a[i]==0)printf("-\n");
            else{
                for(int j=0;j<a[i];j++)printf("*");
                printf("\n");
            }
        }
    }
}

Measured memory_bytes: 2484
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>

using namespace std;

#define INT_MAX (2*1e9)

const int mod = 998244353;
typedef long long ll;
const int maxn = 10 + 200000;

ll fac[maxn];

ll qpow(ll a, ll b)
{
    ll ans = 1;
    while(b){
        if(b & 1)
            ans = ans*a%mod;
        a = a*a%mod;
        b /=2;
    }
    return ans;
}

ll inv(ll a)
{
    return qpow(a, mod-2) % mod;
}

void solve()
{
    fac[0] = 1;
    for(int i=1; i<=maxn-1; i++)
        fac[i] = (fac[i-1]*i)%mod;
}

ll comb(int n, int k)
{
    if(k>n) return 0;
    return (fac[n]*inv(fac[k])%mod*inv(fac[n-k])%mod)%mod;
}

int n, m, k;

int main()
{
    solve();
    scanf("%d%d%d", &n, &m, &k);
    ll ans = 0;
    for(int i=0; i<=k; i++)
        ans = (ans+((m*comb(n-1,n-i-1)%mod)*qpow(m-1, n-1-i))%mod)%mod;
    printf("%lld\n", ans);
}


Measured memory_bytes: 3248
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	string s;
	cin>>s;
	int n=s.length(),cnt[2]={};
	FOR(i,0,n){
		cnt[s[i]-'0']++;
	}
	cout<<min(cnt[0],cnt[1])*2<<endl;
    return 0;
}


Measured memory_bytes: 512
/****************************************************************
*	Author: huhao
*	Email: 826538400@qq.com
*	Create time: 2020-03-09 16:15:41
****************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=(r<<3)+(r<<1)+(c^48);
		c=getchar();
	}
	return r*t;
}
#define i64 long long
const int N=100010,L=20,mod=1000000007,i2=(mod+1)/2;
i64 power(i64 a,i64 b,i64 p)
{
	i64 r=1;
	for(;b;b>>=1,a=a*a%p) if(b&1) r=r*a%p;
	return r;
}
int n,h[N],m[N][L+2],b[N];
int Min(int a,int b){ return h[a]<h[b]?a:b; }
int cmin(int l,int r)
{
	int B=b[r-l+1];
	return Min(m[l][B],m[r-(1<<B)+1][B]);
}
#define info std::pair<i64,i64>
info operator+(info a,i64 b){ a.first-=a.second; a.second=a.second*power(2,b,mod)%mod; return info((a.first+a.second+mod)%mod,a.second); }
info operator+(info a,info b){ return info(a.first*b.first%mod,a.second*b.second%mod*i2%mod); }
info calc(int l,int r,int H)
{
	if(l>r) return info(1,2);
	if(l==r) return info(2,2)+(h[l]-H-1);
	int m=cmin(l,r);
	return (calc(l,m-1,h[m]-1)+info(2,2)+calc(m+1,r,h[m]-1))+(h[m]-H-1);
}
int main()
{
	n=read();
	fr(i,1,n) h[i]=read();
	fr(i,2,n) b[i]=b[i>>1]+1;
	fr(i,1,n) m[i][0]=i;
	fr(j,1,L) fr(i,1,n-(1<<j)+1) m[i][j]=Min(m[i][j-1],m[i+(1<<(j-1))][j-1]);
	printf("%d\n",int(calc(1,n,0).first));
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<sstream>
#include<iomanip>
#include<bitset>
#include<map>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
using namespace std;
int main(){
  int n,m,a,b,x,y;
  char s,t;
  cin>>s;
  s+=1;
  if(s>122)s-=26;
  ou(s);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while (a > 0 && c > 0) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            break;
        }

    }

    return 0;

}

Measured memory_bytes: 3636
#include <cstdint>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

int main() {
	int n;
	cin >> n;
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		int pi;
		cin >> pi;
		if (pi != i + 1) {
			cnt += 1;
		}
	}
	if (cnt <= 2) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
A,B,C,D=input()
i=0
if A==B and C==D and A!=C:
    i=1
if A==C and B==D and B!=C:
    i=1
if A==D and B==C and A!=C:
    i=1
if i==0:
    print("No")
if i==1:
    print("Yes")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
//#define LOCAL
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define ft first
#define sd second
#define sz size()
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
//cout << fixed << setprecision(12) <<x<<endl;

bool cmp(pair<int,pair<string,int>> &a,pair<int,pair<string,int>> &b){
    if(a.sd.ft!=b.sd.ft) return a.sd.ft<b.sd.ft;
    return a.sd.sd>b.sd.sd;
}
int main(){
fastIO;
#ifdef LOCAL
     freopen("in.txt", "r", stdin);
#endif

int n;
vector<pair<int,pair<string,int>>> v;
cin>>n;
//cout<<n<<endl;
forn(i,1,n+1){
    string nom;
    cin>>nom;
    int p;
    cin>>p;
    v.pb({i,{nom,p}});
}
sort(v.begin(),v.end(),cmp);
for(auto &x:v){
    cout<<x.ft<<endl;
}
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

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

vll a;
void f(ll n) {
    a.resize(n+1);
    for(int i = 0; i <= n; i++) a[i] = 2;
    a[1] = 1;
    for(int i = 2; i <= n; i++) {
        for(int j = 2*i; j <= n; j += i) {
            a[j]++;
        } 
    }
}

int main()
{   
    ll n;
    cin >> n;
    f(n);
    ll ans = 0;
    rep(i, n) {
        ans += (i+1) * a[i+1];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 81312
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb push_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=1e17;
const ll ms=(1e5)+5;


ll ar[ms];


int main()
{
    idfc;

    int n;
    cin>>n;

    ll a,b;
    cin>>a>>b;


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


    ll ans=0;

    for(i=2;i<=n;i++)
    {
        ans+=min(b,a*(ar[i]-ar[i-1]));
    }

    cout<<ans;


    return 0;
}

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


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()


using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;


void err(istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}


const double EPS = 1e-8;
const long long mod = 1e9 + 7;

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

const int N = 1e5 + 5;
const long long INF = 1e18;




int n , k;

int arr[200];
int main()
{

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; ++i){
            cin >> arr[i];
            arr[i + n] = arr[i];
    }
    int ans = 0;
    for(int i = 1; i <= min(n,k); ++i){ // no of elements i will take from dequeue
        for(int j = n - min(n,k) + (min(n,k)-i); j <= n; j++){
               // error(j);
        vector<int> vec;
                for(int l = j; l < j + i; ++l){
                    vec.push_back(arr[l]);
                }
                sort(all(vec));
                reverse(all(vec));
                int remK = k - i;
                while(remK > 0 and !vec.empty()){
                    if(vec.back() < 0)vec.pop_back();
                    else break;
                    remK--;
                }
                int s = 0;
                for(auto l : vec)s += l;
//        if(i == 3)
//                error(i,j,s,vec.size(),k);
                ans = max(ans,s);
        }
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int>d(N);
    for (int i=0;i<N;i++){
    cin>>d[i];
    }
    int sum=0;
    for(int i=0;i<N;i++){
     for(int j=i+1;j<N;j++){
         sum+=d[i]*d[j];
     }
    }
   cout<<sum<<endl;
}

Measured memory_bytes: 256
// in the name of god

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define size(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
typedef pair<int , int>pii;
const int inf = 1e9 + 10;

int main(){
	ios_base :: sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	int n , a , b;
	cin >> n >> a >> b;
	int t = abs(a-b);
	if(t%2 == 0) return cout << "Alice\n" , 0;
	cout << "Borys\n";
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int modP = 1000000007;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int t = in.nextInt();
        int[] T = new int[n];
        for(int i = 0; i < n; i++) T[i] = in.nextInt();

        int ans = 0;
        for(int i = 0; i < n-1; i++) {
            int d = T[i+1] - T[i];
            if(d < t) {
                ans += d;
            }else{
                ans += t;
            }
        }
        ans += t;
        print(ans);
    }

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

    static void print(int i) {
        System.out.println(i);
    }
}


Measured memory_bytes: 64840
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
typedef tuple<double, int, int> T;

double INF = 1e+9;
int n, m, p, a, b;
int t[8];
vector<int> et[30];
vector<int> ec[30];
double dp[30][1 << 8];

int main() {
	while (cin >> n >> m >> p >> a >> b) {
		if (!n) break;
		
		a--; b--;
		
		int i, j;
		
		rep(i, m) {
			et[i].clear();
			ec[i].clear();
		}
		
		rep(i, n) cin >> t[i];
		rep(i, p) {
			int x, y, z;
			cin >> x >> y >> z;
			x--; y--;
			et[x].push_back(y);
			ec[x].push_back(z);
			et[y].push_back(x);
			ec[y].push_back(z);
		}
		
		priority_queue<T, vector<T>, greater<T>> que;
		rep(i, m) rep(j, (1 << n)) dp[i][j] = INF;
		dp[a][0] = 0;
		que.push(T(0, a, 0));
		
		while (!que.empty()) {
			T now = que.top(); que.pop();
			double cst = get<0>(now);
			int v = get<1>(now);
			int s = get<2>(now);
			
			rep(i, et[v].size()) {
				int nv = et[v][i];
				rep(j, n) {
					if ((s >> j) % 2 == 1) {
						continue;
					}
					
					double ncst = cst + (double)ec[v][i] / t[j];
					int ns = s + (1 << j);
					if (dp[nv][ns] > ncst) {
						dp[nv][ns] = ncst;
						que.push(T(ncst, nv, ns));
					}
				}
			}
		}
		
		double ans = INF;
		rep(i, (1 << n)) {
			ans = min(ans, dp[b][i]);
		}
		if (ans >= INF) cout << "Impossible" << endl;
		else printf("%.14f\n", ans);
	}
	return 0;
}


Measured memory_bytes: 4532
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
using ll = long long;

long charCounter(string sentence, char character) {
    return count(sentence.cbegin(), sentence.cend(), character);
}

int main() {

    string S;
    cin >> S;

//    vector<bool > blocks(S.size());
//
//    for (int i = 0; i < S.size(): ++i) {
//
//    }

    lli zero = charCounter(S, '1');
    lli one = charCounter(S, '0');

    if (zero > one) {
        cout << one * 2<< endl;
    } else {
        cout << zero * 2<< endl;
    }

    return 0;
}


Measured memory_bytes: 512
"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
    lines.push(line)
});

reader.on('close', () => {
    lines.forEach(function (line) {
	if (line==="0 0") {
	    return;
	}
	var l = line.trim().split(' ').map(x=>parseInt(x));
	console.log(l.sort((a,b)=>a-b).map(x=>x.toString()).join(' '));
    })
});


Measured memory_bytes: 20780
n, a, b = map(int, input().split())
sums = 0
for i in range(n+1):
    if len(str(i)) != 1:
        nlist = [int(j) for j in str(i)]
        s = 0
        for num in nlist:
            s += num
    else:
        s = int(i)
    if a <= s <= b:
        sums += i
print(sums)


Measured memory_bytes: 41456
#ITP1_6_B


n= int(input())

T=[[0 for j in range(13)]for m in range(4)]
format(T)

for i in range(n):
    a,b = input().split()
    b=int(b)
    
    if a=='S':
      T[0][b-1] = 1
    elif a=='H':
      T[1][b-1] = 1
    elif a=='C':
      T[2][b-1] = 1
    else:
      T[3][b-1] = 1
for c in range(4):
  for d in range (13):
    if T[c][d] == 0:
      if c==0:
        K = "S"
      elif c==1:
        K = "H"
      elif c==2:
        K = "C"
      else:
        K = "D"
      print(K,d+1)
    else:
      pass



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

int main(){
  int n,max=0,ans=0;
  cin >> n;
  vi h(n);
  rep(i,0,n){
    cin >> h[i];
    if(max<=h[i]){
      max=h[i];
      ans++;
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof a)
#define MAX 100005
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    double d;
    int n,ans=0;
    cin>>n>>d;
    double x,y;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        if(x*x+y*y<=d*d)
            ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3804
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<set>
#include<map>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

const int N = 105;
const int M = 211;
const int W = 211;

int n,stx,sty,m;
int a[N],b[N],c[N],d[N];
int e[M];
char f[M];
bool input(){
	cin>>n>>stx>>sty>>m;
	rep(i,n)cin>>a[i]>>b[i]>>c[i]>>d[i];
	rep(i,m)cin>>e[i]>>f[i];
	return true;
}

typedef pair<int,int> pii;

void makeinput(){
	rep(i,n){
		a[i]*=2;
		b[i]*=2;
		c[i]*=2;
		d[i]*=2;
	}
	stx*=2;
	sty*=2;
	int sum = 0;
	rep(i,m){
		e[i]*=2;
		sum += e[i];
		e[i] = sum;
	}
}

int board[W][W];
void makeboard(){
	rep(i,W)rep(j,W)board[i][j]=1;
	rep(i,n){
		if(a[i]==c[i])reps(j,min(b[i],d[i]),max(b[i],d[i])+1)board[j][a[i]]=0;
		else reps(j,min(a[i],c[i]),max(a[i],c[i])+1)board[b[i]][j]=0;
	}
}

int dirnum(char c){
	if(c=='N')return 0;
	if(c=='E')return 1;
	if(c=='S')return 2;
	return 3;
}

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

int dp[2][W][W][4];

bool canmove(int x,int y,int dir,int next){
	if((dir+2)%4==next)return false;
	if(board[y][x]==1)return false;
	
	int nx = x+dx[next];
	int ny = y+dy[next];
	
	if(nx<0 || ny<0 || nx>=W || ny>=W || board[ny][nx]==1)return false;
	
	return true;
}

vector<pii> solve(){
	
	makeinput();
	makeboard();
	
	rep(k,2)rep(i,W)rep(j,W)rep(p,4)dp[k][i][j][p]=0;
	
	int dp1 = 0;
	int dp2 = 1;
	
	rep(i,4)dp[dp1][sty][stx][i]=1;
	
	rep(walk, e[m-1]+1){
		rep(i,W)rep(j,W)rep(k,4)dp[dp2][i][j][k]=0;
		
		int hitnum = -1;
		rep(p, m){
			if(e[p]==walk){
				hitnum = p;
			}
		}
		
		rep(i,W){
			rep(j,W){
				rep(k,4){
					if(dp[dp1][i][j][k]==0)continue;
					rep(p,4){
						bool hitok = true;
						if(hitnum!=-1){
							if(k!=dirnum(f[hitnum]) && p!=dirnum(f[hitnum]))hitok=false;
						}
						if(canmove(j,i,k,p) && hitok){
							int ny = i+dy[p];
							int nx = j+dx[p];
							dp[dp2][ny][nx][p] = 1;
						}
					}
				}
			}
		}
		swap(dp1,dp2);
	}
	
	vector<pii> ret;
	rep(i,W){
		rep(j,W){
			bool ok = false;
			if(dp[dp2][i][j][dirnum(f[m-1])]==1)ok=true;
			rep(k,4){
				if(dp[dp2][i][j][k]==1 && canmove(j,i,k,dirnum(f[m-1])) )ok=true;
			}
			if(ok)ret.push_back(pii(j/2, i/2));
		}
	}
	sort(ret.begin(),ret.end());
	return ret;
}

void call(){
	vector<pii> ans = solve();
	rep(i,ans.size())printf("%d %d\n",ans[i].first, ans[i].second);
}

int main(){
	input();
	call();
}

Measured memory_bytes: 2756
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    vector<int> a, b, c, tmp(n, 0);
    vector<vector<int>> dp(3, tmp);
    rep(i, n){
        int x, y, z;
        cin >> x >> y >> z;
        a.push_back(x);
        b.push_back(y);
        c.push_back(z);
    }

    dp[0][0] = a[0];
    dp[1][0] = b[0];
    dp[2][0] = c[0];
    rep2(i, 1, n){
        dp[0][i] = max(dp[1][i-1] + a[i], dp[2][i-1] + a[i]);
        dp[1][i] = max(dp[0][i - 1] + b[i], dp[2][i - 1] + b[i]);
        dp[2][i] = max(dp[1][i - 1] + c[i], dp[0][i - 1] + c[i]);
    }

    int ans=dp[0][n-1];
    ans = max(dp[0][n - 1], max(dp[1][n - 1], dp[2][n - 1]));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6160
n = gets.to_i
t = Math.sqrt(n)
array = Array.new(n,0)

(1..t).each do |x|
  (1..t).each do |y|
    (1..t).each do |z|
      k = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if k <= n
        array[k-1] += 1
      end
    end
  end
end

array.each do |a|
  puts a
end


Measured memory_bytes: 14316
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define dbg(n) cout<<#n<<' '<<n<<endl;
int power(ll x,ll y){ 
	ll res = 1;	
	while(y>0){ 
		if(y & 1) 
			res = (res*x)%mod; 
		y=y>>1;
		x=(x*x)%mod;
	} 
	return res; 
}

int main(){ 
	int t;
	cin>>t;
	int a[t+1];
	int n[200001];
	for(int i=1;i<=t;i++){
	cin>>a[i];
	n[a[i]]=i;
	}
	int count,ma=0;
	if(t==1)
	ma=1;
	for(int i=2;i<=t;i++)
{
	count=1;
	while(n[i]>n[i-1]&&i<=t){
		count++;
		i++;
		}
		if(count>ma)
		ma=count;
	}	
	cout<<t-ma<<endl;
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <map>
#include <deque>
#include <vector>
typedef unsigned int UINT;
using namespace std;

void oneisstrong(int & n) 
{
    if (n == 1)
        n = 14;
}

int main(void) {
    int A, B;
    cin >> A >> B;
    oneisstrong(A);
    oneisstrong(B);

    if (A == B)
        cout << "Draw" << endl;
    else if (A > B)
        cout << "Alice" << endl;
    else
        cout << "Bob" << endl;

    //Aliceが勝つならAliceを、Bobが勝つならBobを、引き分けならDrawを出力せよ。
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
        #pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize("unroll-loops")
         
        #include <algorithm>
        #include <bitset>
        #include <cassert>
        #include <chrono>
        #include <cmath>
        #include <complex>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <ctime>
        #include <deque>
        #include <functional>
        #include <iomanip>
        #include <iostream>
        #include <iterator>
        #include <limits>
        #include <climits>
        #include <list>
        #include <map>
        #include <numeric>
        #include <queue>
        #include <random>
        #include <ratio>
        #include <set>
        #include <sstream>
        #include <stack>
        #include <string>
        #include <unordered_map>
        #include <unordered_set>
        #include <utility>
        #include <vector>
        using namespace std;
         
        typedef long long ll;
        typedef long double LD;
        #define int ll
        #define double LD
        #define pb push_back
        #define mp make_pair
        #define REP(i,n) for (int i = 0; i < n; i++)
        #define loop(i,n) for (int i = 0; i < n; i++)
        #define FOR(i,a,b) for (int i = a; i < b; i++)
        #define REPD(i,n) for (int i = n-1; i >= 0; i--)
        #define FORD(i,a,b) for (int i = a; i >= b; i--)
        #define remax(a,b) a = max(a,b)
        #define remin(a,b) a = min(a,b)
        #define mem(a, b) memset(a, b, sizeof a)
        #define append push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define print(x) cout << (x) << endl
        #define PRECISION(x) cout << fixed << setprecision(x)
        #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
         
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        const double eps = 1e-9;
         
        mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
        
        signed main()
        {
        	int k;
        	cin>>k;
        	queue<int> q;
        	FOR(i,1,10)
        	{
        		q.push(i);
			}
			int p;
			for(int i=0;i<k;i++)
			{
				p=q.front();
				q.pop();
				if(p%10!=0)
				{
					q.push(p*10+p%10-1);
				}
				q.push(p*10+p%10);
				if(p%10!=9)
				{
					q.push(p*10+p%10+1);
				}
			}
			cout<<p;
		}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <algorithm>

using namespace std ;

int main(void){
    int K,X;

    cin >> K >> X;
    
    for(int i=X-K+1; i<X; i++){
        cout << i << " ";
    } 
    cout << X;
    for(int i=X+1; i<=X+K-1; i++){
        cout << " " << i;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>


int N;
int a[100];
int left[100], right[100], flag;
int main()
{
    scanf("%d", &N);

   while(N--){

        for(int j = 0; j < 10; j++) scanf("%d", &a[j]);

        for(int j = 0; j < 1<<10; j++)
        {
            int l = 0, r = 0;
            flag = 1;
            for(int k = 1, x = 0; k < 1<<10; k<<=1, x++)
            {
                if(j & k)  left[l++] = a[x];
                else   right[r++] = a[x];

                if((l >= 2 && left[l-1] <= left[l-2]) ||(r >= 2 && right[r-1] <= right[r-2]))
                {
                    flag = 0;
                    break;
                }
            }

            if(flag) break;

        }
        if(flag) printf("YES\n");
        else printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

vector<int> g[100005];
int d[100005], e[100005];

void dfs(int x, int p) {
    d[x] = d[p] + 1;
    for (int i : g[x]) if (i != p) dfs(i, x);
}

void dfs2(int x, int p) {
    e[x] = e[p] + 1;
    for (int i : g[x]) if (i != p && e[x] + 1 < d[i]) dfs2(i, x);
}

int main() {
    ios::sync_with_stdio(false);
    int n, u, v, x, y, z = 0;
    cin >> n >> u >> v;
    for (int i = 1; i < n; i++) cin >> x >> y, g[x].push_back(y), g[y].push_back(x);
    dfs(v, v);
    dfs2(u, u);
    for (int i = 1; i <= n; i++) if (e[i]) z = max(z, d[i] - 1);
    z--;
    cout << z;
}


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

int main() {
  int n, a, b, ans, i, sum;
  cin >> n >> a >> b;
  ans = 0;
  for(i = 1; i <= n; i++){
    sum = i/10000 + (i/1000)%10 + (i/100)%10 + (i/10)%10 + i%10;
    if((sum >= a) && (sum <= b)){
      ans += i;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
#a,b = map(int,input().split())
L = list(map(int,input().split()))
#L.sort()

c = min(L)
flag = False
if  c == 1:
    flag = True

li = []
for i in range(n):
    if L[i] == c and flag == True:
        li.append(c)
        c = L[i]+1

if flag:
    print(len(L)-len(li))
else:
    print(-1)

Measured memory_bytes: 26268
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++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()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    ll N; cin>>N;
    vector<vector<int>> G(N, vector<int>(N, 0));
    REP(i, N){
        int a; cin>>a;
        REP(j, a){
            int x, y; cin>>x>>y;
            x--;
            if(y){
                G[i][x] = 1;
            } else {
                G[i][x] = -1;
            }
        }
    }
    ll res = 0;
    vector<int> honest(N);
    ll cnt = 0;
    for(int mask=0; mask<(1<<N); mask++){
        cnt = 0;
        bool ok = true;
        REP(i, N) {
            if(mask & (1<<i)){
                honest[i] = 1;
                cnt++;
            }
            else honest[i] = 0;
        }
        for(int j=0; j<N; j++){
            if(!honest[j]) continue;
            for(int k=0; k<N; k++){
                if(G[j][k]==1 and !honest[k]){
                    ok = false;
                    break;
                }
                else if(G[j][k]==-1 and honest[k]){
                    ok = false;
                    break;
                }
            }
            if(!ok) break;
        }
        if(ok) res = max(res, cnt);
    }
    cout << res << endl;
    return 0;
}

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

int main(){
//    int a, b , c, d, e, k;
//    cin >> a >> b >> c >> d >> e >> k;
    int a[5];
    for(int i=0;i<5;i++){
        cin >> a[i];
    }
    int k;
    cin >> k;

    bool check = true;
    for(int i=0;i<5;i++){
        for(int j=0;j<5;j++){
            if(abs(a[i] - a[j]) > k){
                check = false;
            }
//                cout << abs(a[i] - a[j]) << endl;
        }
    }
    if(check==true){cout << "Yay!" << endl;}
    else{cout << ":(" << endl;}
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int a,b;scanf("%d%d",&a,&b);
	if(a>0) printf("Positive\n");
	else if(a<=0&&b>=0) printf("Zero\n");
	else if(a<0&&b<0) if(b-a+1&1) printf("Negative\n");else printf("Positive\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <utility>
#include <map>
int main(){
	int N,M,X;
	std::cin >> N;
    std::vector<int> a(N),b;
    for(int i=0;i<N;i++){
        std::cin >> a[i];
    }
    std::copy(a.begin(),a.end(),back_inserter(b));
    std::sort(a.begin(),a.end());
    double k=(a[N/2-1]+a[N/2])/2;
    for(int i=0;i<N;i++){
        if(k>=b[i]){
            std::cout << a[N/2] <<std::endl;
        }else{
            std::cout << a[N/2-1] <<std::endl;
        }
        
    
    }
        
    return 0;
}

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

typedef unsigned long long ull;

#define REP(i, N) for (int i = 0; i < N; i++)
#define ANS(a) cout << a << endl;
#define SORT(V) sort(V.begin(), V.end())
#define RSORT(V) sort(V.rbegin(), V.rend())

#define DBG(V) for (auto v : V) cout << v << " "; cout << endl

int
main()
{
  int X, A; cin >> X >> A;

  if (X < A) { ANS(0); } else { ANS(10); }
  
  return 0;
}



Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main() {
    int n, x;
    cin >> n >> x;
    int l[n], d[n+1];
    d[0] = 0;
    int cnt = 1;
    for (int i=0; i<n; i++) {
        cin >> l[i];
        d[i+1] = d[i] + l[i];
        if (d[i+1] <= x) {
            cnt++;
        } else {
            break;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    K,N = map(int,input().split())
    A = list(map(int,input().split()))
    distance_arr = []
    for i in range(N-1):
        distance_arr.append(A[i+1]-A[i])
    distance_arr.append(K - A[N-1] + A[0])
    print(K - max(distance_arr))

Measured memory_bytes: 32372
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

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

const ll inf = (ll)2e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	ll res = -inf;
	ll vmin = inf;
	ll vmax = -inf;
	for (ll i = 0; i < n; i++)
	{
		ll x;
		cin >> x;

		res = max(res, x - vmin);

		vmin = min(vmin, x);		
	}

	println(res);
}



Measured memory_bytes: 3132
from collections import deque

def main():
    N, M = map(int, input().split(' '))
    edge = [[] for i in range(N+1)]
    for _ in range(M):
        a, b = map(int, input().split(' '))
        edge[a].append(b)
        edge[b].append(a)
    signpost = [None] * (N+1)
    signpost[0] = signpost[1] = 0
    q = deque([1])
    dist = [0 for i in range(N+1)]
    while q:
        node = q.popleft()
        for e in edge[node]:
            if signpost[e] is None:
                dist[e] = dist[node] + 1
                signpost[e] = node
                q.append(e)
    if 0 in signpost[2:]:
        print('No')
    else:
        print('Yes')
        for i in signpost[2:]:
            print(i)        

if __name__ == "__main__":
    main()

Measured memory_bytes: 35432
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N;
  cin>>N;
  ll A[N],c=0;
  REP(i,N){
    cin>>A[i];
    c^=A[i];
  }
  
  if(c==0) COYe;
  else CONo;
  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flg = false;
		
		for (int i=0; i<25; i++){
			for (int j=0; j<14; j++){
				
				if ((i*4 + j*7)==n){
					flg = true;
					break;
				}
			}
		}
		if (flg){
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		
		
		
		
		
	}

}


Measured memory_bytes: 22228
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    func count() -> Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
}
extension Array where Element: Comparable {
    func max() -> Element! {
        return self.maxElement()
    }
    func min() -> Element! {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let N = readInt()!
var W = [readLine()!]
for i in 1..<N {
    let Wi = readLine()!
    if W.contains(Wi) || W[i-1].toArray().last! != Wi.toArray()[0] {
        print("No")
        break
    } else {
        W += [Wi]
    }
    if i == N-1 {
        print("Yes")
    }
}


Measured memory_bytes: 3960
import java.util.*;

public class Main{

    public static void main(String a[])
        throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        while(true){
            int n = scan.nextInt();
            if(n==0)break;
            int sum=0;
            for(int i=0;i<n/4;i++)sum+=scan.nextInt();
            System.out.println(sum);

        }
    }
}

Measured memory_bytes: 12000
#include <iostream>
using namespace std;
using ll = long long int;
 
int main(){
  ll x, y; cin >> x >> y;
  if(x % y == 0){cout << -1 << endl; return 0;}
  for(int i=1; i<100; i++){
    if(x*i % y != 0){cout << x*i << endl; return 0;}
  }
  return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M;
ll DP[int(1e5+5)];
bool flag[int(1e5+5)];

int main(){
  cin >> N >> M;
  for (int i = 0; i < M; i++){
    int A; cin >> A;
    flag[A] = true;
  }

  DP[0] = 1;
  for (int i = 0; i <= N; i++){
    if (flag[i]) continue;
    DP[i] %= MOD;
    DP[i+1] += DP[i];
    DP[i+2] += DP[i];
  }
  cout << DP[N] << endl;

  return 0;
}


Measured memory_bytes: 4468
import sys
sys.setrecursionlimit(10**9)
N = int(input())
A = [[] for i in range(N)]

def check(target):
    one_count = 0
    cans = 0
    for idx, flag in enumerate(target):
        if flag == "1":
            one_count += 1
            for x, y in A[idx]:
                if int(target[x]) != y:
                    return 0
    
    cans = max(cans, one_count)
    return cans

def dns(S):
    ans = 0
    if len(S) == N:
        ans = max(ans, check(S))
    else:
        ans = max(dns(S+"0"), dns(S+"1"))
    
    return ans

for i in range(N):
    m = int(input())
    for j in range(m):
        x, y = map(int, input().split())
        x -= 1
        A[i].append((x, y))

kotae = dns("")

print(kotae)

Measured memory_bytes: 49496
#include <iostream>

using namespace std;

int main()
{
    int n, a, b, ans = 0;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; ++i) {
        int t = i;
        int p = 0;
        while (t > 0) {
           p += t % 10;
           t /= 10;
        }
        if (p >= a && p <= b) ans += i;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
bool isprime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (ll i=5; i*i <=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
signed main()
{
    fast;
   
    ll n,i,j;
    cin>>n;
    for(i=n;;i++)
    {
        if(isprime(i))
        {
            cout<<i;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b; 
    cin >> a >> b;
    int ans = -1;
    for(int i = 1 ; i <= 1000 ; i++){
        if(int(i * 0.08) == a && int(i * 0.1) == b){
            ans = i;
            break;
        }
    }
    cout << ans;
    
}


Measured memory_bytes: 3584
program main
  integer(16) :: a, b, n
  read(*,*) n, a, b

  if( mod(abs(b-a),2) == 0) then
    write(*,*) abs(b-a)/2
  else
    write(*,*) min(a+b-1, (n-a)+(n-b)+1)/2
  end if

end program main

Measured memory_bytes: 256