akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define dd double
#define ld long double
#define f(i,a,b) for(ll i = a; i < b; i++)
#define fr(i,a,b) for(ll i = b;i>=a;i--)
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define vpll vector< pii >
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define all(v) (v).begin(),(v).end()
#define Sort(v) sort(v.begin(), v.end(), sortbysec)
#define MEM(a, b) memset(a, (b), sizeof(a))

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

 

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

ll n,d;
cin>>n>>d;

  ll g=2*d+1;
  ll l=n/g;
  if(n%g!=0)l++;
  cout << l << endl;







}


Measured memory_bytes: 3652
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


def get_ashi(x, y):
    return 2*x + 4*y


x, y = zz()
turu = x
kame = 0
while (get_ashi(turu, kame) != y):
    if (turu == 0):
        print('No')
        exit()
    turu -= 1
    kame += 1
print('Yes')


Measured memory_bytes: 27080
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    int ans = 0;
    int n, m; cin >> n >> m;
    vector<int> h(n), a(m), b(m);
    rep(i, n) cin >> h[i];
    rep(i,m) cin >> a[i] >> b[i];
    map<int,int> mp;
    
    
    for(int i = 0; i < m; i++){
        //fill(f[0],f[n-1],true);

        if(h[a[i]-1] > h[b[i]-1]){
            //f[] = true;
            if(mp[a[i]-1] == 0) mp[a[i]-1] = 1;
        }else{
            //f[h[a[i]-1]-1] = false;
            mp[a[i]-1] = -1;
        }

        if(h[a[i]-1] < h[b[i]-1]){
            //f[h[b[i]-1]-1] = true;
            if(mp[b[i]-1] == 0) mp[b[i]-1] = 1;
        }else{
            //f[h[b[i]-1]-1] = false;
            mp[b[i]-1] = -1;
        }
    }
    //or(int j = 0; j < n; j++){ if(f[j]) ans++;}
    //for(auto x:mp){ cout << x.second << " ";}
    //cout << endl;
    for(auto x:mp){ if(x.second > 0) ans++;}
    for(int i = mp.size(); i < n; i++) ans++;

    put(ans);
}

Measured memory_bytes: 8488
from collections import defaultdict
def solve(N,A,B):
    d1=defaultdict(int)
    d2=defaultdict(int)
    for i in range(N):
        d1[A[i]]+=1
        d2[B[i]]+=1
    for i in d1:
        if d1[i]+d2[i]>N:
            return "No",[]
    else:
        return "Yes",B[::-1]
    
if __name__ == "__main__":
    N=int(input())
    A=[int(i) for i in input().split()][:N]
    B=[int(i) for i in input().split()][:N]
    a,b=solve(N,A,B)
    print(a)
    if b!=[]:
        #print(a)
        k,z=0,N-1
        for i in range(N):
            if A[i]==b[i] and b[i]!=b[k]:
                b[i],b[k]=b[k],b[i]
                k+=1
            elif A[i]==b[i] and b[i]==b[k]:
                b[i],b[z]=b[z],b[i]
                z-=1
        z,k=0,N-1
        for i in range(N):
            if A[i]==b[i] and b[i]!=b[k]:
                b[i],b[k]=b[k],b[i]
                k-=1
            elif A[i]==b[i] and b[i]==b[k]:
                b[i],b[z]=b[z],b[i]
                z+=1
        print(*b)


Measured memory_bytes: 177196
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
 
int main() {

    ll n;
    cin >> n;
    vector<ll> a(n+1);
    vector<ll> b(n+1);
    rep(i,n) {
        cin >> a[i];
        if(i>0)  {
            if(a[i]>a[i-1]) {
                b[i] = 1;
            }
            else {
                b[i] = 0;
            }
        }
    }
    b[n] = 0;
    b[0] = 0;

    ll ans = 1000;
    ll kabu = 0;
    rep(i,n) {
        if(b[i] == 0 && b[i+1] == 1) {
            kabu=(ans/a[i]);
            ans-=(kabu*a[i]);
        }
        else if(b[i] == 1 && b[i+1] == 0) {
            ans+=(kabu*a[i]);
            kabu=0;
        }
    }

    cout<<ans<<endl;


 return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination1(int, int);
};
int Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_The_Number_of_Even_Pairs(void) {

	int N, M; cin >> N >> M;
	cout << (N * (N - 1) + M * (M - 1)) * 0.5 << flush;
	return;
}

int main(void) {

	A_The_Number_of_Even_Pairs();
	return 0;
}


Measured memory_bytes: 256
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

int main(void){
	char d[4];
	nextstr(d);
	if(d[0]=='R'&&d[1]=='R'&&d[2]=='R'){
		puts("3");
	}else if(d[0]=='R'&&d[1]=='R'){
		puts("2");
	}else if(d[1]=='R'&&d[2]=='R'){
		puts("2");
	}else if(d[0]=='R'||d[1]=='R'||d[2]=='R'){
		puts("1");
	}else{
		puts("0");
	}
}


Measured memory_bytes: 1480
#include <iostream>
#include<math.h>
#include<cmath>
#include<string.h>
#include<stdio.h>
using namespace std;

int main()
{
   long long  int n;
   long long  int b,min,c;
   long long  int x,y;
    cin>>n;
    min=n;
    for(long long  int i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            b=n/i;
            c=abs(b-i);
            if(c<min)
            {
                min=c;
                x=i,y=b;
            }

        }
    }
    printf("%lld\n",x+y-2);
}


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

int gcd(int a,int b){
  int r=max(a,b)%min(a,b);
  if(r==0){
    return min(a,b);
  }
  return gcd(min(a,b),r);
}
int main(){
  int64_t A,B,C,D,CD;
  cin >> A >> B >> C >> D;
  int64_t all,cn,dn,cdn,ans;
  bool cf=false;
  bool df=false;
  bool cdf=false;
  if(A%C==0){
    cf=true;
  }
  if(A%D==0){
    df=true;
  }
  if(cf){
    cn=B/C-A/C+1;
  }else{
    cn=B/C-A/C;
  }
  if(df){
    dn=B/D-A/D+1;
  }else{
    dn=B/D-A/D;
  }
  CD=(C*D)/gcd(C,D);
  if(A%CD==0){
    cdf=true;
  }
  if(cdf){
    cdn=B/CD-A/CD+1;
  }else{
    cdn=B/CD-A/CD;
  }
  all=B-(A-1);
  ans=all-cn-dn+cdn;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        var S = ReadLine();
        var T = ReadLine();

        for (int i = 0; i < T.Length; i++)
        {
            if (S == T)
            {
                WriteLine("Yes");
                return;
            }
            S = S.Last() + S.Remove(S.Length - 1);
        }
        WriteLine("No");
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 11220
a = int(input())

b = int(a**0.5)+1

res = 0
for i in range(1,a//2+1):
    x = a//i
    y = i*x
    z = (i+y)*x //2
    res += z
zz = (a+a//2+1)*(a-a//2)//2
res +=zz

print(res)

Measured memory_bytes: 9360
#include <iostream>
using namespace std;
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <cstdlib>
#include <fstream>

int main(){
	int n;
	cin >> n;
	cout << n/3 <<endl;
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};


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

int main(){
    int d,t,s;
    cin >> d >> t >> s;

    if (s * t >= d){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 3632
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double EPS = 1e-10;


int main(void) {
  int N, M;
  cin >> N >> M;
  vector<P> ab(M);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    ab[i].first = b;
    ab[i].second = a;
  }

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

  int old = -1;
  int ans = 0;
  for (int i = 0; i < ab.size(); ++i) {
    if (!(ab[i].second <= old && old < ab[i].first)) {
      old = ab[i].first - 1;
      ++ans;
    }
  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3956
#include<iostream>
#include<algorithm>
using namespace std;
#define MAXN 103
int main()
{
    int n, k, r, res = 0;
    int i, j;
    int a[MAXN], plate[MAXN];
    scanf("%d%d",&n, &k);
    for(int i = 0; i < n; i++)
    {
        scanf("%d", a+i);
    }
    r = min(n, k);
    for(int A = 0; A <= r; A++)
    {
        for(int B = 0; B <= r-A; B++)
        {
            for(i = 0; i < A; i++)
            {
                plate[i] = a[i];
            }
            for(j = 0; j < B; j++)
            {
                plate[i+j] = a[n-1-j];
            }
            sort(plate, plate+A+B);
            i = 0;
            while(i < k-A-B && plate[i] < 0) //是k不是r
            {
                i++;
            }
            int sum = 0;
            for(; i < A+B; i++)
            {
                sum += plate[i];
            }
            res = max(res, sum);
        }
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <bitset>
using namespace std;
typedef long long ll;
const ll inf = 4e18;
const ll mod = 1e9+7;
#define print(X) cout << X << endl
#define vec vector
#define pb push_back
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define removeV(x,val) x.erase(x.remove(x.begin(), x.end(), val), x.end());
#define rep(i, n) for (ll (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define repd(i, m, n) for (ll (i) = (m); (i) > (n); --(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;
inline string YesNo(bool cond) { return cond ? "Yes" : "No"; }
inline string YESNO(bool cond) { return cond ? "YES" : "NO"; }

template <class T>
string join(const vector<T>& v, const char* delim = 0) {
  string s;
  if (!v.empty()) {
    s += v[0];
    for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) {
      if (delim) s += delim;
      s += v[i];
    }
  }
  return s;
}
//---------------------------------------------------------------------------
int main(void)
{
  ll a,b;
  ll ans=0;
  cin>>a>>b;
  repp(i,a,b+1) {
    string s;
    s=to_string(i);
    if (s[0]==s[4] && s[1]==s[3]) {
      ans+=1;
    }
  }
  print(ans);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,k,minj,swap;
  int a[100];
  int con=0;
  scanf("%d",&i);
  for(j=0;j<i;j++){
    scanf("%d",&a[j]);
  }


  
  for(j=0;j<i-1;j++){
    minj=j;
    for(k=j;k<i;k++){
      if(a[k]<a[minj]){
	minj=k;
      }}
	swap=a[j];
	a[j]=a[minj];
	a[minj]=swap;
  
	if(j!=minj){
	  con++;
    }
  }
  for(j=0;j<i;j++){
    if(j==0) printf("%d",a[j]);
    else printf(" %d",a[j]);
  }
  printf("\n");
  printf("%d\n",con);
  return 0;
 
}



Measured memory_bytes: 2144
using System;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string AB = Console.ReadLine();
            string[] ab = (AB.Split(' '));
            int a = int.Parse(ab[0]);
            int b = int.Parse(ab[1]);

            int d = a / b;
            int r = a % b;
            double f = a / (double)b;       //???????°???°???
            string g = (f).ToString("F5");  //string???????????´??????????????§??¨???

            Console.WriteLine(d + " " + r + " " + g);

        }
    }
}

Measured memory_bytes: 9128
const main = input => {
  const S = input.trim()

  let ok = true
  for (let i = 0; i < S.length; i++) {
    if (i % 2 === 0) {
      if (!['R', 'U', 'D'].includes(S.charAt(i))) {
        ok = false
        break
      }
    } else {
      if (!['L', 'U', 'D'].includes(S.charAt(i))) {
        ok = false
        break
      }
    }
  }

  ok ? console.log('Yes') : console.log('No')
}

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29544
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second
#define Mat vector<vector<ll>>
#define Arr vector<ll>

class DSU
{
public:
    vector<int> f;
    vector<int> cnt;
    DSU(int sz)
    {
        f = vector<int>(sz);
        cnt = vector<int>(sz, 1);
        forn(i, sz) f[i] = i;
    }
    int get(int x)
    {
        return f[x] == x ? x : (f[x] = get(f[x]));
    }
    void merge(int x, int y)
    {
        x = get(x);
        y = get(y);
        if (x != y)
            f[x] = y, cnt[y] += cnt[x];
    }
    bool same(int x, int y)
    {
        return get(x) == get(y);
    }
    int count(int x)
    {
        return cnt[get(x)];
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    pair<ll, ll> p;
    Mat M(1e5 + 10);
    forn(i, n) cin >> p.fi >> p.se, M[p.se].push_back(p.fi);

    ll ans = 0;
    DSU dsu(1e5 + 10);
    DSU dsu2(1e5 + 10);
    Arr Y(1e5 + 10, -1);
    fori(y, 1, 1e5 + 5)
    {
        ll prev = -1;
        for (ll x : M[y])
        {
            if (Y[x] != -1)
            {
                dsu.merge(y, Y[x]);
                dsu2.merge(M[y].front(), M[Y[x]].front());
            }
            if (prev != -1)
                dsu2.merge(x, prev);
            prev = x;
            Y[x] = y;
        }
    }

    fori(y, 1, 1e5 + 5)
    {
        if (dsu.count(y) > 1 && dsu.get(y) == y)
        {
            ll x = M[y].front();
            ans += 1LL * dsu.count(y) * dsu2.count(x);
        }
        if (dsu.count(y) == 1 && M[y].size() > 0)
            ans += M[y].size();
    }
    cout << (ans - n);
    return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

string repry[] = {"Male","Female","Vacant"};
bool pr;

int query(int n){
    cout1(n);
    string s; cin>>s;
    rep(i,3){
        if(s==repry[i]){
            if(i==2) exit(0);
            if(n%2) i^=1;
            if(pr==i) return true;
            else return false;
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    if(!query(0)) pr=1;
    
    int lb=0, ub=N-1, mid;
    while(ub-lb>1){
        mid = (ub+lb)/2;
        if(query(mid)) lb=mid;
        else ub=mid;
    }
    while(true) query(lb++);
}

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

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

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

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

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

    cin >> n;
    if (n == 1)
        Cout(0);
    else
    {
        rep(i, n) cin >> a[i];
        rep(i, n) p[i] = make_pair(a[i], i);
        sort(p, p + n);
        cnt = 1;
        ll ma = 0;
        rep(i, n - 1)
        {
            if (p[i].second > p[i + 1].second)
                cnt = 1;
            else
                cnt++;
            ma = max(ma, cnt);
        }
        Cout(n - ma);
    }
    return 0;
}


Measured memory_bytes: 18688
#include<stdio.h>
int main()
{
	int a,b,c,d,min,min1,i;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a<=b)  min=a;
	else min=b;
	if(c<=d)  min1=c;
	else min1=d;
	i=min+min1;
	printf("%d\n",i);
	 return 0;


}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

// 最大公約数
int gcd(int a, int b){
    int c;
    if (a < b) {
        a+=b; b=a-b; a-=b;
    }
    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main(void){
    int n; 
    cin >> n;
    vector<int> A(n), left(n), right(n);
    REP(i, n) cin >> A[i];
    int ans = 0;
    left[0] = A[0];
    right[0] = A[n - 1];
    FOR(i, 1, n){
        left[i] = gcd(left[i - 1], A[i]);
        right[i] = gcd(right[i - 1], A[n - 1 - i]);
    }
    REP(i, n){
        if(i == 0) ans = max(ans, right[n - 2]);
        else if(i == n - 1) ans = max(ans, left[n - 2]);
        else ans = max(ans, gcd(left[i - 1], right[n - i - 2]));
    }
    cout << ans << endl;

}

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

int main() {
  string x;
  cin>>x;
  if(x=="abc"||x=="acb"||x=="bac"||x=="bca"||x=="cab"||x=="cba")cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int n,d,x,y,ans;
int read(){
	int x = 0,f = 1;
	char c = getchar();
	while(c < '0' || c > '9') c = getchar();
	while(c >= '0' && c <= '9') x = x * 10 + (c ^ 48),c = getchar();
	return x;
}
inline double dis(int x,int y){
	return sqrt(1ll * x * x + 1ll * y * y);
}
int main(){
	n = read(),d = read();
	for(int i = 1; i <= n; i ++){
		x = read(),y = read();
		if(dis(x,y) <= d) ans ++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3712
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
//从第一个开始翻转，翻转前m个或者后n-m个
const int maxn = 1e5+5;
int main()
{
    char s[maxn];
    int len;
    int res;
    scanf("%s", s);
    len = strlen(s);
    res = len;
    for(int i = 1; i < len; i++)
    {
        if(s[i] != s[i-1])
            res = min(res, max(i, len-i));
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 1016
#include<iostream>
#include<string>
#include<cmath>

using std::cout;
using std::cin;
using std::string;
using std::endl;
using std::pow;

int main(){
    bool b=true;
    string S,T;
    cin >> S;
    cin >> T;
    for(int i=0;i<S.length();i++){
        if(S[i] != T[i]) b=false;
    }
    if(b) cout << "Yes";
    else cout << "No";
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b+c==5+7+5 and a*b*c==5*7*5) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

using namespace std;
#define int long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
typedef pair<int, pii> pip;

int N;
ppi px[100100];
ppi py[100100];
vector<pip> edge;

struct UF {
    const static int size = 100100;
    int par[size];
    int rank[size];

    UF(int n) {
        rep(i, n) {
            par[i] = i;
            rank[i] = 1;
        }
    }

    int root(int x) {
        if (par[x] == x)return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank[x] == rank[y])rank[x]++;
        }
    }

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

signed main() {
    cin >> N;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        px[i] = ppi(pii(x, y), i);
        py[i] = ppi(pii(y, x), i);
    }
    sort(px, px + N);
    sort(py, py + N);
    rep(i, N - 1) {
        int x0 = px[i].first.first;
        int x1 = px[i + 1].first.first;
        int cost = x1 - x0;
        int i0 = px[i].second;
        int i1 = px[i + 1].second;
        edge.push_back(pip(cost, pii(i0, i1)));
    }
    rep(i, N - 1) {
        int y0 = py[i].first.first;
        int y1 = py[i + 1].first.first;
        int cost = y1 - y0;
        int i0 = py[i].second;
        int i1 = py[i + 1].second;
        edge.push_back(pip(cost, pii(i0, i1)));
    }
    sort(edge.begin(), edge.end());

    UF uf(N + 10);
    int ans = 0;
    rep(i, edge.size()) {
        pii p = edge[i].second;
        if (!uf.same(p.first, p.second)) {
            ans += edge[i].first;
            uf.unite(p.first, p.second);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }

int main() {
	ll n,a,b; cin>>n>>a>>b;
    ll cnt = 0;
    rep(i,n){
        ll v; cin >> v;
        if(v<a or v>=b) cnt++;
    }
    cout << cnt << endl;
}

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

int main(){
	int n,m;
	cin>>n>>m;
	int a[n][m],b[m],c[n];
	for(int i=0;i<n;i++) c[i]=0;

	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++) cin>>a[i][j];
	}
	for(int i=0;i<m;i++) cin>>b[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++) c[i]+=(a[i][j]*b[j]);
	}
	for(int i=0;i<n;i++){
		cout<<c[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3100
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N;
  cin >> N;
  vec<ll> A(N);
  REP(i, N) cin >> A[i];

  ll res = 1;
  optional<int> global_grad;
  FOR(i, 1, N) {
    optional<int> local_grad;
    if (A[i - 1] < A[i]) {
      local_grad = -1;
    } else if (A[i - 1] > A[i]) {
      local_grad = 1;
    }
    if (!global_grad) {
      global_grad = local_grad;
    } else if (global_grad && local_grad && global_grad != local_grad) {
      res++;
      global_grad = nullopt;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3992
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n,X=map(int,input().split())
x = list(map(int,input().split()))
x_d = [abs(X-x1) for x1 in x]
a = x_d[0]
for i in range(n-1):
    a = gcd(a,x_d[i+1])
print(a)

Measured memory_bytes: 14252
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void mysort(vector<pll> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n,m ;
	cin >> n >> m ;
	vb q(m,true) ;
	vector<pll> a(m),b(m) ;
	for(int i=0;i<m;i++){
		cin >> a.at(i).first ;
		a.at(i).second = i ;
		cin >> b.at(i).first ;
		b.at(i).second = i ;
	}
	mysort(a) ;
	mysort(b) ;
	ll ans = 0 ;
	ll pos = 0 ;
	for(int i=0;i<m;i++){
		if(q.at(b.at(i).second)){
			ans++ ;
			q.at(b.at(i).second) = false ;
			while(pos!=m){
				if(!q.at(a.at(pos).second)){
					pos++ ;
					continue ;
				}
				if(a.at(pos).first<b.at(i).first){
					q.at(a.at(pos).second) = false ;
					pos++ ;
				}else break ;
			}
		}
	}
	cout << ans << endl ;
}


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

int h, w;
typedef pair<int, int> P;

int main(void){
  while(cin >> h >> w && h && w){
    pair<P, int> p(P(w * w + h * h, h), w);
    vector<pair<P, int> > v;

    for(int h_ = 1; h_ <= 150; h_++){
      for(int w_ = 1; w_ <= 150; w_++){
        if(h_ < w_) v.push_back(pair<P,int>(P(w_ * w_ + h_ * h_, h_), w_));
      }
    }

    sort(v.begin(), v.end());
    for(int i = 0; i < v.size(); i++){
      if(p < v[i]){
        cout << v[i].first.second << " " << v[i].second << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1364
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
using namespace std;
typedef long long ll;
int main() {
	int n;
	cin >> n;
	if (n == 0) {
		cout << '1' << endl;
	}
	else {
		cout << '0' << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
class Graph():  #directed
    def __init__(self, n, edge, indexed=1):
        self.n = n
        self.graph = [[] for _ in range(n)]
        self.deg = [0 for _ in range(n)]
        for e in edge:
            self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))
            self.deg[e[1] - indexed] += 1

    def dijkstra(self, s, INF=10**18, restore_to=None):
        dist = [INF for _ in range(self.n)]
        dist[s] = 0
        heap = [(0, s)]
        while heap:
            cost, node = heappop(heap)
            if dist[node] < cost:
                continue
            for adj, adjcost in self.graph[node]:
                if dist[node] + adjcost < dist[adj]:
                    dist[adj] = dist[node] + adjcost
                    heappush(heap, (dist[adj], adj))
        if restore_to is not None:
            g = restore_to
            if dist[g] == INF:
                return dist, False
            path = [g]
            node = g
            while node != s:
                node = prev[node]
                path.append(node)
            return dist, path[::-1]
        return dist

    def bellman_ford(self, s, t=None, INF=10**18):
        dist = [INF for _ in range(self.n)]
        dist[s] = 0
        update = True
        for i in range(self.n):
            update = False
            for node, g in enumerate(self.graph):
                for adj, adjcost in g:
                    if dist[node] != INF and dist[node] + adjcost < dist[adj]:
                        dist[adj] = dist[node] + adjcost
                        update = True
            if not update:
                return dist[t] if t is not None else dist
        if t is None:
            return
        negative_cycle = [0 for _ in range(self.n)]
        for i in range(self.n):
            for node, g in enumerate(self.graph):
                for adj, adjcost in g:
                    if dist[node] != INF and dist[node] + adjcost < dist[adj]:
                        dist[adj] = dist[node] + adjcost
                        negative_cycle[adj] = True
        if not negative_cycle[t]:
            return dist[t]

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
E = []

for _ in range(M):
    a, b, c = map(int, input().split())
    E.append((a, b, -c))

g = Graph(N, E)
bf = g.bellman_ford(0, N - 1)

print(-bf if bf is not None else 'inf')

Measured memory_bytes: 46812
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>

bool dfs(std::set<int> A, std::set<int> B, int min, int max, bool a_plays) {
  if (A.empty()) return true;
  if (B.empty()) return false;

  if (a_plays) {
    bool can_pass = true;
    if (A.count(min-1)) {
      can_pass = false;
      A.erase(min-1);
      if (dfs(A, B, min-1, max, false)) return true;
      A.insert(min-1);
    }
    if (A.count(max+1)) {
      can_pass = false;
      A.erase(max+1);
      if (dfs(A, B, min, max+1, false)) return true;
      A.insert(max+1);
    }
    if (!can_pass) return false;
    return dfs(A, B, min, max, false);
  } else {
    bool can_pass = true;
    if (B.count(min-1)) {
      can_pass = false;
      B.erase(min-1);
      if (!dfs(A, B, min-1, max, true)) return false;
      B.insert(min-1);
    }
    if (B.count(max+1)) {
      can_pass = false;
      B.erase(max+1);
      if (!dfs(A, B, min, max+1, true)) return false;
      B.insert(max+1);
    }
    if (!can_pass) return true;
    return dfs(A, B, min, max, true);
  }
  assert(false);
}

int solve_testcase() {
  std::vector<int> A0(6);
  std::set<int> B{1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13};
  for (auto& ai: A0) {
    scanf("%d", &ai);
    B.erase(ai);
  }
  std::set<int> A(A0.begin(), A0.end());

  puts(dfs(A, B, 7, 7, true)? "yes":"no");
  return 0;
}

int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; ++i)
    solve_testcase();
}



Measured memory_bytes: 2688
import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))
B = [[0] * n for i in range(2)]

k = 10**4 * 3

for i in range(n):
    B[0][i] = k * (i+1)
    B[1][n-1-i] = k * (i+1)


for i in range(n):
    B[0][A[i]-1] += i

for i in range(2):
    print(" ".join([str(j) for j in B[i]]))

Measured memory_bytes: 44996
require 'prime'
sum = 0
memo = (0..(10 ** 5)).each_with_object({}) do |i, h|
  sum += 1 if i.odd? && i.prime? && (i / 2 + 1).prime?
  h[i] = sum
end
gets.to_i.times do
  l, r = gets.split.map(&:to_i)
  puts memo[r] - memo[l - 1]
end


Measured memory_bytes: 11644
#include <iostream>

using namespace std;

const int MAXN = 1e2+2;
int nums[MAXN];

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

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

	//遍历搜索
	int ans = 0;
	int minn = 100;
	for (int i=0; i<MAXN; i++) {
		if (0==nums[i]) {
			if (minn>abs(i-x)) {
				ans = i;
				minn = abs(i-x);
			}
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    int c = 0;
    int ans = 0;
    rep(i,n){
        if(a[i] == a[i+1]) c++;
        if(a[i] != a[i+1]){
          	c++;
            if(c%2 != 0) ans++; 
            c = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N;
  cin >> N;
  
  vector <int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  
  sort(L.begin(), L.end());
  
  int sum = 0;
  for (int i = 0; i < N - 1; i++) {
    sum += L[i];
  }
  
  if (sum <= L[N - 1]) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18+7
#define pi 3.1415926535
vector<vector<ll>> v;
vector<ll> vis, dep1, dep2, dep3;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n,m,sss;
	cin>>n>>m>>sss;
	if(sss>2500)
	sss=2500;
	ll dp[n+1][5503];
	for(ll i=0;i<=n;i++)
	{
	    for(ll j=0;j<=5000;j++)
	    dp[i][j]=inf;
	}
	vector<vector<pair<ll,pair<ll,ll>>>> v;
	v.resize(n+1);
	ll u,uu,a,b,c,d;
	for(ll i=0;i<m;i++)
	{
	    cin>>u>>uu>>a>>b;
	    v[u].pb(mk(uu,mk(a,b)));
	    v[uu].pb(mk(u,mk(a,b)));
	}
	vector<pair<ll,ll>> nod;
	nod.pb(mk(0,0));
	for(ll i=1;i<=n;i++)
	{
	    cin>>c>>d;
	    nod.pb(mk(c,d));
	}
	set<pair<ll,pair<ll,ll>>> s;
    dp[1][sss]=0;
	s.insert(mk(0,mk(1,sss)));
	while(s.size())
	{   
	    auto it=s.begin();
	    ll t=it->ff;ll i=it->ss.ff;ll c=it->ss.ss;
	   // cout<<t<<" time"<<i<<"node"<<c<<"coins left"<<endl;
	    s.erase(it);//cout<<nod[i].ff<<"coin"<<nod[i].ss<<"dsd"<<endl;
	   // cout<<dp[i][c+nod[i].ff]<<"ori"<<dp[i][c]+nod[i].ss<<endl;
	    if(c+nod[i].ff<=2500&&(dp[i][c+nod[i].ff]>dp[i][c]+nod[i].ss))
	    {
	        
	        auto it =s.find(mk(dp[i][c+nod[i].ff],mk(i,c+nod[i].ff)));
	        if(it!=s.end())
	        s.erase(it);
	        s.insert(mk(dp[i][c]+nod[i].ss,mk(i,c+nod[i].ff)));
	        dp[i][c+nod[i].ff]=dp[i][c]+nod[i].ss;
	    }
	    for(int j=0;j<v[i].size();j++)
	    {
	        ll u=v[i][j].ff;ll cs=v[i][j].ss.ff;ll ti=v[i][j].ss.ss;
	        if(c-cs>=0&&(dp[u][c-cs]>dp[i][c]+ti))
	        {
	            //cout<<dp[u][c-cs]<<"ori"<<dp[i][c]<<endl;
	            auto it=s.find(mk(dp[u][c-cs],mk(u,c-cs)));
	             if(it!=s.end())
	             s.erase(it);
	            s.insert(mk(dp[i][c]+ti,mk(u,c-cs)));
	            dp[u][c-cs]=dp[i][c]+ti;
	        }
	    }
	   // cout<<s.size()<<endl;
	    
	}
	
    for(ll i=2;i<=n;i++)
    {
        ll mn=inf;
        for(ll j=0;j<=5000;j++)
        mn=min(mn,dp[i][j]);
       
         cout<<mn<<endl;
    }
	return 0;
}


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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string a;
  cin >> a;
  
  ll ans = a.size() * (a.size() - 1) / 2 + 1;
  
  vector<ll> x(26);
  for(int i = 0; i < a.size(); i++) x.at(a.at(i) - 'a')++;
  
  for(int i = 0; i < 26; i++) ans -= x.at(i) * (x.at(i) - 1) / 2;
  
  cout << ans << '\n';
}

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

namespace abc088b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(s => int.Parse(s)).ToList();
            var num = a.Distinct().Count();
            Console.Write(n == num ? "YES":"NO");
        }
    }
}


Measured memory_bytes: 37940
#include<iostream>
using namespace std;
int a[100];
int main(){
	int n,key;
	while(true){
		cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++)cin>>a[i];
		cin>>key;
		int ans=0;
		int left=0,right=n-1,mid;
		while(true){
			if(left>right)break;
			mid=(left+right)/2;
			ans++;
			if(a[mid]==key)break;
			if(a[mid]<key)left=mid+1;
			if(a[mid]>key)right=mid-1;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	l := make([]int, n+1)
	l[0], l[1] = 2, 1

	for i := 2; i <= n; i++ {
		l[i] = l[i-1] + l[i-2]
	}

	fmt.Println(l[n])
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
int a, b;
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
  	cin >> a >> b;
  	cout << max(max(a + b, a - b), a * b) << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 *   created: 03 June 2019  00:25:23
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


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

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
	optimizeIO();
	int tt=1;
	//cin>>tt;
	while(tt--){
		int n,k;
		cin>>n>>k;
		string s;
		cin>>s;
		vi pref(n,0);
		int flag=0,flag1=0;
		pref[0] = 0;
		if(s[0]=='0'){
			pref[0]++;
			flag=1;
		}
		rep(i,1,n){
			if(s[i]=='0' && flag==0 ){
				pref[i] = pref[i-1]+1;
				flag=1;
			}
			else if(s[i]=='1'){
				flag=0;
				pref[i]= pref[i-1];
			}
			else{
				pref[i] = pref[i-1];
			}
		}
		// rep(i,0,n)
		// 	cout<<pref[i]<<" ";
		// cout<<endl;
		int maxi = 0;
		rep(i,0,n){
			int ind;
			if(s[i]=='0')
				ind = upper_bound(all(pref), pref[i]+k-1) - pref.begin();
			else
				ind = upper_bound(all(pref), pref[i]+k) - pref.begin();
			// trace2(ind,i);
			maxi = max(maxi , ind-i);
		}
		cout<<maxi;
	}
	return 0;
}


Measured memory_bytes: 848
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    int N;
    Scanner in=new Scanner(System.in);
    N=in.nextInt();
    int i;
    i=N%10;
    if(i==3)
      System.out.println("bon");
    else if(i==2 ||i==4 ||i==5 ||i==7 ||i==9)
      System.out.println("hon");
    else 
      System.out.println("pon");
  }
}
    


Measured memory_bytes: 35736
def main():
    N = int(input())
    T = [int(input()) for i in range(N)]

    def gcd(x, y):
        if y == 0:
            return x
        while y != 0:
            x, y = y, x % y
        return x

    def lcm(x, y):
        return x*y//gcd(x, y)

    ans = 1
    for t in T:
        ans = lcm(ans, t)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

int main(){
    lli n,a,cnt=0,check=-1;
    map<lli,lli> mp;
    lli i,j;
    cin>>n;
    rep(i,0,n){
        cin>>a;
        mp[a]++;
    }
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        if(check==2){
            cout<<"0"<<endl;
            exit(0);
        }
        else{
            if(check==-1){
                if(itr->first==0&&itr->second==1){
                    check=0;
                }
                else if(itr->first==1&&itr->second==2){
                    cnt++;
                    check=1;
                }
                else{
                    check=2;
                }
            }
            else{
                if(check==itr->first%2){
                    if(check==1&&2*cnt+1==itr->first&&itr->second==2){
                        cnt++;
                    }
                    else if(check==0&&2*cnt+2==itr->first&&itr->second==2){
                        cnt++;
                    }
                    else{
                        cout<<"0"<<endl;
                        exit(0);
                    }
                }
            }
        }
    }
    lli ans=1;
    rep(i,0,cnt){
        ans*=2;
        ans%=N;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4224