akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int N,L;
    cin >> N >> L;
    vector<string> w;
    string a;
    rep(i,N) {
        cin >> a;
        w.push_back(a);
    }
    sort(ALL(w));
    rep(i,w.size()) cout << w[i];

    return 0;
}

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

const int MAX = 510000;
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;
}

long long Per(int n, int k)
{
	if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[n - k] % MOD;
}


int main()
{
	COMinit();
	int N,M;
	cin >> N >> M;
	ll tmp = 0;
	for (int i = 1; i <= N; ++i)
	{
		if (i % 2 == 1) tmp = (tmp + COM(N,i) * Per(M,i) % MOD * (Per(M-i,N-i) * Per(M-i,N-i) % MOD) % MOD) % MOD;
		else tmp = (tmp + MOD - COM(N,i) * Per(M,i) % MOD * (Per(M-i,N-i) * Per(M-i,N-i) % MOD) % MOD) % MOD;
	}
	ll ans = ((Per(M,N) * Per(M,N) % MOD) + MOD - tmp) % MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15564
#include <iostream>
//#include <string>
#include <algorithm>
using namespace std;
typedef unsigned int u_i;

int main(){

 	int n,count=0;
  	cin >> n;
  	if(n<3){
      cout << count << endl;
      return 0;
    }
  	u_i l[n],mx;
  	for(int i=0; i<n; ++i){
      cin >> l[i];
    }
	for(int i=0; i<n-2; ++i){
      for(int j=i+1; j<n-1; ++j){
        for(int k=j+1; k<n; ++k){
          mx = max({l[i],l[j],l[k]});
          if((mx<l[i]+l[j]+l[k]-mx) && (l[i]!=l[j] && l[i]!=l[k] && l[k]!=l[j]) ){
            count++;
          }
        }
      }
    }
  	
  
  	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3616
n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()
print('-1 -1 -1')


Measured memory_bytes: 40684
import java.util.Scanner;

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

        // 入力(A B C)
        String a = sc.next();
        String b = sc.next();
        String c = sc.next();

        System.out.println((isConnect(a, b) && isConnect(b, c)) ? "YES" : "NO");
        sc.close();
    }

    private static boolean isConnect(final String x, final String y) {
        return x.charAt(x.length() - 1) == y.charAt(0);
    }
}


Measured memory_bytes: 35756
#include <iostream>
#include <algorithm>
#include <limits>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <cmath>

using namespace std;

int n;
long long min_sum;

int main() {
    scanf("%d", &n);
    int prev = 0, cur;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &cur);
        if (prev > cur) {
            min_sum += (prev - cur);
        } else {
            prev = cur;
        }
    }
    printf("%lld\n", min_sum);

    return 0;
}


Measured memory_bytes: 3820
#include <stdio.h>

int main(){
  int a,i,j,n,k,s[100],b[100][100];
  while(scanf("%d %d",&n,&k),n!=0){
    a=0;
    for(i=0;i<k;i++) scanf("%d",&s[i]);
    for(i=0;i<n;i++) for(j=0;j<k;j++) scanf("%d",&b[i][j]);
    for(i=0;i<k;i++){
      for(j=0;j<n;j++){
        if((s[i]-=b[j][i])<0){ a=1;break;}
      }
      if(a==1) break;
    }
    if(a==1) printf("No\n"); else printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 620
S = input()
T = input()
s = len(S)
t = len(T)
# Sの何文字目からTが開始されるか 1~ s-t+1
# Tと合致していない数の最小を探索
ans = t
for i in range(s-t+1):
    cnt = 0
    for j in range(t):
        if S[i+j] != T[j]:
            cnt += 1
    ans = min(ans,cnt)
print(ans)

Measured memory_bytes: 9028
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

bool isPrime(int n){
	for(int i=2;i*i<=n;i++)
		if(n%i==0)return false;
	return true;
}
int main(){
	int n;
	while(cin>>n&&n){
		int ans=0;
		for(int i=n+1;i<=2*n;i++)if(isPrime(i))ans++;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define INF 1e9
using namespace std;

int n,m;
int c[20];
int num[50001];

int dfs(int j){
  if(j==0) return 0;
  if(j<0) return INF;
  if(num[j]>0) return num[j];

  int res=INF;
  for(int i=0;i<m;i++){
    if(j>=c[i]){
      res=min(res,dfs(j-c[i])+1);
      num[j]=res;
    }
  }

  return res;
}
  
int main(){

  cin>>n>>m;
  for(int i=0;i<m;i++) cin>>c[i];

  cout<<dfs(n)<<endl;

  return 0;
}



Measured memory_bytes: 5628
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  long long C[500],S[500],F[500];
  for(int i=0;i<N-1;i++) cin>>C[i]>>S[i]>>F[i];
  for(int i=0;i<N-1;i++){
    long long answer=S[i]+C[i];
    for(int j=i+1;j<N-1;j++){
      if(answer<S[j]) answer=S[j]+C[j];
      else answer+=(F[j]-answer%F[j])%F[j]+C[j];
    }
    cout<<answer<<endl;
  }
  cout<<0<<endl;
  
  return 0;
}

Measured memory_bytes: 3208
#include <vector>
#include <list>
#include <map>
#include <set>
#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 <queue>

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int,int>;
#define SORT(v, n) sort(v, v+n);
#define ALL(v) v.begin(),v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v),greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)),v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i = (b-1); i >= a; i--)
#define rrep(i,n) RFOR(i,0,n)
#define INF 999999999
#define mins(a,b) a = min(a,b)
#define maxs(a,b) a = max(a,b)

//4近傍
//int dy[]={0, 0, 1, -1};
//int dx[]={1, -1, 0, 0};

//8近傍
int dy[]={0,0,1,-1,1,1,-1,-1};
int dx[]={1,-1,0,0,1,-1,1,-1};

ll mod = 1000000007;

void solve() {
    int n,k; cin >> n >> k;
    vector<bool> flag(10,true);
    int d;
    rep(i,k){
        cin >> d;
        flag[d] = false;
    }
    int ans = n;
    while(1){
        int a = 0;
        string s = to_string(ans);
        rep(i,s.size()){
            if(!flag[int(s[i])-48]){
                a = 1;
                break;
            }
        }
        if(a == 0) break;
        ans++;
    }
    cout << ans << endl;
}

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

    solve();

    return 0;
}

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

#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

bool C(int x){
    for(int i=2;i*i<=x;i++)if(x%i==0)return false;
    return true;
}

signed main(){
    int T;cin>>T;
    int ans=0;
    while(T--){
        int n;cin>>n;
        ans+=C(n);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1156
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
            out.flush();
        }
    }

    private void solve(InputReader in, PrintWriter out) {
        int min = in.nextInt();
        in.nextInt();
        in.nextInt();
        in.nextInt();
        int max = in.nextInt();
        int k = in.nextInt();
        out.println((max - min) > k ? ":(" : "Yay!");
    }
}

class InputReader implements AutoCloseable {
    private final Scanner sc = new Scanner(System.in);

    String next() {
        return this.sc.next();
    }

    int nextInt() {
        return Integer.parseInt(this.sc.next());
    }

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

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

    @Override
    public void close() {
        this.sc.close();
    }
}


Measured memory_bytes: 22868
N=int(input())
d=[]
d0=[]
d1=[]
for i in range(N):
  d.append(list(map(int,input().split())))
for i in range(N):
  if d[i][2]==0:
    d0.append(d[i])
  else:
    d1.append(d[i])
cx=0
cy=0
for x in range(101):
  for y in range(101):
    H=d1[0][2]+abs(x-d1[0][0])+abs(y-d1[0][1])
    c=0
    for i in range(len(d1)):
      if max((H-abs(x-d1[i][0])-abs(y-d1[i][1])),0)==d1[i][2]:
        c+=1
    if c==len(d1):
      cx=x
      cy=y
      cnt=0
      for j in range(len(d0)):
        if max((H-abs(x-d0[j][0])-abs(y-d0[j][1])),0)==0:
          cnt+=1
      if cnt==len(d0):
        ans=[cx,cy,H]
  else:
    continue
  break
for i in range(len(ans)):
  print(ans[i],end=' ')

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

#define ll long long
#define fast_in_out  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{
    fast_in_out;
    string s;
    cin >> s;
    int l = s.length();
    ll n = 0;
    for(int i = 0; i < l; i++)
    {
        int x = s[i] - '0';
        n += x;
    }
    if(n % 9 == 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b[1000000],c=10000000,d=0;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b[i];
  }
  sort(b,b+a,greater<int>());
  for(int i=0;i<a;i++){
    if(c>b[i]){
      d++;
      c=b[i];
    }
  }
  cout<<d<<"\n";
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String str = null;
		try {
			str = in.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String[] input = str.split(" ");
		Integer ballCnt = Integer.parseInt(input[0]);
		Integer colorCnt = Integer.parseInt(input[1]);

		if (1 > ballCnt || 1000 < ballCnt) {
			System.out.println("input N error");
		}
		if (2 > colorCnt || 1000 < colorCnt) {
			System.out.println("input K error");
		}

		int result = 0;
		for (int i = 0; i < ballCnt; i++) {
			if (i == 0) {
				result = colorCnt;
			} else {
				result *= (colorCnt - 1);
			}
		}

		System.out.println(result);

	}
}


Measured memory_bytes: 8020
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> a >> b >> c >> d;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
  
  if(a+b > c+d) anss = "Left";
  else if(a+b < c+d) anss = "Right";
  else anss = "Balanced";
  
  cout << anss << endl;

}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
import numpy as np

def scores(c, s, t):
    last = [0] * 26
    V = []
    lastv = 0
    for d, i in enumerate(t):
        last[i] = d+1
        v = s[d*26+i]
        sub = sum([c[j]*(d+1-last[j]) for j in range(26)])
        # print(v, sub)
        lastv += v-sub
        V.append(lastv)
    return V


def main():
    D, *cs = map(int, read().split())
    c = cs[:26]
    s = cs[26:-D]
    t = [x-1 for x in cs[-D:]]

    v = scores(c, s, t)
    print(*v, sep='\n')
    # c = cs[:26]
    # s = cs[26:]
    # print(D, c)
    # print(s)

if __name__ == '__main__':
    main()

Measured memory_bytes: 27224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int ans = 1;
    while(n--) {
        if(ans * 2 > ans + k) ans += k;
        else ans *= 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3656
N,M = list(map(int,input().split()))
A = []
for i in range(N):
    B = list(input())
    if "#" in B: 
        A.append(B)
    else:
        pass
after_A = []
Fafter_A = []
for i in range(M):
    C = ""
    for j in range(len(A)):
        C += A[j][i]
    after_A.append(C)
for i in range(M):
    if "#" in after_A[i]: 
        Fafter_A.append(after_A[i])
    else:
        pass
for i in range(len(A)):
    D = ""
    for j in range(len(Fafter_A)):
        D += Fafter_A[j][i]
    print(D)

Measured memory_bytes: 3188
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   int a[4],b[4];
   int hit,blow;
   while(cin>>a[0])
   {
     hit=blow=0;
     for(int i=1;i<4;i++) cin>>a[i];
     for(int i=0;i<4;i++) cin>>b[i];
     for(int i=0;i<4;i++) if(a[i]==b[i]) hit++;
     for(int i=0;i<4;i++)
     {
       for(int j=0;j<4;j++)
       {
         if(j==i) j++;
         if(a[i]==b[j]) blow++;        
       }        
     }
     cout<<hit<<" "<<blow<<endl;
   }
   //while(1);      
   return 0;    
 }

Measured memory_bytes: 3016
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    
    int[] a = new int[n];
    a[0] = sc.nextInt();
    boolean nextBuy = true;
    for(int i = 1; i < n;){
      int a_i = sc.nextInt();
    
      if(nextBuy){
        if(a[i-1] > a_i){
          a[i-1] = a_i;
          n--;
        } else {
          a[i] = a_i;
          i++;
          nextBuy = !nextBuy;
        }
      } else {
        if(a[i-1] < a_i){
          a[i-1] = a_i;
          n--;
        } else {
          a[i] = a_i;
          i++;
          nextBuy = !nextBuy;
        }
      }
    }
    
    long money = 1000l;
    if(n == 1){
      System.out.println(money);
      return;
    }
    
    nextBuy = true;
    long cnt = 0;
    for(int i = 0; i < n; i++){
      
      if(i == n-1 && nextBuy){
        break;
      }

      if(nextBuy) {
        
        cnt = money / (long)a[i];
        money -= cnt * (long)a[i];
        
        nextBuy = !nextBuy;
      } else {
        
        money += cnt * (long)a[i];
        
        nextBuy = !nextBuy;
      }
    }
    
    System.out.println(money);
  }
}


Measured memory_bytes: 27172
#include<iostream>
using namespace std;
int X;
int main(){
  cin >> X;
  if(400 <= X && X <= 599) cout << 8 << endl;
  else if (600 <= X && X <= 799) cout << 7 << endl;
  else if (800 <= X && X <= 999) cout << 6 << endl;
  else if (1000 <= X && X <= 1199) cout << 5 << endl;
  else if (1200 <= X && X <= 1399) cout << 4 << endl;
  else if (1400 <= X && X <= 1599) cout << 3 << endl;
  else if (1600 <= X && X <= 1799) cout << 2 << endl;
  else cout << 1 << endl;
return 0;
}

Measured memory_bytes: 3640
H, W = map(int, input().split())
S = [input() for _ in range(H)]

dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]

def longest_BFS(h, w):
    ret = -1
    if S[h][w] == '#':
        return -1
    table = [[-1 for i in range(W)] for j in range(H)]
    table[h][w] = 0
    next_step = [[h, w]]
    while next_step:
        ret += 1
        step = next_step[:]
        next_step = []
        while step:
            u = step.pop()
            for i in range(4):
                if u[0]+dx[i] >= 0 and u[0]+dx[i] < H \
                    and u[1]+dy[i] >= 0 and u[1]+dy[i] < W \
                    and S[u[0]+dx[i]][u[1]+dy[i]] == '.' \
                    and table[u[0]+dx[i]][u[1]+dy[i]] == -1:
                    next_step += [[u[0]+dx[i], u[1]+dy[i]]]
                    table[u[0]+dx[i]][u[1]+dy[i]] = ret

    return ret

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans, longest_BFS(h, w))
print(ans)



Measured memory_bytes: 3188
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize,
        k: usize,
        hs:[usize;n]
    }
    hs.iter().filter(|h| **h >= k).count().to_string()
}
test! {
    "4 150\n150 140 100 200" => "2",
    "1 500\n499" => "0",
    "5 1\n100 200 300 400 500" => "5"
}


Measured memory_bytes: 4352
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,w;
    cin>>h>>w;
    string paths[h];
    for (int i=0;i<h;i++) cin>>paths[i];
    long long int dp[h][w];
    int mod = 1000000007;
    for (int i=0;i<h;i++)
    {
        for (int j=0;j<w;j++)
        {
            if (i==0 && j==0) dp[i][j] = 1;
            else if  (i==0) dp[i][j] = paths[i][j]=='#'?0:dp[i][j-1];
            else if  (j==0) dp[i][j] = paths[i][j]=='#'?0:dp[i-1][j];
            else {
                dp[i][j] = paths[i][j]=='#'?0:dp[i-1][j]+dp[i][j-1];
            }
            dp[i][j] = dp[i][j]%mod;
        }
    }
    cout<<dp[h-1][w-1];
}

Measured memory_bytes: 9088
#include <bitset>
#include <iostream>

using ull = unsigned long long;
using bitset = std::bitset<32>;

int main(void) {
    ull a, b;
    std::cin >> a >> b;

    bitset bitset_a(a);
    bitset bitset_b(b);

    std::cout << (bitset_a & bitset_b).to_string() << std::endl;
    std::cout << (bitset_a | bitset_b).to_string() << std::endl;
    std::cout << (bitset_a ^ bitset_b).to_string() << std::endl;
}


Measured memory_bytes: 3136
#include <iostream>
using namespace std;
int main(void)
{
	double x[4];
	double y[4];
	int n;
	cin >> n;
	while(n--){
		for(int i=0; i<4; i++){
			cin >> x[i] >> y[i];
		}
		double d1,d2;
		d1 = (y[1]-y[0])/(x[1]-x[0]);
		d2 = (y[3]-y[2])/(x[3]-x[2]);
		if(d1==d2) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define in freopen("input.txt", "r" ,stdin)
#define out freopen("output.txt", "w" , stdout)
#define ll long long
#define inf 200005
#define fr first
#define  sc second
#define pb push_back
#define p_b pop_back
#define mp make_pair
using namespace std;
int n;
int a[100005] , b[100005] , c[100005];
int dp[100005][4];
int main (){
//in;out;
ios_base::sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; i++) {
     cin >> a[i] >> b[i] >> c[i];
}
dp[1][1] = a[1];
dp[1][2] = b[1];
dp[1][3] = c[1];
for (int i = 2; i  <= n; i++) {
dp[i][1] = max (dp[i-1][2] , dp[i-1][3]) + a[i];
dp[i][2] = max (dp[i-1][1] , dp[i-1][3]) + b[i];
dp[i][3] = max (dp[i-1][2] , dp[i-1][1]) + c[i];
}

int ans = max (dp[n][1] , max (dp[n][2] , dp[n][3]));

cout << ans;
}


Measured memory_bytes: 2944
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int n = sc.nextInt() - 1;
		int m = sc.nextInt();
		
		long s[] = new long[n+1];
		
		for(int i =0 ; i < n ; i++){
			s[i+1] = s[i] + sc.nextInt();
		}
		
		int p  =0;
		long ans = 0;
		for(int i = 0 ;i  < m ;i++){
			int p2 = sc.nextInt();
			ans += Math.abs(s[p2+p] - s[p]);
			p = p+p2;
		}
		System.out.println(ans%100000);
		
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
void solve(long long A, long long B){
  ll cnt=0;
  ll now=1;
  while(1){
    if(now>=B){
      break;
    }
    cnt++;
    now+=(A-1);
  }
  op(cnt)
}

// 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)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	int n, m;
	cin >> n >> m;
	int ans = 1900 * m + 100 * (n - m);
	for (int i = 0; i < m; i++) {
		ans *= 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
while 1:
	n=input()
	if n==0:break
	games=[map(int,raw_input().split()) for i in range(n)]
	ls=[]
	for game in games:
		score,flame,thrw=0,1,1
		while thrw<len(game):
			if flame<10:
				if game[thrw]==10:
					score+=sum(game[thrw:thrw+3])
					thrw+=1
				elif game[thrw]+game[thrw+1]==10:
					score+=sum(game[thrw:thrw+3])
					thrw+=2
				else:
					score+=game[thrw]+game[thrw+1]
					thrw+=2
				flame+=1
			else:
				score+=game[thrw]
				thrw+=1
		ls.append([game[0],score])
	for k,s in sorted(sorted(ls),key=lambda x:x[1],reverse=True):
		print k,s

Measured memory_bytes: 4272
# 解説AC, add の部分を自分で作れなかった


def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [(a, i+1) for i, a in enumerate(A)]
    B.sort(reverse=True)
    B.append((0, 0))
    ans = [0]*(N+1)
    idx = N+1
    for i in range(N):
        add = (i+1)*(B[i][0] - B[i+1][0])
        idx = min(idx, B[i][1])
        ans[idx] += add
    print(*ans[1:], sep="\n")


if __name__ == '__main__':
    main()


Measured memory_bytes: 67684
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long lli;

class p {
public:
	lli num;
	int idx;
	p(lli num, int idx)
		:num(num), idx(idx)
	{}
};

vector<p> v1, v2;
int n;

void process(vector<int>& v) {
	vector<int> res;
	int dif1 = v[0] - 1;
	for (int i = 0; i < dif1; i++)
		res.push_back(1);
	for (int i = 0; i < v.size(); i++)
		v[i] -= dif1;
	int cur = n - dif1;
	while (cur != v.back()) {
		res.push_back(cur--);
	}
	for (int i = 0; i < v.size() - 1; i++) {
		while (v[i] != v[i + 1]) {
			res.push_back((v[i] + v[i + 1]) / 2);
			for (int j = i + 1; j < v.size(); j++)
				v[j] -= 2;
		}
	}
	printf("%d\n", (int)res.size());
	for (int i = 0; i < res.size(); i++)
		printf("%d\n", res[i]);
}

int main() {
	scanf("%d", &n);
	lli mx = -(1LL << 60);
	int idx;
	for (int i = 1; i <= n; i++) {
		lli x;
		scanf("%lld", &x);
		if (x > mx) {
			mx = x; idx = i;
		}
		if (i % 2) v1.push_back(p(x, i));
		else v2.push_back(p(x, i));
	}
	if (mx <= 0) {
		vector<int> v;
		v.push_back(idx);
		printf("%lld\n", mx);
		process(v);
		return 0;
	}
	lli r1 = 0, r2 = 0;
	for (int i = 0; i < v1.size(); i++) {
		if (v1[i].num > 0) r1 += v1[i].num;
	}
	for (int i = 0; i < v2.size(); i++) {
		if (v2[i].num > 0) r2 += v2[i].num;
	}
	vector<int> v;
	if (!v1.empty() && (v2.empty() || r1 > r2)) {
		printf("%lld\n", r1);
		for (int i = 0; i < v1.size(); i++) {
			if (v1[i].num > 0) v.push_back(v1[i].idx);
		}
	} else {
		printf("%lld\n", r2);
		for (int i = 0; i < v2.size(); i++) {
			if (v2[i].num > 0) v.push_back(v2[i].idx);
		}
	}
	process(v);
	return 0;
}

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

int main()
{
  int K,N;
  int p[1000];
  int tmp;
  long int sum=0;

  cin >> N >> K;

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

  for(int i=0; i<N; ++i)
  {
    for(int j=0; j<N-1; ++j)
    {
      if(p[j] > p[j+1])
      {
        tmp = p[j];
        p[j] = p[j+1];
        p[j+1] = tmp;
      }
    }
  }

  for(int i=0; i<K; ++i)
  {
    sum += p[i];
  }

  cout << sum << endl;

  //cout << fixed << setprecision(8) << s << " " << l << " " << endl;

  return 0;
}



Measured memory_bytes: 3636
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int city = sc.nextInt(), road = sc.nextInt();
        int[] result = new int[city];
        while(sc.hasNextInt()) {
            int i = sc.nextInt();
            result[i - 1] += 1;
        }
        for (int r : result) {
            System.out.println(r);
        }
    }
}


Measured memory_bytes: 21716
import math
a,b,x = (int(i) for i in input().split())

v0 = (a**2)*b
v1 = 0.5*(a**2)*b
ans = 0
if x >= v1:
    v = v0 - x
    ans = math.degrees(math.atan(2.0*v/(a**3)))
else:
    ans = math.degrees(math.atan(a*b*b/(2.0*x)))

print(ans)

Measured memory_bytes: 3064
def insertionSort(a, n, g):
    cnt = 0

    for i in range(g, n):
        v = a[i]
        j = i - g

        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1

        a[j+g] = v

    return (cnt, a)

def shellSort(a, n):
    cnt = 0

    for i in g(n):
        c, a = insertionSort(a, n, i)
        cnt += c

    return (cnt, a)

def g(n):
    nums = []

    h = 1
    while True:
        nums.append(h)
        h = 3*h+1

        if n < h:
            break

    return list(reversed(nums))

def main():
    n = int(input())

    a = []
    for _ in range(n):
        a.append(int(input()))

    G = g(n)
    cnt, a = shellSort(a, n)

    print(len(G))
    print(' '.join([str(x) for x in G]))
    print(cnt)
    for x in a:
        print(x)

if __name__ == '__main__':
    main()



Measured memory_bytes: 45532
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>


using namespace std;


int main() {

	int H, W;
	string *C;

	cin >> H >> W;

	C = new string[H];

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

	for (int i = 0; i < H; i++) {
		cout << C[i] << "\n" << C[i] << "\n";
	}

	return 0;
}


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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> food(m, 0);
  REP(i,n){
    int k;
    cin >> k;
    REP(j,k){
      int food_num;
      cin >> food_num;
      food[food_num-1]++;
    }
  }
  int ans = 0;
  REP(i,m){
    if(food[i]==n) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,h,w,a[52][52];
  char s[50],x[50][50];
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++){
      scanf("%s",s);
      for(j=0;j<w;j++){
          x[i][j]=s[j];
      }
    }
  for(i=0;i<=h+1;i++){
    for(j=0;j<=w+1;j++){
      a[i][j]=0;
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(x[i-1][j-1]=='#'){
        a[i-1][j-1]++;
        a[i-1][j]++;
        a[i-1][j+1]++;
        a[i][j-1]++;
        a[i][j+1]++;
        a[i+1][j-1]++;
        a[i+1][j]++;
        a[i+1][j+1]++;
      }
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(x[i-1][j-1]=='#'){printf("#");}
      else{printf("%d",a[i][j]);}
    }
    printf("\n");
  }
}

Measured memory_bytes: 128
local function getgcd(x, y)
  while 0 < x do
    x, y = y % x, x
  end
  return y
end

local function getlcm(x, y)
  local gcd = getgcd(x, y)
  return (x // gcd) * y
end

local n, m = io.read("*n", "*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n") // 2
end
local valid = true
local cur = a[1]
for i = 2, n do
  local gcd = getgcd(cur, a[i])
  if (cur // gcd) % 2 == 0 or (a[i] // gcd) % 2 == 0 then
    valid = false
    break
  end
  cur = (cur // gcd) * a[i]
  if m < cur then
    valid = false
    break
  end
end
if valid then
  local c = m // cur
  print(math.ceil(c / 2))
else
  print(0)
end


Measured memory_bytes: 2424
import numpy as np
s=np.array(list(map(int,input())))
a=[1 if i%2==0 else 0 for i in range(len(s))]
b=[0 if i%2==0 else 1 for i in range(len(s))]

a=np.array(a)
b=np.array(b)

c=s-a
d=s-b

print(min(np.count_nonzero(c!=0),np.count_nonzero(d!=0)))

Measured memory_bytes: 16488
import sys
from collections import defaultdict
def cnt_multiple(s, p):
    # ABC158E, ABC164D
    n = len(s)
    if p != 2 and p != 5:
        a = []
        t = 1
        for i in range(n-1, -1, -1):
            a.append((ord(s[i])-ord("0")) * t % p)
            t = t * 10 % p
        cum = [0]
        for v in a:
            cum.append((cum[-1] + v) % p)

        dic = defaultdict(int)
        ans = 0
        for v in cum:
            ans += dic[v]
            dic[v] += 1
        return ans
    elif p == 2:
        ans = 0
        for i in range(n):
            if (ord(s[i]) - ord("0")) % 2 == 0:
                ans += i+1
        return ans
    else:
        ans = 0
        for i in range(n):
            if (ord(s[i]) - ord("0")) % 5 == 0:
                ans += i+1
        return ans
s = str(input())
n = len(s)
p = 2019

print(cnt_multiple(s, p))


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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n; cin>>n;
    string ans;
    while (n>0){
    	n--;
    	ans+=(char)('a'+n%26);
    	n/=26;
    }

    reverse(ans.begin(), ans.end());
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;
constexpr double EPS = 1e-10;

ll v[44], w[44];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll N, W; cin >> N >> W;
    REP(i,N) cin >> v[i] >> w[i];

    int n1 = N/2;
    int n2 = N - n1;
    vector<pair<ll,ll> > group;
    for(int bit = 0; bit < (1<<n1); ++bit) {
        ll value = 0, weight = 0;
        for(int i=0;i < n1;++i) {
            if(bit & (1<<i)) {
                value += v[i];
                weight += w[i];
            }
        }
        if(W < weight) continue;
        group.emplace_back(weight, value);
    }
    sort(group.begin(),group.end());

    int t = 1;
    for(int i=1; i < (int)group.size(); ++i) {
        if(group[t-1].second < group[i].second) group[t++] = group[i];
    }
    group.resize(t);

    ll ans = 0;
    for(int bit = 0; bit < (1<<n2); ++bit) {
        ll value = 0, weight = 0;
        for(int i=0; i < n2; ++i) {
            if(bit & (1<<i)) {
                value += v[n1 + i];
                weight += w[n1 + i];
            }
        }
        if(W < weight) continue;
        ll val = (lower_bound(group.begin(), group.end(), make_pair(W-weight, INF)) - 1)->second;
        ans = max(ans, val + value);
    }

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 19488
/// {{{
#include "bits/stdc++.h"
#define   ALL(x)  x.begin(), x.end()
#define   iostreamBooster()  do{cin.tie(nullptr);ios::sync_with_stdio(false);}while(0)
#define   rep(i, s, t)       for(int i = int(s); i < int(t); ++i)
using namespace std;
typedef long long i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}


signed main()
{
  iostreamBooster();

  int N;
  string s[105];
  int p[105];

  cin >> N;
  rep(i, 0, N) {
    cin >> s[i] >> p[i];
  }

  vector<int> ord(N);
  iota(ALL(ord), 0);

  sort(ALL(ord), [&](int i, int j) { return (s[i] == s[j]) ? (p[i] > p[j]) : (s[i] < s[j]); });

  rep(i, 0, N) {
    cout << ord[i]+1 << '\n';
  }
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <sstream>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using boost::string_ref;

using namespace std;

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

    size_t k;
    string s;
    cin >> s >> k;
    
    set<string_ref> substrs;
    
    for(size_t l = 1; l <= s.size(); ++l)
    {
       for(size_t i = 0; i < s.size() - l + 1; ++i)
        {
            const auto ss = string_ref(&s[i], l);
            //cout << '(' << i << ',' << l << ')' << ' ' << ss << '\n';
            if(substrs.size() < k)
            {
                substrs.insert(ss);                
            }
            else if(ss < *--end(substrs))
            {
                substrs.insert(ss);
                if(substrs.size() > k)
                {
                    substrs.erase(--end(substrs));
                }
            }
            //copy(begin(substrs), end(substrs), ostream_iterator<string>(std::cout, " ")); cout << endl;
        }
    }
    
    cout << *next(begin(substrs), k-1) << '\n';

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
  int N;
  unsigned long ans1,ans2=0;
  cin>>N;
  vector<int> high(N);
  
  for(int i=0;i<N;i++){
    cin>>high.at(i);
  }
  
  for(int j=1; j<N;j++){
    if(high.at(j)<high.at(j-1)){
      
      ans1=high.at(j-1)-high.at(j);
      ans2+=ans1;
      high.at(j)=high.at(j-1);
    }
  }
  cout<<ans2<<endl;
  return 0;
  
  
}

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

int main(){
    string l, r;
    cin >> l >> r;
    int li, ri;
    cin >> li >> ri;
    string d;
    cin >> d;
    
    if (l == d){
        cout << li - 1 << " " << ri << endl;
    }else{
        cout << li << " "  << ri - 1 << endl;
    } 
}


Measured memory_bytes: 256
import numpy as np
import sys
input = sys.stdin.readline

N, M, Q = map(int, input().split())
city = np.zeros((N + 2, N + 1), dtype=np.int)

for _ in range(M):
    L, R = map(int, input().split())
    city[L][R] += 1

np.cumsum(city, axis=0, out=city)
np.cumsum(city, axis=1, out=city)

for _ in range(Q):
    p, q = map(int, input().split())
    print(city[q][q] - city[q][p - 1] - city[p - 1][q] + city[p - 1][p - 1])

Measured memory_bytes: 15288
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int masu = scan.nextInt();
		long[] height = new long[masu];
		int count = 0;
		int max = 0;

		for(int i=0;i<masu;i++) {
			height[i] = scan.nextLong();
		}

		for(int i=0;i<masu-1;i++) {
			if(height[i] >= height[i+1]) {
				count++;
			}else {
				count = 0;
			}
			if(max<count) {
				max = count;
			}
		}

		System.out.println(max);
		scan.close();

	}

}


Measured memory_bytes: 53036
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i = 0;i < (int)s.size();i++){
    if(i == 4){
      cout << " ";
    }
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>F
int main() {

  double a,b,c;
  double S,L2, L, h;

  scanf("%lf %lf %lf",&a,&b,&c);

  S = 0.5*a*b*sin(c*3.14159265359/180);
  L2 = a*a+b*b-2*a*b*cos(c*3.1415926359/180);
  L = sqrt(L2)+a+b;
  h = 2*S/a;

  printf("%.11lf\n%.11lf\n%.11lf\n",S ,L,h); 

  return 0;
}



Measured memory_bytes: 2104
let dbg = Printf.printf "[debug]%s"

let max_num = 1_000_000_000

let id = fun x -> x
let tuple2 x y = (x,y)
let succ x = x + 1
let pred x = x - 1

let (++) n m =
  let rec aux i =
    if i = m then [m]
    else i :: aux (i+1) in
  if n > m then [] else aux n

let (++^) n m = n ++ (m-1)

let scan fmt f = Scanf.sscanf (read_line ()) fmt f

let scan_lines n fmt f =
  List.map (fun _ -> scan fmt f) (0++^n)

let scan_matrix n m e conv =
  let arr = Array.make_matrix n m e in
  Array.iteri (fun i line ->
      let s = Scanf.Scanning.from_string @@ read_line () in
      Array.iteri (fun j _ ->
          arr.(i).(j) <- Scanf.bscanf s " %s" conv;
        ) line) arr; arr

let between n x m = n <= x && x < m

let string_to_list s =
  List.map (String.get s) (0 ++^ String.length s)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let mid = (l + u) /2 in
      if f mid then
        aux l mid
      else aux mid u
    else u in aux (-1) n


let n = scan "%d" id
let ls = scan_lines n "%d" id

let arr = Array.make n 0

let rec solve len = function
  | [] -> len
  | v::rest ->
    if len = 0 || arr.(pred len) < v then
      (arr.(len) <- v;
       solve (succ len) rest)
    else
      let i = lower_bound len (fun i -> v <= arr.(i)) in
      arr.(i) <- v;
      solve len rest

let () =

  Printf.printf "%d\n" @@ solve 0 ls



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

bool solved[200005];
int wa[200005];

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n,m;cin>>n>>m;
  int ans=0,ng=0;

  for(int i=0;i<m;i++){
    int p;string s;cin>>p>>s;p--;
    if(solved[p])continue;
    if(s=="WA")wa[p]++;
    if(s=="AC"){
      solved[p]=true;
      ans++;
      ng+=wa[p];
    }
  }
  cout<<ans<<' '<<ng<<endl;

  
  return 0;
}


Measured memory_bytes: 896
'use strict'

const main = arg => {
    const input = arg.trim().split("\n");
    const rectangle = [];
    input.some(str => {
        if(str === "0 0"){ return true; } //break;
        const num = str.split(" ");
        const height = parseInt(num[0], 10);
        const width = parseInt(num[1], 10);

        [...Array(height)].forEach((obj, h) => {
            var len = "";
            [...Array(width)].forEach((obj,w) => {
                if(h % 2 === 0){
                    len += w % 2 === 0 ? "#" : ".";
                } else {
                    len += w % 2 === 0 ? "." : "#";
                }
            });
            rectangle.push(len);
        });
        rectangle.push("");
    });

    console.log(rectangle.join("\n"));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 20672
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define PB push_back
#define in insert
#define MP make_pair
#define F first
#define S second
 void faster()
 {
 	ios_base::sync_with_stdio(false);
 	cin.tie(NULL);
 	cout.tie(NULL);
 }
 void inout()
 {
 	freopen("in.txt","r",stdin);
 	freopen("out.txt","w",stdout);
 }
 void solve()
 {
 	ll n;
 	cin>>n;
 	multiset<ll>s;
 	ll ara[n+10],cnt[1000010]={0};
 	ll sum=0;
 	for(int i=1;i<=n;i++)
 	{
 		cin>>ara[i];
 		sum+=ara[i];
 		s.in(ara[i]);
 		cnt[ara[i]]++;
 	}
 	ll q;
 	cin>>q;
 	while(q--)
 	{
 		ll a,b;
 		cin>>a>>b;
 		ll k=cnt[a];
 		sum-=(k*a);
 		cnt[a]=0;
 		sum+=(k*b);
 		cnt[b]+=k;
 		cout<<sum<<endl;
 	}
 }
 int main()
 {
 	faster();
 	//inout();
 	solve();
 	return 0;

 }


Measured memory_bytes: 16880
import sys

def func(op, val):
    target = []

    for i, o in enumerate(op):
        if sum([val[k] for k in o]) == 0:
            return []
        k0 = o[0]
        k1 = o[1]
        if val[k0] == 0:
            p,m = k0,k1
        elif val[k1] == 0:
            p,m = k1,k0
        elif i < len(op)-1 and k1 in op[i+1]:
            p,m = k1,k0
        else:
            p,m = k0,k1
        val[p] += 1
        val[m] -= 1
        target.append(p)
    return target

n,a,b,c = [int(x) for x in input().split()]
operation = [sys.stdin.readline().strip() for _ in range(n)]
val = {'A':a, 'B':b, 'C':c}

target = func(operation,val)

if len(target) == 0:
    print("No")
else:
    print("Yes")
    for t in target:
        print(t)

Measured memory_bytes: 16984
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const ll M = 1000000007;

struct BIT{
	int s[1<<18];
	void init(){
		rep(i,(1<<18))s[i] = 0;
	}
	void add(int k,int x){
		while(k > 0){
			s[k] += x;
			k -= k&-k;
		}
	}
	int sum(int k){
		int ret = 0;
		while(k < (1<<18)){
			ret += s[k];
			k += k&-k;
		}
		return ret;
	}
}bit;

int main(){
	static int n,m;
	static int l[300010],r[300010];
	scanf("%d%d",&n,&m);
	rep(i,n)scanf("%d%d",&l[i],&r[i]);

	bit.init();
	
	vector<P> vec;
	rep(i,n)vec.pb(P(r[i]-l[i]+1,i));
	sor(vec);
	int k = 0;
	rep1(i,m){
		while(k < vec.size() && vec[k].fr < i){
			bit.add(l[vec[k].sc]-1,-1);
			bit.add(r[vec[k].sc],1);
			k ++;
		}
		int ret = n-k;
		for(int j = 1; i*j <= m ; j ++){
			ret += bit.sum(i*j);
		}
		printf("%d\n",ret);
	}
}
	



Measured memory_bytes: 7920
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 100002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()
int32_t main()
{ 
   IOS
 
  
  int n;
  cin >> n;
  int rem = 1000 - n%1000;
  if(rem == 1000){
    cout<<0<<endl;
  }
  else{
    cout<<rem<<endl;
  }
    



  




  
}

Measured memory_bytes: 3644