akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll x,y;
  char c;
  cin >> x >> c >> y;
  if(c=='+') pr(x+y);
  else pr(x-y);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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


signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ;

	string s ;
	cin >> s ; 
	if(s.back() == 's')
	{
		
		cout << s << "es" ;
	}
	else 
		cout << s << 's' ;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#define N 40
using namespace std;

int d[N];
int p[N];
void mergeSort(int, int);
void merge(int, int, int);
int main(){
  int n;
  int ans1[N], ans2[N];
  int data[21];
  while(1){
    cin >> n;
    if(n==0) break;

    for(int i=0;i<n;i++){
      cin >> d[i];
      int size;
      char tmp;
      for(int j=0;;j++){
        scanf("%c", &tmp);
        if(tmp=='\n'){
          size=j;
          break;
        }
        scanf("%d", &data[j]);
      }
      int now=1;
      p[i]=0;
      int f=1;
      for(int count=0;count<size;count++){
        if(f==10){
          if(data[count]==10 & data[count+1]==10 && data[count+2]==10){
            p[i]+=30;
          }
          else if(data[count]==10){
            p[i]+=10+data[count+1]+data[count+2];
          }
          else if((data[count]+data[count+1]==10)){
            p[i]+=10+data[count+2];
          }
          else p[i]+=data[count]+data[count+1];
          break;
        }
        if(now==1){
          if(data[count]==10){
            p[i]+=10+data[count+1]+data[count+2];
            f++;
            continue;
          }
          else{
            p[i]+=data[count];
            now=2;
          }
        }
        else{
          p[i]+=data[count];
          if((data[count]+data[count-1])==10){
            p[i]+=data[count+1];
          }
          now=1;
          f++;
        }
      }
    }
    mergeSort(0, n);
    for(int i=0;i<n;i++){
      ans1[i]=p[n-i-1];
      ans2[i]=d[n-i-1];
    }
    for(int i=0;i<n-1;i++){
      int left, right;
      if(ans1[i]==ans1[i+1]){
        left=i;
        for(int j=i+1;;j++){
          if(j>=n){
            right=n;
            i=j-1;
            break;
          }
          if(ans1[i]!=ans1[j]){
            right=j;
            i=j-1;
            break;
          }
        }
        sort(ans2+left, ans2+right);
      }
    }
    for(int i=0;i<n;i++){
      cout << ans2[i] << ' ' << ans1[i] << endl;
    }
  }
  return 0;
}

void merge(int left, int mid, int right){
  int L[N/2+2], R[N/2+2];
  int l[N/2+2], r[N/2+2];
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++){
    L[i]=p[left+i];
    l[i]=d[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=p[mid+i];
    r[i]=d[mid+i];
  }
  L[n1]=R[n2]=2147483647;
  l[n1]=r[n2]=2147483647;
  int i, j;
  i=j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]){
      p[k]=L[i];
     d[k]=l[i++];
    }
    else{
      p[k]=R[j];
      d[k]=r[j++];
    }
  }
}

void mergeSort(int left, int right){
  if(left>=right-1) return;
  int mid=(left+right)/2;
  mergeSort(left, mid);
  mergeSort(mid, right);
  merge(left, mid, right);
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            int iX = int.Parse(sS[1]);
            List<int> lstInp = new List<int>();
            sS = System.Console.ReadLine().Trim().Split(' ');
            for (int i = 0; i < sS.Length; i++) { lstInp.Add(int.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            List<int> lstOut = new List<int>() { 0 };
            for (int i = 0; i < lstInp.Count; i++)
            {
                int iNow = lstOut[i] + lstInp[i];
                if (iNow > iX) { break; }
                lstOut.Add(iNow);
            }

            // 出力
            System.Console.WriteLine("{0}", lstOut.Count.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

using namespace std;

bool is_prime(int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}

bool like_2017(int n) {
  if (n % 2 == 0) return false;
  return is_prime(n) and is_prime((n + 1) / 2);
}

int main() {
  int Q;
  cin >> Q;
  vector<int> L(Q), R(Q);
  for (int i = 0; i < Q; i++) {
    cin >> L[i] >> R[i];
  }
  vector<int> P(100005);
  for (int i = 2; i <= 100000; i++) {
    P[i] = like_2017(i);
    P[i] += P[i - 1];
  }
  for (int i = 0; i < Q; i++) {
    cout << P[R[i]] - P[L[i] - 1] << endl;
  }

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);

int main(){
 IOS
 ll n,k;
 cin>>n>>k;
 if(n==2){
 	if(k==0) {
 		cout<<1<<endl;
 		cout<<1<<" "<<2<<endl;
 	}
 	else cout<<-1<<endl;
 	return 0;
 }
 if(k>((n-1)*(n-2))/2) {
 	cout<<-1<<endl;
 	return 0;
 }
 ll total_da=((n-1)*(n-2))/2;
 //dbg(total_da);
 ll curr=0;
 ll extra=((n-1)*(n-2))/2-k;
 ll this_day=n-2;
 ll node=2;
 ll tmp;
 //dbg(extra);
 ll check=0;
 std::vector<pair<ll,ll>> edges;
 while(true){
 	if(curr==extra) break;
 	if(curr+this_day<extra){
 		
 		FOR(i,1,this_day){
 			edges.pb({node,node+i});
 			check++;
 		}
 		curr+=this_day;

 	}
 	else {
 		tmp=extra-curr;
 		FOR(i,1,tmp){
 			edges.pb({node,node+i});
 			check++;
 		}
 		break;

 	}
 	//dbg(curr);
 	node++;
 	this_day--;
 	if(curr==extra) break;

 }
  //dbg(check);
  ll total_edges=sz(edges);

 FOR(i,2,n){
 	total_edges++;
 	

 }
 cout<<total_edges<<endl;
 FOR(i,2,n){
 	
 	cout<<1<<" "<<i<<endl;

 }
 for(auto kk:edges){
 	cout<<kk.first<<" "<<kk.second<<endl;
 }


}

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

#define M 1005
#define MOD 100000000
#define PI 3.14159265358979323846
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
typedef pair<lli,lli> PLL;

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

	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);

	lli a;
	long double b;

	cin>>a>>b;

	long double res = a*b;
	lli ans = res;
	cout<<ans<<"\n";

}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
const double pi=acos(-1.0);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int main(void){
    long long l,r,d;
    cin>>l>>r>>d;
    int cnt=0;
    for(int i=l;i<=r;++i){
        if(i%d==0)cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3520
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons;
import core.bitop, core.thread;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) throw new EOFException; tokens = readln.split; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return readToken().to!int; }
long readLong() { return readToken().to!long; }
real readReal() { return readToken().to!real; }

void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); }


immutable INF = 10^^9 + 10;

int N, K;
int[] H;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      K = readInt();
      H = new int[N];
      foreach (i; 0 .. N) {
        H[i] = readInt();
      }
      auto dp = new int[N];
      dp[] = INF;
      dp[0] = 0;
      foreach (i; 0 .. N) {
        foreach (j; i + 1 .. i + 1 + K) {
          if (j < N) {
            chmin(dp[j], dp[i] + abs(H[i] - H[j]));
          }
        }
      }
      writeln(dp[N - 1]);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 4280
def solve():
    M, D = map(int, input().split())
    count = 0
    for d in range(1, D + 1):
        d1 = d % 10
        d10 = int(d / 10)
        if d1 >= 2 and d10 >= 2 and 0 < d1 * d10 <= M:
            count += 1
    print(count)


if __name__ == '__main__':
    solve()


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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> a(N);
	for (auto& e: a) scanf("%d", &e);
	std::vector<int> status;
	status.reserve(N);
	status.push_back(1 << 30);
	for (int i{}; i + 1 < N; i++)
	{
		int next;
		if (a[i] < a[i + 1]) next = 1;
		else if (a[i] == a[i + 1]) next = 0;
		else next = -1;
		if (status.back() != next)
			status.push_back(next);
	}
	int count[5]{};
	for (int i{2}; i + 1 < (int)status.size(); i++)
	{
		if (status[i]) continue;
		int terrain{};
		if (status[i - 1] * status[i + 1] > 0)
			terrain = 2;
		else if (status[i - 1] < 0)
			terrain = 1;
		count[terrain]++;
	}
	for (int i{1}; i + 1 < (int)status.size(); i++)
	{
		if (status[i] > 0 && status[i + 1] < 0)
			count[3]++;
		if (status[i] < 0 && status[i + 1] > 0)
			count[4]++;
	}
	for (int i{}; i < 5; i++)
		printf("%d%c", count[i], i == 4?'\n':' ');

	return 0;
}


Measured memory_bytes: 3632
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
	     Scanner scn=new Scanner(System.in);
	     int h =scn.nextInt();
	     int w =scn.nextInt();
	     
	     
	     int t =scn.nextInt();
	  //   int [][]arr3 =new int[h][w];
	     HashMap<String ,Long> hm=new HashMap<>();
	     pair []arr =new pair[h];
	     pair[]arr2=new pair[w];
	     for(int i=0;i<h;i++){
	    	 arr[i]=new pair(i,0);
	     }
	     for(int i=0;i<w;i++){
	    	 arr2[i]=new pair(i,0);
	     }
	     while(t-->0){
	    	 int r =scn.nextInt();
	    	 int c =scn.nextInt();
	    	 String s = (r-1)+" "+(c-1);
	    	  hm.put(s, 1l);
	    	  arr[r-1].val++;
	    	  arr2[c-1].val++;
	    	 
	    	 
	     }
	      Arrays.sort(arr);
	      Arrays.sort(arr2);
	      long ans=0;
	      for(int i=0;i<h;i++){
	        String s =arr[i].idx+" "+arr2[0].idx;
	        long max=arr[i].val+arr2[0].val;
	        if(hm.containsKey(s)){
	        	max--;
	        }
	        ans=Math.max(ans, max);
	      }
	      for(int i=0;i<w;i++){
		        String s =arr[0].idx+" "+arr2[i].idx;
		        long max=arr[0].val+arr2[i].val;
		        if(hm.containsKey(s)){
		        	max--;
		        }
		        ans=Math.max(ans, max);
		      }
	      
	   System.out.println(ans);

	}
	public static class pair implements Comparable<pair>{
		long val;
		int idx;
		public pair(int idx  , long val){
			 this.idx=idx;
			this.val=val;
		}
		public int compareTo(pair o){
			return (int)(o.val-this.val);
		}
	}

}

Measured memory_bytes: 124460
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define CLR(a) memset(a, 0, sizeof(a))
#define DBG(x) cout<<(#x)<<"="<<x<<endl
#define FOR(i, a, b)  for(int i=(a); i<(b); i++)
#define REP(i, a, b)  for(int i=(a); i<=(b); i++)
#define DOWN(i, a, b) for(int i=(a); i>=(b); i--)

using namespace std;

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

const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const ll LL_INf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1000000009;
const int N= 1e5 +10;

ll n,k,tmp,ans;

int main(){
	cin>>n>>k;
	if (k==0) {
		cout<<n*n<<endl;
		return 0;
	} 
	REP(i, k+1, n) {
		ans+=n/(i)*(i-k);
		tmp=n-n/i*i;
		if (tmp>=k) ans+=tmp-k+1;
	}
	cout<<ans<<endl;
	//cout<<1.*clock()/CLOCKS_PER_SEC<<"ms"<<"\n";
	return 0;
}

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

int64_t a[63][100010];
int64_t sum[63][100010];

int main() {
	int64_t n, x, m; cin >> n >> x >> m;
	for(int64_t i = 0; i < m; ++i) {
		a[0][i] = (i * i) % m;
		sum[0][i] = (i * i) % m;
	}
	for(int64_t i = 0; i < 60; ++i) {
		for(int64_t j = 0; j < m; ++j) {
			a[i + 1][j] = a[i][a[i][j]];
			sum[i + 1][j] = sum[i][j] + sum[i][a[i][j]];
		}
	}
	int now = x;
	int64_t ans = x;
	--n;
	for(int64_t i = 0; i < 60; ++i) {
		if(n >> i & 1) {
			ans += sum[i][now];
			now = a[i][now];
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 98944
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    a,b=map(int, input().split())
    s=a*b
    l=2*(a+b)
    print(s,l)
    

main()


Measured memory_bytes: 5992
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;

int main() {
    string a;
    cin >> a;
    bool d = false;
    for (int i = 0; i < 3; i++) {
        if (a.at(i) == '7')d = true;
    }
    if (d)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main () {
	int n, k;
	cin >> n >> k;
	int monster[n];
	for(int i = 0; i < n; i++) {
		cin >> monster[i];
	}
	sort(monster, monster + n);
	long long ans = 0;
	for(int i = n - 1; i >= 0; i--) {
		if(k > 0) {
			k -= 1;
		}else {
			ans += monster[i];
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int i,n,k;
	cin>>n>>k;
	int l[n],ans=0;
	for(i=0;i<n;i++)cin>>l[i];
	sort(l,l+n);
	for(i=n-k;i<n;i++){
		ans+=l[i];
	}
	cout<<ans<<endl;
	
	return 0;
}

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

int N;
int t[100010], x[100010], y[100010];

int main()
{
    cin >> N;
    for (int i = 1; i <= N; i++)
    {
        cin >> t[i] >> x[i] >> y[i];
    }

    t[0] = 0;
    x[0] = 0, y[0] = 0;

    for (int i = 0; i + 1 <= N; i++)
    {
        int dt = t[i + 1] - t[i];
        int dx = abs(x[i + 1] - x[i]);
        int dy = abs(y[i + 1] - y[i]);

        if (dt < dx + dy || dt % 2 != (dx + dy) % 2)
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 1408
# -*- coding: utf-8 -*-
(N,T) = map(int,input().split(" "))
t = list(map(int,input().split(" ")))

diffs=0
for i in range(1,N):
    diff = t[i] - t[i-1]
    if diff < T:
        diffs = diffs + T - diff

print(T*N-diffs)

Measured memory_bytes: 26836
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, ll> P;

#define N_OVERSIZE 100050
vector<P> root[N_OVERSIZE];
int color[N_OVERSIZE] = {0}; //white 0, black 1

void dfs(int v, int p){
    for (auto next: root[v]){
        if (next.first == p) continue;
        if (next.second % 2 == 0) color[next.first]=color[v];
        else color[next.first]=color[v]^1;
        dfs(next.first, v);
    }
    return;
}

bool visited[N_OVERSIZE];
void dfs_(int v){
    //if (root[v].size() == 1)

    return;
}

int main()
{
    int n;
    cin >> n;
    rep(i, n-1){ 
        int tmpu, tmpv, tmpw; 
        cin >> tmpu >> tmpv >> tmpw;
        tmpu--; tmpv--; 
        root[tmpu].push_back(P(tmpv, tmpw));
        root[tmpv].push_back(P(tmpu, tmpw));
    }

    color[0] = 0; //white_start
    dfs(0, -1); 

    rep(i, n){
        cout << (color[i] == 1 ? 1: 0) << endl;
    }

}



Measured memory_bytes: 9856
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

ll md(ll x1, ll y1, ll x2, ll y2){
    return abs(x1-x2) + abs(y1-y2);
}

ll id(ll x1, ll y1, ll x2, ll y2){
    max(abs(x2-x1), abs(y2-y1));
}

int main()
{
    ll N;
    cin >> N;
    vector<ll> x(N), y(N);
    rep(i, N){
        cin >> x.at(i) >> y.at(i);
    }
    ll t = -1 * INF;
    rep(i, N){
        chmax(t, x.at(i)-y.at(i));
    }
    ll u = INF;
    rep(i, N){
        chmin(u, x.at(i)-y.at(i));
    }
    ll v = -1 * INF;
    rep(i, N){
        chmax(v, x.at(i)+y.at(i));
    }
    ll w = INF;
    rep(i, N){
        chmin(w, x.at(i)+y.at(i));
    }
    cout << max(t-u, v-w) << endl;
}

Measured memory_bytes: 6344
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,as=100;
  cin >> n;
  for(int64_t i=1;;i++){
    as+=(int64_t)as*1/100;
    if(as>=n){
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 3648
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int main()
{
	int n; ll k;
	cin>>n>>k;
	ll a[200020];
	ll s[200020]; s[0]=0;
	for(int i=0; i<n; i++){
		cin>>a[i];
		s[i+1]=s[i]+a[i];
		s[i+1]%=k;
	}
	for(int i=0; i<=n; i++){
		s[i]=(s[i]-i%k+k)%k;
	}
	if(k>n){
		map<ll, ll> mp;
		for(int i=0; i<=n; i++){
			mp[s[i]]++;
		}
		ll ans=0;
		for(auto p:mp){
			ans+=p.second*(p.second-1)/2;
		}
		cout<<ans<<endl;
		return 0;
	}
	vector<int> v[200020];
	for(int i=0; i<=n; i++) v[s[i]].push_back(i);
	ll ans=0;
	for(int i=0; i<k; i++){
		for(int j=0; j<v[i].size(); j++){
			int t=lower_bound(v[i].begin(), v[i].end(), v[i][j]+k)-v[i].begin();
			ans+=t-j-1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 17280
#include <bits/stdc++.h>
using namespace std;
int main() {
  long int a, b, c, k;
  cin >> a >> b >> c >> k;
  if (k % 2 == 0) {
    if (a - b >= pow(10, 18)) cout << "Unfair" << endl;
    else cout << a - b << endl;
  }
  else {
    if (b - a >= pow(10, 18)) cout << "Unfair" << endl;
    else cout << b - a << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		// スペース区切りの整数の入力
		int r = sc.nextInt();
		int i;
		if (n<10) {
			i=r+1000-100*n;
		} else {
			i=r;
		}
		System.out.println(i);
	}
}

Measured memory_bytes: 22612
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        int H;
        int W;
        int A;
        int B;
        int MOD = (int) 1e9 + 7;
        private static int MAX = 200000;
        private static long[] xs = new long[MAX + 1];
        private static long[] ys = new long[MAX + 1];

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            H = in.nextInt();
            W = in.nextInt();
            A = in.nextInt();
            B = in.nextInt();

            long ans = 0;
            for (int i = B; i < W; i++) {
                long x1 = comb(i + H - A - 1, i);
                long x2 = comb(W - i - 1 + A - 1, W - i - 1);
                ans += x1 * x2 % MOD;
                ans %= MOD;
            }
            out.println(ans);
        }

        private long comb(int n, int r) {
            if (r < 0 || r > n) return 0;
            if (xs[0] == 0) {
                xs[0] = 1;
                for (int i = 1; i <= MAX; i++) {
                    xs[i] = xs[i - 1] * i % MOD;
                }
                long inv = modpow(xs[MAX]);
                ys[MAX] = inv;
                for (int i = MAX; i >= 1; i--) {
                    inv = inv * i % MOD;
                    ys[i - 1] = inv;
                }
            }
            return xs[n] * (ys[r] * ys[n - r] % MOD) % MOD;
        }

        private long modpow(long a) {
            return modpow(a, MOD - 2);
        }

        private long modpow(long a, long n) {
            long r = 1;
            while (n > 0) {
                r = r * ((n % 2) != 0 ? a : 1) % MOD;
                a = a * a % MOD;
                n >>= 1;
            }
            return r;
        }

    }
}



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

int main() {
  int n;
  cin >> n;
  int a = n / 100;
  int b = ( n - a * 100 ) / 10;
  int c = n - a * 100 - b * 10; 
  cout << a + b + c << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

ll rui(ll a,ll b){
     ll ans=1;
     while(b>0){
        if(b&1) ans=ans*a%MOD;
        a=a*a%MOD;
        b/=2;
    }
     return ans;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
    int n; cin >> n; 
    vector<ll> A(n), num(1100000, 0);
    rep(i, n){
        cin >> A[i];
        auto pf = prime_factorize(A[i]);
        for(auto p: pf) chmax(num[p.first], p.second);  
    }
    
    ll LCM = 1;
    for(int v = 2; v < 1100000; v++){
        LCM = LCM * rui(v, num[v]) % MOD;
    }

    ll res = 0;
    for(auto a: A){
        ll inv = modinv(a, MOD);
        ll tmp = LCM * inv % MOD;
        res = (res + tmp) % MOD;
    }
    cout << res << ln;
}



Measured memory_bytes: 9088
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  vector<int> a(n), p(n);
  unordered_map<int,int> mp;
  rep(i, n) {
    cin >> a[i];
    mp[a[i]] += 1;
  }

  int diff = mp.size() - k;
  for (auto&& itr : mp) {
    // debug(itr.second);
    p[itr.second] += 1;
  }

  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (diff > 0) {
      for (int j = 0; j < p[i]; ++j) {
        diff -= 1;
        ans += i;
        if (diff <= 0) break;
      }
    } else {
      break;
    }
  }
  cout << ans << endl;
}


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

int top, S[1000];

void push(int x){
    S[++top] = x;
}

int pop(){
    top--;
    return S[top+1];
}

int main(){
    int a, b;
    top = 0;
    char s[100];
    while(scanf("%s", s) != EOF){
        if(s[0]=='+'){
            a = pop();
            b = pop();
            push(a + b);
        }else if(s[0]=='-'){
            b = pop();
            a = pop();
            push(a - b);
        }else if(s[0]=='*'){
            a = pop();
            b = pop();
            push(a * b);
        }else{
            push(atoi(s));
        }
    }
    printf("%d\n", pop());
    return 0;
}

Measured memory_bytes: 980
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	if((n + 1) / 2 >= k) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    a, b = map(int, input().split())

    if a + b == 15:
        print('+')
    elif a * b == 15:
        print('*')
    else:
        print('x')

if __name__ == '__main__':
    main()


Measured memory_bytes: 61436
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>
#define rep(i,n) for(int i = 0; i <(n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}


int main(void) {
	int A, B, C, i, j, k, cnt, ans, limit;
	bool flag = false;
	scanf("%d %d %d", &A, &B, &C);

	limit = A * B;
	for (i = A; i <= limit; i += A) {
		if (i % B == C) {
			flag = true;
			break;
		}
	}
	if (flag) {
		printf("YES");
	}
	else {
		printf("NO");
	}




	return 0;
}

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

using namespace std;

const int maxn = 2e5 + 9;

vector<int> tree[maxn];
int p[maxn];

int main() {
#if DEBUG
    freopen("in.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, m; cin >> n >> m;
    for (int i = 0; i < n - 1; ++i) {
        int a, b; cin >> a >> b;
        tree[a].push_back(b);
    }
    for (int i = 0; i < m; ++i) {
        int pos, x; cin >> pos >> x;
        p[pos] += x;
    }
    queue<int> q;
    q.push(1);
    while (!q.empty()) {
        int here = q.front();
        q.pop();
        for (auto there : tree[here]) {
            p[there] += p[here];
            q.push(there);
        }
    }
    for (int i = 1; i <= n; ++i) {
        cout << p[i] << ' ';
    }
    cout << '\n';
}



Measured memory_bytes: 14080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = null;
		while ((str = br.readLine()) != null) {
			String input[] = str.split(" ");
			String input_array[] = br.readLine().split(" ");
			int n = Integer.parseInt(input[0]);
			int t = Integer.parseInt(input[1]);
			int sum = 0;
			int mae = 0;
			for (int i = 0; i < n; i++) {
				int ima = Integer.parseInt(input_array[i]);
				int diff = ima- mae;
				if(i != 0){
					if(diff >= t){
						sum += t;
					}else{
						sum += diff;
					}
				}
				mae = ima;
				if(i == n -1){
					sum += t;
				}
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 47060
mod = 10**9+7
import sys
import math
from collections import Counter, defaultdict, deque
import copy

# from itertools import product, permutations, combinations, combinations_with_replacement
# from itertools import accumulate
# from operator import itemgetter
# from bisect import bisect_bound_list,bisect
# from heapq import heappop,heappush
# from math import ceil,floor
# from copy import deepcopy
# from heapq import heappop,heappush,heapify
# import heapq


# def combinations(n, r):
# 	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# def gcd(a, b):
# 	if b == 0:
# 		return a
# 	else:
# 		return gcd(b, a%b)
 
# def lcm(a, b):
# 	return a // gcd(a, b) * b

# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)

# d = defaultdict(int)

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

# リストの要素を改行を挟んで表示する
p2D = lambda x: print(*x, sep="\n")
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

# 入力全てを整数に変換したものの配列を受け取る
# def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))

S = input()
ans = len(S)
N = ans
for i in range(len(S)-1):
    if S[i]!=S[i+1]:
        ans = min(ans, max(i + 1, N - i - 1))
print(ans)


















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

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

    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> right_smaller(n);
    rep(i, n-1){
        ll cnt = 0;
        for(int j = i+1; j<n; ++j){
            if(a[i]>a[j]) ++cnt;
        }
        right_smaller[i] = cnt;
    }

    vector<ll> all_smaller(n);
    rep(i, n){
        ll cnt = 0;
        rep(j, n){
            if(a[i]>a[j]) ++cnt;
        }
        all_smaller[i] = cnt;
    }

    ll res = 0;
    const ll K_SUM = (k*(k-1)/2l)%MOD;
    rep(i, n){
        if(all_smaller[i]==0) continue;
        res = ((res + (right_smaller[i]%MOD * k%MOD) % MOD) % MOD + (all_smaller[i]%MOD) * K_SUM % MOD) % MOD;
    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def min(a,b)
    return a>b ? b : a
end
INF=Float::INFINITY
H,W=get_i
s=array(H)
H.times do|i|
    s[i]=get_nsp
end
Dir_x=[1,0,-1,0]
Dir_y=[0,1,0,-1]
def BFS(map)
    score=array(W,INF,H)
    queue=[]
    queue.push([0,0]) if map[0][0]=="."
    score[0][0]=1
    while queue!=[]
      current_p=queue.shift
      4.times do|i|
          next_x=current_p[0]+Dir_x[i]
          next_y=current_p[1]+Dir_y[i]
          next unless next_x.between?(0,W-1) and next_y.between?(0,H-1) and map[next_y][next_x]=="." and score[next_y][next_x]==INF
          score[next_y][next_x]=min(score[next_y][next_x],score[current_p[1]][current_p[0]]+1)
          queue.push([next_x,next_y])
      end 
    end
    return score[H-1][W-1]
end
all_white=0
H.times do|i|
    W.times do|j|
        all_white+=1 if s[i][j]=="."
    end
end
val=BFS(s)
if val==INF
    puts -1
else
    puts all_white-val
end

Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*既に塗った色の配列　tuple(親、子、その間の辺の色)の配列
  を用意
*/
struct edge{
    int to,color;
};

using Graph = vector<vector<edge>>;

int main() {
    int X,A;
    cin >> X >> A;
    if(X < A) cout << 0 << endl;
    else cout << 10 << endl;
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a,b,c,d,n;
signed main()
{
	
	cin>>n>>a>>b>>c>>d;n--;
	for(int i=n;i>=0;i--)
	{
		int l=a+i*c-(n-i)*d;int r=a+i*d-(n-i)*c;
		//cout<<l<<" "<<r<<endl;
		if(l>r)swap(l,r);
		if(b<=r&&b>=l)cout<<"YES",exit(0);
	}
	cout<<"NO";
}

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

struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007



struct UnionFind {
    vector<int> par, rank;

    UnionFind(int n) : par(n , -1), rank(n, 0) { }
    void init(int n) { par.assign(n, -1), rank.assign(n, 0); }

    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]); //ここで経路圧縮
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

struct Edge {
    ll from, to, cost;
    Edge(ll a, ll b, ll c) {from = a; to = b; cost = c;}
};
bool comp(const Edge &e1, const Edge &e2){
    return e1.cost < e2.cost;
}


ll V;
vector<Edge> es;

ll kruskal() {
    sort(all(es),comp);
    UnionFind tree(V);
    ll res = 0;
    rep(i,es.size()){
        Edge e = es[i];
        if(!tree.same(e.to,e.from)){
            tree.unite(e.to,e.from);
            res += e.cost;
        }
    }
    return res;
}

ll distance(pll P, pll Q){
    ll a = (P.F > Q.F ? P.F - Q.F : Q.F - P.F);
    ll b = (P.S > Q.S ? P.S - Q.S : Q.S - P.S);
    return (a > b ? b : a);
}


int main() {
    cin >> V;
    vector<pii> P(V), X(V), Y(V);
    rep(i,V){
        cin >> P[i].F >> P[i].S;
        X[i] = pii(P[i].F, i);
        Y[i] = pii(P[i].S, i);
    }
    sort(all(X));
    sort(all(Y));

    rep(a,V-1){
        ll i = X[a].S, j = X[a+1].S;
        Edge e = Edge(i,j,distance(P[i],P[j]));
        es.pb(e);
    }
    rep(a,V-1){
        ll i = Y[a].S, j = Y[a+1].S;
        Edge e = Edge(i,j,distance(P[i],P[j]));
        es.pb(e);
    }

    cout << kruskal() << endl;


}


Measured memory_bytes: 10864
//{{{
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define sz(x) (int)((x).size())
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
// clang-format off
void _print() { cerr << "]\033[0m\n"; }
template <typename T> void __print(T x) { cerr << x; }
template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifdef LOCAL
#define debug(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m["; _print(x)
#define debug_arr(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m" << (x) << "\033[0m\n"
#else
#define debug(x...)
#define debug_arr(x...)
#endif
// clang-format on
//}}}

const int N = 2e5 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;

int n;
set<LL> a, b;

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (cin >> n)
    {
        int x, y;
        a.clear();
        b.clear();
        for (int i = 1; i <= n; ++i)
        {
            cin >> x >> y;
            a.insert(x - y);
            b.insert(x + y);
        }

        LL ans1 = *a.rbegin() - *a.begin();
        LL ans2 = *b.rbegin() - *b.begin();
        LL ans = max(ans1, ans2);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 22340
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAX = 2000005;
int fac[MAX], inv[MAX], finv[MAX];

void pre(){
	inv[1]=1;
	for (int i = 2; i <MAX ; i++)
	{
		inv[i]=inv[mod%i]*(mod-mod/i)%mod;
	}
	fac[0]=finv[0]=1;
	for (int i = 1; i < MAX; ++i)
	{
		fac[i]=fac[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
int ncr(int n, int r){
	if(r<0||r>n)return 0;
	return fac[n]*finv[r]%mod*finv[n-r]%mod;
}

int modpow(int x, int n, int m) {
    if (n == 0) return 1%m;
    long long u = modpow(x,n/2,m);
    u = (u*u)%m;
    if (n%2 == 1) u = (u*x)%m;
    return u;
}

string s;
int k;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  pre();
  cin >> k;
  cin >> s;
  int n = s.size();
  int ans = modpow(26,n+k,mod);
  for(int i=0;i<n;i++){
  	ans = (ans - ncr(n+k,i)*modpow(25,n+k-i,mod)%mod + mod)%mod;
  }
  cout << ans << endl;

return 0;
}
///....


Measured memory_bytes: 51212
#include <stdio.h>
#include <stdlib.h>

#define WHITE 0
#define GRAY 1
#define BLACK 2
#define MAX_N 101

int n,time,head,tail;
int *queue;
int *dist;
int *color;
int **matrix;

void enqueue(int);
int dequeue(void);
void bfs(void);

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

  scanf("%d",&n);

  queue = malloc(MAX_N * sizeof(int));
  color = malloc(n * sizeof(int));
  dist = malloc(n * sizeof(int));

  matrix = malloc(n * sizeof(int *));
  for(i = 0 ; i < n ; i++){
    matrix[i] = malloc(n * sizeof(int));
 }
 for(i = 0 ; i < n ; i++){
   dist[i] = -1;
 }
 for(i = 0 ; i < n ; i++){
   for(j = 0 ; j < n ; j++){
     matrix[i][j] = 0;
   }
 }

 for(i = 0 ; i < n ; i++){
    scanf("%d",&u); u--;
    scanf("%d",&k);
    for(j = 0 ; j < k ; j++){
      scanf("%d",&v); v--;
      matrix[u][v] = 1;
    }
  }

  bfs();
  for(i = 0 ; i < n ; i++){
    printf("%d %d\n",i+1,dist[i]);
  }

  for(i = 0 ; i < n ; i++){
    free(matrix[i]);
  }
  free(matrix);
  free(queue);
  free(dist);
  free(color);
  return 0;
}

void bfs(){
  int u,i;

  head = tail = 0;
  color[0] = GRAY;
  dist[0] = 0;
  enqueue(0);

  while(head != tail){
    u = dequeue();
    for(i = 0 ; i < n ; i++){
      if(matrix[u][i] == 1 && color[i] == WHITE){
        color[i] = GRAY;
        dist[i] = dist[u] + 1;
        enqueue(i);
      }
    }
    color[u] = BLACK;
  }
}

void enqueue(int q){
  queue[tail] = q;
  if(++tail == MAX_N+1) tail = 0;
}

int dequeue(){
  int v = queue[head];
  if(++head == MAX_N+1) head = 0;
  return v;
}

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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

/*
int	gcd(int A, int B) {
	while (0!=B) {
		A %=B;
		swap(A, B);
	}
	return A;
}

long	gcd(long A, long B) {
	while (0!=B) {
		A %=B;
		swap(A, B);
	}
	return A;
}

long	lcm(long A, long B) {
	long G=gcd(A, B);
	return A/G*B;
}

long	GCD(vector<long> &A) {
	long B=A.at(0);
	for (long i=1; i<A.size(); i++)
		B =gcd(B, A.at(i));
	return B;
}

long	LCM(vector<long> &A) {
	long B=A.at(0);
	for (long i=1; i<A.size(); i++)
		B =lcm(B, A.at(i));
	return B;
}
*/

int	main() {
	int H, W, N;
	cin >>H >>W >>N;
	if (H>W)
		cout <<(N+H-1)/H <<endl;
		else
		cout <<(N+W-1)/W <<endl;
	return 0;
}



Measured memory_bytes: 256
a= str(input())
kaibun = list(a)
n = int(len(kaibun))
answer = "No"
strongn1 = int((n-1)/2)
strongn2 = int((n+3)/2)
for i in reversed(range((int((n+1)/2)),n)):
    if kaibun[i] == kaibun[n-i-1]:
        answer = "Yes"
    else:
        answer = "No"
        break

if answer == "Yes":
    for i in range(int(strongn1/2)):

        if kaibun[i] == kaibun[strongn1-i-1]:
            answer = "Yes"
        else:
            answer="No"
            break
if answer == "Yes":
    for i in reversed(range(strongn2+int(strongn1/2)-1,n)):
        if kaibun[i] == kaibun[strongn2-2-i+n]:
            answer = "Yes"
        else:
            answer = "No"
            break
print(answer)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int n;
    cin >> n;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(n==i*j){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}
    



Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"
void out(int a, int b) {
	printf("? %d %d\n", a, b);
	fflush(stdout);
	return;
}
int in() {
	int a;
	scanf("%d", &a);
	return a;
}

int main() {
	int N; cin >> N;
	long long int pre = 0;
	vector<int>ans;
	for (int i = 0; i < N; ++i) {
		out(1, i + 1);
		long long  int k = in();
		int s = k - pre;
		ans.insert(ans.end() - s, i);

		pre = k;
	}
	vector<int>aans(N);
	for (int i = 0; i < N; ++i) {
		aans[ans[i]] = i + 1;
	}
	printf("!");
	for (int i = 0; i < ans.size(); ++i) {
		
		printf(" %d",aans[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 288900