akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys


def solve(a: int):
    print(a + a**2 + a**3)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    solve(a)

if __name__ == '__main__':
    main()


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

int main() {
    int n;cin>>n;
    int v[n];
    for (int i=0;i<n;i++)
        cin>>v[i];
    int ans=0;
    int c;
    for (int i=0;i<n;i++) {
        cin>>c;
        ans+=max(0,v[i]-c);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
// #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() {
  string S;
  ll K;
  cin >> S >> K;
  smatch m;
  if (regex_match(S, m, regex("^(1+)([1-9]*)$"))) {
    cout << ((m.length(1) >= K) ? '1' : m.str(2).front()) << endl;
  } else {
    cout << S.front() << endl;
  }
  return 0;
}


Measured memory_bytes: 3876
#include <iostream>
#include <math.h>
using namespace std;

#define REP(i, n) for (int i = 0; (i) < (n); ++i)

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    cout << 2 * x * 3.1415;

    return 0;
}

Measured memory_bytes: 3800
a, b = [int(x) for x in input().split()]
s = input()

ans = ""
ss = ""
for i in range(len(s)):
    if i == a:
        ss += " "
    else:
        ss += s[i]    

if (len(s) != a+b+1) or (s[a] != "-") or ("-" in ss):
    ans = "No"
else:
    ans = "Yes"

print(ans)

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

int main() {
    ll N;
    cin >> N;
    ll i = sqrt(N), j = 1;
    while (true) {
        if (N % i == 0) {
            j = N / i;
            break;
        }
        i--;
    }
    cout << i + j - 2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int ans=10;
    for(int i=0;i<3;i++){
        if(N%ans==7){
            cout << "Yes\n";
            return 0;
        }
        N=N/ans;
    }
    cout << "No\n";
    
    return 0;
}

Measured memory_bytes: 3632
/*-------------------------------"ANJAN AGARWALA"-----------------------------

         _/_/_/_/    _/_/    _/   _/_/_/_/   _/_/_/_/    _/_/    _/   
        _/    _/    _/ _/   _/         _/   _/    _/    _/ _/   _/        
       _/_/_/_/    _/   _/ _/         _/   _/_/_/_/    _/  _/  _/         
      _/    _/    _/    _/_/   _/    _/   _/    _/    _/    _/_/  
     _/    _/    _/      _/   _/_/_/_/   _/    _/    _/      _/   

-------------------------------------@anjn98---------------------------------*/

//#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long long int LL;
typedef unsigned long long int ull;
ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define PR(a)           cout<<"("<<a<<")";
#define ED              cout<<'\n';
#define endl            '\n'
#define loop(j,a,n)     for(int j=a;j<=n;j++)
#define loop1(j,a,n)    for(int j=a;j>=n;j--)
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define SC(n)           scanf("%d",&n)
#define PB              push_back
#define MP              make_pair
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007


const int N=1e5+99;

int n;
ll dp[N][2];
vector<int> g[N];

void solve(int v,int p)
{
    dp[v][0]=dp[v][1]=1;

    trav(x,g[v])
    {
        if(x==p) continue;
        solve(x,v);
        dp[v][1]=(dp[v][1] * 1LL*(dp[x][1]+dp[x][0])%mod)%mod;
        dp[v][0]=(dp[v][0]*dp[x][1]*1LL)%mod;
    }   
}
int main() 
{
    IO
    cin>>n;
    fr(n-1)
    {
        int x,y;
        cin>>x>>y;
        g[x].PB(y);
        g[y].PB(x);
    }
    solve(1,1);



    ll ans=(dp[1][0]+dp[1][1])%mod;

    cout<<ans<<endl;
}




 

Measured memory_bytes: 14208
#include<stdio.h>
#include<string.h>
char ar[10000000];
int main()
{
    int a,c=1,i;
    scanf("%d",&a);
    getchar();
    gets(ar);
    for(i=1;i<a;i++)
    {
        if(ar[i]!=ar[i-1])
            c++;
    }
    printf("%d\n",c);
    return 0;
}


Measured memory_bytes: 256
N=int(input())
a=[]
for n in range(N):
    a.append(input())

M=int(input())
b=[]
for m in range(M):
    b.append(input())

c=[]
for i in range(N):
    d=a.count(a[i])
    e=b.count(a[i])
    c.append(d-e)

answer = max(c)

if answer>=0 :
    print(answer)
else :
    print(0)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
 
long long Modpow(long long a, long long n, long long mod)
{
    long long ans = 1;
    while(n > 0)
    {
        if(n & 1)
        {
            ans = ans * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return ans;
}
 
long long Modinv(long long a, long long mod)
{
    return Modpow(a, mod - 2, mod);
}

int main()
{
    constexpr int PN = 1000000007;
    int a,b,n;
    std::cin >> n >> a >> b;
    
    long long ans = Modpow(2, n, PN);
    ans -= 1;
    if(ans < 0)
    {
        ans += PN;
    }
    
    long long numerA = 1;
    long long denomA = 1;
    for(long long i = 0; i < a; ++i)
    {
        numerA = numerA * (n - i) % PN;
        denomA = denomA * (i + 1) % PN;
    }
    const long long ca = numerA * Modinv(denomA, PN) % PN;
    
    long long numerB = 1;
    long long denomB = 1;
    for(long long i = 0; i < b; ++i)
    {
        numerB = numerB * (n - i) % PN;
        denomB = denomB * (i + 1) % PN;
    }
    const long long cb = numerB * Modinv(denomB, PN) % PN;
    
    ans -= ca;
    if(ans < 0)
    {
        ans += PN;
    }
    
    ans -= cb;
    if(ans < 0)
    {
        ans += PN;
    }
    
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
	long long int c1=0,N,X,i,sum=0,n;
	cin>>N>>X;
	for(i=0;i<N;i++)
	
	{
	cin>>n;
	sum=sum+n;
	if(sum<=X)
	{
		c1++;	
	}
	else
	{
		continue;
	}
}

      cout<<c1+1<<"\n";
      return 0;
  }

Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if((a < b) && (b < c)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}



Measured memory_bytes: 26160
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define txt freopen("ip.txt", "r", stdin); freopen("op.txt", "w", stdout)
#define a3 INT_MAX
#define i3 INT_MIN
#define a6 INT64_MAX
#define i6 INT64_MIN
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define div2(a) (!(a&1))
#define deb(x) cout<<(#x)<<" "<<(x)<<"\n";
#define newl cout<<"\n" 
#define all(s) s.begin(),s.end()
#define pi 3.14159265358979323846
#define mod 1000000007
#define fp(x) fixed<<setprecision(x)<<
template<class T>
int digit(T a)
{
    vector<long long> dig = {
        0,
        9,
        99,
        999,
        9999,
        99999,
        999999,
        9999999,
        99999999,
        999999999,
        9999999999,
        99999999999,
        999999999999,
        9999999999999,
        99999999999999,
        999999999999999,
        9999999999999999,
        99999999999999999,
        999999999999999999,
        INT64_MAX};
    auto it = lower_bound(dig.begin(), dig.end(), a);
    int idx = (it - dig.begin());
    return idx;
}
template<class T>
int sumAllInts(T n){
    int a = 1;
    int su = 0;
    while(n){
        su += n%10;
        n/=10;
    }
    return su;
}
template<class T>
void split(char c,T s){
    int n = s.size();
    int i = 0;
    while ((cout<<s[i],i+=1) && (i<n) && (cout<<c<<' '));
}
void solve(){
    int x; cin>>x;
    if(x < 1200){
        cout<<"ABC";
    }else{
        cout<<"ARC";
    }
    
}
int main(){
    quickie;
    //txt;
    int t= 1;
    while(t--){
        solve(); 
        newl; 
    } 
    return 0;
}

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

using namespace std;

int main()
{
    int n, k, count = 0;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        int t;
        cin >> t;
        if (t >= k)
        {
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int n,h,a[100005],b[100005],maxv=0x8fffffff,maxp,ans,pos;
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	cin>>n>>h;
	for(register int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(register int i=1;i<=n;i++)
	{
		if(a[i]>maxv)
		{
			maxv=a[i];
			maxp=i;
		}
	}
	sort(b+1,b+n+1,cmp);
	for(register int i=1;i<=n;i++)
	{
		if(b[i]>a[maxp])
		{
			pos++;
		}
	}
	for(register int i=1;i<=pos;i++)
	{
		if(h-b[i]>0)
		{
			h-=b[i];
			ans++;
		}
		else
		{
			ans++;
			cout<<ans<<"\n";
			return 0;
		}
	}
	ans+=h/a[maxp];
	if(h%a[maxp]!=0)
	{
		ans++;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
A, B = [], []
for i in range(N):
    tm, p = map(int, input().split())
    A.append(tm), B.append(p)
A.sort(), B.sort()

a = A[N // 2] * 2 if N % 2 == 1 else A[N // 2 - 1] + A[N // 2]
b = B[N // 2] * 2 if N % 2 == 1 else B[N // 2 - 1] + B[N // 2]

print((b - a) // 2 + 1 if N % 2 == 1 else b - a + 1)


Measured memory_bytes: 25556
import java.util.*;

public class Main {
    public static void main(String[] args) {
        long mod = (long) 1e9 + 7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        sc.close();
        ArrayList<Integer> len = new ArrayList<>();
        int l = 1;
        while (l <= n) {
            int r = n / (n / l);
            len.add(r - l + 1);
            l = r + 1;
        }
        int q = len.size();
        long[] dp = new long[k*(q + 1)];
        for (int j = 1; j <= q; j++) {
            dp[j] = len.get(j - 1) + dp[j - 1];
        }
        for (int i = 1; i < k; i++) {
            for (int j = 1; j <= q; j++) {
                dp[i * (q + 1) + j] = dp[i* (q + 1) + j - 1] + dp[(i - 1) * (q + 1) + q - j + 1] * len.get(j - 1);
                dp[i * (q + 1) + j] %= mod;
            }
        }
        System.out.println(dp[k * (q + 1) - 1]);
    }
}


Measured memory_bytes: 74196
#include <cstdio>
#include <iostream>

using namespace std;

const int maxN = 1e5 + 10;
int nodeN, tot;
int val[maxN], cntHas[maxN], dp[1 << 16], num[20], xorSum[1 << 16];

int main () {
	scanf("%d", &nodeN);
	for (int nodeI = 1; nodeI < nodeN; ++nodeI) {
		int n1, n2, len;
		scanf("%d%d%d", &n1, &n2, &len);
		++n1, ++n2;
		val[n1] ^= len;
		val[n2] ^= len;
	}
	for (int nodeI = 1; nodeI <= nodeN; ++nodeI) ++cntHas[val[nodeI]];
	int ans = 0;
	for (int valI = 1; valI < 16; ++valI) {
		ans += cntHas[valI] >> 1;
		cntHas[valI] &= 1;
		if (cntHas[valI] != 0) {
			num[++tot] = valI;
		}
	}
	for (int stI = 0; stI < (1 << tot); ++stI) {
		for (int weiJ = 0; weiJ < tot; ++weiJ) {
			if ((stI & (1 << weiJ)) != 0) {
				xorSum[stI] ^= num[weiJ + 1];
			}
		}
	}
	for (int stI = 0; stI < (1 << tot); ++stI) {
		if (xorSum[stI] > 0) {
			dp[stI] = 0x3f3f3f3f;
			continue;
		}
		for (int weiJ = 0; weiJ < tot; ++weiJ) {
			if ((stI & (1 << weiJ)) != 0) {
				++dp[stI];
			}
		}
		--dp[stI];
	}
	dp[0] = 0;
	for (int stI = 0; stI < (1 << tot); ++stI) {
		if (xorSum[stI] != 0) continue;
		for (int son = stI & (stI - 1); son; son = stI & (son - 1)) {
			if (xorSum[son] == 0) {
				dp[stI] = min(dp[stI], dp[stI ^ son] + dp[son]);
			}
		}
	}
	ans += dp[(1 << tot) - 1];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 896
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int n = in.nextInt();
		long ans = 1;
		for (int i=2; i<=n; i++) {
			ans *= i;
		}
		out.println(ans);
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 26220
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

int main() {
  int H, W; cin >> H >> W;
  rep(i, H) rep(j, W) {
    string S; cin >> S;
    if (S=="snuke") {
      char pos = 'A'+j;
      cout << pos << i+1 << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i > 0; i--)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
template <typename Iter> std::string join(Iter begin, Iter end, std::string const& separator){ std::ostringstream result; if (begin != end){ result << *begin++; }; while (begin != end){ result << separator << *begin++; }; return result.str(); }
using namespace std;
typedef long long ll;
void solve() {
  ll N; cin >> N;
  vector<double> A(N), B(N);
  REP(i,N) {
    cin >> A[i];
    B[i] = 1 / A[i];
  }
  sort(ALL(B));
  double sum = 0;
  for(auto b: B) {
    sum += b;
  }
  cout << fixed;
  cout << setprecision(6) <<  1 / sum << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256
/* 
 * Author: aps
 * Time: 2020-01-26 21:48:24
**/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
 
using namespace __gnu_pbds;
using namespace std;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
 
const ll inf = 1e18;
const ll mod = 1e9+7;
 
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x;}
inline ll sub(ll x, ll y) { x -= y; if (x < 0) x += mod; return x;}
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod;}
inline ll gcd(ll x, ll y) { return x == 0 ? y : gcd(y % x, x); }
inline ll power(ll a, ll b) {
    ll x = 1;
    while (b) {
        if (b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}
inline ll inv(ll a) { return power(a, mod - 2);}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,k; cin >> n >> k;
    vi h(n,0);
    for(int i=0; i<n; i++) {
        cin >> h[i];
    }
    sort(all(h));
    reverse(all(h));
    ll ans = 0;
    for(int i=k;i<n;i++) ans += h[i];
    cout << ans << "\n";
    return 0;
}










Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,d;
int main(){
	cin>>n>>d;
	cout<<(n+2*d)/(2*d+1)<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	int N, K;
	cin >> N >> K;
	vector<LL> H(N);
	for (int i = 0; i < N; ++i) {
		cin >> H[i];
	}
	sort(H.begin(), H.end());
	
	LL ans = LINF;
	for (int i = 0; i + K - 1 < N; ++i) {
		LL res = H[i + K - 1] - H[i];
		chmin(ans, res);
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline

def main():
    A,B,C = map(int,input().split())
    if A == B == C:
        if A%2 == 0:
            print(-1)
        else:
            print(0)
    else:
        for i in range(10**5):
            if (A%2 == 1 or B%2 == 1 or C%2 == 1):
                print(i)
                exit()
            _A,_B,_C = A,B,C
            A = (_B+_C)//2
            B = (_A+_C)//2
            C = (_A+_B)//2 
        
if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
def calculate(m,n):
    s1 = calculate2(m-1)
    s2 = calculate2(n)
    return xor(s1,s2)

# from 0
def calculate2(n):
    if n % 2 == 1:
        if ((n - 1) / 2) % 2 == 0:
            return xor(xor(0,n-1),n)
        else:
            return xor(xor(1,n-1),n)

    else:
        if ((n / 2) % 2) == 0:
            return xor(0,n)
        else:
            return xor(1,n)

def xor(m,n):
    return n ^ m


S = input().split(" ")

result = calculate(int(S[0]),int(S[1]))

print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, M;
    cin >> N >> M;
    vector<string> A(N);
    vector<string> B(N);
    for(int i=0; i<N; ++i) cin >> A[i];
    for(int j=0; j<M; ++j) cin >> B[j];
    bool ans = false;
    for(int i=0; i<N-M+1; ++i){
        for(int j=0; j<N-M+1; ++j){
            bool exist_ans = true;
            for(int k=0; k<M; ++k){
                if(A[i+k].substr(j, M) != B[k]){
                    exist_ans = false;
                    break;
                }
                //else{
                    //cout << "match " <<  B[k] << "\n";
                //}
            }
            //if(exist_ans){
                //cout << i << " " << j << "\n";
            //}
            ans |= exist_ans;
        }
    }
    
    if(ans)
        cout<< "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

int t[(1<<18)];
//0 2 1 0 0 
//0 2 1 0 0 65536
//0 2 1 0 0 2
void Set(int a,int b,int x,int k=0,int l=0,int r=(1<<17)){
  if(b<=l || r<=a)return;
  if(a<=l && r<=b){
    t[k]=max(t[k],x);
    return;
  }
  int m=(l+r)/2;
  
  Set(a,b,x,k*2+1,l,m);
  Set(a,b,x,k*2+2,m,r);
}

int Get(int i){
  i+=(1<<17)-1;
  int res=t[i];
  while(i){
    i=(i-1)/2;
    res=max(res,t[i]);
  }
  return res;
}

int n,q;
int value[100005];

int main(){
  value[0]=2147483647;

  scanf("%d %d",&n,&q);
  for(int i=1;i<=q;i++){
    int type;
    scanf("%d",&type);
    if(type==0){
      int l,r;
      scanf("%d %d %d",&l,&r,&value[i]);
      r++;
      Set(l,r,i);
    }else{
      int target;
      scanf("%d",&target);
      int ans=Get(target);
      printf("%d\n",value[ans]);
    }
  }
  return 0;
}

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

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

  if(a == b == 1) {
    cout << "Draw" << endl;
  } else if(a == 1) {
    cout << "Alice" << endl;
  } else if(b == 1) {
    cout << "Bob" << endl;
  }else{
    if(a > b) {
      cout << "Alice" << endl;
    }else if(a < b) {
      cout << "Bob" << endl;
    }else{
      cout << "Draw" << endl;
    }
  }
}


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

int main(){
  int n;cin>>n;
  vector<double> coins(n);
  for(int i=0;i<n;++i)cin>>coins[i];
  
  vector<double> winsLst(n+1);
  vector<double> wins(n+1);
  winsLst[0] = 1.0;
  
  for(int i=0;i<n;++i){
    for(int j=0;j<i+1;++j){
      wins[j] += winsLst[j] * (1.0 - coins[i]);
      wins[j+1] += winsLst[j] * coins[i];
    }
    winsLst = wins;
    for(int j=0;j<=i+1;++j){
      wins[j]=0;
    }
  }
  double result = 0.0;
  for(int i=(n+1)/2;i<=n;++i){
    result += winsLst[i];
  }
  cout<<setprecision(10)<<result<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
class Main{
	public static void main(String[] args) throws IOException {
		int[] n = new int[5];
		String[] str = new String[5];
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		str = in.readLine().split(" ");
		n[0] = Integer.parseInt(str[0]);
		n[1] = Integer.parseInt(str[1]);
		if(n[0]<n[1]) System.out.println("a < b");
		else if(n[0]==n[1]) System.out.println("a == b");
		else if(n[0]>n[1]) System.out.println("a > b");
	}
}

Measured memory_bytes: 24212
n,d = map(int,input().split())
w = [list(map(int,input().split())) for a in range(n)]
c = 0
 
for i in range(n-1):
  for j in range(i+1,n):
    b = 0
    for m in range(d):
      b += (w[i][m]-w[j][m])**2
    if (b**0.5)==float(int(b**0.5)):
      c += 1
      
print(c)

Measured memory_bytes: 3060
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long long solve(vector<int>& A, int K) {
        int n = A.size();

        long long res = 0;
        for (int s = 1; s <= K && s <= n; ++s) {
            for (int i = 0; i <= s; ++i) {
                int j = s - i;
                vector<int> S;
                for (int k = 0; k < i; ++k) {
                    S.push_back(A[k]);
                }
                for (int k = n - j; k < n; ++k) {
                    S.push_back(A[k]);
                }
                sort(S.begin(), S.end(), greater<int>());
                int rem = K - s;
                while (rem > 0 && S.size() > 0 && S.back() < 0) {
                    S.pop_back();
                    --rem;
                }
                long long ans = 0;
                for (auto x : S) {
                    ans += x;
                }
                // cout << i << " " << j << " " << s << " " << ans << endl;
                res = max(res, ans);
            }
        }
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; 
    cin >> n;
    int k;
    cin >> k;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    Solution sol;
    cout << sol.solve(A, k) << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
//const int mod=1e9+7;
const int mod=998244353;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=1e6+10;
const ll inf=0x3f3f3f3f;
const int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}};


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ll n,t;
    cin>>n;
    int ans=0;
    for(ll i=1;i*i<=n-1;i++){
        if((n-1)%i==0){
            if(i!=1)ans++;
            if((n-1)/i!=i)ans++;
        }
    }

    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            t=n;
            while(t%i==0)t/=i;
            if(t%i==1)ans++;
        }
    }
    cout<<ans+1;
    return 0;
}


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

int main(){
  string S,T; cin >> S >> T;
  int ans = 0;
  for(int i=0;i<S.size();i++){
    if(S.at(i) != T.at(i))  ans ++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3924
#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>;
ll mod = 1e9 + 7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n, 0);
  vector<int> pos, neg;
  rep(i, n) {
    cin >> a.at(i);
    if (a.at(i) < 0) neg.push_back(a.at(i));
    else pos.push_back(a.at(i));
  }

  // 正にできる組み合わせがあるか調べる
  bool ok = true;
  int posSize = pos.size();
  int negSize = neg.size();
  if (posSize == 0) {
    ok = (k % 2 == 0);
  } else {
    if (n == k) ok = (negSize % 2 == 0);
  }

  mint ans = 1;
  if (!ok) {
    // できない場合は絶対値の小さい順に取る
    sort(a.begin(), a.end(), [](int x, int y) {
      return abs(x) < abs(y);
    });
    rep(i, k) ans *= a.at(i);
  } else {
    // できる場合は積を大きくできる組み合わせを選ぶ
    sort(pos.begin(), pos.end());
    sort(neg.rbegin(), neg.rend());
    if (k % 2 == 1) {
      ans *= pos.back();
      pos.pop_back();
    }

    vector<ll> p;
    while (pos.size() > 1) {
      ll tmp = pos.back(); pos.pop_back();
      tmp *= pos.back(); pos.pop_back();
      p.push_back(tmp);
    }
    while (neg.size() > 1) {
      ll tmp = neg.back(); neg.pop_back();
      tmp *= neg.back(); neg.pop_back();
      p.push_back(tmp);
    }
    sort(p.rbegin(), p.rend());
    rep(i, k/2) ans *= p.at(i);
  }

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

Measured memory_bytes: 6368
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;



int main(void){
    while(true){
        int m,n,p;
        cin>>m>>n>>p;
        if(m==0 && n==0 && p==0)break;
        int total=0;
        int winnum=0;
        for(int i=0;i<m;i++){
            int x;
            cin>>x;
            total+=x;
            if(i==n-1)winnum=x;
        }
        total*=100;
        total=total*(100-p)/100;
        if(winnum!=0){
            int ans=(int)total/winnum;
            cout<<ans<<endl;
        }
        else cout<<0<<endl;
    }
    return 0;
}


Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int A=0, T=0, R=0, N = 0, K = 1;
int X, Y;
//vector<int> M(5);
cin >> X >> Y;
if(Y%2==1){
	cout << "No" << endl;
	return 0;
}
for(int i = 0; i <= X; i++){
	if(i*2+(X-i)*4==Y){
		cout << "Yes" << endl;
		return 0;
	}
}

cout << "No" << endl;

}

Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#define INF (__INT32_MAX__ / 2)

using namespace std;

int main(int argc, char **argv) {
    int a, b, k;
    scanf("%d %d %d", &a, &b, &k);

    int min = a < b ? a : b;

    int i = 0;
    int j;
    for( j = min; j >= 1; --j) {
        if( a % j == 0 && b % j == 0)
            ++i;
        if(i == k) break;
    }

    printf("%d\n", j);
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
    int i,j,n,m=0;
    int num[6],NUM[6];

    for(i=0;i<6;i++){
        scanf("%d",&num[i]);
    }
    scanf("%c",&i);
    for(i=0;i<6;i++){
        scanf("%d",&NUM[i]);
    }
    for(i=0;i<6;i++){
        if(i>0 && i<5){
            n=num[1];
            num[1]=num[3];
            num[3]=num[4];
            num[4]=num[2];
            num[2]=n;
            if(i==4){
                n=num[0];
                num[0]=num[1];
                num[1]=num[5];
                num[5]=num[4];
                num[4]=n;
            }
        }else if(i==5){
            n=num[0];
            num[0]=num[5];
            num[5]=n;
            n=num[1];
            num[1]=num[4];
            num[4]=n;
        }
        for(j=0;j<4;j++){
            if(num[0]==NUM[0] && num[1]==NUM[1] && num[2]==NUM[2] && num[3]==NUM[3] && num[4]==NUM[4] && num[5]==NUM[5]){
                m=1;
                break;
            }
            n=num[0];
            num[0]=num[2];
            num[2]=num[5];
            num[5]=num[3];
            num[3]=n;
        }
        if(m==1){
            break;
        }
    }
    if(m==1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}   


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007

int main(){
    int a; cin >> a;
    char b; cin >> b;
    int c; cin >> c;
    if(b=='+') cout << a + c << endl;
    else cout << a - c << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


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

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

signed main(){
  string s;cin>>s;
  if(s[2] == s[3] && s[4] == s[5])cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
// Title:
// URL: https://atcoder.jp/contests/abc118
#pragma region Library

#include <bits/stdc++.h>

using namespace std;

using ll = long long int;  // int_fast64_t;

template <class T>
using vt = vector<T>;
template <class T>
using vvt = vector<vector<T>>;
using vi = vt<int>;
using vvi = vvt<int>;
using vl = vt<ll>;
using vvl = vvt<ll>;

constexpr int INF = 1 << 30;   // 1073741824 2倍すると-2147483648
constexpr ll INFL = 1l << 62;  // 4611686018427387904 2倍すると-0.9*10^18
constexpr int dx4[] = {0, 1, 0, -1};
constexpr int dy4[] = {1, 0, -1, 0};
constexpr int dx8[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy8[] = {0, -1, 0, 1, -1, -1, 1, 1};
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define RANGE(i, a, b) for (int i = (a); i <= (b); i++)
#define RANGER(i, a, b) for (int i = (b); i >= (a); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, 0, (n))

#pragma endregion
const int maxM = 30;
int main() {
  int N, M;
  cin >> N >> M;
  int cnt[maxM];
  REP(k, M) cnt[k] = 0;
  REP(i, N) {
    int K;
    cin >> K;
    REP(j, K) {
      int index;
      cin >> index;
      index--;
      cnt[index]++;
    }
  }
  int ans = 0;
  REP(k, M) {
    if (cnt[k] == N) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main()
    {
        var nx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        long ans = 0;
        for (int i = 0; i < nx[0] - 1; i++)
        {
            if (a[i] + a[i + 1] > nx[1])
            {
                int eat = Math.Min(a[i + 1], a[i] + a[i + 1] - nx[1]);
                ans += eat;
                a[i + 1] -= eat;
                if (a[i] + a[i + 1] > nx[1])
                {
                    ans += a[i] - nx[1];
                }
            }
        }
        Console.WriteLine(ans);
    }
}



Measured memory_bytes: 25052
#include <stdio.h>
#include <math.h>

int main(void){
  long long int a=100,x,i;
  
  scanf("%lld", &x);
  
  for(i=0;;i++){
    if(a>=x){break;}
    a=floor(1.01*(double)a);
  }
  printf("%lld", i);
  
  
  return 0;
}

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[],int n){
    for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
    }
    cout<<endl;
}

int main() {
    int i,n,m,c=0,k,sum=0;
    c_p_c();
 	cin>>n;
 	// for (int i = 0; ; ++i)
 	// {
 	// 	/* code */
 	// }
 	i=0;
 	while(1){
 		// watch(1<<i);
 		if(1<<i > n)
 			break;
 		i++;


 	}
 	cout<<(1<<i-1)<<endl;
 	return 0;

   }

Measured memory_bytes: 3600
main = interact $ unlines . map (show' . balance) . init . lines
 where show' p = case p of {True -> "yes"; False -> "no"}

balance = null . foldr scan [] . filter (flip elem "()[]")
 where
  scan b [] = [b]
  scan b (a:acc) = if [b,a] == "()" || [b,a] == "[]" then acc else (b:a:acc)

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

now = 0
d = []
for p in a + [0]:
    d.append(abs(p - now))
    now = p

a = [0] + a + [0]
sum_d = sum(d)
for i in range(n):
    ans = sum_d - (d[i] + d[i+1]) + abs(a[i] - a[i+2])
    print(ans)

Measured memory_bytes: 14048
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

using namespace std;

int main(void){
    long long k;
    vector<int> tel,flg;
    tel.push_back(-1);
    flg.push_back(-1);
    int n,temp,town,start_town,init_len,loop_len;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>temp;
        tel.push_back(temp);
        flg.push_back(0);
    }
    flg[1]=1;
    town=1;
    while(1){
        town=tel[town];
        if(flg[town]==1){
            start_town=town;
            break;
        }else{
            flg[town]=1;
        }
    }
    init_len=0;
    for(int i=0;i<n;i++)flg[i]=0;
    town=1;
    while(1){
        if(town==start_town){
            break;
        }
        init_len++;
        town=tel[town];
    }
    loop_len=0;
    town=start_town;
    while(1){
        town=tel[town];
        loop_len++;
        if(town==start_town)break;
    }

    k-=init_len;
    if(k<0){
        k+=init_len;
        town=1;
        while(1){
            if(k==0)break;
            town=tel[town];
            k--;
        }   
    }else{
        k=k%loop_len;
        town=start_town;
        while(1){
            if(k==0)break;
            town=tel[town];
            k--;
        }    
    }
    cout<<town<<endl;
    return 0;
}


Measured memory_bytes: 5096
s=input()
s01=int(s[0])*10+int(s[1])
s23=int(s[2])*10+int(s[3])
if (0<s01<13)and(0<s23<13):
    print("AMBIGUOUS")
elif 0<s01<13:
    print("MMYY")
elif 0<s23<13:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
 
#define M 1000000
#define L 14
 
char H[M][L]; /* Hash Table */

 
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;
}
 
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[9];
    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)==1){
        printf("yes\n");
        } else {
        printf("no\n");
        }
    }
    }
 
    return 0;
}

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

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

	string s; cin >> s;
	rep(i, s.size()-1) {
		if (s[i]==s[i+1]) {
			cout << i+1 << " " << i+2 << endl;
			return 0;
		} else if (i<s.size()-2 && s[i]==s[i+2]) {
			cout << i+1 << " " << i+3 << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = ReadLine().Split().Select(int.Parse).ToArray();
        int count = 0;
        for(int i = n[0]; i <= n[1]; i++)
        {
            if(i % n[2] == 0)
                count++;
        }
        WriteLine(count);
    }
}


Measured memory_bytes: 19004
import queue

H,W=map(int,input().split())
c=[list(map(int,input().split())) for _ in range(10)]

change_list=[]
for i in range(10):
    if i==1:
        change_list.append(0)
    else:
        MIN=c[i][1]
        sub=queue.Queue()
        for g in range(10):
            if i!=g and g!=1 and c[i][g]<c[i][1]:
                sub.put((g,c[i][g]))
        while not sub.empty():
            now,_sum=sub.get()
            MIN=min(_sum+c[now][1],MIN)
            for l in range(10):
                if now!=l and l!=1 and _sum+c[now][l]<MIN:
                    sub.put((l,_sum+c[now][l]))
        change_list.append(MIN)

ans=0
for g in range(H):
    a=list(map(int,input().split()))
    for l in range(W):
        if a[l]!=-1:
            ans+=change_list[a[l]]

print(ans)


Measured memory_bytes: 4080
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
int main(){
	bool cnt[26];
	for(int i = 0; i < 26; i++){
		cnt[i] = false;
	}
	string s;
	getline(cin, s);
	int len = s.size();
	for(int i = 0; i < len; i++){
		cnt[s.at(i) - 'a'] = true;
	}
	for(int i = 0; i < 26; i++){
		if(cnt[i] == false){
			printf("%c\n",i+'a');
			return 0;
		}
	}
	printf("None\n");
	return 0;
}

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

struct Node
{
    int key;
    struct Node *parent;
    struct Node *left;
    struct Node *right;
};

typedef struct Node *NodePointer;

void insert(NodePointer t, int w)
{
    NodePointer x;
    if (t->key <= w)
    {
        if (t->right == NULL)
        {
            x = (NodePointer)malloc(sizeof(struct Node));
            x->key = w;
            x->right = NULL;
            x->left = NULL;
            t->right = x;
        }
        else
        {
            insert(t->right, w);
        }
    }
    else
    {
        if (t->left == NULL)
        {
            x = (NodePointer)malloc(sizeof(struct Node));
            x->key = w;
            x->right = NULL;
            x->left = NULL;
            t->left = x;
        }
        else
        {
            insert(t->left, w);
        }
    }
};

void preorder(NodePointer t)
{
    if (t == NULL)
    {
        return;
    }
    printf(" %d", t->key);
    preorder(t->left);
    preorder(t->right);
};

void inorder(NodePointer t)
{
    if (t == NULL)
    {
        return;
    }
    inorder(t->left);
    printf(" %d", t->key);
    inorder(t->right);
};

void postorder(NodePointer t)
{
    if (t == NULL)
    {
        return;
    }
    postorder(t->left);
    postorder(t->right);
    printf(" %d", t->key);
};

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

    NodePointer tree = (NodePointer)malloc(sizeof(struct Node));

    char input[8];
    int k;

    for (int i = 0; i < n; i++)
    {
        scanf("%s", &input);

        if (strcmp(input, "insert") == 0)
        {
            scanf("%d\n", &k);

            if (i == 0)
            {
                tree->key = k;
                tree->right = NULL;
                tree->left = NULL;
            }

            else
            {
                insert(tree, k);
            }
        }
        else
        {
            inorder(tree);
            printf("\n");

            preorder(tree);
            printf("\n");
        }
    }

    return 0;
}


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

vector<int> input(int N){
    int i;
    vector<int> out(N);
    for(i=0;i<N;i++)cin>>out[i];
    return out;
}

int main(){
    int N,i;
    int odd_count=0;
    int even_count=0;
    int result=0;
    vector<int> A,A_odd,A_even;

    cin>>N;
    A=input(N);

    for(i=0;i<N;i++){
        if(A[i]%2==0){
            result+=A[i];
        }else{
            A_odd.push_back(A[i]);
            result+=A[i];
            odd_count+=1;
        }
    }

    if(odd_count%2==1){
        sort(A_odd.begin(),A_odd.end());
        result-=A_odd[0];
    }

    cout<<result/2<<endl;
    return 0;
}


Measured memory_bytes: 3164