akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)
#define rreps(v, f, l) for (int v = (l), v##_ = (f); v >= v##_; --v)
#define rrep(v, n) rreps(v, 0, n - 1)
#define rlep(v, n) rreps(v, 1, n)
#define show_a(a, size) rep(a##_it, size) std::cout << a[a##_it] << " \n"[a##_it == a##_it_ - 1];
#define show_v(v) show_a(v, v.size())
#define debug(x) std::cerr << #x << " = " << (x) << "\n";

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }

string toStr(int x)
{
  stringstream ss;
  ss << x;
  return ss.str();
}

int main()
{
  int a, b;
  while (~scanf("%d %d", &a, &b)){
    cout << toStr(a + b).size() << endl;
  }
  return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007ll
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define db(x) cout << #x << " = " << x << '\n'
#define sep cout << "********************************************\n"
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL)
ll ans[2003], n, xx, yy;
int main(int argc, char const *argv[])
{
	cin >> n >> xx >> yy;
	for (ll l = 1; l <= n; ++l)
	{
		for (ll r = l + 1; r <= n; ++r)
		{
			if (r < xx)
			{
				ans[r - l] ++;
				continue;
			}
			if (l > yy)
			{
				ans[r - l] ++;
				continue;
			}
			if (l < xx && r > yy)
			{
				ans[xx - l + r - yy + 1] ++;
				continue;
			}
			if (l < xx & r <= yy)
			{
				ll clen = yy - xx + 1;
				ans[xx - l + min(r - xx, clen - (r - xx))] ++;
				continue;
			}
			if (l >= xx && r <= yy)
			{
				ll clen = yy - xx + 1;
				ans[min(r - l, clen - (r - l))] ++;
				continue;
			}
			if (l >= xx && l <= yy && r > yy)
			{
				ll clen = yy - xx + 1;
				ans[r - yy + min(yy - l, clen - (yy - l))] ++;
				continue;
			}
		}
	}
	for (int i = 1; i < n; ++i)
	{
		cout << ans[i] << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
def koch(n, a_x, a_y, b_x, b_y):
  if n == 0:
    return
 
  th = math.pi*60.0/180.0
 
  s_x = (2.0*a_x + 1.0*b_x)/3.0
  s_y = (2.0*a_y + 1.0*b_y)/3.0
  t_x = (1.0*a_x + 2.0*b_x)/3.0
  t_y = (1.0*a_y + 2.0*b_y)/3.0
  u_x = (t_x - s_x)*math.cos(th) - (t_y - s_y)*math.sin(th) + s_x
  u_y = (t_x - s_x)*math.sin(th) + (t_y - s_y)*math.cos(th) + s_y
 
  koch(n-1, a_x, a_y, s_x, s_y)
  print '%.8f %.8f' % (s_x, s_y)
  koch(n-1, s_x, s_y, u_x, u_y)
  print '%.8f %.8f' % (u_x, u_y)
  koch(n-1, u_x, u_y, t_x, t_y)
  print '%.8f %.8f' % (t_x, t_y)
  koch(n-1, t_x, t_y, b_x, b_y)
 
 

import math
n = input()
a_x = 0.0
a_y = 0.0
b_x = 100.0
b_y = 0.0
 
print '%.8f %.8f' % (a_x, a_y)
koch(n, a_x, a_y, b_x, b_y)
print '%.8f %.8f' % (b_x, b_y)

Measured memory_bytes: 6584
#include<bits/stdc++.h>
using namespace std;
const int N=110;
bool pd(int k){
	if(k==1) return 0;
	int sk=sqrt(k);
	for(int i=2;i<=sk;i++) if(!(k%i)) return 0;
	return 1;
}
int n,b[N<<1],link[N],e[N<<1],o[N<<1];
bool g[N][N],vis[N];
bool dfs(int k){
	for(int i=1;i<=e[0];i++){
		if(g[k][i]&&!vis[i]){
			vis[i]=1;
			if(link[i]==-1||dfs(link[i])){
				link[i]=k;
				return 1;
			}
		}
	}
	return 0;
}
int main(){
	int tx;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&tx);
		if(b[b[0]]==tx) b[b[0]]++;
		else b[++b[0]]=tx,b[++b[0]]=tx+1;
	}
	for(int i=1;i<=b[0];i++){
		if(b[i]&1) o[++o[0]]=b[i];
		else e[++e[0]]=b[i];
	}
	for(int i=1;i<=o[0];i++)
		for(int j=1;j<=e[0];j++){
			if(pd(abs(o[i]-e[j]))) g[i][j]=1;
		}
	int k=0;
	memset(link,-1,sizeof(link));
	for(int i=1;i<=o[0];i++){
		memset(vis,0,sizeof(vis));
		if(dfs(i)) k++;
	}
//	cout<<k<<endl;
	cout<<k+((o[0]-k)/2+(e[0]-k)/2)*2+((e[0]-k)%2)*3<<endl;
}

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

int64_t ipowmod( int64_t a, int64_t b, int64_t m ) {
	int64_t n = abs( b );
	int64_t result = 1;

	while( n != 0 ) {
		if( n & 1 ) {
			result = (result * a) % m;
		}

		a = (a * a) % m;
		n = n >> 1;
	}

	return result;
}

int main() {
	ios_base::sync_with_stdio( false );

	int64_t m, n;
	cin >> m >> n;

	cout << ipowmod( m, n, 1e9 + 7 ) << endl;
}



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

int main(){
	int n, q;
	scanf("%d%d", &n, &q);
	vector<vector<long> > vec(n);
	for(int i = 0; i < q; i++) {
		int y, t;
		scanf("%d%d", &y, &t);
		if(y == 0) {
			long x;
			scanf("%ld", &x);
			vec[t].push_back(x);
		}
		if(y == 1) {
			if(!vec[t].empty()) {
				int m = vec[t].size();
				for(int j = 0; j < m - 1; j++)
					printf("%ld ", vec[t][j]);
				printf("%ld\n", vec[t][m-1]);
			}else{
				printf("\n");
			}
		}
		if(y == 2) {
			if(!vec[t].empty()) vec[t].clear();
		}
	}
}



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

int main(){
    int s,m,h;
    cin >> s;

    h = s / 3600;
    m = s % 3600;
    s = m % 60;
    m = m / 60;
    cout << h << ":" << m << ":" << s << endl;

    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <climits>


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

	std::vector<int> buf(3*N, 0);

	for (int i = 0; i < 3*N; ++i) {
		std::cin >> buf[i];
	}

	int64_t topsum = 0;
	std::multiset<int> topset{};
	for (int i = 0; i < N; ++i) {
		topsum += buf[i];
		topset.insert(buf[i]);
	}

	std::multiset<int> botsetSub{}; // 末尾範囲で末尾最小和に含まれないもの
	for (int i = N; i < 3*N; ++i) {
		botsetSub.insert(buf[i]);
	}

	int64_t botsum = 0;
	std::multiset<int> botset{};
	{
		auto itSub = botsetSub.begin();
		for (int i = 0; i < N; ++i) {
			botsum += *itSub;
			botset.insert(*itSub);
			++itSub;
		}
		botsetSub.erase(botsetSub.begin(), itSub);
	} // itSub

	int64_t maxans = topsum - botsum; // 初期状態の答え

	for (int i = 0; i < N; ++i) {
		int val = buf[N + i];

		auto itTop = topset.begin();
		int topmin = *itTop;
		if(val > topmin){
			topsum += val - topmin;
			topset.erase(topset.begin());
			topset.insert(val);
		}

		auto itBot = botset.find(val);
		if (itBot != botset.end()) {
			botset.erase(itBot);

			auto itBotSub = botsetSub.begin();
			int newval = *itBotSub;
			botsetSub.erase(itBotSub);
			botset.insert(newval);

			botsum += newval - val;
		}
		else {
			botsetSub.erase(botsetSub.find(val));
		}
		
		maxans = (std::max)(maxans, topsum - botsum); // N+i番目までとそれ以降を範囲とした時の答え
	}

	std::cout << maxans << std::endl;

	return 0;
}



Measured memory_bytes: 20224
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
using namespace __gnu_pbds;
using namespace std;
const int mod=1e9+7;
// const int mod=998244353;
const int INF=4e18+10;
const int MOD=mod;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


bool no(string s)
{
    return !(s=="0011" || s=="0101"|| s=="1110" || s=="1111");
}

int pow(int a, int b)
{
    int prod=1;
    int mult=a%mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod*=mult;
            prod%=mod;
        }
        mult*=mult;
        mult%=mod;
        b/=2;
    }
    return prod;
}
int inverse(int q)
{
   return pow(q, mod-2);
}

signed main()

{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
       cout.tie(NULL);
     #ifndef ONLINE_JUDGE
        if(fopen("INPUT.txt","r"))
        {
        freopen ("INPUT.txt" , "r" , stdin);
        freopen ("OUTPUT.txt" , "w" , stdout);
        }
     #endif
    auto clk=clock(); 
    // -------------------------------------Code starts here---------------------------------------------------------------------     
    int n, k;
    cin>>n>>k;
    cout<<min(n%k , (k-n%k))<<endl;
    // -------------------------------------Code ends here------------------------------------------------------------------

 
 
    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
 }


Measured memory_bytes: 256
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
    ll N, K;
    cin >> N >> K;
    string s;
    cin >> s;
    ll ans0 = 0;
    for (ll i = 0; i < s.size(); i++) {
        if (i > 0 && s[i] == s[i-1]) {
            ans0++;
        }
    }
    ll cnt = (N-1) - ans0;
    if (cnt % 2 == 0) {
        cout << ans0 + min(K, cnt / 2) * 2 << endl;
    } else {
        if (cnt / 2 + 1 <= K) {
            cout << ans0 + (cnt / 2) * 2 + 1 << endl;
        } else {
            assert(K <= cnt / 2);
            cout << ans0 + K * 2 << endl;
        }
    }
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int k,a,b;
    cin>>k>>a>>b;
    int f=0;
    for(int i=a;i<=b;i++)
    {
    	if(i%k==0)
    	{
    		f=1;
    		break;
		}
	}
	if(f==1)
		cout<<"OK\n";
	else cout<<"NG\n";
    return 0;
}

Measured memory_bytes: 3636
N = int(input())
ary = [int(_) for _ in input().split()]


def bubble_sort(ary, verbose=True):
    flag = True
    count = 0
    while flag:
        i = 0
        flag = False
        for j in range(N - 1, i, -1):
            if ary[j] < ary[j - 1]:
                ary[j], ary[j - 1] = ary[j - 1], ary[j]
                flag = True
                count += 1
        i += 1

    print(' '.join([str(_) for _ in ary]))

    if verbose:
        print(count)


bubble_sort(ary)



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


int main(){
  int n;
  int m;
  cin >> n >> m;
  vector<int> a(m);
  int tisa = 0;
  for(int i=0; i<m; i++){
    cin >> a.at(i);
    tisa += a.at(i);
  }
  if(n - tisa >= 0){
    cout << n-tisa << endl;
  }else{
    cout << -1 << endl;
  }
  
  
  //cout << r*2*3.14159 << endl;
}


Measured memory_bytes: 3668
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::ops::Bound::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout]
fn main() {
    input! {
        n: usize, q: usize,
    }

    let mut dsu = DSU::new(n);
    for _ in 0..q {
        input! {
            t: u8, u: usize, v: usize,
        }
        if t == 0 {
            dsu.merge(u, v);
        } else {
            let res = dsu.same(u, v) as u8;
            println!("{}", res);
        }
    }
}
#[allow(dead_code)]
pub struct DSU {
    parent_or_size: Vec<isize>,
}

#[allow(dead_code)]
impl DSU {
    pub fn new(n: usize) -> Self {
        assert!(n <= std::isize::MAX as usize);
        Self {
            parent_or_size: vec![-1; n],
        }
    }

    pub fn merge(&mut self, a: usize, b: usize) -> usize {
        let mut x = self.leader(a);
        let mut y = self.leader(b);
        if x == y {
            return x;
        }
        if self.parent_or_size[x] > self.parent_or_size[y] {
            std::mem::swap(&mut x, &mut y);
        }
        self.parent_or_size[x] += self.parent_or_size[y];
        self.parent_or_size[y] = x as isize;
        x
    }

    pub fn same(&mut self, a: usize, b: usize) -> bool {
        self.leader(a) == self.leader(b)
    }

    pub fn leader(&mut self, mut a: usize) -> usize {
        while self.parent_or_size[a] >= 0 {
            a = self.parent_or_size[a] as usize;
        }
        a
    }

    pub fn size(&mut self, a: usize) -> usize {
        let leader = self.leader(a);
        -self.parent_or_size[leader] as usize
    }

    pub fn groups(&mut self) -> Vec<Vec<usize>> {
        let mut leader_buf = vec![0usize; self.parent_or_size.len()];
        let mut group_size = vec![0usize; self.parent_or_size.len()];
        for i in 0..self.parent_or_size.len() {
            leader_buf[i] = self.leader(i);
            group_size[leader_buf[i]] += 1;
        }
        let mut result = vec![Vec::new(); self.parent_or_size.len()];
        for i in 0..self.parent_or_size.len() {
            result[i].reserve(group_size[i]);
        }
        for i in 0..self.parent_or_size.len() {
            result[leader_buf[i]].push(i);
        }
        result.retain(|v| !v.is_empty());
        result
    }
}

Measured memory_bytes: 5528
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll INF = 1e16;

int main() {
    ll n, x;
    cin >> n >> x;
    VL a(n);
    REP(i,n) a[i] = lin();

    reverse(ALL(a));
    VL sum(n+1);
    REP(i,n) sum[i+1] = sum[i] + a[i];

    ll mi = INF;
    VL cnt(n+1);
    FOR(t,1,n) cnt[t] = t * x;
    FOR(t,1,n){
        int r = 2 * t;
        if (r > n) r = n;
        cnt[t] += 5 * sum[r];
    }

    FOR(i,3,n){
        FOR(t,1,n){
            int l = (i - 1) * t, r = i * t;
            if (l > n) break;
            if (r > n) r = n;
            cnt[t] += (2 * i + 1) * (sum[r] - sum[l]);
            if (cnt[t] > INF || cnt[t] < 0) cnt[t] = INF;
        }
    }

    FOR(t,1,n) mi = min(mi, cnt[t]);

    ll ans = mi + n * x;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4992
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

template<typename T>
inline void scan(std::deque<T>&v){for(auto&& sv:v){scan(sv);}}

using namespace std;

void solve() {
  int n, m;
  scan(n, m);
  if (n % 2 == 1) {
    FOR (i, 1, m+1) {
      printf("%d %d\n", i, n+1 - i);
    }
    return;
  }
  FOR (i, 1, m+1) {
    int j = n+1 - i;
    if ((j - i) * 2 <= n) {
      j -= 1;
    }
    printf("%d %d\n", i, j);
  }
}

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


Measured memory_bytes: 3228
#include <stdio.h>
int linearsearch(int*, int);

int n;

int main(){
  int i,j,q, cnt = 0;
 
  scanf("%d", &n);
  int s[n];
  for(i = 0; i < n; i ++)
    scanf("%d", &s[i]);
 
  scanf("%d", &q);
  int t[q];
  for(i = 0; i < q; i ++)
    scanf("%d", &t[i]);

  for(i = 0; i < q; i++)
    cnt += linearsearch(s, t[i]);

  printf("%d\n", cnt);
  return 0;
}

int linearsearch(int *s, int key){
  int i = 0;
  s[n] = key;
  while(s[i] != key)
    i++;
  if(i == n){
    return 0;
  }
  return 1;
}

Measured memory_bytes: 636
using System;
using System.Linq;

namespace AButtons
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力の取得
            var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = inputs[0];
            var b = inputs[1];

            var sum = Math.Max(a, b);
            if (a < b) sum += Math.Max(a, b - 1);
            else sum += Math.Max(a - 1, b);

            // 解答の出力
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13396
import sys
input = sys.stdin.readline
 
def main():
    bingo_map = [[0] * 3 for _ in range(3)]
    number_list = []
    for _ in range(3):
        A, B, C = map(int, input().split())
        number_list.append(A)
        number_list.append(B)
        number_list.append(C)
    N = int(input())
    for _ in range(N):
        b = int(input())
        if b in number_list:
            pos = number_list.index(b)
            bingo_map[pos//3][pos%3] = 1
        else:
            continue
    nagomi = bingo_map[0][0] + bingo_map[1][1] + bingo_map[2][2]
    kugoi  = bingo_map[0][2] + bingo_map[1][1] + bingo_map[2][0]
    nahaku = bingo_map[0][0] + bingo_map[0][1] + bingo_map[0][2]
    shigoro = bingo_map[1][0] + bingo_map[1][1] + bingo_map[1][2]
    hifumi = bingo_map[2][0] + bingo_map[2][1] + bingo_map[2][2]
    nashii = bingo_map[0][0] + bingo_map[1][0] + bingo_map[2][0]
    yagoni = bingo_map[0][1] + bingo_map[1][1] + bingo_map[2][1]
    kuromi = bingo_map[0][2] + bingo_map[1][2] + bingo_map[2][2]
    if nagomi == 3 or kugoi == 3 or nahaku == 3 or shigoro == 3 or hifumi == 3 or nashii == 3 or yagoni == 3 or kuromi == 3:
        print("Yes")
    else:
        print("No")
 
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 38256
#include<cstdio>


int main(void)
{
	char s[6+4];
	while(scanf("%6[a-z]\n", s)==1)
	{
		bool ans=(s[2]==s[3] && s[4]==s[5]);
		printf("%s\n", ans?"Yes":"No");
	}
	return 0;
}


Measured memory_bytes: 128
(N, P), A = $<.map{|l| l.split.map &:to_i }

def fact n; (1..n).reduce 1, :* end

a = 2 ** A.count(&:even?)
b = A.count &:odd?
ans = 0
(0..b).each do |x|
  if x % 2 == P
    ans += a * fact(b) / fact(x) / fact(b-x)
  end
end
p ans


Measured memory_bytes: 1788
#include <iostream>
#include <string>
 
using namespace std;
 
int main() 
{
    int shift;
    string str;
    
    cin >> shift >> str;
    shift %= 26;
    
    /*for(int i=0 ; i<str.size() ; i++)
    {
        if(str[i]+shift > 'Z')
        {
            int temp = 'Z' - str[i];
            str[i] = 'A' + (shift-temp-1);
        }
        else
            str[i] += shift;
    }
    cout << str;*/

    
    for(int i=0 ; i<str.size() ; i++)
    {
        int index = str[i] - 'A';
        index = (index + shift)%26;

        cout << (char)('A'+index);
    }
    

    
    return 0;
}

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

using namespace std;

int f(int x){
    if (x % 2 == 0)
        return x / 2;
    else
        return 3 * x + 1;
}

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

    vector<int> a;
    a.push_back(s);

    bool t = true;
    while(t){
        int s1 = f(s);
        s = s1;
        a.push_back(s);
        int size = a.size();
        for(int i = 0; i < size-1; i++){
            if(a.at(i) == s1){
                cout << size << endl;
                t = false;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
import datetime

while(True):
	y1, m1, d1, y2, m2, d2 = map(int, raw_input().split())
	if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0:
		break
	dt1 = datetime.datetime(y1, m1, d1, 0, 0, 0)
	dt2 = datetime.datetime(y2, m2, d2, 0, 0, 0)
	dt3 = dt2 - dt1
	print dt3.days

Measured memory_bytes: 6336
#include<iostream>
#include<string>
using namespace std;
 
int main()
{
	int nenner;
	double a;
	int zaehler;
	cin >> nenner;
	zaehler = int(nenner / 2);
	if ((nenner % 2) != 0) {
		++zaehler;
	}
	a = double(zaehler) / double(nenner);
	string outp = std::to_string(a);
	cout.precision(6);
	cout << fixed << a << endl;
    return 0;
}

Measured memory_bytes: 256
Sl = list(input())

def func(n, s):
    n += 1
    if n==len(Sl)-1:
        a = sum([int(i) for i in (s+Sl[n]).split("+")])
        b = sum([int(i) for i in (s+"+"+Sl[n]).split("+")])
        return a + b
    else:
        return func(n, s+Sl[n]) + func(n, s+"+"+Sl[n])

if len(Sl)==1:
    print(Sl[0])
else:
    print(func(0, Sl[0]))

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

int main() {
  int N, K, X;
  cin >> N >> K;
  X = 1;
  for (int i = 0; i < N; i++) {
    int A, B;
    A = 2*X;
  	B = X + K;
    
    if (A <= B) {
      X *= 2;
    }
   else {
     X += K;
    }
  }
  cout << X << endl;
 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    long long n;
    cin>>n;
    long long ans=0;
    for(long long i=1,j;i<n;i++){
        if(n%i==0) j=(n/i)-1;
        else j=n/i;
        ans+=j;
    }
    cout<<ans<<"\n";
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    return 0;
}

Measured memory_bytes: 3648
l = gets.to_i

es = []

i = 0
while (1 << (i+1)) <= l
  es << [i, i + 1, 1 << i]
  es << [i, i + 1, 0]
  i += 1
end

n = i
a = 1 << n
(n-1).downto(0) do |i|
  if (l >> i) & 1 == 1
    es << [i, n, a]
    a += 1 << i
  end
end

puts "#{n + 1} #{es.length}"
es.each do |x|
  puts "#{x[0] + 1} #{x[1] + 1} #{x[2]}"
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define chal ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
    ll n,k;
    cin>>n>>k;
    ll p[n+1],c[n+1],i,x,y,z,j,ans=-1e14,mini=-1e14;
    vector<ll> v[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>p[i];
    }
    for(i=1;i<=n;i++)
    {
        cin>>c[i];
        mini=max(mini,c[i]);
    }
    for(i=1;i<=n;i++)
    {
        x=p[i];
        z=k;
        while(x!=i && z>0)
        {
            v[i].push_back(c[x]);
            x=p[x];
            z--;

        }
        if(z>0)
            v[i].push_back(c[x]);
    }
    for(i=1;i<=n;i++)
    {
        for(j=0;j<(ll)v[i].size();j++)
        {
            if(j>0)
                v[i][j]=v[i][j]+v[i][j-1];
            if(j+1<=k)
                ans=max(v[i][j],ans);
        }
            x=k%(ll)v[i].size();
            if(x==0)
                x=v[i].size();
            y=0;
            z=-1e14;
            //cout<<x<<endl;
            while(y<x)
            {
                z=max(z,v[i][y]);
                y++;
            }
            //cout<<z<<endl;
            x=k%(ll)v[i].size();
            if(x!=0)
                ans=max(ans,(z+(v[i][v[i].size()-1])*(k/(ll)v[i].size())));
            else
                ans=max(ans,(z+(v[i][v[i].size()-1])*((k/(ll)v[i].size())-1)));
        /*for(auto x:v[i])
            cout<<x<<" ";
        cout<<endl;
        */
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 218856
#include<stdio.h>

int main(void){
  int a,b,d,r;
  double f;

  scanf("%d %d",&a,&b);

  d=a/b;
  r=a%b;
  f=(double)a/b;
  
  printf("%d %d %.5f\n",d,r,f);
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, X;
//string S, T;

signed main(){
  int a, b;
  cin >> W >> a >> b;
  int ans = 0;
  if(b>W+a) ans = b-W-a;
  else if(a>W+b) ans = a-W-b;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>

int main(){

	int N;

	scanf("%d",&N);

	if(N<10){
		printf("Yes");
		return 0;
	}

	for(int i=2;i<10;i++){
		if((N%i)==0){
			if((N/i)<10){
				printf("Yes");
				return 0;
			}
		}
	}

	printf("No");
	
	return 0;

}

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

using namespace std;


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

	string s, t;

	cin >> s >> t;

	if (t.compare(0, t.length() - 1, s) == 0) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}

	return 0;
}

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

int main()
{
    priority_queue<int> Q;
    string str;
    int a;
    while (1)
    {
        cin >> str;
        if (str =="insert") { 
            cin >> a;
            Q.push(a);
        }
        else if (str=="extract") {
            cout << Q.top() << endl;
            Q.pop();
        }
        else {
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 5976
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    if (args.length > 0 && args(0) == "TEST") {
      println(test())
    } else {
      val input = io.Source.stdin.getLines().mkString("\n")
      println(solve(input).trim())
    }
  }

  def solve(input: String): String = {
    val s: Scanner = new Scanner(input)
    val n,x = s.nextInt
    List.fill(n)(s.nextInt).scan(0)(_ + _).count(_ <= x).toString
  }

  val tests = List(
    """3 6
      |3 4 5""".stripMargin -> """2""",
    """4 9
      |3 3 3 3""".stripMargin -> """4"""
  )

  def test(): String = tests.map { case (i, o) => (i.trim(), o.trim()) }
    .zipWithIndex.map {
    case ((input, outputExpect), i) =>
      val output = solve(input).trim()
      val tnum = i + 1
      s"test$tnum:" + (
        if (output == outputExpect) "Passed"
        else s"Failed\nexpect:\n$outputExpect\noutput:\n$output")
  }
    .mkString("\n")
}

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

int stack[101];
int top=0;

void push(int n){
    stack[++top]=n;
    //printf("stack top %d\n",stack[top]);
}

int pop(){
    int n;
    n=stack[top--];
    return n;
}

int main(void){
    int n1,n2;
    char s[100];
    while(scanf("%s",s)!=EOF){
        if(s[0]>'0'&&s[0]<='9'){
            //printf("!%c\n",s[0]);
            push(atoi(&s[0]));
        }else{
            n2=pop();
            n1=pop();
            //printf("!!%c\n",s[0]);
            //printf("%d %d\n",n1,n2);
            switch(s[0]){
                case '+':
                    push(n1+n2);
                    break;
                case '-':
                    push(n1-n2);
                    break;
                case '*':
                    push(n1*n2);
                    break;
            }
        }
    }
    printf("%d\n",stack[top]);
    return 0;
}



Measured memory_bytes: 2096
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<vector>
#include<math.h>
#include<stack>
#include<map>
#include<queue>
#define ls(x) (x<<1)
#define rs(x) ((x<<1)|1)
#define eps 1e-9
using namespace std;
int n,st;
int a[100005];
int gcd(int x,int y)
{
	if(y==0)return x;
	return gcd(y,x%y);
}
int main()
{
	scanf("%d%d",&n,&st);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int ans=abs(st-a[1]);
	for(int i=2;i<=n;i++)
	{
		ans=gcd(ans,abs(a[i]-st));
	}
	printf("%d",ans);
}

Measured memory_bytes: 640
#学習用
#
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
    # curはN本の竹のうち何本を確認したか。
    if cur == N:
        # 全ての竹を確認した場合
        #
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    # cur本目の竹を使用しない場合
    ret0 = dfs(cur + 1, a, b, c)
    # cur本目の竹をAに使用する場合
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    # cur本目の竹をBに使用する場合
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    # cur本目の竹をCに使用する場合
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
   int a,b;
   cin>>a>>b;
  if(a>=b+1){
    	cout<<2*a-1<<endl;
  }
else if(b>=a+1){
  		cout<<2*b-1<<endl;
}
  else
    cout<<a+b<<endl;
}

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

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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

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

fn main() {
    input!{
      a: i64,
      b: i64,
      c: i64,
      d: i64,
      e: i64,
      f: i64,
    }
    let mut ans = 0f64;
    let mut ans_a = 0;
    let mut ans_s = 0;
    for i in 0..31 {
        for j in 0..31 {
            let aa = 100 * a * i;
            let bb = 100 * b * j;
            let sugar = f - aa - bb;
            if sugar < 0 { break; }
            let ee = (aa + bb) / 100 * e;
            let max_s = min(sugar, ee);
            for k in 0..(max_s/c+1) {
                let cc = k * c;
                let dd = (max_s - cc)/d*d;
                let ff = aa + bb + cc + dd;
                if ff == 0 { continue };
                let dense = (100 * (cc + dd)) as f64 / ff as f64;
                ans = if dense > ans { dense } else { ans };
                if ans == dense {
                    ans_a = ff;
                    ans_s = cc + dd;
                }
                // debug!(f, aa, bb, sugar, ee, max_s, ff, cc+dd);
                // println!("dense={:?}", dense);
            }
        }
    }
    println!("{} {}", ans_a, ans_s);
}


Measured memory_bytes: 4352
/**
 * Binary search trees - Binary Search Tree I
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		Tree tree = new Tree();
		int key;

		int n = parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			line = br.readLine();
			switch (line.charAt(0)) {
				case 'i':
					key = parseInt(line.substring(line.indexOf(' ') + 1));
					tree.insert(new Node(key));
					break;
				case 'p':
					tree.print(Tree.Order.Inorder);
					tree.print(Tree.Order.Preorder);
					break;
			}
		}
	} //end main
}

class Tree {

	enum Order {
		Preorder,
		Inorder,
		Postorder
	}

	Node root;

	Node insert(Node node) {
		Node parent = null;
		Node child = root;
		//
		while (child != null) {
			parent = child;
			if (node.key < child.key) child = child.left;
			else child = child.right;
		}
		node.parent = parent;
		//
		if (parent == null) {
			this.root = node;
		} else if (node.key < parent.key) {
			parent.left = node;
		} else {
			parent.right = node;
		}
		return node;
	}

	void print(Order order) {
		switch (order) {
			case Preorder:
				walkPreorder(root);
				break;
			case Inorder:
				walkInorder(root);
				break;
			case Postorder:
				walkPostorder(root);
				break;
		}
		System.out.println();
	}

	void walkPreorder(Node node) {
		if (node == null) return;
		System.out.print(" " + node.key);
		walkPreorder(node.left);
		walkPreorder(node.right);
	}

	void walkInorder(Node node) {
		if (node == null) return;
		walkInorder(node.left);
		System.out.print(" " + node.key);
		walkInorder(node.right);
	}

	void walkPostorder(Node node) {
		if (node == null) return;
		walkPostorder(node.left);
		walkPostorder(node.right);
		System.out.print(" " + node.key);
	}
}

class Node {
	int key;
	Node parent, left, right;

	Node(int key) {
		this.key = key;
	}
}

Measured memory_bytes: 129688
#include <bits/stdc++.h>
#define nl endl
#define dbg(a) cout << #a << "=" << a << endl
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define md 1000000007

using namespace std;

int solve()
{
    string s;
    cin>>s;
    if(s.back()=='s') 
    {
        s+="es";
    }
    else s.push_back('s');
    cout<<s<<endl;
    return 0;
}

int main()
{
    fast;
    solve();
    return 0;
}

Measured memory_bytes: 3616
#お年玉
n,y=map(int,input().split())
a,b,c=0,0,0
flag=False
for i in range(2001):
    for j in range(2001):
        if i+j<=n and 10000*i+5000*j+1000*(n-i-j)==y:
            a=i
            b=j
            c=n-i-j
            flag=True
            break
if flag:
  print(a,b,c)
if not flag:
    print(-1,-1,-1)


Measured memory_bytes: 3064
from heapq import heappush, heappop

num_q = int(input())
x = 0
f = 0
low = []
high = []
odd = False
num_a = 0
 
for _ in range(num_q):
  q = input()
  if q[0] == '2':
    print(x, f)
  else:
    _, n, m = map(int, q.split(" "))
    if odd:
      if n >= -low[0]:
        f += m + n + low[0]
        heappush(high, n)
      else:
        f += m - n - low[0]
        heappush(low, -n)
        heappush(high, -heappop(low))
    else:
      f += m
      if num_a == 0:
        heappush(low, -n)
      else:
        if n > -low[0]:
          if n > high[0]:
            f += n - high[0]
          heappush(high, n)
          heappush(low, -heappop(high))
        else:
          f += - n - low[0]
          heappush(low, -n)

    odd = ~odd
    x = -low[0]
    num_a += 1

Measured memory_bytes: 11092
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int calc(int a[], int n, int l[]) {
    if(n<=0) return 0;
    if(l[n]!=-1) return l[n];
    if(n==1) return l[n] = abs(a[n]-a[n-1])+calc(a,n-1,l);
    return l[n] = min(abs(a[n]-a[n-1])+calc(a,n-1,l), abs(a[n]-a[n-2])+calc(a,n-2,l));
}

int main()
{
    int n;
    cin>>n;
    int a[n],i,j,k,l[n];
    for(i=0;i<n;i++) {
        cin>>a[i];
        l[i]=-1;
    }
    //l[n]=-1;
    l[0]=0;
    l[1]=abs(a[0]-a[1]);
    j=calc(a,n-1,l);
    cout<<j<<endl;

    return 0;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100009],b[100009];
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i]>>b[i];
    long long num = 0;
    for(int i=n-1;i>=0;i--){
        a[i] += num;
        if(a[i]%b[i]!=0)
        num += (b[i] - a[i]%b[i]);
    }
    cout<<num<<endl;
}


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

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = false;


struct Node{
    ll cost;
    int parent;  // index of parent node
    int index;   // index in node list
    vector< ll > connect;
};
    
    
    
int main(){

    int N, M;    
    cin >> N >>  M;
    
    vector<Node> node(N);
    for(int i = 0; i < N; i++){
        node[i].cost = 0;
        node[i].parent = -1;
        node[i].index = i;
    }

    if(DEBUG) cout << "test" << endl;

    for(int i = 0; i < M; i++){
        if(DEBUG) cout << i << " " << M << endl;
        if(DEBUG) cout << (i < M) << endl;
        ll a, b;
        cin >> a >> b ;
        a --;
        b --;
        node[a].connect.push_back(b);
        node[b].connect.push_back(a);
    }

    if(DEBUG) cout << "FOR END" << endl;


    vector<int > reach(N, -1);
    queue<int> que;
    que.push( 0 );
    int parent = 0;
    reach[0] = parent;
    while ( !que.empty() ) {
        int id = que.front();
        que.pop();
        parent = id;

        for(int i = 0; i < node[id].connect.size(); i++){
            int q = node[id].connect[i];
            if(reach[q] == -1 ){
                reach[q] = parent;
                que.push(q);
            }
        }

    }
    
    cout << "Yes" << endl;
    for(int i = 1; i < N; i++){
        cout << reach[i] + 1 << endl;
    }
    
}

Measured memory_bytes: 13852
n = int(input())
s = input()

R = [0]*n # R[i] := i文字目より右にある'R'の個数
G = [0]*n
B = [0]*n

# R
for i in range(n-2, -1, -1):
    if s[i+1] == 'R':
        R[i] = R[i+1] + 1
    else:
        R[i] = R[i+1]
# G
for i in range(n-2, -1, -1):
    if s[i+1] == 'G':
        G[i] = G[i+1] + 1
    else:
        G[i] = G[i+1]
# B
for i in range(n-2, -1, -1):
    if s[i+1] == 'B':
        B[i] = B[i+1] + 1
    else:
        B[i] = B[i+1]

cnt = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        if s[i] != s[j]:
            Set = set((s[i], s[j]))
            if Set == set(('R', 'G')):
                cnt += B[j]
                if j+(j-i) < n:
                    if s[j+(j-i)] == 'B':
                        cnt -= 1
            elif Set == set(('G', 'B')):
                cnt += R[j]
                if j+(j-i) < n:
                    if s[j+(j-i)] == 'R':
                        cnt -= 1
            else:
                cnt += G[j]
                if j+(j-i) < n:
                    if s[j+(j-i)] == 'G':
                        cnt -= 1
print(cnt)

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

using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> a(n+1);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	vector<int> minn(n+1,999999999);
	int ans=0;
	for(int i=1;i<=n;i++){
		minn[i]=min(minn[i-1],a[i]);
		if(a[i]==minn[i]) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

void solve(long long P, long long Q, long long R)
{
    cout << min(P + Q, min(Q + R, R + P)) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long P;
    scanf("%lld", &P);
    long long Q;
    scanf("%lld", &Q);
    long long R;
    scanf("%lld", &R);
    solve(P, Q, R);
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iterator>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
 
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))
 
typedef long long ll;

using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  float n;
  cin>>n;

  cout<<ceil(n/2);
  
  return 0;
}

Measured memory_bytes: 256
<?php
$N = (int)fgets(STDIN);
if ($N === 1) {
    echo 0;
    return;
}

$sqrt_N = (int)sqrt($N) + 1;

$map_of_prime = [];
for ($i = 2; $i < $sqrt_N; $i++) {
    $map_of_prime[$i] = 0;
    while ($N % $i === 0) {
        $map_of_prime[$i] += 1;
        $N = $N / $i;
    }
}

if ($N !== 1) {
    $map_of_prime[$N] = 1;
}

$map_of_prime = array_filter($map_of_prime);
if (empty($map_of_prime)) {
    echo 1;
    return;
}

$ans = 0;
foreach ($map_of_prime as $prime) {
    $i = 1;
    while ($prime >= $i) {
        $ans += 1;
        $prime -= $i;
        $i += 1;
    }
}
echo $ans;

Measured memory_bytes: 79252
S = list(input())
S1 = S[2:-1]
ans = 'WA'
if S[0] == 'A':
    if S1.count('C') == 1:
        S2 = S[1:]
        S2.remove('C')
        L = ''.join(S2)
        if L.isalpha() == True & L.islower() == True:
            ans = 'AC'

print(ans)

Measured memory_bytes: 3060
n=int(input())
b=input().split()
s=b[:]
for i in range(n):
    for j in range(n-1,i,-1):
        if b[j][1]<b[j-1][1]:b[j],b[j-1]=b[j-1],b[j]
    m=i
    for j in range(i,n):
        if s[m][1]>s[j][1]:m=j
    s[m],s[i]=s[i],s[m]
print(*b)
print('Stable')
print(*s)
print(['Not s','S'][b==s]+'table')



Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    int arr[n][2];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            cin >> arr[i][j];
        }
    }
    int flag = 0;
    for (int i = 0; i < n - 2; i++)
    {

        if (arr[i][0] == arr[i][1] &&
            arr[i + 1][0] == arr[i + 1][1] &&
            arr[i + 2][0] == arr[i + 2][1])
        {
            flag++;
        }
    }

    if (flag == 0)
        cout << "No";
    else
    {
        cout << "Yes";
    }
}

Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

s,w = l_in()
if w >= s:
    print("unsafe")
else:
    print("safe")


Measured memory_bytes: 61856
import java.util.Scanner;




public class Main {
	public static void main(String[] args){
		Scanner sn = new Scanner(System.in);
		
		while(true){
			int n = sn.nextInt(), A = sn.nextInt(), B = sn.nextInt(), C = sn.nextInt(), x = sn.nextInt();
			if(n == 0 && A == 0 && B == 0 && C == 0 && x == 0) break;
			MyRand rand = new MyRand(A, B, C, x);
			int Y[] = new int[n];
			for(int i = 0; i < n; i++) Y[i] = sn.nextInt();
			
			for(int i = 0; i < n; i++){
				if(i == 0 && Y[i] == rand.x) continue;
				int j = 1;
				while(Y[i] != rand.getRand()){
					if(rand.getCount() > 10000) break;
				}
				if(rand.getCount() > 10000) break;
				
			}
			System.out.println(rand.getCount() > 10000? -1: rand.getCount());
		}
	}
}


class MyRand{
	private int A, B, C;
	int x;
	int count = 0;
	public MyRand(int A, int B, int C, int x) {
		this.A = A;
		this.B = B;
		this.C = C;
		this.x = x;
	}
	
	public int getRand(){
		count++;
		return (x = (A*x+B)%C);
	}
	
	public int getCount(){
		return count;
	}
	
	public int getSeed(){
		return x;
	}
	
	public void setSeed(int seed){
		x = seed;
	}
}

Measured memory_bytes: 31672
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
#define out(S) cout<<(S)<<endl;
#define REP(i,b) for(size_t i=0;i<(b);i++)
#define rREP(i,b) for(int i=(b)-1;i>=0;i--)
#define FOR(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define Foreach(item,collection) for(auto item:collection)
#define mod(i) ((i) % (ll)(1e9 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9 + 5))))
#define Yes out("Yes")
#define No out("No")
#define NO out("NO")
#define YES out("YES")
#define INF 1e10;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define IfOut(condition,text) if((condition)){out(text);return 0;}
#define IfeOut(condition,itext,etext) if(condition){out(itext);return 0;}else{out(etext);return 0;}
#define Select(collection,condition,result) Foreach(i,collection){result+=condition;}
#define GetAuto(_N,vect) {cin>>_N;vect.resize(_N);REP(i,_N){cin>>vect[i];}}
#define beginend(vec) (vec).begin(),(vec).end()
#define pb(item) push_back(item)
#define removeAll(vec,deleg) auto itr=remove_if(beginend(vec),deleg);vec.erase(itr,vec.end());
void removeAt(string& s, int index) { s.erase(index, 1); }
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
ll manhattanDistance(ll x1, ll y1, ll x2, ll y2) { return (abs(x2 - x1) + abs(y2 - y1)); }
vector<ll> sieveOfEratosthenes(int max) {ll prime;double sqrtmax = sqrt(max);vector<ll> primeVec, searchVec;FOR(i, 2, max + 1) searchVec.push_back(i);do{prime = searchVec[0];primeVec.push_back(prime);auto itr = remove_if(beginend(searchVec), [=](ll x)->bool {return x%prime == 0; });searchVec.erase(itr, searchVec.end());} while (prime < sqrtmax);primeVec.reserve(primeVec.size() + searchVec.size());primeVec.insert(primeVec.end(), beginend(searchVec));return primeVec;}
bool isPrime(ll x) {
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;
	ll i = 3;
	while (i <= sqrt(x)) {
		if (x%i == 0) return false;
		i += 2;
	}
	return true;
}

int a, d, n;

void solve() {
	ll next = a;
	int cnt = 0;
	while (cnt < n) {
		if (isPrime(next)) cnt++;
		next += d;
	}
	out(next-d);
}

int main() {
	while (cin >> a >> d >> n, (a || d || n)) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3068