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

int main() {
  int N;
  cin >> N;
  vector<int> arr(1);
  cin >> arr[0];
  int cnt = 1;
  int tmp;
  for (int i = 1; i < N; i++) {
    cin >> tmp;
    for (int j = 0; j < cnt; j++) {
      if (arr[j] == tmp) break;
      if (j == cnt - 1) {
        arr.push_back(tmp);
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
//char s[200],t[200],s1[200],d,s2[200];
#include <iostream>
#include <algorithm>
using namespace std;
struct node{
 int a,b;
}x[100000];
int cmp(node q,node w){
	return q.a<=w.a;
}
int main(){
	int n,m,i,j=1,mx,mn;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++)scanf("%d%d",&x[i].a,&x[i].b);
	sort(x,x+m,cmp);
	mn=x[0].b; 
	for(i=1;i<m;i++){
	if(x[i].a>=mn){j++;mn=x[i].b;} 
	if(mn>x[i].b)mn=x[i].b;
	}
	printf("%d",j);
	return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys


def solve(S: str):
    str_S = S
    for i in range(4):
        if i == 3:
            break
        if str_S[i] == str_S[i + 1]:
            print("Bad")
            return 
    print("Good")
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

int main()
{
  string S;
  int N, K;
  cin >> N >> S >> K;
  
  char c = S[K-1];
  
  for (int i = 0; i < S.size(); ++i)
    if (S[i] != c)
      S[i] = '*';
  
  cout << S;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  long long N, A, B;
  cin >> N >> A >> B;

  if((B-A)%2==0){
    cout << (B-A)/2 << endl;
  }else{
    cout << min(N-B+1+(B-A-1)/2,A+(B-A-1)/2) << endl;
  }
}

Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int mini(int a, int b){
    return a < b ? a : b;
}

int main()
{
    int n;
    int a[128], b[128];
    int s;

    cin >> n;
    for(int i=1; i<=n-1; ++i) cin >> b[i];
        
    s = b[1];
    for(int i=2; i<=n-1; ++i){
        a[i] = mini(b[i], b[i-1]);
        s += a[i];
    }
    s += b[n-1];

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
using namespace std;

int main() {

	int N;
	cin >> N;

	vector<long long> A(N, 0);
	long long bv = 1000000000000000000;
	bool jdg = false;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] != 0) {
			bv /= A[i];
		}
		else {
			jdg = true;
		}
	}

	if (bv > 0) {
		jdg = true;
	}

	long long ans = 1;

	if (jdg == true) {
		for (int i = 0; i < N; i++) {
			ans *= A[i];
		}
		cout << ans << endl;
	}
	else {
		cout << -1 << endl;
	}

	return 0;
}



Measured memory_bytes: 4056
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args){
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] l = new int[n];
        int[] sum = new int[n+1];
        for (int i=0; i<n; i++) l[i] = sc.nextInt();
        for (int i=1; i<n+1; i++) sum[i] = sum[i-1] + l[i-1];

        int res = 0;
        for (int i=0; i<n+1; i++) {
            if (sum[i] <= x) res++;
        }

        System.out.println(res);
    }


}


Measured memory_bytes: 35996
N, M = map(int, input().split())
X = [[] for _ in range(N)]
for _ in range(M):
    u, v, d = map(int, input().split())
    X[u-1].append((v-1, d))
    X[v-1].append((u-1, d))

input()    
T = int(input())


t = 0
x = 0
while t < T:
    if t < 5000:
        print(-1)
        t += 1
        continue
    
    y, d = max([(y, d) for y, d in X[x]])
    for i in range(d):
        print(y+1)
        t += 1
        if t >= T:
            break
    x = y


Measured memory_bytes: 4628
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int nxt() {int x;scanf("%d", &x);return x;}


int main(){
    int n=nxt();
    int t[n];
    int sum=0;
    REP(i,n){
        int x=nxt();
        t[i]=x;
        sum+=x;
    }
    int m=nxt();
    REP(i,m){
        int p=nxt();
        int x=nxt();
        int out=sum-(t[p-1]-x);
        printf("%d\n",out);
        
    }
    return 0;
}



Measured memory_bytes: 256
N = int(input())
W_list = list(map(int, input().split()))

low = 0
high = sum(W_list)
diff = sum(W_list)

for w in W_list:
    low += w
    high -= w
    if diff > abs(high - low):
        diff = abs(high - low)
    else:
        break

print (diff)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();
//        int[] A = new int[N];
        NavigableMap<Integer, Integer> ns = new TreeMap<>();

        for(int i = 0; i < N; i ++) {
            Integer a = scanner.nextInt();
            if(ns.containsKey(a)) {
                ns.put(a, ns.get(a) + 1);
            }else {
                ns.put(a, 1);
            }
        }

        for(int i = 0; i < M; i++) {
            Integer key = ns.lowerKey(Integer.MAX_VALUE);
            Integer val = ns.get(key);
            if(val == 1) {
                ns.remove(key);
            }else{
                ns.put(key, val - 1);
            }

            Integer newKey = key / 2;
            if(ns.containsKey(newKey)) {
                ns.put(newKey, ns.get(newKey) + 1);
            }else {
                ns.put(newKey, 1);
            }
        }

        long sum = 0;
        for (Integer key : ns.keySet()) {
            Integer val = ns.get(key);
            sum += (long)key * (long)val;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 65516
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cout<<(#v)<<":";for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;
#define printVS(vs) cout<<(#vs)<<":"<<endl;for(auto(s):(vs)){cout<<(s)<< endl;}
#define printVV(vv) cout<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;}
#define printP(p) cout<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cout<<(#vp)<<":"<<endl;for(auto(p):(vp)){cout<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 2e9;
const int mod = 1e9 + 7;

int n, m;
const int MAX = 100000;
int y[MAX];
int l[2 * MAX];
int r[2 * MAX];

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

    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int x, _y;
        cin >> x >> _y;
        y[x] = _y;
    }

    rep(i, n) {
        l[i] = r[i] = i;
    }

    rep(i, MAX) {
        if (!y[i]) continue;
        int t = min(l[y[i] - 1], l[y[i]]);
        l[y[i] - 1] = t;
        l[y[i]] = t;
        int u = max(r[y[i] - 1], r[y[i]]);
        r[y[i] - 1] = u;
        r[y[i]] = u;
    }

    rep(i, n) {
        cout << (i != 0 ? " " : "") << r[i] - l[i] + 1;
    }
    cout << endl;

}

Measured memory_bytes: 7020
#define _CRT_SECURE_NO_WARNINIGS
#include <stdio.h>

int main(void) {
	int N, A, B;

	scanf("%d", &N);
	if (N == 1)
		puts("Hello World");
	else {
		
		scanf("%d%d", &A, &B);
		printf("%d\n", A + B);
	}

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i,x,y) for(ll i=x; i<=y; i++)
#define BIT(t) ((long long 1) << t)
#define PER(i,y,x) for(ll i=y; i>=x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
using namespace std;
typedef long long ll;

struct segtree {
       vector<ll> tree;

       ll op(ll x, ll y) {
               return min(x,y);
       }
       ll const INIT_VALUE = 1e18;
       ll n_ = 1;

       segtree(ll n) {
               while (n_ <= n) {
                       n_ *= 2;
               }
               tree = vector<ll>(n_ * 2 + 1, INIT_VALUE);
       }

       //k番目をxでupdate
       void update(ll k, ll x) {
               k += n_;
               tree[k] = x;
               while (k >= 1) {
                       k /= 2;
                       tree[k] = op(tree[k * 2], tree[k * 2 + 1]);
               }
       }

       ll val_o(ll a, ll b, ll k, ll l, ll r) {
               if (a <= l && r <= b) {
                       return tree[k];
               }
               else if (r <= a || b <= l) {
                       return INIT_VALUE;
               }
               else {
                       ll x1 = val_o(a, b, k * 2, l, (l + r) / 2);
                       ll x2 = val_o(a, b, k * 2 + 1, (l + r) / 2, r);
                       return op(x1, x2);
               }

       }

       //[a,b)のvalueを求める
        ll val(ll a, ll b) {
            if(a >= b){
                return INIT_VALUE;
            }
            return val_o(a, b, 1, 0, n_);
        }
};

ll const MAX = 1e5 + 5;
segtree tree1(MAX), tree2(MAX);
vll a(MAX);
vll dp(MAX);
int main(){
    ll n,e,t;
    cin >> n >> e >> t;
    a[0] = 0;
    REP(i,1,n){
        cin >> a[i];
    }
    tree1.update(0,0);
    tree2.update(0,-2 * a[1]);
    a.push_back(1e18);
    REP(i,1,n){
        ll tmp = lower_bound(a.begin(), a.begin() + n + 1, a[i] - double(t) / 2) - 1 - a.begin();
        ll k1,k2;
        k1 = tree1.val(tmp, i) + a[i] + t;
        k2 = tree2.val(0, tmp) + 3 * a[i];
        dp[i] = min(k1,k2);
        tree1.update(i, dp[i] - a[i]);
        tree2.update(i, dp[i] - a[i] - 2*a[i+1]);
    }
    cout << dp[n] + e - a[n]<< endl;    
}

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

map<ll, ll> insu;
void bunkai(ll n)
{
    ll a = 2; //割る数
    while (n >= a * a)
    {
        if (n % a == 0)
        {
            insu[a] += 1;
            n /= a;
        }
        else
        {
            a++;
        }
    }
    // 最後に残った n は素因数
    insu[n] += 1;
}
int main()
{
    ll n, p;
    cin >> n >> p;
    bunkai(p); //これでできるはず。
    ll count = 1;
    for (auto x : insu)
    {
        count *= pow(x.first, (x.second / n));
    }
    cout << count << endl;
}

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

int main (void) {
    
    int N, K;
    cin >> N >> K;
    
    vector<bool> sunuke(N, false);
    vector<int> okashi(K, 0);
    
    for (auto o : okashi) {
        int d;
        cin >> d;
        for (int i = 0; i < d; i++) {
            int A;
            cin >> A;
            if (!sunuke.at(A - 1)) {
                sunuke.at(A - 1) = true;
            }
        }
    }
    
    int c = 0;
    for (auto s :sunuke) {
        if (s == false)
            c++;
    }
    cout << c  << endl;
}

Measured memory_bytes: 3644
// spagetti
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  int n;
  scanf("%d",&n);
  ll ans = 0;
  for (int i = 2; i <= 18; ++i) {
    ll x = 1; rep(j,i-1) x *= 10; --x;
    ll y = 1;
    ll m = n;
    ll cnt = 1;
    bool fst = true;
    while (x >= 0) {
      if (x == 0) {
        cnt *= 10;
        break;
      }
      ll t = 0;
      while (m%(y*10)/y != (9*t)%10) ++t;
      // cerr<<i<<" "<<m<<" "<<x<<" "<<y<<" "<<t<<" "<<cnt<<endl;
      m = abs(m-x*t);
      cnt *= (fst?9:10) - t;
      x = (x-99*y)/10;
      y *= 10;
      fst = false;
    }
    if (!m) ans += cnt;
  }
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <string>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;
ll mod=1000000007;

//Greatest Common Divisor 最大公約数
ll gcd(ll m, ll n){
	//方法1 ユークリッドの互除法
	if(n==0) return m;
    return gcd(n, m%n);

	//方法2 速度が必要な場合、GCC拡張を利用する
	// return __gcd(m, n);

    //方法3 引き合い
    //引数に０がある場合は０を返す
    /*if((m==0)||(n==0)) return 0;
    while(m!=n){
		if(m>n) m-=n;
		else n-=m;
	}
	return m;*/
}

//Least Common Multiple 最小公倍数
ll lcm(ll m, ll n){
	//引数に０がある場合は０を返す
	if((0==m)||(0==n)) return 0;

	//lcm=m*n/gcd(m,n) ⇔ m*n==gcd*lcm
	return (m/gcd(m,n))*n; 
}

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

	ll A,B,C,D,Ans,tmp;
	cin>>A>>B>>C>>D;
	A--;
	tmp=lcm(C,D);
	Ans = (B - B/C - B/D + B/tmp) - (A - A/C - A/D + A/tmp);
	cout<<Ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	ll N, x;
	cin >> N >> x;
	vector<ll> a(N);
	vector<vector<ll> > b(N, vector<ll>(N, 0));
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		b[0][i] = a[i];
	}
	for (int i = 0; i < N-1; i++)for (int j = 0; j < N; j++) {
		ll k = j - (i + 1);
		if (k < 0)k = N + k;
		b[i + 1][j] = min(b[i][j], a[k]);
	}
	ll ans = INF_LL / 2;
	for (int i = 0; i < N; i++) {
		ll tmp = 0;
		tmp += i*x;
		for (int j = 0; j < N; j++) {
			tmp += b[i][j];
		}
		ans = min(ans, tmp);
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 31616
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
  int x, i, j, t;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j] <= x) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

int main(void) {
  int i, q;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d",&A[i]);
  q = partition(0,n-1);

  for(i=0; i<n; i++) {
    if(i) printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q) printf("]");
  }
  printf("\n");

  return 0;
}

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

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

int main(){
  IOS();
  string s;
  cin>>s;
  ll k;
  cin>>k;
  REP(i,min(105LL,k))if( s[i]!='1' ) return cout<<s[i]<<endl,0;
  cout<<1<<endl;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int K = sc.nextInt();
    	int [] h = new int [N];
    	int count =0;
    	
    	for(int i =0; i<N; i++){
    	    h[i] = sc.nextInt();
    	}
    	
    	for(int i=0; i<N; i++){
    	    if(h[i]>=K){
    	        count++;
    	    }
    	    
    	}    
    	
    	System.out.println(count);
        
 	}
}

Measured memory_bytes: 47816
#include<bits/stdc++.h>
#define ls ch[x][0]
#define rs ch[x][1]
#define ll long long
using namespace std;

inline ll read(){
	ll num=0,neg=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')neg=-1;c=getchar();}
	while(isdigit(c)){num=(num<<3)+(num<<1)+c-'0';c=getchar();}
	return num*neg;
}

ll a,b,c,d,ans;

int main(){
	a=read(),b=read(),c=read(),d=read();
	ans=a*c;
	ans=max(ans,a*d);
	ans=max(ans,b*c);
	ans=max(ans,b*d);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, k, a[N];
bool check(int x) {
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] <= x) continue;
    if (a[i] % x == 0)
      cnt += (a[i] / x) - 1;
    else
      cnt += (int)(a[i] / x);

    if (cnt > k) return false;
  }
  return true;
}
int main() {
  while (cin >> n >> k) {
    int ans = 0;
    for (int i = 0; i < n; i++) cin >> a[i], ans = max(ans, a[i]);
    int l = 1, r = 1e9 + 7;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (check(mid)) {
        r = mid - 1;
        ans = mid;
      } else
        l = mid + 1;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 4324
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
string s;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>s;
    rep(i,0,s.size()){
    	if(s[i]!='?') cout<<s[i];
    	else cout<<'D';
	}
    return 0;
}


Measured memory_bytes: 3788
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  int N, M;
  cin >> N >> M;

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

  long long coords[M][2];
  long long dists[N][M];
  for (int i = 0; i < M; ++i) {
    cin >> coords[i][0] >> coords[i][1];
    for (int j = 0; j < N; ++j) {
      long long d = abs(students[j][0] - coords[i][0]) + abs(students[j][1] - coords[i][1]);
      dists[j][i] = d;
    }
  }

  for (int i = 0; i < N; ++i) {
    long long min_dist = 1000000000;
    int min_index;
    for (int j = 0; j < M; ++j) {
      if (dists[i][j] < min_dist) {
        min_dist = dists[i][j];
        min_index = j + 1;
      }
    }
    cout << min_index << endl;
  }


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;
//絶対値
ll ze(ll x,ll y){
    return max(x,y)-min(x,y);
};
int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> s(n);
    vector<pair<int,int>> c(m);
    vector<int> ans(m);
    for(int i = 0; i < n; i++){
        int a,b;
        cin >> a >> b;
        s[i] = {a,b};
    }    
    for(int i = 0; i < m; i++){
        int d,e;
        cin >> d >> e;
        c[i] = {d,e};
    }
    for(int i = 0; i < n; i++){
        pair<int,int> can = {mod,-1};
        for(int j = 0; j < m; j++){
            if(can.first > ze(s[i].first,c[j].first)+ze(s[i].second,c[j].second)){
                can = {ze(s[i].first,c[j].first)+ze(s[i].second,c[j].second),j};
            }
        }
        cout << can.second+1 << endl;
    }
}

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

int main()
{
  ll N, T; cin >> N >> T;
  vector<ll> t(N);
  rep(i, N) cin >> t[i];
  ll ans = 0;
  rep(i, N-1) {
    if(t[i+1]-t[i] > T)
      ans += T;
    else
      ans += t[i+1]-t[i];
  }
  ans += T;
  cout << ans << endl;
  return 0;
}


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	int n, a;
	cin >> n;
	
	REP(i,n) {
		cin >> a;
		if(a % 2 == 0) {
			if (a % 3 == 0 || a % 5 == 0) {
			} else {
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
	return 0;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define fll(a) scanf("%lld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
    fast
    int n;
    string s;
    cin >> n;
    cin >> s;
    if(s.size()<=n)
    {
        cout << s << endl;
        return 0;
    }
    else
    {
        for(int i=0; i<n; i++)
            cout << s[i];
    }
    cout << "...\n";
    return 0;
}



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

int main(){
    int n; cin >>n;
    vector<int>bs(n+1);for(int i=0;i<n-1;i++){cin>>bs[i];}
    bs[n-1]=100000;
    long long acc = bs[0];
    for (int i=0;i<n-1;i++){
        acc += min(bs[i], bs[i+1]);
    }
    cout << acc << endl;
    return 0;
}

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

  int t[5],n[5],result[5];

  for(int i=1 ; i < 5 ; i++){
    cin >>t[i]>>n[i];
    
    if(t[i] == 1){
      result[i]=n[i]*6000;
    }else if(t[i] == 2 ){
      result[i]=n[i]*4000;
    }else if(t[i] == 3 ){
      result[i]=n[i]*3000;
    }else if(t[i] == 4 ){
      result[i]=n[i]*2000;
    }      
  
  }

  for(int i=1 ; i < 5 ; i++){
    cout<<result[i]<<endl;
  }

  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;


int main() {
    int N, count=0;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];

    for(int i=0; i<N; i++) {
        while(A[i] > 0) {
            for(int j=i; j<N; j++) {
                if(A[j] == 0) break;
                A[j]--;
            }
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3636
import java.util.*;


class Main{
	public static void main(String args[]){
		
		Scanner sc=new Scanner(System.in);
		
		int x=sc.nextInt();
		int y=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int[] p =new int[a];
		int[] q =new int[b];
		int[] all =new int[x+y+c];
		//LinkedList<Integer> q =new LinkedList();
		//LinkedList<Integer> r =new LinkedList();
		//LinkedList<Integer> all =new LinkedList();
		
		long ans = 0;
		
		for(int i=0;i<a;i++){
			//p.add(sc.nextInt());
			p[i]=sc.nextInt();
		}
		
		for(int i=0;i<b;i++){
			//q.add(sc.nextInt());
			q[i]=sc.nextInt();
		}
		
		for(int i=0;i<c;i++){
			//all.add(sc.nextInt());
			all[i]=sc.nextInt();
		}
		//Collections.sort(p);
		//Collections.sort(q);
		
		Arrays.sort(p);
		Arrays.sort(q);
		//Collections.sort(r);
		
		//ans+=p.pollLast();
		//ans+=q.pollLast();
		
		
		
		for(int i=0;i<x;i++){
			//all.add(p.pollLast());
			all[c+i]=p[a-i-1];
		}
		
		for(int i=0;i<y;i++){
			//all.add(q.pollLast());
			all[c+x+i]=q[b-i-1];
		}
		
		
		Arrays.sort(all);
		
		for(int i=0;i<x+y;i++){
			ans+=all[x+y+c-i-1];
		}
		
		System.out.print(ans);
	}
}
	




Measured memory_bytes: 94360
#include <cstdio>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

int n, as[3];

int solve(vector<int> vs) {
  int res;
  if(vs.size() == 3) {
    sort(vs.begin(), vs.end());
    res = 0;
    REP(i, 3) {
      res += abs(vs[i] - as[i]);
    }
  } else {
    res = 1000000000;
    REP(i, vs.size()) {
      vector<int> vs2;
      REP(j, vs.size()) {
        if(j != i) {
          vs2.push_back(vs[j]);
        }
      }
      res = min(res, solve(vs2));
    }
    REP(i1, vs.size()) {
      REP(i2, i1) {
        vector<int> vs2;
        vs2.push_back(vs[i1] + vs[i2]);
        REP(i, vs.size()) {
          if(i != i1 && i != i2) {
            vs2.push_back(vs[i]);
          }
        }
        res = min(res, 10 + solve(vs2));
      }
    }
    
  }
  return res;
}

int main(void) {
  scanf("%d", &n);
  REP(i, 3) {
    scanf("%d", &as[i]);
  }
  sort(as, as + 3);
  vector<int> vs;
  REP(i, n) {
    int v;
    scanf("%d", &v);
    vs.push_back(v);
  }
  int res = solve(vs);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<complex>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8
#define REP(i, m) for(long long i = 0; i < m; ++i)
#define FOR(i, n, m) for(long long i = n; i < m; ++i)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<ll> vl;
typedef vector<vector<ll> > vll;

ll N = 100001;
ll bit[100001];
#define MAX_N 1000000
ll extgcd(ll a, ll b, ll& x, ll& y) {
	ll d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else {
		x = 1; y = 0;
	}
	return d;
}
ll mod_inverse(ll a, ll m) {
	ll x, y;
	if(extgcd(a, m, x, y) == 1) return (m + x % m) % m;
	else return -1;
}
vector<ll> fact(MAX_N+1, INF);
ll mod_fact(ll n, ll& e) {
	if(fact[0] == INF) {
		fact[0]=1;
		if(MAX_N != 0) fact[1]=1;
		for(ll i = 2; i <= MAX_N; ++i) {
			fact[i] = (fact[i-1] * i) % MOD;
		}
	}
	e = 0;
	if(n == 0) return 1;
	ll res = mod_fact(n / MOD, e);
	e += n / MOD;
	if((n / MOD) % 2 != 0) return (res * (MOD - fact[n % MOD])) % MOD;
	return (res * fact[n % MOD]) % MOD;
}
ll mod_comb(ll n, ll k) {
	if(n < 0 || k < 0 || n < k) return 0;
	ll e1, e2, e3;
	ll a1 = mod_fact(n, e1), a2 = mod_fact(k, e2), a3 = mod_fact(n - k, e3);
	if(e1 > e2 + e3) return 0;
	return (a1 * mod_inverse((a2 * a3) % MOD, MOD)) % MOD;
}


int main() {
	ios::sync_with_stdio(false);
	string a;
	cin>>a;
	vector<ll> cnt(26,0);
	REP(i,a.size()) {
		++cnt[a[i]-'a'];
	}
	ll res=a.size()*(a.size()-1)/2;
	REP(i,26) {
		res-=cnt[i]*(cnt[i]-1)/2;
	}
	cout<<res+1<<endl;
}


Measured memory_bytes: 8528
#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

int n, h, w, max1=0, max3=0, min2, min4, islem;
pair<int, int> konum;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>w>>h>>n;
	min2=w;
	min4=h;
	for (int i = 0; i < n; ++i){
		cin>>konum.first>>konum.second;
		cin>>islem;
		switch(islem){
			case 1:
			max1=max(max1, konum.first);
			break;
			case 2:
			min2=min(min2, konum.first);
			break;
			case 3:
			max3=max(max3, konum.second);
			break;
			case 4:
			min4=min(min4, konum.second);
		}
	}
	cout<<max(min2-max1, 0)*max(0, min4-max3);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


const int MAX = 1000005;
//const int mod = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
 
}
long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}



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

    int n, k; cin >> n >> k;
    COMinit();

    repr(i, 1, k+1){
        if(i>k || n-k-i+1<0) cout << 0 << endl;
        else cout << (COM(k-1, i-1) * COM(n-k+1, i))%mod << endl;
    }

    return 0;
}

Measured memory_bytes: 23680
import bisect

n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort()
B.sort()
C.sort()

count = 0

for i in range(n):
    a = bisect.bisect_left(A,B[i])
    c = bisect.bisect_right(C,B[i])
    count += a*(n-c)
    
print(count)

Measured memory_bytes: 105572
def isEven(iterable):
    for n in iterable:
        if n % 2 != 0:
            return False
    return True

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    count = 0
    while isEven(a):
        a = [int(x/2) for x in a]
        count = count+1
    print(count)


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

int main(){
  int x,a[101],b=1;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      a[b-2] = a[b-2] + a[b-1];  
      b--;
    } else if ( s[0] == '-' ){
      a[b-2] = a[b-2] - a[b-1];
      b--;
    } else if ( s[0] == '*' ){
      a[b-2] = a[b-2] * a[b-1]; 
      b--;
    } else {
      x = atoi(s);
      a[b] = x;
      b++;
    }
  }
  printf("%d\n",a[b-1]);
  return 0;
}

Measured memory_bytes: 548
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;

int main() {
	int n, m, p;
	while(cin >> n >> m >> p, n|m|p) {
		int x[n], sum=0;
		for(int i=0; i<n; i++) {
			cin >> x[i];
			sum += x[i];
		}

		if(x[m-1]==0)
			cout << 0 << endl;
		else
			cout << sum*(100-p)/x[m-1] << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
    using namespace std; 
    //typedef long long int ll; 
     
    int main() {
      		int N, D;
      		cin>> N >> D;
      		int r =0; 
      		if( N % (2*D+1) != 0)  r=1;  
            cout<< r+ (N/(2*D+1)) <<endl;  
                }

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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    int N,M;
    cin>>N>>M;
    string Zero="000000";
    vector<pair<int,pair<int,int> > > PY(M);
    vector<string> ANS(M);
    rep(i,M){
        int a,b;
        cin>>a>>b;
        PY[i]=make_pair(a,make_pair(b,i));
    }
    sort(PY.begin(),PY.end());
    int c=PY[0].first,Co=0;
    rep(i,M){
        string A=Zero;
        string num=to_string(PY[i].first);
        A.replace(6-num.length(),num.length(),num);

        if(c!=PY[i].first){
            Co=1;
            c=PY[i].first;
        }
        else Co++;

        string B=Zero;
        num=to_string(Co);
        B.replace(6-num.length(),num.length(),num);
        A+=B;
        ANS[PY[i].second.second]=A;
    }
    rep(i,M)cout<<ANS[i]<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 8192
#include<iostream>
using namespace std;
int n;
int h[100005],mn;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	mn=h[n];
	for(int i=n-1;i>=1;i--)
	{
		if(mn>h[i]) mn=h[i];
		if(h[i]-2>=mn) 
		{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	
}

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

int A[20], m[200];

// i番目以降の要素を使ってmを作れる場合trueを返す
bool solve(int i, int m, int n) {
    if (m == 0) return true;
    if (i >= n) return false;
    return solve(i + 1, m, n) || solve(i + 1, m - A[i], n);
}

int main() {
    int n, q;
    cin >> n;
    for (int i = 0; i < n; i++) scanf("%d", A + i);
    cin >> q;
    for (int i = 0; i < q; i++) scanf("%d", m + i);

    for (int i = 0; i < q; i++) {
        if (solve(0, m[i], n)) cout << "yes" << endl;
        else cout << "no" << endl;
    }

    return 0;
}


Measured memory_bytes: 3164
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
#define inf 1000000007

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    int ans = c-(a-b);
    if(ans<0)
        ans=0;
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ll a,b;
	cin>>a>>b;
	if(a>=10)
	{
		cout<<b<<Endl;
	 } 
	else cout<<(10-a)*100+b<<endl;
	return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
int main(void)
{
   int A,B,add,sub,mul;
   while(scanf("%d %d",&A,&B)!=EOF){
        add=A+B;
        sub=A-B;
        mul=A*B;

        if(add>=sub&&add>=mul)
        {
            printf("%d\n",add);
        }
        else if(sub>=mul&&sub>=add)
        {
                        printf("%d\n",sub);
        }
        else if(mul>=sub&&mul>=add)
        {

            printf("%d\n",mul);
        }
   }
}


Measured memory_bytes: 128
"""
参考にさせていただきました.ありがとうございました.(https://atcoder.jp/contests/abc088/submissions/10819295)
"""

from collections import deque

def dfs(H,W,s):
    que = deque()
    que.append([0,0])##初期地点
    distance = [[-1 for i in range(W)] for j in range(H)]##距離を記録する配列
    dxdy = [[1,0],[0,1],[-1,0],[0,-1]]##縦横の4方向

    distance[0][0] = 1##今回は進んだ歩数が欲しいので1から始める

    flag = False ##ゴール(右下)についたかどうかのフラグ

    while que:##取り出せなくなるまでループ

        x,y = que.popleft()##現在地点

        if x == H-1 and y == W-1:##ゴールに到着
            flag = True
            break

        for i,j in dxdy:##4方向を走査
            dx = x + i
            dy = y + j
            if dx >= 0 and dx < H and dy >= 0 and dy < W and distance[dx][dy] == -1 and s[dx][dy] == ".":
                distance[dx][dy] = distance[x][y] + 1 ##値の更新(+1)
                que.append([dx,dy])##forループ後に移動した点を調べる

    if not flag:
        return -1
    else:
        ans = 0
        for i in range(H):
            ans += s[i].count("#")
        ##print("#",ans)
        ##print("dist",distance[-1][-1])
        return H*W - ans - distance[-1][-1]

def main():
    H,W = map(int,input().split())
    s = []
    for i in range(H):
        s.append(input())
    print(dfs(H,W,s))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cassert>
#include <deque>
#include <map>
#include <queue>
#include <climits>
#include <set>
#include <stack>

using namespace std;

#define ll long long
#define MAX 100000
#define MAX1 10000
#define MAX2 100000
#define inf 1000000000
#define eps 1e-12
#define MOD 1000000007

priority_queue<int> pq;

void apply(bool flag, int l, int r, ll &sum) {
    if (flag) {
        sum += r;
        if (r - l < pq.top()) {
            sum += pq.top();
            pq.pop();
            sum += -r + l;
            pq.push(-l + r);
        }
    } else {
        sum += l;
        pq.push(-l + r);
    }
}

void clr() {
    while (!pq.empty()) {
        pq.pop();
    }
    pq.push(-2 * inf);
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    int t, n, i, l, r, k, sz, ac;
    ll sum;
    cin >> t;
    while (t-- > 00) {
        vector<pair<int, pair<int, int> >> a[2];
        cin >> n;
        for (i = 1; i <= n; ++i) {
            cin >> k >> l >> r;
            a[l < r].push_back({k, {l, r}});
        }
        sort(a[0].begin(), a[0].end());
        sort(a[1].begin(), a[1].end());
        sum = 0;
        clr();
        sz = a[0].size();
        for (i = 0; i < sz; ++i) {
            l = a[0][i].second.first;
            r = a[0][i].second.second;
            k = a[0][i].first;
            // [1,k]
            ac = pq.size();
            apply(ac > k, l, r, sum);
        }
        clr();
        sz = a[1].size();
        for (i = sz - 1; i >= 0; --i) {
            l = a[1][i].second.first;
            r = a[1][i].second.second;
            k = a[1][i].first;
            swap(l, r);
            // [k+1,n]
            ac = pq.size();
            apply(n - ac < k, l, r, sum);
        }
        cout << sum << "\n";
    }

    return 0;
}

Measured memory_bytes: 6212
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#ifdef DEBUG
#include <boost/core/demangle.hpp>
#define dump(x) cerr << "L" << __LINE__ << ": in " << __PRETTY_FUNCTION__ << " \e[32;1m" << boost::core::demangle(typeid(x).name()) << "\e[37m" << " " << (#x) << " = " << (x) << "\e[m" << endl;
#else
#define dump(x)
#endif
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T> ostream& operator<<(ostream &os, vector<T> &v){os << "{";ITR(i,v){if(i!=v.begin())os << ","; os << *i;}os << "}"; return os;}
template <typename T, typename U> ostream& operator<<(ostream& os, pair<T,U> &p){os << "(" << p.first << "," << p.second << ")"; return os;}

template <typename T> T& chmin(T &a, const T &b){return a = min(a,b);}
template <typename T> T& chmax(T &a, const T &b){return a = max(a,b);}

const LLI mod = 1e9+7;

int H,W;
LLI dp[1100][1100];
bool visit[1100][1100];

LLI rec(vector<string> &a, int i, int j){
  if(i==H-1 && j==W-1) return dp[i][j] = 1;
  if(visit[i][j]) return dp[i][j];
  visit[i][j] = true;

  if(i+1<H && a[i+1][j]=='.') (dp[i][j] += rec(a,i+1,j)) %= mod;
  if(j+1<W && a[i][j+1]=='.') (dp[i][j] += rec(a,i,j+1)) %= mod;

  return dp[i][j];
}

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

   cin >> H >> W;
  vector<string> a(H); cin >> a;

  cout << rec(a,0,0) << endl;
  
  return 0;
}


Measured memory_bytes: 11648
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

s = gets.chomp
if(s == "Sunny")
  puts "Cloudy"
elsif(s == "Cloudy")
  puts "Rainy"
else
  puts "Sunny"
end

Measured memory_bytes: 1788
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int x = sc.nextInt();
    	int y = sc.nextInt();
	    int[] list = {0,1,2,1,3,1,3,1,1,3,1,3,1};
      
      	if(list[x] == list[y]){
        	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
    }
}

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

using namespace std;
using ll = long long;


int main()
{
    Phuong_;
    int n;
    cin >> n;
    vector<vector<int> > a(200005);
    for(int i=0; i<n; ++i)
    {
        int k;
        cin >> k;
        a[k].pb(i);
    }
    int dem=0;
    int head =1;
    int id = 0;
    while (true)
    {
        bool stop = true;
        for(int i=0; i<a[head].size(); ++i)
            if (a[head][i]>=id)
        {
            id = a[head][i];
            dem++;
            head++;
            stop=false;
            break;
        }
        if (stop) break;
    }
    if (dem==0) cout << -1; else
    cout << n - dem;
    return 0;
}



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

using namespace std;
typedef long long ll;

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

    vector<vector<int>> A(m);
    vector<int> p(m);

    for (int i = 0; i < m; i++) {
        cin >> k;
        A[i].resize(k);
        for (int j = 0; j < k; j++) {
            cin >> A[i][j];
            A[i][j]--;
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> p[i];
    }

    int count = 0;
    int res = 0;
    bool chk;
    for (int s = 0; s < (1 << n); s++) {
        chk = true;
        for (int i = 0; i < m; i++) {
            count = 0;
            for (int j = 0; j < A[i].size(); j++) {
                if (s & (1 << A[i][j])) {
                    count++;
                }
            }
            if (count % 2 != p[i]) {
                chk = false;
                break;
            }
        }
        if (chk) res++;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256