akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 2000000000000000000LL
#define EPS 1e-9
#define debug(a) cerr<<#a<<"="<<(a)<<"\n"
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 1e9+7;
const double PI = acos(-1);

int n,i,j,k,t;
int a[22][22];
int dp[22][1<<22];

int solve(int idx, int state){
    int &ans= dp[idx][state];
    if(ans == -1){
        ans = 0;
        int now = 1;
        for(int i=0;i<n;++i, now<<=1){
            if(!a[idx][i] || (now & state)) continue;
            ans = (ans + solve(idx+1, state|now))%mod;
        }
    }
    return ans;
}

int main(){
    memset(dp, -1, sizeof dp);
    scanf("%d", &n);
    for(i=0;i<n;++i)
        for(j=0;j<n;++j)
            scanf("%d", a[i]+j);
    memset(dp[n], n, sizeof dp[n]);
    dp[n][(1<<n)-1] = 1;
    int ans = solve(0, 0);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 360832
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;

#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(v) v.begin(), v.end()

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

  int n, q; cin >> n >> q;
  VI c(n); rep(i, n) cin >> c[i];
  vector<pair<int, int>> lr(q); rep(i, q) cin >> lr[i].first >> lr[i].second;
  rep(i, q) lr[i].first--;

  const int sq = 10;
  VI ri(q), lri(q);
  VI cnt(n+1);
  rep(i, q) cnt[lr[i].second]++;
  rep(i, n) cnt[i+1] += cnt[i];
  repr(i, q) ri[--cnt[lr[i].second]] = i;
  fill(all(cnt), 0);
  rep(i, q) cnt[lr[i].first >> sq]++;
  rep(i, n) cnt[i+1] += cnt[i];
  repr(i, q) lri[--cnt[lr[ri[i]].first >> sq]] = ri[i];
  fill(all(cnt), 0);

  VI ans(q);

  int prev = -1;
  int lx, rx;
  int sum = 0;
  for (auto i : lri) {
    auto [l, r] = lr[i];
    if (l >> sq != prev) {
      fill(all(cnt), 0);
      lx = rx = r;
      prev = l >> sq;
      sum = 0;
    }
    int cx;
    while (lx > l) if (cnt[cx=c[--lx]]++ == 0) sum += 1;
    while (lx < l) if (--cnt[c[lx++]] == 0) sum -= 1;
    while (rx < r) if (cnt[cx=c[rx++]]++ == 0) sum += 1;
    ans[i] = sum;
  }
  rep(i, q) cout << ans[i] << "\n";
}


Measured memory_bytes: 17396
import java.util.Scanner;

class Main{
    public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		int iin = sc.nextInt();
		int iia = sc.nextInt();
		int iib = sc.nextInt();
		if(iin*iia<iib) {
			System.out.println(iin*iia);

		}
		else {
			System.out.println(iib);
		}
    }
}


Measured memory_bytes: 24148
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int,int>
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,b,a) for (int i=(b);i>=(a);--i)
typedef long long LL;
inline int read(){
	int x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}

const int MAXN=200005,Mo=1000000007;
char s[2005][2005];
int n,m,o,a[2005],f[2005][2005],l[2005],r[2005],v[2005],w[2005];
int cmp(int i,int j){ return f[i][o]>f[j][o]; }
int main(){
	n=read(); m=read();
	FOR(i,1,n) scanf("%s",s[i]+1);
	FOR(j,1,m) f[1][j]=m-j+1;
	FOR(i,2,n) {
		for (int j=1,k;j<=m;j=k+1) {
			for (k=j;k<m&&(s[i][j]==s[i-1][j])==(s[i][k+1]==s[i-1][k+1]);++k);
			FOR(l,j,k) f[i-1][l]=(k-l+1);
		}
	}
	//FOR(i,2,n)
	//	FOR(j,1,m) printf("%d%c",f[i][j]," \n"[j==m]);
	int ans=max(n,m);
	FOR(j,1,m) {
		FOR(i,1,n-1) a[i]=l[i]=r[i]=i,w[i]=2,v[i]=0;
		o=j; sort(a+1,a+n,cmp);
		FOR(i,1,n-1) {
			v[a[i]]=1;
			if (a[i]>1&&v[a[i]-1]) {
				w[a[i]]+=w[a[i]-1]-1;
				l[a[i]]=l[a[i]-1];
			}
			if (a[i]<n-1&&v[a[i]+1]) {
				w[a[i]]+=w[a[i]+1]-1;
				r[a[i]]=r[a[i]+1];
			}
			w[l[a[i]]]=w[r[a[i]]]=w[a[i]];
			r[l[a[i]]]=r[a[i]];
			l[r[a[i]]]=l[a[i]];
			ans=max(ans,w[a[i]]*f[a[i]][o]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

/*
*/


Measured memory_bytes: 19840
#include <bits/stdc++.h>//toINFandByd
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define endl "\n"
using namespace std;
typedef long long ll;

void solve(){
    int n,x;
    cin >> x >> n;
    vector<int> p(n);
    forn(i,n) cin >> p[i];
    // if(n==0){
    //     cout << x << endl;
    //     return;
    // }
    sort(p.begin(),p.end());
    vector<int> v(102);
    int i;
    for(i=0;i<n;i++){
        v[p[i]] = 1;
    }
    int min_diff = x;
    int ans = 0;
    for(i=1;i<102;i++){
        if(v[i]==0){
            if(abs(x-i) < min_diff){
                min_diff = abs(x-i);
                ans = i;
            }
        }
    }
    // if(ans==0){
    //     int diff = 101-x;
    //     if(diff < min_diff){
    //         min_diff = diff;
    //         ans = 101;
    //     }
    // }
    cout << ans << endl;
}   

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll a1,a2,a3,a4,a5,a6,a7,a8;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n)cin>>a[i];
    rep(i,n){
        if(1<=a[i]&&a[i]<=399)a1=1;
        else if(400<=a[i]&&a[i]<=799)a2=1;
        else if(800<=a[i]&&a[i]<=1199)a3=1;
        else if(1200<=a[i]&&a[i]<=1599)a4=1;
        else if(1600<=a[i]&&a[i]<=1999)a5=1;
        else if(2000<=a[i]&&a[i]<=2399)a6=1;
        else if(2400<=a[i]&&a[i]<=2799)a7=1;
        else if(2800<=a[i]&&a[i]<=3199)a8=1;
        else cnt++;
    }
    if(a1==0&&a2==0&&a3==0&&a4==0&&a5==0&&a6==0&&a7==0&&a8==0){
        cout<<1<<" "<<cnt<<"\n";
    }
    else{
        ans=a1+a2+a3+a4+a5+a6+a7+a8;
        cout<<ans<<" "<<ans+cnt<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){

    int A,B;
    cin>>A>>B;
    if(B%A==0) cout<<A+B<<endl;
    else cout<<B-A<<endl;
}



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

int main(){
  string S, T;
  cin >> S >> T;
  cout << T << S << endl;
}

Measured memory_bytes: 3628
/**
 *   author: malviyanshiv
 *   created: 09 January 2019  23:27:27
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define MAX 3001

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

void fastscan(int &x){
    bool neg=false;
    register int c;
    x =0;
    c=getchar();
    if(c=='-'){
        neg = true;
        c=getchar();
    }
    for(;(c>47 && c<58);c=getchar())
        x = (x<<1) + (x<<3) +c -48;
    if(neg)
        x *=-1;
}

void optimizeIO(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

vector< vector<ll> > dp(MAX, vector<ll>(MAX));
vector< vector<bool> > vis(MAX, vector<bool>(MAX, false));
vector<ll> inp(MAX);

ll cal(int l, int r, int turn){
    if( l > r )
        return 0;
    if( vis[l][r] )
        return dp[l][r];

    if( turn ){
        vis[l][r] = true;
        return dp[l][r] = min( cal(l+1, r, 1-turn)-inp[l], cal(l, r-1, 1-turn)-inp[r]);
    }else{
        vis[l][r] = true;
        return dp[l][r] = max( cal(l+1, r, 1-turn)+inp[l], cal(l, r-1, 1-turn)+inp[r]);
    }
    
}

int main(){
	optimizeIO();
    
    int n;
    cin >> n;
    REP(i, 0, n)
        cin >> inp[i];

    cout << cal(0, n-1, 0) << endl;

	return 0;
}

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

using namespace std;

int n, x[55], y[55];
bool u[55], g, o[55];
long long ans;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", x + i);
	for (int i = 0; i < n; i++)
		scanf("%d", y + i);
	for (int i = 1; i <= 51; i++)
		u[i] = 1;
	for (int i = 51; i; i--) {
		u[i] = 0;
		g = 0;
		for (int j = 0; j < n; j++) {
			for (int k = 0; k <= 50; k++)
				o[k] = 0;
			o[x[j]] = 1;
			for (int k = 50; k; k--)
				if (u[k])
					for (int l = 0; l <= 50; l++)
						if (o[l])
							o[l % k] = 1;
			if (!o[y[j]]) {
				g = 1;
				break;
			}
		}
		if (g)
			if (i == 51) {
				printf("-1\n");
				return 0;
			} else {
				u[i] = 1;
				ans ^= 1LL << i;
			}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define endl '\n'
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()
#define show(x) cout<<(#x)<<" is "<<(x)<<endl

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set=tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef vector<vector<int>> matrix;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=5e5+123;
const int M=1e6+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int a[N];

multiset<ll>s;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        ll q=0;
        for(int j=i;j;j--){
            q+=a[j];
            s.insert(q);
        }
    }
    ll ans=0;
    for(int i=40;i>=0;i--){
        int cnt=0;
        vector<ll>v;
        for(ll x : s){
            if(x&(1ll<<i)){
                cnt++;
            }
            else{
                v.push_back(x);
            }
        }
        if(cnt>=k){
            ans+=(1ll<<i);
            for(ll x : v)s.erase(x);
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 31780
use std::io::Read;

fn read<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut a = vec![0; n + 1];
    let mut b = vec![0; n];
    for i in 0..n + 1 {
        a[i] = read();
    }
    for i in 0..n {
        b[i] = read();
    }

    let mut res: u64 = 0;
    for i in 0..n {
        // a[i] を倒す
        let rem: u64;
        if a[i] <= b[i] {
            res += a[i];
            rem = b[i] - a[i];
            a[i] = 0;
        } else {
            res += b[i];
            rem = 0;
            a[i] -= b[i];
        }

        // a[i + 1] を倒す
        if a[i + 1] <= rem {
            res += a[i + 1];
            a[i + 1] = 0;
        } else {
            res += rem;
            a[i + 1] -= rem;
        }
    }

    println!("{}", res);
}


Measured memory_bytes: 6396
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
vector<vector<int>> vec(100010);
int co[100010] = { 0 };
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n - 1 + m; i++) {
		int a, b;
		cin >> a >> b;
		co[b]++;
		vec[a].emplace_back(b);
	}
	queue<int>que;
	for (int i = 1; i <= n; i++) {
		if (co[i]==0) {
			que.push(i);
			break;
		}
	}
	int ans[100010] = { 0 };
	while (!que.empty()) {
		int k = que.front();
		for (int l = 0; l < vec[k].size(); l++) {
			co[vec[k][l]]--;
			if (co[vec[k][l]] == 0) {
				que.push(vec[k][l]);
			}
			ans[vec[k][l]] = k;
		}
		que.pop();
	}
	for (int i = 1; i <= n; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 7040
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        int N = in.nextInt();
        int A = in.nextInt();
        int B = in.nextInt();

        int distance = A-B;

        if (distance%2==0)
        {
            System.out.println("Alice");
        }
        else 
            {
                System.out.println("Borys");
            }
            
            
            

    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

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

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

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

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

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


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define f(i,n) for(int i=0; i<n; ++i)
#define fi(i,st,n) for(int i=st; i<=n; ++i)
#define veci vector<int>
#define vecp vector<pair<int,int> >
#define vecl vector<ll>
int prime[100000+10];

ll lcm(ll a, ll b) {
	return a*b/__gcd(a,b);
}

ll power(ll a, ll n, ll mod) {
	ll res = 1;
	while(n > 0) {
		if(n&1) {
			res = (res*a)%mod;
		}
		a = (a*a)%mod;
		n = n/2;
	}
	return res;
}

ll sum(int arr[], int n) {
	ll res = 0;
	f(i,n) {
		res += arr[i];
	}
	return res;
}

void seive() {
	prime[1] = 0;
	for(int i=2; i<=100000; i++) {
		prime[i] = 1;
	}
	for(ll i=2; i<=100000; i++) {
		if(prime[i]) {
			for(ll j=i*i; j<=100000; j+=i) {
				prime[j] = 0;
			}
		}
	}
}

ll max(ll a,ll b,ll c,ll d) {
	ll t1 = max(a,b);
	ll t2 = max(c,d);
	return max(t1,t2);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--){
		ll a,b,c,d;
		cin>>a>>b>>c>>d;
		cout<<max(a*c,b*d,a*d,b*c)<<"\n";
 	}
 	return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;
static const int M = 22370000;
bool Hash[M];

inline int convertChartoNum(char c)
{
	if (c == 'A')
	{
		return(1);
	}
	else if (c == 'C')
	{
		return(2);
	}
	else if (c == 'G')
	{
		return(3);
	}
	else if (c == 'T')
	{
		return(4);
	}
}

inline int getKey(string s)
{
	int sum = 0;
	int p = 1;
	int size = s.size();
	for (int i = 0; i < size; ++i)
	{
		sum += p * convertChartoNum(s[i]);
		p *= 4;
	}
	return(sum);
}

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

	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		string command, str;
		cin >> command >> str;
		int key = getKey(str);
		if (command[0] == 'i')
		{
			if (!Hash[key])
			{
				Hash[key] = true;
			}
		}
		else
		{
			if (Hash[key])
			{
				printf("yes\n");
			}
			else
			{
				printf("no\n");
			}
		}
	}
}

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

Measured memory_bytes: 2580
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n, h := nextInt(), nextInt()
	b := make([]int, n)
	// 最後まで残す剣のa
	aMax := 0
	for i := 0; i < n; i++ {
		a := nextInt()
		b[i] = nextInt()
		if aMax < a {
			aMax = a
		}
	}
	sort.Sort(sort.IntSlice(b))

	ans := 0
	for i := n - 1; i >= 0 && aMax <= b[i] && h > 0; i-- {
		h -= b[i]
		ans++
	}
	if h > 0 {
		ans += (h-1)/aMax + 1
	}
	fmt.Println(ans)
}


Measured memory_bytes: 4608
import kotlin.String

fun main(args: Array<String>) {
    val n = readInt()
    val s = readString()

    val cnt = MutableList(26) { 0 }
    s.forEach {
        cnt[it - 'a']++
    }
    var ans = 1L
    cnt.forEach {
        if (it > 0) {
            ans = (ans * (it + 1L) % 1000000007L) % 1000000007L
        }
    }
    println(ans - 1)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()

Measured memory_bytes: 38528
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
  char s[100001];
  char olds;
  int len;
  int index=0;
  int *line;
  scanf("%s\n",s);
  len=strlen(s);
  line=(int *)malloc(len*sizeof(int));
  for (int i=0;i<len;i++) line[i]=0;
  olds='R';
  for (int i=0;i<len;i++){
    if (olds!=s[i]){
      if (s[i]=='R'){
        line[index]+=(i-index+1)/2;
        line[index-1]+=(i-index)/2;
        index=i;
        olds=s[i];
      }
      if (s[i]=='L'){
        line[i]+=(i-index)/2;
        line[i-1]+=(i-index+1)/2;
        index=i;
        olds=s[i];
      }
    }
  }
  line[index]+=(len-index+1)/2;
  line[index-1]+=(len-index)/2;
  for (int i=0;i<len;i++){
    if (i<len-1) printf("%d ",line[i]);
    else printf("%d\n",line[i]);
  }
  free(line);
  return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    int n; cin >> n;
    int h[n];
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += max(0, h[i]-h[i-1]);
    }
    cout << ans << endl;
}

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V)                                                           \
    for (auto v : (V))                                                         \
        cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    string N;
    cin >> N;
    REP(i, N.size()) {
        if (N[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
signed main(){
  string s;
  cin>>s;
  bool check=false;
  for(int i = 0; i<3;i++){
    if(s[i]==s[i+1])check=true;
  }
  if(check)cout<<"Bad"<<endl;
  else cout<<"Good"<<endl;
}


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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

		
			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			long M = inputArray[1];


			var warInfo = new List<Tuple<long, long>>();


			for (int i = 0; i < M; i++) {
				var input= retreiveLongArray();
				warInfo.Add(new Tuple<long, long>(input[0], input[1]));
			}


			var sortedInfo = warInfo.OrderByDescending(x => x.Item1).ToArray();

			var cutted = sortedInfo[0].Item1;
			var count = 1;

			for (int i = 1; i < M; i++) {

				var war = sortedInfo[i];
				//war.item1 <= cuttedが保証されている
				if (war.Item2 <= cutted) {
					cutted = war.Item1;
					count++;
				}

			}

			//答えの出力
			var ans = count;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 50908
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cstdio>
using namespace std;
static inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int pow(long x, int n, int m){
    long ret = 1;
    while (n > 0) {
        if (n & 1) ret *= x, ret %= m;
        x *= x, x %= m;
        n >>= 1; 
    }
    return ret % m;
}

int euler_phi(int n) {
   int ret = n;
   for(int i = 2; i * i <= n; ++i){
       if(n % i == 0) {
           ret -= ret / i;
           while(n % i == 0) n /= i;
       }
   }
   if(n > 1) ret -= ret / n;
   return ret;
}

int main()
{
    int K = 0, c = getchar();
    while(c > 47 && c < 58){
        K = K * 10 + c - 48;
        c = getchar();
    }

    K /= gcd(K, 7);
    if(K == 1){
        putchar('1');
        return 0;
    }

    K *= 9;

    if(gcd(K, 10) != 1) {
        putchar('-');
        putchar('1');
        return 0;
    }

    int res = euler_phi(K);

    int ans = 1000000;
    int now = 10;
    int mx = 0;
    for(int i = 1; i * i <= res; ++i){
        if(res % i == 0) {
            if(now == 1){
                printf("%d\n", i);
                return 0;
            }
        }
        now *= 10, now %= K;
        mx = i;
    }
    for (int i = mx; i >= 1; --i){
        if(res % i == 0){
            if(pow(10, res / i, K) == 1){
                printf("%d\n", res / i);
                return 0;
            }
        }
    }

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

    return 0;
}


Measured memory_bytes: 1600
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;
    
    string tmp = "keyence";
    
    int i = 0;
    while(s[i] == tmp[i]) {
        i++;
    }
    
    int j = 0;
    while(s[s.size() - 1 - j] == tmp[tmp.size() - 1 - j]) {
        j++;
    }
    
    if(i + j >= 7) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

struct Combination{
    vector<ll> fac,finv,inv;
    Combination(int mx){init(mx);}
    void init(int mx){
        fac.resize(mx+1);
        finv.resize(mx+1);
        inv.resize(mx+1);
        fac[0]=fac[1]=1;
        finv[0]=finv[1]=1;
        inv[1]=1;
        for(int i=2;i<=mx;i++){
            fac[i]=fac[i-1]*i%MOD;
            inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
            finv[i]=finv[i-1]*inv[i]%MOD;
        }
    }
    ll calc(int n,int k){
        if(n<k){
            return 0;
        }
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
    }
};

int main(){
    int n,k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    Combination comb(n);
    ll ans=0;
    for(int i=0;i<n;i++){
        ans+=comb.calc(i,k-1)*a[i];
        ans%=MOD;
    }
    for(int i=0;i<n;i++){
        ans-=comb.calc(n-i-1,k-1)*a[i];
        ans%=MOD;
    }
    ans=(ans+MOD)%MOD;
    cout<<ans<<endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iomanip>

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b);
ll lcm(ll a, ll b);

int main(){
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    
    if(C == 1 || D == 1){
        cout << 0 << endl;
        return 0;
    }
    
    ll ans = 0;
    if(C < D)       swap(C, D);
    
    ll c_cnt, d_cnt, cd_cnt;
    
    if(A % C == 0){
        c_cnt = (ll)B / C - A / C + 1;
    }
    else{
        c_cnt = (ll)B / C - A / C;
    }
    if(A % D == 0){
        d_cnt = (ll)B / D - A / D + 1;
    }
    else{
        d_cnt = (ll)B / D - A / D;
    }
    ll div = lcm(C, D);
    if(A % div == 0){
        cd_cnt = (ll)B / div - A / div + 1;
    }
    else{
        cd_cnt = (ll)B / div - A / div;
    }
    
    ans = (B - A + 1) - (c_cnt + d_cnt - cd_cnt);
    cout << ans << endl;
}

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

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

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int a,b,c,d;
	int l,r;
	
	scanf("%d %d %d %d",&a,&b,&c,&d);

	l = a + b;
	r = c + d;

	if (l>r){
		printf("Left\n");
	}
	else if(l<r){
		printf("Right\n");
	}
	else{
		printf("Balanced\n");
	}
	return 0;
}


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

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

    int N;
    cin >> N;
    vector<int> A(N + 1), B(N + 1), C(N);
    for (int i = 1; i <= N; i++)
        cin >> A[i];
    for (int i = 1; i <= N; i++)
        cin >> B[i];
    for (int i = 1; i <= N - 1; i++)
        cin >> C[i];

    int sum = B[A[1]];
    for (int i = 2; i <= N; i++) {
        sum += B[A[i]];
        if (A[i] == A[i - 1] + 1)
            sum += C[A[i - 1]];
    }
    cout << sum << '\n';

    return 0;
}

Measured memory_bytes: 256
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#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>
#define f first
#define s second
using namespace std;	

int main()
{
	sync;
	ll n,k,ans=0;
	cin>>n>>k;
	ll arr[n+1];
	for(ll i=1;i<=n;i++)cin>>arr[i];arr[0]=0;
	for(ll i=1;i<=min(n,k);i++)//total elemnets taken
	{
		for(ll j=0;j<=i;j++)//left elements taken
		{
			vector<ll>neg;
			ll sum=0;
			for(ll l=0;l<=j;l++)
			{
				sum+=arr[l];
				if(arr[l]<0)
				neg.push_back(arr[l]);
			}
			for(ll l=n;l>n-i+j;l--)
			{
				sum+=arr[l];
				if(arr[l]<0)
				neg.push_back(arr[l]);
			}
			if(neg.size())
			sort(neg.begin(),neg.end());
			for(ll l=0;l<min(k-i,(ll)neg.size());l++)
			sum-=neg[l];
			ans=max(ans,sum);
	}
}
	cout<<ans;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
#AGC37 A

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
n = len(s)
tmp = s[0]
tmp2 = ''
ans = 1
for i in range(1,n):
    tmp2 += s[i]
    if tmp == tmp2:
        continue
    else:
        ans += 1
        tmp = tmp2
        tmp2 = ''
print(ans)


Measured memory_bytes: 41052
import std.stdio;
import std.string, std.conv;
import std.math;

void main() {
  for(int N; N = readln().chomp().to!int(), N != -1;) {
    real x = 1, y = 0;

    foreach(i; 0 .. N - 1) {
      real r = hypot(x, y);
      real theta = atan(y / x);
      if(x < 0) theta += PI;
      theta += PI / 2;
      x += cos(theta);
      y += sin(theta);
      // writefln("%f %f %f", theta, x, y);
    }
    writeln(x);
    writeln(y);
  }
}

Measured memory_bytes: 1060
def generate_permutations(trunk, size, current=[]):
    if len(current) == size:
        trunk.append(current)
        return

    generate_permutations(trunk, size, current + [True])
    generate_permutations(trunk, size, current + [False])


S = input()
perms = []
generate_permutations(perms, len(S) - 1)
ANS = 0
for perm in perms:
    A = [int(c) for c in S]
    ans = 0
    tmp = A.pop(0)
    for i in range(len(A)):
        if perm[i]:
            ans += tmp
            tmp = A[i]
        else:
            tmp *= 10
            tmp += A[i]
    else:
        ans += tmp
    ANS += ans
print(ANS)


Measured memory_bytes: 3064
#include<iostream>
 
using namespace std;
 
const int N = 123456;
int dp[3][N];
 
int main(){
  int n;
  cin >> n;
  int a,b,c;
  cin >> a >> b >> c;

  dp[0][0] = a;
  dp[1][0] = b;
  dp[2][0] = c;

  for(int i = 1; i<n; i++){
    cin >> a >> b >> c;
    dp[0][i] = max(dp[1][i-1],dp[2][i-1])+a;
    dp[1][i] = max(dp[0][i-1],dp[2][i-1])+b;
    dp[2][i] = max(dp[1][i-1],dp[0][i-1])+c;
  }
  cout << max(max(dp[0][n-1],dp[1][n-1]),dp[2][n-1]) << endl;
  return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define INF 1e9
#define LINF 1e18
#define ld double
#define ll long long
#define ull unsigned long long

namespace io {
	const int SZ = 1 << 13;
	char buff[SZ], *pos = buff + SZ - 1;
	char gc() {
		if (++ pos == buff + SZ) fread(pos = buff, 1, SZ, stdin);
		return *pos;
	}
}

template <typename T>
inline void read(T &x) {
	x = 0; int f = 1, c = io :: gc();
	for (;!isdigit(c);c = io :: gc()) if (c == '-') f = -f;
	for (; isdigit(c);c = io :: gc()) x = (x<<3) + (x<<1) + (c^48);
	x *= f;
}

const int N = 400005;

int x[N];
int n, L;
ll sum[N];
ll ans;

void solve() {
	for (int i = 1; i <= n + n; ++ i) sum[i] = sum[i - 1] + x[i];
	if (L - x[1] > ans) ans = L - x[1];
	if (x[n + n] - L > ans) ans = x[n + n] - L;
	for (int i = 2; i <= n; ++ i) {
		int j = i + n - 1;
		int ed = j - n + i;
//		printf("%d %d %d: ", i, j, ed);
		ll cur = 2 * (sum[j] - sum[n]) - (2 * (sum[ed - 1] - sum[i]) + x[i] + x[ed]) + abs(L - x[ed]);
//		printf("%lld\n", cur);
		if (cur > ans) ans = cur;
	}
}

int main() {
	read(L); read(n);
	for (int i = 1; i <= n; ++ i) read(x[i]);
	for (int i = n + 1; i <= n + n; ++ i) x[i] = x[i - n] + L;
	
	solve();
	reverse(x + 1, x + n + n + 1);
	for (int i = 1; i <= n + n; ++ i) x[i] = L + L - x[i];
	solve();
	
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define THREE 3
using namespace std;

int mat[THREE][THREE];

pair <int , int> search(int x) {
	for(int i = 0 ; i < THREE ; ++i) 
		for(int j = 0 ; j < THREE ; ++j) 
			if(mat[i][j] == x) return make_pair(i , j); 
	return make_pair(-999 , -999);
}

int main(int argc, char **argv) {
	vector < pair <int , int> > v;
	vector <int>  m(8 , 0);
	int n = 0 , x = 0;
	bool flag = false;
	for(int i = 0 ; i < THREE ; ++i) 
		for(int j = 0 ; j < THREE ; ++j) scanf("%d" , &(mat[i][j]));
	scanf("%d" , &n);
	for(int i = 0 ; i < n ; ++i) {
		scanf("%d" , &x);
		if(search(x).first != -999 && search(x).second != -999) v.push_back(search(x));
	}
	for(auto &a : v) {
		if(a.first == a.second) ++m[0];
		if(a.first + a.second == 2) ++m[1];
		if(a.first == 0) ++m[2];
		if(a.first == 1) ++m[3];
		if(a.first == 2) ++m[4];
		if(a.second == 0) ++m[5];
		if(a.second == 1) ++m[6];
		if(a.second == 2) ++m[7];
	}
	
	for(int a : m) if(a == 3) flag = true;
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mx 100001
#define tc int t;cin>>t;for(int raf=1;raf<=t;raf++)
#define fm cout<<"Case "<<raf<<": "
using namespace std;
bool prime[100005];
void sieve()
{
	int n=100004;
	int p=sqrt(n);
	for(int i=4;i<=n;i+=2)prime[i]=1;
	for(int i=3;i<=p;i+=2){
		if(!prime[i])
		{
			for(int j=i*i;j<=n;j+=i) prime[j]=1;
		}
	}
	prime[1]=1;

}
int main()
{
    int b,c,d,e,f,i,j,n;
    cin>>n;
    sieve();
    for(i=n;;i++)
    {
        if(!prime[i])
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 200005
using namespace std;
struct node {
	int num, pos;
} a[N];
bool cmp (string x, string y) {
    return x < y;
}
bool cmp1 (node x, node y) {
	if (x.num == y.num) return x.pos < y.pos;
	else return x.num > y.num;
}
int main() { 
    memset (a, 0, sizeof(a));
	int n, tot = 0;		
	bool flag;
	scanf("%d", &n);
	string s[N];
	cin.ignore();
	for (int i = 0; i < n; i++) {
		getline(cin ,s[i]);
    }
    sort(s, s + n, cmp);
	a[++tot].num = 1;
	a[tot].pos = 0;
    for (int i = 1; i < n; i++) {
    	if (s[i] == s[i - 1]) {
    	    a[tot].num ++;
		}
		else {
			a[++tot].num ++;
			a[tot].pos = i;
		}
	}
	
	sort(a + 1, a + n + 1, cmp1);
	int x = a[1].num;
	for (int i = 1; i <= tot; i++) {
		if (a[i].num == x) 
		cout << s[a[i].pos] << endl;
		else break;
	}
	return 0;
} 

Measured memory_bytes: 15872
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

using namespace std;

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

constexpr ll MOD = 1e9 + 7;

struct ST
{
private:
    int n;
    vector<ll> node;

public:
    ST(vector<ll> v)
    {
        n = 1;
        while (n < v.size())
            n *= 2;
        node.resize(n * 2 - 1, 0);
        for (int i = 0; i < v.size(); i++)
            node[i + n - 1] = v[i];
        for (int i = n - 2; i >= 0; i--)
            node[i] = max(node[i * 2 + 1], node[i * 2 + 2]);
    }

    void add(int x, ll v)
    {
        x += n - 1;
        node[x] = v;
        while (x > 0)
        {
            x = (x - 1) / 2;
            node[x] = max(node[x * 2 + 1], node[x * 2 + 2]);
        }
    }

    ll get(int a, int b, int k = 0, int l = 0, int r = -1)
    {
        if (r < 0)
            r = n;

        if (b <= l || r <= a)
            return 0;
        if (a <= l && r <= b)
            return node[k];

        ll vl = get(a, b, k * 2 + 1, l, (l + r) / 2);
        ll vr = get(a, b, k * 2 + 2, (l + r) / 2, r);
        return max(vl, vr);
    }
};

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

    int n, h[212345], a[212345];
    cin >> n;
    vector<ll> v(n + 1, 0);
    for (int i = 0; i < n; i++)
        cin >> h[i];
    for (int i = 0; i < n; i++)
        cin >> a[i];

    auto st = ST(v);

    ll res = 0;

    for (int i = 0; i < n; i++)
    {
        ll sum = st.get(0, h[i]) + a[i];
        st.add(h[i], sum);
        res = max(res, sum);
    }

    cout << res << endl;

    return 0;
}


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

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

    int N, R;
    cin >> N >> R;

    if (10 <= N){
        cout << R << "\n";
    }
    else {
        cout << (R + (100 * (10 - N))) << "\n";
    }


    return 0;
}

Measured memory_bytes: 256
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>> 
ld pie=3.141592653589793238462643383279;
int mod=1e9+7;
int dx[]={-1,1,0,0};
int dy[]={0,0,1,-1};


int dig(int a){
  int r=0;
  while(a!=0){
    int xp=a%10;
    a/=10; if(xp==1) ++r;
  }
  return r;
}

int sp(int a){
  int s=0;
  int ano=a-1;
  while(a!=0){
    s+=a%10;
    a/=10;
  }
  while(ano!=0){
    s+=ano%10;
    ano/=10;
  }
  return s;
}

int fun(int a){
  int r=1;
  f(i,0,10) r*=a;
  return r;
}

void q1(){
  int n,b,q; cin>>n>>b>>q;
  int a[n];  f(i,0,n) a[i]=i/b;
  int curr=-1;
  int load=0;
  while(q--){
    int x; cin>>x;
    if(a[x]!=curr){
      curr=a[x];
      load++;
    }
  }
  cout<<load<<"\n";
}
void q2(){
  int t; cin>>t;
  while(t--){
    int n; cin>>n;
    int a[2*n+5];
    f(i,0,2*n) cin>>a[i];
    int o=0,e=0;
    vector<int> odd,even;
    f(i,0,2*n) if(a[i]%2==1) {
      ++o; odd.pb(i+1);
    }
    else {
      ++e; even.pb(i+1);
    }
    vpii vt;
    if(o&1){
      for(int i=0;i<odd.size()-1;i+=2)
        vt.pb({odd[i],odd[i+1]});
      for(int i=0;i<even.size()-1;i+=2)
        vt.pb({even[i],even[i+1]});
    }else{
      if(o>0){
        for(int i=2;i<odd.size();i+=2)
        vt.pb({odd[i],odd[i+1]});
      for(int i=0;i<even.size();i+=2)
        vt.pb({even[i],even[i+1]});
      }else{
          for(int i=2;i<even.size();i+=2)
        vt.pb({even[i],even[i+1]});
      }
    }
    for(auto it : vt) cout<<it.ff<<" "<<it.ss<<"\n";
  }
}
void q3(){
  int t; cin>>t;
  vector<int> xx;
  int pr[100005]={0};
  f(i,2,100005) if(pr[i]==0){
    if(i&1){
      xx.pb(i); for(int j=2*i;j<100005;j+=i) pr[j]=i;
   }
  }
  while(t--){
    int n; cin>>n;
    if(n==1) cout<<"FastestFinger\n";
    else if (n&1) cout<<"Ashishgup\n";
    else{
      int curr=0;
      while(n!=1){
        if(n&1){
          ++curr;
          break;
        }
        int mx=-1;
        for(auto it : xx) if(n%it==0) mx=it;
        if(mx==-1){
          if(n==2){
            break;
          }else{
            ++curr;
            break;
          }
        }else{
          n/=mx;
          curr++;
        }
      }
      if(curr%2==0) cout<<"Ashishgup\n";
      else cout<<"FastestFinger\n";
    }
  }
}
int32_t main(){
#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s; cin>>s;
  if(s>="a" && s<="z") cout<<"a";
  else cout<<"A";
  return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		
		int h = a / 3600;
		int m = (a - h * 3600) / 60;
		int s = a - (h * 3600 + m * 60);
		
		System.out.println(h + ":" + m + ":" + s);
		scan.close();
	}
}


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


	



int main(){
	string s;

	cin>>s;
	

	vector<char> a(4);

	for(int i = 0;i<4;i++){
		a[i]=s[i];
	}
	
	sort(a.begin(),a.end());

	if(a[0]==a[1] && a[1]!=a[2] && a[2]==a[3]){
		cout << "Yes";
	}else{
		cout << "No";
	}
	
	


	return 0;
}



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

int main() {
  
  int N;
  cin >> N;
  
  vector<int> d(N);
  for(int i=0; i<N; i++){ cin >> d.at(i); }
  sort(d.begin(), d.end());
  
  int res = 0;
  
  res = d.at(N/2)-d.at(N/2-1);
  
  cout << res << endl;
  
}

Measured memory_bytes: 640
package main

import (
	"fmt"
)

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)
	var A, B int
	E := make([][]int, N)
	for i := 0; i < N; i++ {
		E[i] = make([]int, 0)
	}
	for i := 0; i < M; i++ {
		fmt.Scanf("%d %d", &A, &B)
		E[A-1] = append(E[A-1], B)
		E[B-1] = append(E[B-1], A)
	}

	prevRooms := make([]int, N)
	for i := 0; i < N; i++ {
		prevRooms[i] = -1
	}

	nowRooms := []int{1}
	for {
		nextRooms := []int{}
		for _, nowRoom := range nowRooms {
			for _, nextRoom := range E[nowRoom-1] {
				if prevRooms[nextRoom-1] > 0 {
					continue
				}
				prevRooms[nextRoom-1] = nowRoom
				nextRooms = append(nextRooms, nextRoom)
			}
		}
		if len(nextRooms) == 0 {
			break
		}
		nowRooms = nextRooms
	}
	if len(prevRooms) > 0 {
		fmt.Println("Yes")
		for index, prevRoom := range prevRooms {
			if index == 0 {
				continue
			}
			fmt.Println(prevRoom)
		}
	}
}


Measured memory_bytes: 18840
package main

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

var stdin = bufio.NewScanner(os.Stdin)

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

func main() {
	stdin.Split(bufio.ScanWords)
	n := nextInt()
	s := make([]int, n)

	for i := 0; i < n; i++ {
		s[i] = nextInt()
	}

	for i := 1; i <= n; i++ {
		fmt.Printf("node %v: key = %v, ", i, s[i-1])
		if i != 1 {
			fmt.Printf("parent key = %v, ", s[i/2-1])
		}
		if i*2 <= n {
			fmt.Printf("left key = %v, ", s[i*2-1])
		}
		if i*2+1 <= n {
			fmt.Printf("right key = %v, ", s[i*2+1-1])
		}
		fmt.Println()
	}

}



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

using namespace std;
typedef long long ll;
#define tr(container, it) \
    for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define endl '\n'
#define int ll

const double PI = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
const int MOD = (int) (1e9) + 7;
const int MX = 777777 + 5;
const int mod = 1777777777;
const double EPS = 1e-10;
const ll MXP = 8999251775770639633;

inline int len(string s){return s.size();}
inline int len(int* A){return (sizeof(A))/sizeof(A[0]);}
template <typename T>inline int len(vector<T> v){return v.size();}
template <typename T>inline int len(set<T> v){return v.size();}
template <typename T,typename S>inline int len(map<T,S> v){return v.size();}

int fac[MX+5];
int power(int x, int y, int p)
{
    int res = 1;

    x = x % p;

    while (y)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}

int C(int n, int r, int p)
{
    if (r==0)
        return 1;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
}

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

int CC(int a, int b){
    int res = 1;
    rep(i,a+1,a-b+1)res *= i,res/=a-i+1;
//    rep(i,1,b+1)res /= i;
    return res;
}

string S[16];
double win[16][16];
double P[16][5];
void _() {
    string s;
    cin >> s;
    if((stoi(s.substr(5,2)) ==4 && stoi(s.substr(8,2)) == 31) || stoi(s.substr(5,2)) >4 )cout << "TBD";
    else cout << "Heisei";


};

#undef int
int main() {
#if __MINGW32__
    freopen("C:\\Users\\hiroo\\CLionProjects\\competitive\\Input.txt", "r", stdin);
    freopen("C:\\Users\\hiroo\\CLionProjects\\competitive\\Output.txt", "w", stdout);

#endif

    _();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


}

Measured memory_bytes: 256
H, W = map(int, input().split())
if H % 3 == 0 or W % 3 == 0:    # 3の倍数だったら最小値は0
    print(0)
    exit()

answer = float('inf')

h = 1
for _ in range(H):
    a = h * W
    b = (H-h) * (W // 2)
    c = H * W - a - b
    MAX = max([a, b, c])
    MIN = min([a, b, c])
    if MAX - MIN <= answer:
        answer = MAX - MIN
    h += 1

w = 1
for _ in range(W):
    a = w * H
    b = (W-w) * (H // 2)
    c = H * W - a - b
    MAX = max([a, b, c])
    MIN = min([a, b, c])
    if MAX - MIN <= answer:
        answer = MAX - MIN
    w += 1

a = W // 3
b = (W - a) // 2
c = W - a - ((W - a) // 2)
a *= H
b *= H
c *= H
MAX = max([a, b, c])
MIN = min([a, b, c])
if MAX - MIN <= answer:
    answer = MAX - MIN

a = H // 3
b = (H - a) // 2
c = H - a - ((H - a) // 2)
a *= W
b *= W
c *= W
MAX = max([a, b, c])
MIN = min([a, b, c])
if MAX - MIN <= answer:
    answer = MAX - MIN

print(answer)

Measured memory_bytes: 3188
#include <algorithm>

#include <bitset>

#include <complex>

#include <deque>

#include <exception>

#include <fstream>

#include <functional>

#include <iomanip>

#include <ios>

#include <iosfwd>

#include <iostream>

#include <istream>

#include <iterator>

#include <limits>

#include <list>

#include <locale>

#include <map>

#include <memory>

#include <new>

#include <numeric>

#include <ostream>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <stdexcept>

#include <streambuf>

#include <string>

#include <typeinfo>

#include <utility>

#include <valarray>

#include <vector>



#if __cplusplus >= 201103L

#include <array>

#include <atomic>

#include <chrono>

#include <condition_variable>

#include <forward_list>

#include <future>

#include <initializer_list>

#include <mutex>

#include <random>

#include <ratio>

#include <regex>

#include <scoped_allocator>

#include <system_error>

#include <thread>

#include <tuple>

#include <typeindex>

#include <type_traits>

#include <unordered_map>

#include <unordered_set>

#endif
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> l(n);
	for (int i = 0;i < n;i++) {
		cin >> l[i];
	}
	sort(l.begin(), l.end());
	int ans = 0;
	for (int i = 0;i < k;i++) {
		ans += l[n - 1 - i];
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char s[200001];
int main(){
  int i,n,w=0;
  long long a=0;
  scanf("%s",s);
  n=strlen(s);
  for(i=0;i<n;i++){
    if(s[i]=='W'){
      a=a+(i-w);
      w++;
    }
  }
  printf("%lld\n",a);
  return 0;
}


Measured memory_bytes: 384
import scala.math._

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val s = sc.next
//  val h = List.fill(n)(sc.nextInt)

  val ans = s match {
    case "SUN" => 7
    case "MON" => 6
    case "TUE" => 5
    case "WED" => 4
    case "THU" => 3
    case "FRI" => 2
    case "SAT" => 1
  }

  println(ans)

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

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 25788