akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		List<String> moji = new ArrayList<String>();
		moji.add("a");
		moji.add("i");
		moji.add("u");
		moji.add("e");
		moji.add("o");
		String c=sc.next();
		if(moji.contains(c))System.out.println("vowel");
		else System.out.println("consonant");
		
		
		
	
	}
	
}

Measured memory_bytes: 10064
#include <iostream>

using namespace std;

int main()
{
	int r, g, b;
	cin >> r >> g >> b;
	int num = r * 100 + g * 10 + b;
	if (num % 4 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
num_input=list(map(int,input().split()))

h=num_input[0]
w=num_input[1]

while h!=0 or w!=0:
    for i in range(h):
        for j in range(w-1):
            if i==0 or i==h-1 or j==0:
                print("#",end="")
            else:
                print(".",end="")
        print("#")

    print()
    num_input=list(map(int,input().split()))

    h=num_input[0]
    w=num_input[1]



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

int A,B,add,sub,mul,ans;

int main (){
    cin>>A>>B;
    ans=A+B;
    sub=A-B;
    mul=A*B;
    if(ans<sub)ans=sub;
    if(ans<mul)ans=mul;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

int dp[30005][11][11][11];

class DLuckyPIN {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }


    void solve(std::istream& cin, std::ostream& cout) {
        int n;
        cin >> n;
        string s;
        cin >> s;

        CLR(dp, 0);

        dp[0][10][10][10] = 1;
        REP(i, n) {
            int x = s[i] - '0';
            REP(h, 11) {
                REP(j, 11) {
                    REP(k, 11) {
                        dp[i + 1][h][j][k] = dp[i][h][j][k];
                        if (dp[i][h][j][k] > 0) {
                            dp[i+1][x][10][10]++;
                            dp[i+1][h][x][10]++;
                            dp[i+1][h][j][x]++;
                        }
                    }
                }
            }
        }


        //REP(h, n + 1) REP(i, 11) REP(j, 11) REP(k, 11) {
        //    if (dp[h][i][j][k] == 0) continue;
        //                DUMP(h);
        //                DUMP(i);
        //                DUMP(j);
        //                DUMP(k);
        //    DUMP(dp[h][i][j][k])
        //}

        int res = 0;
        REP(i, 10) REP(j, 10) REP(k, 10) {
                    if (dp[n][i][j][k] > 0) {
                        res++;
                    }
                }
                cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DLuckyPIN solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 312320
#include <stdio.h>
#include <string.h>

int main(void){
    char po[10000];
    scanf("%s",po);
    int s=strlen(po);
    int x[2];
    scanf("%d %d",&x[0],&x[1]);
    int flag=0;
    int buri[2][10000]={};
    buri[0][0]=1;
    buri[1][0]=1;
    int firstflag=1;
    int sum[2]={};
    int count=0;
    for(int i=0;i<s;i++){
        if(po[i]=='F'&&firstflag==1){
            x[flag]--;
        }
        else if(po[i]=='T'){
            for(int i=9999;i>=0;i--){if(buri[flag][i]==1)buri[flag][i+count]=1;}
            sum[flag]+=count;
            flag^=1;
            count=0;
            firstflag=0;
        }
        else if(i==s-1){
            count++;
            for(int i=9999;i>=0;i--){if(buri[flag][i]==1)buri[flag][i+count]=1;}
            sum[flag]+=count;
        }
        else count++;
    }
    int ans[2]={1,1};
    for(int i=0;i<2;i++){
        if(sum[i]+x[i]<0)ans[i]=0;
        else if((sum[i]+x[i])%2==1)ans[i]=0;
        else if(buri[i][(sum[i]+x[i])/2]==0)ans[i]=0;
    }
    if(ans[0]==1&&ans[1]==1)printf("Yes");
    else printf("No");
    return 0;
}


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

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        int N;
        cin >>N;
        vector<string> S(N);
        Rep0(i, N)
                cin >>S.at(i);
        Sort(S);
        int SS=1;
        for (int i=1; i<N; i++)
                if (S.at(i-1)!=S.at(i))
                        SS++;
        cout <<SS <<endl;
        return 0;
}


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

class Main{
    public static void main(String args[])throws IOException{
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
            String[] input = br.readLine().split(" ");
            int N = Integer.parseInt(input[0]);
            int M = Integer.parseInt(input[1]);

            int result = 0;

            if(N > 1){
              result += (N*(N-1))/2;
            }

            if(M > 1){
              result += (M*(M-1))/2;
            }

            System.out.println(result);
        }
   
    }
}

Measured memory_bytes: 21076
s=str(input())
s=s.replace('A', '1').replace('T', '1').replace("C", "1").replace("G", "1")
l=len(s)
d=0
for i in range(l):
  for k in range(i, l+1):
    if s[i:k].count("1")==len(s[i:k]):
      d=max(d, len(s[i:k]))
print(d)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    int n,a;
    cin >> n >> a;
    if(n%500 <= a)cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <unordered_map>
#include <list>
using namespace std;
const long long int mod1=1000000007;
const long long int mod2 = 998244353;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define ll long long int
#define ull unsigned long long int
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define FOR(i, a, b) for (int i = (a), _##i = (b); i <= _##i; ++i)
#define FORD(i, a, b) for (int i = (a), _##i = (b); i >= _##i; --i)
#define REP(i, a) for (int i = 0, _##i = (a); i < _##i; ++i)
#define REPD(i,n) for(int i = (n)-1; i >= 0; --i)
#define pll pair<ll, ll>
#define ln endl
ll gcd(ll a, ll b){
    ll c;
     while(b){
        c = b;
        b = a % b;
        a = c;
     }
     return a;
}
ll lcm(ll a, ll b){
    return (a * b) / gcd(a, b);
 }
ll power1(ll a, ll b){
     ll out = 1;
     while(b){
        if(b & 1){
            out *= a;
        }
        b >>= 1;
        a *= a;
     }
     return out;
}
ll power2(ll a, ll b, ll m){
     a %= m;
     ll out = 1;
     while(b){
        if(b & 1){
            out *= a;
            out %= m;
        }
        b >>= 1;
        a = (a * a) % m;
     }
     return out;
}
ll modi(ll x, ll p){
    return power2(x, mod1 - 2, mod1);
}
int main(){
    fast;
    ll tt = 1;
    //cin >> tt;
    while(tt--){
        string s;
        cin >> s;
        for(auto x : s){
            if(x != '?'){
                cout << x;
            }
            else{
                cout << "D";
            }
        }
        cout << endl;
    }   
}

Measured memory_bytes: 3748
#include <iostream>
#include <algorithm>
using namespace std;
int n,a[200],b[200],len;
bool com(int a,int b)
{
	return a>b;
}
main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[a[i]]++;
	}
	sort(a+1,a+n+1,com);
	len=a[1]+1;
	if (len%2==0)
	{
		bool flag=true;
		for (int i=len-1;i>=len/2;i--)
		 if (b[i]<2) 
		 {
		 	flag=false;
		 	break;
		 }
		if (b[len/2]!=2) flag=false;
		if (flag) cout<<"Possible"<<endl;
		else cout<<"Impossible"<<endl;
	}
	else if (len%2==1)
	{
		bool flag=true;
		for (int i=len-1;i>=len/2+1;i--)
		 if (b[i]<2) 
		 {
		 	flag=false;
		 	break;
		 }
		if (b[len/2]!=1) flag=false;
		if (flag) cout<<"Possible"<<endl;
		else cout<<"Impossible"<<endl;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

vector<int> adj[2000];

int main() {
	fastio;
	int N, x, y;
	cin >> N >> x >> y; --x, --y;

	for (int i = 1; i < N; ++i) {
		adj[i - 1].push_back(i);
		adj[i].push_back(i - 1);
	}
	adj[x].push_back(y);
	adj[y].push_back(x);

	int ans[2000]{};
	for (int i = 0; i < N; ++i) {
		queue<int> Q;
		Q.push(i);

		bool vis[2000]{};
		vis[i] = 1;

		int d = 1;
		while (!Q.empty()) {
			int szQ = sz(Q);
			while (szQ--) {
				int now = Q.front(); Q.pop();
				for (int nxt : adj[now]) {
					if (vis[nxt]) continue;
					vis[nxt] = 1;
					Q.push(nxt);
					ans[d]++;
				}
			}
			++d;
		}
	}

	for (int i = 1; i < N; ++i) cout << ans[i] / 2 << endl;

	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		WriteLine(F / 3);
	}
}


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

int main()
{
    int n;
    cin>>n;
    vector<int> height(n);
    for(int i=0;i<n;i++)
    cin>>height[i];
    
    vector<int> ans(n);
    ans[0]=0;
    ans[1]=abs(height[1]-height[0]);
    for(int i=2;i<n;i++)
    {
        ans[i]=min(ans[i-1]+abs(height[i]-height[i-1]) , ans[i-2]+abs(height[i]-height[i-2]));
    }
    cout<<ans[n-1];
}

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

#define int long long
const int mod = 1e9+7;

class FermatCombination{
private:
	vector<int> fac, inv;
	
	int Pow(int x, int n){
		int ans = 1;
		while(n > 0){
			if(n & 1)ans = (ans*x)%mod;
			x = (x*x)%mod;
			n >>= 1;
		}
		return ans;
	}
	void Factrial(int n){
		fac[0] = inv[0] = 1;
		for(int i = 1;i <= n;i++){
			fac[i] = (fac[i-1]*i)%mod;
			inv[i] = Pow(fac[i], mod-2);
		}
	}
	
public:
	void init(int n){	//nCk
		fac.resize(n+1);
		inv.resize(n+1);
		Factrial(n);
	}
	int combine(int n, int k){
		int tmp = (fac[n]*inv[k])%mod;
		return (tmp*inv[n-k])%mod;
	}
};

FermatCombination C;
int a[100002], b[100002];
int comb(int x, int y){
	if(x < y)return 0;
	if(y == 0)return 1;
	return C.combine(x, y);
}

signed main(){
	int n, t, l = -1, r = 0;
	scanf("%lld", &n);
	for(int i = 0;i < n+1;i++){
		scanf("%lld", &a[i]);
		b[a[i]]++;
		if(b[a[i]] == 2)t = a[i];
	}
	
	for(int i = 0;i < n+1;i++){
		if(l != -1 && a[i] == t)r = n-i;
		if(l == -1 && a[i] == t)l = i;
	}
	
	C.init(n+1);
	for(int i = 1;i <= n+1;i++){
		int ans = comb(n+1, i)-comb(l+r, i-1)+mod;
		printf("%lld\n", ans%mod);
	}
	return 0;
}


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

int main() {
    //
    long long n, m;
    long long kekka1 = 0;
    long long kekka2 = 0;
long long waru = 1000000007;

    cin >> n >> m;

    if (abs(n - m) > 1) {
        cout << 0;
        return 0;
    }else{
        kekka1 = n;
        for (int i = n-1; i > 0; i--) {
            kekka1 = (kekka1 * i) % waru;
        }

        kekka2 = m;
        for (int i = m-1; i > 0; i--) {
            kekka2 = (kekka2 * i) % waru;
        }

        kekka1 = kekka1 * kekka2 % waru;
    }

    if (abs(n - m) == 0) kekka1 = kekka1 *  2 % waru;

    cout << kekka1;
    //
}


Measured memory_bytes: 3568
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#define int long long
#define inf 0x3f3f3f3f
using namespace std;
const int maxn = 1e5 + 5;

struct node
{
    int x, y;
}a[maxn];

bool cmp(node b, node c)
{
    return b.x < c.x;
}

signed main()
{
    int n, k;
    scanf("%lld %lld", &n, &k);
    for(int i=0; i<n; i++)
        scanf("%lld %lld", &a[i].x, &a[i].y);
    sort(a, a+n, cmp);
    for(int i=0; i<n; i++)
    {
        if(k>a[i].y)
            k -= a[i].y;
        else
        {
            printf("%lld\n", a[i].x);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 1792
/* VERSION 5763 */
#include<iostream>
using namespace std;
#define MAX 100000

int partition(int* A, int p, int r) {
    int x = A[r];
    int i = p-1;
    for ( int j = p; j < r; j++ ) {
        if ( A[j] <= x ) {
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

int main() {
    int A[MAX];
    int n, q;
    cin >> n;
    for ( int i = 0; i < n; i++ ) cin >> A[i];
    q = partition(A, 0, n-1);
    for ( int i = 0; i< n; i++ ) {
        if ( i ) cout << " ";
        if ( i == q ) cout << "[" << A[i] << "]";
        else cout << A[i];
    }
    cout << endl;
    return 0;
    
}


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;

#define pb push_back
#define F  first
#define S  second
#define int ll
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define edl "\n"
#define ceils(s,n) (s+n-1)/n
#define str string
#define add insert
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int MOD = 1e9 + 7, N = 5e5 + 10;
const ll LINF = LLONG_MAX;
int a,b,c,d,e,n,sum;
str s1,s2,s;
int32_t main() {
    fast();
    char ch;
    cin >> ch;
    ch++;
    cout<<ch;

    return 0;
}
 


Measured memory_bytes: 256
from itertools import product

num753 = ['7', '5', '3']
ans = 0
n = int(input())
for i in range(3, 10):
    for j in product(num753, repeat=i):
        if all(x in j for x in num753) and int(''.join(j)) <= n:
            ans += 1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define max 1000000
int main()
{
    int n;
    cin >> n;
    ll a[n + 5] = {0};
    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum = (sum ^ a[i]);
    }
    for (int i = 0; i < n; i++)
    {
        cout << (sum ^ a[i]) << " ";
    }
    return 0;
}


Measured memory_bytes: 5132
A=int(input())
B=int(input())
C=int(input())
X=int(input())
x=X//50
r=[]
for i in range(A+1):
    for k in range(B+1):
        for h in range(C+1):
            if i*500+k*100+h*50==X:
                r.append([i,k,h])
print(len(r))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, N) for (int i = 0; i < (N); i++)
#define REP(i, a, N) for (int i = a; i < (N); i++)
#define rrep(i, N, k) for (int i = (N); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - (int)1e8;
const ll INFLL = numeric_limits<ll>::max() - (ll)1e17;
#define BITSET bitset<3000>

int main() {
    int N, A;
    cin >> N >> A;
    vector<int> a(N + 1);
    for (int i = 1; i <= N; i++) cin >> a[i];
    vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>>(N + 1, vector<ll>(3000, 0)));
    dp[0][0][0] = 1;
    for (int i = 1; i <= N; i++) {
        int plus = a[i];
        for (int j = 0; j < i; j++) {
            for (int k = 0; k < 3000; k++) {
                dp[i][j][k] += dp[i - 1][j][k];
                if (k + plus < 3000) dp[i][j + 1][k + plus] += dp[i - 1][j][k];
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i * A < 3000 && i <= N; i++) ans += dp[N][i][i * A];
    cout << ans << endl;
}

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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

LL f(LL x, LL y, LL z)
{
	return y / z - (x - 1) / z;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n;
	cin >> n;
	VI a(n + 1), b(n);
	FOR(i, 0, n + 1) cin >> a[i];
	FOR(i, 0, n) cin >> b[i];
	LL ans = 0;
	
	RFOR(i, n, 0)
	{
		int tut = min(b[i], a[i + 1]);
		ans += tut;
		b[i] -= tut;
		tut = min(b[i], a[i]);
		ans += tut;
		b[i] -= tut;
		a[i] -= tut;
	}
	
	cout << ans << endl;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

const int MAX_N = 100100;
pair<int, int> AREA[MAX_N];
int N;

int main()
{
    scanf("%d", &N);
    
    for(int i = 0; i < N; ++i) {
        int X, L;
        scanf("%d %d", &X, &L);
        AREA[i].first = X + L;
        AREA[i].second = X - L;
    }
    sort(AREA, AREA + N);
    int res = 0, x = -1000001000;
    for(int i = 0; i < N; ++i) {
        if(x <= AREA[i].second){
            ++res;
            x = AREA[i].first;
        }
    }
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
        using namespace std;
        int main()
        {
          int n , count1=0 ,t;
          cin>>n;
          while(n){
                t=n;
            int count =0;
            while(t){
                t=t/10;
                count++;
            }
            if(count%2!=0){
                count1++;
            }
            n--;
         }
        cout<<count1<<endl;
         
         
         return 0;
        }

Measured memory_bytes: 256
import numpy as np

def countMatchedSwitch(sw_status, switch, index):
    ret = 0
    for s in switch[index]:
        if int(sw_status[int(s) - 1]) == 1:
            ret += 1
    return ret % 2


if __name__ == '__main__':
    N, M = [int(i) for i in input().split()]
    s = []
    for i in range(int(M)):
        data = input().split()
        s.append(data[1:])
    p = [int(i) for i in input().split()]

    ret = 0
    for i in range(2**N):
        is_all_passed = True
        sw_status = bin(i)[2:].zfill(N)
        for j in range(M):
            if p[j] != countMatchedSwitch(sw_status, s, j):
                is_all_passed = False
        if is_all_passed:
            ret += 1
    print("{ret}".format(ret=ret))

Measured memory_bytes: 12504
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;

int main()
{
  lint n, m;
  cin >> n >> m;
  vector<plint> war(m);
  REP(i,m) cin >> war[i].first >> war[i].second;


  lint cnt = 0;

  sort(war.begin(),war.end(),[](const plint &alpha,const plint &beta){return alpha.second < beta.second;});

  lint x = -1;
  REP(i,m){
    if(x < war[i].first-1){
      x = war[i].second-2;
      cnt++;
    }
  }

  cout << cnt << "\n";
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main (){
    string s;
    cin >> s;

    for(int i=s.size()-1;3<i;){
        
        if(i-4>=0 && s.substr(i-4,5)== "dream"){
            s.erase(i-4,5);
            i -= 5;
        }
        else if(i-4>=0 && s.substr(i-4,5)== "erase"){
            s.erase(i-4,5);
            i -= 5;
        }//等価演算子→論理演算子なので注意
        else if(i-6>=0 && s.substr(i-6,7)=="dreamer"){
            s.erase(i-6,7);
            i -= 7;
        }
        else if(i-5>=0 && s.substr(i-5,6)=="eraser"){
            s.erase(i-5,6);
            i -= 6;
        }//eraserのところっぽい？
        else{
            break;
        }
    }
    
    if(s == ""){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AOJ
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long gcd(long x, long y) => y == 0 ? x : gcd(y, x % y);
        static long lcm(long x, long y) => x * y / gcd(x, y);
        static void Main(string[] args)
        {
            var n = Sarray()[0];
            var a = Sarray();
            var p = a[0];
            for(var i=1;i<n;++i)
                p=lcm(p, a[i]);
            WriteLine(p);
        }
    }
}


Measured memory_bytes: 18468
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int H, W;
  cin >> H >> W;
  
  cout << string(W + 2, '#') << endl;
  
  for (int i = 0; i < H; i++) {
    string h;
    cin >> h;
    cout << '#' << h << '#' << endl;
  }
  
  cout << string(W + 2, '#') << endl;
}
  

Measured memory_bytes: 256
#include<stdio.h>
#define MAX_LEN 10000

int main()
{
    int array[MAX_LEN];
    
    int len=0;
    while(true)
    {
        int num;
        scanf("%d",&num);
        if(num==0)break;
        len++;
        array[len-1]=num;
    }
    
    for(int i=0;i<len;i++)
    {
        printf("Case %d: %d\n",i+1,array[i]);
    }
    return 0;
}


Measured memory_bytes: 2604
N=int(input())
a=list(map(int,input().split()))
b=[0]*N
b[N//2]=a[0]
for i in range(1,N//2+1):
  b[N//2-i]=a[i*2-1]
  if i != N//2 or N%2==1:
    b[N//2+i]=a[i*2]
if N%2==1:
  b=b[::-1]
print(" ".join(map(str,b)))
  

Measured memory_bytes: 29764
use std::io;

fn read_line()-> String {
    let mut s = String::new();
    let _ = io::stdin().read_line(&mut s).unwrap();
    s
}

fn main () {
	let s = read_line().split_whitespace().map(|e|e.parse().unwrap())
	.collect::<Vec<i32>>();

	if s[0] % 3 == 0 || s[1] % 3 == 0 || (s[0] + s[1]) % 3 == 0 {
		println!("Possible");
	}else{
		println!("Impossible");
	}
}


Measured memory_bytes: 4476
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>

using namespace std;

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define DEBUG 0
#define LIM 1000000007
#define UP 1
#define DOWN 2

int main(){
	string str;
	cin>>str;
	string t[4]={"maerd","remaerd","esare","resare"};
	lli ansFlag=0;

	lli now=0;
	reverse(str.begin(),str.end());

	while(now<str.size()){
		lli flag=-1;
		REP(i,4){
			if(now+t[i].size()>str.size())continue;
			if(str.substr(now,t[i].size()) == t[i]){
				flag=i;
				break;
			}
		}
		if(flag!=-1){
			ansFlag=1;
			now+=t[flag].size();
		}
		else{
			ansFlag=0;
			break;
		}
	}
	if(ansFlag==0){
		cout<<"NO"<<endl;
	}
	else{
		cout<<"YES"<<endl;
	}

	return 0;
}

Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e3 + 10;
const ll MAXM = 2e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n, A[MAXN][MAXN], inDeg[MAXM], dp[MAXM];
vector<ll> adj[MAXM];
vector<ll> ts;

ll ind(ll x, ll y) {
    return min(x, y) * MAXN + max(x, y);
}

ll topoSort() {
    queue<ll> Q;
    for (ll i = 0; i < ind(n, n); i++) {
        if (inDeg[i] == 0) {
            Q.push(i);
        }
    }

    while (!Q.empty()) {
        ll v = Q.front();
        ts.push_back(v);
        Q.pop();
        for (ll u : adj[v]) {
            inDeg[u]--;
            dp[u] = max(dp[u], dp[v] + 1);
            if (inDeg[u] == 0) Q.push(u);
        }
    }
    return ts.size() == ind(n, n);
}

int main() {
    fast_io;

    cin >> n;
    for (ll i = 1; i <= n; i++) {
        ll last = 0;
        for (ll j = 2; j <= n; j++) {
            cin >> A[i][j];
            adj[last].push_back(ind(i, A[i][j]));
            inDeg[ind(i, A[i][j])]++;
            last = ind(i, A[i][j]);
        }
    }

    if (!topoSort()) return cout << -1 << endl, 0;
    cout << *max_element(dp, dp + MAXM) << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 99184
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  string s;
  cin >> s;
  if (s == "ABC") {
    cout << "ARC" << "\n";
  }
  else {
    cout << "ABC" << "\n";
  }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
using R = double;

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

    int n; cin >> n;
    R res = 0.0;

    rep(_, n){
        R x; string u; cin >> x >> u;
        if(u == "BTC"){
            x *= 380000;
        }
        res += x;
    }

    cout.precision(10);
    cout << fixed << res << endl;

    return 0;
}


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

int main(){
	int n, m, max_x, min_y, x, y;

	std::cin >> n >> m >> max_x >> min_y;

	for (int i = 0; i < n; i++){
		std::cin >> x;
		max_x = std::max(max_x, x);
	}

	for (int i = 0; i < m; i++){
		std::cin >> y;
		min_y = std::min(min_y, y);
	}

	//std::cout << max_x << " " << min_y << std::endl;

	if (max_x >= min_y){
		std::cout << "War" << std::endl;
	}
	else{
		std::cout << "No War" << std::endl;
	}

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> money;
    money.push_back(1);
    int num = 6;
    while(n >= num){
        money.push_back(num);
        num *= 6;
    }
    num = 9;
    while(n >= num){
        money.push_back(num);
        num *= 9;
    }
    int m = money.size();
    int sheet[n+1];
    rep(i,n+1)sheet[i] = INT_MAX;
    sheet[0] = 0;
    typedef pair<int,int> P;
    queue<P> que;
    que.push(P(0,0));
    while(que.size() != 0){
        P now = que.front();
        int nowmoney = now.first;
        int count = now.second+1;
        que.pop();
        rep(i,m){
            int nextmoney = nowmoney + money[i];
            if(nextmoney == n){
                cout << count << endl;
                return 0;
            }
            else if(nextmoney < n &&sheet[nextmoney] > count){
                sheet[nextmoney] = count;
                que.push(P(nextmoney,count));
            }
        }
    }
}


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

typedef string::const_iterator State;
typedef vector<string> vs;

vs v;


vs mergevec(vs veca,vs vecb){
	vs ret;
	for(auto &a:veca){
		for(auto &b:vecb){
			int count[4]={};
			rep(i,a.size()) count[a[i]-'a']++;
			rep(i,b.size()) count[b[i]-'a']++;
			string andelm="",orelm="",xorelm="";
			rep(i,4){
				if(count[i]==2)andelm+='a'+i;
				if(count[i]!=0) orelm+='a'+i;
				if(count[i]==1)xorelm+='a'+i;
			}
			ret.pb(andelm);
			ret.pb( orelm);
			ret.pb(xorelm);
		}
	}
	return ret;
}


vs leaf(State &begin){
	vs ret;
	ret.pb(v[*begin-'0']);
	begin++;
	return ret;
}


vector<string> tree(State &begin){
	if(*begin=='('){
		begin++;
		
		vs tmp1 = tree(begin);
		begin++;	//read ' '

		vs tmp2 = tree(begin);
		begin++;	//read ')'
		
		return mergevec(tmp1,tmp2);
	}
	else return leaf(begin);
}

int main(){
	string s;
	while(getline(cin,s)){
		if(s=="END")break;
		int n;
		cin>>n;
		v.clear();
		v.resize(n+1);
		rep(i,n){
			string tmp="";
			rep(j,4){
				int x;
				cin>>x;
				if(x==1)tmp+='a'+j;
			}
			v[i+1]=tmp;
		}
//		rep(i,n+1) cout<<"x"<<v[i]<<"x"<<endl;
		
		State begin = s.begin();
		vector<string> vs = tree(begin);
		
		int ans=0;
		rep(i,vs.size())if(vs[i]=="abcd")ans++;
		cout<<ans<<endl;
		
		getline(cin,s);
	}
	
}

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

typedef long long ll;

const int Maxn = 200005;

int wh[Maxn];
int n;
set <int> S;
ll res;

int main()
{
    scanf("%d", &n);
    S.insert(0); S.insert(n + 1);
    for (int i = 1; i <= n; i++) {
        int a; scanf("%d", &a);
        wh[a] = i;
    }
    for (int i = 1; i <= n; i++) {
        int ind = wh[i];
        auto it2 = S.upper_bound(ind);
        auto it1 = it2; it1--;
        res += ll(ind - *it1) * ll(*it2 - ind) * i;
        S.insert(ind);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 10368
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int X, Y, Z;
	scanf("%d%d%d", &X, &Y, &Z);

	int i, j, k;
	int num = 0, length = 0;
	for (i = 0, length = Y + 2*Z, num = 1; ; ) {
		if (length + Y + Z > X)
			break;
		else {
			length += Y + Z;
			num += 1;
		}
	}

	printf("%d\n", num);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>

using namespace std;

int map[110][110];
int ans;
int w,h,n;

void serch(int xx,int yy,int gx,int gy,int color)
{
	map[yy][xx]=0;
	
	int nex[4]={1,0,-1,0};
	int ney[4]={0,1,0,-1};
	if(xx==gx && yy==gy)
	{
		ans=1;
		return ;
	}
	for(int i=0;i<4;i++)
	{
		if(map[yy+ney[i]][xx+nex[i]]==color)
		{
			serch(xx+nex[i],yy+ney[i],gx,gy,color);
			if(ans==1)
				return ;
		}
	}
	return ;
}

int main()
{
	int sx,sy,ex,ey;
	int i,j,k;
	int c,d,x,y;
	for(;;)
	{
		cin >> w >> h ;
		if(w==0 && h==0)
			break;
		
		ans=0;
		
		for(i=0;i<110;i++)
			for(j=0;j<110;j++)
				map[i][j]=0;
		
		cin >> sx >> sy >> ex >> ey >> n ;
		
		for(i=0;i<n;i++)
		{
			cin >> c >> d >> x >> y ;
			if(d==0)
			{
				for(j=0;j<2;j++)
					for(k=0;k<4;k++)
						map[y+j][x+k]=c;
			}
			else
			{
				for(j=0;j<4;j++)
					for(k=0;k<2;k++)
						map[y+j][x+k]=c;
			}
		}
		if(map[sy][sx]!=0)
			serch(sx,sy,ex,ey,map[sy][sx]);
		
		if(ans==1)
			cout << "OK" << endl;
		else
			cout << "NG" << endl;
	}
}

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

int main(){
  long long A,B,K;
  cin>>A>>B>>K;
  long long Ac = (A<K?0:A-K);
  long long Bc=B;
  if(A+B<K) Bc=0;
  else if(A<K) Bc=B-(K-A);
  cout<<Ac << " " << Bc << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-5;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
vector<ll> a;
int n;
bool check(ll s){
	map<ll,ll> mp;
	for(int i=0;i<n-1;i++){
		ll x=a[i+1];
		if(a[i]<x)continue;
		while(mp[x]+1LL>=s&&x>0)--x;
		if(x==0LL)return false;
		mp[x]++;
		auto itr=mp.end();--itr;
		while(itr->first>x){
			mp.erase(itr);
			--itr;
		}
	}
	return true;
}
int main(){
	cin>>n;
	a.resize(n);
	for(int i=0;i<n;i++)cin>>a[i];
    bool f=true;
    for(int i=1;i<n;i++){
        if(a[i-1]>=a[i])f=false;
    }
    if(f){
        cout<<1<<endl;
        return 0;
    }
	ll ng=1,ok=INF;
	while(ok-ng>1){
		ll mid=(ng+ok)/2;
		if(check(mid)){
			ok=mid;
		}else{
			ng=mid;
		}
	}
	cout<<ok<<endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll m,n,ts,a,b,f=0;
    string s;
    cin>>n>>s;
    if(s.size() <= n)
    {
        cout<<s<<endl;
    }
    else
    {
        for(int i = 0;i < n;i++)
        {
            cout<<s[i];
        }
        cout<<"...";

    }




}


Measured memory_bytes: 3628
#!/usr/bin/env python
# -*- coding: utf-8 -*

A = int(raw_input())
B = int(raw_input())
C = int(raw_input())
D = int(raw_input())

if A < B:
    p = A
else:
    p = B

if C < D:
    q = C
else:
    q = D

print str(p + q)


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


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

    vector< int >v(n);

    for (int i = 0; i < n; i++) cin >> v[i];

    sort(v.begin(), v.end());

    int ans = 1, lst = v[0];

    for (int i = 1; i < n; i++) {
        if (v[i]!=lst) {
            lst = v[i];
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define maxheap priority_queue<int>
#define minheap priority_queue<int, vector<int>, greater<int> >
#define ll long long
const int inf = 1e8;
const ll INF = 1e18;
const int MAXN = 3e5 + 200;
const  long double eps = 1e-9;
const long double pi = acos(-1.0);
using namespace std;

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

int n;
ll m;
ll a[MAXN];
void solve() {
    cin >> n >> m;
    int ind = 0;
    for (int i = 1; i <= n; i++){
        ll x;
        cin >> a[i];
        if (a[i] + a[i - 1] >= m){
            ind = i;
        }
    }
    if (ind == 0){
        cout << "Impossible";
        return;
    }
    cout << "Possible" << endl;
    for (int i = 1; i <= ind - 2; i++)
        cout << i << endl;
    for (int i = n - 1; i >= ind; i--) cout << i << endl;
    if (ind - 1 >= 1) cout << ind - 1 << endl;
}


int main(){
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(40);
    //freopen("inevit.in", "r", stdin);
    //freopen("inevit.out", "w", stdout);
    int step;
    step = 1;
    //cin >> step;
    for (int i = 1; i <= step; i++)
        solve();


}

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

using namespace std;

int main() {                 

	int n;
	cin >> n;

	vector<int> x(n);

	for (int i = 0; i < n; i++) cin >> x[i];

	int ans = 1e9;
	for (int p = -1000; p <= 1000; p++) {
		int calc = 0;

		for (int i = 0; i < n; i++) calc += (x[i] - p) * (x[i] - p);
		ans = min(ans, calc);

	}

	cout << ans << '\n';
	
}


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

int n, t, x, y;

int abs(int p) {return p > 0 ? p : -p;}

int main()
{
	int t1, t2, t3, t4;
	cin >> n;
	while (n--) {
		scanf("%d %d %d", &t1, &t2, &t3);
		t4 = t1 - t - abs(x - t2) - abs(y - t3);
		if (t4 < 0 || t4 % 2) {cout << "No"; return 0;}
		t = t1; x = t2; y = t3;
	}
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict


def check(num):
    if num in dic:
        print(len(f)+1)
        exit()
    else:
        f.append(num)
        dic[num] = 1


if __name__ == "__main__":
    s = int(input())

    dic = defaultdict(int)
    f = list()
    dic[s] = 1
    f.append(s)

    while True:
        if f[len(f)-1] % 2 == 0:
            tmp = f[len(f)-1] // 2
            check(tmp)
        else:
            tmp = f[len(f)-1] * 3 + 1
            check(tmp)


Measured memory_bytes: 3316
#include<stdio.h>
#include<string.h>
char a[60];
int num[60];
int s[60];
int main(){
	int n;
	scanf("%d",&n);
	memset(s,51,sizeof(s));
	while(n--){
		scanf("%s",a);
		memset(num,0,sizeof(num));
		int t = strlen(a);
		for(int i = 0;i<t;i++){
			if(a[i]=='a')num[1]++;
			else if(a[i]=='b')num[2]++;
			else if(a[i]=='c')num[3]++;
			else if(a[i]=='d')num[4]++;
			else if(a[i]=='e')num[5]++;
			else if(a[i]=='f')num[6]++;
			else if(a[i]=='g')num[7]++;
			else if(a[i]=='h')num[8]++;
			else if(a[i]=='i')num[9]++;
			else if(a[i]=='j')num[10]++;
			else if(a[i]=='k')num[11]++;
			else if(a[i]=='l')num[12]++;
			else if(a[i]=='m')num[13]++;
			else if(a[i]=='n')num[14]++;
			else if(a[i]=='o')num[15]++;
			else if(a[i]=='p')num[16]++;
			else if(a[i]=='q')num[17]++;
			else if(a[i]=='r')num[18]++;
			else if(a[i]=='s')num[19]++;
			else if(a[i]=='t')num[20]++;
			else if(a[i]=='u')num[21]++;
			else if(a[i]=='v')num[22]++;
			else if(a[i]=='w')num[23]++;
			else if(a[i]=='x')num[24]++;
			else if(a[i]=='y')num[25]++;
			else if(a[i]=='z')num[26]++;
		}
		for(int j = 1;j<=26;++j){
				if(s[j]>num[j])s[j]=num[j];
		}
	}
	for(int j = 1;j<=26;++j){
		for(int i = 0;i<s[j];++i){
			printf("%c",j-1+'a');
		}
	}
		//printf("%d ",s[j]);

}

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

int main(){
  int N,sum=0;
  cin >> N;
  vector<int> L(N);
  for(int i=0; i<N; i++){
    cin >> L.at(i);
    sum+=L.at(i);
  }
  sort(L.begin(), L.end());
  sum-=2*L.at(N-1);
  if(sum>0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    int A,B;
    cin >> A >> B;
    
    rep(i,1000000){
        double a = (double)i * 0.08;
        double b = (double)i * 0.1;
        if((int)a == A && (int)b == B){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    
    

    return 0;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 1e5 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b,ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a,ll b){ if(a==0){return b;}else{ return gcd(b%a,a);}}

string s;
void solve()
{
	cin>>s;
	int len=s.length();
	
	ll ans=0;
	for(int i=0;i<(1<<(len-1));i++)
	{
		vector<int> pos;
		for(int k=0;k<len;k++)
		{
			if((i>>k)&1)
			{
				pos.push_back(k+1);
			}
		}
		/*
		for(int i=0;i<pos.size();i++)
		{
			cout<<" "<<pos[i];
		}
		cout<<endl;
		*/
		int st,k;
		for(st=0,k=0;k<pos.size();k++)
		{
			ll p=0;
			for(int j=st;j<pos[k];j++)
			{
				p=p*10+s[j]-'0';
			}
			ans+=p;
			st=pos[k];
		}
		ll p=0;
		for(;st<len;st++)
		{
			p=p*10+s[st]-'0';
		}
		ans+=p;
		//out<<p<<endl;
	}
	printf("%lld",ans);
}

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

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

using namespace std;

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

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

	int x, y;
	cin >> x >> y;

	if(x % y == 0){
		cout << -1 << endl;
	}else{
		cout << x << endl;
	}
}


Measured memory_bytes: 256