akhauriyash/Code-Regression huggingface dataset:
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const ll MOD = 998244353;
//}}}

ll x[1000];
ll y[1000];
ll z[1000];
ll w[1000];
int main(){
  ll N, M;
  cin >> N >> M;
  ll ans = 0;
  rep(i, N){
    cin >> x[i];
    cin >> y[i];
    cin >> z[i];
  }

  rep(i, 8){
    rep(j, N){
      w[j] = 0;
      w[j] += ((i & 1) ? x[j] : -x[j]);
      w[j] += ((i & 2) ? y[j] : -y[j]);
      w[j] += ((i & 4) ? z[j] : -z[j]);
    }
    sort(w, w + N);
    reverse(w, w + N);
    ll sum = 0;
    rep(j, M) sum += w[j];
    ans = max(sum, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<Int,Int> p;


int main(){
    int N, M; cin >> N >> M;

    if (N % 2 == 1){
        rep(i,M){
            cout << 1+i << " " << N-i << endl;
        }
    } else {
        int max_odd, max_even;
        if((N/2-1) % 2 == 1){
            max_odd = N/2-1;
            max_even = N/2 -2;
        } else {
            max_odd = N/2-2;
            max_even = N/2-1;
        }

        int i=1, j=max_odd+2, cnt = 0;
        while(max_odd > 0){
            cout << i << " " << i+max_odd << endl;
            i++; max_odd -= 2; cnt++;
            if(cnt == M) return 0;
        }

        while(max_even > 0){
            cout << j << " " << j+max_even << endl;
            j++; max_even -= 2; cnt++;
            if(cnt == M) return 0;
        }
    }
}


Measured memory_bytes: 3588
#写経
#https://atcoder.jp/contests/abc173/submissions/15061788

def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    A.sort()
    MOD = 10 ** 9 + 7
    ans = 1

    if K % 2 == 1 and A[-1] < 0:
        for i in range(K):
            ans = ans * A[N - (i + 1)] % MOD

        print(ans)
        return

    l = 0
    r = N - 1
    if K % 2 == 1:
        ans = ans * A[r]
        r -= 1
    
    for _ in range(K // 2):
        ml = A[l] * A[l + 1]
        mr = A[r] * A[r - 1]
        if ml > mr:
            ans = ans * ml % MOD
            l += 2
        else:
            ans = ans * mr % MOD
            r -= 2

    print(ans)
    return
resolve()

Measured memory_bytes: 31684
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int a;
	string s;
	cin >> a >> s;
	if(a >= 3200) cout << s << endl;
	else cout << "red" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
    long long a[5];
    int temp;
    for(int i=0; i<3; i++){
        scanf("%lld",&a[i]);
    }
    for(int i=0; i<2; i++){
        for(int j=0; j<2-i; j++){
            if(a[j] > a[j+1]){
                temp = a[j];
                a[j] = a[j+1];
                a[j+1] = temp;
            }
        }
    }
    printf("%lld\n",a[0]+a[1]);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
typedef long long int ll;
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
    ll A,B;
    string S,T;
int main(){
    cin>>A>>B;
    REP(i,A){
        cin>>S;cout<<S<<endl<<S<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
using namespace std;

bool boin(char c) {
    return c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o';
}

int main() {
    int n;
    while(cin >> n, n) {
        vector<string> v(n);
        for(int i=0; i<n; ++i) {
            cin >> v[i];
        }
        int max_len = 0;
        for(int i=0; i<n; ++i) {
            string str;
            for(int j=0; j<v[i].size(); ++j) {
                if(j == 0 || j >= 1 && boin(v[i][j-1])) {
                    str += v[i][j];
                }
            }
            v[i] = str;
            max_len = max(static_cast<int>(str.size()), max_len);
        }
        sort(v.begin(), v.end());

        int ret = -1;
        set<int> s;
        for(int i=0; i<v.size(); ++i) {
            s.insert(i);
        }

        for(int k=0; k<max_len; ++k) {
            for(int i=0; i<n-1; ++i) {
                if(v[i] == v[i+1]) {
                    i = i+2;
                    continue;
                } else if(v[i].length() <= k || v[i].length() <= k) {
                    s.erase(i);
                }
                if(v[i][k] != v[i+1][k]) {
                    s.erase(i);
                }
            }
            if(s.size() == 1) {
                ret = k+1;
                break;
            }
        }
        cout << ret << endl;
    }
}


Measured memory_bytes: 3120
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
 
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
 
using namespace std;
 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
 
const int MOD = 1000000007;
 
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;
 
signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);
 
    int n;
    cin >> n;
    VI a(n), b(n);
    REP(i, n) {
        cin >> a[i] >> b[i];
    }
 
    int ans = 0;
    for (int i = n - 1; i >= 0; --i) {
        int ta = a[i] + ans;
        int tb = b[i];
        if ((ta % tb) != 0) {
            ans += tb - (ta % tb);
        }
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
int main(){
  int a,b,e=0,d=0;
  int c[1000000]={};
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b;
    if(b<400)c[1]=1;
    else {
      if(b<800) c[2]=1;
      else {
        if(b<1200) c[3]=1;
        else {
          if(b<1600) c[4]=1;
          else {
            if(b<2000) c[5]=1;
            else {
              if(b<2400) c[6]=1;
              else {
                if(b<2800) c[7]=1;
                else {
                  if(b<3200) c[8]=1;
                  else c[9]++;
                }
              }
            }
          }
        }
      }
    }
  }
  for(int i=1;i<=8;i++) d+=c[i];
  if(d==0) d=1,c[9]--;
  cout<<d<<" "<<d+c[9]<<"\n";
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, k, ans;
    bool ok[10];
    cin >> n >> k;
    REP(i,10)ok[i] = true;
    REP(i,k){
        int d;
        cin >> d;
        ok[d] = false;
    }
    ans = n;
    while(1){
        bool f = true;
        int tmp = ans;
        while(tmp>0){
            f &= ok[tmp%10];
            tmp /=10;
        }
        if(f){
            cout << ans << endl;
            break;
        }
        else{
            ans++;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define MAX 101
#define inf 1<<29
using namespace std;

string s[MAX];
int n;

int f1(string t,int c){
  for(int i=0;i<t.length();i++){
    if(t[i]=='(')c++;
    else c--;
    if(c<0)return -inf;
  }
  return c;
}

int f2(string t,int c){
  for(int i=t.length()-1;0<=i;i--){
    if(t[i]==')')c++;
    else c--;
    if(c<0)return -inf;
  }
  return c;
}

string solve(){
  int l=0,r=0;
  bool b[MAX]={};
  for(int k=0;k<n;k++){
    pair<int,int> m=mp(-1,-1);
    for(int i=0;i<n;i++){
      if(!b[i])m=max(m,mp(f1(s[i],l),i));
    }
    if(m.f<l)break;
    l=m.f;
    b[m.s]=true;
  }

  for(int k=0;k<n;k++){
    pair<int,int> m=mp(-1,-1);
    for(int i=0;i<n;i++){
      if(!b[i])m=max(m,mp(f2(s[i],r),i));
    }
    if(m.f<r)break;
    r=m.f;
    b[m.s]=true;
  }
  for(int i=0;i<n;i++)if(!b[i])return "No";

  if(r==l)return "Yes";
  return "No";
}

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

  cout<<solve()<<endl;

  return 0;
}

Measured memory_bytes: 1232
n, p = map(int, input().split())
a = list(map(int, input().split()))

cnt = 0
for num in a:
    if num % 2 == 1:
        cnt += 1

ans = 0
if cnt == 0:
    if p % 2 == 0:
        ans = 2**n
else:
    ans = 2**(n - 1)

print(ans)

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

int main() {
  char a, b;
  cin >> a >> b;
  if (a=='H' && b=='H') {
    cout << 'H' << endl;
  } else if (a=='H' && b=='D') {
    cout << 'D' << endl;
  } else if (a=='D' && b=='D') {
    cout << 'H' << endl;
  } else {
    cout << 'D' << endl;
  }
  return 0;
}


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

using namespace std;

using LL = long long;

void solver() {
    LL k;
    cin >> k;
    
    if(k % 2 == 0) {
        cout << -1 << '\n';
        return;
    }
    
    LL v = 7 % k;

    for(int i = 1; i < 1e7; ++i) {
        if (v == 0) {
            cout << i << '\n';
            return;
        }
        v = (v * 10 + 7) % k;
    }
    cout << -1 << '\n';
}

int main() {

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

    int t;
    //cin >> t;
    t = 1;

    while(t--)
        solver();

    return 0;
}

Measured memory_bytes: 3652
#include<iostream>

using namespace std;

int main(void)
{
  int a,b; cin>>a>>b;
  int count=0;
  int b_max=30;
  
  for(int i=1;i<=a;i++){
    if(i==a){b_max=b;}
    for(int j=1;j<=b_max;j++){
      if(i==j){count++;}
    }
  }
  
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] words = new String[n];
        
        int index = 1;
        boolean ok = true;
        for (int i = 0; i < n; i++) {
            String word = br.readLine();
            words[i] = word;
            //System.out.println(word);
        }
            
            
        for (int i = 0; i < n; i++) {    
            if (i == 0) continue;
            else {
                if (words[i].charAt(0) != words[i-1].charAt(words[i-1].length()-1)) {
                    ok = false;
                    break;
                }
                for (int j = 0; j < n; j++) {
                    if (i==j) continue;
                    if (words[i].equals(words[j])) {
                        ok = false;
                        break;
                    }
                }
                
            }
        }
        
        if (ok) System.out.println("Yes");
        else System.out.println("No");
        
    }
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N; cin >> N;
  vector<string> s(N);
  REP(i, N) cin >> s[i];

  {
    int black = -1;
    REP(i, N) if (count(ALL(s[i]), '#') > 0) black = i;
    if (black == -1) {
      cout << -1 << endl;
      return 0;
    }
  }

  int ans = 1001001001;

  int columns = 0;
  REP(c, N) {
    bool all_black = true;
    REP(r, N) if (s[r][c] == '.') all_black = false;
    if (!all_black) columns++;
  }


  int all_black_row = false;
  REP(r, N) {
    if (count(ALL(s[r]), '#') == N) all_black_row = true;
  }

  if (all_black_row) {
    ans = columns;
  }
  else
  {
    REP(r, N) {
      int val = 0;

      int src = -1;
      REP(i, N) {
        if (s[i][r] == '#') src = i;
      }
      if (src == -1) {
        val++;
      }
      REP(c, N) {
        if (s[r][c] == '.') {
          val++;
        }
      }
      chmin(ans, val + columns);
    }
  }

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

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,k;
	cin>>n;
	ll a[n+1]={};
	ll b[n+1]={};
	ll t;
for(ll i=1;i<n+1;i++){
	cin>>t;
	a[i]=t;
	b[t]=i;
	
}
for(ll i=1;i<n+1;i++){
	cout<< b[b[a[i]]]<<" ";
}
	
	return 0;
}

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

int main(void) {
	int a[2], coin = 0;
	scanf("%d %d", &a[0], &a[1]);
	
	for (int i = 0; i < 2; i++) {
		if (a[0] > a[1]) {
			coin += a[0];
			a[0]--;
		} else {
			coin += a[1];
			a[1]--;
		}
	}
	
	
	printf("%d\n", coin);
	return 0;
}

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

int main() {
    char s[3];
    cin >> s;
    
    if(s[0] != s[1] && s[1] != s[2] && s[2] != s[0]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import collections
H, W, K = map(int, input().split())
MOD = 10**9 + 7
F = [1,1,2,3,5,8,13,21,34]
c1 = collections.Counter([1])

for i in range(H):
    tmp = collections.Counter()
    for c in c1:
        if c > 1:
            tmp[c-1] += c1[c] * F[max([0, c-2])] * F[W-c]

        tmp[c] += c1[c] * F[c-1] * F[W-c]

        if c < W:
            tmp[c+1] += c1[c] * F[c-1] * F[W-c-1]

    c1 = collections.Counter(tmp)
    # print('%d c1=%s'%(i+1,c1))

# print('c1=', c1)

ans = c1[K]
print(ans%MOD)



Measured memory_bytes: 3316
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int vetor[100000100];
vector<int> primos;

void crivo(long long int n) {
    for (long long int i=2; i<=floor(sqrt(n)); i++){
        if (vetor[i] == 0){
            primos.push_back(i);
            int limite = floor(sqrt(n)/i);
            if (i <= limite) {
                for (long long int j=i*i; j<=limite*i; j+= i) vetor[j] = 1;
            }
        }
    }
}

int main(){

    long long int n;
    cin >> n;

    crivo(n);

    int resp = 0;

    for (int i=0; i<primos.size(); i++){
        int exp = 0;
        while(n%primos[i]==0){
            exp++;
            n/=primos[i];
        }

        int d = 1;
        while(d<=exp) {
            exp-= d;
            d++;
        }
        d--;

        resp+= d;
    }


    if (n!=1){
        // while(n!=1)
        cout << resp+1 << endl;
    } else {
        cout << resp << endl;
    }
    return 0;

}

Measured memory_bytes: 7760
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する

int main(){
  int n,k;
  cin>>n>>k;
  cout<<n-k+1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
vl adj[100005],s;
ll dp[100005],in[100005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,m,u,v;
    cin>>n>>m;
    rep(i,0,m)
    {
    	cin>>u>>v;
    	adj[u].pb(v);
    	in[v]++;
    }
    queue<ll>q;
    rep(i,1,n+1)
    {
    	if(in[i]==0)
    		q.push(i);
    }
    while(!q.empty())
    {
    	ll p=q.front();
    	q.pop();
    	s.pb(p);
    	for(auto j:adj[p])
    	{
    		in[j]--;
    		if(in[j]==0)
    			q.push(j);
    	}
    }
    ll ans=0;
    sep(i,sz(s)-1,0)
    {
    	for(auto j:adj[s[i]])
    		dp[s[i]]=max(dp[s[i]],dp[j]+1);
    	ans=max(ans,dp[s[i]]);
    }
    cout<<ans;

}


Measured memory_bytes: 8180
N,M=map(int,input().split())
c=[list(map(int,input().split())) for i in range(N)]

bit=[[] for i in range(2**3)]
for k in range(N):
    for i in range(2**3):
        t=c[k].copy()
        for j in range(3):
            if(i>>j&1):
                t[j]*=-1
        bit[i].append(t)
for i in range(2**3):
    bit[i].sort(key=lambda x:(x[0]+x[1]+x[2]),reverse=True)
res=0
for i in range(2**3):
    p=[1,1,1]
    for j in range(3):
        if(i>>j&1):
            p[j]*=-1
    z,o,t=0,0,0
    for k in range(M):
        z+=bit[i][k][0]*p[0]
        o+=bit[i][k][1]*p[1]
        t+=bit[i][k][2]*p[2]
    res=max(res,abs(z)+abs(o)+abs(t))
print(res)

Measured memory_bytes: 4596
#include<stdio.h>
int gcd(int,int);
int main()
{
int i,j,x,y,c;
  scanf("%d%d",&x,&y);
if(x<=y)
  c=gcd(y,x);
 else c=gcd(x,y);
printf("%d\n",c);
return 0;
}
int gcd(int x,int y){
int a;
  
while(y>0)
  {
a=x%y;
x=y;
y=a;
}
return x;
}



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

typedef unsigned long long ll;
typedef pair<int, int> P;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define All(i, c) for(typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define pb push_back

const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int MAX = 202;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
	string s; cin >> s;
	int n = s.length();
	int from[n-1] = {}, to[n-1] = {};
	if(s[n-1] == '1' || s[0] == '0'){
		cout << -1 << endl;
		return 0;
	}else{
		bool flag = false;
		For(i, 0, (n-1)/2){
			if(s[i] != s[n-i-2]){
				flag = true;
			}
		}
		if(flag){
			cout << -1 << endl;
			return 0;
		}else{
			int p = n;
			Rep(i, n-1){
				from[i] = p;
				to[i] = i+1;
				if(s[i] == '0'){
				}else if(s[i] == '1'){
					p = i+1;
				}
			}
		}
	}
	Rep(i, n-1){
		cout << from[i] << " " << to[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 2432
// Problem : D - Bouquet
// Contest : AtCoder - AtCoder Beginner Contest 156
// URL : https://atcoder.jp/contests/abc156/tasks/abc156_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }
int modPow(int a, int x, int p) {
    int res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

int modInverse(int a, int p) {
    return modPow(a, p-2, p);
}
int modBinomial(int n, int k, int p) {

    int numerator = 1;
    for (int i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    int denominator = 1; 
    for (int i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }
    return ( numerator* modInverse(denominator,p) ) % p;
}
  
 
void solve(){
	int n,a,b;
	rd(n,a,b);
	int ans=modPow(2,n,MOD);
	ans-=(modBinomial(n,a,MOD)+modBinomial(n,b,MOD)+1)%MOD;
	ans=(ans%MOD+MOD)%MOD;
	pp(ans);
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


Measured memory_bytes: 3608
/* ex 7_3
   tomatokan */

#include<stdio.h>
#include<stdlib.h>

int main(void){
    int **cell;
    int width,height;
    char read;
    int *good_col;
    int *good_row;
    int n_good_col=0;
    int n_good_row=0;
    scanf("%d %d",&height,&width);
    //メモリの確保
    good_col=(int*)(calloc(sizeof(int),height));
    if(good_col==NULL){
        printf("calloc failed");
        exit(1);
    }
    for(int i=0;i<height;i++){
        good_col[i]=0;
    }
    good_row=(int*)(calloc(sizeof(int),width));
    if(good_row==NULL){
        printf("calloc failed");
        exit(1);
    }
    for(int i=0;i<width;i++){
        good_row[i]=0;
    }
    cell=(int**)(calloc(sizeof(int*),height));
    if(cell==NULL){
        printf("calloc failed");
        exit(1);
    }
    for(int i=0;i<height;i++){
        cell[i]=(int*)(calloc(sizeof(int),width));
        if(cell[i]==NULL){
            printf("calloc failed");
            exit(1);
        }
    }
    //入力の読み取り
    for(int i=0;i<height;i++){
        for(int j=0;j<width;j++){
            scanf(" %c",&read);
            if(read=='#'){
                cell[i][j]=1;
            }else{
                cell[i][j]=0;
            }
        }
    }
    //各列に#があるか判定
    for(int i=0;i<height;i++){
        for(int j=0;j<width;j++){
            if(cell[i][j]){
                good_col[n_good_col]=i;
                n_good_col++;
                break;
            }
        }
    }
    //各行に#があるか判定
    for(int j=0;j<width;j++){
        for(int i=0;i<height;i++){
            if(cell[i][j]){
                good_row[n_good_row]=j;
                n_good_row++;
                break;
            }
        }
    }
    //出力
    for(int i=0;i<n_good_col;i++){
        for(int j=0;j<n_good_row;j++){
            if(cell[good_col[i]][good_row[j]]){
                printf("#");
            }else{
                printf(".");
            }
            if(j==n_good_row-1){
                printf("\n");
            }
        }
    }
    //メモリの解放
    free(good_col);
    free(good_row);
    for(int i=0;i<height;i++){
        free(cell[i]);
    }
    free(cell);
    return 0;
}

Measured memory_bytes: 1624
#include<stdio.h>
#include<math.h>

int main(void){

int i;
double  n,h[1000],a,c,d;

while(scanf("%lf",&n) != EOF){
if(n == 0){
break;
}
double s=0;
double b=0;
for(i =0; i<n; i++){
scanf("%lf",&h[i]);
s += h[i];
}
a = s/n;
for(i=0; i<n; i++){
b += (h[i]-a)*(h[i]-a);
}
c = b/n;
d = sqrt(c);

printf("%.8lf\n",d);
}

return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<long long> > vvll;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define p_q priority_queue

#define FOR(i, a, b) for (int i=(a); i<=(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 200005
int n;
vi e[MN];

pii dfs(int cn, int p){
    int fn = cn, d = 0;
    F0R(i, e[cn].size()){
        int nn = e[cn][i];
        if(nn == p) continue;

        pii res = dfs(nn, cn);
        if(res.s > d){
            fn = res.f;
            d = res.s;
        }
    }
    return mp(fn, d+1);
}

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

    cin >> n;
    F0R(_, n-1){
        int a, b;
        cin >> a >> b;
        e[a].pb(b);
        e[b].pb(a);
    }

    pii far = dfs(1, 0);
    pii far2 = dfs(far.f, 0);
    int diam = far2.s;

    if(diam % 3 == 2){
        cout << "Second\n";
    } else{
        cout << "First\n";
    }

    return 0;
}


Measured memory_bytes: 26880
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;
ll n, ans;
inline ll read(){                                     
    ll s = 0, w = 1;
    char ch = getchar();
    for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
    for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
    return s * w;
}
inline ll gcd(ll a, ll b){                              
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}
inline void work(){
    n = read();                                        
    REP(i, 1, n)                                        
        REP(j, 1, n)                                    
            REP(k, 1, n){                                
                if (min(i, min(j, k)) == 1) ans++;      
                else if (i == j && j == k) ans += i;   
                    else ans += gcd(i, gcd(j, k));      
            }
    printf("%lld\n", ans);                            
}
int main(){
    work();
    return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


int main(){
  ll n;
  cin >> n;
  vector<ll> p(n);
  rep(i, n) cin >> p[i];


  ll cnt = 0;
  rep1(i, n-2){
    if(p[i-1] < p[i] && p[i] < p[i+1]) cnt++;
    if(p[i+1] < p[i] && p[i] < p[i-1]) cnt++;
  }

  cout << cnt << endl;


  return 0;
}


Measured memory_bytes: 256
n,A,B,C=map(int,input().split())
l=[int(input()) for i in range(n)]
INF=10**9

def dfs(cur,a,b,c):
    if cur == n:
        if min(a,b,c)>0:
            return abs(a-A)+abs(b-B)+abs(c-C)-30
        else:
            return INF
    pat0=dfs(cur+1,a+l[cur],b,c)+10
    pat1=dfs(cur+1,a,b+l[cur],c)+10
    pat2=dfs(cur+1,a,b,c+l[cur])+10
    pat3=dfs(cur+1,a,b,c)
    return min(pat0,pat1,pat2,pat3)

print(dfs(0,0,0,0))


Measured memory_bytes: 3064
#include <cstdio>
#include <cctype>
#include <utility>
#include <complex>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int, in){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}

#define x(o) o.real()
#define y(o) o.imag()

int main() {
	in(), in();
	int d = 0, N = in();
	complex<int> c = {in(), in()}, n;
	while (--N) {
		c -= n = {in(), in()};
		int ax = abs(x(c)), ay = abs(y(c));
		d += x(c) * y(c) > 0 ? max(ax, ay) : ax + ay;
		c = n;
	}
	outl(d);
}


Measured memory_bytes: 2516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

ll gcd(int a, int b)
{
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}

int main()
{
    int K;
    cin >> K;
    ll ans = 0;
    rep(1, i, K + 1)
    {
        rep(1, j, K + 1)
        {
            rep(1, k, K + 1)
            {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
N = int(input())
memo = [{} for i in range(N + 1)]
MOD = 10 ** 9 + 7

def ok(last4):
    
    
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i], t[i - 1] = t[i - 1], t[i]
        if "".join(t).count("AGC") >= 1:
            return False
        
    return True
        

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in "ACGT":
        if ok(last3 + c):
            ret = ret + dfs(cur + 1, last3[1:] + c)
    memo[cur][last3] = ret
    return ret

print(dfs(0, "TTT") % MOD)

Measured memory_bytes: 3956
import numpy as np
N, Q = list(map(int, input().split()))
S = input()
t = [0] * N
for j in range(1, N):
  t[j] = t[j-1] + 1 if S[j-1:j+1] == "AC" else t[j-1]
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(t[r-1]-t[l-1])

Measured memory_bytes: 15804
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> a;
    for(int i=0; i<N; i++)
    {
    	int x;
    	cin >> x;
    	a.push_back(x);
    }
    int cnt[100003] = {};
    for(int i=0; i<N; i++)
    { 
       int x = a[i];
       int y = x-1;
       int z = x+1;
       cnt[x+1]++; 
       cnt[y+1]++;
       cnt[z+1]++;
    }

    int max_num = 0;
    for(int i=0; i<100003; i++)
    {
    	max_num = max(max_num,cnt[i]);
    }

    cout << max_num << endl;

	return 0;
}

Measured memory_bytes: 1144
from fractions import gcd
from functools import reduce

n = int(input())
nums = [int(input()) for i in range(n)]


def lcm_base(x, y):
  return (x * y) // gcd(x, y)

def lcm(nums):
  return reduce(lcm_base, nums, 1)

print(lcm(nums))

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

N, T = map(int, raw_input().split(' '))
t = map(int, raw_input().split(' '))
assert len(t) == N

sum_ = 0
begin = t[0]
end = t[0] + T
for i in range(N):
    if t[i] <= end:
        end = t[i] + T
    else:
        sum_ += (end - begin)
        begin = t[i]
        end = t[i] + T

sum_ += (end - begin)
print sum_

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

int main() {
  int n,k,s;
  cin >> n>>k>>s;
  rep(i,k){
    cout<<s<<" ";
  }
  rep(i,n-k){
    if(s!=1000000000){
      cout<<s+1<<" ";
    }
    else{
      cout<<s-1<<" ";
    }
  }
}

Measured memory_bytes: 1280
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
  double x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout.precision(9);
  cout.setf(ios::fixed);
  cout  << sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) << endl;
  return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> x(n);
    REP(i, n) {
        cin >> x[i];
    }

    int t = 0;
    REP(i, n) {
        if (x[i] > abs(x[i] - k)) {
            t += abs(x[i] - k) * 2;
        } else {
            t += x[i] * 2;
        }
    }
    cout << t << endl;
}


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

int main()
{
    int N;
    cin >> N;
    int count = 1;
    while (true)
    {
        if (pow(2, count) > N)
        {
            break;
        }
        ++count;
    }
    cout << pow(2, count - 1) << endl;
}

Measured memory_bytes: 4260
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(list(map(int, input())))
    return li

# --------------------------------------------

dp = None

def main():
    X, Y, Z = list(map(int, input().split()))
    X -= Z

    ans = 0
    while True:
        if X >= Y + Z:
            ans += 1
            X -= Y + Z
        else:
            break

    print(ans)

main()


Measured memory_bytes: 4672
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
#pragma endregion

void solve() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, 3) if (s[i] == t[i]) ans++;
  cout << ans << endl;
}


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

bool is_valid(int lower_bound, int upper_bound, string S, string T, char plus, char minus, int start, int n)
{
    int minimum = 1;
    int maximum = upper_bound;
    if (S.back() == plus)
    {
        upper_bound--;
    }
    if (S.back() == minus)
    {
        lower_bound++;
    }

    int idx = n - 2;
    while (idx >= 0)
    {
        if (lower_bound > upper_bound)
        {
            return false;
        }
        if (T[idx] == plus)
        {
            lower_bound--;
        }
        if (T[idx] == minus)
        {
            upper_bound++;
        }
        upper_bound = min(upper_bound, maximum);
        lower_bound = max(lower_bound, minimum);

        if (S[idx] == plus)
        {
            upper_bound--;
        }
        if (S[idx] == minus)
        {
            lower_bound++;
        }
        upper_bound = min(upper_bound, maximum);
        lower_bound = max(lower_bound, minimum);

        idx--;
    }
    if (lower_bound > start || start > upper_bound)
    {
        return false;
    }
    if (lower_bound > upper_bound)
    {
        return false;
    }
    return true;
}

int main()
{
    int H, W, N, sr, sc;
    cin >> H >> W >> N >> sr >> sc;

    string S, T;
    cin >> S >> T;

    if (!is_valid(1, H, S, T, 'D', 'U', sr, N))
    {
        cout << "NO" << endl;
        return 0;
    }

    if (!is_valid(1, W, S, T, 'R', 'L', sc, N))
    {
        cout << "NO" << endl;
        return 0;
    }

    cout << "YES" << endl;
}


Measured memory_bytes: 1160
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))

n,k = ma()
A = lma()
bu = []
for i in range(n):
    tmp=0
    for j in range(i,n):
        tmp+=A[j]
        bu.append(tmp)
mb = bin(max(bu))
ans = 0
for i in range(len(mb)-3,-1,-1):
    tmp=[]
    for b in bu:
        if (b>>i &1):
            tmp.append(b)
    if len(tmp)>=k:
        ans+=2**i
        bu=tmp
    else:
        pass
print(ans)


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

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

/*  テンプレここから */
typedef long long ll;

#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define INFL (1e18)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

template<typename A, size_t N, typename T>
void array_fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n, k, ans = 0;
    cin >> n >> k;
    for(int i = 0; i < n; ++ i){
        int h;
        cin >> h;
        if(h >= k) ++ ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int str[200005];
int main()
{
	int N;
	cin>>N;
	for(int i=0;i<N;i++)
	 cin>>str[i];
	int nowmin=str[0];
	int ans=0;
	for(int i=0;i<N;i++)
	{
		if(str[i]<=nowmin)
		{
			ans++;
			nowmin=str[i];
		}
	}
	cout<<ans<<endl;
}

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

int main() {
  int N,T;
  cin >> N;
  cin >> T;
  int ci,ti;
  int answer;
  answer = 1001;
  for(int i = 0; i < N ; i++ ){
  	cin >> ci;
    cin >> ti;
    
    if(ti <= T){
    	if(answer > ci){
        	answer = ci;
        }
    }
  }
  
  if(answer == 1001){
  	cout << "TLE" << endl;
  }else{
  	cout << answer <<endl;
  }
  
}

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

constexpr int N = 10e7;

int gcd(int a, int b)
{
	if (b == 0)
		return a;
	int c = a % b;
	return gcd(b, c);
}

vector<int> fac;
void factor(int n)
{
	int root = sqrt(n);
	for (int i = 1; i <= root; i++)
	{
		if (n % i == 0)
		{
			int t1 = i;
			int t2 = n / i;
			fac.push_back(t1);
			if (t1 != t2)
				fac.push_back(t2);
		}
	}
}

int main()
{
	int n, k;
	cin >> n >> k;
	int a[500];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	long long sum = 0;
	for (int i = 0; i < n; i++)
	{
		sum += a[i];
	}
	factor(sum);
	int rem[500];
	int ans;
	for (auto num : fac)
	{
		int t = 0;
		for (int i = 0; i < n; i++)
			rem[i] = a[i] % num;
		sort(rem, rem + n);
		long long rsum = 0;
		for (int i = 0; i < n; i++)
			rsum += (num - rem[i]);
		long long lsum = 0;
		long long need = 1e18;
		for (int i = 0; i < n; i++)
		{
			lsum += rem[i];
			rsum -= (num - rem[i]);
			need = min(need, max(lsum, rsum));
		}
		if (need <= k) ans = max(ans, num);
	}
	cout << ans << endl;
	return 0;
}

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();
        ArrayList<Time> L = new ArrayList<>();
        int cnt = 0,tt=0;
        for(int i=0;i<n;i++){
            int s = sc.nextInt();
            int t = sc.nextInt();
            Time time = new Time();
            time.element(s,t);
            L.add(time);
        }
        Collections.sort(L, new Comparator<Time>() {
            @Override
            public int compare(Time o1, Time o2) {
                return o1.end<o2.end?-1:1;
            }
        });
        for(Time time:L){
            if(time.start>tt){
                tt = time.end;
                cnt++;
            }
        }
        System.out.println(cnt);
    }
    public static class Time{
        int start,end;
        public void element(int start,int end){
            this.start = start;
            this.end = end;
        }
    }
}


Measured memory_bytes: 103572
import java.util.*;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int N = sc.nextInt();
        String S = sc.next();
        int Q = sc.nextInt();
        int[][] query = new int[Q][3];
        for (int i=0; i<Q; i++) {
            query[i][0] = sc.nextInt();
            query[i][1] = sc.nextInt();
            if (query[i][0] == 1) {
                query[i][2] = sc.next().toCharArray()[0];
            } else {
                query[i][2] = sc.nextInt();
            }

        }

        Integer[] ans = solve(N, S.toCharArray(), Q, query);
        for (int i=0; i<ans.length; i++) {
            System.out.println(ans[i]);
        }

        /*
        int[] sol = new int[ans.length];
        for (int i=0; i<sol.length; i++) {
            sol[i] = sc.nextInt();
        }
        for (int i=0; i<sol.length; i++) {
            if (ans[i] != sol[i]) {
                System.err.println("wrong anser on " + (i+1) + ": " + ans[i] + " != " + sol[i]);
            }
        }
         */
    }

    private static Integer[] solve(int N, char[] S, int Q, int[][] query) {
        List<Integer> ans = new ArrayList();

        TreeSet<Integer>[] set = new TreeSet[26];
        for (int i=0; i<26; i++) {
            set[i] = new TreeSet();
        }

        for (int i=0; i<N; i++) {
            set[S[i]-'a'].add(i);
        }

        for (int i=0; i<Q; i++) {
            // System.err.println("query " + i + ": " + query[i][0] + ", " + query[i][1] + ", " + query[i][2]);
            if (query[i][0] == 1) {
                int pos = query[i][1]-1;
                char chPre = S[pos];
                char chPost = (char)query[i][2];
                S[pos] = chPost;

                set[chPre-'a'].remove(pos);
                set[chPost-'a'].add(pos);
            } else {
                int sum = 0;
                int left = query[i][1]-1;
                int right = query[i][2]-1;


                for (int a=0; a<26; a++) {
                    // System.err.println("\tch=" + a + ", left=" + left);
                    Integer val = set[a].higher(left-1);
                    if (val != null && val <= right) {
                        sum++;
                    }
                }
                ans.add(sum);
            }
        }

        return ans.toArray(new Integer[0]);
    }
}


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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    string S;
    std::cin >> S;
    auto ans = 700;
    REP(i, S.size()) {
        if(S[i] == 'o') ans += 100;
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256