akhauriyash/Code-Regression huggingface dataset:
// RAKSHIT KADAM
 
//  -- Declare array globally...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
// find_by_order returns iterator to  element present at that index...
// order_of_key returns no. of elements having value stricktly less than that given in the order_of_key();
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 100000000000000005
    #define inf 1000000003
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 200006
    #define pi 3.1415926535897932384626433832795
#define ld long doubles
 #define ll long long
 #define int long long
 
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 200003;
 ll h,w,k;
char a[34][34];
bool ok(ll ma,ll mb)
{
    char b[7][7];
    for(ll i=0;i<h;i++)for(ll j=0;j<w;j++)b[i][j] =a[i][j];
    for(ll i=0;i<7;i++)
    {
        if(ma&(1<<i))
        {
            for(ll j=0;j<w;j++)
                b[i][j]='!';
        }
    }
    for(ll i=0;i<7;i++)
    {
        if(mb&(1<<i))
        {
            for(ll j=0;j<h;j++)
                b[j][i]='!';
        }
    }
    ll cnt = 0;
    for(ll i=0;i<h;i++)for(ll j=0;j<w;j++)if(b[i][j]=='#')cnt++;
    return cnt==k;
}
void solve()
{
   
    cin>>h>>w>>k;ll ans=0;
    for(ll i=0;i<h;i++)for(ll j=0;j<w;j++)cin>>a[i][j];
    for(ll i=0;i<(1<<h);i++)
    {
        for(ll j=0;j<(1<<w);j++)
        {
            ans+=ok(i,j);
        }
    }
    cout<<ans<<endl;
}
signed main()
{
   Need_for_speed(activated);
 
//satisfy
//    {
//  solve();
//   }
//
    solve();
    return 0;
}


Measured memory_bytes: 3668
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>
#include<numeric>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok, flag;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111



int main(void) {
  cin >> n >> m;
  cout << (n - 1)*(m - 1) << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define ll long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e6+10,mod=998244353,mod2=1e9+9,inf=1e9+30;
pii dp[M];
int a[M];
void ne(pii &x,pii y)
{
	if(a[x.F]<a[y.F])x.S=x.F,x.F=y.F;
	else if(a[x.S]<a[y.F] && y.F!=x.F)x.S=y.F;
	if(a[x.S]<a[y.S] && y.S!=x.F)x.S=y.S;
}
int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	int hlp=(1<<n)-1;
	for(int i=0;i<=hlp;i++)
	{
		cin>>a[i];
		dp[i].F=i;
		dp[i].S=0;
		for(int j=0;j<20;j++)
		{
			if((i & (1<<j)))ne(dp[i],dp[(i xor (1<<j))]);
		}
		//cout<<i<<" "<<dp[i]<<endl;
	}
	int ans=0;
	for(int k=1;k<=hlp;k++){
		ans=max(ans,a[dp[k].F]+a[dp[k].S]);
		cout<<ans<<endl;
	}
}

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

int main() {
    int N; cin >> N;
    vector<pair<ll,ll>> work(N);
    rep(i,N) cin >> work.at(i).second >> work.at(i).first;
    sort(work.begin(),work.end());
    ll time = 0;
    rep(i,N) {
        time += work.at(i).second;
        if(time > work.at(i).first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

public class Main {
	
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		int n = in.readInt();
		int a = in.readInt();
		System.out.println((n*n)-a);
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

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

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

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

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 22868
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
 int a[3];
  
 cin >> a[0] >> a[1] >> a[2];
 
 sort(a, a + 3);
 cout << a[0] << " " << a[1] << " " << a[2] <<endl;
}

Measured memory_bytes: 3104
Q,H,S,D = map(int,input().split())
N = int(input())
D = min(D,2*S,4*H,8*Q)
S = min(S,2*H,4*Q)
H = min(2*Q,H)
ans = 0
ans += (N // 2)*D if int(N)%2 == 0 else (N // 2)*D + S
N = N - int(N)
N *= 100
ans += (N // 50)*H if N%50 == 0 else (N // 50)*H  + Q
print(ans)

Measured memory_bytes: 3064
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>

#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	string s1,s2;
	cin>>s1>>s2;
	ll x;
	umap<string,ll> m;
	cin>>x;
	m[s1]=x;
	cin>>x;
	m[s2]=x;
	string s;
	cin>>s;
	m[s]--;
	cout<<m[s1]<<' '<<m[s2];
	exit(0);
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
using lint = long long;

template<typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int main(){
    int n;
    cin >> n;
    vector<lint> t(n);
    for(int i = 0; i < n; i++) cin >> t[i];
    lint ans = t[0];
    for(int i = 1; i < n; i++){
        ans /= gcd(ans, t[i]);
        ans *= t[i];
    }
    cout << ans << endl;
}   

Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	n = n % 10;
	if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
		printf("hon");
	}
	else {
		if (n == 0 || n == 1 || n == 6 || n == 8) {
			printf("pon");
		}
		else {
			printf("bon");
		}
	}
}

Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
ll optimalGame(vector<ll> &arr,int i,int j,vector<ll> &prefixSum,vector<vector<ll>> &dp){
	if(i == j){
		return arr[i];
	}
	if(dp[i][j]!=-1){
		return dp[i][j];
	}
	ll ans = max((arr[i]+(prefixSum[j]-prefixSum[i]-optimalGame(arr,i+1,j,prefixSum,dp))),(arr[j]+(prefixSum[j-1]-prefixSum[i-1]-optimalGame(arr,i,j-1,prefixSum,dp))));
	return dp[i][j] = ans;
}
int main(int argc,char const* argv[]){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin>>n;
	vector<ll> arr(n+1);
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	vector<ll> prefixSum(n+1,0);
	vector<vector<ll>> dp(n+2,vector<ll>(n+2,-1));
	prefixSum[1] = arr[1];
	for(int i=2;i<=n;i++){
		prefixSum[i] = prefixSum[i-1] + arr[i];
	}
	ll taro = optimalGame(arr,1,n,prefixSum,dp);
	ll jiro = prefixSum[n] - taro;
	cout<<taro-jiro<<endl;
	return 0;
}

Measured memory_bytes: 72960
def kaibun(s):
    for i in range(len(s)//2):
        if s[i] != s[len(s)-i-1]:
            return 0

    return 1

s = input()
left = s[:((len(s)-1)//2)]
right = s[((len(s)+3)//2-1):]

if kaibun(s) == 1 and kaibun(left) == 1 and kaibun(right) == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import java.io.*;
import java.util.*;
public class Main {
static int[][] memo;
static int I,J;
static String h,s;
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
	   h=sc.nextLine();
	   s=sc.nextLine();
	   I=h.length();
	   J=s.length();
	   memo=new int[3003][3003];
	   for(int []a:memo)
		   Arrays.fill(a,-1);
	   solve(0,0);
	   trace(0,0);
	}
	static int solve(int i, int j)
	{
		if(i >= I || j >= J)
		{
			return 0;
		}
		if(memo[i][j] != -1)	return memo[i][j];
		int opt1 = solve(i + 1, j);
		int opt2 = solve(i, j + 1);
		int opt3 = s.charAt(j) == h.charAt(i) ? solve(i + 1, j + 1) + 1 : 0;
		return memo[i][j] = Math.max(opt1, Math.max(opt2, opt3));
	}
	static void trace(int i, int j)
	{
		if(i >= I || j >= J)	return;
		
		int opt1 = solve(i + 1, j);
		int opt2 = solve(i, j + 1);
		int opt3 = s.charAt(j)==h.charAt(i) ? solve(i + 1, j + 1) + 1 : 0;
		if(opt3 > opt2 && opt3 > opt2)
		{
			System.out.print(s.charAt(j));
			trace(i + 1, j + 1);
			return; 
		}
		else if(opt2 > opt1)
			trace(i, j + 1);
		else
			trace(i + 1, j);
	 
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
 
		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 81888
#include <iostream>

using namespace std;

typedef long long int tint;

int main() {
	tint val[4],n; cin >>val[0]>>val[1]>>val[2]>>val[3]>>n; n *= 4;
	
	tint smallest = 0;
	for (int i = 1;i < 4;i++) if ((val[smallest] * (1 << i)) >= (val[i] * (1 << smallest))) {
		//~ cout << 0.25 * (1 << i) << " a " << val[i] << " es mejor que " << 0.25 * (1 << smallest) << " a " << val[smallest] << endl;
		smallest = i;
	}
	
	tint boughtBase = n / (1 << smallest);
	tint yenSpentBase = boughtBase * val[smallest];
	tint left = n - boughtBase * (1 << smallest);
	
	tint best = 1e9;
	//~ cout << yenSpentBase << ' ' << left << ' ' << best << endl;
	
	int bought[4];
	for(bought[0] = 0;bought[0] <= 8;bought[0]++)
	for(bought[1] = 0;bought[1] <= 4;bought[1]++)
	for(bought[2] = 0;bought[2] <= 2;bought[2]++)
	for(bought[3] = 0;bought[3] <= 1;bought[3]++) {
		tint accumulated = 0;
		tint price = 0;
		for(int j = 0;j<4;j++) {
			accumulated += (1 << j) * bought[j]; //0.25 *
			price += val[j] * bought[j];
		}
		if (accumulated == left) {
			best = min(best, price);
		}
	}
	
	cout << yenSpentBase + best << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
int a[1001][1001];
int main(){
    int i,j,n,x1,x2,y1,y2,x1_min=1000,y1_min=1000,x2_max=0,y2_max=0,count=0;
    scanf("%d",&n);
    while(n--){
        scanf("%d%d%d%d",&x1, &y1, &x2, &y2);
        a[x1][y1]++,a[x1][y2]--;a[x2][y1]--,a[x2][y2]++;
        x1_min=min(x1,x1_min),x2_max=max(x2,x2_max),y1_min=min(y1,y1_min),y2_max=max(y2,y2_max);
    }
    for(i=x1_min;i<=x2_max;i++)for(j=y1_min;j<=y2_max;j++){
        if(i)a[i][j]+=a[i-1][j];
        if(j)a[i][j]+=a[i][j-1];
        if(i&&j)a[i][j]-=a[i-1][j-1];
        count=max(count,a[i][j]);
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 5760
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))

ans = 0
for i in range(1, n):
    if a[i]+a[i-1] > x:
        eat = min(a[i]+a[i-1]-x, a[i])
        ans += eat
        a[i] -= eat
    if a[i]+a[i-1] > x:
        eat = min(a[i]+a[i-1]-x, a[i-1])
        ans += eat
        a[i-1] -= eat

print(ans)



Measured memory_bytes: 14068
using System;

namespace AOJ.Volume5
{
    public class ShuffleTheCards
    {
        public static int Main()
        {
            int n = int.Parse(Console.ReadLine());
            int m = int.Parse(Console.ReadLine());

            // ?????????
            var cards = new int[n * 2];
            for(int i = 0; i < n * 2; i++) { cards[i] = i + 1; }

            // ?????£???????????????
            for(int i = 0; i < m; i++)
            {
                int k = int.Parse(Console.ReadLine());
                if (k == 0)
                {
                    // ??????????????£?????????
                    var tmp = new int[n * 2];
                    cards.CopyTo(tmp, 0);
                    int pos = 0;
                    for(int j = 0; j < n; j++)
                    {
                        cards[pos] = tmp[j];
                        cards[pos + 1] = tmp[j + n];
                        pos += 2;
                    }
                }
                else
                {
                    // ?????????
                    var tmp = new int[n * 2];
                    cards.CopyTo(tmp, 0);
                    for(int j = 0; j < n * 2; j++)
                    {
                        if (j < k) { cards[j + (2 * n) - k] = tmp[j]; }
                        else { cards[j - k] = tmp[j]; }
                    }
                }
            }

            for(int i = 0; i < n * 2; i++) { Console.WriteLine(cards[i]); }
            return 0;
        }
    }
}

Measured memory_bytes: 9256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

bool isUseful(int n){
    int sq = sqrt(n) + 1;
    int tmp = n; 
    for(int i = 2; i <= sq; i++){
        sq = sqrt(tmp) + 1;
        while(tmp%i == 0)tmp/=i;
    }
    if(tmp == n && n%5 == 1)return  true;
    return false;
}
int main(){
    int n;
    cin >> n;

    int no = 0;
    for(int i = 2; i <= 55555; ++i){
        if(isUseful(i)){
            cout << i << " ";
            no++;
        }
        if(no >= n)break;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long h,x,ok,k;
multiset<long long>s;
deque<long long>d;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
scanf("%lld",&h);
x=1;
while(x<=h){
	ok=ok+x;
	x=x*2;
}
printf("%lld",ok);
return 0;
}


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

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }


int main() {
    ll n;
    cin >> n;
    ll all = 0;
    vl a(n);
    rep(i, n) {
        cin >> a[i];
        all ^= a[i];
    }

    rep(i, n) {
        cout << (all ^ a[i]) << " ";
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 4744
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1);
using namespace std;

int n, t;
pair<int, int> arr[200001];
int main() {
    IOS
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i].second >> arr[i].first;
    }
    sort(arr, arr+n);
    for (int i = 0; i < n; ++i) {
        if (arr[i].second + t > arr[i].first) {
            cout << "No" << endl;
            return 0;
        }
        t += arr[i].second;
    }
    cout << "Yes" << endl;
    
    return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//Library
/*Union-Find木
int par[1000010], rankh[1000010];
void init(int n) {
	for (int i = 0; i <= n; i++) {
		par[i] = i;
		rankh[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x)return x;
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rankh[x] < rankh[y])par[x] = y;
	else {
		par[y] = x;
		if (rankh[x] == rankh[y])rankh[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}
template<typename t>
t GCD(t a, t b) {
	while (max(a, b) % min(a, b)) {
		if (a > b)a %= b;
		else b %= a;
	}
	return min(a, b);
}
Union-Find木end*/
//Library end
int main() {
	string s;
	cin >> s;
	int size = s.size();
	int kiroku = 0;
	ll ans = 0;
	for (int i = 0; i < (1 << size); i++) {
		kiroku = 0;
		for (int j = 1; j <= size; j++) {
			if ((i >> j) & 1) {
				ans += (ll)stoll(s.substr(kiroku, j - kiroku));
				kiroku = j;
			}
		}
		if (kiroku != size)ans += (ll)stoll(s.substr(kiroku, size - kiroku));
	}
	cout << ans / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
total = 0
zan = 0
for i in range(N):
  dif = B[i] + zan - A[i]
  total += min( B[i] + zan, A[i] )
  zan = min( max(0,dif), B[i])
total += min(zan, A[N] )
print(total)


Measured memory_bytes: 18396
n = int(input())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7
MOD2INV = 5 * 10 ** 8 + 4
total = 0
delta = 0

for i in range(n):
  total = (total + a[i]) % MOD
  delta = ((a[i]%MOD) * (a[i]%MOD) + delta)%MOD

result = ((((total * total) - delta + MOD) % MOD) * MOD2INV)%MOD
print(result)


Measured memory_bytes: 105240
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n,k=map(int,input().split())
    A=[0]*n
    for i in range(k):
        _=int(input())
        a=[int(_) for _ in input().split()]
        for aa in a:
            A[aa-1]+=1
    ac=Counter(A)
    print(ac[0])

if __name__=='__main__':
    main()

Measured memory_bytes: 9500
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  string s;
  cin >> s;
  int n = s.size();

 
  int ans = 0;
  char t = s[0];
  int cnt = 0;
  rep(i,n) {
    if (s[i] == t) cnt++;
    else {
      ans++; t = s[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    lint N, A, B;
    cin >> N >> A >> B;
    cout << min(N * A, B) << "\n";
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
#define N 100
#define INF 1e9

queue<int> Q;
int n,M[N][N];
int dist[N];

void bsf(int l){
	Q.push(l);
	for(int i = 0;i < n;i++) dist[i] = INF;

	dist[l]=0;
	while(!Q.empty()){
		int u = Q.front();
		Q.pop();
		for(int i=0;i<n;i++){
			if(M[u][i] == 0)continue;
			if(dist[i] != INF)continue;
			dist[i] = dist[u] + 1;
			Q.push(i);
		}
	}

	for(int i=0;i<n;i++){ 
		if(dist[i] == INF)dist[i] = -1;

		cout<<i+1<<" "<<dist[i]<<endl;
	}
}


int main(){
	int u,k,v;

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

	for(int i = 0;i < n;i++){
		cin >> u >> k;
		u--;
		for(int j = 0;j < k;j++){
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}
	bsf(0);
	return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

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

ll mod = 1e9 + 7;

ll comb[5001][5001];


int main(){
	ll a,b;
	cin >> a >> b;
	if((b-a)%2!=0){
		cout << "IMPOSSIBLE" << endl;
	}else{
		cout << (a+b)/2 << endl;
	}

	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, idx=0;
    while(cin>>n, n!=0){
        idx++;
        cout<<"Case "<<idx<<": "<<n<<endl;
    }
    return 0;
}



Measured memory_bytes: 3032
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f

using namespace std;

int N, M;

vector<vector<int>> graph;
int dp[100005];

int dfs(int u) {
    if(dp[u] != -1) return dp[u];
    int ans = 0;
    for(int v : graph[u]) {
        ans = max(ans, dfs(v) + 1);
    }
    dp[u] = ans;
    return ans;
}


int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> N >> M;
    graph.resize(N + 1);
    int u, v;
    for(int i = 0; i < M; ++i) {
        cin >> u >> v;
        graph[u].push_back(v);
    }
    int mx = 0;
    for(int u = 1; u <= N; ++u) {
        mx = max(mx, dfs(u));
    }
    cout << mx << endl;
    return 0;

}



Measured memory_bytes: 8192
# include "iostream"
# include "cstring"
# include "cstdio"

using namespace std;

const int maxm=1e5+10;

char S[maxm];
int Len;

int main(){
	register int i,L=-1,R=-1;
	scanf("%s",S+1);
	Len=strlen(S+1);
	for(i=1;i<=Len;i++){
		if(S[i]==S[i+1]){
			L=i,R=i+1;
			break;
		}
		if(S[i-1]==S[i+1]){
			L=i-1,R=i+1;
			break;
		}
	}
	printf("%d %d",L,R);
	return 0;
}

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

int main() {
    int H, W;
    while(1) {
        
        cin >> H >> W;
        
        if(H == 0 && W == 0) {
            break;
        }
        
        for(int i = 0; i < H; i++) {
            for(int j = 0; j < W; j++) {
                if((i + j) % 2 == 0) {
                    cout << '#';
                }
                else {
                    cout << '.';
                }
            }
            cout << endl;
        }
        
        cout << endl;
    }
    
    
    return 0;
}


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

using namespace std;
int main(void){
    vector<int> a;
    int i,o,x,q;
    
    cin>>q;
    for(i=0;i<q;i++){
        cin>>o;
        if(o==0){
            cin>>x;
            a.push_back(x);
        }
        else if(o==1){
            cin>>x;
            cout<<a[x]<<endl;
        }
        else{
            a.pop_back();
        }
    }
    
    return 0;
}



Measured memory_bytes: 3944
def selectSort(a, n)
    for i in 0..n-1
        minj = i
        for j in i..n-1
            if a[j][1].to_i < a[minj][1].to_i
                minj = j
            end
        end
        next if i == minj 
        k = a[i]
        a[i] = a[minj]
        a[minj] = k
    end
    return a
end

def bubbleSort(a, n)
    flag = true
    while flag == true
        flag = false
        for j in (-n+1)..-1
            if a[-j][1].to_i < a[-j-1][1].to_i then
                k = a[-j]
                a[-j] = a [-j-1]
                a [-j-1] = k
                flag = true
            end
        end
    end
    return a
end

n = gets.to_i
a = gets.split
k = a.dup
bubbleSort_ary = bubbleSort(k,n)
puts bubbleSort_ary.join(" ")
puts "Stable"
k = a.dup
selectSort_ary = selectSort(k,n)
puts selectSort_ary.join(" ")
puts (bubbleSort_ary == selectSort_ary ? "Stable": "Not stable")


Measured memory_bytes: 6876
import math
def func(n):
    if n == 2:
        return 2
    else:
        return (n-1)*func(n-1)
n = int(input())
town = [list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        ans += ((town[i][0]-town[j][0])**2 + (town[i][1]-town[j][1])**2)**(1/2)
print(ans*func(n)/math.factorial(n))

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int a, b;
	cin >>a >>b;
	
	
	const int mx=100;
	vector<string> ba(mx, string(mx, '.'));
	rep(i, mx) ba[i][0] ='#';
	rep(i, mx) if(i%2==0) rep(j, mx-1) ba[i][j] ='#';
	
	int ca=1;
	for(int i=1;i<mx;i+=2) for(int j=2;j<mx-2;j+=2){
		if(ca < a){ ba[i][j] ='#'; ca++;}
		if(ca >=a) break;
	}
	
	int cb=1;
	for(int i=mx-2;i>mx/2;i-=2) for(int j=mx-3;j>1;j-=2){
		if(cb < b){ ba[i][j] ='.'; cb++;}
		if(cb >=b) break;
	}
	cout << "100 100\n";
	for(auto x :ba) cout<<x <<"\n";
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // ABC156C - Rally

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] x = new int[n];

        int[] ttl = new int[100];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            for (int j = 0; j < 100; j++) {
                ttl[j] += Math.pow(x[i] - j + 1, 2);
            }
        }

        int min =Integer.MAX_VALUE;
        for (int k = 0; k < 100; k++) {
            if (min > ttl[k]) min = ttl[k];
        }

        System.out.println(min);
    }
}

Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N;
    cin >> N;
    string W[N];
    rep(i, N) cin >> W[i];
    bool is_co = true;
    set<string> st;
    string pre = W[0];
    st.insert(W[0]);
    for(int i = 1; i < N; i++){
        if(st.count(W[i]) == 0 && *(pre.end()-1) == *(W[i].begin())){
            st.insert(W[i]);
        }else{
            is_co = false;
            break;
        }
        pre = W[i];
    }
    if(is_co){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
K = int(input())
S = input()

mod = 10 ** 9 + 7

N = len(S) + K

power = [1]
fac = [1]
inv = [1]
for i in range(1, N + 10) :
  power.append(power[-1] * 25 % mod)
  fac.append(fac[-1] * i % mod)
  
inv = [pow(fac[-1], mod - 2, mod)]
for i in range(N + 10 - 1, 0, -1) :
  inv.append(inv[-1] * i % mod)
inv = inv[::-1]

def comb(n, r) :
  if r == 0 :
    return 1
  return fac[n] * inv[n - r] * inv[r] % mod
  
ret = pow(26, N, mod)
for i in range(len(S)) :
  ret -= power[N - i] * comb(N, i) % mod
  ret %= mod
  
print(ret)

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

int main() {
    int n, ans = 0, sum;
    cin >> n;
    vector<int> up(n), bo(n);
    for (int i = 0; i < n; i++) cin >> up.at(i);
    for (int i = 0; i < n; i++) cin >> bo.at(i);
    for (int i = 0; i < n; i++) {
        sum = 0;
        for (int j = 0; j <= i; j++) sum += up.at(j);
        for (int j = i; j < n; j++) sum += bo.at(j);
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL unsigned long long

const LL mod = 998244353;

int main() {
    int n;
    string s;
    while(cin >> n >> s) {
        if(n&1) cout << "No" << endl;
        else {
            bool flag = false;
            for(int i = 0 , j = n/2; i < n/2 ; i++ , j++) {
                if(s[i] != s[j]) {
                    flag = true;
                    break;
                }
            }
            if(flag) cout << "No" << endl;
            else cout << "Yes" << endl;
        }
    }
    return 0;
}


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

int main()
{
  int n,m,l;

  cin >> n >> m >> l;

  int a[100][100];
  int b[100][100];

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

  long long c[100][100] = {};
  
  for(int i = 0;i < n;i++)
    {
      for(int j = 0;j < m;j++)
	{
	  for(int k = 0;k < l;k++)
	    {
	       c[i][k] += a[i][j]*b[j][k];
	    }
	}
    } 

  for(int i = 0;i < n;i++)
	{
	  for(int k = 0;k < l;k++)
	    {
	      if(k) cout << " ";
	      
	      cout << c[i][k];
	    }
	  cout << endl;
	}
}


Measured memory_bytes: 3216
using static System.Console;
using System.Linq;
using System.Diagnostics;
using System;
using System.Collections.Generic;

public static class Program
{
    public static void Main()
    {
        var stopwatch = new Stopwatch();
        var maxD = int.Parse(ReadLine());
        var cArray = ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var sTable = new List<List<int>>();
        var lastList = Enumerable.Repeat(0, 26).ToList();
        var sequenceList = Enumerable.Repeat(0, maxD).ToList();
        int happiness = 0;
        for (int i = 0; i < maxD; ++i)
        {
            sTable.Add(ReadLine().Split(' ').Select(x => int.Parse(x)).ToList());
        }

        stopwatch.Restart();
        Random random = new Random();
        for(int d = 0; d < maxD; ++d)
        {
            var currentContest = random.Next(26);
            lastList[currentContest] = d + 1;
            sequenceList[d] = currentContest;
            happiness += sTable[d][currentContest];
            happiness -= Enumerable.Range(0, 26).Select(i => cArray[i] * ((d + 1) - lastList[i])).Sum();
        }
        while(stopwatch.ElapsedMilliseconds < 1800)
        {
            var ranD = random.Next(maxD);
            var old = sequenceList[ranD];
            sequenceList[ranD] = random.Next(26);
            var newHappiness = calcHappiness();
            if (happiness > newHappiness) sequenceList[ranD] = old;
            else happiness = newHappiness;
        }
        for(int i = 0; i < maxD; ++i)
        {
            WriteLine(sequenceList[i] + 1);
        }


        int calcHappiness()
        {
            var res = 0;
            var lastList1 = Enumerable.Repeat(0, 26).ToList();
            for (int d = 0; d < maxD; ++d)
            {
                lastList1[sequenceList[d]] = d + 1;
                res += sTable[d][sequenceList[d]];
                res -= Enumerable.Range(0, 26).Select(i => cArray[i] * ((d + 1) - lastList1[i])).Sum();
            }
            return res;
        }
    }
}

Measured memory_bytes: 41424
H, W = map(int, raw_input().split())
for i in range(H):
    S_list = raw_input().split()
    if 'snuke' in S_list:
        i0 = i
        j0 = S_list.index('snuke')
print 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[j0]+str(i0+1)

Measured memory_bytes: 2568
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!

    var ans = 0
    for (i in 0..999) {
        var index = 0
        val num = ("00$i").takeLast(3)
        for (c in s) {
            if (c == num[index]) {
                index++
                if (index == 3) {
                    ans++
                    break
                }
            }
        }
    }
    println(ans)
}

Measured memory_bytes: 34844
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N, K, Q;
	cin >> N >> K >> Q;
	vector<int> point(N, K - Q);
	for (int i = 0; i < Q; i++)
	{
		int a;
		cin >> a;
		point[a - 1]++;
	}

	for (int i = 0; i < N; i++)
	{
		if (point[i] > 0) {
			cout << "Yes" << endl;
		}
		else
			cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
 
int main(){
	int i,answer=0,number1=0,number2=0,mod[12],day[12]={28,31,29,31,30,31,30,31,31,30,31,30};
	for(i=0;i<12;i++){
		mod[i]=day[i]%7;
	}
	char Date1[]="Wednesday";
	char Date2[]="Thursday";
	char Date3[]="Friday";
	char Date4[]="Saturday";
	char Date5[]="Sunday";
	char Date6[]="Monday";
	char Date7[]="Tuesday";
	while(1){
			scanf("%d %d",&number1,&number2);
		if(number1==0&&number2==0)break;
			for(i=0;i<number1;i++){
					answer=answer+mod[i];
			}
		answer+=number2;
		answer%=7;
		switch(answer){
			case 0:
			printf("%s\n",Date1);
			break;
			case 1:
			printf("%s\n",Date2);
			break;
			case 2:
			printf("%s\n",Date3);
			break;
			case 3:
			printf("%s\n",Date4);
			break;
			case 4:
			printf("%s\n",Date5);
			break;
			case 5:
			printf("%s\n",Date6);
			break;
			case 6:
			printf("%s\n",Date7);
			break;
		}
		answer=0;
	}
		return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
#define ll long long
#define N 100005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
main()
{
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll s=0;
    s+=min(a,k);
    k-=min(a,k);
    s+=0LL*min(b,k);
    k-=min(b,k);
    s+=-1*min(c,k);
    k-=min(c,k);
    cout<<s;

}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

constexpr inline ll mod = 1'000'000'007;
ll n,k;

ll modpow(ll n, ll k) {
    if (k == 0) { return 1; }
    if (k % 2 == 0) {
        ll res = modpow(n, k/2);
        return res * res % mod;
    } else {
        return modpow(n, k-1) * n % mod;
    }
}
ll modinv(ll n) {
    return modpow(n, mod - 2);
}

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    cin>>n>>k;
    ll res1 = (n - k + 2) * (n + k + 1) / 2 % mod * n % mod;
    ll res2 = ((n + 2) * (n + 1) % mod * n % mod - k * (k - 1) % mod * (k - 2) % mod + mod) * modinv(3) % mod;
    ll res3 = n - k + 2;
    cout << (res1 - res2 + res3 + mod) % mod << '\n';

    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
struct Node{
  int depth;
  int p;//parent
  int l,r; 
} ;
struct Node *tree;
int main(){
  
  int i,j,n,d,id,c,a,x,y;
  
  scanf("%d",&n);
  tree = malloc(sizeof(struct Node)*n);
  
  for(i=0;i<n;i++){
    tree[i].p = tree[i].l = tree[i].r = -1;
  }
    for(i=0;i<n;i++){
    scanf("%d%d",&id,&d);
   
    for(j=0;j<d;j++){
      //printf("d = %d\n",d);
      scanf("%d",&c);
      if(j==0){
	//printf("fuck1\n");
	tree[id].l = c;
	tree[c].p = id;
	a = c;
      }else{
	tree[a].r = c;
	tree[c].p = id;
	//printf("fuck2 %d\n",tree[c].p);
	a = c;
      }
    }
  }
  
  for(i=0;i<n;i++){
    x=0;
    y=i;
    while(tree[y].p>-1){
      y = tree[y].p;
      x++;
      //printf("p = %d\n",tree[y].p);//
    }
    tree[i].depth = x; 
  }

  
  
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,tree[i].p,tree[i].depth);
    if(tree[i].p == -1)printf("root, ");
    else if(tree[i].l == -1)printf("leaf, ");
    else printf("internal node, ");
    printf("[");
    if(tree[i].l != -1){
      printf("%d",tree[i].l);
      a = tree[i].l;
      while(1){
	if(tree[a].r == -1)break;
	printf(", %d",tree[a].r);
	a = tree[a].r;
      }
    }
    printf("]\n"); 
  }
  

  free(tree);
  
  
  return 0;
  }



Measured memory_bytes: 3068
import itertools

N = int(input())
l = list(range(1,N+1))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
i=0
a=0
b=0
for p in itertools.permutations(l,N):
	i+=1
	if a==0:
		for j in range(N):
			if P[j]!=p[j]:break
		else:
			a=i
	if b==0:
		for j in range(N):
			if Q[j]!=p[j]:break
		else:
			b=i
print(abs(a-b))

Measured memory_bytes: 3188
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(N):
    m = i
    for j in range(i + 1, N):
        if A[j] < A[m]:
            m = j
    if m > i:
        A[i], A[m] = A[m], A[i]
        count += 1
print(' '.join(list(map(str, A))))
print(count)



Measured memory_bytes: 5600
#include <stdio.h>
int main(){
	int i,j,h,w,z,r,n;
	while(scanf("%d %d %d", &h, &w, &z), h){
		if(h>w&&h>z)h=z;
		if(w>h&&w>z)w=z;
		scanf("%d ", &n);
		while(n--){
			scanf("%d ", &r);
			printf(w*w+h*h < r*r*4 ? "OK\n":"NA\n");
		}
	}
    return 0;
}

Measured memory_bytes: 0
import itertools
import math
n = int(input())
x = []
y = []

def bikkuri(n):
    if n == 0:
        return 1
    return n*bikkuri(n-1)

for i in range(n):
    xi,yi = map(int, input().split())
    x.append(xi)
    y.append(yi)

d_ave = 0
for p in itertools.permutations(range(n)):
    d = 0
    nx = x[p[0]]
    ny = y[p[0]]
    for i in p:
        d += math.sqrt((nx-x[i])**2+(ny-y[i])**2)
        nx = x[i]
        ny = y[i]
    d_ave += d
print(d_ave / bikkuri(n))

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

typedef long long ll;

int gcd(int a, int b) {return a%b == 0 ? b : gcd(b,a%b);}

int main() {
    int A, B;
    cin >> A >> B;
    //最大公約数
    int g = gcd(A,B);
    cout << (ll)A*B/g << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int n, a[MAX];
 
int main()
{
		scanf("%d", &n);
		for(int i = 1; i <= n; i++){
			scanf("%d", &a[i]);
		}
		sort(a+1, a+n+1, greater<int>());
		for(int i = 1; i <= n; i++){
			if(i+1 <= a[i+1]) continue;
			int ans = 0;
			for(int j = i+1; a[j]==i; j++) ans ^= 1;
			ans |= (a[i]-i)&1;
			if(ans) puts("First");
			else puts("Second");
			break;
		}
	
	return 0;
}

Measured memory_bytes: 640