akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define mod 1000000007

int main(void)
{
  int n, m, broken[100001] = {0};
  scanf("%d %d", &n, &m);

  int bridge;
  int i;
  for (i = 0; i < m; i++)
  {
    scanf("%d", &bridge);
    broken[bridge] = 1;
  }

  int dp[100001] = {0};
  dp[0] = 1;
  for (i = 0; i < n; i++)
  {
    if (broken[i + 1] == 0)
      dp[i + 1] = (dp[i + 1] + dp[i]) % mod;
    if (i + 2 <= n && broken[i + 2] == 0)
      dp[i + 2] = (dp[i + 2] + dp[i]) % mod;
  }

  printf("%d\n", dp[n]);

  return 0;
}


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

#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {0, -1, 0, 1, 1, 1, -1, -1};
int dy[] = {-1, 0, 1, 0, 1, -1, 1, -1};

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

  int n, m;
  string s;
  cin >> n >> m >> s;

  vvt<int> edge(n);
  rep(i, 0, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }

  vt<bool> ok(n, false);
  rep(cu, 0, n) {
    int a = 0, b = 0;

    for(auto to : edge[cu]) {
      if(s[to] == 'A') a++;
      else b++;
    }

    if(a && b) ok[cu] = true;
  }

  vt<int> acou(n, 0), bcou(n, 0);
  rep(cu, 0, n) {
    if(!ok[cu]) continue;

    for(auto to : edge[cu]) {
      if(!ok[to]) continue;

      if(s[to] == 'A') acou[cu]++;
      else bcou[cu]++;
    }
  }

  queue<int> ng;
  rep(cu, 0, n) {
    if(ok[cu] && (!acou[cu] || !bcou[cu])) {
      ng.push(cu);
      ok[cu] = false;
    }
  }

  while(!ng.empty()) {
    int cu = ng.front();
    ng.pop();

    for(auto to : edge[cu]) {
      if(!ok[to]) continue;

      if(s[cu] == 'A') acou[to]--;
      else bcou[to]--;

      if(!acou[to] || !bcou[to]) {
        ng.push(to);
        ok[to] = false;
      }
    }
  }

  rep(cu, 0, n) {
    if(ok[cu]) return cout << "Yes\n", 0;
  }
  cout << "No\n";
}


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

#define MAX 100000

typedef struct{
	char name[10];
	int time;
}process;

void initialize();
int isEmpty();
int isFull();
void enqueue( process x );
process dequeue();
int min( int x , int y );

int head , tail;
process Q[MAX];

int main( void ){
	
	int n , q;
	int i;
	int c;
	int total = 0;
	
	process x;
	
	scanf( "%d %d" , &n , &q );
	
	for( i = 1; i <= n; i++ ){
		scanf( "%s %d" , Q[i].name , &Q[i].time );
	}
	
	initialize();
	head = 1;
	tail = n + 1;
	
	while( head != tail ){
		x = dequeue();
		c = min( q , x.time );
		x.time -= c;
		total += c;
		if( x.time > 0 ){
			enqueue(x);
		}else{
			printf( "%s %d\n" , x.name , total );
		}
	}
}

void initialize(){
	
	head = tail = 0;
	
}

int isEmpty(){
	
	if( head == tail ){
		return 1;
	}else{
		return 0;
	}
	
}

int isFull(){
	
	if( head == ( tail + 1 ) % MAX ){
		return 1;
	}else{
		return 0;
	}
	
}

void enqueue( process x ){
	
	if( isFull() == 1 ){
		fprintf( stderr , "エラー(オーバーフロー)" );
	}else{
		Q[tail] = x;
		if ( tail + 1 == MAX ){
			tail = 0;
		}else{
			tail++;
		}
	}
	
}

process dequeue(){
	
	process x;
	
	if( isEmpty() == 1 ){
		fprintf( stderr , "エラー(アンダーフロー)" );
		exit(0);
	}else{
		x = Q[head];
		if( head + 1 == MAX ){
			head = 0;
		}else{
			head++;
		}
		return x;
	}
	
}
	
int min( int x , int y ){
	
	if( x < y ){
		return x; 
	}else{
		return y;
	}
	
}



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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  map<int, int> B;
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
    --A[i];
    B[A[i]]++;
  }
  
  ll sum = 0;
  for (auto &i : B)
  {
    sum += (ll)i.second * (i.second - 1) / 2;
  }
  
  
  for (int i = 0; i < N; i++)
  {
    ll temp = (ll)B[A[i]] * (B[A[i]] - 1) / 2 - (ll)(B[A[i]] - 1) * (B[A[i]] - 2) / 2;
    cout << sum - temp << endl;
    
  }
  
  return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define INF 2000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>

#define MAX 1000005
const int INT_MA=2147483647;

struct RMQ{
	int n,dat[2*MAX-1];
	void init(int n_){
		n=1;
		while(n<n_) n*=2;
		for(int i=0; i<2*n-1; i++) dat[i]=INT_MA;
	}
	void update(int k,int a){
		k+=n-1;
		dat[k]=a;
		while(k>0){
			k=(k-1)/2;
			dat[k]=min(dat[2*k+1],dat[2*k+2]);
		}
	}
	int query(int a,int b,int k,int l,int r){
		if(r<=a||b<=l) return INT_MA;
		if(a<=l&&r<=b) return dat[k];
		else{
			int vl=query(a, b, 2*k+1, l, (l+r)/2);
			int vr=query(a, b, 2*k+2, (l+r)/2, r);
			return min(vl,vr);
		}
	}
};

RMQ rmq;

signed main(){
	int n,q; cin>>n>>q;
	rmq.init(n);
	for(int i=0; i<q; i++){
		int com,x,y; cin>>com>>x>>y;
		if(com){
			cout<<rmq.query(x, y+1, 0, 0, rmq.n)<<en;
		}else{
			rmq.update(x, y);
		}
	}
}



Measured memory_bytes: 5156
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
#define pb push_back
const int maxn = 100000 + 5;
int n;
int mem[maxn];
int cnt = 0;
vector<int> pro[maxn];
queue<int> que1, que2;

int solve()
{
	sort(mem, mem+n);
	int flag = 0, total = n, p = 0;
	if(mem[0] >= 0) flag = 1;
	else if(mem[n-1] <= 0) flag = -1;

	if(flag == 1) //全部>=0
	{
		while(total > 2)
		{
			pro[cnt].pb(mem[p]);
			pro[cnt++].pb(mem[p+1]);
			mem[p+1] = mem[p] - mem[p+1];
			p++;
			total--;
		}
		pro[cnt].pb(mem[p+1]);
		pro[cnt++].pb(mem[p]);
		mem[p+1] = mem[p+1] - mem[p];
		return mem[p+1];
	}
	else if(flag == -1) //全部<0
	{
		sort(mem, mem+n, greater<int>());
		while(total > 1)
		{
			pro[cnt].pb(mem[p]);
			pro[cnt++].pb(mem[p+1]);
			mem[p+1] = mem[p] - mem[p+1];
			p++;
			total--;
		}
		return mem[p];
	}
	else //+&- 
	{
		int minus = 0, plus = 0;
		for(int i = 0; i < n; i++)
		{
			if(mem[i] < 0)
			{
				que1.push(mem[i]);
				minus++;
			} 
			else 
			{
				que2.push(mem[i]);
				plus++;
			}
		}
		int mi, pl;
		while(minus != 1 || plus != 1)
		{
			mi = que1.front(); que1.pop();
			pl = que2.front(); que2.pop();
			if(plus < minus)
			{
				pro[cnt].pb(pl);
				pro[cnt++].pb(mi);
				que2.push(pl-mi);
				minus--;
			}
			else
			{
				pro[cnt].pb(mi);
				pro[cnt++].pb(pl);
				que1.push(mi-pl);
				plus--;
			}
		}
		mi = que1.front(); que1.pop();
		pl = que2.front(); que2.pop();
		pro[cnt].pb(pl);
		pro[cnt++].pb(mi);
		return pl-mi;
	}
}

int main()
{
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &mem[i]);
	}
	printf("%d\n", solve());
	for(int i = 0; i < cnt; i++)
	{
		printf("%d %d\n", pro[i][0], pro[i][1]);
	}
}

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

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

int a[500][500];

int main(){
    int N, M, Q;
    cin >> N >> M >> Q;
    for(int i = 0; i < M; i++){
        int l, r;
        cin >> l >> r;
        l--; r--;
        a[l][r]++;
    }
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < 500; j++){
            a[i][j] += a[i][j - 1];
        }
    }
    for(int i = 0; i < Q; i++){
        int p, q;
        cin >> p >> q;
        p--; q--;
        int ans = 0;
        for(int j = p; j <= q; j++){
            ans += a[j][q];
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1920
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}


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


	int N = getint(), K = getint();

	int A[200001];
	rep(i, N) A[i] = getint();
	ll owa = ll(N) * N;

	rep(p, K) {
		int B[200001] = {};
		rep(i, N) {
			B[max(0, i - A[i])]++;
			B[min(N, i + A[i] + 1)]--;
		}
		ll kei = B[0];
		A[0] = B[0];
		rep1(i, N - 1) {
			kei +=(A[i] = A[i - 1] + B[i]);
		}
		if (kei == owa) break;
	}

	rep(i, N) cosp(A[i]);

	Would you please return 0;
}

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

bool has3(int x)
{
  while (x > 0) {
    if (x % 10 == 3) return true;
    x /= 10;
  }
  return false;
}

void call(int n)
{
  for (int x=1; x<=n; x++) {
    if (x % 3 == 0 || has3(x))
      cout << " " << x;
  }
  cout << endl;
}

int main()
{
  int n;
  cin >> n;
  call(n);
  return 0;
}



Measured memory_bytes: 3092
import java.util.Scanner;
import java.util.Set;
import java.util.HashSet;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		Set<Integer> s = createPowSet();
		for (int i = X; i >= 0; i--) {
			if (s.contains(i)) {
				System.out.println(i);
				return;
			}
		}
		System.out.println(1);
	}

	private static Set<Integer> createPowSet() {
		Set<Integer> s = new HashSet<>();
		for (int i = 2; i <= 1000; i++) {
			for (int j = 2; j <= 1000; j++) {
				int num = (int)Math.pow(i, j);
				if (num > 1000) {
					if (j == 2) {
						return s;
					} else {
						break;
					}
				}
				s.add(num);
			}
		}
		return s;
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
bool vis[1000][1000];
int main() {
	string s,st,s_begin,s_end;
	cin>>s;
	bool rev=0;
	int q,t;cin>>q;
	for(int i=0;i<q;i++)
	{
     cin>>t;
     if(t==1)
     	{
          rev=!rev;
     	}
     else
     {
     	cin>>t>>st;
     	if(t==1)
     		{
     			if(rev==0)
     				{s_begin+=st;}
     			else
     				s_end+=st;
     		}
     	else
     		{ 
     			if(rev==1)
     				s_begin+=st;
     			else
     				s_end+=st;
     		}
     }
	}
	reverse(s_begin.begin(),s_begin.end());
	s_begin+=s;s_begin+=s_end;
	if(rev)
	{
		reverse(s_begin.begin(),s_begin.end());
	}

	cout<<s_begin;
}

Measured memory_bytes: 1348
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;

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

       int t=1;
       //cin>>t;
       while(t--)
       {
               int n;
               cin>>n;
               string s[n];
               int a=0,b=0,c=0,d=0;
               for(int i=0;i<n;++i)
               {
                    cin>>s[i];
                    if(s[i][0]=='A')
                         a++;
                    else if(s[i][0]=='W')
                         b++;
                    else if(s[i][0]=='T')
                         c++;
                    else
                         d++;
               }
               cout<<"AC x "<<a<<"\n";
               cout<<"WA x "<<b<<"\n";
               cout<<"TLE x "<<c<<"\n";
               cout<<"RE x "<<d<<"\n";
       }
}


Measured memory_bytes: 6764
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }

  int cnt = 1;
  int base = vec[0];
  for (int i = 1; i < n; i++) {
    if (base <= vec[i]) {
      cnt++;
      base = vec[i];
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int pm(int n,int *l){
    int i,j,p=0,c=n-1,target[n-1];

    for(i=0;i<n-1;i++){target[i]=i+2;}
    for(i=0;i<n-1;i++){
        if (!target[i]){continue;}
        for(j=i;j<n-1;j=j+i+2){
            if (!target[j]){continue;}
            if (j!=i && target[j]%target[i]==0){target[j]=0;c--;}
        }
    }
    for(i=0;i<n-1;i++){
        if(target[i]){l[p]=target[i];p++;}
    } 
    return p;
} 

int main(void){
    int i,j,p,n=0,idx=0,l[110000];long int s,o[50];
    p=pm(110000,l);

    while(1){
        s=0;
        scanf("%d",&j);
        if(j==0){break;}
        for(i=0;i<j;i++){
            s+=l[i];
        }
        o[n]=s;
        n++;
    }
    for(i=0;i<n;i++){printf("%ld\n",o[i]);}
}



Measured memory_bytes: 2212
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    string s;
    cin >> s;
    vi cnt(3,0);
    for(char c : s) cnt[c-'a']++;
    sort(all(cnt));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(abs(cnt[i]-cnt[j])>1){
                cout << "NO" <<  endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
	int x, y;
	cin >> x >> y;
	vector<int> a(y);
	for (int i = 0; i < y; i++) {
		cin >> a.at(i);
}
	int tasu = 0;
	for (int i = 0; i < y; i++) {
		tasu += a.at(i);	
}
	if(x - tasu >= 0) {
		cout << x - tasu << endl;
}
	else cout << -1 << endl;
    }

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

typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  vector<int> l(N + 1), b(N);
  for (int i = 0; i <= N; i++) {
    cin >> l[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }

  ll ans = 0;
  for (int i = 0; i < N; i++) {
    int left = min(l[i], b[i]);
    ans += left;
    l[i] -= left;
    b[i] -= left;

    int right = min(l[i + 1], b[i]);
    ans += right;
    l[i + 1] -= right;
    b[i] -= right;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n;
int y,z;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int x=1;x<=n;x++){
		y=x*108;
		z=y/100;
		if(z==n){
			cout<<x<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		int C = A-B-B;
		if(C>0) {
			System.out.println(C);
		}else {
			System.out.println(0);
		}

	}

}

Measured memory_bytes: 23252
#include<iostream>
#include<cstdio>
using namespace std;
int main(){


 
  int H,W;

  for( ; ; ){

    cin>>H>>W;

    if(H==0&&W==0)break;

    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if(i>0 && H-1>i && j>0 && W-1>j){
	cout<<".";
      }else{
	cout<<"#";
      }
    }
    
    cout<<endl;
  }

  cout<<endl;
}   
  return 0;
}

Measured memory_bytes: 3076
let () =
    let split s =
        let rec loop i cur flag acc =
            if i = String.length s then ( if flag then cur :: acc else acc) else (
                match flag, s.[i] with
                | true,  ' ' -> loop (i + 1) "" false (cur :: acc)
                | false, ' ' -> loop (i + 1) "" false acc
                | true,  v   -> loop (i + 1) (Printf.sprintf "%s%c" cur v) true acc
                | false, v   -> loop (i + 1) (Printf.sprintf "%s%c" cur v) true acc
            )
        in
        List.map int_of_string (List.rev (loop 0 "" false []))
    in
    let main () =
        let n = int_of_string (read_line ()) in
        let a = Array.of_list (split (read_line ())) in
        let b = Array.of_list (split (read_line ())) in
        let c = Array.of_list (split (read_line ())) in
        let rec loop i acc =
            if i = n then acc else
                let s = b.(a.(i) - 1) in
                let s = if i < n - 1 && a.(i) + 1 = a.(i + 1) then s + c.(a.(i) - 1) else s in
                loop (i + 1) (acc + s)
        in
        let r = loop 0 0 in
        Printf.printf "%d\n" r
    in
    main ()

Measured memory_bytes: 384
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

int main()
{
	ll base = 100;
	ll res = 0;
	ll x;cin >> x;
	while(base < x)
	{
		base *= 1.01;
		++res;
	}
	cout << res;
    return 0;
}


Measured memory_bytes: 3676
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            if (Integer.toString(i).length() % 2 == 1)
                cnt++;
        }

        System.out.println(cnt);
    }
}

Measured memory_bytes: 30292
#include<stdio.h>
int main(void){
	int n,x,k,i,j,ans;
	while(1){
		ans=0;
		scanf("%d %d",&n,&x);
		if(!n && !x) break;
		for(i=1;i<=n-2;i++){
			for(j=i+1;j<=n-1;j++){
				for(k=j+1;k<=n;k++){
					if(i+j+k==x) ans++;
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){

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

    ll x;
    cin >> x;

    int cor;

    if(0 < x%11 and x%11 <= 6){
        cor = 1;
    }
    else if(0 < x%11 and x%11 > 6){
        cor = 2;
    }
    else{
        cor = 0;
    }
    ppp(x/11 * 2 + cor);



    return 0;
}


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

int main(){
	// sengen
	int n,k;
	// nyuryoku
	cin >> n >> k;
	int d[k];
	int a[k][n];
	map<int,int> mp;
	for(int i=0;i<n;i++){
		mp[i] = 0;
	}
	for(int i=0;i<k;i++){
		cin >> d[i];
		for(int j=0;j<d[i];j++){
			cin >> a[i][j];
			mp[a[i][j]-1]++;
		}
	}
	// keisan
	int count = 0;
	for(auto x:mp){
        if(x.second == 0){
			count++;
		} 
	}
	// syutsuryoku
	cout << count << endl;
}


Measured memory_bytes: 3644
import sys
def hit_blow(num):
   hits = 0
   blows = 0
   emp1 = [0,0,0,0]
   emp2 = [0,0,0,0]
   num.append(emp1)
   num.append(emp2)
   for i in range(0,4):
       i = i*2
       for j in range(0,4):
           j = j*2
           if num[0][i] == num[1][j] and num[2][int(i/2)] == 0 and num[3][int(j/2)] == 0:
               if i ==j :
                   hits += 1
               else:
                   blows += 1
               num[2][int(i/2)] = 1
               num[3][int(j/2)] = 1
   print(hits,blows)

flag = 0
num = []
for line in sys.stdin.readlines():
   if flag == 0:
       num.append(line)
       flag = 1
   elif flag == 1:
       num.append(line)
       flag = 2
   if flag == 2:
       flag = 0
       hit_blow(num)
       del num[:]

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

int main()
{
    ll N, K;
    string S;

    cin >> N >> K >> S;

    vector<ll> one;
    vector<ll> zero;

    char pre = S.at(0);
    ll cnt = 0;
    bool z = false;
    if (pre == '0')
        z = true;

    for (ll i = 0; i < N; i++)
    {
        if (pre == S.at(i))
        {
            cnt++;
        }
        else
        {
            if (z)
            {

                zero.push_back(cnt);
            }
            else
            {
                one.push_back(cnt);
            }
            pre = S.at(i);
            cnt = 1;
            z = !z;
        }
    }
    if (cnt > 0)
    {
        if (z)
            zero.push_back(cnt);
        else
            one.push_back(cnt);
    }

    ll oSize = one.size();
    ll zSize = zero.size();

    if (S.at(0) == '0')
    {
        vector<ll> tmp;
        tmp.push_back(0);
        for (ll i = 0; i < oSize; i++)
        {
            tmp.push_back(one.at(i));
        }
        one = tmp;
        oSize++;
    }

    ll max = 1;
    for (ll i = 0; i < zSize; i++)
    {
        ll tmp = 0;
        ll tmp2 = 0;
        for (ll k = 0; k < K; k++)
        {
            if (i + k < zSize)
            {
                tmp += zero[i + k];
            }
            if (k == 0 && i + k < oSize)
            {
                tmp2 += one[i + k];
            }

            if (i + k + 1 < oSize)
            {
                tmp2 += one[i + k + 1];
            }
        }
        if (max < (tmp + tmp2))
        {
            max = tmp + tmp2;
        }
    }

    if (zSize == 0 && oSize > 0)
    {
        max = N;
    }
    cout << max << endl;
}

Measured memory_bytes: 1908
N = int(raw_input())
ans = 1000000
for A in range(1, 1+N/2):
  B = N - A
  a = 0
  b = 0
  tA = A
  tB = B
  for i in range(6)[::-1]:
    ta = tA/10**i
    tb = tB/10**i
    a += ta
    b += tb
    tA -= ta*(10**i)
    tB -= tb*(10**i)
  ans = min(ans, a+b)
print ans


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

int main()
{
	int n;
	while(cin >> n){
		int* x = new int[n];
		for(int i=0;i<n;i++){
			cin >> x[i];
		}
		sort(x,x+n);
		int sum = x[0];
		for(int i=1;i<n;i++){
			x[i] = x[i]+x[i-1];
			sum += x[i];
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 0
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [int(input()) for j in range(m)]
ab = [sum(a[i][j] * b[j] for j in range(m)) for i in range(n)]
for k in ab:
    print(k)


Measured memory_bytes: 6028
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define ep emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

template<class T, class U> bool chmax(T &a, U b) { if (a < b) a = b; return true; }
template<class T, class U> bool chmin(T &a, U b) { if (a > b) a = b; return true; }

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n, k; cin >> n >> k;
  vi a(n);
  rep(i, n) cin >> a[i];

  auto f = [&](ll len) {
    ll ret = 0;

    rep(i, n) ret += ((a[i] + len - 1) / len) - 1;
    return ret;
  };

  ll left = 0, right = 1e9;
  while (right - left > 1) {
    ll mid = (right + left) / 2;
    ll v = f(mid);

    if (v <= k) right = mid;
    else left = mid;
  }

  cout << right << endl;

  return (0);
}


Measured memory_bytes: 4004
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define bg begin()
#define ed end()
#define fi first()
#define se second()
using namespace std;
using ll = long long;
using vint = vector<int>;
using pint = pair<int,int>;
using vpint = vector<pint>;
template <typename T>
T sq(T x){
  return x * x;
}
ll mod = 1e9 + 7;

signed main (){
  int N;
  cin >> N;
  int max_cnt =0;
  int ans;

  if(N < 2){
cout << N << endl;
    return 0;
  }
  rep2(i,2,N+1){
    int cnt = 0;
    int now = i;
    while(now % 2 == 0){
    now /=  2;
      cnt++; 
    }
    if(cnt>max_cnt){
max_cnt = cnt;
      ans =  i;
    }
  }
  cout << ans << endl;
return 0;
}


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

int n, T, c, t, m;

int main(){
	cin >> n >> T;
	m = 1001;
	for (int i = 0; i < n; ++i){
		cin >> c >> t;
		if (t <= T && m > c) m = c;
	}
	if (m == 1001) cout << "TLE";
	else cout << m;
}

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

int main()
{
  string n;
  cin >> n;
  for (int i = 0; i < 3; i++)
  {
    if (n[i] == '7')
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <climits>

using namespace std;
typedef long long ll;
ll INF = LLONG_MAX/2;

ll closest(const vector<ll>& V, ll x) {
	auto it = lower_bound(V.begin(), V.end(), x);
	if(it == V.end()) {
		return *(it-1);
	} 

	if(it == V.begin()) {
		return *it;
	}
	auto it_ = it-1;
	if(*it-x < x-*it_) {
		return *it;
	}
	return *it_;
}

ll TS_up(const vector<ll>& S, const vector<ll>& T, ll x) {
	auto it = lower_bound(T.begin(), T.end(), x);
	if(it == T.end()) { return INF;}
	return (*it-x) + abs(*it-closest(S, *it));
}

ll TS_down(const vector<ll>& S, const vector<ll>& T, ll x) {
	auto it = lower_bound(T.begin(), T.end(), x);
	if(it == T.begin()) { return INF; }
	it--;
	return (x - *it) + abs(*it-closest(S, *it));
}


ll ST_up(const vector<ll>& S, const vector<ll>& T, ll x) {
	auto it = lower_bound(S.begin(), S.end(), x);
	if(it == S.end()) { return INF;}
	return (*it-x) + abs(*it-closest(T, *it));
}

ll ST_down(const vector<ll>& S, const vector<ll>& T, ll x) {
	auto it = lower_bound(S.begin(), S.end(), x);
	if(it == S.begin()) { return INF; }
	it--;
	return (x - *it) + abs(*it-closest(T, *it));
}

int main() {
	std::ios::sync_with_stdio(false);

	int A,B, Q;
	cin >> A >> B >> Q;
	vector<ll> S;
	for(int i = 0; i < A; i++) {
		ll x;
		cin >> x;
		S.push_back(x);
	} sort(S.begin(), S.end());

	vector<ll> T;
	for(int i = 0; i < B; i++) {
		ll x;
		cin >> x;
		T.push_back(x);
	} sort(T.begin(), T.end());

	for(int i = 0; i < Q; i++) {
		ll x;
		cin >> x;
		cout << min(TS_up(S, T, x),
				min(TS_down(S,T,x),
				min(ST_up(S,T,x),
					ST_down(S,T,x)))) << endl;
	}

	
}


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

const int mod = 1e9 + 7;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
#define ll long long
#define vi vector < int >
#define si set <int>
#define mii map <int, int>
#define vll vector < ll >
#define pii pair < int , int >
#define ff first
#define tc \
    int ttt; cin >> ttt;\
    while(ttt --)
#define ss second
#define f(i,a,b) for(int i=a;i<b;i++)
#define rev(i,a,b) for(int i=a;i>=b;i--)
#define nl '\n'
#define all(x) x.begin() , x.end()
#define mne min_element
#define mxe max_element
ll gcd(ll x, ll y) {return y == 0 ? x : gcd(y, x % y);}
int logg(ll x , ll y) {if (x == 0) return -1; return logg(x / y, y) + 1;}
ll poww(ll a, ll b, ll m) {
	if (b == 0) return 1;
	ll ans = 1;
	ans = poww(a, b >> 1, m);
	ans = (ans * ans) % m;
	if (b & 1) ans = (ans * a) % m;
	return ans;
}
// Start of code
int n, m;
const int N = 1e5 + 5;
vector<int> v[N];
int dp[N];

int solve(int x) {

	if (dp[x] != -1) return dp[x];

	int best = 0;

	for (auto i : v[x]) {
		best = max(best, solve(i));
	}
	return dp[x] = 1 + best;
}

int32_t main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast;
	memset(dp , -1, sizeof dp);
	int x, y;
	cin >> n >> m;
	while (m--) {
		cin >> x >> y;
		v[x].push_back(y);
	}
	int ans = 0;
	f(i, 1, n + 1) ans = max(ans, solve(i));
	cout << ans - 1 << nl;
}


Measured memory_bytes: 11944
import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int l = Integer.parseInt(sc.next());
		
		
		long[][] a = new long[n][m];
		long[][] b = new long[m][l];
		long[][] answer = new long [n][l];
		
			
		for(int i = 0;i<n;i++){
			
			for(int j= 0;j<m;j++){
				
				a[i][j] = Long.parseLong(sc.next());
				
			}
		}
		
		for(int i =0;i<m;i++){
			
			for(int j =0;j<l;j++){
				
				b[i][j] = Long.parseLong(sc.next());
			}
		}
		
		
		for(int i = 0; i<n;i++){
			
			for(int j=0; j<m;j++){
				
				for(int k = 0; k<l;k++){
					
					answer[i][k] += a[i][j] * b[j][k];
					
				}
				
			}
		}
		
		for(int i = 0; i<n;i++){
			
			for(int j =0;j<l;j++){
				
				System.out.print(answer[i][j]);
				if(j ==l-1){
					System.out.print("\n");
				}else{
					System.out.print(" ");
				}
			}
			
			
		}
		
		sc.close();
	}
	

}



Measured memory_bytes: 46912
import std.stdio, std.string, std.conv, std.algorithm, std.range, std.array, std.typecons;

void main() {
    auto s = readln.strip;
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
        writeln("Bad");
    } else {
        writeln("Good");
    }
}


Measured memory_bytes: 256
import sys
N=int(sys.stdin.readline().strip())
C=sys.stdin.readline().strip()
L=[0]
R=[0]
for c in C:
    if c=="W":
        L.append(L[-1]+1)
    else:
        L.append(L[-1])

for c in C[::-1]:
    if c=="R":
        R.append(R[-1]+1)
    else:
        R.append(R[-1])
R=R[::-1]

ans=float("inf")
for i in range(N+1):
    ans=min(ans,max(L[i],R[i]))
print ans

Measured memory_bytes: 100352
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;

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

  vl B(N);
  rep(i, N) B[i] = A[i] - (i + 1);

  stable_sort(B.begin(), B.end());

  if(N % 2 == 1){
    ll ans = 0;
    ll b = B[N / 2];

    rep(i, N) ans += abs(B[i] - b);

    cout << ans << "\n";
  } else{
    if((B[N / 2 - 1] + B[N / 2]) % 2 == 0){
      ll b = (B[N / 2 - 1] + B[N / 2]) / 2;
      ll ans = 0;

      rep(i, N) ans += abs(B[i] - b);

      cout << ans << "\n";
    } else{
      ll b1 = B[N / 2 - 1], b2 = B[N / 2];
      ll ans1 = 0, ans2 = 0;

      rep(i, N){
        ans1 += abs(B[i] - b1);
        ans2 += abs(B[i] - b2);
      }

      cout << min(ans1, ans2) << "\n";
    }
  }
  
  return 0;
}


Measured memory_bytes: 4096
import math

a, b = map(int, input().split())

x = []
for i in range(int(a / 0.08), int((a + 1) / 0.08)):
    if math.floor(i * 0.08)  == a:
        x.append(i)

for i in range(len(x)):
    if x[i] // 10 == b:
        print(x[i])
        break

if i == len(x) - 1:
    print(-1)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    int n;
    bool judgment = false;
    
    cin >> n;
    
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            if(i * j == n){
                judgment = true;
            }
        }
    }
    
    if(judgment){
        cout << "Yes" << "\n" << endl;
    } else {
        cout << "No" << "\n" << endl;        
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#include <numeric>
#include <functional>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define sz(x) ((int)(x).size())
#define pii pair<int, int>
#define trav(a,x) for (auto& a : x)
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using namespace std;
const ll mod = 998244353;
const int N = 2e5 + 5;



void solve()
{
    bool a; cin >> a;
    cout << !a;
}


int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); //cout.tie(NULL);
    /*int tc; cin >> tc;
    while (tc--)*/
        solve();

    return 0;
}


Measured memory_bytes: 3196
n,y = map(int, input().split())

exist = False

for i in range(int(y/10000)+1):
    range_j = int((y - 10000*i)/5000)
    for j in range(range_j+1):
        k = n - i - j
        res = y - 10000*i - 5000*j
        if res == 1000*k:
            print("{} {} {}".format(i,j,n-i-j))
            print("\n")
            exist = True
        if exist:
            break
    if exist:
        break

if not exist:
    print("-1 -1 -1")
    print("\n")


Measured memory_bytes: 9064
h,w = map(int,input().split())
S = [list(input()) for i in range(h)]
#list(input())で1文字ずついじれるようにする

dx = [-1,0,1]
dy = [-1,0,1]
# dx,dyの組み合わせで8方向抑えられる

for i in range(h):
    for j in range(w):
        if S[i][j] == '#':
            continue

        count = 0
        for x in dx:
            for y in dy:
                if not 0<=i+y<h or not 0<=j+x<w:
                    continue
                #枠内のものだけ処理する
                if S[i+y][j+x] == '#':
                    count += 1
        S[i][j] = str(count)

for s in S:
    print("".join(s))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}
struct UnionFind {
    VI d;
    UnionFind(int n = 0): d(n,-1) {}
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x,int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};
int deg[100005];
VI to[100005];

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

mint f(int n) {
    if(n == 0) return 1;
    mint x = f(n/2);
    x *= x;
    if(n%2 == 1) x *= 2;
    return x;
}

mint choose(int n,int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}
// pi = M_PI

int main() {
    int r;
    cin >> r;
    printf("%.15f",2*M_PI*r);
}


Measured memory_bytes: 6128
#include <bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using namespace atcoder;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
  
    int N,Q; cin >> N >> Q;
    fenwick_tree<ll> bit(N);
    rep(i,N) {
        ll a; cin >> a;
        bit.add(i,a);
    }
    rep(i,Q) {
        int a,b,c; cin >> a >> b >> c;
        if (a == 0) bit.add(b,c);
        else cout << bit.sum(b,c) << '\n';
    }
    return 0;
}

Measured memory_bytes: 8256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    cout << a-b+1 << endl;
}


Measured memory_bytes: 3588
#include<stdio.h>
#include<limits.h>

int main(){
  int n;
  int i;
  long max = LONG_MIN;
  long min = LONG_MAX;
  long sum = 0;
  int num;

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&num);
    if(num < min){
      min = num;
    }
    if(num > max){
      max = num;
    }
    sum += num;
  }
  printf("%ld %ld %ld\n",min,max,sum);
  return 0;
}


Measured memory_bytes: 2048
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, n) for (size_t i = 0; i < (n); i++)
#define REP(n) FOR(i, n)
#define cinv(v, n) REP(n) {cin>>(v)[i];}
#define nvec(T, v, n) vector<T> v(n); cinv(v, n)
#define npairs(T1, T2, v, n) vector<pair<T1, T2>> v(n); REP(n){cin>>v[i].first>>v[i].second;}
#define ntuples(T1, T2, T3, v, n) vector<tuple<T1, T2, T3>> v(n); REP(n){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}

#define min_index(v) size_t( min_element(all(v)) - (v).begin() )
#define max_index(v) size_t( max_element(all(v)) - (v).begin() )
#define min_e(v) *min_element(ALL(v))
#define max_e(v) *max_element(ALL(v))

#define count_le(v, a) size_t( upper_bound(ALL(v), a) - (v).begin() )
#define count_lt(v, a) size_t( lower_bound(ALL(v), a) - (v).begin() )
#define count_ge(v, a) size_t( (v).end() - lower_bound(ALL(v), a) )
#define count_gt(v, a) size_t( (v).end() - upper_bound(ALL(v), a) )

#define order(neq_sl) [](const auto s, const auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(ALL(v), 0l)
#define SORT(v) sort(ALL(v))

#define GCD(v) gcd(ALL(v), 0l)

template <typename T>
T gcd(T a, T b) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    return gcd(b%a, a);
}
template <typename InputItr, typename T>
T gcd(InputItr first, InputItr last, T init) {
    for (; first != last; ++first) init = gcd(init, *first);
    return init;
}


int main(){
  int k,s;
  cin>>k>>s;
  long co=0;
  for (int i = 0; i <= s && i <= k; i++) {
    for (int j = 0; j <= s-i && j <= k; j++) {
      if(s-i-j<=k)co++;
    }
  }
  cout<<co;
}


Measured memory_bytes: 256
L=list(map(int,input().split()))
L=sorted(L)
if (L[-1]-L[0])%2==(L[-1]-L[1])%2:
	print(((L[-1]-L[0])+(L[-1]-L[1]))//2)
else:
	print(((L[-1]-L[0])+(L[-1]-L[1]))//2+2)

Measured memory_bytes: 3064
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scanf("%d %d", &N, &K)
	H := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &H[i])
	}
	if K >= N {
		fmt.Println(0)
		return
	}

	sort.Ints(H)
	sum := 0
	for i := 0; i < N; i++ {
		if i >= N-K {
			continue
		}
		sum += H[i]
	}
	fmt.Println(sum)
}


Measured memory_bytes: 6016
#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; }

#define MOD 1000000007

signed main(){
	int n;
	cin >> n;
	int ans = 1;
	for(int i = 2;i <= n;i++){
		ans *= i;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC074 D-Restoring Road Network
// 2020.06.08
// ワーシャルフロイド法で全点間の距離を求める

const ll INF = (1LL<<32);
vector<vector<ll> > d;  // グラフの距離を格納した2次元配列（隣接行列）
// d[u][v]は辺e=(u,v)のコスト（辺が存在しない場合はINF、ただしd[i][i]=0）

void warshall_floyd(int n){  // nは頂点数
  for(int i = 0; i < n; i++){  // 経由する頂点
    for(int j = 0; j < n; j++){  // 開始頂点
      if(d[j][i] == INF) continue;
      for(int k = 0; k < n; k++){  // 終端
        if(d[i][k] == INF) continue;
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
      }
    }
  }
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  d.assign(N, vector<ll>(N, INF));
  REP(i, N){
    REP(j, N){
      cin >> d[i][j];
    }
  }
  vector<vector<ll> > A = d;
  warshall_floyd(N);
  bool flag1 = true;
  ll ans = 0;
  REP(i, N){
      for(int j = i+1; j < N; j++){
      if(A[i][j] > d[i][j]){
        flag1 = false;
      }else{
        bool flag2 = true;
        REP(k, N){
          if(i == k || j == k) continue;
          if(d[i][k] + d[k][j] == d[i][j]){
            flag2 = false;
            break;
          }
        }
        if(flag2) ans += d[i][j];
      }
      if(!flag1){
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>

#define MOD 998244353

int main()
{
	long dp0[300*300+1]={}, dp1[300*300+1]={};
	long sub0[300*300+1]={}, sub1[300*300+1]={};

	long N;
	std::vector<int> A;
	std::cin >> N;
	A.resize(N);
	for (auto& a : A) {
		std::cin >> a;
	}
	long sum = 0;
	for (auto a : A) {
		sum += a;
	}

	dp0[0] = 1;
	sub0[0] = 1;

	long* prevdp = dp0;
	long* dp = dp1;
	long* prevsub = sub0;
	long* sub = sub1;

	for (auto a : A) {
		for (int i = 0; i < a; ++i) {
			dp[i] = prevdp[i]*2 % MOD;
			sub[i] = prevsub[i];
		}
		for (int i = a; i <= 300*300; ++i) {
			dp[i] = (prevdp[i-a] + prevdp[i]*2) % MOD;
			sub[i] = (prevsub[i-a] + prevsub[i]) % MOD;
		}
		std::swap(dp, prevdp);
		std::swap(sub, prevsub);
	}

	long ret = 1;
	for (long i = 0; i < N ; ++i)
		ret = (ret * 3) % MOD;

	for (long i = (sum+1)/2; i <= 300*300; ++i) {
		ret = (ret + (MOD - prevdp[i])*3) % MOD;
	}
	if (sum%2 == 0) {
		ret = (ret + prevsub[sum/2]*3) % MOD;
	}
	std::cout << ret << "\n";
}


Measured memory_bytes: 3072
N, M = [int(x) for x in input().split()]

cond = [None for _ in range(N + 1)]
ok = True
for i in range(M):
    s, c = [int(x) for x in input().split()]
    if cond[s] == None:
        cond[s] = c
    else:
        if cond[s] != c:
            ok = False
            break

if cond[1] == None:
    if N == 1:
        cond[1] = 0
    else:
        cond[1] = 1
else:
    if cond[1] == 0:
        if N != 1:
            ok = False

for i in range(2, N + 1):
    if cond[i] == None:
        cond[i] = 0

if ok == True:
    for i in range(1, N + 1):
        print(cond[i], end='')
    print('')
else:
    print(-1)

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

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

int h,n,temp,sum=0;
int main()
{
  

    cin>>h>>n;
    while(n--)
        cin>>temp,sum+=temp;
    if(sum>=h)
        cout<<"Yes";
    else
        cout<<"No";
}




Measured memory_bytes: 256