akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)

void solve(){
    ll n;
    cin>>n;
    ll k;
    cin>>k;
    ll a[n+1];
    loop(i,1,n+1){
        cin>>a[i];
        // a[i]--;
    }

    ll to[n+1][66];
    loop(i,1,n+1){
        to[i][0] = a[i];
    }

    for(ll i=1; i<66; i++){
        loop(j,1,n+1){
            to[j][i] = to[to[j][i-1]][i-1];
        }
    }

    // loop(i,1,n+1){
    //     loop(j,0,4){
    //         cout<<to[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    ll cur = 1;
    for(ll i=0; i<64; i++){
        if(k&(1ll<<i)){
            // trace(cur, i);
            cur = to[cur][i];
            // trace(cur);
        }
    }
    print(cur);

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


Measured memory_bytes: 108328
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;


public class Main {
    public static void main(String[] args) {
        FastScanner fsc = new FastScanner();
        char[] s=fsc.next().toCharArray();
        int f=0, b=s.length-1;
        while(s[f]!='A'){
            f++;
        } while(s[b]!='Z'){
            b--;
        }
        System.out.println(b-f+1);
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair


int main(){
    string s,t;
    cin >> s >> t;
    ll count=0;
    ll n=s.size();
    for(ll i=0;i<n;i++){
        if(s[i]!=t[i]) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 3844
#include <map>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
//#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;


int main(){
  long long n,k =0;
  cin >> n >> k;
  vector<double> v(n);
  rep(i,n) cin >> v.at(i);
  rep(i,n){
    v.at(i) = (v.at(i)+1)/2;
  }
  double mx = 0;
  double s = 0;
  queue<double> q;
  rep(i,n){
    s += v.at(i);
    q.push(v.at(i));
    if(q.size() > k){
      s -= q.front();
      q.pop();
    }
    if(q.size() == k){
      mx = max(mx,s);
    }
  }
printf("%.10f\n", mx);





  
  // long long n,k =0;
  // cin >> n >> k;
  // vector<double> v(n);
  // rep(i,n) cin >> v.at(i);
  // rep(i,n){
  //   v.at(i) = (v.at(i)+1)/2;
  // }
  // double ans = 0;
  // rep(i,k) ans += v.at(i);
  // vector<double> vans(n-k+1);
  // vans.at(0) = ans;
  // for(int i = 0; i<n-k; i++){
  //   vans.at(i+1) = vans.at(i);
  //   vans.at(i+1) -= v.at(i);
  //   vans.at(i+1) += v.at(i+k);
  // }
  // double ansMax;

  // sort(vans.begin(),vans.end());
  // ansMax = vans.at(n-k);
  // cout << ansMax;



}

Measured memory_bytes: 3456
// Aizu 0258: Kitchen Garden
// 2017.9.8 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

typedef struct { int d, c; } T;
T tbl[4]; int len;

int h[103], d[103];

int cmp(T *a, T *b) { return b->c - a->c; }

int main()
{
	int n, i, j, dd, ans;

	while (scanf("%d", &n) && n) {
		scanf("%d", h);
		for (i = 1; i <= n; i++) scanf("%d", h+i), d[i-1] = h[i] - h[i-1];
		tbl[0].d = d[0], tbl[0].c = 1, len = 1;
		for (i = 1; i < n; i++) {
			for (j = 0; j < len; j++) if (d[i] == tbl[j].d) { tbl[j].c++; break; }
			if (j >= len) tbl[len].d = d[i], tbl[len++].c = 1;
		}
		qsort(tbl, len, sizeof(T), cmp); dd = tbl[0].d;
		if (tbl[0].c > tbl[1].c) {
			for (i = 0; i < n; i++) {
				if (d[i] == dd) continue;
				if (i == 0 && d[1] == dd) ans = h[0]; else ans = h[i+1];
				break;
			}
		} else {
			if      (d[3]+d[2] == d[0]) ans = h[3];
			else if (d[1]+d[2] == d[0]) ans = h[2];
			else                        ans = h[1];
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1860
#include<cstdio>
#include<cstring>
using namespace std;
char du[1000];
int c=-1,f=-1;
int main()
{
    scanf("%s",du);
    for(int i=0;i<strlen(du);i++)
    {
        if(du[i]=='C')
            c=i;
        if(du[i]=='F')
            f=i;
        if(c>=0&&f>=0&&c<f)
        {
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 128
// Last Change: 06/10/2019 18:28:47.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

int main() {
  int ipt, ans = 0, maxVal = 0;

  for (int i = 0; i < 3; ++i) {
    cin >> ipt;
    maxVal = max(ipt, maxVal);
    ans += ipt;
  }

  cout << ans - maxVal << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	ll N,A,B;
	cin>>N>>A>>B;
	
	if(B==1){
		if(N==A){
			rep1(i,N)cout<<i<<" ";
		}
		else cout<<-1<<endl;
		return 0;
	}
	if(A==1){
		if(N==B){
			for(int i=N; i>=1; i--)cout<<i<<" ";
		}
		else cout<<-1<<endl;
		return 0;
	}
	
	if(A+B-1<=N && N<= A*B){
		for(int i=N-A+1;i<=N;i++)cout<<i<<" ";
		int k=N-A;
		if(k%(B-1)==0){
			int q=k/(B-1);
			for(int j=(B-2)*q+1;j>0;j-=q){
				for(int g=j;g<j+q;g++){
					cout<<g<<" ";
				}
			}
		}
		else{
			int q=k/(B-1);
			int r=k%(B-1);
			vector<int> v;
			int p=0;
			v.push_back(p);
			rep1(j,B-1){
				if(j<=B-1-r)p+=q;
				else p+=q+1;
				v.push_back(p);
			}
			for(int j=B-1; j>=1; j--){
				for(int g=v[j-1]+1; g<=v[j]; g++)cout<<g<<" ";
			}
		}
		cout<<endl;
	}
	else{
		cout<<-1<<endl;
	}
}

Measured memory_bytes: 2804
n=int(input())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True)
amax=arr[0]
rbest=amax//2
arr=arr[1:]
r=0
diff=10**18
for i in range(n-1):
  tmp=abs(rbest-arr[i])
  if tmp<diff:
    diff=tmp
    r=arr[i]
print(amax,r)

Measured memory_bytes: 14052
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <math.h>
#include <limits.h>
#include <map>
#include <stack>
#include <list>
#include <deque>

using namespace std;

void binary_convert(int x,vector<bool> &ob){
    for(int i=0;i<20;i++){
        ob[i]=bool(x%2);
        x/=2;
    }
}

bool matching(vector<bool>&x,vector<bool> &y,vector<bool> &ans){
    bool ju=false;
    for(int i=0;i<20;i++){
        if(x[i]&&y[i]){
            ans[i]=true;
            ju=true;
        }
        else{
            if(y[i]){
                x[i]=true;
            }
        }
    }
    return ju;
}

void shrinking(vector<bool> &ans,vector<vector<bool>> &da,int &l,vector<bool> &now){
    bool ju=false;
    for(int i=0;i<20;i++){
        if(ans[i]){
            if(da[l][i]){
                ans[i]=false;
            }
            else{
                ju=true;
            }
        }
        else{
            if(da[l][i]){
                now[i]=false;
            }
        }
    }
    l++;
    if(ju){
        shrinking(ans,da,l,now);
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> inp(n);
    for(int i=0;i<n;i++){
        cin >> inp[i];
    }
    vector<vector<bool>> da(n,vector<bool>(20));
    for(int i=0;i<n;i++){
        binary_convert(inp[i],da[i]);
    }
    int l=0,r=0;
    long long ans=0;
    vector<bool> now(20,false);
    while(r<n){
        vector<bool> memo(20,false);
        if(matching(now,da[r],memo)){
            shrinking(memo,da,l,now);
        }
        ans=(long long)ans+r-l+1;
        r++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 15104
n,x,y = map(int,input().split())
ans = [0]*(n-1)
x -= 1
y -= 1
for i in range(n-1):
    for j in range(i+1,n):
        dist = min(j-i,abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))
        ans[dist-1] += 1
print("\n".join(map(str,ans)))

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int n = tmp[0], k = tmp[1];
	int[] h = ReadIntArray();

	const int Inf = 2000000000;
	int[] dp = new int[n];
	for (int i = 1; i < n; i++) dp[i] = Inf;
	dp[0] = 0;

	for (int i = 0; i < n-1; i++)
	    for (int j = i + 1; j <= i + k && j < n; j++)
		dp[j] = Math.Min(dp[j], dp[i] + Math.Abs(h[j]-h[i]));

	WriteLine(dp[n-1]);
    }
}


Measured memory_bytes: 18400
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void) {

	int N = 0;
	int x = 0;
	int mem = 0;
	string S;
	cin >> N >> S;
	
	for (int i = 0; i < N; i++) {
		if (S[i] == 'I')x++;
		if (S[i] == 'D')x--;
		if (mem < x)mem = x;
	}

	cout << mem << endl;
	return 0;
	



}


Measured memory_bytes: 256
def needed_truck(capacity, weights)
  t = 1
  c = capacity
  weights.each do |w|
    if w <= c
      c -= w
    else
      t += 1
      c = capacity - w
    end
  end
  t
end

n, k = gets.split.map(&:to_i)
weights = (1..n).map { gets.to_i }
min, max = weights.max, weights.inject(:+)
p (min..max).bsearch {|capacity| needed_truck(capacity, weights) <= k }


Measured memory_bytes: 7788
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a,b,v,w,t;
  cin >> a >> v >> b >> w >> t;
  if(a<=b){
    cout << ((v-w)*t >= (b-a) ? "YES\n": "NO\n");
  }else{
    cout << ((v-w)*t >= (a-b) ? "YES\n": "NO\n");
  }

  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 100000000000000

int main(){
  int N;
  cin>>N;
  if(N%2==0){
    cout<<N*(N-2)/2<<endl;
    for(int i=1;i<=N;i++){
      for(int j=i+1;j<=N;j++){
        if(j==i||j==N+1-i){
          continue;
        }
        cout<<i<<" "<<j<<endl;
      }
    }
  }else{
    cout<<(N-1)*(N-1)/2<<endl;
    for(int i=1;i<N;i++){
      for(int j=i+1;j<N;j++){
        if(j==i||j==N-i){
          continue;
        }
        cout<<i<<" "<<j<<endl;
      }
    }
    for(int i=1;i<N;i++){
      cout<<i<<" "<<N<<endl;
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  vector<int> a(3);
  rep(i,3)cin>>a[i];
  sort(a.begin(),a.end());
  	if(a[2]==a[1]+a[0]){
          cout<<"Yes"<<endl;
      }
      else{
          cout<<"No"<<endl;
      }
  return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#include <tuple>
#include <set>
#include <functional>

using namespace std;

// 3 2
// 2 1
//
// + +
// + +
// + +

int main() {
    int H, W;
    int h, w;
    cin >> H >> W;
    cin >> h >> w;

    cout << (H * W) - W * h - H * w + h * w;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll L,R,d;
    cin >> L >> R >> d;
    ll ans = (R/d) - ((L-1)/d);
    cout << ans << endl;
}


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define SI size()
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PF push_front
#define PB push_back
#define VE vector<int>
#define VP vector<PA>
#define LL long long
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
  LL N;
  LL A[100000];
  LL S=0;
  cin>>N;
  FOR(i,0,N){
    cin>>A[i];
    S+=A[i];
  }
  if(S%(N*(N+1)/2)!=0){
    YES(0);
    return 0;
  }
  LL num=S/(N*(N+1)/2);
  LL D[100000];
  FOR(i,0,N){
    if(i==N-1){
      D[i]=A[i]-A[0];
    }else{
      D[i]=A[i]-A[i+1];
    }
  }
  FOR(i,0,N){
    D[i]+=num;
    if(D[i]%N||D[i]<0){
      YES(0);
      return 0;
    }
  }
  YES(1);
  return 0;
}


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

int n, t, a, h[1010];

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

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

    int ans = 1;
    double mi = 1000000000.0;
    for (int i = 0; i < n; i++)
    {
        double diff = abs(a - (t-h[i]*0.006));
        if(mi>diff){
            mi = diff;
            ans = i+1;
        }
        
    }
    cout << ans << endl;    
        
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define finish(x) return cout << x << endl, 0;
#define ll long long

int q, l, r, seive[100001], ans[100001];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    seive[1] = 1;
    for(int i = 2 ; i <= 100000 ; i++) if(seive[i] == 0)
        for(int j = i+i ; j <= 100000 ; j += i)
            seive[j] = 1;

    for(int i = 1 ; i <= 100000 ; i++)
        ans[i] = ans[i-1]+(i%2 && seive[i] == 0 && seive[(i+1)/2] == 0);
    cin >> q;
    while(q-- && cin >> l >> r)
        cout << ans[r]-ans[l-1] << endl;
    return 0;
}


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

b = [0 for _ in range(n)]
i = 0
j = n - 1

while(j >= 0):
    b[i] = a[j]
    i += 1
    j -= 2

j = 0 if j == -1 else 1

while(i < n):
    b[i] = a[j]
    i += 1
    j += 2

ans = ' '.join(map(str, b))
print(ans)

Measured memory_bytes: 29760
#include<stdio.h>
int main(void) {
	int n, m;
	
	int i, j;

	scanf("%d", &n);
	scanf("%d", &m);

	int l[1000];

	for (i = 0; i < n; i++) {
		scanf("%d", &l[i]);
	}

	int count = 1;
	int ans = 0;

	for (i = 0; i < n; i++) {
		ans = ans + l[i];
		if (ans <= m) {
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}

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

long gcd(long n, long m)
{
    long x = std::min(n,m);
    long y = std::max(n,m);
    if(y%x==0) return x;
    return gcd(y%x,x);
}

int main(){
    long long n,m;
    std::cin >> n >> m;
    std::cout << gcd(n,m) << "\n";
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007

bool dbgflag = false;

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

  int n;
  cin >> n;
  
  n %= 10;
  if ((n == 2) || (n == 4) || (n == 5) || (n == 7) || (n == 9)) {
    cout << "hon" << endl;
  }
  else if ((n == 0) || (n == 1) || (n == 6) || (n == 8)) {
    cout << "pon" << endl;
  }
  else {
    cout << "bon" << endl;
  }
} 


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

int main() {
  int N, pos;
  cin >> N;
  vector<int> h(N);
  vector<int> costs(100000);

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

  pos = N-1;

  for (int i=0; i<N; i++) {
    if (pos == N-1) {
      costs[pos] = 0;
    } else if (pos == N-2) {
      costs[pos] = abs(h[N-1] - h[N-2]);
    } else {
      int onesteptwice = costs[pos+1] + abs(h[pos] - h[pos+1]);
      int twostepsonce = costs[pos+2] + abs(h[pos] - h[pos+2]);
      costs[pos] = min(onesteptwice, twostepsonce);
    }

    //printf("cost at pos %d: %d\n", pos, costs[pos]);
    pos--;
  }

  printf("%d", costs[0]);

  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <utility>
#include <list>
#include <iterator>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in(gcu());}
_sc(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
//_sc(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename H,typename... T> _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
template <typename T>
_vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for (char c: s) pcu(c);}
template <typename H,typename... T> _vo(H&& h, T&&... t){out(h);out(move(t)...);}
//template <typename T> _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
_vl(){out('\n');}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	int n = in();
	list<int> l;
	auto i = l.begin();
	while (n--) {
		switch (in()) {
		case 0:
			i = l.insert(i, in());
			break;
		case 1:
			advance(i, in());
			break;
		default:
			i = l.erase(i);
		}
	}
	for (int x: l)
		outl(x);
}


Measured memory_bytes: 18124
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N, M;
  cin >> N >> M;
  vector<string> A(N);
  vector<string> B(M);
  rep(i, N) cin >> A[i];
  rep(i, M) cin >> B[i];

  rep(i, N - M + 1){
    rep(j, N - M + 1){
      if(A[i][j] != B[0][0]) continue;

      bool found = true;

      rep(k, M){
        if(A[i + k].substr(j, M) != B[k]){
          found = false;
          break;
        }
      }

      if(found){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
D1 = []
D2 = []

D1.append(abs(A[0]))
D2.append(abs(A[1]))

for i in range(1,N):
  D1.append(abs(A[i]-A[i-1]))
D1.append(abs(A[N-1]))

for i in range(1,N-1):
  D2.append(abs(A[i+1]-A[i-1]))
D2.append(abs(A[N-2]))

S = sum(D1)

for i in range(N):
  print(S-D1[i]-D1[i+1]+D2[i])

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

int main(){
	int n;
	cin >> n;
	int *array = new int[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 << " ";
	}

	cout << endl;
	
	return 0;
}

Measured memory_bytes: 1188
#include<cstdio> 
#include<stack>
using namespace std; 
int read()
{
	int a=0;
	char ch=getchar();
	while (ch<'0' || ch>'9'){ ch=getchar(); }
	while (ch>='0' && ch<='9') { a=a*10+ch-48;ch=getchar(); }
	return a;
}

int main()
{
	int x=read();
	if (x==1) printf("%d",0);
	else printf("%d",1);
	return 0;
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    int h,w,k;
    cin>>h>>w>>k;
    char c[h][w];
    rep(i,h) rep(j,w) cin>>c[i][j];

    int ans=0;
    rep(bit1,1<<h){
        rep(bit2,1<<w){
            int tmp=0;
            rep(i,h){
                rep(j,w){
                    if((bit1 & 1<<i) || (bit2 & 1<<j) || c[i][j]=='.') continue;
                    tmp++;
                }
            }
            if(tmp==k) ans++;
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

ll b(ll n, ll d, vector<ll> x, vector<ll> y) {
  ll res = 0; 
  for(int i=0;i<n;i++) {
    if((x[i] * x[i] + y[i] * y[i]) <= d * d) {
      //cout << x[i] << " - " << y[i] << endl;
      res++;
    }
  }
  return res;
}

int main() {
  ll n, d;
  cin >> n >> d;
  vector<ll> x(n);
  vector<ll> y(n);
  for(int i=0;i<n;i++) {
    cin >> x[i] >> y[i];
  }
  cout << b(n, d,x, y);
}

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

const int MOD = 1e9 + 7;

inline int mod_add(int a, int b, int m = MOD) {
    int sum = a + b;
    return sum >= m ? sum - m : sum;
}

int N;
string S;

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

    cin >> N >> S;
    vector<int> dp(N, 1), next_dp(N);

    for (int i = 0; i < N - 1; i++) {
        int start_count = N - i;
        int end_count = start_count - 1;
        next_dp.assign(end_count, 0);

        if (S[i] == '<') {
            int running_sum = 0;

            for (int j = 0; j < end_count; j++) {
                running_sum = mod_add(running_sum, dp[j]);
                next_dp[j] = running_sum;
            }
        } else if (S[i] == '>') {
            int running_sum = 0;

            for (int j = end_count - 1; j >= 0; j--) {
                running_sum = mod_add(running_sum, dp[j + 1]);
                next_dp[j] = running_sum;
            }
        } else {
            assert(false);
        }

        swap(dp, next_dp);
    }

    printf("%d\n", dp[0]);
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
int a[100000], b[100000], c[100000], ord[100000], tmp[100000];

void re(int *a) {
    forn(i, n) tmp[i] = a[ord[i]];
    forn(i, n) a[i] = tmp[i];
}

inline bool cmpX(const int &lhs, const int &rhs) {
    return -a[lhs] * b[rhs] < -a[rhs] * b[lhs];
}

inline bool cmpY(const int &lhs, const int &rhs) {
    return -b[lhs] * a[rhs] < -b[rhs] * a[lhs];
}

pair<double, int> p[100000];

int fen[100000];

void fenInc(int pos) {
    for (; pos < n; pos |= pos + 1) {
        ++fen[pos];
    }
}

int fenGet(int pos) {
    int res = 0;
    for (; pos >= 0; pos = (pos & (pos + 1)) - 1) {
        res += fen[pos];
    }
    return res;
}

int main() {
    scanf("%d", &n);
    forn(i, n) {
        scanf("%d%d%d", a + i, b + i, c + i);
        c[i] *= -1;
        if (b[i] < 0) {
            a[i] *= -1;
            b[i] *= -1;
            c[i] *= -1;
        }
    }

    forn(i, n) ord[i] = i;
    sort(ord, ord + n, cmpX);
    re(a);
    re(b);
    re(c);
    double lo = -1e13, hi = 1e13, mid;
    forn(_, 100) {
        mid = (lo + hi) / 2;
        forn(i, n) p[i] = mp((-c[i] - a[i] * mid) / b[i], i);
        sort(p, p + n);
        LL cnt = 0;
        memset(fen, 0, sizeof fen);
        forn(i, n) {
            cnt += fenGet(p[i].second);
            fenInc(p[i].second);
        }
        if (cnt < (n * (n - 1) / 2 + 1) / 2) {
            lo = mid;
        } else {
            hi = mid;
        }
    }
    printf("%.15f ", lo);

    forn(i, n) {
        if (a[i] < 0) {
            a[i] *= -1;
            b[i] *= -1;
            c[i] *= -1;
        }
    }
    forn(i, n) ord[i] = i;
    sort(ord, ord + n, cmpY);
    re(a);
    re(b);
    re(c);
    lo = -1e13, hi = 1e13;
    forn(_, 100) {
        mid = (lo + hi) / 2;
        forn(i, n) p[i] = mp((-c[i] - b[i] * mid) / a[i], i);
        sort(p, p + n);
        LL cnt = 0;
        memset(fen, 0, sizeof fen);
        forn(i, n) {
            cnt += fenGet(p[i].second);
            fenInc(p[i].second);
        }
        if (cnt < (n * (n - 1) / 2 + 1) / 2) {
            lo = mid;
        } else {
            hi = mid;
        }
    }
    printf("%.15f\n", lo);
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#ifdef STOPIT
#define debug(...) 0
#else
#define debug(...)\
do {\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;\
} while (false)
#endif

void err() { std::cout << -1 << std::endl; exit(0); }
#define require(exp) do { if (!(exp)) { err(); } } while(false)

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n, k; std::cin >> n >> k;
  if (n + 1 < 2 * k) err();
  std::vector< int > x, y, z;
  rep(i, 0, k) {
    x.emplace_back(k + i);
    y.emplace_back(2*n + i);
    z.emplace_back(2*n + k + 2*i);
  }
  rep(i, 0, k) {
    x.emplace_back(2*k + i);
    y.emplace_back(n + k + i);
    z.emplace_back(2*n + k + 2*i + 1);
  }
  rep(i, 0, n - 2*k) {
    x.emplace_back(3*k + i);
    y.emplace_back(n + 2*k + i);
    z.emplace_back(2*n + 3*k + i);
  }
  rep(i, 0, n) {
    assert(x.at(i) + y.at(i) <= z.at(i));
    std::cout << x.at(i) << " " << y.at(i) << " " << z.at(i) << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define MOD 1000000007
#define pb push_back
#define loop(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define loope(i, b) for (int i = 1; i <= (int)b; i++)
#define loopl(i, a, b) for (ll i = ll(a); i < (ll)b; i++)

int main()
{

    int n, x, t;
    cin >> n >> x >> t;
    int time = 0;
    int taka = 0;
    while (1)
    {
        taka += x;
        time += t;
        if (taka >= n)
        {
            break;
        }
    }
    cout << time << endl;
}

Measured memory_bytes: 3632
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

# まずK回移動する
# 後は直前に開いた扉を進んでいけるので，辺への最短路を進む

H,W,K = LI()
A = [list(input()) for _ in range(H)]

s = (-1,-1)
for i in range(H):
    for j in range(W):
        if A[i][j] == 'S':
            s = (i,j)

def grid_bfs(S,s,default=-1):
    dist = [[default]*W for _ in range(H)]
    can_visit_mark = ['.','S']
    if S[s[0]][s[1]] not in can_visit_mark:
        return dist
    d = [(0,1),(0,-1),(1,0),(-1,0)]
    dist[s[0]][s[1]] = 0
    q = [s]
    counter = 1
    while q:
        q1 = []
        for now in q:
            for delta in d:
                new = (now[0]+delta[0], now[1]+delta[1])
                if 0 <= new[0] <= H-1 and 0 <= new[1] <= W-1:
                    if S[new[0]][new[1]] in can_visit_mark:  
                        if dist[new[0]][new[1]] == -1:
                            dist[new[0]][new[1]] = counter
                            q1.append(new)
        q = q1
        counter += 1
        if counter == K+1:
            break
    return dist

dist = grid_bfs(A,s)

min_ = float('inf')
for i in range(H):
    for j in range(W):
        if dist[i][j] != -1:
            temp = min(i,H-i-1,j,W-j-1)
            if temp < min_:
                min_ = temp

print(1+math.ceil(min_/K))

Measured memory_bytes: 76764
#include<stdio.h>

int main(){
	
	double a,b,c,d,e,f;
	double y,x;
	
	while (1) {
		
	scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f);
		if (getchar() == EOF)break;
		y=(c*d-f*a)/(b*d-e*a);
		x=(c-b*y)/a;
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static int N;
    static int[] D;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        D = sc.nextIntArray(N);
        System.out.println( solve() );
    }

    static int solve() {
        Arrays.sort(D);
        boolean[] R = new boolean[24];
        R[0] = true;

        int[] cnt = new int[13];
        for (int d : D) {
            if( d == 0 ) return 0;

            cnt[d]++;
            if( d != 12 && cnt[d] > 2 ) return 0;
            if( d == 12 && cnt[d] > 1 ) return 0;
        }

        boolean isFst = true;
        for (int i = 0; i < N; i++) {
            int d = D[i];

            // 交互に置いていきたい
            if(isFst && !R[d]) {
                R[d] = true;
                isFst = false;

            } else {
                R[24-d] = true;
                isFst = true;
            }
        }

        int ans = 24;
        int prev = 0;
        for (int i = 1; i < 24; i++) {
            if( R[i] ) {
                ans = Math.min(i - prev, ans);
                prev = i;
            }
        }

        ans = Math.min(24-prev, ans);

        return ans;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<vector<bool>> v(H, vector<bool>(W, false));
  int all = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      char c;
      cin >> c;
      if (c == '#') {
        v[i][j] = true;
        all++;
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < (1 << H); i++) {
    for (int j = 0; j < (1 << W); j++) {
      int tmp = all;
      for (int k = 0; k < H; k++) {
        for (int l = 0; l < W; l++) {
          if ((((i >> k) & 1) || ((j >> l) & 1)) && v[k][l])
            tmp--;
        }
      }
      if (tmp == K)
        ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
n = int(input())

p = list(map(int, input().split()))

a = [(i+1)*n for i in range(n)]
b = [(n-i)*n for i in range(n)]

for i in range(n):
    a[p[i]-1] -= n-i-1
    
sa = ""
sb = ""
for i in range(n):
    sa = sa + str(a[i])
    sb = sb + str(b[i])
    if i != n-1:
        sa = sa + ' '
        sb = sb + ' '
        
print(sa)
print(sb)

Measured memory_bytes: 6712
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val t = (1..2).map { sc.nextInt() }.toMutableList()
    val k = sc.nextInt()
    var ti = 0
    repeat(k) {
        if (t[ti] % 2 == 1) {
            t[ti]--
        }
        val nextTi = (ti + 1) % 2
        t[nextTi] += t[ti] / 2
        t[ti] /= 2
        ti = nextTi
    }
    println(t.joinToString(" "))
}

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

A, B = map(int, input().split(" "))
c = 0
for i in range(A, B + 1):
    num = str(i)
    for j in range(len(num) // 2):
        if num[j] != num[-1 - j]:
            break
        if j == (len(num) // 2 - 1):
            c += 1

print(c)


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

int main(void)
{
	bool prime[1000000];
	unsigned long n;

	for(unsigned long j = 2; j <= 999999; j++)
		prime[j] = true;
	for(int i = 2; i <= 1000; i++) {
		if(prime[i] == true) {
			for(unsigned long j = i * i; j <= 999999; j += i) {
				prime[j] = false;
			}
		}
	}

	while(cin >> n) {
		unsigned cnt = 0;
		for(unsigned long j = 2; j <= n; j++) {
			if(prime[j] == true) {
				cnt++;
			}
		}

		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 2132
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int h, w, white = 0;
    cin >> h >> w;
    vector< vector<int> > board(h + 2, vector<int>(w + 2, 1)), dist(h + 2, vector<int>(w + 2, (1 << 15)));
    for (vector< vector<int> >::size_type i = 1; i <= h; ++i) {
        for (vector<int>::size_type j = 1; j <= w; ++j) {
            char c;
            cin >> c;
            if (c == '.') {
                ++white;
                board.at(i).at(j) = 0;
            }
        }
    }
    queue< pair<int, int> > que;
    que.push(make_pair(1, 1));
    dist.at(1).at(1) = 1;
    vector<int> dx{0, 0, -1, 1}, dy{-1, 1, 0, 0};
    while (!que.empty()) {
        int x = que.front().first, y = que.front().second;
        que.pop();
        for (vector<int>::size_type i = 0; i < 4; ++i) {
            int nx = x + dx.at(i), ny = y + dy.at(i);
            if (board.at(nx).at(ny) || dist.at(nx).at(ny) <= dist.at(x).at(y) + 1) continue;
            que.push(make_pair(nx, ny));
            dist.at(nx).at(ny) = dist.at(x).at(y) + 1;
        }
    }
    if (dist.at(h).at(w) == (1 << 15)) cout << "-1" << endl;
    else cout << white - dist.at(h).at(w) << endl;
    return 0;
}


Measured memory_bytes: 256
K = gets.to_i

wk = K
n = 0
bef = [0,1,1,1,1,1,1,1,1,1]
while 0 < wk do
  w = bef.inject(:+)
  break if wk - w <= 0
  n += 1
  wk -= w
  nxt = Array.new(10, 0)
  (0..9).each{|i|
    nxt[i] += bef[i-1] if i>0
    nxt[i] += bef[i]
    nxt[i] += bef[i+1] if i<9
  }
  bef = nxt
end
@max = n+1
ANS = []
@cnt = wk

def solve(i, d)
  if d == @max then
    @cnt -= 1
    (ANS << i; return true) if @cnt == 0
    return false
  end
  (-1..1).each{|j|
    next if i+j < 0 || 9 < i+j
    ret = solve(i+j, d+1)
    if ret then
      ANS.unshift(i)
      return true
    end
  }
  false
end

(1..9).each{|i|
  break if solve(i, 1)
}
puts ANS.join


Measured memory_bytes: 1916
import sys
input = sys.stdin.readline
from collections import Counter

K = int(input())
S = input().rstrip('\n')

MOD = 10 ** 9 + 7

T = K + len(S)
fac = [1] * (T+1)
for i in range(1, T+1):
	fac[i] = fac[i-1] * i % MOD;

inv = [1] * (T+1)
inv[-1] = pow(fac[-1], MOD-2, MOD)
for i in range(T-1, -1, -1):
	inv[i] = inv[i+1] * (i+1) % MOD

def choose(n, k):
	return fac[n] * inv[n - k] % MOD * inv[k] % MOD

A = 1
l = len(S)
for i in range(K):
	A = A * 26 + pow(25, i+1, MOD) * choose(len(S)+i, i+1)
	A %= MOD

#A = pow(26, len(S)+K, MOD)
#A *= pow(56, MOD-2, MOD)
print(A%MOD)


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

int main()
{
  int MOD=1000000007;
  int n;
  int m;
  cin >>n >>m;
 long long ans;
 long long x=0;
 long long y=0;
 long long bef;
 long long sta;
 for(int i=0;i<n;i++){
   cin >>bef;
   sta = ((i - (n - 1 - i)) * bef)%MOD;
    x += sta;
   x%=MOD;
 }

 for (int i = 0; i < m; i++)
 {
   cin >> bef;
   sta = ((i - (m - 1 - i)) * bef) % MOD;
   y +=sta;
   y %= MOD;
 }
 //cout <<x <<"  " << y<<endl;  
 cout << (x*y)%MOD << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a + b == 15)
		puts("+");
	else if (a*b == 15)
		puts("*");
	else
		puts("x");
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Console.WriteLine(Solve() ? "Yes" : "No");
		Out.Flush();
	}
	bool Solve()
	{
		var N = F;
		var t = new int[N];
		var x = new int[N];
		var y = new int[N];
		for (var i = 0; i < N; i++)
		{
			var I = G;
			t[i] = I[0];
			x[i] = I[1];
			y[i] = I[2];
		}
		int t0 = 0, x0 = 0, y0 = 0;
		for (var i = 0; i < N; i++)
		{
			if (!IsFeasible(t[i] - t0, x[i] - x0, y[i] - y0)) return false;
			t0 = t[i];
			x0 = x[i];
			y0 = y[i];
		}
		return true;
	}
	bool IsFeasible(int dt, int dx, int dy)
	{
		if (dx < 0) dx *= -1;
		if (dy < 0) dy *= -1;
		return (dt % 2) == (dx + dy) % 2 && dt >= dx + dy;
	}
}


Measured memory_bytes: 18400
#include <bits/stdc++.h>
using namespace std;
string s,t,ss;
long long n,m;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>s>>t;

for(int i=0;i<t.size();i++){
        cout<<s[i]<<t[i];
}
if(s.size()!=t.size())cout<<s[s.size()-1];





return 0;
}


Measured memory_bytes: 3652
from heapq import heappush, heappop

N, M = map(int, input().split())
vec = [[] for _ in range(N)]
for _ in range(M) :
  A, B = map(int, input().split())
  vec[A - 1].append(B - 1)
  vec[B - 1].append(A - 1)

q = [(0, 0)]
dist = [float('inf')] * N
dist[0] = 0
ret = [-1] * N
ret[0] = 0

while q :
  cc, cur = heappop(q)
  for nex in vec[cur] :
    if cc + 1 < dist[nex] :
      dist[nex] = cc + 1
      ret[nex] = cur
      heappush(q, (cc + 1, nex))
      
if -1 in ret :
  print('No')
else :
  print('Yes')
  for i in range(1, N) :
    print(ret[i] + 1)

Measured memory_bytes: 102028
def main():
    import sys
    sys.setrecursionlimit(1000000)
    # 行先、上限、逆辺

    def add_edge(From, to, cap):
        g[From][to] = cap
        g[to][-From-1] = 0

    def max_flow(s, t):
        def dfs(v, t, f):
            q.append(v)
            if v == t:
                return f
            used[v] += 1
            for i in range(len(gkey[v])):
                to = gkey[v][i]
                cap = g[v][to]
                if to < 0:
                    to2 = -to-1
                else:
                    to2 = to
                if used[to2] or cap == 0:
                    continue
                d = dfs(to2, t, min(f, cap))
                if d > 0:
                    g[v][to] -= d
                    g[to2][-v-1] += d
                    return d
            q.pop()
            return 0

        flow = 0
        while True:
            used = [0]*n
            q = []
            f = dfs(s, t, 10**100)
            if not q:
                return flow
            flow += f

    h, w = map(int, input().split())
    n = h+w+2
    g = [dict() for _ in range(n)]
    for i in range(h):
        A = input()
        for j in range(w):
            if A[j] == "o":
                add_edge(i, j+h, 1)
                add_edge(j+h, i, 1)
            elif A[j] == "S":
                add_edge(h+w, i, 10**6)
                add_edge(h+w, j+h, 10**6)
            elif A[j] == "T":
                add_edge(i, h+w+1, 10**6)
                add_edge(j+h, h+w+1, 10**6)
    gkey = [list(i.keys()) for i in g]

    ans = max_flow(h+w, h+w+1)
    if ans >= 10**6:
        print(-1)
    else:
        print(ans)


main()


Measured memory_bytes: 60636