akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <cmath>

#define	MOD 1000000007;
#define PI 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

	ll s[100003];
	for (int i = 0; i < 100003; i++)
	{
		s[i] = 0;
	}

	for (int i = 0; i < N; i++)
	{
		ll a;
		cin >> a;
		s[a]++;
		s[a + 3]--;
	}

	int maxNum = 0;
	for (int i = 0; i <= 100003; i++)
	{
		s[i + 1] = s[i + 1] + s[i];

		if (maxNum < s[i + 1])
		{
			maxNum = s[i + 1];
		}
	}
	cout << maxNum << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define rep(i,a,b) for(int i = a; i < b; i++)
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

int main(){
  ll N,start; cin >> N; cout << 0 << endl;
  string s; cin >> s;
  if (s[0] == 'V') {exit(0);}
  else if (s[0] == 'M') {start = 0;}
  else {start = 1;}

  ll lo=0,hi=N;
  while (true){
    ll mid = (hi+lo)/2;
    cout << mid << endl;
    cin >> s;
    if (s[0] == 'V') {exit(0);}
    else if (s[0] == 'M'){
      if ((2+(mid%2)-(lo%2))%2 != start) {hi = mid;}
      else {lo = mid; start = 0; }
    } else {
      if ((2+(mid%2)-(lo%2))%2 == start) {hi = mid;}
      else {lo = mid; start = 1; }
    }
    if (hi == lo+1){
      cout << hi << endl; cin >> s; if (s[0] == 'V') {exit(0);}
      cout << lo << endl; cin >> s; exit(0);
    }
  }
}


Measured memory_bytes: 852
n = int(input())
x, y = [], []
for i in range(n):
    tmp = [int(x) for x in input().split()]
    x.append(tmp[0])
    y.append(tmp[1])

ans = 0
for i in range(0, n):
    for j in range(i+1, n):
        way = (x[i]-x[j])**2 + (y[i]-y[j])**2
        way = way ** (1/2)
        ans += way
ans = 2 * ans / n
print(ans)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
const int N=2010,p=1e9+7;
int add(int x,int y){return(x+y)%p;}
int mul(int x,int y){return 1ll*x*y%p;}
int mpow(int a,int n){
    int ret=1;
    while(n){
        if(n&1)ret=mul(ret,a);
        a=mul(a,a);
        n/=2;
	}
	return ret;
}
int n,k;
int fac[N],inv[N];
int a,b;
int C(int n,int m){
	if(m>n)return 0;
    return mul(fac[n],mul(inv[m],inv[n-m]));
}
int main(){
//	freopen("1.in","r",stdin);
    fac[0]=1;
    for(int i=1;i<N;++i)fac[i]=mul(fac[i-1],i);
    inv[N-1]=mpow(fac[N-1],p-2);
    for(int i=N-2;~i;--i)inv[i]=mul(inv[i+1],i+1);
    cin>>n>>k;
    a=n-k,b=k;
    for(int i=1;i<=k;++i){
        printf("%d\n",mul(C(a+1,i),C(b-1,i-1)));
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    ll a,b,k;
    cin>>a>>b>>k;
    bool turn=true;
    while(k--){
        if(turn){
            if(a%2){
                a--;
            }
            b+=a/2;
            a=a/2;
        }else{
            if(b%2){
                b--;
            }
            a+=b/2;
            b=b/2;
        }
        turn^=true;
    }
    cout<<a<<" "<<b<<endl;
    return 0;  
}

Measured memory_bytes: 256
def main():
    H,W,K = [int(x) for x in input().split()]

    B = 0
    BH = [0]*H
    BW = [0]*W
    BHW = []
    for h in range(H):
        BHW.append([0]*W)
    for i in range(H):
        C = list(input())
        for j in range(W):
            if C[j] == '#':
                B += 1
                BH[i] += 1
                BW[j] += 1
                BHW[i][j] = 1

    cnt = 0
    for ibit in range(0,1<<H):
        for jbit in range(0,1<<W):
            icost = 0
            jcost = 0
            ijcost = 0
            for i in range(H):
                if (1<<i) & ibit:
                    icost += BH[i]
            for j in range(W):
                if (1<<j) & jbit:
                    jcost += BW[j]
            for i in range(H):
                for j in range(W):
                    if (1<<i) & ibit and (1<<j) & jbit:
                        ijcost += BHW[i][j]
            b = B - icost - jcost + ijcost
            if K == b:
                cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 73964
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

long long N, X;

int main() {
	scanf( "%lld%lld", &N, &X );
	printf( "%lld\n", 3ll * ( N - __gcd(N, X) ) );
	return 0;
}

Measured memory_bytes: 128
import sys
from sys import exit
from math import gcd, factorial, ceil, floor, sqrt
from bisect import bisect_left, bisect_right
from copy import deepcopy
from heapq import heapify, heappop, heappush
from itertools import permutations, combinations, product, accumulate
from collections import defaultdict, deque
sys.setrecursionlimit(10**7)

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

X = ii()
a = X//500 * 1000
b = (X-X//500*500)//5 * 5
print(a+b)

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

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

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

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

			var hudreds = N / 100;
			var tens = (N - hudreds * 100) / 10;
			var num = N % 10;

			if (hudreds == 7) {
				Console.WriteLine("Yes");
				return;
			}

			if (tens == 7) {
				Console.WriteLine("Yes");
				return;
			}
			if (num == 7) {
				Console.WriteLine("Yes");
				return;
			}


			Console.WriteLine("No");

		}

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

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


Measured memory_bytes: 28240
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int n,k,count=0;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
        if(h[i]>=k) count++;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3960
p=10**9+7
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
pi=1
ni=0
ans=1
i=0
while i<k-1:
  if a[ni]*a[ni+1]>a[-pi]*a[-pi-1]:
    ans=ans*a[ni]*a[ni+1]%p
    ni+=2
    i+=2
  else:
    ans=ans*a[-pi]%p
    pi+=1
    i+=1
if i==k-1:
  ans=ans*a[-pi]%p
if a[-1]<0 and k%2==1:
  ans=1
  for i in a[n-k:]:
    ans=ans*i%p
print(ans)

Measured memory_bytes: 33156
import java.util.*;

class Main {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        for (int i = 0; i < n; i++) {
            int v = sc.nextInt();
            if (v != i + 1) {
                count++;
            }
        }
        sc.close();
        if(count == 0 || count == 2){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

string s;
int ans[100010];

signed main() {
    cin >> s;
    int n = s.size();
    int cnt = 0;
    // R
    bool is_r = true;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') {
            cnt++;
            is_r = true;
        } else {
            if (is_r) {
                ans[i] += cnt / 2;
                ans[i - 1] += cnt - cnt / 2;
                cnt = 0;
                is_r = false;
            }
        }
    }

    reverse(s.begin(), s.end());

    // L
    cnt = 0;
    bool is_l = true;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            cnt++;
            is_l = true;
        } else {
            if (is_l) {
                ans[n - 1 - i] += cnt / 2;
                ans[n - i] += cnt - cnt / 2;
                cnt = 0;
            }
            is_l = false;
        }
    }

    for (int i=0;i<n;i++) {
        cout << ans[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll ans = LLONG_MAX;
  for(ll i = 0; i<= 100000; i++) {
    ans = min(ans, a*max(x-i,(ll)0)+b*max(y-i,(ll)0)+2*c*i);
  }
  cout << ans << endl;
  return 0;
}

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

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	// dp : minimum weight for each value 
	int n,w;
	cin >> n >> w;
	vector<int> dp(1e5+1,LLONG_MAX/2);
	dp[0] = 0;
	for (int i=0; i<n; ++i){
		int w,v;
		cin >> w >> v;
		for (int j=1e5; j>=0; --j){
			if (j == 0 or dp[j] != LLONG_MAX/2){
				dp[j+v] = min(dp[j+v],w+dp[j]);
			}
		}
	}
	int ans = 0;
	for (int i=0; i<=1e5; ++i){
		if (dp[i] <= w){
			ans = i;
		}
	}
	cout << ans;
	return 0;
}


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

const double INF = 1e4;
const double EPS = 1e-11;

// ????¬????
struct P3{
  double x,y,z;
  double vx,vy,vz;
  double r,vr;
  P3(double x=0, double y=0, double z=0):x(x),y(y),z(z){}
  P3 operator + (const P3 &a) const{ return P3(x+a.x, y+a.y, z+a.z); }
  P3 operator - (const P3 &a) const{ return P3(x-a.x, y-a.y, z-a.z); }
  P3 operator * (const double &c) const{ return P3(x*c, y*c, z*c); }
  void input(){scanf("%Lf%Lf%Lf%Lf%Lf%Lf%Lf%Lf",&x,&y,&z,&vx,&vy,&vz,&r,&vr);};
  P3 v ()const{return P3(vx,vy,vz);}
};
P3 operator * (double c, const P3 &a){ return P3(c * a.x, c * a.y, c * a.z); }


double norm(const P3 &a){ return a.x*a.x + a.y*a.y + a.z*a.z; }
double abs(const P3 &a){ return sqrt(norm(a)); }

typedef pair<int,int> P;
typedef pair<double,P> PP;

double calc(const P3 &A,const P3 &B,double t){
  if((A.r-t*A.vr)<0|| (B.r-t*B.vr)<0) return -1;
  return abs((A+t*A.v())-(B+t*B.v())) - ((A.r-t*A.vr) + (B.r-t*B.vr));
}

double calc(const P3 &A,const P3 &B){
  double L=0,R=INF,cnt = 65;
  while(cnt--){
    double M = (L+R)/2;
    double y1 = calc(A,B,M);
    double y2 = calc(A,B,M+EPS);
    if(y1<0||y1-y2<0) R = M;
    else L = M+EPS;
  }
  return L-EPS;
}

int main(){
  int n;
  while(cin>>n,n){
    vector<P3>A(n);
    for(int i=0;i<n;i++) A[i].input();

    priority_queue<PP,vector<PP>,greater<PP> >Q;
    for(int i=0;i<n;i++)
      for(int j=i+1;j<n;j++){
	double t = calc(A[i],A[j]);
	if(abs(calc(A[i],A[j],t))<2e-8)Q.push(PP(t,P(i,j)));
      }

    vector<double> ans(n,-1);
    while(!Q.empty()){
      PP t = Q.top();Q.pop();
      double c = t.first;
      int a = t.second.first;
      int b = t.second.second;
      if(ans[a]>=0||ans[b]>=0)continue;
      ans[a] = ans[b] = c;
    }

    for(int i=0;i<n;i++){
      if(ans[i]<0) ans[i] = A[i].r / A[i].vr;
      ans[i] = min(ans[i],A[i].r / A[i].vr);
      printf("%.10Lf\n",ans[i]);
    }    
    
  }
  return 0;    
}

Measured memory_bytes: 3276
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    if(a+b==15){
        cout << "+" << endl;
    }else if(a*b==15){
        cout << "*" << endl;
    }else{
        cout << "x" << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long ll;

struct node
{
    int sta[8];
    int step;
    int p;
};
queue<node> q;
int s[8];

int d[] = {-4,-1,1,4};
int hash[1000000];
int w[10],vec[10];

void init()
{
    w[0] = 1;
    int sum = 1;
    for(int i=1;i<=7;i++)
    {
        sum*=i;
        w[i] = sum;
    }
}

void solve()
{
    while(!q.empty()) q.pop();
    memset(hash,-1,sizeof(hash));

    node ff,gg,hh;
    for(int i=0;i<8;i++)
        ff.sta[i] = i;
    ff.step = 0;


    int mark = 0,pos;
    int n = 8;
    for(int i=0;i<n;i++)
    {
        int cnt = 0;
        for(int j=i+1;j<n;j++)
        {
            if(s[j]<s[i]) cnt++;
        }
        vec[n-i-1] = cnt;
    }
    for(int i=0;i<n;i++)
        mark += vec[i]*w[i];
    mark++;
    ff.p = mark;
    q.push(ff);
    hash[mark] = 0;

    int cur[8],next[8];
    while(!q.empty())
    {
        gg = q.front();
        q.pop();
        memcpy(cur,gg.sta,sizeof(gg.sta));
        int step = gg.step;

        for(int i=0;i<8;i++)
        {
            if(cur[i] == 0)
            {
                pos = i;
                break;
            }
        }

        for(int i=0;i<4;i++)
        {
            int x = pos+d[i];
            if(x<0 || x>7) continue;
            if(x==3 && pos==4) continue;
            if(x==4 && pos==3) continue;

            memcpy(next,cur,sizeof(cur));

            int tmp = next[x];
            next[x] = next[pos];
            next[pos] = tmp;

            int mark = 0;
            for(int k=0;k<8;k++)
            {
                int cnt = 0;
                for(int j=k+1;j<8;j++)
                {
                    if(next[j]<next[k]) cnt++;
                }
                vec[n-k-1] = cnt;
            }
            for(int k=0;k<8;k++)
                mark += vec[k]*w[k];
            mark++;
            if(hash[mark]!=-1) continue;

            memcpy(hh.sta,next,sizeof(next));
            hh.step = step+1;
            hh.p = mark;
            q.push(hh);
            hash[mark] = hh.step;
        }
    }
}

int main()
{
   // freopen("1.txt","w",stdout);

    init();
    solve();
    int x;
    while(~scanf("%d",&s[0]))
    {
        for(int i=1;i<=7;i++)
        {
            scanf("%d",&x);
            s[i] = x;
        }
        int omg = 0;
        for(int i=0;i<8;i++)
        {
            int cnt = 0;
            for(int j=i+1;j<8;j++)
            {
                if(s[j]<s[i])
                    cnt++;
            }
            vec[8-1-i] = cnt;
        }
        for(int i=0;i<8;i++)
            omg += vec[i]*w[i];
        omg++;
        printf("%d\n",hash[omg]);
    }
    return 0;
}

Measured memory_bytes: 5212
#include<stdio.h>
int main(void){
        int a,b,c,i,count;
        scanf("%d %d %d",&a,&b,&c);
        for(i=a;i<=b;i++){
                if(c%i == 0){
                        count = count + 1;
                }
        }
        printf("%d\n",count);
        return 0;
}

Measured memory_bytes: 596
n = int(input())
num_list = list(map(int,input()))

cnt = 0

for i in range(10):
    if i not in num_list:
        continue
    else:
        first_pwd = num_list.index(i)
        new_num_list = num_list[first_pwd + 1:]
        for j in range(10):
            if j not in new_num_list:
                continue
            else:
                second_pwd = new_num_list.index(j)
                new_new_num_list = new_num_list[second_pwd+1:]
                for k in range(10):
                    if k not in new_new_num_list:
                        continue
                    else:
                        cnt += 1

print(cnt)

Measured memory_bytes: 10264
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn dfs(edges: &Vec<Vec<(usize, bool)>>, cur: usize, par:usize, color: usize, colors: &mut Vec<usize>) {
    colors[cur] = color;
    for &(next, is_even) in edges[cur].iter() {
        if next != par {
            let nc = if is_even { color } else { 1-color };
            dfs(edges, next, cur, nc, colors);
        }
    }
}


fn main() {
    input!{
      n: usize,
      uvws: [(usize, usize, usize); n-1],
    }

    let mut edges = vec![vec![]; n];
    for &(u, v, w) in uvws.iter() {
        edges[u-1].push((v-1, w%2==0));
        edges[v-1].push((u-1, w%2==0));
    }
    let mut cs = vec![0; n];
    dfs(&edges, 0, n, 0, &mut cs);
    for i in 0..n {
        println!("{}", cs[i]);
    }
}


Measured memory_bytes: 22780
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        string s = Console.ReadLine();
        int ans = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == '2')
                ans++;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <math.h>
#include <stdbool.h>


//using ll = long long;
int ASC( void *a,  void *b) {
	return strcmp(*(const char **)a, *(const char **)b);//降順
}
int GCD(int a, int b) {	//最大公約数
	if (b == 0) return a;
	else return GCD(b, a % b);
}
int min(double a, double b ) {
	if (a < b) {
		return a;
	}
	else
		return b;
}
int max(int a, int b) {
	if (a < b)
		return b;
	else
		return a;
}
int main(void)
{
	int a, b, h, m;
	scanf("%d%d%d%d",&a,&b,&h,&m);
	double hunsin = 6 * m;
	double jisin = 30 * h + 0.5*m;
	double rad = fabs(hunsin - jisin)* 3.14159265358979323846 / 180;
	//printf("%lf\n", 90*3.14/180.0);
	double ans = a*a + b*b - 2.0 * a*b*cos(rad);
	//printf("%lf\n",cos(rad));
	ans = sqrt(ans);
	printf("%.20f",ans);
	return 0;
}

Measured memory_bytes: 2660
#include<stdio.h>
#include<string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch){
if(ch=='A') return 1;
else if(ch=='C') return 2;
else if(ch=='G') return 3;
else if(ch=='t') return 4;
else return 0;
}
long long getKey(char str[]){
long long sum=0,p=1,i;
for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
}
return sum;
}
int h1(int key){return key%M;}
int h2(int key){return 1+(key%(M-1));}
int find(char str[]){
long long key,i,h;
key=getKey(str);
for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0) return 0;
}
return 0;
}
int insert(char str[]){
long long key,i,h;
key=getKey(str);
for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0) {
        strcpy(H[h],str);
        return 0;
    }
}
return 0;
}
int main()
{
    int i,n,h;
    char str[L],com[8];
    for(i=0;i<M;i++) H[i][0]='\0';
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s",com,str);
        if(com[0]=='i') insert(str);
        else {
            if(find(str)) printf("yes\n");
            else printf("no\n");
        }
    }
    return 0;
}

Measured memory_bytes: 16972
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  ll n, k;
  cin >> n >> k;
  vi a(n);
  vvi w(2.1e5);
  vi nx(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    w[a[i]].push_back(i);
  }
  for (int i = 0; i < w.size(); ++i) if (!w[i].empty()) {
    for (int j = 0; j + 1 < w[i].size(); ++j) {
      nx[w[i][j]] = w[i][j + 1];
    }
    nx[w[i].back()] = w[i][0] + n;
  }
  const int B = 60;
  vvi b(n + 1, vi(B));
  b[n][0] = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (nx[i] >= n) b[i][0] = nx[i] - n + 1;
    else b[i][0] = b[nx[i] + 1][0];
  }
  for (int t = 1; t < B; ++t) for (int i = 0; i < b.size(); ++i) {
    b[i][t] = b[b[i][t - 1]][t - 1];
  }
  int cur = 0;
  for (int t = B - 1; t >= 0; --t) if ((k - 1) & (1LL << t)) {
    cur = b[cur][t];
  }
/*  while (cur < n) {
    if (nx[cur] < n) cur = nx[cur] + 1;
    else break;
  }*/
  vi q;
  vi was(2.1e5);
  for (int i = cur; i < n; ++i) {
    if (!was[a[i]]) {
      q.push_back(a[i]);
      was[a[i]] = 1;
    } else {
      while (1) {
        assert(!q.empty());
        int x = q.back();
        was[q.back()] = 0;
        q.pop_back();
        if (x == a[i]) break;
      }
    }
  }
  for (int x : q) cout << x << ' ';
  cout << endl;
  return 0;
}


Measured memory_bytes: 70648
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 100100
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
struct edge{int to,lt;}e[N<<1];
int cnt,in[N],c[N],n;
void add(int x,int y)
{
	e[++cnt].to=y; e[cnt].lt=in[x]; in[x]=cnt;
	e[++cnt].to=x; e[cnt].lt=in[y]; in[y]=cnt;
}
int siz[N],tot,s[N],f[N],ans,d[N],qwq;
void dfs(int x,int fr)
{
	siz[x]=!c[x]; int w=0,gg=0,g=0;
	for(int i=in[x];i;i=e[i].lt)
	{
		int y=e[i].to; if(y==fr)	continue;
		dfs(y,x); siz[x]+=siz[y]; w+=(siz[y]!=0);
		gg=max(gg,g+f[y]); g=max(g,f[y]); f[x]=max(f[x],f[y]);
	}
	if(!siz[x])	return; 
	w+=(siz[x]!=tot); ans+=w;
	if(!((w&1)^c[x]))	ans++,d[x]=2,gg+=2,f[x]+=2;
	qwq=max(qwq,gg);
}
char ch[N];
int main()
{
	n=read(); for(int i=1;i<n;i++)	add(read(),read());
	scanf("%s",ch+1); tot=0; int rt=0; for(int i=1;i<=n;i++)	c[i]=(ch[i]=='B'),tot+=(!c[i]),rt=(ch[i]=='W'?i:rt);
	dfs(rt,0); if(!rt) return puts("0"),0; if(tot==1) return puts("1"),0; printf("%d\n",ans-qwq);
	return 0;
}

Measured memory_bytes: 11136
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
inf = 10**4

def bamboo_connect(i, a, b, c):
    if i == N:
        if all((a, b, c)):
            return abs(a-A) + abs(b-B) + abs(c-C) - 30
        else:
            return inf
    no_connect = bamboo_connect(i+1, a, b, c)
    choice_a = bamboo_connect(i+1, a+l[i], b, c) + 10
    choice_b = bamboo_connect(i+1, a, b+l[i], c) + 10
    choice_c = bamboo_connect(i+1, a, b, c+l[i]) + 10
    return min(no_connect, choice_a, choice_b, choice_c)

print(bamboo_connect(0, 0, 0, 0))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <string>
using namespace std;
int main() {
	int N, Q;
	string S;
	cin >> N >> S >> Q;
	vector<int> k(Q);
	vector<long long> cnt(Q);
	for (int i = 0; i < Q; i++)
		cin >> k[i];
	for (int i = 0; i < Q; i++) {
		long long cntD = 0;
		long long cntM = 0;
		long long cntMD = 0;
		int start = 0;
		for (int j = 0; j < N; j++) {
			if (j - start >= k[i]) {
				if (S[start] == 'D') {
					cntD--;
					cntMD -= cntM;
				}				
				if (S[start] == 'M') {
					cntM--;
					
				}
				start++;
			}
			if (S[j] == 'D')
				cntD++;
			if (S[j] == 'M') {
				cntM++;
				cntMD += cntD;
			}
			if (S[j] == 'C')
			{
				cnt[i] += cntMD;
			}
		}
	}
	for (int i = 0; i < Q; i++)
		cout << cnt[i] << endl;
	return 0;

}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.rbegin(), A.rend());
  int X = 0, Y = 0;
  for (int i = 0; i < N; i++) {
    if (i % 2) Y += A.at(i);
    else X += A.at(i);
  }
  cout << X - Y << "\n";
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define MAXN 1000002
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod=1e9+7;

void solve()
{
  double pi=3.14159;
  double n;
  cin>>n;
  double a=2;
  double ans=a*pi*n;
  cout<<setprecision(6)<<fixed<<ans;
}

int main()
{
  fastio
  solve();
}


Measured memory_bytes: 3820
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    pw.println((long) Math.pow(n, 3));
  }
}


Measured memory_bytes: 21844
/*
                        Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
        {   if(n % 2 ==1)
            result=(result * x)%M;
            x=(x*x)%M;
            n=n/2;
        }
    return result%M;
}      
bool isPrime(int n)
    {
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
    }
int inv(int a,int m)
{   return power(a,m-2);
}
int lcm(int a,int b)
{   return a*b/(gcd(a,b));
}
signed main()
{   jaldi
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=10000;i++)
    {   if((i*8)/100==a && (i/10)==b)
        {   cout<<i;    
            return 0;
        }
    }
    cout<<-1;
}

Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    OUT(1000 * ((N + 999) / 1000) - N);
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int h = sc.nextInt();
		int[] a = new int[n];
		Integer[] b = new Integer[n];
		for(int i = 0 ; i < n ; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		Arrays.sort(a);
		Arrays.sort(b);
		Arrays.sort(b, Comparator.reverseOrder());
		int ans = Integer.MAX_VALUE;
		for(int i = 0 ; i <= n ; i++) {
			if(i != 0) h -= b[i - 1];
			int cnt = 0;
			if(h > 0) {
				cnt = (h + a[n - 1] - 1) / a[n - 1];
			}
			ans = Math.min(ans, cnt + i);
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 87844
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  int N;
  cin >> N;
  ll dp[N+1][4][4][4] = {};
  dp[0][3][3][3]=1;
  rep(len, N){
    rep(i, 4){
      rep(j, 4){
        rep(k, 4){
          if(dp[len][i][j][k]==0) continue;
          rep(l, 4){
            if(j==0 && i==1 && l==2) continue;
            else if(j==0 && i==2 && l==1) continue;
            else if(j==1 && i==0 && l==2) continue;
            else if(k==0 && j==1 && l==2) continue;
            else if(k==0 && i==1 && l==2) continue;
            dp[len+1][l][i][j] += dp[len][i][j][k];
            dp[len+1][l][i][j] %= mod;
          }
        }
      }
    }
  }
  ll ans=0;
  rep(i, 4){
      rep(j, 4){
        rep(k, 4){
          if(dp[N][i][j][k]==0) continue;
          ans += dp[N][i][j][k];
          ans %= mod;
        }
      }
  }
  cout << ans << endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int N,T;
  cin>>N>>T;
  int mn=10000000000,mx=0,cnt=0;
  for(int i=0;i<N;i++){
    int A;
    cin>>A;
    if(A-mn>mx)mx=A-mn,cnt=1;
    else if(A-mn==mx)cnt++;
    mn=min(mn,A);
  }
  cout<<cnt<<endl;
}

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

#define FIO                     ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod                     1000000007
#define eps                     1e-9
#define setbits                 __builtin_popcount
#define gcd                     __gcd
#define rep(i,a,b)              for(int i=a;i<=b;i++)
#define repr(i,b,a)             for(int i=b;i>=a;i--)
#define forn(i,n)               for(int i=0;i<n;i++)
#define all(a)                  a.begin(), a.end()
#define in(a,b)                 ( (b).find(a) != (b).end())
#define pb                      push_back
//#define fill(a,v)               memset(a, v, sizeof a)
#define endl                    "\n"
#define ff                      first
#define ss                      second
#define mp                      make_pair
#define minin(a)                *min_element (all(a))
#define maxin(a)                *max_element(all(a))
#define asort(c)                sort(all(c))
#define dsort(c)                sort(all(c), greater<int>()) 
#define PI                      3.14159265358979323846
#define int                     long long
typedef  vector<int>                 vi;
typedef  pair<int, int>              ii;
typedef  vector<ii>                 vii;
typedef  set<int>                    si;
typedef  map<int, int>              mii;
typedef  long double                 ld;

clock_t time_p=clock();
void timer()
{
    time_p=clock()-time_p;
    cerr<<"Execution Time: "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
int32_t main()
{
  FIO
 
 
  int n;
  cin>>n;
  if(n==1)
  {
    cout<<"Hello World";

  }
  else
  {
    int a,b;
    cin>>a>>b;
    cout<<a+b;
  }

  timer();
  return 0;
}  

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

int main() {
  int N;
  cin >> N;
  int answer = 0;
  for(int i = 0;i < N;i++) {
    int A,B;
    cin >> A >> B;
    answer = answer + B - A + 1;
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
def main
  a, b, c = gets.chomp.split(' ').map(&:to_i)
  puts "#{[c - (a - b), 0].max}"
end

def solve(n)
  if n % 2 == 0
    puts n
  else
    puts 2 * n
  end
end

main if $0 == __FILE__

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

int main() {
	char str[100];
	string str2;
	int len,k;
	cin >> str;
	str2 = str;
	len = str2.length();
	k=0;
	for(int i=0;i<len/2;i++){
		if(str[i]!=str[len-i-1]){
			k++;
		}
	}
	cout << k;
	return 0;
}

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

int main() {
  int N;
  cin >> N;

  int X = N;
  int K = 1;
  while(X >= 10) {
    X /= 10;
    K *= 10;
  }
  int sum = 0;
  X = N;
  while (K) {
    sum += X / K;
    X %= 10;
    K /= 10; 
  } 

  if(N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3528
#include <stdio.h>

#define MOD (1000000007UL)

unsigned long total(int n)
{
    unsigned long total_x = 0;
    int prev_x;
    for (int i = 0; i < n; i++){
        int x;
        scanf("%d", &x);
        if (i == 0){
            prev_x = x;
        } else {
            int g = (i <= n/2) ? i : n - i;
            total_x += (unsigned long)(x - prev_x) * (unsigned long)g * (unsigned long)(n - g);
            total_x %= MOD;
            prev_x = x;
        }
    }
    return total_x;
}

int main(void)
{
    int n,m;
    scanf("%d %d", &n, &m);

    unsigned long total_x = total(n);
    unsigned long total_y = total(m);

    printf("%lu", (total_x * total_y) % MOD);

    return 0;
}


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

using namespace std;

#define INF 0x3f3f3f3f

int N,M;

int cost[1001]; //custo de cada chave
int chave[1001]; // baus que cada chave abre
int memo[1001][9000];
int total; // bits de baus

int dp(int key, int baus){

    if (key == M){
        if(baus == total) return 0;
        else return INF;
    }
    
    if(memo[key][baus] != -1) return memo[key][baus];

    //usando essa chave
    int a = dp(key+1, baus | chave[key]) + cost[key];
    
    //sem usar essa chave
    int b = dp(key+1, baus);
    
    int res = min(a,b);
    memo[key][baus] = res;
    
    return res;

}


int main(){

    cin >> N >> M;
    memset(memo, -1, sizeof(memo));
    
    for(int i=0; i<N; i++){
        total |= 1 << i;
    }
    
    for(int i=0; i< M; i++){
        int custo, qtd;
        
        cin >> custo >> qtd;
        cost[i] = custo;

        int bau;
        for(int x=0; x<qtd; x++){
            cin >> bau;
            chave[i] |= 1 << (bau - 1);
        }
    
    }

    int res = dp(0,0);
    if(res == INF) cout << -1 << endl;
    else cout << res << endl;

}

Measured memory_bytes: 35456
#include<cstdio>
#include<iostream>
#include<ctime>
#include<algorithm>
#include<cstring>
using namespace std;
long long mod;
long long pow(long long x,long long y);
int main (void)
{
	int n, i;
	long long S=1, a[100001], b[100001];
	
	mod=998244353LL;
	scanf("%d",&n);
	for (i=1; i<=n; i++) scanf("%d",&a[i]);
	if (a[1]) {
		printf("0\n");
		return 0;
	}
	memset(b,0,sizeof(b));
	for (i=1; i<=n; i++) b[a[i]]++;
	if (b[0]!=1) {
		printf("0\n");
		return 0;
	}
	for (i=1; i<=n-1; i++) S=S*pow(b[i-1],b[i])%mod;
	cout<<S<<endl;

	return 0;
}
long long pow(long long x,long long y)
{
	long long S=1;
	
	for (; y; y>>=1) {
		if (y&1) S=S*x%mod;
		x=x*x%mod;
	}

	return S;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define ALL(a) (a).begin(), (a).end()
#define p(a, b) printf(a, b);
#define c(s) cout << (s) << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define cyn(c) cout << (c ? "Yes" : "No") << endl;
#define cYN(c) cout << (c ? "YES" : "NO") << endl;
#define pyn(c) printf("%s\n", c ? "Yes" : "No");
#define pYN(c) printf("%s\n", c ? "YES" : "NO");
#define INF 1e18
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> P;
template <class T>
bool contain(const std::string &s, const T &v)
{
  return s.find(v) != std::string::npos;
}
ULL mod = 1e9 + 7;

int main()
{
  ULL n, a[5] = {}, v_min = 1e15 + 5, g_cnt = 0;
  cin >> n;
  rep(i, 5)
  {
    cin >> a[i];
    v_min = min(v_min, a[i]);
  }
  if (v_min >= n)
  {
    cout << 5 << endl;
  }
  else
  {
    g_cnt += n / v_min;
    if (n % v_min)
    {
      g_cnt++;
    }
    cout << 4 + g_cnt << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        for (int i = 1; i <= 1000; i++)
        {
            var res1 = (int)Math.Floor(i * 0.08);
            var res2 = (int)Math.Floor(i * 0.1);
            if (res1 == vals[0] && res2 == vals[1])
            {
                Console.WriteLine(i);
                return;
            }
        }
        Console.WriteLine(-1);
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	map<char, int> mp;
	for( char c : s ){
		++mp[c];
	}
	for( char c = 'a'; c <= 'z'; ++c ){
		if( mp[c] == 0 ){
			cout << c << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

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

    int a,b;
    cin>> a >> b;
    int cnt=0;
    for(int i=a;i<=b;i++){
        string m;
        m = to_string(i);
        reverse(m.begin(),m.end());
        if(to_string(i)==m){
            cnt+=1;
        }
    }
    cout << cnt;

    return 0;
}

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

typedef long long ll;
#define re(n) cin >> n
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define ff(i,x,n) for(ll i=(int)x;i<(int)n;i++)
#define f(i,n) ff(i,0,n)
#define fast std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define te(t) ll t; re(t); while(t--)
#define MOD 1000000007

int main(){
	fast;
	ll n, k;
	re(n >> k);
	ll dp[n+1][k+1];
	memset(dp, 0, sizeof dp);
	ll prof[n+1], w[n+1];
	ff(i, 1, n+1){
		re(w[i] >> prof[i]);
	}
	f(i, n+1){
		f(j, k+1){
			if(i==0||j==0){
				dp[i][j] = 0;
			}else{
				if(w[i]<=j){
					dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+prof[i]);
				}else{
					dp[i][j] = dp[i-1][j];
				}
			}
		}
	}
	cout << dp[n][k] << "\n";
	return 0;
}


Measured memory_bytes: 82456
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

ull cal(ull a,ull b) {
	if (a < b)swap(a, b);
	if (a%b == 0) {
		return b;
	}
	else {
		cal(b, a%b);
	}
}

int main() {

	int n;
	ull cl[100] = { 0 };
	ull ans = 0;

	cin >> n;
	rep(i, 0, n) {
		cin >> cl[i];
	}

	ull gc = cl[0];
	ans = 1;

	rep(i, 0, n) {
		gc = cal(cl[i], ans);
		ans = ans / gc * cl[i];
	}

	cout << ans << endl;

	return 0;
}

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

#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

using namespace std;

int main() {
    constexpr int N_MAX = 100;
    constexpr int S_MAX = 100;
    constexpr int S_SUM_MAX = N_MAX * S_MAX;
    bitset<S_SUM_MAX + 1> b(1);
    int N;
    cin >> N;
    REP(i, N) {
        int s;
        cin >> s;
        b |= b << s;
    }
    int result = 0;
    RREP(i, S_SUM_MAX + 1) {
        if (i % 10 == 0) {
            continue;
        }
        if (b.test(i)) {
            result = i;
            break;
        }
    }
    cout << result << endl;
    return 0;
}

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

int main() {
  string s;
  cin >> s;

  int n = s.size();
  vector<int> l(n), r(n), ans(n);

  r[0] = l[n - 1] = 1;
  for (int i = 1; i < n; i++) {
    if (s[i] == 'R') r[i] = r[i - 1] + 1;
  }

  for (int i = n - 2; i > -1; i--) {
    if (s[i] == 'L') l[i] = l[i + 1] + 1;
  }

  for (int i = 0; i < n - 1; i++) {
    if (r[i] * l[i + 1] == 0)
      ans[i] = 0;
    else {
      int x = r[i] + l[i + 1];
      if (x % 2 == 0)
        ans[i] = ans[i + 1] = x / 2;
      else if (x % 2 != 0 && r[i] % 2 == 0) {
        ans[i] = (x - 1) / 2;
        ans[i + 1] = (x + 1) / 2;
      } else if (x % 2 != 0 && r[i] % 2 != 0) {
        ans[i] = (x + 1) / 2;
        ans[i + 1] = (x - 1) / 2;
      }
      i++;
    }
  }

  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
//************************************//
//-Manthan Surkar----((smallstar))----//
//***********************************//
/*
 * You may think you know what the following code does.
 * But you dont. Trust me.
 * Fiddle with it, and youll spend many a sleepless
 * night cursing the moment you thought youd be clever
 * enough to "optimize" the code below.
 * Now close this file and go play with something else.
 */
//***************************************************************************
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define se second
//****************************************************************************
#define rep(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define dwn(i,n) for(int i=(n); --i>=0; )
#define repr(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define dwnr(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define repi(i,a) for(__typeof((a).begin()) i=(a).begin(), _##i=(a).end(); i!=_##i; ++i)
#define dwni(i,a) for(__typeof((a).rbegin()) i=(a).rbegin(), _##i=(a).rend(); i!=_##i; ++i)
//******************************************************************************

        ll a[100000+5];
        ll b[100000+5];
        ll c[100000+5];
        ll d[100000+5];
        ll dp[100000+5];
        ll dp1[100000+5];
        ll dp2[100000+5];
        
        ll sum;
	    int t;



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


        cin>>t;

	  rep(i,t)
	  {
         cin>>a[i]>>b[i]>>c[i];
       // ll d[i] = max(a[i],max(b[i],c[i]));
    
     }
     
     dp[0]=a[0];
     dp1[0]=b[0];
     dp2[0]=c[0];
     
     repr(i,1,t){
          dp[i]= max(dp1[i-1],dp2[i-1]) + a[i];        
          dp1[i]= max(dp2[i-1],dp[i-1]) + b[i];       
          dp2[i]= max(dp[i-1],dp1[i-1]) + c[i];       
         
     }
     
     cout<<max(dp[t-1],max(dp1[t-1],dp2[t-1]));

           
           

}


//************************************//
// Manthan Surkar----((smallstar))----//
//***********************************//



Measured memory_bytes: 5760