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


const int maxn = 1e6+1000;

typedef long long LL;
const int INF = 0x3f3f3f3f;


struct HeapNode
{
    int u,w;
    HeapNode(int u = 0,int w = 0):u(u),w(w) {}
    bool operator < (const HeapNode& rhs) const {
        return w > rhs.w;
    }
};

struct Edge
{
    int from,to,w;
    Edge(int u = 0,int v = 0,int w = 0):from(u),to(v),w(w) {}
};

struct Dijkstra
{
    vector<Edge> edges;
    vector<int> G[maxn];
    int d[maxn];
    bool done[maxn];


    void init()
    {
        for(int i = 0;i < maxn;++i)
            G[i].clear();
        edges.clear();
    }


    void addEdge(int from,int to,int w)
    {
        edges.push_back(Edge(from,to,w));
        int m = edges.size();
        G[from].push_back(m-1);
    }


    void getRes(int s)
    {
        memset(d,INF,sizeof(d));
        memset(done,0,sizeof(done));
        priority_queue<HeapNode> Q;
        Q.push(HeapNode(s,0));
        d[s] = 0;
        while(!Q.empty())
        {
            HeapNode now = Q.top(); Q.pop();

            int u  = now.u;
            if(done[u]) continue;
            done[u] = 1;
            for(int i = 0;i < G[u].size();++i)
            {
                Edge& e = edges[G[u][i]];
                if(d[e.to] > d[u] + e.w)
                {
                    d[e.to] = d[u] + e.w;
                    Q.push(HeapNode(e.to,d[e.to]));
                }
            }
        }
    }
};

Dijkstra D;

vector< pair<int,int> > G[maxn];
vector<int> C[maxn];

int cur[maxn];
int vis[maxn];
int n,m;

int Q[maxn];

int main()
{
   // freopen("./test.txt","r",stdin);
    scanf("%d %d",&n,&m);

    int Maxid = 0;
    for(int i = 1;i <= m;++i)
    {
        int a,b,id;
        scanf("%d %d %d",&a,&b,&id);
        Maxid = max(Maxid,id);
        G[a].push_back(make_pair(id,b));
        G[b].push_back(make_pair(id,a));
        C[id].push_back(a);
        C[id].push_back(b);
    }

    for(int i = 1;i <= m;++i)
    {
        sort(G[i].begin(),G[i].end());
        cur[i] = 0;
    }
    memset(vis,-1,sizeof(vis));


    int idx = n;
    for(int color = 1;color <= Maxid;++color)
    {
        for(int i = 0;i < C[color].size();++i)
        {
            int s = C[color][i];
            if(vis[s] == color) continue;

            int head = 0,tail = 0;
            Q[tail++] = s;
            vis[s] = color;

            while(head < tail)
            {
                int u = Q[head++];
                for(int &i = cur[u];i < G[u].size();++i)
                {
                    int tc = G[u][i].first;
                    if(tc != color) break;

                    int v = G[u][i].second;
                    if(vis[v] != color)
                    {
                        vis[v] = color;
                        Q[tail++] = v;
                    }
                }
            }


            idx++;
            for(int i = 0;i < tail;++i)
            {
                int v = Q[i];
                D.addEdge(idx,v,0);
                D.addEdge(v,idx,1);
            }

        }

    }

    D.getRes(1);
    int res = D.d[n];
    if(res == INF)
        res = -1;
    printf("%d\n",res);


    return 0;
}




Measured memory_bytes: 112552
#include <iostream>

int main()
{
    std::string s;
    std::cin >> s;
    bool is_heisei;

    std::string year = s.substr(0, 4);
    int n = atoi(year.c_str());
    
    if (n < 2019) {
        is_heisei = true;
    } else if (n > 2019) {
        is_heisei = false;
    } else {
        std::string month = s.substr(5, 2);
        n = atoi(month.c_str());

        if (n <= 4) {
            is_heisei = true;
        } else {
            is_heisei = false;
        }
    }

    if (is_heisei) {
        std::cout << "Heisei" <<std::endl;
    } else {
        std::cout << "TBD" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int c[10][10];
int main() {
  int h,w;
  cin >> h >> w;
  rep(i,10)rep(j,10) cin >> c[i][j];
  rep(k,10)rep(i,10)rep(j,10) if(c[i][j]>c[i][k]+c[k][j]) c[i][j] = c[i][k]+c[k][j];
  int ans = 0;
  rep(i,h*w){
    int a;
    cin >> a;
    if(a!=-1) ans += c[a][1];
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
//
//AOJ vol1 109
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0109&lang=jp
//2017/07/10
//640009E
//Yang Bo
//

#include <iostream>
#include <cctype>

using namespace std;

string S;
size_t cur = 0;

//string?????°??????int???"??°???"???????????????
int digit()
{
  int n = S[cur] - '0';
  cur++; //cur?????????????????????????????????(?¬??????°??????)
  //cout << "cur_digit = " << cur << endl;
  return n;
}

//?????????????????????????????????????????????????????????
int number()
{
  int n = digit();
  while (cur < S.size() && isdigit(S[cur])) //?????¨?????¨???????????°
    n = n * 10 + digit();
  //cout << "cur_number = " << cur << endl;
  return n;
}

int expression(); //??£?¨?

//??¬??§????????§?????????
int brackets()
{
  //??¬??§???????????´???
  if (S[cur] != '(')
    return number();
  //??¬??§???????????´???
  cur++;
  int n = expression();
  cur++; //')'??????????????????????????????
  //cout << "cur_brackets = " << cur << endl;
  //cout << "n = " << n << endl;
  return n;
}

//????????????????????????
int term()
{
  int a = brackets(); //????????????????????°
  while (cur < S.size() && (S[cur] == '*' || S[cur] == '/')) {
    char op = S[cur++];
    int b = brackets(); //???????????????????????°(?¶????????????°?????????)
    if (op == '*')
      a *= b;
    else if (op == '/')
      a /= b;
  }
  //cout << "cur_term = " << cur << endl;
  //cout << "a_term = " << a << endl;
  return a;
}

//????????????????????????
int expression()
{
  int a = term(); //????????????????????°
  while (cur < S.size() && (S[cur] == '+' || S[cur] == '-')) {
    char op = S[cur++]; //cur?????????????????????????????????(?????????????????????)
    int b = term(); //???????????????????????°(?¶????????????°?????????)
    if (op == '+')
      a += b;
    else if (op == '-')
      a -= b;
  }
  //cout << "cur_expression = " << cur << endl;
  //cout << "a_expression = " << a << endl;
  return a;
}

int main()
{
  int n; cin >> n;
  while (n-- > 0) {
    cur = 0;
    cin >> S;
    int a = expression();
    cout << a << endl;
  }
}

/*
  ?????£??¨?????????????????´??\??\??????????????????????????????????????¨????????????????????§????????????????????????????????£????????§?????????
  ?????????????????????????§????????????§????????±????????????????????????????§£???????????????
  11.A??????????????????????????§????????????????§£?????????????????????????????£???????????£??????????????????????????????
  ???????????????????????????????????°???2??\????????????cur?????°?????????????????°?????¨?°???\???????????????cur???0??????????????????????????°?????????????????¨????°???\?????????????????????????????£??????
  ????????¨?????\????????????????????£???Encryption System?????¢??????????????£????????§????????????????????¨???????§£??????????????????
*/

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

int main() {
  int n;
  cin >> n;
  
  
  for(;n>1000;){
    n -=1000;
  }
  
  n = 1000-n;
  
  cout << n << endl;
  return 0;
  
  
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
const int N = 505;

int C[N][N];
int cache[N][N];

int main() {
    int n, m, q;
    scanf("%d %d %d", &n, &m, &q);
    for(int i = 1; i <= m; ++i) {
        int x, y;
        scanf("%d %d", &x, &y);
        C[x][y]++;
    }

    for(int i = n; i >= 1; i--)
        for(int j = 1; j <= n; ++j) {
            cache[i][j] = C[i][j] + cache[i][j - 1] + cache[i + 1][j] - cache[i + 1][j - 1];
        }

    while(q--) {
        int x, y;
        scanf("%d %d", &x, &y);
        printf("%d\n", cache[x][y]);
    }
}

Measured memory_bytes: 2944
unittest
{
	assert( [ "20 12 6" ].solve == 12 );
	assert( [ "1000 1 1000" ].solve == 1000000 );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto x = 0L;
	auto t = 0L;
	input.front.formattedRead!"%s %s %s"( n, x, t );
	
	return ( n + x - 1 ) / x * t;
}


Measured memory_bytes: 2884
d, g = map(int, input().split())

g //= 100

p = [0 for _ in range(d)]
c = [0 for _ in range(d)]
b = [0 for _ in range(d)]
for i in range(d):
    p[i], c[i] = map(int, input().split())
    b[i] = p[i] * (i + 1) + (c[i] // 100)

res = sum(p)
com = [0 for _ in range(d)]
for i in range(2 ** d):
    temp = i
    temp_res = 0
    total = 0
    for j in range(d):
        com[j] = temp % 2
        temp //= 2
        if com[j] == 1:
            total += b[j]
            temp_res += p[j]
    if total >= g:
        res = min(temp_res, res)
        #print(com, temp_res)
        continue

    j = d
    while total < g:
        j -= 1
        if j < 0:
            break
        if com[j] == 1:
            continue
        if (p[j] - 1) * (j + 1) + total >= g:
            temp_res += (g - total) // (j + 1)
            if (g - total) % (j + 1) != 0:
                temp_res += 1
            total += (p[j] - 1) * (j + 1)
            break
        else:
            temp_res += p[j] - 1
            total += (p[j] - 1) * (j + 1)
    if total >= g:
        #print(com, temp_res, total)
        res = min(temp_res, res)

print(res)

Measured memory_bytes: 3064
def main():
    n = int(input())
    d = {}
    for _ in range(n):
        s = input()
        d[s] = d.get(s, 0) + 1
    
    print('AC x ' + str(d.get('AC', 0)))
    print('WA x ' + str(d.get('WA', 0)))
    print('TLE x ' + str(d.get('TLE', 0)))
    print('RE x ' + str(d.get('RE', 0)))

    
if __name__ == '__main__':
    main()

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

int gcd(int x, int y){
    if(x%y==0){
        return y;
    }
    else{
        return(gcd(y,x%y));
    }
}
int main() {
int K;
int64_t sum=0;
cin >> K;
for (int a = 0; a < K; a++) {
    for (int b = 0; b < K; b++) {
        for (int c = 0; c < K; c++) {
            sum += gcd(gcd(a+1,b+1),c+1);
        }
    }
 }
cout << sum << endl;

}


Measured memory_bytes: 3636
N = int(input())
d = tuple(map(int, input().split(' ')))

if len(d) % 2 == 1:
    print(0)
else:
    d = sorted(d)
    left = d[len(d) // 2 - 1]
    right = d[len(d) // 2]
    print(max(0, right - left))


Measured memory_bytes: 14524
#include<cstdio>

using namespace std;

int main(){
    int a, b, k;
    scanf("%d %d %d", &a, &b, &k);
    if (b - a + 1 > 2 * k){
        for(int i = a; i <= a+k-1; i++){
            printf("%d\n", i);
        }
        
        for(int i = b-k+1; i <= b; i++){
            printf("%d\n", i);
        }
    } else {
        for(int i = a; i <= b; i++){
            printf("%d\n", i);
        }
        
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT

signed main() {
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	while (true) {
		c -= b;
		if (c <= 0) {
			cout << "Yes" << endl;
			break;
		}
		a -= d;
		if (a <= 0) {
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3604
n= int(input())
s = input()

m= len(s)
alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

new=''


for i in range(m):
    num = alph.index(s[i])
    new += alph[num+n]

print(new)

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

void insertionSort(vector<int> &a)
{
	for (int i = 0; i < a.size(); i++)
	{
		int v = a.at(i);
		int j;
		for (j = i - 1; j >= 0 && a.at(j) > v; j--)
		{
			a.at(j + 1) = a.at(j);
		}
		a.at(j + 1) = v;

		for (int k = 0; k < a.size(); k++)
		{
			cout << a.at(k) << (k == a.size() - 1 ? "" : " ");
		}

		cout << endl;
	}
}

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

	vector<int> a;

	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;

		a.push_back(x);
	}

	insertionSort(a);
}



Measured memory_bytes: 3156
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s= sc.next();
		int ans = 0;
		for(int i = 0 ; i < 3 ; i ++) {
			if(s.charAt(i) == '1') {
				ans++;
			}
		}
		System.out.println(ans);
	}
}



Measured memory_bytes: 22356
#include <bits/stdc++.h>
#include <stdlib.h>
#include <cmath>
using namespace std;
typedef long long ll;
ll mod=1000000007;

vector<ll> soin(ll x){
    vector<ll> ans;
    int i=2, count=0;
    while(true){
        while(x%i==0) {count++; x/=i;}
        if(count!=0) ans.push_back(count);
        i++;
        count=0;
        if(i*i>x) break;
    }
    if(x!=1) ans.push_back(1); 
    return ans;
}


void comb(vector<vector <ll> > &v){
  for(int i = 0;i <v.size(); i++){
    v[i][0]=1;
    if(i<=60) v[i][i]=1;
  }
  for(int k = 1;k <v.size();k++){
    for(int j = 1;j<=50;j++){
      if(j<k) v[k][j]=(v[k-1][j-1]+v[k-1][j])%mod;
    }
  }
}


int main(){
    ll N,M; cin>>N>>M;
    vector<ll> d=soin(M);
    //cout<<d.size()<<endl;
    vector<vector<ll>> v(N+50,vector<ll>(70,0));
    comb(v);
    ll ans=1;
    for(int i=0;i<d.size();i++){
      ans*=v[N+d.at(i)-1][d.at(i)];
      ans=(ans%mod);
    }
    cout<<ans<<endl;




}

Measured memory_bytes: 59008
#include<bits/stdc++.h>
#define endl '\n'
#define pii pair<int, int>
#define lli long long int
#define tup tuple<int, int, int>

using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a, b ,c;
    cin >> a >> b;
    cout << a*a-b <<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int K = sc.nextInt();
	int[] V = new int[N];
	for(int i = 0; i < N; i++){
	    V[i] = sc.nextInt();
	}

       
	// 左右それぞれ何個ずつ取るかをきめる
	// left + right + remove
	int max = 0;
	for(int left = 0; left <= N; left++){
	    for(int right = 0; right <= N; right++){
		if(left + right > Math.min(N, K)) break;
		int remove = K - right - left;

		// 実際に取りましょう
		ArrayList<Integer> score = new ArrayList<Integer>();
		for(int i = 0; i < left; i++) score.add(V[i]);
		for(int i = 0; i < right; i++) score.add(V[N - 1 - i]);
		
		// ソートします
		Collections.sort(score);

		// 負の数を除きながら総和を取る
		int sum = 0;
		int k = 0;
		for(int x : score){
		    if(x < 0 && k < remove){
			k++;
		    }
		    else{
			sum += x;
		    }
		}
		max = Math.max(max, sum);
							 
		
	    }
	}
	System.out.println(max);
    }
}


Measured memory_bytes: 24404
x, x1, x2, x3, x4 = map(int, input().split())

if x == 0:
    print(1)

if x1 == 0:
    print(2)

if x2 == 0:
    print(3)

if x3 == 0:
    print(4)

if x4 == 0:
    print(5)

Measured memory_bytes: 9040
//D - Road to Millionaire /
//Hiia
#include <stdio.h>
#include <stdlib.h>//rannsuu, zettaichi(absolute)
#include <time.h>
//srand((unsigned int) time(0));
#include <math.h>//koudona keisann
#include <string.h>//hairetsu
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
typedef long long ll;
//#define N 998244353
#define pi 3.1415926535897932384626433832

int gcd(int m,int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
int lcm(int m,int n){if((0==m)||(0==n))return 0;return(m*n/gcd(m, n));}
int fact(int x){if(x==1) return(x);else return(x*fact(x-1));}//Kaijou x!
int ruijou(int base,int exponent){int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent

long long int llgcd(long long int m,long long int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
long long int lllcm(long long int m,long long int n){if((0==m)||(0==n))return 0;return(m*n/llgcd(m, n));}
long long int llfact(long long int x){if(x==1) return(x);else return(x*llfact(x-1));}//Kaijou
int llruijou(long long int base,long long int exponent){long long int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent

int main()
{
  ll n;
  scanf("%lld", &n);

  ll a[200010]={};
  for(ll i = 1; i <= n; i++){
    scanf("%lld", &a[i]);
  }

  ll money=1000,tmp;
  for(ll i = 1; i <= n-1; i++){
    if(a[i]<a[i+1]){
      tmp=money/a[i];
      money=money%a[i] + tmp*a[i+1];
    }
  }

  printf("%lld\n", money);

  return 0;
}


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

int main()
{
  char s[3];
  int cnt = 700;

  for(int i = 0; i < 3; i++){
    cin >> s[i];
    if(s[i] == 'o') cnt += 100;
  }

  cout << cnt << endl;

  return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
  
  int n, x, t;
  
  scanf("%d %d %d", &n, &x, &t);
  
  int div;
  
  div = n / x;
  int ans;
  
  if((n % x) == 0){
    ans = t * div;
  }
  else{
    ans = t * div + t;
  }
  
  printf("%d", ans);
 
  return 0;
}

Measured memory_bytes: 2152
//Name-Deepesh Bhatt
//Institute-IIT Dhanbad

#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
#define m 100000000;
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a ,ll b)
{
    return a/gcd(a,b)*b;
}
ll power(ll a, ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p);
    if (n % 2)
        return (p * a);
    else
        return p;
}
bool is_possible(int a){
    int z;
    for(int i=1;;i++){
        z=(power(2,i)-1)*power(2,i-1);
        if(z==a){
            return true;
        }
        if(z>a)
            return false;
    }
    return false;
}
int main()
{
    ios_base::sync_with_stdio(false);    //for fast I/O operation
    cin.tie(NULL);
    int n;
    cin>>n;
    ll sum=0;
    for(int i=1;i<=n;i++){
        if(i%3!=0&&i%5!=0){
            sum+=i;
        }
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int x[3], k;
    for(int i = 0; i < 3; ++i)
        cin >> x[i];
    cin >> k;
    vector<int> v[3];
    v[0].resize(x[0]);
    v[1].resize(x[1]);
    v[2].resize(x[2]);
    for(auto& e : v[0])
        cin >> e;
    for(auto& e : v[1])
        cin >> e;
    for(auto& e : v[2])
        cin >> e;
    
    vector<int> xy;
    for(auto& e0 : v[0]) {
        for(auto& e1 : v[1]) {
            xy.push_back(e0 + e1);
        }
    }
    sort(xy.rbegin(), xy.rend());
    if(xy.size() > 3000) xy.erase(xy.begin() + 3000, xy.end());
    
    vector<int> ans;
    for(auto& e2 : v[2]) {
        for(auto& xye : xy) {
            ans.push_back(e2 + xye);
        }
    }
    sort(ans.rbegin(), ans.rend());
    for(int i = 0; i < k; ++i) {
        cout << ans[i] << '\n';
    }
}

Measured memory_bytes: 43368
main = do
    line <- getLine
    let n = words line
        a = read $ n !! 0
        b = read $ n !! 1
    putStrLn $ calc a b

calc :: Int -> Int -> String
calc a b
    | a > b = "a > b"
    | a < b = "a < b"
    | otherwise ="a == b"


Measured memory_bytes: 3592
# coding: utf-8
import math

n = int(input().rstrip())


class Pos:
    def __init__(self, init: list):
        self.x = init[0]
        self.y = init[1]

    def get_dist(self, target):
        return math.sqrt(pow(target.x - self.x, 2) + pow(target.y - self.y, 2))


mati_list = [Pos([int(i) for i in input().rstrip().split(" ")]) for j in range(n)]


def get_kumiawase(prev: int, flag: list):
    if len([i for i in flag if i == False]) == 0:
        return [0]
    ans = []
    for i in range(n):
        if flag[i]:
            continue
        diff = mati_list[prev].get_dist(mati_list[i])
        flag[i] = True
        ret = get_kumiawase(i, flag)
        flag[i] = False
        for j in ret:
            ans.append(j + diff)
    return ans


kumiawase = []
for i in range(n):
    ret = get_kumiawase(i, [j == i for j in range(n)])
    kumiawase += ret

print(sum(kumiawase) / len(kumiawase))



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

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

if M%2:
    cnt = 0
    for i in range(1, M//2 + 1):
        cnt += 1
        print(i, M + 2 - i)
        print(M + 1 + i, 2*M + 2 - i)

    i = cnt + 1
    print(i, M + 2 - i)
else:
    for i in range(1, M//2 + 1):
        print(i, M + 2 - i)
        print(M + 1 + i, 2*M + 2 - i)

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

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

Measured memory_bytes: 256
total_num, reg_total = map(int, input().split())

crane_num = 2*total_num - reg_total/2
turtol_num = total_num - crane_num + 0.0

if crane_num.is_integer() and crane_num >= 0 and \
        turtol_num.is_integer() and turtol_num >= 0:
    print('Yes')
else:
    print('No')


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

int main() {
string s;
cin>>s;
if(s[0]=='1') s[0]='9';
else s[0]='1';
if(s[1]=='1') s[1]='9';
else s[1]='1';
if(s[2]=='1') s[2]='9';
else s[2]='1';
cout<<s<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a;
    cin>>a;
    int m;
    string s;
    bool c[4][52]={false};
    for(int i=0;i<a;i++){
        cin>>s;   
        cin>>m;
        if(s=="S")
          c[0][m-1]=true;
        if(s=="H")
          c[1][m-1]=true;
        if(s=="C")
          c[2][m-1]=true;
        if(s=="D")
          c[3][m-1]=true;
    }
  
    for(int i=0;i<13;i++){
        if(c[0][i]==false)
            cout<<"S "<<i+1<<endl;
    }
    for(int i=0;i<13;i++){
        if(c[1][i]==false)
            cout<<"H "<<i+1<<endl;
    }
    for(int i=0;i<13;i++){
        if(c[2][i]==false)
            cout<<"C "<<i+1<<endl;
    }
    for(int i=0;i<13;i++){
        if(c[3][i]==false)
            cout<<"D "<<i+1<<endl;
    }
    return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
        int a, b, c;
        cin>>a>>b>>c;
        if(a>b) swap(a, b);
        if(b>c) swap(b, c);
        if(a*a+b*b==c*c) cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

Measured memory_bytes: 3136
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;
//#define _USE_MATH_DEFINES

int main(void) {
	LL n, a, b, c;
	n = 0;
	string s;
	cin >> s;
	for (int i = 0; i < 4; i++) {
		if (s[i] == '-') {
			n--;
		}
		else {
			n++;
		}
	}

	cout << n << endl;

	return 0;
}


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

char wo[200200];

main()
{
	int bc=0,len;
	long long ans=0;
	scanf("%s",wo);
	len=strlen(wo);
	for(int i=len-1;i>=0;i--)
	{
		if(wo[i]=='B')
		{
			ans+=len-1-i-bc;
			bc++;
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

typedef long long    ll;
typedef long double  ld;

#define rep(i, n)      for (int i = 0; i < (int)(n); ++i)
#define rep3(i, m, n)  for (int i = (m); i < (int)(n); ++i)
#define rrep(i, n)     for (int i = (int)(n)-1; i >= 0; --i)
#define rrep3(i, m, n) for (int i = (int)(n)-1; i >= (m); --i)

#define endl '\n'
#define INF  0x7f7f7f7f7f7f7f7f
#define INFi 0x7f7f7f7f


ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll solve(ll L, ll R, ll d) {
  return R/d - L/d + (L%d==0?1:0);
}

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

  ll L, R, d;
  cin >> L >> R >> d;

  auto ans = solve(L, R, d);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long cc;

cc N, d[1000000], Ans = 0, i, j;
cc judge1=0, judge2=0, judge3;
string S;


int main() {
	cin >> N;
	for (i = 0; i < N; i++)
		cin >> d[i];
	
	sort(d,d + N);
	judge1 = d[N / 2];

	if (N % 2 == 0) {
		if (judge1 != d[N / 2 - 1]) {
			Ans = judge1 - d[N / 2 - 1];
		}
	}

	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>


/* ----- Type Alias ----- */
using Bool = bool;
using Int = long long int;
using Real = long double;
using Char = char;
using String = std::string;
template <class T, class U>
using Pair = std::pair<T, U>;
template <class... Ts>
using Tuple = std::tuple<Ts...>;

template <class T>
using Vector = std::vector<T>;
template <size_t N>
using Bits = std::bitset<N>;
template <class T>
using Queue = std::queue<T>;
template <class T>
using Stack = std::stack<T>;
template <class T>
using Deque = std::deque<T>;

template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
using Set = std::set<T>;
template <class T, class U>
using Map = std::map<T, U>;

template <class T, class... Us>
using Func = std::function<T(Us...)>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return Vector<decltype(genv<T>(ts...))>(l, genv<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = Vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = Vector<Vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}


/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// constexpr Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

int main() {
    String s, t;
    std::cin >> s >> t;
    Int ans = 0;
    for (Int i = 0; i < 3; ++i) {
        ans += (s[i] == t[i]);
    }
    std::cout << ans << std::endl;
    return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#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=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  string s; cin >> s;

  vi a(3);
  REP(i, SZ(s)) {
    switch(s[i]) {
      case 'a':
        a[0]++;
        break;
      case 'b':
        a[1]++;
        break;
      default:
        a[2]++;
        break;
    }
  }

  sort(ALL(a));
  if((a[0] == 0 && a[1] == 0 && a[2] >= 2) ||
      (a[0] == 0 && a[1] != 0 && a[1] + a[2] >= 3) ||
      (a[0] != 0 && a[2] - a[0] > 1)) {
        cout << "NO" << endl;
      } else {
        cout << "YES" << endl;
      }

}


Measured memory_bytes: 512
import itertools
import math

D, G = map(int, input().split())

p = {}
c = {}
s = {}
for i in range(1, D + 1):
    pi, ci = map(int, input().split())
    score = 100 * i * pi + ci
    s[i] = score
    p[i] = pi
    c[i] = ci


def complete(pset):
    score = 0
    solved = 0
    comped = set()
    for i, b in zip(range(1, D + 1), pset):
        if b:
            score += s[i]
            solved += p[i]
            comped.add(i)
    leftset = set(list(range(1, D + 1))) - comped
    return score, solved, leftset


def left(norm, leftset):
    if norm <= 0 or len(leftset) == 0:
        return 0
    i = max(leftset)
    res = int(math.ceil(norm / (100 * i)))
    if res < p[i]:
        return res
    return float("inf")


ans = float("inf")
for pset in itertools.product((True, False), repeat=D):
    score, solved, leftset = complete(pset)
    solved += left(G - score, leftset)
    ans = min(ans, solved)

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=1e6+10;
int a[N];
int cmp(pair<int,int>&a,pair<int,int>&b)
{
    return a.ff+a.ss>b.ff+b.ss;
}
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    vector<int>v1;
    vector<pair<int,int> >v2;
    int cnt1=0;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        string s;
        cin>>s;
        cnt1+=count(all(s),'(');
        cnt1-=count(all(s),')');
        int ans=0;
        int cnt=0;

        for(int j=0;j<s.size();j++)
        {
            if(s[j]=='(')
                cnt++;
            else
                cnt--;
            if(cnt<0)
                ans=min(ans,cnt);
        }
        int ans1=0;
        cnt=0;
        for(int j=s.size()-1;j>=0;j--)
        {
            if(s[j]=='(')
                cnt++;
            else
            {
                cnt--;
            }
            if(cnt>0)
            {
              //  cout<<cnt<<endl;
                ans1=max(ans1,cnt);
            }
        }

        if(ans1==0&&ans==0)
            continue;
        if(ans==0&&ans1>0)
        {
            sum+=ans1;
        }
        else if(ans<0&&ans1==0)
        {
            v1.pb(ans);
        }
        else
        {

            v2.pb({ans1,ans});
        }
    }
    if(cnt1==0)
    {
        sort(all(v2),cmp);
        for(int i=0;i<v2.size();i++)
        {
            if(sum<-1*v2[i].ss)
            {
                cout<<"No"<<endl;
                return 0;
            }
            sum+=v2[i].ss;
            sum+=v2[i].ff;
        }
        for(int i=0;i<v1.size();i++)
            sum+=v1[i];
        if(sum==0)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }




}

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

using namespace std;

const int INF = 1e9;
const int N = 1e4;
const int MOD = 1e9 + 7;
const double EPS = 1e-6;

const double PI = acos(-1);


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB")
        cout << "No";
    else
        cout << "Yes";
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(d<=a)printf("%d",d);
  else if(d<=a+b)printf("%d",a);
  else printf("%d",(2*a+b-d));
  return 0;
}

Measured memory_bytes: 3816
#include <iostream>

 

using namespace std;

 

int main()
{
   int a , b;
   cin >> a >> b;

   
   if (a == b)
       cout << "a == b" << endl; 
   else if (a > b)
       cout << "a > b" << endl;
   else
       cout << "a < b" << endl;
   
   return 0;
}


Measured memory_bytes: 3088
w=int(input())
n=int(input())
a=[]
b=[]
Ans=[int(0) for i in range(w)]
for i in range(n):
    x,y=[int(j) for j in input().split(",")]
    a.append(x)
    b.append(y)
for i in range(1,w+1):
    ans=i
    for j in range(len(a)):
        if ans==a[j]:
            ans=b[j]
        elif ans==b[j]:
            ans=a[j]
    Ans[ans-1]=i
for i in range(w):
    print(Ans[i])

Measured memory_bytes: 7732
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define LONGMAX 1e18
#define MOD 1000000007
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define fr(a,n) for(int i=a;i<n;i++)

void dfs(int node ,vector<int> adj[],vector<int> &dp,bool visited[])
{
	visited[node]=true;

	for(int i=0;i<adj[node].size();i++)
	{
		if(visited[adj[node][i]]==false)
			dfs(adj[node][i],adj,dp,visited);
		dp[node]=max(dp[node], 1+ dp[adj[node][i]]);
	}
}

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

	int n,m;
	cin>>n>>m;
	bool visited[n+1];
	memset(visited,false,sizeof(visited));
	vector<int> adj[n+1];	//adjacency list
	vector<int> dp(n+1,0);
	//dp[i] denotes max length of path starting at node i
	int x,y;

	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		adj[x].pb(y);
	}

	for(int i=1;i<n+1;i++){
		if(visited[i]==false)
			dfs(i,adj,dp,visited);
	}

	int ans=0;
	for( int i=1;i<n+1;i++)
		ans=max(ans,dp[i]);
	cout<<ans<<endl;
}



Measured memory_bytes: 9600
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
typedef long long ll;

void Main()
{
	string s;
  	cin >> s;
  	int left, right;
  	rep(i,s.size()){
    	if(s[i] == 'A'){
        	left = i;
          	break;
        }	
    }
  	rep3rev(i,s.size()-1,0){
    	if(s[i] == 'Z'){
        	right = i;
          	break;
        }	
    }
  	cout << right - left + 1 << endl;
  
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


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

int main(){
	int n,m,x,y,ans;
	ans=0;
	int a[100001];
	for(int i=0;i<=100001;i++){
		a[i] = 1;
	}
	int red[100001]={};
	red[1]=1;
	cin >> n >>m; 
	for(int j=1;j<=m;j++){
		cin >>x>>y;
		a[x]-=1;
		a[y]+=1;
		if(red[x]&&a[x]==0){
			red[x]=0;
			red[y]=1;
		}else if(red[x]){
			red[y]=1;
		}
	}
	for(int k=1;k<=n;k++){
		if(red[k])ans+=1;
	}
	cout << ans <<endl;
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  
  int i;
  bool yet = true;
  for(i = 0; i < s.size() - 1; i++){
    if(s.at(i) == s.at(i + 1)){
      cout << i + 1 << " " << i + 2 << endl;
      yet = false;
      break;
    }
  }
  
  if(yet){
    for(i = 0; i < s.size() - 2; i++){
      if(s.at(i) == s.at(i + 2)){
        cout << i + 1 << " " << i + 3 << endl;
        yet = false;
        break;
      }
    }
  }
  
  if(yet) cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int next = 11;
		String ans = "";
		while (N > 0 && next <= 55555) {
			if (isPrime(next)) {
				ans += next + " ";
				N--;
			}
			next += 10;
		}


		System.out.print(ans.substring(0, ans.length()-1));
		reader.close();
	}
	public static boolean isPrime(int num) {
		boolean result = true;
		for (int i = 2; i < num; i++) {
			if (num % i == 0) {
				result = false;
			}
		}
		return result;
	}
}





Measured memory_bytes: 21716
/*	final2
    kumasaka.m.aa
    Masayuki Kumasaka */

#include<stdio.h>
#include<string.h>
#define SIZE 4000

// 2つの文字列の最長部分列(LCS)を求めて出力
void solve(char *s1,char *s2,int len1,int len2){
    int lcs[SIZE][SIZE] = {},i,j,cnt;
    char answer[SIZE];
    // lcs[i][j] := s1のi文字目とs2のj文字目までのLCSの長さ
    // answer := LCS

    // 更新
    for(i = 0;i < len1-1;i ++){
        for(j = 0;j < len2-1;j ++){
            // 同じ文字ならば+1
            if(s1[i]==s2[j]) lcs[i+1][j+1] = lcs[i][j] + 1;
            else {
                // 異るならば大きい方から遷移
                if(lcs[i+1][j] < lcs[i][j+1]) lcs[i+1][j+1] = lcs[i][j+1];
                else lcs[i+1][j+1] = lcs[i+1][j];
            }
        }
    }
    cnt = lcs[len1-1][len2-1];
    i = len1-1;
    j = len2-1;
    while(cnt){
        if(lcs[i][j]!=lcs[i-1][j] && lcs[i][j]!=lcs[i][j-1]){
            answer[cnt-1] = s1[i-1];
            cnt --;
            i --;
            j --;
        }else if(lcs[i][j]==lcs[i-1][j]){
            i --;
        }else{
            j --;
        }
    }
    printf("%s\n",answer);
}

int main(){
    char string1[SIZE],string2[SIZE];

    fgets(string1,SIZE,stdin);
    fgets(string2,SIZE,stdin);

    solve(string1,string2,strlen(string1),strlen(string2));

    return 0;
}

Measured memory_bytes: 62720
#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

ll n;

int cnt;

bool check(ll num) {
	bool flg3 = false, flg5 = false, flg7 = false;

	string s = to_string(num);

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '3') flg3 = true;
		if (s[i] == '5') flg5 = true;
		if (s[i] == '7') flg7 = true;
	}

	return (flg3 && flg5 && flg7);
}

void dfs(ll num) {
	if (num > n) return;

	if (check(num)) cnt++;

	dfs(num * 10 + 3);
	dfs(num * 10 + 5);
	dfs(num * 10 + 7);

	return;
}

int main(void){
	cin>>n;

	dfs(0LL);

	printf("%d\n", cnt);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SSTR( x ) static_cast< ostringstream & >((ostringstream() << dec << x ) ).str()

int main(){
    int a, b;
    cin >> a >> b;

    int ans = 0;
    for(int i=a; i <= b; i++){
        string temp = SSTR(i);
        if(temp[0] == temp[4] and temp[1] == temp[3]) ans += 1;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import bisect, functools, sys
sys.setrecursionlimit(10**6)
N = int(input())
A = sorted(int(x) for x in input().split())
B = sorted(int(x) for x in input().split())
C = sorted(int(x) for x in input().split())

@functools.lru_cache(maxsize=None)
def a(n):
    return bisect.bisect_left(A, n)

b_cache = [0] * (N + 1)
b_cached = [False] * (N + 1)
def b_i(i):
    global b_cache, b_cached
    if i >= 1:
        if not b_cached[i - 1]: b_i(i - 1)
        t = b_cache[i - 1] + a(B[i - 1])
        b_cache[i] = t
        b_cached[i] = True
        return t
    return 0

@functools.lru_cache(maxsize=None)
def b(n):
    return b_i(min(N, bisect.bisect_left(B, n)))

def c():
    return sum(b(x) for x in C)

print(c())

Measured memory_bytes: 121644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		int Y = sc.nextInt();
		String res = "Yes";

		if(Y%2 != 0) {
			res = "No";
		}

		if(Y < 2*X) {
			res = "No";
		}

		if(Y > 4*X) {
			res = "No";
		}

		System.out.print(res);
	}

}


Measured memory_bytes: 35724
# coding: utf8

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

if __name__ == "__main__":
    n, k = read_int_n()
    num = []
    for _ in range(n):
        num.append(int(input()))
    num.sort()
    ans = 10 ** 9
    for i in range(n-k+1):
        if ans > num[i+k-1] - num[i]:
            ans = num[i+k-1] - num[i]
    print(ans)

Measured memory_bytes: 7436
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int x, ans = 0;
    cin >> x;
    if(x >= 400 && x < 600) ans = 8;
    if(x >= 600 && x < 800) ans = 7;
    if(x >= 800 && x < 1000) ans = 6;
    if(x >= 1000 && x < 1200) ans = 5;
    if(x >= 1200 && x < 1400) ans = 4;
    if(x >= 1400 && x < 1600) ans = 3;
    if(x >= 1600 && x < 1800) ans = 2;
    if(x >= 1800 && x < 2000) ans = 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#from statistics import median
import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
#from collections import deque,defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
S = readInts()
i = 0
cnt = 0
while i < n:
    while i+1 < n:
        if S[i] == S[i+1]:
            i += 1
        else:
            break
    if i + 1 < n:
        if S[i] < S[i+1]:
            while i + 1 < n:
                if S[i] <= S[i+1]:
                    i += 1
                else:
                    break
        else:
            while i + 1 < n:
                if S[i] >= S[i+1]:
                    i += 1
                else:
                    break
    cnt += 1
    i += 1
print(cnt)


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

using namespace std;

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

  int n, l;
  cin >> n >> l;

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

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

  for (int i = 0; i < n; ++i) {
    cout << s[i];
  }
  cout << '\n';

  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int A[1000][1000-1];
  REP(i,n)REP(j,n-1){
      cin >> A[i][j];
      A[i][j]--;
  }
  int ans = 0;
  int count[1000];
  REP(i,n)count[i] = 0;
  while(1){
      bool game = false;
      int visited[n];
      REP(i,n)visited[i]=0;
      REP(i,n){
          if (count[i]==n-1)continue;
          if (visited[i]==1)continue;
          int next = A[i][count[i]];
          if (visited[next]==1)continue;
          if (A[next][count[next]]==i){
              visited[i]++;visited[next]++;
              count[i]++;count[next]++;
              game = true;
          }
      }
      if (!game){
          break;
      }else{
          ans++;
      }
      game = false;
  }
  REP(i,n){
      if (count[i]!=n-1){
          ans = -1;
      }
  }
  cout << ans << endl;

}

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

/*
,,,,
　　　　　　　　　　　　　　　　　　　　　　　　　　,.斗*''“i:i:{
　　　　　　　　　　　　　,.　｡. . . * : : : ''' : : : :” :”“ ''ｰ - 弋,,_
　　　　　 　 　 ,.斗*''“ : : : : : : : : : : : : : ' ' ' ' ' ' : : : : : : : : : : :”: '':* ｡ ,
　　　 ,.斗*''“ ” ＼：　　 ”・・． ' ' ' '　　　　　　　　 ' ' ' ' : : : : : : : : : : : : ”ミ*｡,,,,,,　　　　　　 　 　 　 ＿
　　く.　 ◎　 ﾞ:.ﾞ:..　ﾟ:,　:　───────────　　　--　　,,,,,,__ ' ' ' :.:.:.:.:.”≧s｡.　　＿,,,｡s*i:i:i:i:<
　　ﾏ*s｡ :,　 }　ﾟ:,　 :}　　　　　　　　　　　　　　　　　　　　　　　　　　　　”　''　-　”””：：”：：`*｡i:i:i:i:i:i:i;:’
　　　` .｡`　 ,　,ノ ／｡ ,,,_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　＿＿`　　} }　　ﾉi:i:i:i:i:ﾂ
　　　　　 `　*　｡　　`*｡i:i:i::*=-　　　　　　　　　　　＿＿　　　　　　,,,....｡s*'i,:’　　　”`*｡＿,*’i:i:i:i:r’
　　　　　　　　　　　”　─ --　　　　｡｡｡｡｡　　 -　－`''''''''ヽ ─ '''”　　　｀ｰ“　　　　　　　`*｡i:i:i:i:i:i:
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*｡i:i:::
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*ﾟ:,
         fozubaoyou    no BUGs alive!
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 0

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cout<<endl;}
template<class...A> inline void debug_rest() {cout<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cout<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cout<<first,debug_rest(rest...);}

int fv,a,b,c,d,e;
int comp=101;
string s,t,ans;

int main(){
    ios::sync_with_stdio(false);
    cin>>s>>t;
    reverse(all(s));
    reverse(all(t));
    while(s.size()){
      ans+=s.back();
      s.pop_back();
      if(t.size()){
        ans+=t.back();
        t.pop_back();
      }
    }
    dump(ans);
}

Measured memory_bytes: 256