akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define ld long double
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
int main()
{
    fio;
    ll a;
    long double b;
    cin>>a>>b;
    long double res=a*b;
    cout<<(ll)floor(res)<<endl;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using namespace std;

#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll mod = (1000000007LL);

inline ll poww(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if(b & 1) res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
    }
    return res;
}
inline pii operator+(pii A, pii B){
	return pii(A.f + B.f, A.s + B.s);
}
inline pii operator-(pii A, pii B){
	return pii(A.f - B.f, A.s - B.s);
}
inline ll mult(ll a, ll b){
	return (a * b) % mod;
}

ll gcd (ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

///CUIDADO COM MAXN
#define N 300050

int n, m, q, k, v[N], ans, sz[N];
pii w[N];
string s;
vector<int> grafo[N];
int fat[N], acum = 1; // produto de todos os sz[x]
void dfs(int x, int p){
    sz[x] = 1;
    int sum = 0, prod = 1;
    for(auto v: grafo[x]){
        if(v == p) continue;
        dfs(v, x);
        sz[x] += sz[v];
    }
    acum = (acum * sz[x]) % mod;
}
int fator[N];
void solve(int x, int p){
    if(x != 1){
        acum = (acum * poww(sz[x],mod-2)) % mod;
        acum = (acum * (n-sz[x])) % mod;
    }
    fator[x] = acum;
    for(auto v: grafo[x]){
        if(v == p) continue;
        solve(v,x);
    }
    if(x != 1){
        acum = (acum * sz[x])%mod;
        acum = ( acum * poww(n-sz[x],mod-2))%mod;
    }
}
int32_t main(){
	ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    for(int i = 1, a, b; i < n; i++){
        cin>>a>>b;
        grafo[a].pb(b);
        grafo[b].pb(a);
    }
    fat[0]=1;
    for(int i = 1; i <N; i++) fat[i] = (i*fat[i-1])%mod;
    dfs(1,1);
    // cout<<"INI "<<acum<<"\n";
    solve(1,1);
    for(int i = 1; i <= n; i++){
        // cout<<i<<" "<<fator[i]<<"\n";
        cout<<(fat[n] * poww(fator[i],mod-2)) % mod<<"\n";
    }
}
/*
    CUIDADO COM MAXN, MOD, OVERFLOW 
    >Colocar (>DEFINE INT LONG LONG<) no inicio do template
    >mod = (1e9 + 7), por padrao (NAO ESQUECER DE ALTERAR)
    >NAO ESQUECER DEFINE INT LONG LONG
    > N = 1 ? 
*/

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

using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")

#define fastio               \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
//#define int long long
#define ll long long
#define endl "\n"
#define inf ULLONG_MAX
#define gcd __gcd
#define deb(x) cout << #x << " " << x << endl;
#define pr(x) cout << x << endl;

#define sz(a) ((ll)(a).size())
#define all(v) (v).begin(), (v).end()
#define tr(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); it++)
#define pres(c, val) ((c).find(val) != (c).end())
#define cpres(c, val) (find(all(c), val) != (c).end())
#define dec greater<ll>()
#define sortv(x) sort(all(x))
#define revsortv(x) sort(all(x), dec)
#define com(x) (((x) * (x + 1)) / 2)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define bg begin()
#define ed end()
#define bs binary_search // to find if an element is present or not in Ologn time, return a boolean
#define ub upper_bound   // to find an element strictly greater than the given no.
#define lb lower_bound   // lb(v,begin(), v.end(), n) gives the iterator

#define fo(n) for (ll i = 0; i < n; i++)
#define fo1(n) for (ll i = 1; i < n; i++)
#define fo2(i, n) for (ll i = 0; i < n; i++)
#define fo3(i, a, b) for (ll i = a; i < b; i++)
#define fors(a) cin >> a[i]
#define forp(a) cout << a[i] << " "
#define prv(a, n)  \
    fo(n) forp(a); \
    cout << endl;
#define fob(i, a, b) for (ll i = (b); i >= (a); i--)

typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef unordered_map<string, ll> umsl;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;

#define scan(v, n)   \
    vl v;            \
    fo(n)            \
    {                \
        ll item;     \
        cin >> item; \
        v.pb(item);  \
    }

const ll INF = 0xFFFFFFFFFFFFFFFL;;
const ll N = 1000003;
void solve()
{
ll n,d;
cin>>n>>d;
ll c=0;
fo(n){
    ll a,b;
    cin>>a>>b;
    if(a*a+b*b<=d*d)c++;
}
cout<<c;

}
int32_t main(int32_t argc, char **argv)
{
    ios_base::sync_with_stdio(0);
   // cin.tie(0);
   // cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("inputf.txt", "r", stdin);
    freopen("outputf.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif*/

    ll t;
    t=1;
 //cin >> t;

   while (t--)
        solve();

    cerr << endl
         << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

    return 0;
}


Measured memory_bytes: 3816
#include <iostream>

using namespace std;

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

  for (int i = 0;; i++) {
    if (i * i > N) {
      cout << (i - 1) * (i - 1) << endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 888
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int A, B; cin >> A >> B;

    if (A%3==0 || B%3==0 || (A+B)%3==0) cout <<"Possible"<<endl;
    else cout << "Impossible" << endl;
  
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n,k,h[100000],m=1000000000;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    sort(h,h+n);
    for(int i=0;i<n-k+1;i++){
        m=min(m,h[i+k-1]-h[i]);
    }
    cout<<m<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb(x) push_back(x)

typedef pair<ll,ll> pp;
int lcm(int a, int b)
{
    int lar = max(a, b);
    int small = min(a, b);
    for (int i = lar; ; i += lar) {
        if (i % small == 0)
            return i;
    }
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b) {
    return (a.second < b.second);
}

ll power(ll x, unsigned ll y, ll p)
{
    ll res = 1;     // Initialize result
  
    x = x % p; // Update x if it is more than or
                // equal to p
   
    if (x == 0) return 0; // In case x is divisible by p;
  
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;
  
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

struct ArrayWrapper
{
    int a[101][101];
};

bool isPowerOfTwo (ll x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}


void solve(){
    ll x;
    cin >> x;
    vector<ll> v;
    for(ll i = 0;i <= 3980;i++){
        v.push_back(pow(i,5));
    }
    for(ll i = 0;i <= 3980;i++){
        if(v[i] == 0){
            ll z = pow(x, 1.0/5);
            if(pow(z, 5) == x){
                cout << z << " " << 0 << endl;
                return;
            }
        }
        else{
            ll y = x-v[i];
            ll z = pow(y, 1.0/5);
            if(pow(z, 5) == y){
                cout << z << " " << (-1)*i << endl;
                return;
            }
            y = x+v[i];
            z = pow(y, 1.0/5);
            if(pow(z, 5) == y){
                cout << z << " " << i << endl;
                return;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //ll t; cin >> t; while(t--)
        solve();
}


Measured memory_bytes: 4300
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	while(1){
		int a, max=-1, min=100000, sum=0, ans;
		cin >> n;
		if(n==0) break;
		for(int i=0;i<n;i++){
			cin >> a;
			if(a<min) min=a;
			if(a>max) max=a;
			sum += a;
		}
		ans = (sum-(max+min))/(n-2);
		cout << ans << endl;
	}
}


Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
  
int mood(int a){
if(a>0)return a;
a=a*(-1);
return a;
}
  
  int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
int cost [n];
cost[0]=0;
cost[1]=mood(arr[0]-arr[1]);
for(int i=2;i<n;i++)cost[i]=min( cost[i-1]+mood(arr[i]-arr[i-1])  ,  cost[i-2]+mood(arr[i]-arr[i-2]) );
cout<<cost[n-1];
 
}

Measured memory_bytes: 1024
#include <iostream>
//#include <iomanip>

using namespace std;
//#define

int main() {
	int n;

	cin >> n;

	int array[n];

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

	for(int i=n-1;i>=0;i--){
			cout << array[i];
			if(i!=0){
				cout << " ";
			} else {
				cout << "\n";
			}
		}

	return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int a, b;
    char[] cs;

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

    void run() {
        FastReader sc = new FastReader();
        a = sc.nextInt();
        b = sc.nextInt();
        cs = sc.next().toCharArray();
        solve();
    }

    void solve() {
        boolean flag = true;
        for (int i = 0; i < a; i++) {
            if (!Character.isDigit(cs[i])) {
                flag = false;
            }
        }
        if (cs[a] != '-') {
            flag = false;
        }
        for (int i = a + 1; i <= a + b; i++) {
            if (!Character.isDigit(cs[i])) {
                flag = false;
            }
        }
        if (flag) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
using ll = long long;
int main(){
	ll a,b;
	cin>>a>>b;
	int ans = 0;
	while(a<=b){
		a*=2;
		ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
#include <algorithm>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

const int ms = 303;

int dp[ms][ms];

struct Edge{
	Edge(){}
	Edge(int a, int b, int co) : u(a), v(b), c(co) {}
	int u, v, c;

	bool operator < (const Edge &o) const { return c < o.c; }
};

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n;
	std::cin >> n;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			std::cin >> dp[i][j];
		}
	}
	bool valid = true;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			for(int k = 0; k < n; k++) {
				valid = valid && dp[i][j] + dp[j][k] >= dp[i][k];
			}
		}
	}
	if(!valid) {
		std::cout << "-1\n";
		return 0;
	}
	long long ans = 0;
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j < n; j++) {
			valid = true;
			for(int k = 0; k < n; k++) {
				if(i == k || j == k) continue;
				valid = valid && dp[i][k] + dp[k][j] != dp[i][j];
			}
			if(valid) ans += dp[i][j];
		}
	}
	std::cout << ans << '\n';
}

Measured memory_bytes: 640
# import sys
# import math #sqrt,gcd
# import decimal
import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

def main():
    n = int(input())
    s = input().split()
    m = set()
    for i in range(n):
        m.add(s[i])
    if len(m)==3:
        print("Three")
    else:
        print("Four")
    return

if __name__=='__main__':
    main()

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

public class ABC
{




    public static void Main()
    {
        int[] read = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int N = read[0];
        int K = read[1];
        if ((K - 1) * 2 + 1 <= N) Console.WriteLine("YES");
        else Console.WriteLine("NO");

    }


}



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

using namespace std;

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

    if(X < A) {
        /*
         * XがA未満
         */
        cout << 0 << endl;
    }
    else {
        /*
         * XがA以上
         */
        cout << 10 << endl;
    }

    //cout << X << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <utility>
#include <set>
#include <numeric>
#include <queue>
#include <sstream>
#include <map>
#include <unordered_map>
#include <cmath>
using namespace std;
using LLI = long long int;

#define Rep(i, N) for (int i = 0; i < N; i++)


int main(int argc, char *argv[])
{
    int N;
    cin >> N;
    vector<double> v(N);
    Rep(i, N) {
        cin >> v[i];
    }

    sort(v.begin(), v.end());
    
    double s = v[0];
    for (int i=1; i<N; i++) {
        s = (s + v[i]) / 2.0;
    }

    cout << s << endl;
}

Measured memory_bytes: 256
// #include<bits/stdc++.h>
#include <iostream>
#include<vector>
#include<string>
//#include<algorithm>
//#include<stdio.h>
//#include<cmath>
//#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define umii unordered_map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define pws(x) cout<<x<<" ";
#define pwe(x) cout<<x<<endl;
#define all(arr) arr.begin(),arr.end()
using namespace std;

vector<pair<bool,int> > common(vector<pair<bool,int> > a,vector<pair<bool,int> > b)
{
	for(int i=0;i<26;i++)
	{
		if(a[i].first && b[i].first)
		{
			a[i].second=min(a[i].second,b[i].second);
		}
		else
		{
			a[i].first=0;
		}
	}
	return a;
}

int main()
{
	// #ifndef IO
	// freopen("input2.txt","r",stdin);
	// freopen("output2.txt","w",stdout);
	// #endif

	int t=1;
	cin>>t;
	vector< pair<bool, int> > a(26,make_pair(0,0));
	string str;
	cin>>str;
	t--;
		for(int i=0;i<str.length();i++)
		{
			a[str[i]-'a'].first=1;
			a[str[i]-'a'].second++;			
		}
	while(t--)
	{
		string str;
		cin>>str;
		vector< pair<bool, int> > b(26,make_pair(0,0));
		for(int i=0;i<str.length();i++)
		{
			b[str[i]-'a'].ff=1;
			b[str[i]-'a'].ss++;			
		}
		a=common(a,b);
	}
   	for(int i=0;i<26;i++)
   	{
   		if(a[i].first)
   		{
			while(a[i].second--)
			{
				cout<<char(i+'a');
			}
   		}
   	}
	return 0;
}

Measured memory_bytes: 3516
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int main(){
  int n;

  cin >> n;

  int N[4];
  for(int i = 0; i < 4; i++){
    N[i] = n%10;
    n /=10;
  }

  bool flag = true;
  for(int i = 0;i < 3; ++i){
    if(N[i] == N[i+1]){
      flag = false;
      break;
    }
  }
  if(flag)
    cout << "Good" << endl;
  else
    cout << "Bad" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define F first
#define S second
#define SHN 1e9
#define lSHN 1e18
using namespace std;
int r,g,b,n;
int res=0;
int main()
{
	cin >>r>>g>>b>>n;
	for (int i=0;i<=n/r;i++)
	{
		for (int j=0;j<=(n-i*r)/g;j++)
		{
			int bt=n-i*r-j*g;
			if (bt%b==0) res++;
		}
	}
	cout <<res;
	return 0;
}

Measured memory_bytes: 256
import copy
import sys
input=sys.stdin.readline

l=[list(map(int,input().split())) for i in range(3)]
a=l[0][0]-l[0][1]
b=l[0][1]-l[0][2]
c=l[0][0]-l[1][0]
d=l[1][0]-l[2][0]
for i in range(1,3):
    if a!=l[i][0]-l[i][1]:
        print('No')
        break
    elif b!=l[i][1]-l[i][2]:
        print('No')
        break
    elif c!=l[0][i]-l[1][i]:
        print('No')
        break
    elif d!=l[1][i]-l[2][i]:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 3444
from time import time
from random import random

limit_secs = 2
start_time = time()

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

def calc_score():
    score = 0
    S = 0
    last = [-1] * 26
    for d in range(D):
        S += s[d][t[d]]
        last[t[d]] = d
        for i in range(26):
            S -= c[i] * (d - last[i])
        score += max(10 ** 6 + S, 0)
    return score

def solution():
    return [i % 26 for i in range(D)]

t = solution()
score = calc_score()
while time() - start_time + 0.14 < limit_secs:
    d = int(random() * D)
    q = int(random() * 26)
    old = t[d]
    t[d] = q
    new_score = calc_score()
    if new_score < score:
        t[d] = old
    else:
        score = new_score
print('\n'.join(str(e + 1) for e in t))


Measured memory_bytes: 79136
#include<iostream>
using namespace std;
int a[200010];
int main() {
    int N,tmp,max1=0,max2=0;
    cin >> N;
    for (int i=0; i<N; i++)
        scanf("%d", &a[i]);

    for (int i=0; i<N; i++) {
        if (max1 < a[i]) {
            max2 = max1;
            max1 = a[i];
        } else if(max2 < a[i]) {
            max2 = a[i];
        }
    }

    for (int i=0; i<N; i++) {
        if (max1 == a[i])
            printf("%d\n", max2);
        else
            printf("%d\n", max1);
    }
    return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=100010;
int a[N],f[N][17];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int n,L,Q;
    cin>>n;
    for(int i=1;i<=n;i++) a[i]=gi();
    cin>>L>>Q;
    for(int i=1,j=1;i<n;i++) {
	while(j<n&&a[j+1]-a[i]<=L) ++j;
	f[i][0]=j;
    }
    f[n][0]=n;
    for(int i=n;i;i--)
	for(int j=1;j<17;j++)
	    f[i][j]=f[f[i][j-1]][j-1];
    while(Q--) {
	int x=gi(),y=gi(),ans=1;
	if(x>y) swap(x,y);
	for(int i=16;~i;i--)
	    if(f[x][i]<y) x=f[x][i],ans+=1<<i;
	printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 7808
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
  		char[] c=s.toCharArray();
  		

   for(int d=0;d<s.length();d++){
 		c[d]= (char)((c[d]-'A'+n)%26+'A');
     }
           
    	String ans="";
    	System.out.println(ans.valueOf(c));
    }
}

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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int n;
double item_dist[21][21];
double boss_dist[20];

double distance(pii a, pii b) {
    return hypot(a.first - b.first, a.second - b.second);
}

bool dfs(int p, double t, int remain) {
    if (remain == 0) return true;
    REP(i, n) {
        if (remain & (1 << i)) {
            double next_t = t + item_dist[i][p];
            bool reachable = true;
            REP(j, n) {
                if (remain & (1 << j) && boss_dist[j] <= next_t + item_dist[i][j]) {
                    reachable = false;
                    break;
                }
            }
            if (reachable && dfs(i, next_t, remain & ~(1 << i))) {
                return true;
            }
        }
    }
    return false;
}

int main() {
    int x, y, hx, hy;
    while (cin >> n >> x >> y >> hx >> hy, n|x|y|hx|hy) {
        fill_n((int *)item_dist, 21*21, 0);
        fill_n((int *)boss_dist, 21*21, 0);

        vector<pii> items;
        REP(i, n) {
            int a, b;
            cin >> a >> b;
            items.push_back({a, b});
        }
        items.push_back({x, y});
        REP(i, n+1) {
            FOR(j, i+1, n+1) {
                item_dist[i][j] = item_dist[j][i] = distance(items[i], items[j]);
            }
        }
        REP(i, n) {
            boss_dist[i] = distance(items[i], {hx, hy});
        }

        if (dfs(n, 0.0, (1 << n)-1)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

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

#define ll long long

using namespace std;

const int maxn = (int)2e5 + 7;
const int INF = (int)1e9;

ll a,b[maxn],c,d,cnt,e[(int)2e3 + 1][(int)2e3 + 1],cost[maxn],tout[maxn],mn = INF,p[maxn];

vector < pair < ll, ll> > g[maxn];

vector <ll> ans;

string s,t;

int main()
{
    //freopen("island2.in" , "r" , stdin);
    //freopen("island2.out" , "w" , stdout);
    cin >> s >> t;
    s += s;
    for(int i = 0; i < s.size() - t.size(); ++i){
    	if(s.substr(i,t.size()) == t){
    		cout << "Yes";
    		return 0;
    	}
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 6400
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	stack<int> T;
	int q;
	while(cin>>q){
		if(q){
			T.push(q);
		}
		else{
			out(T.top());
			T.pop();
		}
	}

	return 0;
}


Measured memory_bytes: 3200
# -*- coding: utf-8 -*-
#https://atcoder.jp/contests/abc141/tasks/abc141_a
import sys
#import collections

#n= int(input())
s= input()
#tmp = input().split()
#a = list(map(lambda a: int(a), tmp))

if(s[0]=="S"):
	print("Cloudy")
	sys.exit()
if(s[0]=="C"):
	print("Rainy")
	sys.exit()
else:
	print("Sunny")


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <cmath>
#include <climits>
#include <algorithm>
using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<int> x(N);
    vector<int> y(N);
    vector<int> h(N);
    int xt,yt,ht;
    for(int i=0; i<N; i++){
        cin >> x[i] >> y[i] >> h[i];
        if(h[i] != 0){
            xt = x[i];
            yt = y[i];
            ht = h[i];
        }
    }
    int ansx, ansy, ansh;
    for(int i=0; i<101; i++){
        for(int j=0; j<101; j++){
            int H = ht + abs(xt - i) + abs(yt - j);
            bool flag = true;
            for(int k=0; k<N; k++){
                if(max(H - abs(x[k] - i) - abs(y[k] - j), 0) != h[k]){
                    flag = false;
                }
            }
            if(flag){
                ansx = i;
                ansy = j;
                ansh = H;
            }
        }
    }
    
    cout << ansx << " " << ansy << " " << ansh << endl;
}

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

#define int long long
#define double long double

const int INF=2147483647;
const int MOD=1000000007;
const int mod=998244353;
const double eps=1e-18;

using namespace std;

signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int x;
    cin>>x;
    cout<<1-x<<endl;
    
    return 0;
}


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

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

const int MAX_N = 2e5 + 5, C = 30, MOD = 1e9 + 9;
int BASE = 2;
int pw[MAX_N];

int n;
int Arr[MAX_N];
int Brr[MAX_N];
int table[C];
int TABLE[C];
vector <pii> ans;

int _sum(int a, int b) {
	int c = a + b;
	if (MOD <= c)
		c -= MOD;

	return c;
}

int _sub(int a, int b) {
	int c = a - b;
	if (c < 0)
		c += MOD;

	return c;
}


int _mul(int a, int b) {
	int c = 1LL * a * b % MOD;
	return c;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	pw[0] = 1;
	for (int i = 1; i < MAX_N; i++)
		pw[i] = _mul(pw[i - 1], BASE);

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

	for (int b = 0; b < C; b++) {
		int val = 0;
		for (int i = 0; i < n; i++)
			val = _sum(val, ((Arr[i] >> b) & 1) * pw[i]);

		table[b] = val;
	}

	for (int b = 0; b < C; b++) {
		int val = 0;
		for (int i = 0; i < n; i++)
			val = _sum(val, ((Brr[i] >> b) & 1) * pw[i]);

		TABLE[b] = val;
	}

	for (int i = 0; i < n; i++) {
		bool same = true;
		for (int j = 0; j < C; j++)
			if (table[j] != TABLE[j] && _sum(table[j], TABLE[j]) != _sub(pw[n], 1)) {
				same = false;
				break;
			}

		if (same)
			ans.push_back({(n-i)%n, Arr[n - 1] ^ Brr[n - 1 - i]});

		int ind = n - 1 - i;
		for (int j = 0; j < C; j++) {
			TABLE[j] = _sub(TABLE[j], ((Brr[ind] >> j) & 1) * pw[n - 1]);
			TABLE[j] = _mul(TABLE[j], BASE);
			TABLE[j] = _sum(TABLE[j], ((Brr[ind] >> j) & 1) * pw[0]);
		}
	}

	sort(ans.begin(), ans.end());
	for (pii p: ans)
		cout << p.first << " " << p.second << endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int INF = 1e9;
const int MAX = 1e5;

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

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

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 n, k; // 変数
int h[MAX];
int dp[MAX]; // 足場iまでの最小コスト

// メモ化再帰
int rec(int i) {
    if (dp[i] != INF) return dp[i];
    if (i == 0) return dp[i] = 0;
    for (int j = 1; j <= k; j++) {
        if (i-j < 0) break;
        dp[i] = min(dp[i], rec(i-j) + abs(h[i]-h[i-j]));
    }
    return dp[i];
}

int main() {
// input
    cin >> n >> k;
    rep(i, n) {
        cin >> h[i];
    }
// solve
    rep(i, n) {
        dp[i] = INF;
    }
    int ans = rec(n-1);
// output
    cout << ans << "\n";
}

Measured memory_bytes: 9028
#include<stdio.h>

long long int FiveFactorical(long long int r){
    return r * r * r * r * r;
}

int main(void){
    
    long long int X,i,j,ans;
    
    scanf("%lld",&X);

    for(i = -500;i <= 500;i++){
        for(j = -500;j <= 500;j++){
            if(FiveFactorical(i) - FiveFactorical(j) == X){
                printf("%lld %lld\n",i,j);
                return 0;
            }
        }
    }
    
    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
int A[100100];

bool can(int x){
    return (std::lower_bound(A, A + N, x) - A) == N / 2;
}

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

    std::cin >> N;

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

    std::sort(A, A + N);

    int res = 0;

    if(can(A[N/2])){
        res = A[N/2] - A[N/2-1];
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = str(input())

    sn = 0
    for i in n:
        sn += int(i)

    if int(n) % sn == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)

	sc.Scan()
	lenA, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	A := strings.Split(sc.Text(), " ")

	sc.Scan()
	lenB, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	B := strings.Split(sc.Text(), " ")

	shorter := lenB
	short := 0
	if lenB > lenA {
		shorter = lenA
		short = 1
	}

	for i := 0; i < shorter; i++ {
		if A[i] > B[i] {
			fmt.Println(0)
			os.Exit(0)
		} else if A[i] < B[i] {
			fmt.Println(1)
			os.Exit(0)
		}
	}

	fmt.Println(short)
}



Measured memory_bytes: 1136
#include<iostream>
#include<vector>
#include<string>

using namespace std;
vector<string> ans;
vector<char> alp;

int main(){

	for(int i = 0;i < 26;i++){
		char a = 'a' + i;
		alp.push_back(a);
	}
	for(int i = 0;i < 26;i++){
		char  A = 'A' + i;
		alp.push_back(A);
	}

	while(1){
		int n;
		cin >> n;
		if(n == 0) break;
		int k[100];
		for(int i = 0;i < n;i++) cin >> k[i];
		
		string s;
		cin >> s;
		
		for(int i = 0;i < s.size();i++){
			char cnum;
			if(s[i] >= 'a'){
				cnum = s[i] - 'a';
			}else cnum = s[i] - 'A' + 26;
			s[i] = alp[(cnum -k[i%n] +52)%52];
		}
		
		ans.push_back(s);
	}
	for(int i = 0;i < ans.size();i++)cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int D,N; cin>>D>>N;

    if(N==100) N++;
    while(D--) N*=100;
    cout<<N<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

#define FOR(i,k,n) for(int i=k;i<n;i++)
#define FORR(i,k,n) for(int i=k;i<=n;i++)
#define scan(a) scanf("%d",&a)
#define scann(a,b) scanf("%d%d",&a,&b)
#define scannn(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define mst(a,n)  memset(a,n,sizeof(a))
#define ll long long
#define N 1005
#define mod 1000000007
#define INF 0x3f3f3f3f

const double eps=1e-8;
const double pi=acos(-1.0);


int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    int a,b;
    while(scann(a,b)!=EOF)
    {
        if(a==1) a=14;
        if(b==1) b=14;
        if(a>b)
            printf("Alice\n");
        else if(a==b)
            printf("Draw\n");
        else
            printf("Bob\n");
    }
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    vector<int> d(100000+2,0);
    int ans = 0;

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

    for(int i = 0; i <=100000; i++){
        ans = max(ans, d[i]+d[i+1]+d[i+2]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim() {
  int u, minv;
  int d[MAX], p[MAX], color[MAX];

  for (int i = 0; i < n; i ++) {
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while (true) {
    minv = INFTY;
    u = -1;
    for (int i = 0; i < n; i ++) {
      if (minv > d[i] && color[i] != BLACK) {
        u = i;
        minv = d[i];
      }
    }
    if (u == -1) break;
    color[u] = BLACK;
    for (int v = 0; v < n; v ++) {
      if (color[v] != BLACK && M[u][v] != INFTY) {
        if (d[v] > M[u][v]) {
          d[v] = M[u][v];
          p[v] = u;
          color[v] = GRAY;
        }
      }
    }
  }

  int sum = 0;
  for (int i = 0; i < n; i ++) {
    if (p[i] != -1) sum += M[i][p[i]];
  }

  return sum;
}

int main() {
  cin >> n;

  for (int i = 0; i < n; i ++) {
    for (int j = 0; j < n; j ++) {
      int e; cin >> e;
      M[i][j] = (e == -1) ? INFTY : e;
    }
  }

  cout << prim() << endl;
}


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

int main(){
  int n;
  cin >> n;
  int max1 = 0;
  int count = 0;
  for(int i=0;i<n;i++){
      int h;
      cin >> h;
      if(h>=max1){
          max1 = h;
          count++;
      }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()


int main() {
	string s, t;
	cin >> s >> t;
	sort(all(s));
	sort(t.rbegin(), t.rend());
	if (s < t)cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}





Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	long int n,m;
	//printf("好きな整数を1～200個入力します。入力する文字数を入力してください。\n");
	scanf("%d", &m);
	//printf("好きな整数を入力してください。\n");
	int count = 0;
	int escape = 0;
	int a[200];
	for (int i = 0;i < m;i++)
	{
		scanf("%d", &a[i]);
	}

	while (1)
	{
		for (int i = 0;i < m;i++)
		{
			if (a[i] % 2 == 1)
			{
				escape = 1;
				break;
			}
			a[i] = a[i] / 2;
		}
		if (escape == 1)
		{
			break;
		}
		count++;
	}
	//printf("試行回数は%d回です。", count);
	printf("%d", count);
	return 0;
}

Measured memory_bytes: 128
import bisect

n, m = map(int, input().split())

pn_cn = []
pn_cn_dict = {}


for _ in range(m):
    pn, cn = map(int, input().split())
    cities = pn_cn_dict.get(pn)
    if cities is None:
        cities = [cn]
    else:
        cities.append(cn)
    pn_cn_dict[pn] = cities
    pn_cn.append((pn, cn))

for k in pn_cn_dict:
    c = pn_cn_dict[k]
    c = sorted(c)
    pn_cn_dict[k] = c

for pn, cn in pn_cn:
    ci = bisect.bisect(pn_cn_dict[pn], cn)
    print("{:06}{:06}".format(pn, ci))




Measured memory_bytes: 35900
#include <iostream>
using namespace std;
const uint32_t mod = 998244353;
uint32_t fact[300009], inv[300009], factinv[300009];
uint32_t comb(uint32_t n, uint32_t k) {
	return 1ull * fact[n] * factinv[k] % mod * factinv[n - k] % mod;
}
int main() {
	uint32_t N, A, B; uint64_t K;
	cin >> N >> A >> B >> K;
	fact[0] = 1; factinv[0] = 1;
	for (uint32_t i = 1; i <= N; ++i) {
		fact[i] = 1ull * fact[i - 1] * i % mod;
		inv[i] = (i == 1 ? 1 : 1ull * inv[mod % i] * (mod - mod / i) % mod);
		factinv[i] = 1ull * factinv[i - 1] * inv[i] % mod;
	}
	uint32_t ret = 0;
	for (uint32_t x = 0; x <= N && 1ull * A * x <= K; ++x) {
		uint64_t y = (K - 1ull * A * x) / B;
		if (0 <= y && y <= N && 1ull * y * B + 1ull * A * x == K) {
			ret = (ret + 1ull * comb(N, x) * comb(N, y)) % mod;
		}
	}
	cout << ret << '\n';
	return 0;
}

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

int main(void){
  int x, a, b;
  cin >> x >> a >> b;
  if(a-b>=0) cout << "delicious" << endl;
  else if(a-b<0&&b-a<=x) cout << "safe" << endl;
  else cout << "dangerous" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
long long h,w,n;
cin>>h>>w>>n;
long long ans=0;
long long temp=0;
if(h>=w){
  for(int i=0;i<w;i++){
    if(temp>=n){
      break;
    }
    ans++;
    temp+=h;

  }
}
else{
  for(int i=0;i<h;i++){
    if(temp>=n){
      break;
    }
    ans++;
    temp+=w;

  }
}
cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using i64 = long long;

int main() {
    i64 a, b, n;
    std::cin >> a >> b >> n;
    const i64 x = std::min(n, b - 1);
    std::cout << a * x / b - x / b * a << std::endl;

    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
using namespace std;
int main(void){
    int H,W;
    while(true){
    cin >> H >> W;
        if(H == 0 && W == 0){
        break;
        }
        for (int i = 0; i < H; i++ ){
            for (int j = 0; j < W; j++ ){
                cout << "#";
            }
            cout  << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
int H,W,a[1000][1000];
int main()
{
   
    while (1>0)
    {
        H=W=0;
        scanf("%d%d",&H,&W);
        if (H==0 && W==0) return 0;
        for(int i=1;i<=H;i++)
        {
            for(int j=1;j<=W;j++)
                if (((i%2==0)&&(j%2==0))||((i%2!=0)&&(j%2!=0))) printf("#");
                else printf(".");
            printf("\n");
        }
        printf("\n");
    }
}



Measured memory_bytes: 3148
#include <iostream>
#include "math.h"
#include <string>

using namespace std;

int n;

bool* data;

int getChar(char a) {
  if (a == 'A') 
    return 1;
  else if (a == 'C') 
    return 2;
  else if (a == 'G')
    return 3;
  else if (a == 'T')
    return 4;
  else
    return 0;
}

int getKey (string str) {
  int res = 0;

  int l = str.size();
  int p = 1;
  for (int i = 0; i < l; i++) {
    int v = getChar(str[i]);
    res += p * v;
    p *= 5;
  }
  return res;
}

void insert (string str) {
  int key = getKey(str);
  data[key] = true;
}

bool find (string str) {
  int key = getKey(str);
  return data[key];
}

int main() {
  int v = pow(5, 12);
  data = new bool[v];

  cin >> n;
  for (int i = 0; i < n; i++) {
    string cmd, str;
    
    cin >> cmd >> str;
    
    if (cmd == "insert") {
      insert(str);
    } else if (cmd == "find") {
      if (find(str)) {
        cout << "yes" << endl;
      } else {
        cout << "no" << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 12000
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	n := nextInt()
	m := make(map[int]bool)
	for i := 0; i < n; i++ {
		a := nextInt()
		m[a] = !m[a]
	}

	var cnt int
	for _, a := range m {
		if a {
			cnt++
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 5504
#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() {
  string s;
  cin >> s;
  if(s == "AAA" || s == "BBB") cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 1;
  for(int i = 1; i < N; i++) {
    if(S.at(i) != S.at(i - 1)) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
h, w = list(map(int, input().split()))
C = [' ']
for i in range(h):
    s = ' ' + str(input())
    C.append(s)

for i in range(1, 2*h+1):
    for j in range(1, w+1):
        i_ = (i+1)//2
        print(C[i_][j], end='')
    print('')


Measured memory_bytes: 4468
#include <stdio.h>
int main(void){
	int i,s,o,n[4],q[4],toread,L,S,A,a,b,c;
	while(1){
		for(i=0;i<=3;i++){
			A=0;
			scanf("%1d",&n[i]);
			q[i]=n[i];
		}
		if(n[0]==n[1]&&n[1]==n[2]&&n[2]==n[3]){
			if(n[0]==0){
				break;
			}
			else{
				printf("NA\n");
			}
		}
		if(n[0]==6&&n[1]==1&&n[2]==7&&n[3]==4){
			printf("0\n");
		}
		else if(!(n[0]==n[1]&&n[1]==n[2]&&n[2]==n[3])){
			for(s=0;A!=6174;s++){
				for(o=0;o<=3;o++){
					for(i=0;i<=3;i++){
						if(n[i]<n[o]){
							toread=n[i];
							n[i]=n[o];
							n[o]=toread;
						}
					}
				}
				L=n[0]*1000+n[1]*100+n[2]*10+n[3];
				for(o=0;o<=3;o++){
					for(i=0;i<=3;i++){
						if(n[i]>n[o]){
							toread=n[i];
							n[i]=n[o];
							n[o]=toread;
						}
					}
				}
				S=n[0]*1000+n[1]*100+n[2]*10+n[3];
				A=L-S;
				a=A/1000;
				n[0]=a;
				n[1]=(A-(n[0]*1000))/100;
				n[2]=(A-((n[0]*1000)+(n[1]*100)))/10;
				n[3]=A-((n[0]*1000)+(n[1]*100)+(n[2]*10));
			}
			printf("%d\n",s);
		}
	}
	return 0;
}

Measured memory_bytes: 608
console.log((args=>{
  const [[N],X] = args.trim().split('\n').map(r=>r.split(' ').map(v=>v|0));
  const _X = [].concat(X).sort((a,b)=>a-b);
  const M1 = _X[N/2-1], M2 = _X[N/2];
  const m = [];
  for ( let i = 0; i < N; i++ ) {
    if ( X[i] <= M1 ) m.push(M2); else m.push(M1);
  }
  return m.join`\n`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 65008
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i=0; i<N; i++) cin >> A[i];
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  if (N%2==0) {
    ll res = 0;
    for (int i=0; i<N/2-1; i++) res += A[i]*2;
    res += A[N/2-1];
    res -= A[N/2];
    for (int i=N/2+1; i<N; i++) res -= A[i]*2;
    cout << res << endl;
  }
  else {
    ll res1 = 0;
    for (int i=0; i<N/2-1; i++) res1 += A[i]*2;
    res1 += A[N/2-1]+A[N/2];
    for (int i=N/2+1; i<N; i++) res1 -= A[i]*2;
    ll res2 = 0;
    for (int i=0; i<N/2; i++) res2 += A[i]*2;
    res2 -= A[N/2]+A[N/2+1];
    for (int i=N/2+2; i<N; i++) res2 -= A[i]*2;
    cout << max(res1, res2) << endl;
  }
  return 0;
}

Measured memory_bytes: 4012
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define mod               1000000007
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define maxe              max_element
#define mine              min_element
#define min3(a,b,c)       min(a,min(b,c))
#define max3(a,b,c)       max(a,max(b,c))
#define min4(a,b,c,d)     min(a,min(b,min(c,d)))
#define max4(a,b,c,d)     max(a,max(b,max(c,d)))
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define case(a)           cout<<"Case "<<(a)<<": "
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl
#define see(x)            cout<<#x<<" = "<<x<<endl
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define big(a)            transform((a).begin(),(a).end(),(a).begin(),::toupper)
#define small(a)          transform((a).begin(),(a).end(),(a).begin(),::tolower)
#define ischar(a)         (('a'<=a&&a<='z')('A'<=a&&a<='Z'))
#define isvowel(a)        (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U')
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    ll a; cin>>a;
    string s; cin>>s;
    if(a<3200) cout<<"red";
    else cout<<s;
}




















Measured memory_bytes: 3592
n = int(input())
a = list(map(int,input().split()))
memo = {}
def f(i):
    if i in memo.keys():
        return memo[i]
    if i==0 or i%2==1:
        return 0
    else:
        memo[i] = 1+f(i//2)
        return memo[i]
ans = 0
for a_ in a:
    ans += f(a_)
print(ans)

Measured memory_bytes: 15168
using System;
using System.Linq;

namespace ITP1_8_A
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine
            (
                Console
                    .ReadLine()
                    .Select
                    (
                        c => char.IsUpper(c) ? char.ToLower(c) :
                                char.IsLower(c) ? char.ToUpper(c) :
                                c
                    )
                    .ToArray()
            );
        }
    }
}

Measured memory_bytes: 9584