akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    string s;
    cin >> s;
    cout<<s.substr(0,s.size()-8)<<endl;
    return 0;
}

Measured memory_bytes: 3596
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    r = ri()
    print(3*r*r)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
n = int(input())
L = []
i = 0
while i < n:
    a,b = map(int,input().split(' '))
    L.append((b,a))
    i += 1
L.sort()
sum_a = 0
f = 0
for l0 in L:
    sum_a += l0[1]
    if l0[0] < sum_a:
        f = 1
        break
if f == 1:
    print('No')
else:
    print('Yes')

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

int main(){
    int n,ans=0,r=0;
    cin>>n;
    map<int,int> a;
    rep(i,n){
        int x;
        cin>>x;
        r=max(r,x);
        a[x]++;
    }
    for(auto p:a){
        if(p.second==1) ans++;
        int i=p.first;
        while(i<=r){
            i+=p.first;
            a.erase(i);
        }
    }
    cout<<ans;
}

Measured memory_bytes: 12848
#include <bits/stdc++.h>
# define ll int64_t
#define rep(i,n) for(ll i=0;i<n;i++)
#define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool compare_by_a(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first != b.first) return a.first<b.first;
    else return a.second<b.second;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

int main(){
    ll n;
    cin>>n;
    vector<pair<ll,ll>> a(n);
    rep(i,n){
        cin>>a[i].first;
        a[i].second = i+1;
    }
    sort(ALL(a),compare_by_a);
    rep(i,n) cout<<a[i].second<<" ";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 2432
import itertools
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
list1 = []
for i in range(1, N+1):
    list1.append(i)
cnt = 1
for i in itertools.permutations(list1):
    i = list(i)
    if A==i:
        a = cnt
    if B==i:
        b = cnt
    cnt += 1
print(abs(b-a))

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second

typedef int def; //default parameter for loops

#define fori(a) for(def i=0; i<(a); i++)
#define fori1(a) for(def i=1; i<=(a); i++)
#define fori_(a) for(def i=(a)-1; i>=0; i--)
#define fori1_(a) for(def i=(a); i>0; i--)
#define forii(a, b) for(def i=(a); i<(b); i++)
#define forii_(a, b) for(def i=(b)-1; i>=(a); i--)

#define forj(a) for(def j=0; j<(a); j++)
#define forj1(a) for(def j=1; j<=(a); j++)
#define forj_(a) for(def j=(a)-1; j>=0; j--)
#define forj1_(a) for(def j=(a); j>0; j--)
#define forjj(a, b) for(def j=(a); j<(b); j++)
#define forjj_(a, b) for(def j=(b)-1; j>=(a); j--)

#define fork(a) for(def k=0; k<(a); k++)
#define fork1(a) for(def k=1; k<=(a); k++)
#define fork_(a) for(def k=(a)-1; k>=0; k--)
#define fork1_(a) for(def k=(a); k>0; k--)
#define forkk(a, b) for(def k=(a); k<(b); k++)
#define forkk_(a, b) for(def k=(b)-1; k>=(a); k--)

#define forl(a) for(def l=0; l<(a); l++)
#define forl1(a) for(def l=1; l<=(a); l++)
#define forl_(a) for(def l=(a)-1; l>=0; l--)
#define forl1_(a) for(def l=(a); l>0; l--)
#define forll(a, b) for(def l=(a); l<(b); l++)
#define forll_(a, b) for(def l=(b)-1; l>=(a); l--)

#define forg(a) for(def g=0; g<(a); g++)
#define forg1(a) for(def g=1; g<=(a); g++)
#define forg_(a) for(def g=(a)-1; g>=0; g--)
#define forg1_(a) for(def g=(a); g>0; g--)
#define forgg(a, b) for(def g=(a); g<(b); g++)
#define forgg_(a, b) for(def g=(b)-1; g>=(a); g--)

#define forf(a) for(def f=0; f<(a); f++)
#define forf1(a) for(def f=1; f<=(a); f++)
#define forf_(a) for(def f=(a)-1; f>=0; f--)
#define forf1_(a) for(def f=(a); f>0; f--)
#define forff(a, b) for(def f=(a); f<(b); f++)
#define forff_(a, b) for(def f=(b)-1; f>=(a); f--)

#define forh(a) for(def h=0; h<(a); h++)
#define forh1(a) for(def h=1; h<=(a); h++)
#define forh_(a) for(def h=(a)-1; h>=0; h--)
#define forh1_(a) for(def h=(a); h>0; h--)
#define forhh(a, b) for(def h=(a); h<(b); h++)
#define forhh_(a, b) for(def h=(b)-1; h>=(a); h--)

#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

template <typename T>
std::ostream& operator<< (std::ostream& out, const std::vector<T>& v) {
  if ( !v.empty() ) {
    std::copy (v.begin(), v.end(), std::ostream_iterator<T>(out, " "));
  }
  return out;
}
template <typename T>
std::ostream& operator<< (std::ostream& out, const std::set<T>& v) {
  if ( !v.empty() ) {
    std::copy (v.begin(), v.end(), std::ostream_iterator<T>(out, " "));
  }
  return out;
}

const int N = 1e5+10;
const ll M = 1e9+7;

int main(){
	fastIO;
	ll k;
	string s;
	cin>>s>>k;
	int ct = 0;
	fori(k){
		if(s[i]!='1'){
			cout<<s[i];
			exit(0);
		}
	}
	cout<<1;
}


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

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n);
#define SINT2(n,m) scanf("%d %d",&n,&m);
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o);
#define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p);
#define SINT5(n,m,o,p,q) scanf("%d %d %d %d %d",&n,&m,&o,&p,&q);

#define SLL(n) scanf("%lld",&n);
#define SLL2(n,m) scanf("%lld %lld",&n,&m);
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o);


#define PINT(n) printf("%d",(int)(n));
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m));
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l));
#define PLL(n) printf("%lld",(long long)(n));

#define PINTN(n) printf("%d\n",(int)(n));
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m));
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l));
#define PLLN(n) printf("%lld\n",(long long)(n));


#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;

typedef pair<Pi, int> Piii;

#define fs first
#define sc second

const int INF = 0x1f1f1f1f; //522,133,279
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL; //2,242,545,357,980,376,863


int T[10000][1300];



int main() {
	
	int N, M;

	for (;;) {
		SINT2(N, M);
		if (N + M == 0)break;
		int r;
		SINT(r);

		FILL0(T);

		rep(i, r) {
			int t, n, m, s;
			SINT4(t, n, m, s);
			if (s == 1) {
				T[m][t]++;
			} else {
				T[m][t]--;
			}
		}

		rep(i, M+1) {
			rep(j, 1280) {
				T[i][j + 1] += T[i][j];
				// printf("%4d: %d\n",j, T[i][j]);
			}
		}
		SINT(r);
		rep(i, r) {
			int s, e, m;
			SINT3(s, e, m);
			int ret = 0;

			repft(j, s, e) {
				if (T[m][j] > 0) ret++;
			}
			PINTN(ret);
		}
	}


}

Measured memory_bytes: 53872
N = int(input())
H = list(map(int, input().split()))

ans = 0
tmp_ans = -1
tmp_h = H[0]
for h in H:
    if h <= tmp_h:
        tmp_ans += 1
    else:
        ans = max(ans,tmp_ans)
        tmp_ans = 0
    tmp_h = h
ans = max(ans,tmp_ans)
print(ans)



Measured memory_bytes: 15020
/*****************************************************
 *     created by: nayakashutosh9
 * "Winners Never Quit and Quitters Never Win".
*****************************************************/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace __gnu_pbds;
#define int long long int
#define endl '\n'
#define mod 1000000007
#define inf 1e18
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const int N = 300005;
/**********************************************************************************************/


void solve() {
	int n; cin >> n;
	int p = 7;
	for (int i = 1; i < 3000001; i++) {
		if (p % n == 0) {
			cout << i << endl;
			return;
		}
		p = (p * 10 + 7);
		p %= n;
	}
	cout << "-1\n";
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int t = 1, z = 1;
	// cin >> t; cin.ignore();
	while (t--) {
		// cout << "Case #" << (z++) << ": ";
		// clock_t start = clock();
		solve();
		// clock_t end = clock();
		// cout << (end-start) << endl;
		//print execution time in ms
	}

	return 0;
}

Measured memory_bytes: 3652
use proconio::input;
use std::vec::Vec;

fn main() {
    input! {
        x : i32,
        n: i32,
    }
    if n == 0 {
        println!("{}", x);
        return;
    }
    input! {
        p: [i32; n]
    }
    let mut ans = 0;
    let mut mi = x;
    for i in 1..102 {
        if p.contains(&i) {
            continue;
        }
        if (i - x).abs() < mi {
            mi = (i - x).abs();
            ans = i;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2108
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main () {
    int n = 0, x = 0;
    cin >> n >> x;
    vector<int> l(n);
    for (int i=0; i<n; i++) {
        cin >> l.at(i);
    }
    int now = 0;
    int ans = 1;
    for (int i=0; i<n; i++) {
        now += l.at(i);
        if (now <= x) ans++;
        else break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){

	int N,R;
	cin >> N;
	int A[N-1],B[N-1],C[N-1];

	for (int i=0;i<N;i++){
		cin >> A[i];
	}
	for (int i=0;i<N;i++){
		cin >> B[i];
	}
	for (int i=0;i<N;i++){
		cin >> C[i];
	}

	for (int i=0;i<N;i++){
		R += B[A[i]-1];
		if ((i>=1)&&(A[i]-A[i-1]==1)){
			R += C[A[i-1]-1];
		}
	}

	cout << R << endl;
}


Measured memory_bytes: 256
#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...);}
#ifndef ONLINE_JUDGE
#define wt(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define wt(x...)
#endif
/**/

#define LL long long
const int MAXN = 212345;
const int INF  = 0x3f3f3f3f;

bool cmp (const string& a, const string& b) {
	if (int(a.size()) < int(b.size())) return true;
	return a < b;
}

int main () {

	ios_base::sync_with_stdio(false);  cin.tie(NULL); 

	string s; int k; cin >> s >> k;
	int n = int (s.size());

	// std::set <string, decltype(&cmp) > v(&cmp);
	set < string > v;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j <= 5; ++j) {
			string x = "";
			
			for (int b = i; b <= i + j && b < n; ++b)
					x += s[b];

			if (!x.empty()) v.insert(x);
		}
	}

	// wt (v);

	int x = 0;
	for (auto y : v) {
		++x;
		if (x == k) {
			cout << y << '\n';
			return 0;
		}
	}

	return 0;
}



Measured memory_bytes: 2176
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll V = 100000;
const ll INF = 1LL << 60;
using P = pair<ll, ll>;
vector<P> G[V];	//pair<辺の距離, 行き先の頂点>
vector<ll> dist(V); //dist[i]はsから頂点iへの最短距離が入る
vector<bool> used(V);
void dijkstra(ll s) {	//s : 始点
	//初期化
	fill(dist.begin(), dist.end(), INF);
	fill(used.begin(), used.end(), false);

	priority_queue<P, vector<P>, greater<P>> q;
	q.push(P(0, s));
	while (!q.empty()) {
		ll d;	//d : sからの距離
		ll t;	//t ; 行き先
		tie(d, t) = q.top();
		q.pop();
		if (used[t]) {	//もう探索済みか
			continue;
		}
		used[t] = true;
		dist[t] = d;
		for (P e : G[t]) {
			if (dist[e.second] <= d + e.first) {	//枝刈り
				continue;
			}
			q.push(P(d + e.first, e.second));
		}
	}
}

int main() {
	ll n;
	vector<ll> dist1(V);
	vector<ll> distn(V);

	cin >> n;

	REP(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		G[a - 1].push_back(make_pair(1, b - 1));
		G[b - 1].push_back(make_pair(1, a - 1));
	}

	dijkstra(0);

	REP(i, n) {
		dist1[i] = dist[i];
	}

	dijkstra(n - 1);
	
	REP(i, n) {
		distn[i] = dist[i];
	}

	ll black = 0;
	ll white = 0;

	REP(i, n) {
		if (dist1[i] <= distn[i]) {
			black++;
		}
		else {
			white++;
		}
	}

	if (black > white) {
		cout << "Fennec" << endl;
	}
	else {
		cout << "Snuke" << endl;
	}
}

Measured memory_bytes: 10764
#include <bits/stdtr1c++.h>

#define MAX 100100
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
#define dbg(x) cout << #x << " = " << x << endl

using namespace std;

const unsigned long long base = 666666667;

int n, depth[MAX];
vector <int> adj[MAX];
unsigned long long dp[MAX], power[MAX];
tr1::unordered_map <unsigned long long, int> mp;

void dfs(int i, int p){
    depth[i] = 1;
    int j, k, d, x, len = adj[i].size();

    for (j = 0; j < len; j++){
        x = adj[i][j];
        if (x != p){
            dfs(x, i);
            depth[i] = max(depth[i], depth[x] + 1);
        }
    }

    d = depth[i] - 1;
    unsigned long long h = 0;
    for (j = 0; j < len; j++){
        x = adj[i][j];
        if (x != p){
            unsigned long long r = dp[x] * power[d - depth[x]];
            h += r;
        }
    }

    h += power[depth[i]];
    dp[i] = h;
    mp[h]++;
}

int main(){
    int i, j, k, l, a, b;

    power[0] = 1;
    for (i = 1; i < MAX; i++) power[i] = power[i - 1] * base;

    while (scanf("%d", &n) != EOF){
        mp.clear();
        for (i = 0; i < MAX; i++) adj[i].clear();

        for (i = 1; i < n; i++){
            scanf("%d %d", &a, &b);
            adj[a].push_back(b);
            adj[b].push_back(a);
        }

        dfs(1, 1);
        long long res = 0;
        for (auto it: mp){
            long long x = it.second;
            res += ((x * (x - 1)) >> 1);
        }

        printf("%lld\n", res);
    }
    return 0;
}

Measured memory_bytes: 23716
#include<stdio.h>

int main(void){
  int a,b,c,k;
  int a2,b2,c2;
  int i;
  
  scanf("%d %d %d %d",&a,&b,&c,&k);
  b2=b;
  c2=c;
  
  for(i=0;i<k;i++){
    if(b2<=a){
      b2*=2;
    }
    else{
      c2*=2;
    }
  }
  
  if(a<b2 && b2<c2){
    printf("Yes");
  }
  else{
    printf("No");
  }
   return 0;
}
  

Measured memory_bytes: 1736
fn main(){
    let (n,a,b)={
        let s={
            let mut buf=String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            buf.trim_right().to_owned()
        };
        let mut ws = s.split_whitespace();
        let n:i32= ws.next().unwrap().parse().unwrap();
        let a:i32= ws.next().unwrap().parse().unwrap();
        let b:i32=ws.next().unwrap().parse().unwrap();
        (n,a,b)
    };

    let msg = if (a-b)%2==0{"Alice"} else{"Borys"};
    println!("{}",msg);
}


Measured memory_bytes: 4352
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    h = I()
    w = I()

    return (n-h+1) * (n-w+1)



print(main())




Measured memory_bytes: 5460
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int K[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << K[k-1] << endl;
    return 0;
}







Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
//#include<array>
#include<algorithm>
//#include<deque>
#include<vector>
//#include<utility>
#include<set>
//#include<map>
//#include<list>

using namespace std;

class UnionFind {
public:
	vector<int>data;
	UnionFind(int size) :data(size, -1) {};
	bool unionset(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x]) {
				swap(x, y);
			}
			data[x] += data[y];
			data[y] = x;
		}
		return x != y;
	}
	bool findset(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int gcd(int x, int y) {
	int tmp, r;
	if (x < y) {
		tmp = x;
		x = y;
		y = tmp;
	}
	r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}

int main(void) {
	long long int a,b,c;
	cin >> a;
	b = a % 11;
	a = (a / 11) * 2;
	if (b > 0) {
		if (b > 6) {
			a += 2;
		}
		else {
			a += 1;
		}
	}
	cout << a << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int a, b, c;
  scanf("%d %d %d\n", &a, &b, &c);
  if(0<=a && a<=100)
    if(0<=b && b<=100)
      if(0<=c && c<=100)
        if(a < b && b < c && a < c) printf("Yes\n");
        else printf("No\n");

  return 0;

}

Measured memory_bytes: 584
#include <vector>
#include <iostream>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
long long n,m,x;
long long a,b,c,hh,t,i;
vector<long long> h(100000);
vector<tuple<long long,long long,long long>> abt(300000);
priority_queue<tuple<long long, long long, long long>> q;
vector<map<long long,long long>> graph(100000);
vector<bool> vis(100000,false);

tuple<long long,long long,long long> time(long long nowh,long long i,long long j,long long c,long long t){
    //cout << i << endl;
    long long cost,height;
    if(nowh>=t){
        long long cost=c+max(t,nowh-h[j]);
        long long height=min(nowh-t,h[j]);
        return make_tuple(-cost,height,j);
    }
    else{
        if(t<=h[i]){
            long long cost=c+2*t-nowh;
            long long height=0;
            return make_tuple(-cost,height,j);
        }
        else return make_tuple(1,-1,-1);
    }
}

int main(){
    cin >> n >> m >> x;
    for(long long i=0;i<n;i++)cin >> h[i];
    for(long long i=0;i<m;i++)cin >> get<0>(abt[i]) >> get<1>(abt[i]) >> get<2>(abt[i]);
    for(long long i=0;i<m;i++){
        tie(a,b,t)=abt[i];
        graph[a-1][b-1]=t;
        graph[b-1][a-1]=t;
    }
    q.push(make_tuple(0,x,0));
    
    long long ans=-1;
    while(q.size()>0){
        tie(c,hh,i) = q.top();
        c=-c;
        q.pop();
        if(vis[i]) continue;
        if(i==n-1){
            ans=c+h[i]-hh;
            break;
        }
        vis[i]=true;
        for(auto itr=graph[i].begin();itr!=graph[i].end();itr++){
            long long j=itr->first;
            long long t=itr->second;
            if(vis[j]) continue;
            //cout << i << " " << hh << " " << i << " " << j << " " << c << " " << t << endl;
            auto add=time(hh,i,j,c,t);
            //cout << i << " " << get<0>(add) << " " << get<1>(add) << " " << get<2>(add) << endl;
            if(get<0>(add)!=1) q.push(add);
        }
    }
    cout << ans << endl;
}



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



int main() 
{
    int n;
    string s;
    cin >> n >> s;
    int ans = n;
    rep(i,n-1)
    {
        if(s[i]==s[i+1])
        {
            ans -= 1;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
n = int(input())
w = 0
j = 0
for i in range(n):
    x, y = map(int,input().split(' '))
    if x == y:
        j += 1
        if j >= 3:
            w = 1
    else:
        j = 0
if w == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9144
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 200005;
ll A[MAX_N],F[MAX_N],need[MAX_N];

bool check(ll t, int N, ll K)
{
	rep(i,N)
	{
		need[i] = t / F[i];
	}

	for (int i = 0; i < N; ++i)
	{
		if (A[N-1-i] >= need[i])
		{
			K -= A[N-1-i] - need[i];
			if (K < 0) return false;
		}
	}
	return true;
}

int main()
{
	int N;
	ll K;
	cin >> N >> K;
	rep(i,N)
	{
		cin >> A[i];
	}
	rep(i,N)
	{
		cin >> F[i];
	}

	sort(A,A+N);
	sort(F,F+N);
	ll l = 0,r = 1e13;
	for (int i = 0; i < 50; ++i)
	{
		ll m = (l+r) / 2;
		if (check(m,N,K))
		{
			r = m;
		}
		else
		{
			l = m;
		}
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ll n,wt,i,j;
  cin>>n>>wt;
  ll w[n],v[n],k[n+1][wt+1];
  for(i=0;i<n;i++)
  {
    cin>>w[i]>>v[i];
  }
  for(i=0;i<=n;i++)
  {
    for(j=0;j<=wt;j++)
    {
      if(i==0||j==0)
      {
        k[i][j]=0;
      }
        else if(w[i-1]<=j)
        {
          k[i][j]=max(v[i-1]+k[i-1][j-w[i-1]],k[i-1][j]);
        }
      else
      {
        k[i][j]=k[i-1][j];
      }
    }
  }
cout<<k[n][wt]<<endl;
  }
    

Measured memory_bytes: 79232
extern crate core;

use std::fmt;
use std::cmp::{Ordering, min, max};
use std::f32::MAX;
use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut, SubAssign, Range};
use std::collections::{BTreeMap, VecDeque, BinaryHeap, BTreeSet, HashMap};
use std::fmt::{Display, Formatter, Error};

fn show<T: Display>(vec: &Vec<T>) {
    if vec.is_empty() {
        println!("[]");
    }else {
        print!("[{}", vec[0]);
        for i in 1 .. vec.len() {
            print!(", {}", vec[i]);
        }
        println!("]");
    }
}
fn show2<T: Display>(vec: &Vec<Vec<T>>) {
    if vec.is_empty() {
        println!("[]");
    }else {
        for l in vec {
            show(l);
        }
    }
}

macro_rules! read_line{
    () => {{
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        line
    }};
    (delimiter: ' ') => {
        read_line!().split_whitespace().map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (delimiter: $p:expr) => {
        read_line!().split($p).map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (' ') => {
        read_line!(delimiter: ' ')
    };
    ($delimiter:expr) => {
        read_line!(delimiter: $delimiter)
    };
    (' '; $ty:ty) => {
        read_line!().split_whitespace().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
    ($delimiter:expr; $ty:ty) => {
        read_line!($delimiter).into_iter().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
}
macro_rules! read_value{
    () => {
        read_line!().trim().parse().ok().unwrap()
    }
}
macro_rules! let_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}

macro_rules! let_mut_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let mut $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}
fn main() {
    let_all!(n: usize);
    let mut sticks = read_line!(' '; i32);
    sticks.sort();
    let sticks = sticks;
    let mut sum = 0;
    for i in 0 .. n {
        let mut last = i + 1;
        for j in i + 1 .. n {
            while last < n && sticks[i] + sticks[j] > sticks[last] {
                last += 1;
            }
            sum += last - j - 1;
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
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>;
ll x,n,a;
mll m;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>x>>n;
    rep(i,0,n)
    {
        cin>>a;
        m[a]=1;
    }
    ll p=x;
    while(m[p])
        p++;
    ll q=x;
    while(m[q])
        q--;
    if(abs(q-x)<=abs(p-x))
        cout<<q<<"\n";
    else
        cout<<p<<"\n";

}


Measured memory_bytes: 3656
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	string a="0123456789";
	cin>>n;
	for(int i=0;i<n;i++){
		string er,ki,ori;
		cin>>er>>ki;
		int m=er.size();
		int len=ki.size();
		ori=ki;
		for(int j=m-1;j>=0;j--){
			if(er[j]=='J'){
				for(int k=0;k<len;k++){
					ori[k]=ki[(k+len-1)%len];
				}
			}
			else if(er[j]=='C'){
				for(int k=0;k<len;k++){
					ori[k]=ki[(k+1)%len];
				}
			}
			else if(er[j]=='E'){
				if(len%2==0){
					for(int k=0;k<len/2;k++){
						ori[k]=ki[k+len/2];
						ori[k+len/2]=ki[k];
					}
				}
				else{
					int naka=len/2;
					for(int k=0;k<naka;k++){
						ori[k]=ki[k+naka+1];
						ori[k+naka+1]=ki[k];
					}
				}
			}
			else if(er[j]=='A'){
				for(int k=0;k<len;k++){
					ori[k]=ki[len-k-1];
				}
			}
			else if(er[j]=='P'){
				for(int k=0;k<len;k++){
					for(int h=0;h<10;h++){
						if(ki[k]==a[h]){
							ori[k]=a[(h+9)%10];
						}
					}
				}
			}
			else if(er[j]=='M'){
				for(int k=0;k<len;k++){
					for(int h=0;h<10;h++){
						if(ki[k]==a[h]){
							ori[k]=a[(h+1)%10];
						}
					}
				}
			}
			ki=ori;
		}
		cout<<ori<<endl;
	}
    return 0;
}

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

using namespace std;

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

int main() {
  
  int N, C;
  while(cin >> N >> C && N && C) {
    int panel[N]; memset(panel, 0, sizeof panel);
    rep(i, N) rep(j, 16) {
      int x; cin >> x;
      if(x) { panel[i] += 1<<(15-j); }
    }
    
    int jubi[C]; memset(jubi, 0, sizeof jubi);
    rep(i, C) rep(j, 16) {
      int x; cin >> x;
      if(x) { jubi[i] += 1<<(15-j); }
    }
    
    int dp[2][1<<16];
    memset(dp, -1, sizeof dp);
    dp[0][0] = 0;
    
    int const mask = (1<<16)-1;
    rep(i, N) {
      rep(S, 1<<16) {
	if(dp[i&1][S] == -1) continue;
	dp[(i+1)&1][panel[i]|S] = max(dp[(i+1)&1][panel[i]|S], dp[i&1][S]);
	rep(j, C) {
	  int nS = (panel[i]|S)&(mask-jubi[j]);
	  int score = __builtin_popcount(panel[i]|S) - __builtin_popcount(nS);
	  dp[(i+1)&1][nS] = max(dp[(i+1)&1][nS], dp[i&1][S] + score);
	}
      }
    }

    cout << *max_element(dp[N&1], dp[N&1]+(1<<16)) << endl;
  }
  
  return 0;
}

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

int main() {

int a,b,Xdis,Ydis,srt,tmp,k; cin>>a>>b;
  vector<vector<int>> A(a,vector<int>(2)),B(b,vector<int>(2));
  for(int i=0; i<a;i++){cin>>A.at(i).at(0)>>A.at(i).at(1);}
  for(int i=0; i<b;i++){cin>>B.at(i).at(0)>>B.at(i).at(1);}
  
  for(int i=0; i<a;i++){k=1;
    for(int j=0; j<b; j++){
      if(A.at(i).at(0)>=B.at(j).at(0)){Xdis=A.at(i).at(0)-B.at(j).at(0);}
      else{Xdis=B.at(j).at(0)-A.at(i).at(0);}
      if(A.at(i).at(1)>=B.at(j).at(1)){Ydis=A.at(i).at(1)-B.at(j).at(1);}
      else{Ydis=B.at(j).at(1)-A.at(i).at(1);}
      tmp=Xdis+Ydis;if(j==0){srt=tmp;}
      if(srt>tmp){srt=tmp; k=j+1;}}
      cout<<k<<endl;
                       }
}


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

using ll = long long;
using pii = pair<int, int>;
constexpr int M = 1e9 + 7;
constexpr int INF = 1e9;

int main() {
    string s;
    cin >> s;
    bool ok = false;
    for(int i = 0; i < s.size() - 1; ++i) {
        if(s[i] == 'A' && s[i + 1] == 'C') {
            ok = true;
        }
    }
    if(ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1072114514
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    char s[131072];
    int i,b[128]={0};
    scanf("%s",s);
    for(i = 0;i < strlen(s);i++){b[s[i]]++;}
    for(i = 'a';i <= 'z';i++){
        if(b[i] == 0){printf("%c\n",i);return 0;}
    }
    printf("None\n");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int n;
long long p, e, a;
long long d[101][301];
long long w[100];
long long v[100];
int main() {
	scanf("%d%lld", &n, &p);
	for (int i = 0; i < n; i++) {
		scanf("%lld%lld", w + i, v + i);
	}
	e = w[0];
	for (int i = 0; i < n; i++)w[i] -= e;
	for (int i = 0; i < n; i++) {
		for (int j = 100; j >= 0; j--) {
			for (int k = 300; k >= 0; k--) {
				if (j + 1 < 100 && k + w[i] <= 300) {
					if (d[j + 1][k + w[i]] < d[j][k] + v[i]) {
						d[j + 1][k + w[i]] = d[j][k] + v[i];
					}
				}
			}
		}
	}
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 300; j++) {
			if (i * e + j > p)d[i][j] = 0;
			if (a < d[i][j])a = d[i][j];
		}
	}
	printf("%lld\n", a);
}

Measured memory_bytes: 1968
n,m,k;a[99],b[99],c[99];
void push(x,y,z){a[m]=x;b[m]=y;c[m++]=z;}
main(i){
	scanf("%d",&k);
	while((1<<n)<=k)n++;
	for(i=n;--i;push(i,i-1,0),push(i,i-1,1<<(i-1)));
	for(i=n-2;~i;i--)if((1<<i)&k)push(n-1,i,(k>>(i+1))<<(i+1));
	printf("%d %d\n",n,m);
	for(i=m;i--;printf("%d %d %d\n",n-a[i],n-b[i],c[i]));
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int Q = sc.nextInt();

		int[][] X = new int[N + 1][N + 1];

		for(int i = 0; i < M; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			X[l][r]++;
		}

		int[][] C = new int[N + 1][N + 1];
		for(int i = 1; i <= N; i++) {
			for(int j = 1; j <= N; j++) {
				C[i][j] = X[i][j] + C[i][j - 1];
			}
		}

		for(int i = 0; i < Q; i++) {
			int p = sc.nextInt();
			int q = sc.nextInt();

			int sum = 0;
			for(int j = p; j <= q; j++) {
				sum += C[j][q] - C[j][p - 1];
			}

			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 154688
n,k=map(int,input().split())

ans=0
for i in range(1,n+1):
    if k<=i:
        ans+=(1/n)
    else:
        sum=i
        x=0
        while(sum<k):
            sum*=2
            x+=1
        ans+=(1/n)*(1/2)**(x)
print(ans)

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

int facc(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i) sum *= i;
    return sum;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    double x[n];
    double y[n];
    for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];

    double d = 0;

    for (int i = 0; i < n - 1; ++i){
        for (int j = i + 1; j < n; ++j){
            d += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
        }
    }
    double d_total = d * facc(n - 1) * 2;
    double route_total = facc(n);

    printf("%.10f\n", d_total / route_total);

}

Measured memory_bytes: 256
// ABC054
// A - One Card Poker
#include<bits/stdc++.h>

using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(a==1) a += 13;
    if(b==1) b += 13;
    if(a > b) cout << "Alice" << endl;
    else if(a == b) cout << "Draw" << endl;
    else cout << "Bob" << endl;
    return 0;
}


Measured memory_bytes: 256
loop do
  n, m = gets.split.map(&:to_i)
  
  break if n == 0
  
  sum = Array.new(m, 0)
  
  n.times do
    arr = gets.split.map(&:to_i)
    m.times do |i|
      sum[i] += arr[i]
    end
  end
  
  h = {}
  
  m.times do |i|
    h[i] = sum[i]
  end
  
  arr1 = []
  
  h.sort{|(k1, v1), (k2, v2)| v2 <=> v1 }.each do |arr2|
    arr1 << arr2[0] + 1
  end
  
  puts arr1.join(" ")
  
end

Measured memory_bytes: 9168
n, k = map(int, input().split())
ans = 0

if k == 0:
    print(n*n)
    exit()

# mod b ということは、あまり0~b-1が n // b回つづく
for b in range(k, n+1):
    x = n // b
    y = n % b
    ans += (b-k) * x
    if y >= k:
        ans += y + 1 - k
print(ans)

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

int main(){
    long long N;
    cin >> N;
    long long A[N+1];
    long long i;
    long long oddsum[N+1];
    for(i = 1; i <= N; i++){
        cin >> A[i];
    }
    oddsum[1] = A[1];
    for(i = 3; i <= N; i += 2){
        oddsum[i] = oddsum[i-2] + A[i];
    }
    long long dp[N];
    dp[2] = max(A[1],A[2]);
    if(N>=3){
        dp[3] = max(dp[2],A[3]);
    }
    if(N>=4){
        dp[4] = max(A[1]+A[3],A[1]+A[4]);
        dp[4] = max(dp[4], A[2]+A[4]);
    }
    for(i = 5; i <= N; i++){
        if(i % 2 == 0){
            dp[i] = max(dp[i-2]+A[i],oddsum[i-1]);
        }else{
            dp[i] = max(dp[i-2]+A[i],dp[i-3]+A[i-1]);
            dp[i] = max(dp[i],oddsum[i-2]);
        }
    }
    cout << dp[N] << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 8344
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;
template <typename... Args> void dbg(Args &&... args) {
  using expander = int[];
  (void)expander{
      0,
      (static_cast<void>(void(cout << std::forward<Args>(args) << " ")), 0)...};
  cout << endl;
}
void gen() {
  exit(0);
}

int n, i;

void input() {
  scanf("%d %d", &n, &i);
}

void solve() {
  printf("%d\n", n - i + 1);
}

int main() {
#ifdef DEBUG
  freopen("input", "r", stdin);
//  freopen("output", "w", stdout);
//  gen();
#endif
  input();
  solve();
  return 0;
}


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

#define int long long

signed main(){
    int M, D;
    cin>>M>>D;
    int res = 0;
    for(int i=1; i<=D; i++){
        int f = i%10;
        int s = (i/10)%10;
        if(f>=2 && s>=2){
            if(f*s > 0  && f*s <= M){
                res++;
            }
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
def create_correct_set
  set = []
  %w(S H C D).each do |v|
    1.upto(13) do |i|
      set.push("#{v} #{i}")
    end
  end
  set
end

def func
  n = gets.to_i
  exists_cards = n.times.map{ gets.strip }

  correct_set = create_correct_set

  not_exists_cards = correct_set - exists_cards
  not_exists_cards.each do |c|
    puts c
  end
end

func


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

int main () {
    int H, W;
    cin >> H >> W;
    
    vector<string> ary(H + 1);
    
    for (int i = 0; i <= H + 1; i++) {
        
        if (i == 0 || i == H + 1) {
            continue;
        }
        
        else {
            cin >> ary.at(i);
        }
        
    }
    
    for (int i = 0; i <= H + 1; i++) {
        
        if (i == 0 || i == H + 1) {
            
            for (int j = 0; j <= W + 1; j++) {
                cout << '#';    
            }
            cout << endl;
        }
        
        else {
            cout << '#' + ary.at(i) + '#' << endl;
        }
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

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

using namespace std;

const int INF=1<<29;

int n,m,coin[10];

bool check(int k){
	static int dp[100001];
	rep(j,m+1) dp[j]=INF; // j 円を作れない
	dp[0]=0;
	rep(i,n){
		rep(j,m-coin[i]+1) if(dp[j]<k) dp[j+coin[i]]=min(dp[j+coin[i]],dp[j]+1);
		if(dp[m]<INF) return true;
		rep(j,m+1) if(dp[j]<INF) dp[j]=0;
	}
	return false;
}

int main(){
	for(;scanf("%d%d",&n,&m),n;){
		rep(i,n) scanf("%d",coin+i);

		int lo=0,hi=m;
		while(lo<hi){
			int mi=(lo+hi)/2;
			if(check(mi)) hi=mi; else lo=mi+1;
		}
		printf("%d\n",lo);
	}

	return 0;
}

Measured memory_bytes: 1148
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, A[1 << 18], maxn = (1 << 30);

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = -100; i <= 100; i++) {
		int s = 0;
		for (int j = 1; j <= N; j++) s += (A[j] - i) * (A[j] - i);
		maxn = min(maxn, s);
	}
	cout << maxn << endl;
	return 0;
}

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

int main (void) {
    int n;
    scanf("%d", &n);
    char s[n+1];
    scanf("%s", s);
    int ans=0;
    char *head=s;
    while ( (head = strstr(head, "ABC")) )
    {
        ans++;
        head = &head[2]; // head は "ABC" の先頭なので、その分後ろに移動
    }
    printf("%d\n", ans);
    return EXIT_SUCCESS;
}


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

int main(void){
	int a=0, b=0, c=0;
	for(int i=0; i<10; i++){
		int tmp;
		cin >> tmp;
		if(tmp>c){
			if(tmp>b){
				if(tmp>a){
					c=b;b=a;a=tmp;
				}
				else{
					c=b;b=tmp;
				}
			}
			else{
				c=tmp;
			}
		}
	}
	cout << a << endl << b << endl << c << endl;
	return 0;
}

Measured memory_bytes: 0
// In god we trust
 
#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>
#include <signal.h>
#include <thread>
#include <pthread.h>
#include <omp.h>
 
#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define Q queue
#define Qi Q<int>
#define INF 1000000000 
#define LINF 1000000000000000000
#define int long long
using namespace std;
using namespace std::chrono;

unordered_map<int, int> factor(int n){
  int cnt = 0;
  unordered_map<int, int> m;
  int nn = n;
  while (!(nn & 1))
    cnt++, nn /= 2;
  if(cnt)
    m[2] = cnt;
  for (int i = 3; i <= sqrt(n); i++){
    cnt = 0;
    while(nn % i == 0)
      nn /= i, cnt++;
    if (cnt)
      m[i] = cnt;
  }
  if (nn > 2)
    m[nn] = 1;
  
  return m;
}



signed main(){
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);
  int n;
  cin >> n;
  unordered_map<int, int> m = factor(n);
  bool could = true;
  if (m.find(2) != m.end() or m.find(5) != m.end())
    could = false;
  if (not could){
    cout << -1 << endl;
    exit(0);
  }
  int mod = 7;
  mod %= n;
  for (int i = 0; i < n; i++){
    if (mod == 0){
      cout << i + 1 << endl;
      break;
    }
    mod *= 10, mod += 7, mod %= n;
  }
}


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

const int MAX = 1e6; // 適宜
const int MOD = 1e9 + 7; // 適宜


ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
	
	COMinit();
	
	int x,y;
	cin >> x >> y;
	
	if((x+y)%3!=0 || (2*x-y)%3!=0 || 2*x-y<0 || (2*y-x)%3!=0 || 2*y-x<0){
		cout << 0 << endl;
		return 0;
	}
	
	int n = (2*y-x)/3;
	int m = (2*x-y)/3;
	
	cout << COM(n+m,n) << endl;
	return 0;
}

Measured memory_bytes: 23680
#include <stdio.h>
#include <string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

// convert number to character
int getChar(char ch)
{
    if (ch == 'A') return 1;
    else if (ch == 'C') return 2;
    else if (ch == 'G') return 3;
    else if (ch == 'T') return 4;
    else return 0;
}

// convert character to number to produce key
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);  // convert string to number
    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);  // convert string to number
    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);  // using faster input, scanf

        if (com[0] == 'i') {
            insert(str);
        } else {
            if (find(str)) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 16048
#include <stdio.h>
int main() {
  char one, two, three;
  if(scanf("%c%c%c", &one, &two, &three) <= 0) {
    printf("fail");
  }
  if (one == two && two == three) {
    printf("No");
  } else {
    printf("Yes");
  }
  return 0;
}

Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
//Constant
const int N=100;
const int M=N*2;
//Quick Read
int Read(){
	int x=0;
	bool neg=false;
	char c=getchar();
	while(isdigit(c)==false)neg^=c=='-',c=getchar();
	while(isdigit(c)==true)x=x*10+c-'0',c=getchar();
	return neg==true?-x:x;
}
inline void Read(int &x){x=Read();}
//Main
int length[M+1];
int main(){
	// freopen("AGC001A.in","r",stdin);
	// freopen("AGC001A.out","w",stdout);
	int n=Read(),m=n*2;
	for(int i=1;i<=m;++i)Read(length[i]);
	std::sort(length+1,length+m+1);
	int ans=0;
	for(int i=1;i<=m;i+=2)ans+=length[i];
	printf("%d\n",ans);
	return 0;
}


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

int gcd(int x,int y){
    if(x%y==0)return y;
    else return gcd(y,x%y);
}

int main(){
    /* A
    int n;
    cin >> n;
    bool check = false;
    for(int i=0;i<3;i++){
        if(n%10 == 7)check = true;
        n/=10;
    }
    cout << ((check)? "Yes": "No") << endl;*/

    /* B
    int64_t n;
    cin >> n;
    int64_t ans = 0;
    for(int i=1;i<=n;i++){
        if(i%3!=0&&i%5!=0)ans+=i;
    }
    cout << ans << endl;*/

    /* C
    int k;
    cin >> k;
    int ans = 0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans += gcd(gcd(i,j),l);
            }
        }
    }
    cout << ans << endl;*/

    int n;
    cin >> n;
    string s;
    cin >> s;
    string check="RGB";
    vector<long long> rgb(3,0);
    for(int i=0;i<n;i++)for(int j=0;j<3;j++)if(check.at(j)==s.at(i))rgb[j]++;

    //条件1の組み合わせ数はR*G*B
    long long ans=rgb[0]*rgb[1]*rgb[2];
    //条件2の組み合わせ数は　すべて（条件１）の組み合わせ数 -  (j-i!=k-jの条件以外　つまりk=2*j-iを引けばいい)
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            int k = j + (j-i);
            if(k < n){
                if(s[i] != s[j] && s[i]!=s[k]&&s[j]!=s[k])ans--;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636