akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

void func(){
    int n=in();
    ll ans=0;
    vector<priority_queue<pii>> que(2);
    rep(i,n){
        int k=in()-1,l=in(),r=in();
        if(l > r){
            ans += r;
            l -= r;
            que[0].push(mp(-k,l));
        }else{
            ans += l;
            r -= l;
            que[1].push(mp(-(n-k-2),r));
        }
    }
    rep(x,2){
        rep(i,n){
            while(!que[x].empty() && -que[x].top().first < i){
              //  cout<<"##"<<i<<" "<<-que[x].top().first<<" "<<que[x].top().second<<endl;
                que[x].pop();
            }
            if(!que[x].empty()){
                ans += que[x].top().second;
               // cout<<i<<" "<<-que[x].top().first<<" "<<que[x].top().second<<endl;
                que[x].pop();
            }
        }
    }
    cout<<ans<<endl;
}

int main(){
    int N=in();
    for(int n=1;n<=N;n++){
        int ans=0;
        for(int a=2;a*a<n*2;a++){
            for(int b=a;b*b<n*2;b++){
                int x = sqrt(n*2 - a*a - b*b);
                if(x >= b && a + b > x && x*x + a*a + b*b == 2*n && (a+b+x)%2==0){
                    if(a==b){
                        if(b==x)ans++;
                        else ans+=3;
                    }
                    else if(b==x)ans += 3;
                    else ans += 6;
                }
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3660
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
now = 100000000000
for i in range(len(s)-2):
    chk = abs(753 - int(s[i:i+3]))
    if i == 0:
        now = chk
    elif chk < now:
        now = chk
print(now)

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

int main(void){
    int H, W, i,j;
    while(H != 0 || W != 0){
        cin >> H >> W;
        if(H != 0 || W != 0){
            for( i=0; i<H;i++){
                for(j=0 ; j<W;j++){
                    cout << "#";
                }
                cout << endl;
            }
          if(H != 0 || W != 0) cout << endl;
        }
    }
    
    
    return 0;
}


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

int main() {
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;

	vector<int> Nums;
	int now = 1; //今見ている数
	int cnt = 0; //nowがいくつ並んでいるか
	for (int i = 0; i < N; i++)
	{
		if (S[i] == (char)('0' + now)) cnt++;
		else {
			Nums.push_back(cnt);
			now = 1 - now; //0と1を切り替える時の計算 now ^= 1;
			cnt = 1; //新しいのをカウントし始める
		}
	}
	if (cnt != 0) Nums.push_back(cnt);

	//1-0-1-0-1-0-1って感じの配列が欲しい
	//1-0-1-0みたいに0で終わってたら、適当に１つ足す
	if (Nums.size() % 2 == 0) Nums.push_back(0);

	int Add = 2 * K + 1;

	int ans = 0;

	int left = 0;  
	int right = 0; 
	int tmp = 0;// [left, right) のsum

	//1-0-1...の1から始めるので、偶数番目だけ見る
	for (int i = 0; i < Nums.size(); i += 2)
	{
		int Nextleft = i;
		int Nextright = min(i + Add, (int)Nums.size());

		//左端を移動する
		while (Nextleft > left) {
			tmp -= Nums[left];
			left++;
		}
		//右端を移動する
		while (Nextright > right) {
			tmp += Nums[right];
			right++;
		}

		ans = max(tmp, ans);
	}

	cout << ans << endl;
}



Measured memory_bytes: 1020
N = int(input())
A = list(map(int, input().split()))
flag = [-1] * (N+1)
answer_list = []
for i in range(N):
    counter = 0
    i_num = N - i
    for j in range(i_num, N+1, i_num):
        if j == i_num:
            continue
        else:
            if flag[j] == 1:
                counter += 1
    if counter % 2 == A[i_num - 1]:
        flag[i_num] = 0
    else:
        flag[i_num] = 1
        answer_list.append(i_num)
print(len(answer_list))
if answer_list:
    print(" ".join(map(str, answer_list)))

Measured memory_bytes: 81384
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int n;
LL sum,a[100111];
int main()
{
	get1(n);
	for(int i=1;i<=n;i++)
	{
		get1(a[i]);
		sum+=a[i];
	}
	a[n+1]=a[1];
	if(sum%(1ll*n*(n+1)/2))
	{
		puts("NO");
		return 0;
	}
	sum/=1ll*n*(n+1)/2;
	for(int i=1;i<=n;i++)
	{
		LL dif=a[i]-a[i+1]+sum;
		if(dif<0||dif%n!=0)
		{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;

int main(void){
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  int sum=0;
  if(A>K) A = K;
  sum = sum+A;
  if(B>K-A) B = K-A;
  if(C>K-A-B) C = K-A-B;
  sum = sum-C;
  printf("%d\n",sum);
  return 0;
}

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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second

inline void _min(int &x, int y)
{
	x = min(x, y);
}

int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	string s;
	cin >> s;
	s = "0" + s;
	for (auto &i : s) i -= '0';
	int n = s.length();
	vector<vector<int>> dp(2, vector<int>(n+1, 1<<30));
	dp[0][n] = 0;
	for (int i = n-1; i >= 0; --i)
	{
		_min(dp[0][i], dp[0][i+1] + s[i]);
		_min(dp[0][i], dp[1][i+1] + s[i] + 1);
		_min(dp[1][i], dp[0][i+1] + 10 - s[i]);
		_min(dp[1][i], dp[1][i+1] + 9 - s[i]);
	}
	cout << dp[0][0] << "\n";

	return 0;
}


Measured memory_bytes: 13128
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
	int main(){
		int a,b;
		while(cin>>a>>b){
		int ans=a+b;int c=1;
		while(true){
			if(ans/10>=1){
				ans=ans/10;
				c++;
			}
			else if(ans/10==0)break;
		}
		//if(ans==0)cout<<0<<endl;
		 cout<<c<<endl;
		}
	return 0;
	}

Measured memory_bytes: 1160
from typing import NoReturn


def my_sum(start: int, end: int):
    if start < 0:
        return my_sum(1 - start, end)
    elif start > 1:
        return my_sum(1, end) - my_sum(1, start - 1)
    else:
        return end * (end + 1) // 2


def main() -> NoReturn:
    n, k = map(int, input().split())  # type: int, int

    p: int = 10 ** 9 + 7

    answer = 0

    for i in range(k, n + 2):
        min_val: int = my_sum(0, i - 1)
        max_val: int = my_sum(n - i + 1 , n)
        answer += max_val - min_val + 1

    print(answer % p)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10272
# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n,*a = [int(i) for i in read().split()]
#a = [int(i) for i in readline().split()]
#n = int(input())

n,a,b = [int(i) for i in read().split()]

MOD = 10**9+7
ans = pow(2,n,MOD)-1

def choose(n,r):
    res = 1
    fac = 1
    for i in range(r):
        res *= n-i
        res %= MOD
        fac *= i+1
        fac %= MOD
    return res*pow(fac,MOD-2,MOD)%MOD        


ans -= choose(n,a)
ans -= choose(n,b)

#print(choose(n,a),choose(n,b))

print(ans%MOD)






Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
x = [0 for i in range(62)]
for i in range(n):
    b = bin(a[i])
    for i in range(len(b)-2):
        if b[-1-i] == '1':
            x[-i-1] += 1
mod = 10**9+7
ans = 0
two = 1
for i in range(1,62):
    ans = (ans + x[-i]*(n-x[-i])*two)%mod
    two = two*2%mod
print(ans)


Measured memory_bytes: 122936
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    dp = [[0] * 3 for _ in range(n)]
    for i in range(n):
        a, b, c = list(map(int, input().rstrip('\n').split()))
        if i == 0:
            dp[i][0] = a
            dp[i][1] = b
            dp[i][2] = c
        else:
            dp[i][0] = max(dp[i-1][1] + a, dp[i-1][2] + a)
            dp[i][0] = max(dp[i-1][1] + a, dp[i-1][2] + a)

            dp[i][1] = max(dp[i-1][0] + b, dp[i-1][2] + b)
            dp[i][1] = max(dp[i-1][0] + b, dp[i-1][2] + b)

            dp[i][2] = max(dp[i-1][0] + c, dp[i-1][1] + c)
            dp[i][2] = max(dp[i-1][0] + c, dp[i-1][1] + c)
    print(max(dp[-1]))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 56428
N, L = [int(n) for n in input().split()]

total = (2*L + N - 1) * N / 2
app = [L + i -1 for i in range(1, N+1)]
app_ = [abs(n) for n in app]
idx = app_.index(min(app_))

print(int(total - app[idx]))

Measured memory_bytes: 9180
fun main(args: Array<String>){
    val input = readLine()!!.split(" ")
    val a :Int = input[0].toInt()
    val b :Int = input[1].toInt()
    val ab :Int = input[2].toInt()
    val x :Int = input[3].toInt()
    val y :Int = input[4].toInt()
    var sum :Int
    if(a+b <= 2*ab){
        sum = a*x + b*y
    }
    else{
        val few = if(x >= y) 2*ab*y + a*(x-y) else 2*ab*x + b*(y-x)
        val someabs = if(x >= y) 2*ab*x else 2*ab*y
        sum = if(few >= someabs) someabs else few
    }
    println(sum)
}

Measured memory_bytes: 36004
#include <cstdio>
long long n, s, a[100005], b[100005];
int main() {
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++) scanf("%d%d", &a[i], &b[i]);
	for(i=n-1; i>=0; i--) s += (b[i] - (a[i]+s)%b[i]) % b[i];
	printf("%lld", s);
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define AfterDecimal(n) cout << fixed << setprecision(n);
#define ll long long int
#define ld long double
#define all(a) a.begin(), a.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)

using namespace __gnu_pbds;
using namespace std;

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

//template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

#ifdef LOCAL
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << "# "<< name << " = " << arg1 << '\n';
}
template<typename Arg1, typename... Args>
void __f(const char* names, Arg1 && arg1, Args &&... args){
        const char* comma = strchr(names + 1 ,',');
        cout << "# ";
        cout.write(names, comma - names)<< " = " << arg1 << " | ";
        __f(comma + 1, args...);
}
#else
#define debug(...) 36
#endif


std::mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int ri(int a, int b) {
    return uniform_int_distribution<int>(a, b)(rng);
}

ll power(ll x, ll y, ll p){
   ll res = 1;
   x = x % p;
   while (y > 0) {
      if (y & 1)
         res = (res * x) % p;
      y = y >> 1;
      x = (x * x) % p;
   }
   return res;
}

const ll INF = (ll)(8e18);
const ll MOD = (ll)(1e9 + 7);
const ll HMOD = (ll)4222234727;
const ll Hashprime = (ll)31;

const int maxn = 100100;

int32_t main(){
    IOS;
    #ifndef ONLINE_JUDGE
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
    int t = 1; // cin >> t;
    while(t--){
       string s; cin >> s;
       cout << s.substr(0, 3) << '\n';
    }
    #ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}
//g++ -DLOCAL -std=c++17 -Wshadow -Wall -o "c" "comp.cpp" -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g


Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef unsigned long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

inline int toInt(char c){
  if(isdigit(c)) return c - '0';
  return c - 'A' + 10;
}

ll decode(char *num, int base){
  ll ret = 0;
  while(*num){
    ret *= base;
    ret += toInt(*num++);
  }
  return ret;
}

int main(){
  int base;
  char num[32];

  while(scanf("%d%s",&base,num),base){
    ll dec = decode(num, base);
    ll ans = (1ll)<<63;

    for(int d = 2; ; d++){
      if(base % d == 0){
        int cnt = 0;
        while(base % d == 0){
          base /= d;
          cnt++;
        }

        ll tmp = dec;
        ll a = 0;
        while(tmp){
          tmp /= d;
          a += tmp;
        }
        ans = min(ans, a/cnt);
        //printf("dec:%llu d:%d cnt:%d base:%d a:%llu\n",dec,d,cnt,base,a);
      }

      if(base == 1) break;
    }

    printf("%llu\n",ans);
  }

  return 0;
}

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

bool isPrime(const ll &n){
    if(n == 2) return true;
    if(n < 2 || n%2 == 0) return false;
    const ll m = n-1, d = m / (m & -m);
    auto modpow = [&](ll a, ll b){
        ll res = 1;
        while(b){
            if(b&1) res = res*a%n;
            a = a*a%n;
            b >>= 1;
        }
        return res;
    };
    auto suspect = [&](ll a, int t){
        a = modpow(a,t);
        while(t != n-1 && a != 1 && a != n-1){
            a = a*a%n;
            t *= 2;
        }
        return a == n-1 || t%2 == 1;
    };
    const int witness[] = {2,3,5,61,0}; // 要検証
    for(const int *w = witness; *w < n && *w; w++){
        if(!suspect(*w,d)) return false;
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n){
        ll x;
        cin >> x;
        ans += isPrime(x);
    }
    cout << ans << endl;
}

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

int main() {
  string s, t;
  cin>>s>>t;
  for (int i=0; i<s.length(); i++) {
    if (s[i] != t[i]) {
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 3628
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()

a = LIST()

a = sorted(a)[::-1]

ans = a[0]

a = a[1:]
i = 0
while(n-2>0):
    ans+=a[i]
    n-=1
    if(n-2==0):
        break
    ans+=a[i]
    i+=1
    n-=1
print(ans)


Measured memory_bytes: 99588
//这题完美地诠释了什么是笑里藏刀
//我一开始把M设成0
#include <bits/stdc++.h>
using namespace std;
char s[2050][2050];
int p[2050][2050];
int r[2050][2050];
int u[2050], d[2050];
int h, w;
int main(){
	memset(p, 0, sizeof(p));
	scanf("%d%d", &h, &w);
	for(int i=1;i<=h;i++){
		scanf("%s", s[i]+1);
	}
	for(int i=1;i<h;i++){
		for(int j=1;j<w;j++){
			int cnt=0;
			cnt+=(s[i][j]=='.');
			cnt+=(s[i+1][j]=='.');
			cnt+=(s[i][j+1]=='.');
			cnt+=(s[i+1][j+1]=='.');
			if(cnt%2==0)p[i][j]=1;
		}
	}
	for(int i=1;i<h;i++){
		for(int j=w-1;j>=1;j--){
			if(p[i][j]){
				r[i][j]=r[i][j+1]+1;
			}
			else r[i][j]=0;
		}
	}
	int M=max(h, w);
	for(int j=1;j<w;j++){
		for(int i=1;i<h;i++){
			int id=i-1;
			while(id&&r[id][j]>=r[i][j])id=u[id];
			u[i]=id;
		}
		for(int i=h-1;i>=1;i--){
			int id=i+1;
			while(id<h&&r[id][j]>=r[i][j])id=d[id];
			d[i]=id;
		}
		for(int i=1;i<h;i++){
			M=max(M, (d[i]-u[i])*(r[i][j]+1));
		}
	}
	printf("%d\n", M);
}



Measured memory_bytes: 37120
noOfWords= int(input())
words = []
satisfactor = True
for i in range(noOfWords):
    word = input()
    words.append(word)

if len(set(words)) < len(words):
    print("No")    
    satisfactor = False 
else:
    for i in range(len(words)-1):
        if words[i][len(words[i])-1] ==  words[i+1][0]:
            continue
        else:
            satisfactor = False
            print("No")
            break
if satisfactor :
    print("Yes")            



Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
from collections import Counter



def main():
    S = input().strip()
    T = input().strip()

    c1 = Counter()
    c2 = Counter()

    for i in range(len(S)):
        c1[S[i] + T[i]] += 1
        c2[T[i] + S[i]] += 1

    for i in list("abcdefghijklmnopqrstuvwxyz"):
        count1 = 0
        count2 = 0
        for j in list("abcdefghijklmnopqrstuvwxyz"):
            if c1[i + j] > 0:
                count1 += 1
            if c2[i + j] > 0:
                count2 += 1
        if count1 > 1 or count2 > 1:
            print("No")
            break
    else:
        print("Yes")




if __name__ == '__main__':
    main()



Measured memory_bytes: 4144
#include <stdio.h>

int main(void){

	int max;
	int i;
	int x;

	scanf("%d", &max);
	
	for(i=1;i<=max;i++){
		if(i%3==0){
			printf(" %d",i);
		}else{
			for(x=i;x>0;x/=10){
				if(x%10==3){
					printf(" %d",i);
					break;
				}
			}
		}
	}
	
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 2724
#include<iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int a[2][N];
    for(int i=0;i<N;i++){
        cin >> a[0][i];
    }
    for(int i=0;i<N;i++){
        cin >> a[1][i];
    }

    int max,sum=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<=i;j++){
            sum = sum + a[0][j];
        }
        for(int k=i;k<N;k++){
            sum = sum +a[1][k];
        }
    if(max<sum) max = sum;
    sum = 0;
    }
    cout << max << endl;
}

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

bool check(int x, int y){
	if(x < y)
		return true;
	else
		return false;
}
int main()
{
	int n;
	cin >> n;
	int a[85];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	ll num, money = 1000;
	for(int i = 0; i < n - 1; i++){
		if(check(a[i], a[i + 1])){
			num = money / a[i];
			money = money + num * (a[i + 1] - a[i]);
		}
	}
	cout << money << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lp pair<long, long>

const ll inf = (ll)1 << 40;
ll A, B, Q;
ll bu1[100010], bu2[100010];
ll res1[100010], res2[100010];
int binary_search(int lb, int ub, ll x, ll* bu){
    if(ub - lb == 1) return ub;
    
    int mid = (ub + lb) / 2;
    
    if(bu[mid] < x) lb = mid;
    else ub = mid;

    return binary_search(lb, ub, x, bu);
}

ll solve(ll x){
    int ub1 = binary_search(0, A, x, bu1);
    int ub2 = binary_search(0, B, x, bu2);
    ll dist1 = min(abs(bu1[ub1] - x) + res1[ub1], abs(bu1[ub1 - 1] - x) + res1[ub1 - 1]);
    ll dist2 = min(abs(bu2[ub2] - x) + res2[ub2], abs(bu2[ub2 - 1] - x) + res2[ub2 - 1]);
    return min(dist1, dist2);
}

void culc(ll* dat1, ll* dat2, ll* res, int s1, int s2){
    for(int i = 1; i <= s1; i++){
        int ub = binary_search(0, s2, dat1[i], dat2);
        res[i] = min(abs(dat1[i] - dat2[ub]), abs(dat1[i] - dat2[ub - 1]));
    }
}

int main(){
    cin >> A >> B >> Q;
    
    bu1[0] = bu1[A + 1] = inf; 
    bu2[0] = bu2[B + 1] = inf;
    res1[0] = res1[A + 1] = inf;  
    res2[0] = res2[B + 1] = inf;  
    
    for(int i = 1; i <= A; i++){
        cin >> bu1[i];
    }
    for(int i = 1; i <= B; i++){
        cin >> bu2[i];
    }

    culc(bu1, bu2, res1, A, B);
    culc(bu2, bu1, res2, B, A);

    for(int i = 0; i < Q; i++){
        ll x;
        cin >> x;
        cout << solve(x) << endl;
    }
    return 0;
}

Measured memory_bytes: 4480
<?php
fscanf(STDIN, "%d %d", $L, $R);
$diff = $R - $L;
while($diff > 2019 * 2) {
    $diff -= 2019;
}
$L %= 2019;
$R = $L + $diff;
// echo $L, " ", $R, PHP_EOL;
$ans = PHP_INT_MAX;
for ($i = $L; $i <= $R; $i++) {
    for ($j = $i + 1; $j <= $R; $j++) {
        // echo ($i * $j) % 2019 . PHP_EOL;
        $ans = min($ans, ($i * $j) % 2019);
    }
}
echo $ans;


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

using namespace std;
using ll = long long;
const int F = 26;
const int def = 1e6;


int n;
vector<int> c(F);
vector<vector<int>> a;


void init() {
    cin >> n;
    a.resize(n, vector<int>(F));
    for(int i = 0; i < F; i++)cin >> c[i];
    for(int i = 0; i < n; i++)for(int j = 0; j < F; j++)cin >> a[i][j];
}


vector<int> calc(int rng) {
    vector<int> last(F, -1);
    vector<int> ans;
    for(int i = 0; i < n; i++){ 
        vector<int> cur = a[i];
        for(int j = 0; j < F; j++)cur[j] += ((i - last[j]) * (c[j] + rng) * (rand() % 10 + 1)) / 3;
        int ind =  max_element(cur.begin(), cur.end()) - cur.begin();
        last[ind] = i;
        ans.emplace_back(ind);
    }
    return ans;
}

int chack(vector<int> p) {
    int sum = 0;
    vector<int> last(F, -1);
    for(int i = 0; i < n; i++) {
        sum += a[i][p[i]];
        last[p[i]] = i;
        for(int j = 0; j < F; j++)sum -= (i - last[j]) * c[j];
    }
    return sum;
}


int main()
{
    srand((unsigned)time(NULL));   
    init();


    vector<int> ans;
    int M = 1.5 * 1e4, nax = -1e9;
    for(int I = 1; I <= M; I++) {
        int sed = rand() % (rand() % ((I/50) + 1) + 1) * ((rand() % 2)? 1 : -1);
        vector<int> cur = calc(sed);
        int k = chack(cur);
        if(k > nax) {
            nax = k;
            ans = cur;
        }
    }

    for(auto i : ans)cout << i + 1 << endl;
}

/*
satisfaction: 424801
score: 1424801
*/


Measured memory_bytes: 3688
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!

        Scanner sc = new Scanner (System.in);
        
        int a = sc.nextInt();
     double b = Math.pow(a, 2);
     double c = Math.pow(a, 3);
    
        System.out.println((int)a+(int)b+(int)c);
    
    
    }
}


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

#define MOD 1000000007

int main() {
	long long n,k;
	cin>>n>>k;
	long long ans = 0;
	for(int i = k; i <= n+1; i++) {
		long long temp = i * (n-i+1) + 1;
		temp %= MOD;
		ans = ans + temp;
		ans %= MOD;
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
using namespace std;
typedef long long ll;
ll a[200005];
int main(void)
{
	ll n;
	ll sum=1;
	scanf("%lld",&n);
	for(ll i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
		if(a[i]==0)
		{
			printf("0");
			return 0;
		}
	}
	ll inf=(ll)(1e18);
	for(ll i=0;i<n;i++)
	{
		if((inf/sum)<a[i])
		{
			printf("-1");
			return 0;
		
		}sum=sum*a[i];
	}
	printf("%lld\n",sum);
}

Measured memory_bytes: 4608
nk = gets.chomp.split
n = nk[0].to_i
k = nk[1].to_i

p_a = gets.chomp.split
n.times do |i|
    p_a[i] = p_a[i].to_i
end

p_a.sort!

sum = 0
k.times do |i|
    sum += p_a[i]
end

puts sum


Measured memory_bytes: 14272
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main(){
    long long m,k;
    cin>>m>>k;
    long long com=m+1;
    long long ans=0;



    long long const1=modpow(100,100,MOD);
    long long temp1=0;
    long long temp2=0;

    for(long long i=m-k+1;i<=m;i++){
        temp1+=i;
    }
    for(long long i=0;i<k;i++){
        temp2+=i;
    }
    ans=(temp1-temp2+1);
    for(long long i=k;i<=m;i++){
        temp1+=(m-i);
        temp2+=(i);
        ans=(ans+temp1-temp2+1+MOD)%MOD;
    }
    if(k>=m+1){
        cout<<1<<endl;
    }
    else{
        cout<<ans<<endl;
    }
    return 0;
}

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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;

int a,b,c,d,e;
vector<int> v(5,0);

int main(){
  for(int i=0;i<5;i++) cin >> v[i];
  int last_index=0;
  for(int i=0; i<5;i++){
    if(v[last_index]%10 > v[i]%10 && v[i]%10 != 0)last_index = i;
  }
  int ans=0;
  for(int i=0;i<5;i++){
    int tmp;
    if(v[i]%10==0 || i== last_index)tmp = v[i];
    else tmp = ((int) (v[i]/10)+1)*10;
    ans += tmp;
  }
  cout << ans<< endl;
}

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

using namespace std;

const int INF=100000008;

typedef vector<vector<int> > Matrix;
Matrix graph;


int main()
{
	int n,m;
	cin >> n >> m;

	graph=Matrix(n,vector<int>(n,INF));

	for(int i=0;i<n;i++)
		graph[i][i]=0;
	for(int i=0;i<m;i++)
	{
		int a,b,c;
		cin >> a >> b >> c;
		graph[a-1][b-1]=c;
		graph[b-1][a-1]=c;
	}

	Matrix constGraph=graph;

	for(int k=0;k<n;k++)
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				graph[i][j]=min(graph[i][j],graph[i][k]+graph[k][j]);
	
	int count=0;

	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(graph[i][j]<constGraph[i][j] and constGraph[i][j]!=INF)
			{
				count++;
			}
	cout << count/2 << endl;
}




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

using namespace std;

bool ischeck[1000001];

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

	int n,t;
	vector <long long int> v;

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t);
	}

	sort(v.begin(),v.end());

	memset(ischeck,false,sizeof(ischeck));
	
	long long int res = 0;
	deque <int> deq;
	
	deq.push_back(v[0]);
	ischeck[0] = true;

	int l = 1;
	int r = n-1;
	bool flag = true;
	while(1)
	{
		if(flag)
		{
			if(ischeck[r]==true)
			{
				break;
			}
			ischeck[r] = true;
			deq.push_back(v[r]);
			r--;
			if(ischeck[r]==true)
			{
				break;
			}
			ischeck[r] = true;
			deq.push_front(v[r]);
			r--;
			flag = false;
		}
		else
		{
			if(ischeck[l]==true)
			{
				break;
			}
			ischeck[l] = true;
			deq.push_back(v[l]);
			l++;
			if(ischeck[l]==true)
			{
				break;
			}
			ischeck[l] = true;
			deq.push_front(v[l]);
			l++;
			flag = true;
		}
	}
	for (deque<int>::size_type i = 1; i < deq.size(); ++i)
	{
		//cout << deq[i] << ' ' << deq[i-1] << '\n';
        res += abs(deq[i-1] - deq[i]);
    }
    deq.clear();
    memset(ischeck,false,sizeof(ischeck));

	deq.push_back(v[n-1]);
	ischeck[n-1] = true;

	l = 0;
	r = n-2;
	flag = false;
	while(1)
	{
		if(flag)
		{
			if(ischeck[r]==true)
			{
				break;
			}
			ischeck[r] = true;
			deq.push_back(v[r]);
			r--;
			if(ischeck[r]==true)
			{
				break;
			}
			ischeck[r] = true;
			deq.push_front(v[r]);
			r--;
			flag = false;
		}
		else
		{
			if(ischeck[l]==true)
			{
				break;
			}
			ischeck[l] = true;
			deq.push_back(v[l]);
			l++;
			if(ischeck[l]==true)
			{
				break;
			}
			ischeck[l] = true;
			deq.push_front(v[l]);
			l++;
			flag = true;
		}		
	}

	/*
	for (deque<int>::size_type i = 0; i < deq.size(); ++i)
	{
		cout << deq[i] << '\n';
    }
    */
 	
	long long int res2 = 0;
	for (deque<int>::size_type i = 1; i < deq.size(); ++i)
	{
		//cout << deq[i] << ' ' << deq[i-1] << '\n';
        res2 += abs(deq[i-1] - deq[i]);
    }

   // cout << res << ' ' << res2 << '\n';
    res = max(res,res2);

    cout << res << '\n';

	return 0;
}


Measured memory_bytes: 5340
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==1)a=14;
  if(b==1)b=14;
  if(a==b)puts("Draw");
  else if(a<b)puts("Bob");
  else puts("Alice");
  
  return 0;
}


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

int main() {
  string s;
  cin >>s;
  int q;
  cin >>q;
  
  int t, f;
  string c;
  
  string ans;
  string fw, ba;
  bool re=false;
  
  for (int i=0; i<q; i++){
    cin >>t;
    if(t==2){
      cin >>f >>c;
      if (f==1){
        if(re){
          ba += c;
        }else{
          fw +=c;
        }
      }
      if (f==2){
        if(re){
          fw += c;
        }else{
          ba += c;
        }
      }
    }else{
      if(re) re=false;
      else re =true;
    }
  }
  
  if(re) {
    reverse(s.begin(),s.end());
    reverse(ba.begin(),ba.end());
    ans=ba+s+fw;
  }else{
    reverse(fw.begin(),fw.end());
    ans =fw+s+ba;
  }
  
  cout <<ans <<endl;
  
}


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

inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
#define N 200005
int a[N],t[N];
int n,k;
void solve()
{
	memset(t,0,sizeof(t));
	for(int i=1;i<=n;i++)
	{
		t[max(1,i-a[i])]++,t[min(i+a[i]+1,n+1)]--;
	}
	for(int i=1;i<=n;i++) t[i]+=t[i-1];
	for(int i=1;i<=n;i++) a[i]=t[i];
}
bool val()
{
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=n) return 0;
	}
	return 1;
}
signed main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++) a[i]=read();
	while(k--)
	{
		solve();
		if(val()) break;
	}
	for(int i=1;i<=n;i++) printf("%d ",a[i]);
	return 0;
}




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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    if(c >= a+b+1){
        ans = b + a+b+1;
    }else{
        ans = b + c;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	num, _ := strconv.Atoi(s.Text())

	fmt.Println(num + num*num + num*num*num)

}


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

int main(){
    int N; cin >> N;
    vector<pair<int, int>> p(N);

    for(int i = 0; i < N; i++){
        int A; cin >> A;
        p[i] = make_pair(A, i + 1);
    }
    sort(p.begin(), p.end());

    for(int i = 0; i < N; i++){
        cout << p[i].second << endl;
    }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
//#pragma GCC optimize(3)
using namespace std;
string a;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>a;
	cout<<a[0]<<a.size()-2<<a[a.size()-1]<<endl;
	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws Exception {
		FastScanner scanner = new FastScanner(System.in);
		int size = (int) scanner.nextInt();
		long[] numsArr = scanner.nextLongArray(size);
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < numsArr.length; i++) {
			int count = 0;
			while (numsArr[i]%2 == 0) {
				numsArr[i] = numsArr[i] /2;
				count ++;
			}
			if (count < min) {
				min = count;
			}
		}
		PrintWriter printWriter = new PrintWriter(System.out);
		printWriter.printf("%d\n", min);
		printWriter.close();
	}

	static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public String nextLine() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					return reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}

			return tokenizer.nextToken("\n");
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public long nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = (int) nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
	}
}


Measured memory_bytes: 21460
n, k = map(int, input().split())
x = list(map(int, input().split()))
k -= 1
ans = 10**9

for i in range(n - k):
    l = x[i]
    r = x[i + k]
    if l < 0:
        if r < 0:
            ref = -l
        else:
            ref = min(l*-2 + r, -l + r*2)
    else:
        ref = r
    ans = min(ans, ref)

print(ans)

Measured memory_bytes: 20008
//Shubham Vijayvargiya

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define F first
#define S second
#define sz(a) (int)(a.size())
#define set(a,b) memset(a,b,sizeof(a))
#define let(x,a) __typeof(a) x(a)
#define rep(i, begin, end) for (ll i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) (v).begin(),(v).end()
#define sll(x) { scanf("%lld",&x); }
#define si(x) { scanf("%d",&x); }
#define slf(x) { scanf("%lf",&x); }
#define pll(x) { printf("%lld\n",x); }
#define pi(x) { printf("%d\n",x); }
#define tcases() long long testcases; cin>>testcases ; while(testcases--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " = " << arg1<<" | ";__f(comma+1, args...);
}

#else
#define trace(...)
#endif

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<long long,long long> pll;
typedef vector<long long> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;

const ll mod=1000000007;
//----------------------------------------------------------------------------------------------------------------------------------------------//


int main(){
//	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	ll n,ans=1,cnt=1;
	cin>>n;
	rep(i,0,n){
		ll a;
		cin>>a;
		if(a%2==0)
			cnt*=2;
		ans=(ans*3);
	}
	cout<<ans-cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long const mod = 1000000007;
long long mod_fact(int x){
    static vector<long long> fact = {1, 1};
    if(x < 0)return 0; //
    if(x < fact.size())return fact[x];
    for(int i = fact.size(); i <= x; i++){
        fact.push_back((fact[i-1] * i) % mod);
    }
    return fact[x];
}

long long mod_pow(long long a, long long b){
    long long res = 1;
    a %= mod;
    while(b > 0){
        if(b%2 == 1) res = (res * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return res;
}

long long mod_inv(long long a){
    return mod_pow(a, mod-2);
}

long long mod_comb(int a, int b){
    if(b < 0 || a < b)return 0;
    if(b > a/2)return mod_comb(a, a-b);
    return (((mod_fact(a) * mod_inv(mod_fact(a-b))) % mod) * mod_inv(mod_fact(b))) % mod;
}
int main(void){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    sort(a.begin(), a.end());
    long long ans = 0;
    for(int i=0;i<=n-k;i++){
        long long res = (-a[i] + mod*2) * mod_comb(n-1-i, k-1) % mod;
        ans += res;
        ans %= mod;
    }
    for(int i=0;i<=n-k;i++){
        long long res = (a[n-1-i] + mod*2) * mod_comb(n-1-i, k-1) % mod;
        ans += res;
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1784
A, B, H, M = gets.split.map(&:to_i)

tansin = ((H * 60 + M)* 0.5) % 360
tyosin = M * 6 % 360

kakudo = [tansin, tyosin].max - [tansin, tyosin].min

kakudo = if kakudo > 180
           360 - kakudo
         else
           kakudo
         end

def radian(degree)
  degree * Math::PI / 180
end

def degree(radian)
  radian * 180 / Math::PI
end

puts Math.sqrt(A ** 2 + B ** 2 - (2 * A * B * Math.cos(radian(kakudo))))


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

using namespace std;
#define ll long long int
//ll s,n,a[100005];

int main()
{
    ll n,x;
    cin>>n>>x;
    ll a[n];ll res=0;
    for(ll i=0;i<n;i++)
    {
    cin>>a[i];
    if(a[i]>=x)
    res++;
    }
    
    
    cout<<res;
 
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define mp make_pair

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<int,int> pii;
///-------------------------

/// problem's variable---------------



///--------------------------


int main()
{
    Phuong_;
    int a,b;
    cin >> a >> b;
    int ans = -1;
    for(int i=1; i<=1010; ++i)
    {
        if ((i*2)/25 == a && i/10 == b)
        {
            ans = i;
            break;
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N>>M;
  vector<int> num(N,1);
  vector<bool> ans(N,false);
  ans.at(0)=true;
  for(int i=0;i<M;i++){
    int x,y;
    cin>>x>>y;
    x--;
    y--;
    num.at(x)--;
    num.at(y)++;
    if(ans.at(x)) ans.at(y)=true;
    if(num.at(x)==0) ans.at(x)=false;
    }
  int count=0;
  for(int i=0;i<N;i++) if(ans.at(i)) count++;
  cout<<count<<endl;
  }

Measured memory_bytes: 640
class UnionFind():

  def __init__(self, n):
    self.par = [i for i in range(n)]
    self.rank = [0] * n
    self.sizes = [1] * n

  def find(self, x):
    if self.par[x] != x:
      self.par[x] = self.find(self.par[x])
    return self.par[x]

  def union(self, x, y):
    x, y = self.find(x), self.find(y)
    if x == y:
      return False
    elif self.rank[x] < self.rank[y]:
      self.par[x] = y
      self.sizes[y] += self.sizes[x]
    elif self.rank[x] > self.rank[y]:
      self.par[y] = x
      self.sizes[x] += self.sizes[y]
    else:
      self.par[y] = x
      self.rank[x] += 1
      self.sizes[x] += self.sizes[y]
    return True

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def size(self, x):
    return self.sizes[self.find(x)]

n, m = list(map(int, input().split()))
edge = [tuple(map(int, input().split())) for i in range(m)]
ans = []
uf = UnionFind(n+1)
for x, y in edge[::-1]:
  if uf.same(x, y):
    ans.append(0)
    continue
  else:
    ans.append(uf.size(x)*uf.size(y))
    uf.union(x, y)
cur = 0
for e in ans[::-1]:
  cur += e
  print(cur)

Measured memory_bytes: 120152
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
# define mp make_pair
# define x first
# define y second
using namespace std;
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; }

int main() {
  int n, m; cin >> n >> m;
  vector<int> l(m), r(m);
  rep(i, m){
    cin >> l[i] >> r[i];
  }

  int maxi = n, mini = 1;
  rep(i, m){
    mini = max(mini, l[i]);
    maxi = min(maxi, r[i]);
  }
  int ans = max(maxi - mini + 1, 0);

  cout << ans << endl;
}


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

int main()
{
  string s; cin>>s;
  int ans = 700;
  rep(i, 3){
    if(s[i] == 'o') ans+=100;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';
const int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 };

char c;

int main() {
	cin >> c;
	c++;
	cout << c << endl;
}

Measured memory_bytes: 256
import java.util.*;

@SuppressWarnings("unchecked")
public class Main {
	// public static void printArray(int[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static<T> void printArrayT(T[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	public static String joinInt(int[] a, String separator) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < a.length; i++) {
			if (i > 0) {
				sb.append(separator);
			}
			sb.append(a[i]);
		}
		return sb.toString();		
	}

	static int[] nextIntArray(Scanner sc, int N) {
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int Q = sc.nextInt();
		int[] ans = new int[N];
		for (int i = 0; i < Q; i++) {
			int a = sc.nextInt();
			ans[a - 1]++;
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < N; i++) {
			boolean ok = K - Q + ans[i] > 0;
			sb.append(ok ? "Yes" : "No");
			sb.append("\n");
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 50584
target = []
def dfs(A):
    if len(A) == N:
        tmp = 0
        for a, b, c, d in arr:
            if A[b-1] - A[a-1] == c:
                tmp += d
        target.append(tmp)
        return
    start = 1
    if len(A) != 0:
        start = A[-1]
    for v in range(start,M+1):
        A.append(v)
        dfs(A)
        A.pop()
N, M, Q = map(int, input().split())
arr = [list(map(int, input().split())) for _ in range(Q)]
dfs([])
print(max(target))

Measured memory_bytes: 83728
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int a,b,x;
    cin >> a >> b;
    x = std::max(a,b);
    if(x == a){
        a--;
    }else{
        b--;
    }
    x += std::max(a,b);
    cout << x << endl;
}


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

using namespace std;
using ll = long long;

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

int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];

  deque<int> d;
  rep(i, n) {
    int p = lower_bound(d.begin(), d.end(), a[i]) - d.begin();
    if (p == 0)
      d.push_front(a[i]);
    else
      d[p - 1] = a[i];
  }

  cout << d.size() << endl;
  return 0;
}


Measured memory_bytes: 4416
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define ri register int 
#define il inline
#define pairint pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define LL long long
#define gc getchar
template<class T>il void in(T &x)
{
    x=0;bool f=0;char c=gc();
    while(c<'0'||c>'9') 
    {
        if(c=='-') f=1;
        c=gc();
    }
    while(c>='0'&&c<='9') x=x*10+(c^'0'),c=gc();
    if(f) x=-x;
} 
#undef gc
#define N 100005
#define int LL
int x,y,z,n;
int a[N],b[N],c[N];
int id[N];
bool cmp(const int &x,const int &y)
{
	return a[x]-b[x]>a[y]-b[y];
}
struct Node
{
	int id,val;
	Node(){}
	Node(const int &ii,const int &vv)
	{
		id=ii,val=vv;
	}
	friend bool operator<(const Node &a,const Node &b)
	{
		return a.val>b.val;
	}
};
priority_queue<Node>q;
pairint f[N],g[N]; // (a,c) (b,c)
signed main()
{
#ifdef M207
    freopen("in.in","r",stdin);
#endif
	in(x),in(y),in(z),n=x+y+z;
	for(ri i=1;i<=n;++i) in(a[i]),in(b[i]),in(c[i]),id[i]=i;
	sort(id+1,id+1+n,cmp);
	for(ri i=1;i<=n;++i)
	{
		int u=id[i];
		f[i]=f[i-1];
		if(i<=x) 
		{
			f[i].fi+=a[u];
			q.push(Node(u,a[u]-c[u]));
		}
		else 
		{
			Node t=q.top();
			if(a[t.id]-c[t.id]<a[u]-c[u])
			{
				f[i].fi=f[i].fi-a[t.id]+a[u];
				f[i].se+=c[t.id];
				q.pop();q.push(Node(u,a[u]-c[u]));
			}
			else f[i].se+=c[u];
		}
	}
	while(!q.empty()) q.pop();
	for(ri i=n;i>=1;--i)
	{
		int u=id[i];
		g[i]=g[i+1];
		if(n-i+1<=y) 
		{
			g[i].fi+=b[u];
			q.push(Node(u,b[u]-c[u]));
		}
		else 
		{
			Node t=q.top();
			if(b[t.id]-c[t.id]<b[u]-c[u])
			{
				g[i].fi=g[i].fi-b[t.id]+b[u];
				g[i].se+=c[t.id];
				q.pop();q.push(Node(u,b[u]-c[u]));
			}
			else g[i].se+=c[u];
		}
	}
	int ans=0;
	for(ri i=x;i<=n-y;++i)
		ans=max(ans,f[i].fi+f[i].se+g[i+1].fi+g[i+1].se);
	printf("%lld",ans);
    return 0;
}

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

int main(){
int N, M; cin >> N >> M;
vector<int> a(M);
vector<int> b(M);
vector<int> counter(N);
for (int n = 0; n < N; n++) {
    counter[n] = 0;
}
for (int m = 0; m < M; m++) {
    cin >> a[m];
    cin >> b[m];
    for (int n = 1; n <= N; n++) {
        if (a[m] == n) counter[n - 1]++;
        if (b[m] == n) counter[n - 1]++;
    }
}
for (int n = 0; n < N; n++){
    cout << counter[n] << endl;
}

}

Measured memory_bytes: 384
N, K = map(int, input().split())
S = input()
ans = ''
for i in range(N):
  if i == K-1:
    if S[i] == 'A':
      ans += 'a'
    elif S[i] == 'B':
      ans += 'b'
    elif S[i] == 'C':
      ans += 'c'
  else:
    ans += S[i]
 
print(ans)

Measured memory_bytes: 3060