akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.nextIntArray0indexed(n);

            int[] map = new int[n];
            for (int i = 0; i < n; i++) {
                map[a[i]] = i;
            }

            boolean[] next = new boolean[n - 1];
            for (int i = 0; i < n - 1; i++) {
                next[i] = map[i + 1] > map[i];
            }

            int ans = 1;
            int count = 1;
            for (int i = 0; i < n - 1; i++) {
                if (next[i]) {
                    count++;
                    ans = Math.max(ans, count);
                } else {
                    count = 1;
                }
            }

            out.println(n - ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray0indexed(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt() - 1;
            }
            return res;
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 45048
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

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




/******************************************************************************************/

template<typename T>
T LIS(vector<T>& a) {/*長さに対する最小の最終要素*/

	T siz = a.size();
	vector<T> dp(a.size() + 10, INF);

	for (T i = 0; i < siz; i++) {
		*lower_bound(dp.begin(), dp.begin() + siz, a[i]) = a[i];
	}
	return lower_bound(dp.begin(), dp.begin() + siz, INF) - dp.begin();
}

int main() {

	ll n;
	cin >> n;
	n--;
	cout << n * (n + 1) / 2 << endl;


	

	return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline

def main():
    N,A,B,C = map(int, input().split())
    L = []
    for _ in range(N):
        L.append(int(input()))
    mi = 1000*N
    for i in range(4**N):
        mp = 0
        a = b = c = 0
        x = 0
#        print(bin(i) + " ", end="")
        while i > 0:
            if i%4 == 1:
                if a > 0:
                    mp += 10
                a += L[x]
            if i%4 == 2:
                if b > 0:
                    mp += 10
                b += L[x]
            if i%4 == 3:
                if c > 0:
                    mp += 10
                c += L[x]
            i >>= 2
            x += 1
        if a > 0 and b > 0 and c > 0:
            mi = min(mi, mp + abs(A-a) + abs(B-b) + abs(C-c))
#            print(a,b,c,mi)
    print(mi)

if __name__ == '__main__':
    main()


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

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

ll power(ll  a, ll b){
   ll  ans = 1;
   while(b){
      if(b&1){
         ans *= a;
      }
      a *= a;
      b /= 2;
   }
   return ans;
}

int maxPoints(vector<int> &A, vector<int> &B) {
    // Do not write main() function.
    // Do not read input, instead use the arguments to the function.
    // Do not print the output, instead return values as specified

    int N = A.size();
    if(N <= 2) return N;
    int maxPoint = 0;
    int curMax, overlapPoints, verticalPoints;

    map < pair<int, int>, int> slopeMap;

    vector <pair <int,int> > points;
    for(int i = 0; i < N; i++){
        points.push_back({A[i], B[i]});
    }

    for (int i = 0; i < N; i++)
    {
        curMax = overlapPoints = verticalPoints = 0;


        for (int j = i + 1; j < A.size(); j++)
        {
            if (points[i] == points[j])
                overlapPoints++;

            else if (points[i].first == points[j].first)
                verticalPoints++;

            else
            {
                int yDif = points[j].second - points[i].second;
                int xDif = points[j].first - points[i].first;
                int g = gcd(xDif, yDif);
                yDif /= g;
                xDif /= g;

                // increasing the frequency of current slope
                // in map
                slopeMap[make_pair(yDif, xDif)]++;
                curMax = max(curMax, slopeMap[make_pair(yDif, xDif)]);
            }

            curMax = max(curMax, verticalPoints);
        }

        // updating global maximum by current point's maximum
        maxPoint = max(maxPoint, curMax + overlapPoints + 1);

        // printf("maximum colinear point which contains current
        // point are : %d\n", curMax + overlapPoints + 1);
        slopeMap.clear();
    }
    return maxPoint;

}


ll mod = 1e9+7;

ll arr[234561], b[12345], pre[223456], suff[223456];

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

  for(int i = 0; i < n; i++){
      cin >> arr[i];
      if(i == 0) pre[i] = arr[i];
      else pre[i] = pre[i-1]+arr[i];
  }

  for(int i = n-1; i >= 0; i--){
      if(i == n-1) suff[i] = arr[i];
      else suff[i] = suff[i+1]+arr[i];
  }
  vector <ll> vec;
  for(int i = 0; i < n-1; i++){
       vec.push_back(abs(pre[i]-suff[i+1]));
  }
  sort(vec.begin(), vec.end());
  cout << vec[0];
}



Measured memory_bytes: 7412
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
  ll n,i,a,b,c,d,e,j,ans;
  cin >> n;
  ll p[n];
  ll q[n];
  ll r[n];
  r[0]=1;
  p[0]=0;
  q[0]=0;
  a=0;
  b=0;
  for(i=1;i<=n;i++){
    r[i]=r[i-1]*i;
  }
  for(i=1;i<=n;i++){
    cin >> p[i];
    c=0;
    d=p[i];
    for(j=0;j<i;j++){
      e=p[j];
      if(e<d){
        c+=1;
      }
    }
    a+=r[n-i]*(d-c);
  }
  for(i=1;i<=n;i++){
    cin >> q[i];
    c=0;
    d=q[i];
    for(j=0;j<i;j++){
      e=q[j];
      if(e<d){
        c+=1;
      }
    }
    b+=r[n-i]*(d-c);
  }
  ans=a-b;
  if(ans<0)ans=-ans;
  cout << ans;
}

Measured memory_bytes: 256
from collections import defaultdict
from functools import reduce
from operator import mul

MOD = 10 ** 9 + 7

def nCr(n, r):
    r = min(r, n - r)
    if r == 0:
        return 1
    return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(1, r + 1))

N, M = map(int, input().split())

factors = defaultdict(int)
i = 2
while M > 1 and i * i <= M:
    while M % i == 0:
        M //= i
        factors[i] += 1
    i += 1 if i == 2 else 2
if M > 1:
    factors[M] += 1

ans = 1
for n in factors.values():
    ans *= nCr(N + n - 1, n)
    ans %= MOD
print(ans)


Measured memory_bytes: 3700
<?php
$input = trim(fgets(STDIN));
List($h, $w) = explode(" ", $input);

while(($h+$w) > 0) {

  $s = str_repeat("#", $w);
  for ($i=0; $i<$h; $i++) {
    echo $s.PHP_EOL;
  }
  echo PHP_EOL;

  $input = trim(fgets(STDIN));
  List($h, $w) = explode(" ", $input);
}

Measured memory_bytes: 15324
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    private int N,X;
    private int[]A;
    private void Scan()
    {
        var l=Console.ReadLine().Split(' ');
        N=int.Parse(l[0]);
        X=int.Parse(l[1]);
        l=Console.ReadLine().Split();
    
        A=new int[N];
        for(int i=0;i<N;i++)
        {
            A[i]=int.Parse(l[i]);
        }
    }
    
    
    public void Solve()
    {
        Scan();
        long ans=0;
        for(int i=1;i<N;i++)
        {
            int sum=A[i]+A[i-1];
            if(sum>X)
            {
                    ans+=(sum-X);
                    A[i]=Math.Max(0,A[i]-(sum-X));
                
            }
        }
        Console.WriteLine(ans);
    } 
    
    static void Main()
    {
        new Program().Solve();
    }
}

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

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      int c=0;
      for (String s : line)
        seqS[c++] = Integer.parseInt(s);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  }

  static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] > ref ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    }

    return false;
  }
}


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

#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(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N; cin >> N;
    if(N%2==0)cout << N << endl;
    else cout << 2*N << endl;

    return 0;
}

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

class Main {
	public static void main(String[] args){
	char s;
    InputStreamReader isr = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(isr);
	String str = null;
    try {
            str = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
      
      if(str.compareTo("a") < 0){
      	System.out.println("A");
      }
      else{
		System.out.println("a");
      }
        
    }
}

Measured memory_bytes: 32584
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define MOD 1000000007
typedef long long ll;

int main(){
	int a, b;
	scanf("%d%d", &a, &b);
	if(a <= b) printf("%d", a);
	else printf("%d", a - 1);
	return 0;
}

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

using namespace std;

int main()
{
    int ans=0,coun=0,i;
    string s;
    cin>>s;
    for(i=0;i<3;i++){
        if(s[i]=='R'){
            coun++;
        }
        else{
            ans=max(ans,coun);
            coun=0;
        }
    }
    ans=max(ans,coun);
           cout<<ans<<endl;
               return 0;
}

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

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

    int l = 0, r = 0;
    rep(i, m) {
        int a;
        cin >> a;
        if (a < x)
            l++;
        else
            r++;
    }

    cout << min(l, r) << endl;
    return 0;
}


Measured memory_bytes: 256
import collections
H, W = map(int, input().split())
s = [list(input()) for i in range(H)]

ans = H*W - 2
for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            ans -= 1
q = collections.deque()
q.append((0, 0, 0))
flag = False
while(q):
    x, y, d = q.popleft()
    if x == W-1 and y == H - 1:
        ans -= (d-1)
        flag = True
        break
    if y > 0 and s[y-1][x] == ".":
        q.append((x, y-1, d+1))
        s[y-1][x] = "#"
    if x > 0 and s[y][x-1] == ".":
        q.append((x-1, y, d+1))
        s[y][x-1] = "#"
    if y < H - 1 and s[y+1][x] == ".":
        q.append((x, y+1, d+1))
        s[y+1][x] = "#"
    if x < W - 1 and s[y][x+1] == ".":
        q.append((x+1, y, d+1))
        s[y][x+1] = "#"

if flag:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 3316
//Compete against Yourself.
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;


int n, m, x;

int32_t main(){_
   
   cin >> n >> m >> x;  
   
   if(n > m)
      swap(n, m);

   int ans = 0;

   int total = 0;
   for (int i = 0; i < n; ++i)
   {
      total += m;
      ans++;
      if(total >= x){
         cout<<ans;
         exit(0);
      }
   }

   return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
    int w, h, x, y, r;
    std::cin >> w >> h >> x >> y >> r;
    if(r <= x && r <= y && x <= (w-r) && y <= (h-r)){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define fi first
#define sz size 
#define len length 
#define se second 
const ll mod=998244353;
//const ll mod = 1000000000+7;
vector< int > tree[200000+5];
int ans[200000+5];
int arr[200000+5];
void dfs( int pos, int par,int value)
{
	value+=arr[pos];
	ans[pos]=value;
  for ( int i=0;i<tree[pos].sz();i++)
  {
  	if ( tree[pos][i]!=par)
      dfs( tree[pos][i],pos,value);
 
  }
  value-=arr[pos];
}
int main()
{
  int n,q;
  cin>>n>>q;
  memset( arr,0,sizeof ( arr));
  memset( ans,0,sizeof (ans));
  for ( int i=0;i<n-1;i++){
    int aa,bb;
    cin>>aa>>bb;
    tree[aa].push_back(bb);
    tree[bb].push_back(aa);
  }
 
     for ( int i=0;i<q;i++)
         {
           int aa,bb;
           cin>>aa>>bb;
           arr[aa]+=bb;
		   }
		   dfs(1,-100,0);
		for ( int i=1;i<=n;i++)
			cout<<ans[i]<<' ';
         
         
}
    

Measured memory_bytes: 27392
N,M=map(int,input().split())
MOD=10**9+7
import math
Nb=math.factorial(N)%MOD
Mb=math.factorial(M)%MOD

if abs(N-M)>=2:
    print(0)
elif abs(N-M)==1:
    print(Nb*Mb%MOD)
else:
    print(Nb*Mb*2%MOD)

Measured memory_bytes: 4140
#include<bits/stdc++.h>
using namespace std;
int a[3][3],b[105];
bool f[3][3];
int main(){
	int n;
	for(int i=0;i<3;i++)
	    for(int j=0;j<3;j++)
	        cin>>a[i][j];
	cin>>n;
	while(n--){
		int t; cin>>t;
		for(int j=0;j<3;j++)
		    for(int k=0;k<3;k++){
		    	if(a[j][k]==t) f[j][k]=true;
			}
	}
	if(f[0][0]&&f[1][0]&&f[2][0]||f[0][1]&&f[1][1]&&f[2][1]||f[0][2]&&f[1][2]&&f[2][2]) cout<<"Yes";
	else if(f[0][0]&&f[0][1]&&f[0][2]||f[1][0]&&f[1][1]&&f[1][2]||f[2][0]&&f[2][1]&&f[2][2])
	    cout<<"Yes";
	else if(f[0][0]&&f[1][1]&&f[2][2]||f[2][0]&&f[1][1]&&f[0][2]) cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

int main()
{
    long long n,i,j;
    cin>>n;
    long long a[n+2];
    if((n%2)==1)
    {
        for(i=0; i<n; i++)
        {
            cin>>a[i];
        }
        for(i=n-1; i>=0; i-=2)
        {
            cout<<a[i]<<" ";
        }

        i+=2;
        for(j=i+1; j<n; j+=2)
        {
            cout<<a[j]<<" ";
        }
    }
    else
    {
        for(i=0; i<n; i++)
        {
            cin>>a[i];
        }
        for(i=n-1; i>=0; i-=2)
        {
            cout<<a[i]<<" ";
        }
        for(j=i+1; j<n; j+=2)
        {
            cout<<a[j]<<" ";
        }
    }
    return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <math.h> 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    return true;
}
int main(){
    int a;
    std::cin >> a;
    for (int i = a; i < 1000000; i ++){
        if (IsPrime(i)){
            std::cout << i;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long x,a,b;
	while(scanf("%lld %lld %lld",&x,&a,&b)!=EOF)
	{
		if(b-a<=0)
		printf("delicious\n");
		else if(b-a<=x)
		printf("safe\n");
		else
		printf("dangerous\n");
	}
	return 0;
}

Measured memory_bytes: 128
/*
*/

//#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 300031;

int ar[1000];

int n,m,d[20][20];
int ans;

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

	cin>>n>>m;
	for (int i=0;i<=9;i++){
		for (int j=0;j<=9;j++){
			cin>>d[i][j];
		}
	}
	for (int k=0;k<=9;k++){
		for (int i=0;i<=9;i++){
			for (int j=0;j<=9;j++){
				d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}

	for (int i=0;i<n;i++){
		for (int j=0;j<m;j++){
			int x;
			cin>>x;
			if (x==-1)
				continue;
			ans+=d[x][1];
		}
	}

	cout<<ans<<endl;

	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';


using namespace std;

int main(void){
    ld p[1001];
    rep(i, 1000) p[i+1]=((ld)(i+2)/2);
    
    ll N, K, po;
    cin>>N>>K;
    ld sigma[200005];
    sigma[0]=(ld)0;
    rep(i, N+1){
        if(i==0) continue;
        cin>>po;
        //cout<<p[po]<<endl;
        sigma[i]=(ld)sigma[i-1]+(ld)p[po];
        //cout<<setprecision(10)<<po<<sp<<sigma[i]<<endl;
    }
    ld Maxim=0;
    rep(i, N-K+1){
        //cout<<Maxim<<endl;
        Maxim=max(Maxim, sigma[i+K]-sigma[i]);
    }
    cout<<setprecision(10)<<Maxim<<endl;
    return 0;
}


Measured memory_bytes: 3328
n,m=map(int,input().split())
v=[0]*n
w=[0]*n
for i in range(n):
    v[i],w[i]=map(int,input().split())
dp=[0]*(m+1)
for i in range(n):
    for j in range(1,m+1):
        if j>=w[i]:
            dp[j]=max(dp[j],dp[j-w[i]]+v[i])
print(dp[m])


Measured memory_bytes: 5720
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define ALLG(v) v.begin(), v.end() ,greater<int>()
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll GCD(ll x, ll y) { return y ? GCD(y, x % y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }
ll GetDigit(ll num) {
	ll digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}

using namespace std;
int main() {
	int n;
	cin >> n;
	map<string, int> map;
	for (int i = 0; i < n; i++)
	{
		string temp;
		cin >> temp;
		map[temp]++;
	}

	int ans = 0;
	for (auto ss : map)
	{
		ans++;
	}

	cout << ans << endl;

}

Measured memory_bytes: 19200
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
using ll = long long int;

// to format a document: ctrl + K -> ctrl + D

int main() {
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;

    cout << max({ A1, A2, A3 }) - min({ A1, A2, A3 }) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<queue>
#include<set>
#include<map>
#include<stack>
#define i64 long long
#define vi32 vector<int>
#define vi64 vector<long long>
#define  ii pair<i64,i64>
const long long mod = 1000000007LL, inf = 1e9, linf = 1e18;
using namespace std;
#define pb push_back
#define mp make_pair
#define N 1000005	
using namespace std;
int n, m;
i64 f[N];
ii ckt[N];
bool cmd(ii a, ii b)
{
	if (a.first == b.first)return a.second > b.second;
	return a.first > b.first;
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++)cin >> f[i];
	for (int i = 1; i <= m; i++)cin >> ckt[i].second >> ckt[i].first;
	sort(f + 1, f + 1 + n);
	sort(ckt + 1, ckt + 1 + m,cmd);
 
	for (int i = 1, p = 1; i <= n, p <= m;)
	{
		if (ckt[p].first < f[i])break;
		while (i<=n&&ckt[p].second && ckt[p].first > f[i])
		{
			f[i] = ckt[p].first;
			ckt[p].second--;
			i++;
		}
		p++;
	}
	for (int i = 1; i <= n; i++)f[0] += f[i];
	cout << f[0];
}

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

int main(){
  int d,n;
  cin>>d>>n;
  if(d==0&&n!=100){
    cout<<n<<endl;
  }
  else if(d==0&&n==100){
    cout<<101<<endl;
  }
  else if(d==1&&n!=100){
    cout<<n*100<<endl;
  }
  else if(d==1&&n==100){
    cout<<10100<<endl;
  }
  else if(d==2&&n!=100){
    cout<<n*10000<<endl;
  }
  else if(d==2&&n==100){
    cout<<1010000<<endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, K;
i64 A[1010];
vector<i64> sums;

int cntt(i64 a)
{
	int ret = 0;
	for (i64 v : sums) if ((v & a) == a) ++ret;
	return ret;
}
int main()
{
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; ++i) scanf("%d", A + i);

	for (int i = 0; i < N; ++i) {
		i64 acc = 0;
		for (int j = i; j < N; ++j) {
			acc += A[j];
			sums.push_back(acc);
		}
	}

	i64 mask = 0;

	for (i64 i = 40; i >= 0; --i) {
		if (cntt(mask | (1LL << i)) >= K) mask |= (1LL << i);
	}
	printf("%lld\n", mask);
	return 0;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
 
using namespace std;
 
#define BOOST        std::ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define sp           <<" "<<
#define ll           long long
#define ld           long double
#define For(i,k,n)   for(ll i=k;i<n;i++)
#define Ford(i,n)    for(ll i=n-1;i>=0;i--)
#define AZI(i,x)     for(auto i=x.begin();i!=x.end();i++)
#define AZ(x)        x.begin(),x.end()
#define P(x,y)       pair < x,y >
#define V(x)         vector < x >
#define fi           first
#define se           second
#define pb           push_back
#define mp           make_pair
#define PI           3.14159265358979323846264338327950288419716939937510
 
const ll mod=1e9+7,N=1e6+5;
string ans="",s,t;

int dp[3005][3005]={};

// int lcs(int i,int j)
// {
//     if(i==s.length() || j==t.length())
//         return 0;

//     if(dp[i][j]!=0)
//         return dp[i][j];

//     if(s[i]==t[j])
//     {
//         dp[i][j] = 1+lcs(i+1,j+1);
//         return dp[i][j];
//     }

//     int a = lcs(i+1,j), b = lcs(i,j+1);
//     dp[i][j] = max(a,b);
//     return dp[i][j];
// }

// void Lcs(int i,int j)
// {
//     if(i==s.length() || j==t.length())
//         return;

//     if(s[i]==t[j])
//     {
//         ans+=s[i];
//         Lcs(i+1,j+1);
//     }

//     else if(dp[i+1][j]>=dp[i][j+1])
//         Lcs(i+1,j);
    
//     else
//         Lcs(i,j+1);
// }


int main() 
{ 
    BOOST

    cin>>s>>t;

    int n = s.length()-1, m = t.length()-1; 

    for(int i = n; i >= 0; i--)
    {
        for(int j = m; j >= 0; j--)
        {
            if( s[i] == t[j])
                dp[i][j] = dp[i+1][j+1] + 1;

            else
                dp[i][j] = max(dp[i+1][j],dp[i][j+1]);
        }
    }

    // for(int i=0;i<=n;i++)
    // {
    //     for(int j=0;j<=m;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<"\n";
    // }

    int i=0,j=0;

    while(i<=n && j<=m)
    {
        if(s[i] == t[j])
            ans+=s[i],i++,j++;
        
        else if(dp[i+1][j] >= dp[i][j+1])
            i++;
        
        else
            j++;
    }
    
    cout<<ans<<"\n"; 
    
    return 0; 
} 

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

int main(){
    int n;
    cin>>n;
    long long x=1,y=1;
    for(int i=0;i<n;i++){
        long long t,a;
        cin>>t>>a;
        long long ma=max((x-1+t)/t,(y-1+a)/a);
        x=ma*t,y=ma*a;
    }
    cout<<x+y<<endl;
}

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

int main() {
  int N, X;
  scanf("%d %d", &N, &X);
  int ans = N, min = 1001, usePow = 0;

  for (int k = 0; k < N; k++) {
    int t;
    scanf("%d", &t);
    if (min > t) min = t;
    usePow += t;
  }

  ans += (X - usePow) / min;

  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int h,w;
int maps[101][101];
int check[101][101];
int dy[]={-1,0,1,0};
int dx[]={0,-1,0,1};
int color;
int sy,sx,gy,gx;
int by0[]={0,0,1,1,0,0,1,1};
int bx0[]={0,1,1,0,2,3,2,3};
int by1[]={0,0,1,1,2,3,2,3};
int bx1[]={0,1,1,0,0,0,1,1};

bool solve(int y,int x);
  
int main(){
  int n,c,d,x,y;
  while(cin>>w>>h,w|h){
    cin>>sx>>sy;
    cin>>gx>>gy;
    cin>>n;
    memset(check,0,sizeof(check));
    for(int i=0;i<n;i++){
      cin>>c>>d>>x>>y;
      x--;y--;
      if(d==0){
	for(int i=0;i<8;i++){
	  maps[y+by0[i]][x+bx0[i]]=c;
	}
      }
      if(d==1){
	for(int i=0;i<8;i++){
	  maps[y+by1[i]][x+bx1[i]]=c;
	}
      }
    }
    sy--;sx--;gy--;gx--;
    color=maps[sy][sx];
    if(solve(sy,sx))cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
  }
}

bool solve(int y,int x){
  check[y][x]=1;
  if(y==gy && x==gx)return true;
  bool b=false;
  for(int i=0;i<4;i++){
    int ny=y+dy[i];
    int nx=x+dx[i];
    if(ny>=0 && ny<h && nx>=0 && nx<w && maps[ny][nx]==color && check[ny][nx]==0){
      b=b | solve(ny,nx);
    }
  }
  return b;
}
       
	
  

Measured memory_bytes: 1220
def read():
    return int(input())


def readlist():
    return list(map(int, input().split()))


def readmap():
    return map(int, input().split())


A = input()
L = len(A)


def ctoi(char):
    return ord(char) - 97


cnt = [0] * 26

for a in A:
    cnt[ctoi(a)] += 1

ans = 1 + (L * (L - 1)) // 2
for n in cnt:
    ans -= (n * (n - 1)) // 2

print(ans)

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

struct edge{
  int64_t to;
  int64_t cost;
};


using P = pair<int64_t,int64_t>;

const int MAX_N = 2500*50;
const int64_t INF = 1e18;
vector<edge> G[MAX_N];
vector<int64_t> dist(MAX_N,INF);

void dijkstra(int s){
  priority_queue<P,vector<P>,greater<P>> PQ;
  dist[s] = 0;
  PQ.push(P(0,s));
  
  while(PQ.size()){
    P p = PQ.top();
    PQ.pop();
    int64_t v = p.second; //from
    if(dist[v] < p.first){ //現在わかっている距離が更新できない
      continue;
    }
    int GS = G[v].size();
    for(int i=0; i<GS; i++){
      edge e = G[v][i];
      if(dist[e.to] > dist[v] + e.cost){
        dist[e.to] = dist[v] + e.cost;
        PQ.push(P(dist[e.to], e.to));
      }
    }
  }
}

int main(){
  int64_t N, M, S;
  cin >> N >> M >> S;
  int A = 2500;
  for(int i=0; i<M; i++){
    int64_t u,v,a,b;
    cin >> u >> v >> a >> b;
    u--; v--;
    for(int j=A-1; j>=0; j--){
      if(j - a < 0){
        break;
      }
      else{
        edge add = {A*v + (j-a) ,b};
        G[A*u + j].push_back(add);
        //cout << v << " " << j - a << " " << u << " " << j << endl;
      }
    }
    for(int j=A-1; j>=0; j--){
      if(j - a < 0){
        break;
      }
      else{
        edge add = {A*u + (j-a) ,b};
        G[A*v + j].push_back(add);
      }
    }
  }
  
  for(int i=0; i<N; i++){
    int64_t c, d;
    cin >> c >> d;
    for(int j=0; j<A; j++){
      if(j+c >= A){
        edge add = {A*i + (A-1), d};
        G[A*i + j].push_back(add);
      }
      else{
        edge add = {A*i + j + c, d};
        G[A*i + j].push_back(add);
      }
    }
  }
  
  dijkstra(min(S,(int64_t)2499));
  vector<int64_t> ans(N,INF);
  for(int i=0; i<N*A; i++){
    ans[i/A] = min(ans[i/A], dist[i]);
  }
  for(int i=0; i<100; i++){
    //cout << A*1- i << ":" << dist[A*1 - i] << " ";
  }
  for(int i=1; i<N; i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 23712
#include <bits/stdc++.h>
#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) loop(i, 0, n)
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << endl

using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  LL nums[S.length()];
  LL sum = 0;
  for (int i = 0; i < S.length(); ++i)
  {
    nums[i] = stol(S.substr(S.length() - 1 - i, 1));
  }

  debug(S);
  // 組み合わせ,
  for (int i = 0; i < (1 << S.length() - 1); ++i)
  {
    debug(i);
    int kugiri = 1;
    for (int j = 0; j < S.length(); ++j)
    {
      if (i & (1 << j))
      {
        sum += nums[j] * kugiri;
        kugiri = 1;
      }
      else
      {
        sum += nums[j] * kugiri;
        kugiri = kugiri * 10;
      }
      debug(sum);
    }
  }
  cout << sum << endl;
  return 0;
}


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

const int N=1e6+5;
int n,m,fa[N],sz[N];
long long pr,ans[N];
pair<int,int> p[N];

int getfa(int x)
{
	if(fa[x]!=x) fa[x]=getfa(fa[x]);
	return fa[x];
}

int main()
{
	int i;
	scanf("%d%d",&n,&m);
	ans[m]=pr=1LL*n*(n-1)>>1;
	for(i=1;i<=n;++i) fa[i]=i,sz[i]=1;
	for(i=1;i<=m;++i) scanf("%d%d",&p[i].first,&p[i].second);
	for(i=m;i>1;--i)
	{
		int fx=getfa(p[i].first);
		int fy=getfa(p[i].second);
		if(fx==fy)
		{
			ans[i-1]=pr;
			continue;
		}
		pr-=1LL*sz[fx]*sz[fy];
		sz[fx]+=sz[fy];
		fa[fy]=fx;
		ans[i-1]=pr;
	}
	for(i=1;i<=m;++i) printf("%lld\n",ans[i]);
	return 0;
}

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

int main()
{
    string S;
    int ans = 0;

    cin >> S;

    for(int i = 1; i < S.size() / 2; i++) {
        if(S.substr(0, i) == S.substr(i, i)) {
            ans = i;
        }
    }

    cout << ans * 2 << endl;

    return (0);
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a:i128 = read();
    let v:i128 = read();
    let b:i128 = read();
    let w:i128 = read();
    let t:i128 = read();
    let mut add = 0;

    if a < 0 && b > 0 || a > 0 && b < 0 {
        add = a.abs() + b.abs();
    } else {
        add = (a - b).abs();
    }

    if v * t >= w * t + add {
        println!("YES");
    } else {
        println!("NO");
    }
}

Measured memory_bytes: 2156
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;
int main(void){
    // Your code here!
    int N,A,B;
    vector<int> nums;
    cin >> N >> A >> B;
    for(int i = 1; i <= N; i++)
    {
        int tpnum = i;
        int nmsum = 0;
        while(tpnum > 0)
        {
            nmsum += tpnum % 10;
            tpnum = tpnum / 10;
        }
        if(nmsum >= A && nmsum <= B)
        {
            nums.push_back(i);
        }
    }
    cout << accumulate(nums.begin(),nums.end(),0) << endl;;
}


Measured memory_bytes: 384
from collections import defaultdict

n,m = list(map(int, input().split(" ")))
dic = defaultdict(lambda : [0,0])

for i in range(m):
    task,status = input().split(" ")
    if status == "AC":
        dic[task][0] += 1
    if dic[task][0] == 0 and status == "WA":
        dic[task][1] += 1

acCnt = 0
waCnt = 0

for _, v in dic.items():
    a,b = v
    if a > 0:
        acCnt += 1
        waCnt += b
print(str(acCnt) + " " + str(waCnt))    


Measured memory_bytes: 25684
n=int(input())
a=1
for i in range(n):
    if a%3==0:
        print(" "+str(a),end="")
        a=a+1
    elif a%10==3:
        print(" "+str(a),end="")
        a=a+1
    elif 30<=a%100<=39:
        print(" "+str(a),end="")
        a=a+1
    elif 300<=a%1000<=399:
        print(" "+str(a),end="")
        a=a+1
    elif 3000<=a<=3999:
        print(" "+str(a),end="")
        a=a+1
    else:
        a=a+1
print()


Measured memory_bytes: 5868
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    int N;
    cin >> N;
    vector<int> P(N);
    vector<pll> p(N);
    rep(i, N) {
        cin >> P[i];
        p[i] = {P[i], i};
    }

    sort(all(p));

    int right = 0, cnt = 1;
    int ans = 0;
    while (right < N - 1) {
        if (p[right].second <= p[right + 1].second) {
            cnt++;
        } else {
            ans = max(ans, cnt);
            cnt = 1;
        }
        right++;
    }
    ans = max(ans, cnt);

    cout << N - ans << endl;
}

Measured memory_bytes: 7016
h1 = Hash.new(0)
loop {
    i, k = gets.split(",").map &:to_i
    break if !k
    h1[i] += 1
}
h2 = Hash.new(0)
loop {
    s = gets
    break if !s
    i, k = s.split(",").map &:to_i
    h2[i] += 1
}
(h1.keys & h2.keys).sort.each{|i|
    puts "#{i} #{h1[i] + h2[i]}"
}

Measured memory_bytes: 6096
#include<cstdio>
#include<cstring>
typedef long long ll;
const int lgv=30,maxn=1e5;
int n,k,a[maxn+10],b[maxn+10]; bool zero[lgv+10]; ll ans=0;
inline void solve(){
	ll v=0;
	for(int i=1;i<=n;++i){
		bool suc=1;
		for(int j=0;j<=lgv;++j) if(zero[j]&&(a[i]&(1<<j))){
			suc=0; break;
		}
		if(suc) v+=b[i];
	}
	if(v>ans) ans=v;
}
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i) scanf("%d%d",&a[i],&b[i]);
	for(int i=lgv;i>=0;--i){
		if(k&(1<<i)){
			zero[i]=1; solve(); zero[i]=0;
		}else{
			zero[i]=1;
		}
	}
	solve(); printf("%lld",ans); return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ;
  cin >> n ;
  ll ans = 0 ;
  for(int i=1; i<=n;i++){
    if(i%3!=0 && i%5!=0){
      ans += i ;
    }
  }
  
  cout << ans <<endl ;
  
  
  
  return 0 ;
}




Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <numeric>
#include <map>
#include <sstream>
#include <bitset>
using namespace std;


int main()
{
    int N;
    int b[110];
    cin>>N;
    for(int i=1;i<N+1;i++){
        cin>>b[i];
    }
    vector<int> v;
    for(int i=N;0<i;i--){
        for(int j=i;0<j;j--){

            if(j==b[j]){
                v.push_back(j);
                if(j!=i){
                    for(int p=j+1;p<i+1;p++){
                        b[p-1]=b[p];
                    }
                    }
                break;
                
            }
            
            
            
        }
    }
    
    if(v.size()!=N){
        cout<<-1<<endl;
    }
    else{
        for(auto itr=v.rbegin();itr!=v.rend();itr++){
            cout<<*itr<<endl;
        }
    }
    
    
}


Measured memory_bytes: 256
#include<stdio.h>
main(){
  int a,b,x,y,z=0,i;
  while(1){
    scanf("%d%d",&a,&b);
    if(a==0&&b==0){break;}
    if(a>=b){
      x=a;
      y=b;
    }
    else{x=b;
      y=a;
    }
    while(1){
      x%=y;
      i=x;
      x=y;
      y=i;
      z++;
      if(y==0)
	{
break;}
    }
    
    printf("%d %d\n",x,z);
  z=0;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <math.h> 
#include <string> 
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;

int main() {

	string S; cin >> S;
	int A, B, C, D; A = (S[0]) - 48; B = S[1] - 48; C = S[2] - 48; D = S[3] - 48;

	if (A + B + C + D == 7) {cout << A << "+" << B << "+" << C << "+"; goto koko;}
	if (A + B + C - D == 7) {cout << A << "+" << B << "+" << C << "-"; goto koko;}
	if (A + B - C + D == 7) {cout << A << "+" << B << "-" << C << "+"; goto koko;}
	if (A + B - C - D == 7) {cout << A << "+" << B << "-" << C << "-"; goto koko;}
	if (A - B + C + D == 7) {cout << A << "-" << B << "+" << C << "+"; goto koko;}
	if (A - B + C - D == 7) {cout << A << "-" << B << "+" << C << "-"; goto koko;}
	if (A - B - C + D == 7) {cout << A << "-" << B << "-" << C << "+"; goto koko;}
	if (A - B - C - D == 7) {cout << A << "-" << B << "-" << C << "-"; goto koko;}

koko:
	cout << D << "=7" << endl;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amax(T& a,T b){ if(a>b) a=b;}


int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int h,a, ans =0;
	cin >>h >>a;
	

	cout << (h+a-1)/a <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, c = 0;
    pii a[200005] = {};
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i].second >> a[i].first;
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++) {
        c += a[i].second;
        if (c > a[i].first) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define l(a,b) for(int a=0;a<b;a++)
int main(void){
    // Your code here!
    int a;
    cin>>a;
    if(a%2==0){
        cout<<a/2;
    }
    else{
        cout<<(a+1)/2;
    }
}


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) {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
                String[] tokens = line.split(" ");
                int result = Integer.parseInt(tokens[1]) / Integer.parseInt(tokens[0]);
                System.out.println(result < Integer.parseInt(tokens[2]) ? result : Integer.parseInt(tokens[2]));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}


Measured memory_bytes: 21716
#include<stdio.h>
#include<string.h>

int main(void)
{
    char s[100],len;
    scanf("%s",s);
    len = strlen(s);
    int i;
    int flag = 0;

    for(i=0;i<len;i++){
        if(s[i]=='C'){
            flag = 1;
        }
        if(s[i]=='F' & flag==1){
            printf("Yes");
            return 0;
        }
    }

    printf("No");
    return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		if(a == 1){
			a = 14;
		}
		if(b == 1){
			b = 14;
		}
		if(a == b){
			System.out.println("Draw");
		} else if(a > b){
			System.out.println("Alice");
		}else if(a < b){
			System.out.println("Bob");
		}
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21972
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
	
#define int long long
#define double long double 
#define PI 3.141592653589793
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
// Use for file I/O;
#define FIN string _fname = "paintbarn"; \
			string _is = _fname + ".in", _os = _fname + ".out"; \
			freopen(_is.c_str(), "r", stdin); \
			freopen(_os.c_str(), "w", stdout);

using namespace std;
	
int gcd(int a, int b) {
    while (b > 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}

const int INF = 4e18 + 10;
const int INF2 = 2e18 + 10;
const int INF3 = 2e10;
const int MAXN = 100000;
const int LOGN = 19;
const int MOD = 1e9 + 7;
const int EPS = 1e-9;
const int MULT = 2e5;
const int MCNST = MOD * MOD * 8;

int32_t main() {
	FAST;

	string s, t;
	cin >> s >> t;
	int n = s.size();
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] != t[i]) ans++;
	}
	cout << ans;
}

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

using namespace std;

const int N = 1555;
const int INF = 1e9;

typedef pair<int, int> ii;

int n, m;
int max_dis;
int dis[N][N];
bool vis[N], vis2[N];
vector<ii> G[N];

void calc(int r) {
	for (int i = 1; i <= n; ++i) dis[r][i] = INF;
	priority_queue< ii, vector<ii>, greater<ii> > pq;
	pq.push(ii(0, r)), dis[r][r] = 0;
	while (pq.size()) {
		ii u = pq.top(); pq.pop();
		if (u.first != dis[r][u.second]) continue; 
		for (auto i : G[u.second]) {
			ii v = ii(u.first + i.first, i.second);
			if (dis[r][v.second] > v.first) {
				dis[r][v.second] = v.first, pq.push(v);
			}
		}
	} 
}

void solve(int r) {
	queue<int> qu;
	for (int i = 1; i <= n; ++i) {
		if (dis[r][i] == max_dis) {
			vis[i] = 1, qu.push(i);
		}
		else vis[i] = 0;
	}
	while (qu.size()) {
		int u = qu.front(); qu.pop(), vis2[u] = 1;
		for (auto v : G[u]) {
			if (dis[r][v.second] + v.first == dis[r][u] && !vis[v.second]) {
				vis[v.second] = 1, qu.push(v.second);
			} 
		} 
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for (int i = 1; i <= m; ++i) {
		int u, v, w; cin >> u >> v >> w;
		G[u].push_back(ii(w, v));
		G[v].push_back(ii(w, u));
	}
	for (int i = 1; i <= n; ++i) calc(i);
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) max_dis = max(max_dis, dis[i][j]);
	}
	for (int i = 1; i <= n; ++i) solve(i);
	int cnt = 0;
	for (int i = 1; i <= n; ++i) if (!vis2[i]) cnt++;
	cout << cnt << '\n';
	for (int i = 1; i <= n; ++i) if (!vis2[i]) cout << i << '\n';
}


Measured memory_bytes: 12464