akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=2e5+10;
int main()
{
	int n,m,q,k;
	ll x;
	cin>>x;
	ll ans=0,now=100;
	while(now<x){
		now=now*1.01;
		ans++;
	}
	cout<<ans;
}


Measured memory_bytes: 3192
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numeric>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// using namespace std;

using ll = long long;

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

void Main() {
  std::string s;
  std::cin >> s;
  std::sort(s.begin(), s.end());
  if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
    std::puts("Yes");
  } else {
    std::puts("No");
  }
}

int main() {
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

int main(){
  
  // read problem
  long long int N, tmp, factor;
  std::vector<long long int> a, count, box;
  
  scanf("%lld", &N);
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    a.push_back(tmp);
    count.push_back(0);
  }
  
  // solve problem
  for(int i = N; i >= 1; i--){
    // if add an ball to i-th box
    //if((a[i-1]^count[i-1])&1 != 0){
    if((a[i-1]+count[i-1]+2)%2 != 0){
      // update box
      box.push_back(i);
      // update count
      for(factor = 1; factor*factor<i; factor++){
        if(i%factor == 0){
          count[factor-1]++;
          count[(i/factor)-1]++;
        }
      }
      if(factor*factor==i){
        count[factor-1]++;
      }
    }
  }
  
  std::cerr << "Answer:" << std::endl;
  std::cout << box.size() << std::endl;
  for(int i = 0; i < box.size(); i++){
    std::cout << box[i] << " ";
  }std::cerr << std::endl;
  
  return 0;
}


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

using namespace std;

using ll = long long;

priority_queue<ll> lq;
priority_queue<ll, vector<ll>, greater<>> rq;
vector<ll> m(1);
ll mi = 0;
ll B = 0;

void query2()
{
  cout << m[0] << " " << mi + B << endl;
}

void query1(ll a, ll b)
{
  B += b;
  if (m.size() == 1) {
    mi += abs(a - m[0]);
    if (m[0] < a) {
      rq.push(a);
      m.push_back(rq.top());
      rq.pop();
    } else {
      lq.push(a);
      m.push_back(lq.top());
      lq.pop();
      swap(m[0], m[1]);
    }
  } else {
    if (a <= m[0]) {
      lq.push(a);
      rq.push(m[1]);
      mi += m[0] - a;
      m.pop_back();
    } else if (m[1] <= a) {
      rq.push(a);
      lq.push(m[0]);
      mi += a - m[1];
      m[0] = m[1];
      m.pop_back();
    } else {
      lq.push(m[0]);
      rq.push(m[1]);
      m[0] = a;
      m.pop_back();
    }
  }
}

int main()
{
  int Q;
  cin >> Q;
  ll q, a, b;
  cin >> q >> a >> b;
  B = b;
  m[0] = a;
  Q--;
  while (Q--) {
    cin >> q;
    if (q == 1) {
      cin >> a >> b;
      query1(a, b);
    } else {
      query2();
    }
    assert(m.size() != 0 && m.size() <= 2);
    if (m.size() == 2) assert(m[0] <= m[1]);
    if (lq.size()) {
      assert(lq.top() <= m[0] && m.back() <= rq.top());
    }
  }
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e16;

int n, x, y, z;
long long ans = -INF, delta;
vector<tuple<int,int,int> > v;
vector<long long> pref, suff;
priority_queue<int> pq;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> x >> y >> z;
	n = x+y+z;
	pref.assign(n, -INF);
	suff.assign(n, -INF);
	for(int i = 0, a, b, c; i < n; i++) {
		cin >> a >> b >> c;
		delta += c;
		a -= c; b -= c;
		v.emplace_back(a-b, a, b);
	}
	sort(v.begin(), v.end());
	long long sum = 0;
	for(int i = 0; i < n; i++) {
		sum += get<2>(v[i]);
		pq.push(-get<2>(v[i]));
		if(pq.size() > y) sum += pq.top(), pq.pop();
		if(pq.size() == y) pref[i] = sum;
	}
	sum = 0;
	while(!pq.empty()) pq.pop();
	for(int i = n-1; i >= 0; i--) {
		sum += get<1>(v[i]);
		pq.push(-get<1>(v[i]));
		if(pq.size() > x) sum += pq.top(), pq.pop();
		if(pq.size() == x) suff[i] = sum;
	}
	for(int i = 0; i < n-1; i++) ans = max(pref[i]+suff[i+1]+delta, ans);
	cout << ans;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
//#define int long long
signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> X(N+M);
  vector<int> Y(N+M);
  for(int i=0; i<N+M; i++) {
    cin >> X.at(i) >> Y.at(i);
  }
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(M);
  vector<int> D(M);
  for(int i=0; i<N; i++) {
    A.at(i)=X.at(i);
    B.at(i)=Y.at(i);
  }
  for(int i=N; i<N+M; i++) {
    C.at(i-N)=X.at(i);
    D.at(i-N)=Y.at(i);
  }
  //入力終わり
  int cnt=999999999, ans=0;
  for(int i=0; i<N; i++) {
    for(int j=0; j<M; j++) {
      if(cnt>(abs(A.at(i)-C.at(j))+abs(B.at(i)-D.at(j)))) {
        cnt=abs(A.at(i)-C.at(j))+abs(B.at(i)-D.at(j));
        ans=j;
      }
      if(j==M-1) {
        cout << ans+1 << endl;
        cnt=999999999;
        ans=0;
      }
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int N,K;cin >> N >> K;
    vector<bool> ok(10);
    rep(i,K){
        int t;cin >> t;
        ok[t] = true;
    }   

    for(int i = N;i <= 100000;++i){
        string tmp = std::to_string(i);
        bool ch = true;
        rep(i,tmp.size()){
            int t = tmp[i] - '0';
            if(ok[t])ch = false;
        }
        if(ch){
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

li = [a, b, c, d, e]
distance = max(li) - min(li)

if distance > k:
    ans = ':('
else:
    ans = 'Yay!'
    
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FOR(i,j,n,m) for(int i=j;i<n;i+=m)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.F<<","<<_p.S<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=(ll)1e18;

int main(){
  IOS();
  ll n,k;
  cin>>n>>k;
  REP(i,n){
    ll t;
    cin>>t;
  }
  ll ans = (n-2)/(k-1)+1;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define N 100005
int main(){
    int n,k,cnt=0,ans=0;
    cin>>n>>k;
    int l[N],r[N];
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0'){
            cnt++;
            l[cnt]=i;
            while(s[i]=='0')i++;
            i--;
            r[cnt]=i;
        }
    }
    r[0]=-1;
    l[cnt+1]=n;
    if(k>cnt) k=cnt;
	for(int i=k;i<=cnt;i++)
		ans=max(ans,l[i+1]-r[i-k]-1);
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;


int main()
{
	int n;
	cin>>n;
	int a[100006],b[100006];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		b[a[i]]=i;
	}
	for(int i=1;i<=n;i++)
	{
		cout<<b[i]<<" ";
	}	
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll n,a,b,sum=0,p=0;
    cin>>n;
    vector<pair<ll,ll>> v;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        v.push_back(make_pair(b,a));
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++)
    {
        sum+=v[i].second;
          if(sum>v[i].first)
        p=1;
    
    }
    if(p)
     cout<<"No";
     else
      cout<<"Yes";
    
    return 0;
}

Measured memory_bytes: 6384
N = int(input())
ab = [list(map(int, input().split())) for i in range(N)]
ab = [ ab[i] + [i] for i in range(N)]

ab.sort(key=lambda x: x[1])

t = 0
canDone = True
for _ab in ab:
    t += _ab[0]
    if t > _ab[1]:
        canDone = False
        break
if canDone:
    print("Yes")
else:
    print("No")

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

int main() {
	int N, P;
	bool same[100010];
	cin >> N;
	for(int i=1; i<=N; ++i){
	    cin >> P;
	    same[i]=(P==i);
	}
	int ans=0;
	for(int i=1; i<N; ++i){
	    if(same[i]){
	        ++ans;
	        if(same[i+1]) same[i+1]=false;
	    }
	}
	if(same[N]) ++ans;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.*;
 
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean ans = false;
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                if (i*j == N) {
                    ans = true;
                    break;
                }
            }
        }
        System.out.println(ans ? "Yes" : "No");
    }
}


Measured memory_bytes: 21972
import sys
import itertools
import math
from collections import deque
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()

ans = 0
for i in range(1,N+1,2):
  cnt = 0
  for j in range(1,i+1):
    if i%j == 0:
      cnt += 1
  else:
    if cnt == 8:
      ans += 1
print(ans)

Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, x;
  in3(x, a, b);
  if(a >= b)
    out("delicious");
  else if(a < b && b <= a + x)
    out("safe");
  else
    out("dangerous");
  memi;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    ll ans = 100;
    for(int i = 0; i < n; ++i){
        ll a;
        cin >> a;
        ll tmp = 0;
        for(; a % 2 == 0; a /= 2){
            tmp++;
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n, i, f, x[100];
    scanf("%d", &n);
    for (i=0; i<n; i++) {
        scanf("%d", &x[i]);
    }
    for (f=n; f>0; f--) {
        printf("%d", x[f-1]);
        if(f>1){
            printf(" ");
        }
    }
    printf("\n");
    return 0;
}



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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;

int main(int argc, char *argv[]) {
    string s;
    cin >> s;
        
    for (char moji='a'; moji <= 'z'; ++moji) {
    	if (find(s.begin(), s.end(), moji) != s.end()) continue;
    	cout << moji << endl;
    	exit(EXIT_SUCCESS);
    }
    
    cout << "None" << endl;
    
    return 0;
}

Measured memory_bytes: 512
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0:
        return 1
    over = reduce(lambda x, y: x * y, range(n, n - r, -1))
    under = reduce(lambda x, y: x * y, range(1, r + 1))
    return over // under

N = int(input())

strings = {}
for i in range(N):
    key = ''.join(sorted(list(input())))
    strings.setdefault(key, 0)
    strings[key] += 1
ans = 0

for k, v in strings.items():
    if v > 1:
        ans += cmb(v, 2)

print(ans)

Measured memory_bytes: 18428
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t x;
    cin >> x;
    if(x == 7 || x == 5 || x == 3){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5e4 + 7;
const double pi = acos(-1);
const int mod = 998244353;
const double eps = 1e-8;
int ab[maxn*2],ac[maxn*2],bc[maxn*2];
int check(char x,char y){
	if(x == '?' || y == '?' || x == y) return 1;
	return 0;
}
void init(string a,string b,int n,int m,int *vis){
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			// +maxn是为了吧反着可能出现负数的情况也记录 
			if(!check(a[i],b[j])) vis[i-j+maxn] = 1;
		}
	}
	return;
}
int main(){
	int M = 2e3;
//	ios::sync_with_stdio(false);
//	cin.tie(0),cout.tie(0);
	string a,b,c;
	cin >> a >> b >> c;
	int la = a.size(),lb = b.size(),lc = c.size();
	//预处理两两字符串之间可以重合的位置 
	init(a,b,la,lb,ab);
	init(a,c,la,lc,ac);
	init(b,c,lb,lc,bc);
	//暴力跑每一处循环 
	int ans = 3 * M;
	//i枚举ab之间的间隔 
	for(int i = -(M<<1);i <= (M<<1);i++){
		//j枚举ac 
		for(int j = -(M<<1);j <= (M<<1);j++){			 
			if(!ab[i+maxn] && !ac[j+maxn] && !bc[j-i+maxn]){
				int l = min(0,min(i,j));
				int r = max(la,max(lb+i,lc+j));
				ans = min(ans,r-l);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <time.h>
#define int long long int
#define pb push_back
#define all(a) a.begin(), a.end()
#define scnarr(a, n) for (int i = 0; i < n; ++i) cin >> a[i]
#define vi vector<int>
#define si set<int>
#define pii pair <int, int>
#define sii set<pii>
#define vii vector<pii>
#define mii map <int, int>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace chrono;
/*
	Things to remember : check for coners n = 1, pass references instead
*/
/* -------------------------------Solution Sarted--------------------------------------*/

//Constants
const int MOD = 1000000007; // 1e9 + 7
const int MAXN = 1000005; // 1e6 +5
const int INF = 100000000000005; // 1e15 +5

void solve(){
	string s;
	cin >> s;

	if(s == "SSS"){
		cout << "0\n";
	}else if(s == "SRR" or s == "RRS"){
		cout << "2\n";
	}else if(s == "RRR"){
		cout << "3\n";
	}else{
		cout << "1\n";
	}
	
}

signed main()
{
	faster;
#ifndef ONLINE_JUDGE
	freopen("ip.txt", "r", stdin);
	freopen("op.txt", "w", stdout);
#endif
	// int t; cin >> t; while(t--)
		solve();
	return 0;
}


//Author : Ankit Raj
//Problem Link :

/*Snippets*/
/*
sieve - prime factorization using sieve and primes in range
zpower - pow with mod
plate - Initial template
bfs 
dfs
fenwik - BIT
binary_search
segment_tree
*/
	

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string a,b;
   cin>>a>>b;
   int n=a.length();
   int m=b.length();
   
   int lcs[n+1][m+1];
   memset(lcs,0,sizeof(lcs));
   
   for(int i=1;i<=n;i++)
   {
      for(int j=1;j<=m;j++)
      {  
          if(a[i-1]==b[j-1])
          { 
             lcs[i][j]=1+lcs[i-1][j-1];
          } 
          else
          {
             lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
          }
           
      }
   }
   stack< char > st;
   int i=n,j=m;
   while(1)
   {
      
      if(i==0||j==0) break;
      
      if(a[i-1]==b[j-1])
      { 
          st.push(a[i-1]);
          i--;
          j--;
      }
     else
     {
        if(i==1)
        {
           j--;
        }
        else
         if(j==1)
         {
            i--;
         }
        else
         if(lcs[i-1][j]>lcs[i][j-1])
         {
           i--;
         }
         else
         {
           j--; 
         }
        
     }
   } 
  
  
  
  while(!st.empty())
  {
     cout<<st.top();
     st.pop();
  }
  cout<<"\n";
  return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll a,b,c;
cin>>a>>b>>c;
if((a+b)<=c){
    if((c*c+(a-b)*(a-b)-2*c*(a+b))>0)
            cout<<"Yes"<<endl;
 else
    cout<<"No"<<endl;
}
else
    cout<<"No"<<endl;

}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	if (N % 2 == 1) {
		cout << N / 2 + 1 << endl;
		return 0;
	}
	else {
		cout << N / 2 << endl;
		return 0;
	}
}

Measured memory_bytes: 256
#! /bin/python
# coding:utf-8

import sys

def strchr(string, char):
	for token in string:
		if (token == char):
			return 1
	return 0

S = raw_input()

tmp = chr(ord('a'))
for i in range(0, 26):
	if (strchr(S, tmp) == 0):
		print tmp
		sys.exit()
	tmp = chr(ord(tmp) + 1)

print "None"

Measured memory_bytes: 2692
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    int N;
    cin >> N;
    string s;
    cin >> s;

    int count = 0;
    int j_index = N-1;
    for (int i=0; i<N; i++) {
        if (i >= j_index) {
            break;
        }

        if (s[i] == 'R') {
            continue;
        }

        for (int j=j_index; j>=0; j--) {
            j_index = j-1;
            if (s[j] == 'R' && j > i) {
                count += 1;
                break;
            }
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int n;
typedef pair<Int, Int> P;
vector<P> x, y;
constexpr double EPS = 1e-14;

double func(double t){
	double xmi = 1e10, ymi = 1e10, xma = -1e10, yma = -1e10;
	for(Int i=0; i<n; ++i){
		xmi = min(xmi, x[i].first+t*x[i].second);
		xma = max(xma, x[i].first+t*x[i].second);
		ymi = min(ymi, y[i].first+t*y[i].second);
		yma = max(yma, y[i].first+t*y[i].second);
	}
	return (xma-xmi)*(yma-ymi);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	for(Int i=0; i<n; ++i){
		int tx, ty;
		char c;
		cin >> tx >> ty >> c;
		if(c == 'R' || c == 'L'){
			y.push_back(P(ty, 0));
			x.push_back(P(tx, c=='R'?1:-1));
		}else{
			x.push_back(P(tx, 0));
			y.push_back(P(ty, c=='U'?1:-1));
		}
	}
	double tl = 0.0, tr = 1e10;
	for(int i=0; i<150; ++i){
		double t1 = (2 * tl + tr) / 3;
		double t2 = (tl + 2 * tr) / 3;
		double f = func(t1), g = func(t2);
		if(f < g){
			tr = t2;
		}else{
			tl = t1;
		}
	}
	cout << fixed << setprecision(14) << func(tl) << "\n";
}

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

int func(int N) {
  if (N < 10) return N;
  return func(N/10) + N % 10;
}

int main() {
  int N; cin >> N;
  int S = func(N);
  if (N%S == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}



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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MAX 1000010
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  int N; cin>>N;
  vector<int> A(N+1);
  rep1(i,N+1)cin>>A.at(i);
  ll res = 0;
  for(ll i = 1; i <= N; i++){
    if(i+1<=N&&A.at(i)==i&&A.at(i+1)==i+1){
      res++;
      i++;
    }else if(A.at(i)==i)res++;
  }
  cout<<res<<endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
      public static void main(String args[]) {
          Scanner sc = new Scanner(System.in);
          int a = sc.nextInt();
          int b = sc.nextInt();
          int c = sc.nextInt();
          if (a < b && b < c) {
              System.out.println("Yes");
          } else {
              System.out.println("No");
          }
     }
}

Measured memory_bytes: 26240
#include <iostream>
int Gcd(int a, int b) // Greatest Common Divisor
{
    if (!a || !b) {
        return 0;
    }
    while (a != b) {
        if (a < b) 
            std::swap(a, b);
        a -= b;
    }
    return a;
}
int Lcm(int a, int b, int gcd) // Least Common Multiple
{
    if (!a || !b) {
        return 0;
    }
    return a * (b / gcd); // 桁あふれ防止のために計算順序考慮
}
int main()
{
    int a, b, gcd;
    while (std::cin >> a >> b) {
        gcd = Gcd(a, b);
        std::cout << gcd << " " << Lcm(a, b, gcd) << "\n";
    }
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

vector<int>c, s, f;

int main() {
	int n;
	cin >> n;
	REP(i, 0, n - 1) {
		int a, b, d;
		cin >> a >> b >> d;
		c.push_back(a);
		s.push_back(b);
		f.push_back(d);
	}
	REP(i, 0, n) {
		int now = 0;
		REP(j, i, n - 1) {
			if (now <= s[j]) {
				now = s[j] + c[j];
			}
			else {
				now = ((now - s[j] + f[j] - 1) / f[j])*f[j] + s[j] + c[j];
			}
		}
		printf("%d\n", now);
	}
	return 0;
}

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


using namespace std;

int N, K;
vector<int> H;



int main()
{


	cin >> N;
	cin >> K;

	H = vector<int>(N);


	for (int i = 0; i < N; i++) {
		cin >> H[i];

	}

	sort(H.begin(),H.end(),greater<int>());



	long long ans = 0;

	for (int i = K; i < N; i++) {
		ans += (long long)H[i];
	}


	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	string S;
	cin >> S;
	
	bool ans = S.size() >= 2 && S.size() % 2 == 0;
	for (int i = 0; i < S.size(); i += 2) {
		ans &= S[i] == 'h' && S[i + 1] == 'i';
	}
	puts([&] {
		return ans;
	}() ? "Yes": "No");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    double rec_w, rec_h, pnt_x, pnt_y;
    scanf("%lf%lf%lf%lf", &rec_w, &rec_h, &pnt_x, &pnt_y);
    double area_ans = (rec_w * rec_h) / 2;
    printf("%.10lf ", area_ans);
    if ( pnt_x == (rec_w / 2) && pnt_y == (rec_h / 2)) {
        printf("1\n");
    }
    else {
        printf("0\n");
    }
    return 0;
}

Measured memory_bytes: 128
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let r = read::<usize>();
    println!("{}", r * r * 3)
}


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

int main(){
  int64_t x,k,d;
  cin >> x >> k >> d;
  x=abs(x);
  int64_t ans=0;
  if(x/k>=d){
    ans=x-k*d;
  }else{
    int64_t f,t;
    f=x/d;
    if((k-f)%2==0){
      t=f*d;
      ans=x-t;
    }else{
      t=(f+1)*d;
      ans=abs(x-t);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3572
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>

int main()
{
	int N;
	std::cin >> N;
	std::vector<long long> a(N);
	long long y = 0;
	for (int i = 0; i < N; i++) {
		std::cin >> a[i];
		y += a[i];
	}

	long long x = 0, /*y = std::accumulate(a.begin(), a.end(), 0),*/ min_val = std::pow(10, 9) * N;
	for (int i = 0; i < N - 1; i++) {
		x += a[i];
		y -= a[i];
		min_val = std::min(std::abs(x - y), min_val);
	}
	std::cout << min_val << std::endl;
}

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

int main() {
    int A, B;
    cin >> A >> B;
    if(A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}

const int MAX = 510000;

long long 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;
	}
}

// 二項係数計算
long long 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 MY_COM(int n, int k) {
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

class UnionFind {
private:
	vector<int>par;
public:
	//宣言
	UnionFind(int n) {
		for (int i = 0; i < n; i++) par.push_back(-1);
	}

	//根を求める
	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	//同じグループか
	bool same(int x, int y) {
		return root(x) == root(y);
	}

	//併合
	void unite(int x, int y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return;
	}

	//連結成分のサイズ
	int size(int x) {
		return -par[root(x)];
	}
};

int ans[100005];

signed main() {
	int n, m, k;
	cin >> n >> m >> k;
	UnionFind uf(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		ans[a]--, ans[b]--;
		uf.unite(a, b);
	}
	rep(i, n) {
		ans[i] += uf.size(i);
	}
	rep(i, k) {
		int c, d;
		cin >> c >> d;
		c--, d--;
		if (uf.same(c, d)) {
			ans[c]--, ans[d]--;
		}
	}
	rep(i, n) {
		cout << ans[i]-1 << " ";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 2548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 998244353;

void solve() {
	int n, k; cin >> n >> k;
	vector<pair<int, int> > v(k);
	for (auto &u : v)cin >> u.first >> u.second, u.second++;
	vector<ll> dp(n, 0);
	dp[0] = 1;
	dp[1] = -1;
	for (int i = 0; i < n; i++) {
		if (i > 0)dp[i] = (dp[i] + dp[i - 1]) % mod;
		for (auto u : v) {
			if (u.first + i < n)dp[i + u.first] = (dp[i + u.first] + dp[i]) % mod;
			if (u.second + i < n)dp[i + u.second] = (dp[u.second + i] - dp[i] + mod) % mod;
		}
	}
	cout << dp[n - 1];



}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();

}

Measured memory_bytes: 4744
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int main(void) {

    int N,M; cin>>N>>M;
    priority_queue<ll> A;
    for (int i = 0; i < N; ++i) {
        ll tmp; cin>>tmp;
        A.push(tmp);
    }

    ll ans = 0;

    for (int i = 0; i < M; ++i) {
        ll tmp; tmp=A.top();A.pop();
        tmp = tmp / 2;
        A.push(tmp);
    }

    while(!A.empty()){
        ans += A.top();
        A.pop();
    }

    cout<<ans<<endl;
}

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

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

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



int main(void) {
	int N, K; cin >> N >> K;
	vector<ll> H(N); rep(i, N)cin >> H[i];

	sort(H.begin(), H.end(), greater<ll>());

	ll ans = 0;
	for (int i = K; i < N; i++)ans += H[i];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4776
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define print_time cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
        return x;
    else
        return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
        if(m%2)
            r=(r*n)%p;
        n=(n*n)%p;
        m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
 
    return true;
}
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}
int32_t main()
{
   IOS;
  /* #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ***********************/	
   int n;
   cin>>n;
   int ans=0;
   for(int i=0;i<n;i++)
   {
   	int x=0;
   	cin>>x;
   	while(x%2==0)
   	{
   		ans++;
   		x=x/2;
   	}
   }
   cout<<ans;
} 	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;

template<class T> struct SegTree{
  int n;
  vector<T> node;
  T initv;
  
  SegTree(int n_, T initv_){
    n = 1;
    while(n < n_) n *= 2;
    node.resize(n*2-1);
    initv = initv_;
    rep(i, n*2-1) node[i] = initv;
  }
  
  void update(int i, T val){
    i += n - 1;
    if(node[i] >= val) return;
    node[i] = val;
    while(i > 0) i = (i-1) / 2, node[i] = max(node[i*2+1], node[i*2+2]);
  }
  
  T getmax(int a, int b, int i, int l, int r){
    if(r<=a || b<=l) return initv;
    if(a<=l && r<=b) return node[i];
    T vl = getmax(a, b, i*2+1, l, (l+r)/2);
    T vr = getmax(a, b, i*2+2, (l+r)/2, r);
    return max(vl, vr);
  }
};

int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    vector<int> v(n);
    rep(i, n) scanf("%d", &a[i]), v[i] = a[i];
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    SegTree<int> st(n+1, 0);
    int ans = 0;
    rep(i, n){
        int id = lower_bound(v.begin(), v.end(), a[i]) - v.begin() + 1;
        int tmp = st.getmax(0, id, 0, 0, st.n) + 1;
        ans = max(ans, tmp);
        st.update(id, tmp);
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 4740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
	int n,m;
	cin >> n >> m;
	vector<vector<int>> v(n,vector<int>(m));
	vector<int> b(m);
	for(int i = 0;i<n;++i)
	{
		for(int j = 0;j<m;j++)
		{
			cin >> v[i][j];
		}
	}
	for(int i = 0;i<m;i++)cin >> b[i];
	vector<int> ans(n);
	for(int i = 0;i<n;i++)
	{
		for(int j = 0;j<m;j++)
		{
			ans[i] += v[i][j]*b[j];
		}
	}

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

	return 0;
}


Measured memory_bytes: 3172
import math

n=int(input())
ans=list(map(int,input().split()))
if n==1:
  print(sum(ans))
  
else:
  ans1=[]
  ans1.append(ans)
  for i in range(n-1):
    x,y=map(int,input().split())
    p,q=ans1[-1][0],ans1[-1][1]
    if p%x==0:
      p1=p//x
    else:
      p1=p//x+1
    if q%y==0:
      q1=q//y
    else:
      q1=q//y+1
    pq=max(p1,q1)
    r=[x*pq,y*pq]
    ans1.append(r)
    
  print(sum(ans1[-1]))
    
    

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

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

    long long int ans = 0;
    for(int i=0;i<(1<<(s.size()-1));++i){
        long long int tmp = 0;
        for(int j=0;j<s.size();++j){
            tmp = tmp * 10 + s[j] - '0';
            if((i&(1<<j)) != 0){
                ans += tmp;
                tmp = 0;
            }
        }
        ans += tmp;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())
d1 = (b1 - a1) * t1
d2 = (b2 - a2) * t2
if d1 > 0:
    d1 = -d1
    d2 = -d2
if d1 + d2 < 0:
    print(0)
    exit()
if d1 + d2 == 0:
    print('infinity')
    exit()

ok, ng = 0, 10**20
while ng - ok > 1:
    m = (ok + ng) // 2
    if m * d2 + (m + 1) * d1 <= 0:
        ok = m
    else:
        ng = m
if ok * d2 + (ok + 1) * d1 == 0:
    print(2 * ok)
else:
    print(2 * ok + 1)


Measured memory_bytes: 3064
n = gets.chomp.to_i
l = gets.split.map(&:to_i)
a = 0
#i,j,k = 0
for i in 0..n-1 do
    for j in 0..n-1 do
        for k in 0..n-1 do
            if (l[i] < l[j] + l[k] ) && (l[j] < l[k] + l[i] ) && (l[k] < l[i] + l[j] ) && i != j && j != k && k != i && l[i] != l[j] && l[j] != l[k] && l[k] != l[i] then
                a = a + 1
            end
        end
    end
end
puts a/6
# 

Measured memory_bytes: 14276
#include <iostream>

using namespace std;

// naive but easy to implement
int calc(int n)
{
  int count = 0;
  for (int a = 0; a <= 9; a++) {
    for (int b = 0; b <= 9; b++) {
      for (int c = 0; c <= 9; c++) {
        for (int d = 0; d <= 9; d++) {
          if (a + b + c + d == n){
            count++;
          }
        }
      } 
    }
  }

  return count;
}

int main(int argc, char const* argv[])
{
  int n;
  while (cin >> n) {
    cout << calc(n) << endl;
  };
  return 0;
}

Measured memory_bytes: 1160
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



def main():
    s = input()
    print(s[0] + str(len(s)-2) + s[-1])

if __name__ == "__main__": main()


Measured memory_bytes: 4084
#include <cstdio>
#include <cstring>
typedef unsigned long long int ull;
int N;
ull targetOfRow[505],targetOfCol[505];
int opcatOfRow[505],opcatOfCol[505];
ull matrix[505][505];
int zeroCountOfRow[505],zeroCountOfCol[505];
bool check(){
	for(int r=1;r<=N;r++){
		ull androw=-1,orrow=0ull,andcol=androw,orcol=orrow;
		for(int c=1;c<=N;c++){
			androw&=matrix[r][c];
			orrow|=matrix[r][c];
			andcol&=matrix[c][r];
			orcol|=matrix[c][r];
		}
		if(opcatOfRow[r]&&orrow!=targetOfRow[r]){
			return 0;
		}
		if(!opcatOfRow[r]&&androw!=targetOfRow[r]){
			return 0;
		}
		if(opcatOfCol[r]&&orcol!=targetOfCol[r]){
			return 0;
		}
		if(!opcatOfCol[r]&&andcol!=targetOfCol[r]){
			return 0;
		}
	}
	return 1;
}
void simpleInference(int pos){
	for(int r=1;r<=N;r++){
		for(int c=1;c<=N;c++){
			ull colBit=(targetOfCol[c]>>pos)&1;
			ull rowBit=(targetOfRow[r]>>pos)&1;
			if(colBit!=opcatOfCol[c]){
				matrix[r][c]|=(colBit<<pos);
			}
			if(rowBit!=opcatOfRow[r]){
				matrix[r][c]|=(rowBit<<pos);
			}
			if(rowBit==colBit){
				matrix[r][c]|=(rowBit<<pos);
			}
        }
    }
}
void SpecialInference(ull targets[],ull targets2[],int ops1[],int ops2[],int zeros1[],int zeros2[],bool isRow,int pos){
    ull mask=(ull)1<<(ull)pos;
    for(int r=1;r<=N;r++){
		ull bitTarget=(targets[r]>>pos)&ops1[r];
		if(!bitTarget||zeros1[r]<N){
			continue;
		}
		int c=1;
		while(c<=N){
			if(ops2[c]==0&&(targets2[c]&mask)==0&&zeros2[c]>1){
				break;
			}
			c++;
		}
		if(c>N){
			continue;
		}
		if(isRow){
			matrix[r][c]|=mask;
		}
		else{
			matrix[c][r]|=mask;
		}
		zeros2[c]--;
		zeros1[r]--;
	}
}
int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++){
		scanf("%d",&opcatOfRow[i]);
	}
	for(int i=1;i<=N;i++){
		scanf("%d",&opcatOfCol[i]);
	}
	for(int i=1;i<=N;i++){
		scanf("%llu",&targetOfRow[i]);
	}
	for(int i=1;i<=N;i++){
		scanf("%llu",&targetOfCol[i]);
	}
	for(int bit=0;bit<64;bit++){
		ull mask=(ull)1<<(ull)bit;
		simpleInference(bit);
		memset(zeroCountOfCol,0,sizeof zeroCountOfCol);
		memset(zeroCountOfRow,0,sizeof zeroCountOfRow);
		for(int r=1;r<=N;r++){
			for(int w=1;w<=N;w++){
				if((mask&matrix[r][w])==0){
					zeroCountOfRow[r]++;
					zeroCountOfCol[w]++;
				}
			}
		}
		SpecialInference(targetOfRow,targetOfCol,opcatOfRow,opcatOfCol,zeroCountOfRow,zeroCountOfCol,1,bit);
		SpecialInference(targetOfCol,targetOfRow,opcatOfCol,opcatOfRow,zeroCountOfCol,zeroCountOfRow,0,bit);
	}
	if(!check()){
		puts("-1");
		return 0;
	}
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			printf("%llu ",matrix[i][j]);
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 7424
#include<bits/stdc++.h>
using namespace std;
const int N=105;

int a[N];

int main() {
	int n,ans=0; cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	for (int i=2;i<=n;i++) {
		if (a[i]==a[i-1]) a[i]=-1,ans++;
	}
	cout<<ans<<endl;
}


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

int main() {
	
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	vector<int> l(q), r(q);
	rep(i, q){
		int lt, rt;
		cin >> lt >> rt;
		lt--; rt--;
		l[i] = lt; r[i] = rt;
	}
	vector<int> ac;
	rep(i, n-1){
		if(s[i] == 'A' && s[i+1] == 'C'){
			ac.push_back(i);
		}
	}
	rep(i, q){
		int ans;
		auto Iter_l = lower_bound(ALL(ac), l[i]);
		auto Iter_r = lower_bound(ALL(ac), r[i]);
		ans = Iter_r - Iter_l;
		cout << ans << endl;
	}
	return 0;
}

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

n=int(input())
s=input()
l=[]
m=[]
if n%2==1:
  print("No")
  sys.exit()
for i in range(n//2):
  l.append(s[i])
for _ in range(n//2,n):
  m.append(s[_])
print("Yes" if l==m else "No")

  

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  
  int l;
  int r;
  
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='A'){
      l=i;
      break;
    }
  }
  
  for(int i=s.size()-1;i>=0;i--){
    if(s.at(i)=='Z'){
      r=i;
      break;
    }
  }
  
  cout << r-l+1 <<endl;
}

Measured memory_bytes: 3716
#include<iostream>
using namespace std;
int main(){
  	int n, max,pri,ans=0;
	cin >> n >> max;
  	ans+=max/2;
  	for(int i=0;i<n-1;i++){
		cin >> pri;
      	if(max<pri){
			ans+=(max+pri)/2;
          	max=pri;
        }else{
			ans+=pri;
        }
    }
  	cout << ans;
}


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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
	int n;
	cin >> n;
	map<string, int> mp;
	int ma = 0;
	for(int i = 0;i < n;i++){
		string s;
		cin >> s;
		chmax(ma, ++mp[s]);
	}

	for(auto e : mp){
		if(e.second == ma){
			cout << e.first << endl;
		}
	}

	return 0;
}


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

int main(){
    int n, A[100];
    cin >> n;
    for( int i = 0; i < n; i++) cin >> A[i];
    for( int i = n - 1; i >= 0; i--){
        if(i != n - 1 ) cout << " ";
        cout << A[i];
    }
    cout << endl;
}


Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>

using std::cin;using std::cout;using std::cerr;using std::endl;

#define rep(i,a,b) for(int i = a;i <= b;++i)
#define per(i,a,b) for(int i = a;i >= b;--i)

const int mmax = 80;
long long n,money,stock,price[mmax + 10];

int main(){

	std::ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>n;

	rep(i,1,n){
		cin>>price[i];
	}

	money = 1000;
	stock = 0;

	rep(i,1,n - 1){
		if(price[i + 1] > price[i]){
			stock += money / price[i];
			money = money % price[i];
		}
		else{
			money += price[i] * stock;
			stock = 0;
		}
	}

	cout<<money + stock * price[n];

	return 0;
}

Measured memory_bytes: 3648
import java.io.*;

public class Main{
 public static void main(String[] args){
	try{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int x = Integer.parseInt(br.readLine());
	int ans = x*x*x;
	System.out.println(ans); 
	}catch(IOException e){
	System.out.println(e);
	}
 }
}

Measured memory_bytes: 16864
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    
    int N,X,Y;
    cin >> N >> X >> Y;
    
    vvi G(N);
    rep(i,N-1){
        G[i].pb(i+1);
        G[i+1].pb(i);
    }
    G[X-1].pb(Y-1);
    G[Y-1].pb(X-1);
    
    vi ans(N,0);
    
    rep(i,N){
        vi dis(N,-1);
        queue<int> que;
        que.push(i);
        dis[i] = 0;
        while (!que.empty()) {
            int a = que.front();
            que.pop();
            
            for (int p : G[a]) {
                if(dis[p] >= 0) continue;
                que.push(p);
                dis[p] = dis[a]+1;
            }
        }
        
        reps(j,i+1,N) ans[dis[j]]++;
    }
    
    reps(i,1,N) cout << ans[i] << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 3756
N = int(input())
S = list(input())

w_cnt = [0]
w = 0
for s in S:
    if s == '.':
        w += 1
    w_cnt.append(w)

b_cnt = [0]
b = 0
for s in S[::-1]:
    if s == '#':
        b += 1
    b_cnt.append(b)


ans = float('inf')
i = 0
for b, w in zip(b_cnt[::-1], w_cnt):
    ww, bb = i, N - i
    ans = min(ans, abs(b - bb) + abs(w - ww))
    i += 1
print(ans)


Measured memory_bytes: 15708