akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int width, height, d;
int matrix[1000][1000];
int vect[1000];

bool gauss() {
  int n = width * height;
  int target = 0;
  REP(x, n) {
    int pivot = target;
    FOR(i, target + 1, n) {
      if (matrix[i][x] > matrix[pivot][x]) { pivot = i; break; }
    }
    if (matrix[pivot][x] == 0) { continue; }
    REP(i, n) { swap(matrix[pivot][i], matrix[target][i]); }
    swap(vect[target], vect[pivot]);
    FOR(y, target + 1, n) {
      if (matrix[y][x] == 0) { continue; }
      FOR(i, x, n) {
        matrix[y][i] ^= matrix[target][i];
      }
      vect[y] ^= vect[target];
    }
    target++;
  }
  for (int y = target; y < n; y++) {
    if (vect[y] == 1) { return false; }
  }
  return true;
}

int main() {
  while (scanf("%d %d %d", &width, &height, &d), width|height|d) {
    MEMSET(matrix, 0);
    MEMSET(vect, 0);
    REP(y, height) {
      REP(x, width) {
        scanf("%d", &vect[y * width + x]);
      }
    }
    REP(y1, height) {
      REP(x1, width) {
        REP(y2, height) {
          REP(x2, width) {
            if ((x1 == x2 && y1 == y2) || abs(x1 - x2) + abs(y1 - y2) == d) {
              matrix[y1 * width + x1][y2 * width + x2] = 1;
            }
          }
        }
      }
    }

    if (gauss()) {
      puts("1");
    } else {
      puts("0");
    }
  }
}

Measured memory_bytes: 4764
fun c95(args: Array<String>) {
    val (a, b, c, x, y) = args[0].split(" ").map { it.toInt() }
    val ansList = (0..Math.max(x, y) * 2).map { cNum ->
        Math.max(0, a * (x - cNum / 2)) + Math.max(0, b * (y - cNum / 2)) + c * cNum
    }
    println(ansList.min())
}

fun main(args: Array<String>) {
    c95(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

Measured memory_bytes: 40556
n,T = map(int,input().split())
ans = []
for i in range(n):
    c,t = list(map(int,input().split()))
    ans.append([c,t])

result = []
for i in range(n):
    if ans[i][1] <=T:
        result.append(ans[i][0])
    else:
        result.append(1000000)
if min(result) == 1000000:
    print('TLE')
else:
    print(min(result))

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

int main(){
    cin.tie(0);ios_base::sync_with_stdio(0);
    vector<double> a;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        double k;cin>>k;a.push_back(k);
    }
    sort(a.begin(),a.begin()+n);
    
    int ctr=n-1;
    while(ctr>0){
        ctr--;
        a[0]=(double)(a[0]+a[1])/2;
        a.erase(a.begin()+1);
    }
    cout<<a[0];
    
    return 0;    
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    k, n = na()
    mid = k // 2
    a = na()

    ma = [] #minus
    pa = [] #pls
    for i in range(n - 1):
        x = a[i+1] - a[i]
        if x < 0:
            x = k - abs(x)
        ma.append(x)
    
    for i in range(n - 1, 0, -1):
        x = a[i] - a[i - 1]
        if x < 0:
            x = k - abs(x)
        pa.append(x)

    x = a[-1] - a[0]
    if x < 0:
        x = k - abs(x)
    ma.append(x)
    x = a[0] - a[-1]
    if x < 0:
        x = k - abs(x)
    pa.append(x)
    ma.sort()
    pa.sort()
    
    print(min(sum(ma[:-1]), sum(pa[:-1])))
if __name__ == '__main__':
    main()

Measured memory_bytes: 25936
#include <stdio.h>

int main(void)
{
    int r, g, b;
    scanf("%d%d%d", &r, &g, &b);
    if ((r*100+g*10+b)%4==0) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if (s == u) {
    cout << a - 1 << " " << b;
  } else {
    cout << a << " " << b - 1;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
    int n;
    cin >> n;
    int t[n + 1], x[n + 1], y[n + 1];
    rep (i, n) cin >> t[i + 1] >> x[i + 1] >> y[i + 1];

    bool ok = true;
    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i <= n; i++) {
        if (abs(t[i] - t[i - 1]) < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) ok = false;
        if (abs(t[i] - t[i - 1]) % 2 != (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) % 2) ok = false;
    }
    
    if (ok) yn
    return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int a,b,c;
int ans[3][3];

int main(){
	cin.sync_with_stdio(false);
	cin>>a>>b>>c;
	ans[0][0]=a;ans[0][1]=b;ans[1][1]=c;
	repl(x,1,1111111){
		ans[0][2]=x;
		int sum=0;
		rep(i,3)sum+=ans[0][i];
		ans[2][1]=sum-ans[0][1]-ans[1][1];
		ans[2][2]=sum-ans[0][0]-ans[1][1];
		ans[1][2]=sum-ans[0][2]-ans[2][2];
		ans[2][0]=sum-ans[0][2]-ans[1][1];
		ans[1][0]=sum-ans[0][0]-ans[2][0];
		bool ok=true;
		rep(i,3){
			int asum=0;
			rep(j,3)asum+=ans[i][j];
			if(sum!=asum)ok=false;
		}
		rep(j,3){
			int asum=0;
			rep(i,3)asum+=ans[i][j];
			if(asum!=sum)ok=false;
		}
		int asum=0,bsum=0;
		rep(i,3){
			asum+=ans[i][i];
			bsum+=ans[i][2-i];
		}
		if(asum!=sum||bsum!=sum)ok=false;
		if(ok){
			rep(i,3)rep(j,3){
				printf("%d%c", ans[i][j],(j==2?'\n':' '));
			}
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let n = read::<usize>();
    println!("{}", n * n * n);
}


Measured memory_bytes: 4352
#include<iostream>
#include<map>
#include<string>
#include<vector>

using namespace std;

int main(void){
	while(1){
		int n;
		scanf("%d",&n);
		if(n==0)break;
		map<string,int> sug;
		string s;
		getline(cin,s);
		for(int a=0;a<n;a++){
			string ch;
			getline(cin,s);
			for(int i=0;i<s.size();i++){
				if(i==s.size()-1){
					if(s[i]!=' ')ch+=s[i];
					if(sug.find(ch)!=sug.end()){
						sug[ch]++;
					}else{
						sug.insert( pair<string, int>(ch,1));
					}
					ch.clear();
				}else if(s[i]==' '){
					if(sug.find(ch)!=sug.end()){
						sug[ch]++;
					}else{
						sug.insert( pair<string, int>(ch,1));
					}
					ch.clear();
				}else{
					ch+=s[i];
				}
			}
		}
		map<string,int> sug2;
		string s2;
		cin >> s2;
		map<string,int>::iterator it = sug.begin();
		while( it != sug.end() ){
			string ss=(*it).first;
			if(s2[0]==ss[0])sug2.insert( pair<string, int>((*it).first,(*it).second));
			++it;
		}
		map<string,int>::iterator it2 = sug2.begin();
		int maxs=0;
		while( it2 != sug2.end() ){
			maxs=max(maxs,(*it2).second);
			++it2;
		}
		int e=0;
		while(maxs>0 && e<=5){
			map<string,int>::iterator it3 = sug2.begin();
			while(it3!= sug2.end()){
				if(maxs==(*it3).second && e<=4){
					if(e!=0)cout << " ";
					e++;
					cout << (*it3).first;
				}
				++it3;
			}
			maxs--;
		}
		if(e==0)cout << "NA";
		cout << endl;
	}
    return 0;
}

Measured memory_bytes: 960
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 90000000000000000
signed main(void){
    int h,w,k;cin>>h>>w>>k;
    int V[h][w];
    int now=0;
    rep(i,h)rep(j,w){
        char x;cin>>x;
        if(x=='#'){
            now++;
            V[i][j]=now;
        }
        else V[i][j]=0;
    }
    
    rep(i,h){
        bool ju=false;int now;
        rep(j,w){
            if(V[i][j]!=0){
                ju=true;
                now=V[i][j];
                break;
            }
        }
        if(!ju)continue;
        int j=0;
        while(j<w){
            now=max(now,V[i][j]);
            V[i][j]=now;
            j++;
        }
        
    }

    rep(i,h)rep(j,w){
        if(V[i][j]!=0){
            int c=V[i][j];
            int now=i-1;
            while(now>=0){
                if(V[now][j]!=0)break;
                V[now][j]=c;
                now--;
            }
            now=i+1;
            while(now<h){
                if(V[now][j]!=0)break;
                V[now][j]=c;
                now--;
            }
        }
    }
    
    rep(i,h){
        rep(j,w)cout<<V[i][j]<<' ';
        cout<<endl;
    }
}
        

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#define ll long long
using namespace std;

ll Ceil(ll x,ll y) {
    return (x+y-1)/y;
}

int main() {
    ll H,W,h,w;
    cin>>H>>W>>h>>w;
    
    if (H*W==h*w || h*w == 1) {
        printf("No\n");
        return 0;
    }
    
    // 1 to h
    // H-h+1 to h
    
    
    // H-h+1 to h and W-w+1 to w
    
    // -x + y*(h*w-1) < 0
    // y*(h*w-1) <= x-1
    
    // -x*prod + y*(H*W-prod) >= 1
    // y*(H*W-prod) >= x*prod+1
    
    // i+h-1 <= H
    // i <= H-h+1
    
    // (i,j) -> max(1,i-h+1) to min(i,H-h+1) and max(1,j-w+1) to min(j,W-w+1)
    
    
    // each (i,j) occurs exactly k times.
    
    // h, 2*h,...
    // w, 2*w,...
    
    // (H/h)*(W/w)
    //
    
    ll prod = (H/h)*(W/w);
    
    ll xans,yans;
    bool ok = false;
    for(ll x=1;x<=10000000;x++) {
        ll ymax = (x-1)/(h*w-1);
        ll ymin = Ceil(x*prod+1,H*W-prod);
        if (ymax >= ymin) {
            xans = x;
            yans = ymin;
            ok=true;
            break;
        }
    }
    
    if (ok) {
        printf("Yes\n");
        for(int i=1;i<=H;i++) {
            for(int j=1;j<=W;j++) {
                printf("%lld ",((i)%h==0 && (j)%w==0 ? -xans : yans));
            }
            printf("\n");
        }
    }
    else
        printf("No\n");
    
    return 0;
    
}

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

int main() {
	long long int H;
	cin >> H;
	H = (int)log2(H);
	long long int ans = 1, tmp = 2;
	for (int i = 0; i < H; i++) {
		ans += tmp;
		tmp *= 2;
	}
	cout << ans << endl;
}

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

string _left = "qwertasdfgzxcvb";
bool isLeft[26];

int main() {
	int i;
	string s;
	
	for (i = 0; i < _left.length(); i++) isLeft[_left[i] - 'a'] = true;
	while (cin >> s) {
		if (s == "#") break;
		
		bool dir = isLeft[s[0] - 'a'];
		int ans = 0;
		for (int i = 1; i < s.length(); i++) {
			if (dir != isLeft[s[i] - 'a']) {
				dir = isLeft[s[i] - 'a'];
				ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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


int main() {
    int k,a,b;
    cin >> k >> a >> b;
    
    
    if (a % k == 0) {
        cout << "OK" << endl;
        return 0;
    } else if (b % k == 0) {
        cout << "OK" << endl;
        return 0; 
    }
    int min = a / k + k;
    
    if ((min + k) > b) cout << "NG" << endl;
    else cout << "OK" << endl;
    
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;

int main() {
	int a, b ,c;
	cin >> a >> b >> c;

	if (a == b && b == c && c == a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;

	}
}



Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    for(char c = 'a';c <= 'z';c++){
      String cc = String.valueOf(c);
      String scp = s.replace(cc,"");
      if(s.length() == scp.length()){
        System.out.println(c);
        return;
      }
    }
    System.out.println("None");
  }
}


Measured memory_bytes: 40456
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int x = sc.nextInt();
		int y = sc.nextInt();
		
		System.out.println(x*x -y);
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 20564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)
const ll mod = 1000000007;


struct edge{
	int to,id;
};
vector<vector<edge>> g;
vector<int> ans;

void dfs(int v, int c = -1,int pre=-1) {
	int k = 1;
	rep(i,g[v].size()) {
		int u = g[v][i].to;
		int ei = g[v][i].id;
		if (u == pre) continue;
		if (k == c) ++k;
		ans[ei] = k; k++;
		dfs(u, ans[ei], v);
	}
	return;
}

void slove() {
	int n;
	cin >> n;
	g.resize(n);
	ans = vector<int>(n - 1);
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(edge({b,i}));
		g[b].push_back(edge({a,i}));
	}
	dfs(0);
	int mx = 0;
	rep(i, n - 1) mx = max(mx, int(g[i].size()));
	cout << mx << endl;
	rep(i, n - 1) {
		cout << ans[i] << endl;
	}
	return;
	
}

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

Measured memory_bytes: 8320
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> pippi;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-8;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
//#define endl "\n"
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<int,int,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    if(k<0)return 0;
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int x,n;cin>>x>>n;
    bool bo[102];
    fill(bo,bo+102,false);
    rep(i,0,n){
        int p;cin>>p;
        bo[p]=true;
    }
    int mi=1000000000,ans=-10000;
    rep(i,0,102){
        if(bo[i])continue;
        if(abs(i-x)<mi){
            mi=abs(i-x);
            ans=i;
        }
    }
    cout<<ans<<endl;
}



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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld PI = acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
//const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    int n, m;
    string s; cin >>n >> m ;
    int ans = n/m;
    if(n%m!=0) ans++;
    cout <<  ans<< '\n';
}

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

int main()
{
    int n;
    cin>>n;
    vector<int> x(n);
    priority_queue<INT,vector<INT>,greater<INT>> q;
    for (int i=0;i<n;++i){
        cin>>x.at(i);
    }
    for (int j=0;j<=101;++j){
        INT temp=0;
        for (int i=0;i<n;++i){
            temp+=(x.at(i)-j)*(x.at(i)-j);
        }
        q.push(temp);
    }
    cout<<q.top()<<endl;


}

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

bool has753(ll n){
    bool three,five,seven;
    three = five = seven = false;
    while(n>0){
        ll a = n%10;
        if(a==3){
            three =true;
        }
        if(a==5){
            five=true;
        }
        if(a==7){
            seven = true;
        }
        n /=10;
    }
    if(three&& five && seven){
        return true;
    }
    return false;
}

int main() {
    ll N;
    cin >> N;
    int a[] = {3,5,7}; 
    vector<ll> candidates;
    queue<ll> q;
    q.push(0);
    while(!q.empty()){
        ll t = q.front();
        // cerr << "t="<<t << endl;
        q.pop();
        for(int i=0;i<3;i++){
            ll nt =t*10+a[i];
            // cerr <<  nt<< endl;
            if(nt>N){
                break;
            }
            candidates.push_back(nt);
            q.push(nt);
        }
    }
    // cerr << "f" << endl;
    ll ans =0;
    for(ll t:candidates){
        if(has753(t)){
            ans++;
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 732
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	
	vector<vector<int> > x(N), y(N);
	
	REP(i, N) {
		cin >> A[i];
		x[i].resize(A[i]);
		y[i].resize(A[i]);
		REP(j, A[i]) scanf("%d %d", &x[i][j], &y[i][j]), --x[i][j];
	}
	
	int ans = 0;
	REP(s, 1<<N) {
		bool ok = true;
		REP(i, N) if (s >> i & 1 ^ 1) {
			REP(j, A[i]) {
				ok &= s >> x[i][j] & 1 ^ y[i][j];
			}
		}
		int cnt = 0;
		REP(i, N) if (s >> i & 1 ^ 1) ++cnt;
		if (ok) chmax(ans, cnt);
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main() {
  string str;
  string str2;
  int flag=0;
  cin >> str;
  cin >> str2;
  if(size(str)==size(str2)-1){
    for(int i=0; i<str.size();i++){
      if(str.at(i)!=str2.at(i))flag=1;
    }
  }
  if(flag==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    string s;
    cin >> s;
    int cnt = 0;
    rep(i,s.size()){
        if(s[i] == 'o') cnt++;
    }
    if (cnt + 15 - s.size()>=8){
        cout << "YES" << endl;
    } else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

int main() {
    ll N, K;
    cin >> N >> K;

    ll divided = N;
    string digits = "";
    while (divided > 0) {
        ll left = divided % K;
        digits.push_back('0' + left);
        divided = divided / K;
    }
    reverse(digits.begin(), digits.end());

    int ans = digits.size();

    cout << ans << endl;

    return 0;
}


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

struct STU{
	int id;
	int num;
	bool operator<(const STU&s)const{
		return num<s.num;
	}
}a[100005];

int n;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int sp;
		scanf("%d",&sp);
		a[i].id=i;
		a[i].num=sp;
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		if(i!=1)printf(" ");
		printf("%d",a[i].id);
	}
	printf("\n");
}

Measured memory_bytes: 1664
n, q = map(int, input().split())

links = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    links[a - 1].append(b - 1)
    links[b - 1].append(a - 1)  

values = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    values[p - 1] += x

q = [(0, -1)]
while q:
    me, parent = q.pop()
    for child in links[me]:
        if child == parent:
            continue
        values[child] += values[me]
        q.append((child, me))

print(*values)

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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define NODE 100001
#define INF 1000000000000000000LL
//v[i][j]; j番目の辺。iからfirstへの有向辺で、コストはsecond。
vector<vector<pair<ll,ll> > > v(NODE);
ll dist[NODE];
int dijkstra(int start){
	//初期化
	for(int i = 0;i < NODE;i++)dist[i] = INF;
	dist[start] = 0;
	//priority_queueの宣言
	//pqに入れているのは(startからtoへの最短距離, to)
	//priority_queueの都合上、vのpairの順番とは逆にしている。
	priority_queue<P,vector<P>,greater<P> > pq;
	pq.push(make_pair(0,start));
	while(!pq.empty()){
		//現在見る者の中で、最もdistが小さいものを取り出す
		P now = pq.top();pq.pop();
		ll d = now.first;
		ll node = now.second;
		//すでに更新されていたりして、現在のが最適でなかったらスルー
		if(dist[node] < d)continue;
		//その点と辺を持つものに対して
		for(int i = 0;i < v[node].size();i++){
			ll opp_n = v[node][i].first;
			ll opp_d = v[node][i].second;
			//もし、distが更新できるならば、更新してpriority_queueに突っ込む
			if(dist[opp_n] > d + opp_d){
				dist[opp_n] = d + opp_d;
				pq.push(make_pair(dist[opp_n],opp_n));
			}
		}
	}
}

vector<vector<pair<ll,ll> > > v2(NODE);
ll dist2[NODE];
int dijkstra2(int start){
	//初期化
	for(int i = 0;i < NODE;i++)dist2[i] = INF;
	dist2[start] = 0;
	//priority_queueの宣言
	//pqに入れているのは(startからtoへの最短距離, to)
	//priority_queueの都合上、vのpairの順番とは逆にしている。
	priority_queue<P,vector<P>,greater<P> > pq;
	pq.push(make_pair(0,start));
	while(!pq.empty()){
		//現在見る者の中で、最もdistが小さいものを取り出す
		P now = pq.top();pq.pop();
		ll d = now.first;
		ll node = now.second;
		//すでに更新されていたりして、現在のが最適でなかったらスルー
		if(dist2[node] < d)continue;
		//その点と辺を持つものに対して
		for(int i = 0;i < v2[node].size();i++){
			ll opp_n = v2[node][i].first;
			ll opp_d = v2[node][i].second;
			//もし、distが更新できるならば、更新してpriority_queueに突っ込む
			if(dist2[opp_n] > d + opp_d){
				dist2[opp_n] = d + opp_d;
				pq.push(make_pair(dist2[opp_n],opp_n));
			}
		}
	}
}

int main(){
	ll n, m, s, t;
	cin >> n >> m >> s >> t;
	s--; t--;
	for(int i = 0; i < m; i++) {
		ll ui, vi, ai, bi;
		cin >> ui >> vi >> ai >> bi;
		ui--; vi--;
		v[ui].push_back(make_pair(vi, ai));
		v[vi].push_back(make_pair(ui, ai));
		v2[ui].push_back(make_pair(vi, bi));
		v2[vi].push_back(make_pair(ui, bi));
	}
	dijkstra(s);
	dijkstra2(t);

	vector<pair<ll, ll>> cost;
	for(ll i = 0; i < n; i++)
		cost.push_back(make_pair(dist[i] + dist2[i], i));
	sort(cost.begin(), cost.end());

	ll j = 0;
	for(ll i = 0; i < n; i++) {
		while(cost[j].second < i) j++;
		cout << (1000000000000000LL - cost[j].first) << endl;
	}

	return 0;
}


Measured memory_bytes: 19900
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [0] * N
for i in range(N):
    A[i] = list(map(int, input().split()))

cnt = 0
for i in range(N):
    tmp = 0
    for j in range(M):
        tmp += A[i][j] * B[j]
    if tmp + C > 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int N, L, Q;
    cin >> N;
    int x[N];
    rep(i, N) cin >> x[i];
    cin >> L >> Q;
    //next[i][j]:=jから2^i日かけて到達できる最も座標の大きい点
    int next[30][N], now = 0;
    rep(i, N){
        while(now < N-1 && x[now+1] <= x[i]+L) now++;
        next[0][i] = now;
    }
    rep2(i, 1, 29){
        rep(j, N){
            next[i][j] = next[i-1][next[i-1][j]];
        }
    }
    rep(i, Q){
        int A, B;
        cin >> A >> B;
        A--, B--;
        if(A > B) swap(A, B);
        int ans = 0;
        now = A;
        rep3(j, 29, 0){
            if(next[j][now] < B){
                now = next[j][now];
                ans |= (1<<j);
            }
        }
        cout << ans+1 << endl;
    }
}

Measured memory_bytes: 12928
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

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

func check(a, b []string, x, y int) bool {
	m := len(b)
	for i := 0; i < m; i++ {
		for j := 0; j < m; j++ {
			if a[x+i][y+j] != b[i][j] {
				return false
			}
		}
	}
	return true
}

func main() {
	defer stdout.Flush()
	n := readInt()
	m := readInt()
	a := make([]string, n)
	for i := range a {
		a[i] = readString()
	}
	b := make([]string, m)
	for i := range b {
		b[i] = readString()
	}

	for i := 0; i+m-1 < n; i++ {
		for j := 0; j+m-1 < n; j++ {
			if check(a, b, i, j) {
				println("Yes")
				return
			}
		}
	}
	println("No")
}

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


Measured memory_bytes: 640
#include <iostream>

int main(int argc, char const *argv[]) {
    int ans = 0;
    for (int i = 1; i <= 5; ++i) {
        int x;
        std::cin >> x;
        if (x == 0) ans = i;
    }
    std::cout << ans << std::endl;
    return 0;
}


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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map
#define mtv(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)

vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out( 
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cout << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    stringstream ss; ss << H;
    cout << args[idx] << "- " << ss.str() << ", ";
    debug_out(args, idx + 1, LINE_NUM, T...);
}


void doit(){
	ll n,i;
	set<string>s;
	cin >> n;
	string x;
	rep(i,0,n){
		cin >> x;
		s.insert(x);
	}
	cout << s.size() << nl;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


Measured memory_bytes: 19256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int H,W; cin>>H>>W;
    vector<vector<char>> S(H,vector<char>(W));
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>S[i][j];
        }
    }
    int dx[8]={0,1,1,1,0,-1,-1,-1};
    int dy[8]={1,1,0,-1,-1,-1,0,1};

    vector<vector<char>> ans(H,vector<char>(W,0));
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(S[i][j]=='#'){
                cout<<'#';
                continue;
            }
            int count=0;
            for(int k=0;k<8;k++){
                int ni=i+dx[k];
                int nj=j+dy[k];

                if(ni<0 or ni>=H or nj<0 or nj>=W){
                    continue;
                }
                if(S[i+dx[k]][j+dy[k]]=='#'){
                    count++;
                }
            }
            cout<<count;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;

int main(){
  int total_stations;
  int total_buy_stations;
  int dept_station;
  while(~scanf("%d %d %d",
               &total_stations,
               &total_buy_stations,
               &dept_station)){
    vector<int> stations;
    for(int buy_i = 0; buy_i < total_buy_stations; buy_i++){
      int station_id;
      scanf("%d",&station_id);
      stations.push_back(station_id);
      stations.push_back((station_id > dept_station) ? 
                         station_id - total_stations
                         : station_id + total_stations);
    }

    sort(stations.begin(),stations.end());

    int res = INF;
    
    res = 100 * min(dept_station - stations[0],
                    stations[2 * total_buy_stations - 1] - dept_station);
    for(int i = 1; i < total_buy_stations; i++){
      int route1 = min(dept_station - stations[i],
                       stations[total_buy_stations + i - 1] - dept_station);
      int route2 = max(dept_station - stations[i],
                       stations[total_buy_stations + i - 1] - dept_station);
      res = min(res,100 * (route1 * 2 + route2));
    }
    printf("%d\n",res);
  }
}

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

typedef long double ll;
typedef string str;

int main ()
{
	// ios::sync_with_stdio(0);
 //    cin.tie(0);
 //    cout.tie(0);
	ll t,n,m,k,i,a,b,j;
	ll pi = 2*acos(0.0);
	cin >> i >> j >> n >> m;
	b=(m*(pi/30));
	n+=(m)/60;
	a=n*(pi/6);
	if(a-b>=0)
	k=min(a-b,(2*pi-a+b));
	else
		k=min(b-a,(2*pi-b+a));
	ll val=2*i*j*cos(k);
	ll z=(i*i+j*j-val);
	ll ans=sqrt(z);
	std::cout << std::fixed;
    std::cout << std::setprecision(10);
    std::cout << ans;
    cout << "\n";
	return 0;
}

Measured memory_bytes: 4168
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int x = 0;
    rep(i,n) {
      cin >> a[i];
      x ^= a[i];
    }
    rep(i,n) {
      int ans = a[i] ^ x;
      printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 3988
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>

using namespace std;

const int INF = 1e8;

int N;
int t[10001];

int dp[2][10001][2];

int main() {
    cin >> N;
    for (int i=0; i<N-1; i++) cin >> t[i];
    t[N-1] = 0;

    for (int i=0; i<2; i++) {
        for (int j=0; j<10001; j++) {
            for (int k=0; k<2; k++) {
                dp[i][j][k] = INF;
            }
        }
    }
    dp[0][1][0] = dp[0][0][1] = 0;

    for (int i=0; i<N; i++) {
        for (int j=0; j<=N/2; j++) {
            dp[(i+1)&1][j+1][0] = min(dp[i&1][j][0], dp[i&1][j][1]+t[i]);
            dp[(i+1)&1][j][1] = min(dp[i&1][j][0]+t[i], dp[i&1][j][1]);
        }
    }

    cout << min(dp[(N-1)&1][N/2][0], dp[(N-1)&1][N/2][1]) << endl;

    return 0;
}

Measured memory_bytes: 3284
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#define Mod 1000000007
using namespace std;
int n;
bool book[610];
int num[610],c[610];
int f[610][310][310];
void add(int& x,int y)
{
	x+=y;
	if(x>=Mod)x-=Mod;
}
int main()
{
	scanf("%d",&n);
	int A=0,B=0;
	for(int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		if(x>y)swap(x,y);
		if(y==-1)B++;
		else if(x==-1)
			num[++A]=y;
		if(x>0)book[x]=true;
		if(y>0)book[y]=true;
	}
	sort(num+1,num+A+1);
	int N=(A+B)*2;
	int now=1,cur=0;
	for(int i=1;i<=n*2;i++)
	{
		if(i==num[now]){
			c[++cur]=1;
			now++;
		}
		else if(!book[i])c[++cur]=0;
	}
	f[N][0][0]=1;
	for(int i=N;i>=1;i--)
		for(int x=0;x<=A;x++)
			for(int y=0;y<=A+B;y++)
			{
//				printf("%d %d %d:%d\n",i,x,y,f[i][x][y]);
				if(!f[i][x][y])continue;
				if(c[i]){
					add(f[i-1][x+1][y],f[i][x][y]);
					if(y>0)add(f[i-1][x][y-1],f[i][x][y]);
				}
				else{
					add(f[i-1][x][y+1],f[i][x][y]);
					if(x>0)add(f[i-1][x-1][y],(long long)f[i][x][y]*x%Mod);
					if(y>0)add(f[i-1][x][y-1],f[i][x][y]);
				}
			}
	int ans=f[0][0][0];
	for(int i=1;i<=B;i++)
		ans=(long long)ans*i%Mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 225536
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
#define ll long long
const long long mod = 1e9 + 7;

int main() {
	ll n, m, hoge;
	vector<ll> a;
	cin >> n >> m;
	vector<ll> dp(n + 1);
	dp[0] = 1;
	for (int i = 0; i < m; i++) {
		cin >> hoge;
		a.push_back(hoge);
		dp[hoge] = 0;

		if (i>0 && a[i] - a[i - 1] <= 1) {
			cout << 0 << endl;
			return 0;
		}
	}
	ll j = 0;
	for (ll i = 1; i < n + 1; i++) {
		if (j<a.size()&&i == a[j]) {
			j++;
			continue;
		}
		if (i >= 2) {
			dp[i] = dp[i - 1] + dp[i - 2];
		}
		else {
			dp[i] = dp[i - 1];
		}
		dp[i] %= mod;
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1660
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, A, B, ans;

int main()
{
	in >> N >> A >> B;
	std::vector<LL>X(N);
	rep(i, N) in >> X[i];
	rep(i, N - 1) ans += std::min((X[i + 1] - X[i])*A, B);
	out << ans << std::endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI (acos(-1))
#define ct cout<<
#define cn cin>>
#define spc <<" "<<
#define nl puts("")
#define _fl(x) puts("FLAG " #x);
#define  _(x)  cout<< #x <<" is "<< x <<endl;
#define fs first
#define sc second
#define pb push_back
#define all(v)  (v).begin(), (v).end()
#define _109 (1000000000)
#define _0(arr) memset(arr,0,sizeof ( arr ) )
#define _1(arr) memset(arr,-1,sizeof ( arr ) )
#define _ninp(n,arr) for(int i=0; i<n;i++)cin>>arr[i];
#define _nout(n,arr) for(int i=0; i<n;i++)cout<<arr[i]<<" \n"[i==n-1];
double _eps=1e-6;
long long gcd(long long a, long long b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}


bool isp(string s){





 for (int i = 0,j=s.size()-1; i <=j ; i++ ,j--)
 {
 	if(s[i]!=s[j])return false;
 }
 return true;


}
int main() {

   
   string s;
   cn s;

   string p,q;
   int n=s.size();


   for (int i = 0; i <(n-1)/2; ++i)
   {
   	 p.pb(s[i]);
   }

   for (int i = n/2+1; i < n; ++i)
   {
   	 q.pb(s[i]);
   }


   if(isp(s) && isp(p) && isp(q))ct "Yes";
   else ct "No";
   nl;




    return 0;
}


Measured memory_bytes: 256
from collections import Counter as C

n  =  int(input())
a= list(input().split())
al = list([int(i) for i in a])
aset = set([int(i) for i in a])

cnt=0
ca = C(al)
#print(C(al)[0])
for i in aset:
  #print(i)
  #print(al.count(i-1),al.count(i),al.count(i+1))
  if cnt < ca[i-1] + ca[i] + ca[i+1]:
    cnt = ca[i-1] + ca[i] + ca[i+1]

print(cnt)

Measured memory_bytes: 25316
while True:
    n=input().split()
    n[0]=int(n[0])
    n[1]=int(n[1])
    if n[0]==0 and n[1]==0:
        break

    if n[0]>n[1]:
        c=n[0]
        n[0]=n[1]
        n[1]=c
    print(n[0],n[1])



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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, std::vector<long long> A){
    vector<vector<ll>> dp(2001, vector<ll>(2001, 0));
    vector<pair<ll, int>> a(N);
    rep(i,0,N) a[i] = {A[i], i};
    sort(all(a), greater<>());
    ll answer = 0;
    rep(i,0,N+1) rep(j,0,N-i+1) {
        ll lValue = 0, rValue = 0;
        if (i>0) lValue = dp[i-1][j] + a[i+j-1].first * abs((i-1)-a[i+j-1].second);
        if (j>0) rValue = dp[i][j-1] + a[i+j-1].first * abs((N-j)-a[i+j-1].second);
        dp[i][j] = max(lValue, rValue);
        answer = max(dp[i][j], answer);
    }
    cout << answer << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 35048
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		int x = sc.nextInt();
		int y = sc.nextInt();
		for (; x != 0 || y != 0;) {
			if (x > y) {
				System.out.println(y + " " + x);
			} else {
				System.out.println(x + " " + y);
			}
			x = sc.nextInt();
			y = sc.nextInt();
		}
	}
}

Measured memory_bytes: 27260
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new A().doIt();
	}
	
	class A{
		void doIt(){
			int n = in.nextInt();
			int m = in.nextInt();
			int[] hyou = new int[n];
			for(int i=0;i<m;i++){
				int a = in.nextInt();
				int b = in.nextInt();
				for(int s=a;s<a+b;s++){
					int index = s % n;
					hyou[index] = 1;
				}
			}
//			System.out.println(Arrays.toString(hyou));
			int[] result = new int[101];
			int sum = 0;
			boolean sw = false;
			int memo = 0;
			for(int i=0;i<n;i++){
				if(hyou[i]>0)sum++;
				else {
					if(!sw){
						sw = true;
						memo = sum;
					}else result[sum]++;
					sum = 0;
				}
			}
			if(sum > 0){
				result[sum + memo]++;
			}else{
				result[memo]++;
			}
			
			for(int i=100;i>=1;i--)if(result[i]>0){
				System.out.println(i+" "+result[i]);
			}
		}
	}
	
	
	class C{
		int[][] hyou;
		void doIt(){
			int n = in.nextInt();
			int x = in.nextInt();
			hyou = new int[n][2];
			for(int i=0;i<n;i++){
				hyou[i][0] = in.nextInt();
				hyou[i][1] = in.nextInt();
			}
			PriorityQueue<Data> q = new PriorityQueue<Main.C.Data>();
			q.add(new Data(0, 0));
			
			boolean[] closed = new boolean[1500010];
			while(q.size()>0){
				Data d = q.remove();
				if(d.v == x){
					System.out.println(d.cost);
					return;
				}
				for(int i=0;i<n;i++){
					int nv = hyou[i][0] + d.v;
					if(!closed[nv])q.add(new Data(nv, d.cost + hyou[i][1]));
					nv = d.v - hyou[i][0];
					if(nv >= 0 && !closed[nv])q.add(new Data(nv, d.cost + hyou[i][1]));
				}
			}
			System.out.println("-1");
		}
		
		class Data implements Comparable<Data>{
			int v,cost;
			public Data(int v,int cost) {
				this.v = v;
				this.cost = cost;
			}
			public int compareTo(Data o) {
				return this.cost - o.cost;
			}
		}
		
	}
}


Measured memory_bytes: 18128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define MOD 1000000007
#define ll long long

int cmpfunc(const void *a, const void *b){
    return (*(int*)a - *(int*)b);
}

int max(int a,int b){
    return (a>b)?a:b;
}

int main(void){
    char s[100];
    scanf("%s",s);
    int len=strlen(s);
    int a[26];
    int i;
    for(i=0;i<26;i++) a[i]=0;
    for(i=0;i<len;i++) a[s[i]-'a']++;
    for(i=0;i<26;i++){
        if(a[i]>1) break;
    }
    if(i>=26) printf("yes\n");
    else printf("no\n");


    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

void solve(ll a, ll b){
    cout<<lcm(a,b)<<endl;
}

int main(){
    ll a;
    scanf("%lld",&a);
    ll b;
    scanf("%lld",&b);
    solve(a, b);
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(ll i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF INT_MAX / 2

using namespace std;
typedef long long ll;


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

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

int main(void){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    s[k-1]+=('a'-'A');
    cout<<s;
}
/*

*/


Measured memory_bytes: 3588