akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
 
 
public class Main{
 
    public static void main(String args[]){
        int n=100;
        int i,j,k,v,l;
        int a[]=new int[n+1];
         Scanner sc = new Scanner(System.in);
        k=Integer.parseInt(sc.next());
         
        for(i=0;i<k;i++){
            a[i]=Integer.parseInt(sc.next());
        }
        for(i=0;i<k;i++){
            System.out.print(a[i]);
            if(i<k-1){
            System.out.print(" ");
            }
        }
         
        System.out.println();
        for(i=1;i<k;i++){
            v=a[i];
            j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];
             
                j--;
            }
                a[j+1]=v;
            for(l=0;l<k;l++){
                System.out.print(a[l]);
                if(l<k-1){
                System.out.print(" ");
                }
            }
            System.out.println();
             
        }
         
    }
}

Measured memory_bytes: 25792
#include <stdio.h>
typedef struct route{
	int cost,time;
}Route;
int main()
{
	int N,T;
	while(scanf("%d%d", &N, &T)!=EOF){
		Route r[N];
		int min = 10000,index = -1;
		for(int i = 0; i < N; i++){
			scanf("%d%d", &r[i].cost, &r[i].time);
			if(r[i].time <= T){
				if(r[i].cost < min){
					min = r[i].cost;
					index = i;
				}
			}
		}
		if(min != 10000){
			printf("%d\n", r[index].cost);
		}
		else printf("TLE\n");
	}
}

Measured memory_bytes: 128
/*input
1 1
1000
*/

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  sort(p.begin(), p.end());
  int ans = 0;
  rep(i, k) ans += p[i];
  cout << ans << endl;
}

Measured memory_bytes: 3612
# include <bits/stdc++.h>
 
# define pb push_back
# define fr first
# define sc second
# define mk make_pair
 
using namespace std;
 
const int inf = 1000000000 + 7;
const int N = 5e3 + 5;
 
typedef long long ll;
 
int n, k, a[N], l, r;
bool dp[N];
 
bool check(ll x)
{
    if(a[x] >= k) return true;
    for(int i = 1; i <= k; i ++)
            dp[i] = 0;
    for(int i = 1; i <= n; i ++)
    {
        if(i != x && a[i] < k)
        {
            for(int j = k - 1; j - a[i] >= 0; j --)
            {
                if(dp[j - a[i]])
                {
                    dp[j] = 1;
                    if(j >= (k - a[x])) return true;
                }
            }
        }
    }
    return false;
}
 
inline void solve()
{
    scanf("%d %d", &n, &k);
 
    for(int i = 1; i <= n; i ++)
        scanf("%d", &a[i]);
 
    sort(a + 1, a + n + 1);
 
    dp[0] = 1;
 
    l = 1, r = n;
    while(r - l > 1)
    {
        ll md = (l + r) / 2;
        if(check(md))
            r = md;
        else
            l = md;
    }
    if(check(r))
        r = l;
    if(check(r))
        r = 0;
    printf("%d", r);
}
 
int tests = 1;
 
int main()
{
//    scanf("%d", &tests);
 
    while(tests --)
        solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N;
    cin >> N;
    map<char, int> m;
    rep(i, N){
        char c;
        cin >> c;
        m[c]++;
    }

    if(m.size() == 3) cout << "Three" << endl;
    else cout << "Four" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for( int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)
#define INF 1000000000000
using lli = long long int;
using ulli = unsigned long long int;
typedef pair<lli,lli> P;

struct edge{ int u, v; lli cost; };
struct DirectedGraph
{
  int vertex_num;
  int edge_num;
  vector<edge> edge_list;
  vector< vector<int> > adj_list;
	vector< vector<lli> > distance_matrix;
};

template <typename T>
vector<int> argsort(const vector<T> &v) {

  // initialize original index locations
  vector<int> idx(v.size());
  iota(idx.begin(), idx.end(), 0);

  // sort indexes based on comparing values in v
  sort(idx.begin(), idx.end(),
       [&v](int i1, int i2) {return v[i1] < v[i2];});

  return idx;
}

template<typename T>
void displayVector(vector<T> v)
{
	lli n = v.size();
	REP(i,n){
		cout << v[i] << " " ;
	}
	cout << endl;
}



int main(){
	int a; cin >> a;
	cout << a + a*a + a*a*a << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N; cin >> N;
  vector<ll> T(N), A(N);
  rep(i, N) cin >> T[i] >> A[i];
  ll T_tot=T[0], A_tot=A[0];
  for(ll i=1; i<N; ++i) {
    ll n = max((T_tot+T[i]-1)/T[i], (A_tot+A[i]-1)/A[i]);
    T_tot = T[i]*n;
    A_tot = A[i]*n;
  }
  cout << T_tot + A_tot << endl;
}


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

int main()
{
    long long int a,b,c,x3=0,t;
    string s;set<char>k;
    cin>>s;
    for(int i=0;i<s.size();i++){
        k.insert(s[i]);}
    if(k.size()==s.size())cout<<"yes";
    else cout<<"no";
}

Measured memory_bytes: 256
import java.util.Scanner;

 
public class Main {
 
	public static final MyScanner in = new MyScanner();
 
	public static void main(String[] args) {
 
		int A = in.nextInt();
		int B = in.nextInt();
		int M = in.nextInt();
		int[] Rfzs = new int[A];
		int[] Mcws = new int[B];
		int minRfz = Integer.MAX_VALUE;
		int minMcw = Integer.MAX_VALUE;
		for(int i=0;i<A;i++) {
			Rfzs[i]=in.nextInt();
			minRfz = Math.min(minRfz, Rfzs[i]);
		}
		for(int i=0;i<B;i++) {
			Mcws[i]=in.nextInt();
			minMcw = Math.min(minMcw, Mcws[i]);
		}

		int answer = minRfz + minMcw;
		for(int i=0;i<M;i++) {
			int x = in.nextInt();
			int y = in.nextInt();
			int c = in.nextInt();
			int val = Rfzs[x-1] + Mcws[y-1] - c;
			answer = Math.min(answer, val);
		}
		System.out.println(answer);
	}

	public static class MyScanner{
		Scanner sc = new Scanner(System.in);
		String nextLine() {return sc.nextLine();}
		String next() {return sc.next();}
		int nextInt() {return Integer.valueOf(sc.next());}
		long nextLong() { return Long.valueOf(sc.next());}
	}

}

Measured memory_bytes: 89936
s = int(input())
stock = []
stock.append(s)
i = 2
pre = s
while(True):
	if pre % 2 == 0:
		tmp = pre / 2
	else:
		tmp = 3 * pre + 1
	if tmp in stock:
		print (i)
		break
	pre = tmp
	stock.append(tmp)
	i += 1

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

#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()

const int NAX = 2e5 + 5, MOD = 1000000007;

class UnionFind
{ // OOP style
private:
    vector<int> p, rank, setSize; // remember: vi is vector<int>
    int numSets;

public:
    UnionFind(int N)
    {
        setSize.assign(N, 1);
        numSets = N;
        rank.assign(N, 0);
        p.assign(N, 0);
        for (int i = 0; i < N; i++)
            p[i] = i;
    }
    int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
    bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
    bool unionSet(int i, int j)
    {
        if (!isSameSet(i, j))
        {
            numSets--;
            int x = findSet(i), y = findSet(j);
            // rank is used to keep the tree short
            if (rank[x] > rank[y])
            {
                p[y] = x;
                setSize[x] += setSize[y];
            }
            else
            {
                p[x] = y;
                setSize[y] += setSize[x];
                if (rank[x] == rank[y])
                    rank[y]++;
            }
            return true;
        }
        return false;
    }
    int numDisjointSets() { return numSets; }
    int sizeOfSet(int i) { return setSize[findSet(i)]; }
};

struct Solution
{
    Solution() {}
    void solveCase();
};

void Solution::solveCase()
{
    int n, m;
    cin >> n >> m;
    UnionFind U(n);
    for (size_t i = 0; i < m; i++)
    {
        int u, v;
        cin >> u >> v;
        --u, --v;
        U.unionSet(u, v);
    }
    int res = 0;
    for (size_t i = 0; i < n; i++)
    {
        res = max(res, U.sizeOfSet(i));
    }

    cout << res << '\n';
}

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef LOCAL
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 5580
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

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 FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 999999999
#define MINF -999999999
#define ALL(n) n.begin(),n.end()
#define MP make_pair
#define F first
#define S second

int main()
{
	int n, a, ans = 0;
	cin >> n;
	REP(i, n) {
		cin >> a;
		if (a % 2 == 1) ans = 1;
	}
	if (ans == 0) cout << "second" << endl;
	else cout << "first" << endl;
}




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

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int k, s;
    cin >> k >> s;
    int counter=0;
    REP(i, k+1)
    {
        REP(j, k+1)
        {
            int z = s - i - j;
            if (z <= k && 0 <= z) counter++;
        }
    }
    cout << counter << endl;
    return 0;
}



Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    print((100000000 - ni()) % 1000)
    return

solve()


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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long> VLL;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
    ll n,k;
    cin>>n>>k;
    VLL x(n);
    ll zero=0;
    for(ll i=0;i<n;i++){
        cin>>x[i];
    }
    for(ll i=0;i<n-1;i++){
        if(x[i]*x[i+1]<0)zero=i+1;
    }
    bool minus=false;
    if(x[n-1]<0)minus=true;
    //cout<<"zero="<<zero<<endl;
    ll ans=MAXX;
    //cout<<ans<<endl;
    ll tmp=MAXX;
    for(ll i=1;i<=k&&zero-i>=-1;i++){
        
        if(zero==0&&i==1){tmp=x[k-1];} 
        if(minus){tmp=-x[n-k];}
        else if(zero-i>=0&&zero+k-i-1<n){
            tmp=-2*x[zero-i]+x[zero+k-i-1];
            //printf("tmp=%d\n",tmp);
        }
        ans=min(ans,tmp);
        //printf("ans=%d\n",ans);
    }
    for(ll i=0;i<k&&zero-k+i+1>=0&&zero+i<n;i++){
        tmp=2*x[zero+i]-x[zero-k+i+1];
        ans=min(ans,tmp);
        //printf("tmp=%d\n",tmp);
        //printf("ans=%d\n",ans);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
        a: i32,
        b: i32,
        t: i32,
    );
    // println!("{} {} {}", a,b,t);
    let count : i32 = (((t as f32)+0.5)/(a as f32)) as i32;
    let num : i32 = count * b;
    println!("{}", num);
}


Measured memory_bytes: 4352
q,h,s,d=list(map(int, input().split()))
x=int(input())

q=q*4
h=h*2

if q<s:
	s=q
if h<s:
	s=h

if s*2<=d:
	print(x*s)
else:
	if x % 2 == 0:
		print((x*d)//2)
	else:
		print(((x//2)*d)+s)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>

using namespace std;

string s, t;
int s_len, t_len;
vector<int> l_pos[26];
int next_pos[26][100000];
long long ans;

int main()
{
  cin >> s >> t;
  
  s_len = s.length();
  t_len = t.length();
  
  for (int i = 0; i < s_len; i++) {
    l_pos[s[i]-'a'].push_back(i);
  }
  
  for (int i = 0; i < t_len; i++) {
    if (l_pos[t[i]-'a'].empty()) {
      cout << -1 << endl;
      return 0;
    }
  }
  
  for (int letter = 0; letter < 26; letter++) {
    if (l_pos[letter].empty()) continue;
    int np = l_pos[letter][0], lp_id = l_pos[letter].size() - 1;
    for (int i = s_len - 1; i >= 0; i--) {
      next_pos[letter][i] = np;
      if (lp_id >= 0 and i == l_pos[letter][lp_id]) {
        np = i;
        lp_id--;
      }
    }
  }
  
  for (int i = 0; i < t_len; i++) {
    int pos = ans % s_len;
    if (i == 0) {
      ans = -1;
      pos = s_len - 1;
    }
    int np = next_pos[t[i] - 'a'][pos];
    ans += (np - pos + s_len - 1) % s_len + 1;
  }
  
  ans++;
  cout << ans << endl;
  return 0;
}

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

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

  vector<int> a(n);
  rep(i,n) cin >> a[i];

  bool flag = true;
  a[0]--;
  for (int i = 1; i < n; i++) {
    if(a[i] == a[i - 1]) continue;
    else if(a[i] > a[i - 1]) a[i]--;
    else if(a[i] < a[i - 1]) flag = false;
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3724
def main():
    import sys
    import math
    A,B=map(int,input().split())
    A1=math.ceil(A/0.08)
    A2=(A+1)//0.08
    for i in range(int(A1),int(A2)):
        if i//10==B:
            print(i)
            sys.exit()

    print(-1)    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    long P = 1000000007;
    long N = sc.nextLong();
    long K = sc.nextLong();
    
    long ans =0;
    for(long i=K;i<=N+1;i++){
      //i番目の個数は(2*N+3-i)*i/2-(i-1)*i/2+1個
      ans=(ans+((((2*N-i+1)*i)/2)-(((i-1)*i)/2)+1)%P)%P;
    }



    System.out.println(ans);


  }

}
 

Measured memory_bytes: 35960
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int n;
int dp[5000001];
int dp2[5000001];

int func(int v){
	if(dp[v]!=11451419)return dp[v];
	if(v==0)return 0;
	int cnt=11451419;
	int j=1;
	while(j*(j+1)*(j+2)/6<=v)j++;
	j--;
	for(int i=j;i>=1;i--){
		cnt=min(cnt,func(v-i*(i+1)*(i+2)/6));
	}
	return (dp[v]=cnt+1);
}

int func2(int v){
	if(dp2[v]!=11451419)return dp2[v];
	if(v==0)return 0;
	int cnt=11451419;
	int j=1;
	while(j*(j+1)*(j+2)/6<=v)j++;
	j--;
	for(int i=j;i>=1;i--){
		if((i*(i+1)*(i+2)/6)%2!=1)continue;
		cnt=min(cnt,func2(v-i*(i+1)*(i+2)/6));
	}
	return (dp2[v]=cnt+1);
}

int main(void){
	for(int i=1;i<=2000000;i++)dp[i]=dp2[i]=11451419;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		printf("%d %d\n",func(n),func2(n));
	}
	return 0;
}

Measured memory_bytes: 19456
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long
#define int long long
//#define int __int128
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define y1 y122

/*
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")

#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")

#pragma comment(linker, "/STACK: 20000000005")
*/

using namespace std;

string fun (string s){
    vector < char > V;
    for (int i = 0; i < s.size(); i++){
        if (V.size() == 0 || s[i] == 'R' || V.back() == 'R')
            V.pb (s[i]);
        else
            V.pop_back();
    }
    string ans = "";
    for (char ch : V)
        ans += ch;
    return ans;
}

vector < int > V;
vector < string > S;


main()
{
    ios_base::sync_with_stdio(0);
    int po;
    string s;
    cin >> po >> s;
    s = fun (s);
    V.pb (0);
    S.pb (s);
    while (po--){
        int n = V.size();
        vector < int > vv (n*3, 0);
        vector < string > ss (n*3, "");
        for (int i = 0; i < n; i++){
            s = S[i];
            for (int st = 0; st < 3; st++){
                string str = "";
                int x = st;
                for (int j = 0; j < s.size(); j++){
                    if (s[j] == 'S'){
                        str += "S";
                        if (x >= 1)
                            x = 3 - x;
                        continue;
                    }
                    x++;
                    if (x == 3){
                        x = 0;
                        str += "R";
                    }
                }
                str = fun (str);
                vv[st * n + i] = x * n + V[i];
                ss[st * n + i] = str;
            }
        }
        V = vv;
        S = ss;
    }
    for (int x : V)
        cout << x << " ";
    cout << endl;
}


Measured memory_bytes: 55240
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		boolean ans = true;
		
		if(!(S.charAt(0) == 'A')) ans = false;
		
		String SS = S.substring(2, S.length()-1);
		int count = 0;
		for(int i = 0; i < SS.length(); i++){
			if(SS.charAt(i) == 'C') count++;
		}
		if(!(count == 1)) ans = false;
		
		count = 0;
		for(int i = 0; i < S.length(); i++){
			if(S.charAt(i) == 'A') continue;
			if(S.charAt(i) == 'C') continue;
			if(S.charAt(i) >= 'a' && S.charAt(i) <= 'z') continue;
			ans = false;
		}
		
		System.out.println(ans?"AC":"WA");
	}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
long long ans,n,k,a[200001],b[200001],l,r,mid; 
bool cmp1(long long x,long long y)
{
	return x<y;
} 
bool cmp2(long long  x,long long y)
{
	return x>y;
}
int pd(long long x)
{
	long long hh=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]*b[i]>x)
		hh+=max(0ll,a[i]-x/b[i]);
		if(hh>k)
		return 0;
	}
	return 1;
}
int main()
{
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		ans+=k;
	}
	for(int i=1;i<=n;i++)
	scanf("%lld",&b[i]);
	if(k>=ans)
	{
		printf("0");
		return 0;
	}
	ans=0;
	sort(a+1,a+n+1,cmp1);
	sort(b+1,b+n+1,cmp2);
	l=0;
	r=2e18;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(pd(mid))
		{
			ans=mid;
			r=mid-1;
		}
		else
		l=mid+1;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3328
private var N = 0
private var list: Array<List<Int>> = emptyArray()
private var memo: MutableMap<Pair<Int, Int>, Long> = mutableMapOf()
/**
 * 再帰メモ化
 * @param args Array<String>
 */
fun main(args: Array<String>) {

    N = readLine()!!.toInt()
    list = Array(N) {
        readLine()!!.split(" ").map(String::toInt)
    }

    val result = mutableListOf<Long>()
    for (i in 0 until 3) {
        result.add(calc(N - 1, i))
    }
    println(result.max())
}

private fun calc(i: Int, current: Int): Long {

    if (memo.containsKey(i to current)) {
        return memo[i to current]!!
    }

    val currentScore = list[i][current].toLong()

    if (i == 0) {
        return currentScore
    }

    val (one, two) = (0..2).filterNot { it == current }


    return memo.getOrPut(
        i to current, {
            currentScore + Math.max(
                calc(i - 1, one),
                calc(i - 1, two)
            )
        }
    )
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const double PI = 3.14159265358979;

void solve()
{
  ll n, h, ina, inb;
  cin >> n >> h;
  vector<ll> b(n);
  ll a_max = 0LL;
  for(int i = 0; i < n; ++i)
  {
    cin >> ina >> inb;
    a_max = max(a_max, ina);
    b[i] = inb;
  }

  sort(RALL(b));

  ll sum = 0;
  ll cnt = 0;
  for(const auto& bv : b)
  {
    if (bv <= a_max) break;

    sum += bv;
    cnt++;

    if (h <= sum){
      cout << cnt;
      return;
    }
  }
  cout << cnt + (h - sum - 1) / a_max + 1;
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

typedef long long ll;
int main()
{
    ll N;
    cin>>N;
    ll A[N];
    for(ll i=0; i<N; i++){
        cin>>A[i];
    }
    map<ll,ll> counts;
    counts.insert(pair<ll,ll> (0,1));
    ll sum = 0;
    for(ll i=0; i<N; i++){
        sum+=A[i];
        if(counts.find(sum) ==counts.end()){
            counts.insert(pair<ll,ll> (sum, 1));
        }
        else{
            counts[sum] +=1;
        }
    }
    ll ans = 0;
    map<ll,ll>::iterator it;
    for(it = counts.begin(); it!=counts.end(); it++){
        ans+=(it->second)*(it->second-1)/2;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec(x) vector<x>
#define pb push_back
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pair<ll,ll>>
#define matrix(x) vector<vector<x>>
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a, b, sizeof a)
#define ff first
#define ss second
#define mp make_pair
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main()
{
ll t;
cin>>t;
ll a[t];
for(ll i=0;i<t;i++)
{
    cin>>a[i];
}
sort(a,a+t);
ll x=a[t-1];
ll cont=0;
ll s=0;
ll res=1;
for(ll i=t-1;i>=0;i--)
{

    if(x==a[i])
    {
        cont++;
    }
    else
    {
        cont=1;
        x=a[i];
    }
     if(cont==2)
    {
        s=s+1;
        cont=0;
        res=res*x;
        x=a[i-1];

    }
    if(s==2)
        break;

}
if(s>=2)
cout<<res<<endl;
else
    cout<<0<<endl;
}


Measured memory_bytes: 4332
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#pragma warning( disable:4996 )
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))


int main(void) {
	/*int n, k;
	char s[51];
	scanf("%d %d", &n, &k);
	scanf("%s", s);
	s[k-1] += 'a' - 'A';
	printf("%s", s);*/

	/*char s[5];
	scanf("%s", s);
	for (int i = 0; i < 4; i++) {
		s[i] -= '0';
	}
	int p0 = 0;
	int p1 = 0;
	if ((s[0] == 1 && s[1]<=2) || (s[0]==0 && s[1]>0)) {
		p1 = 1;
	}
	if ((s[2] == 1 && s[3]<=2) || (s[2] == 0 && s[3] > 0)) {
		p0 = 1;
	}
	if (p0) {
		if (p1) {
			printf("AMBIGUOUS\n");
		}
		else {
			printf("YYMM\n");
		}
	}
	else {
		if (p1) {
			printf("MMYY\n");
		}
		else {
			printf("NA\n");
		}
	}*/

	int n, k;
	scanf("%d %d", &n, &k);
	double sum = 0.0;
	for (int i = 1; i <= n; i++) {
		if (i >= k) {
			sum += 1.0 / n;
		}
		else {
			double kaisu = ceil(log2((double)k / i));
			sum += 1.0 / n * pow(0.5, kaisu);
		}
		
	}
	printf("%.20lf\n", sum);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
    fast;
    ll n;
    cin>>n;
    ll a[n], ans = 0;
    scan(a, 0, n);
    forn(i, 0, n-1){
        forn(j, i+1, n){
            ans = ans+(a[i]*a[j]);
        }
    }
    cout<<ans<<endl;
}

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

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, K;
    cin >> N >> M >> K;
    vector<bool> ok(N * M + 1, false);
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= M; j++) {
            const int num = i * j + (N - i) * (M - j);
            ok[num] = true;
        }
    }
    cout << (ok[K] ? "Yes" : "No") << endl;
    return 0;
}


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

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

  vector<int> a(n);
  for (auto& e : a)
    cin >> e;

  int cnt = 0;

  for (int i = 0; i < n; ++i)
    if (a[a[i] - 1] == i + 1)
      ++cnt;
  cnt /= 2;
  cout << cnt << endl;
}

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

// ----本問について----
// 問題：Frog1
// 問題文URL：https://atcoder.jp/contests/dp/tasks/dp_a
// 所要時間：
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

const ll N_MAX = pow(10, 5) + 10;

// グローバル変数（入力）
ll N, h[N_MAX], dp[N_MAX];

ll solve(ll i) {               // メモ化再帰（？）
  if (dp[i] != -1) { return dp[i]; } // 計算済みならその値を返す

  if (i == 1) {
    dp[i] = 0;
  } else if (i == 2) {
    dp[i] = abs(h[2] - h[1]);
  } else {
    dp[i] = min(solve(i - 1) + abs(h[i] - h[i - 1]),
                solve(i - 2) + abs(h[i] - h[i - 2]));
  }

  return dp[i];
}

int main() {
  // cout << fixed << setprecision(10);
  cin >> N;
  for (ll i = 1; i <= N; i++) {
    cin >> h[i];
  }
  rep(i, N_MAX) {
    dp[i] = -1; // dpを全部未計算(-1)に初期化
  }
  cout << solve(N) << endl;

  return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int gcd(int a, int b)
{
  if(a < b){return gcd(b, a);}
  if(b == 0){return a;}
  return gcd(b, a%b);
}
int lcm(int a, int b)
{
  return a*b/(gcd(a,b));
}
int main()
{
  int N;
  cin >> N;
  int sum = 0;
  int tmp;
  REP(i, N){
    cin >> tmp;
    sum += tmp;
  }
  cout << sum - N << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

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

        int i;
        int y;
        int p;
        while (n != 0) {
            int a[] = new int[n];
            int g = 1000000;
            for (i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            for (i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (i != j) {
                        y = a[i] - a[j];
                        if (y < 0) {
                            y = y * -1;
                        }
                        if (y < g) {
                            g = y;
                        }

                    }
                }
            }

            System.out.println(g);
            n = sc.nextInt();
        }
    }
}



Measured memory_bytes: 46800
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric> // 最大公約数が使える
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

int main(){
    ll X;
    cin >> X;
    for (int i = 0; i < 10000; i++)
    {
        ll I = pow(i,5);
        for (int j = 0; j < 1000; j++)
        {
            ll J = pow(j,5);
            if ((I-J)==X )
            {
                cout << i << " "<<j << endl;
                return 0;
            }
        }
        for (int j = -1000; j < 0; j++)
        {
            ll J = pow(j,5);
            if ((I-J)==X )
            {
                cout << i << " "<<j << endl;
                return 0;
            }
        }
        
    }
    
}

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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;

int main(void){
  ll A,B;
  cin >> A >> B;
  cout << A*B;

  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef string::const_iterator State;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
string in;
map<char, int> mp;

int f(State &itr) {
    //cerr << *itr << endl;
    int now;
        if(*itr <= '2' && *itr >= '0') {
            now = (int)(*itr - '0');
            itr++;
            return now;
        }
        if(*itr <= 'R' && *itr >= 'P') {
            now = mp[*itr];
            itr++;
            return now;
        }
        if(*itr == '-') {
            itr++;
            return 2 - f(itr);
        }
        if(*itr == '(') {
            itr++;
            now = f(itr);
            char ope = *itr;
            itr++;
            int now2 = f(itr);
            itr++;
            if(ope == '*') return min(now, now2);
            else return max(now, now2);
        }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        cin >> in;
        if(in == ".") break;
        State itr = in.begin();
        int ans = 0;
        for(mp['P'] = 0; mp['P'] <= 2; mp['P']++) {
            for(mp['Q'] = 0; mp['Q'] <= 2; mp['Q']++) {
                for(mp['R'] = 0; mp['R'] <= 2; mp['R']++) {
                    itr = in.begin();
                    int ret = f(itr);
                    //cerr << mp['P'] << " " << mp['Q'] << " " << mp['R'] << " " << ret << endl;
                    if(ret == 2) ans++;
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

int main() {
    string S;
    cin >> S;
    int length = 0;
    int cnt = 0;
    for(int i = 0; i < S.length(); i++) {
        if(S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C') {
            ++cnt;
            length = max(length, cnt);
        } else {
            cnt = 0;
        }
    }
    cout << length << endl;
}

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

    #define all(v) v.begin(),v.end()
    #define rall(v) v.rbegin(),v.rend()
    #define trav(i,a) for(auto i: a)
    #define ff first
    #define ss second
    #define eb emplace_back
    #define tc(t) ll t; cin>>t; while(t--)
    #define prec(n) fixed<<setprecission(n)
    #define mst(arr,value) memset(arr,value,sizeof(arr))
    #define sz(a) a.size()
    #define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    
    const long long inf = (long long)1e18;
    const long long M = (long long)1e9+7;
    
    #define fab(i,a,b) for(ll i=a; i<b; i++)
    #define fba(i,b,a) for(ll i=b; i>=a; i--)

    ll mpw(ll a, ll b, ll M = inf) {
        if(b == 0) return 1;
        if(b % 2 == 1) 
            return a * mpw((a * a) % M, b / 2, M) % M;
        return mpw((a * a) % M, b / 2, M);        
    } 

    ll knapsack(vector<pair<ll, ll>> items, ll n, ll w) {
        ll ans = 0;
        vector<ll> dp(w + 1, 0);
        fab(i, 0, n) {
            ll wt = items[i].ff;
            ll vl = items[i].ss;
            fba(j, w - wt, 0) {
                dp[wt + j] = max(dp[j] + vl, dp[wt + j]);
            }
        }
        fab(i, 0, w + 1) {
            ans = max(ans, dp[i]);
        }
        return ans;
    }

    int main() {
        fio

        ll n, w;
        cin >> n >> w;

        vector<pair<ll, ll>> items(n);

        fab(i, 0, n) { 
            cin >> items[i].ff >> items[i].ss;
        }

        cout << knapsack(items, n, w);

        
        return 0;
    }

Measured memory_bytes: 3964
def main():
    A, B = list(map(int, input().split()))
    S = input()

    for idx in range(len(S)):
        if idx == A:
            if S[idx] != "-":
                print("No")
                return

        else:
            if not S[idx].isdigit():
                print("No")
                return

    print("Yes")

main()


Measured memory_bytes: 2940
#include<stdio.h>
int main(void){
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(a+b>c+d){
    printf("Left");
  }else if(a+b<c+d){
    printf("Right");
  }else{
    printf("Balanced");
  }
  return 0;
}

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

using namespace std;
#ifdef __DEBUG__
    void debug_out() { cerr << endl; } 
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) {cerr << " " << H; debug_out(T...);}
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 
#endif

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N,M;
inline void input(){
    fast_io();
    cin >> N >> M;
}

inline int solve(){
    atcoder::scc_graph scc(N);
    for (int i = 0; i < M; i++)
    {
        int a,b; cin >> a >> b;
        scc.add_edge(a,b);
    }

    cout << scc.scc().size() << "\n";
    for(auto v:scc.scc()){
        cout << v.size() << " ";
        reverse(v.begin(),v.end());
        cout << v << "\n";
    }
    
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


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

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

int d(char n){
	switch(n){
	case 'N':return 0;
	case 'S':return 1;
	case 'E':return 2;
	case 'W':return 3;
	}
}

int main(){
	char input;
	int n,a,b,x,y,m,mov;
	
	while(cin >> n,n){
		int ret = 0;
		int pos[21][21]={0};
		for(int i=0;i<n;i++){
			cin >> a >> b;
			pos[a][b] = 1;
		}
		cin >> m;
		x = y = 10;
		ret += pos[x][y];
		pos[x][y] = 0;
		for(int i=0;i<m;i++){
			cin >> input >> mov;
			int t = d(input);
			
			for(int j=0;j<mov;j++){
				x += dx[t];
				y += dy[t];
				ret += pos[x][y];
				pos[x][y] = 0;
			}
		}
		cout << (n==ret?"Yes":"No") << endl;
	}
}

Measured memory_bytes: 0
fun main(args:Array<String>){
    var S = readLine()!!.split("").filter { it != "" }
    val T = readLine()!!.split("").filter { it != "" }
    var count = 0

    for(i in 0 until S.count()){
        if(S[i] != T[i]){
            count++
        }
    }

    println(count)
}


Measured memory_bytes: 82140
n = int(input())

list_n = [int(n) for n in input().split(' ')]

A = 0

for n in list_n:
        A += (100-n)**2

for n in range(-100,100):
        B = 0
        for num in list_n:
                B += (n-num)**2
        if A > B:
                A = B

print(A)


Measured memory_bytes: 3064
/*                          The four Truths of Life

                                    CKMKB
                                    PKMKB

                                    CKMKC
                                    PKMKC
*/


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define ye cout<<"YES";
#define no cout<<"NO";
#define ln cout<<"\n";
// cout<<"Case #"<<ts<<": “;
//priority_queue < pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;




ll mod(ll x, ll m) {
	return (x % m + m) % m;
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll t = 1, r, n, a, d, c, b, x, y, sum, cnt, i, j, k, m, l, q, maxx, minn, temp, ans, flag, g, ts;
	ll mod = 1000000007;
	char ch, chh;
	double dans;
	string str, ttr;

	//cin >> t;


	for (ts = 1; ts <= t; ts++)
	{
		flag = 0; sum = 0; cnt = 0; ans = 0; k = 0; maxx = 0; minn = 0; a = 0; b = 0; temp = 0;

		cin >> n;
		//ll arr[n]; for (i = 0; i < n; i++) {cin >> arr[i];}

		if (n <= 599)
		{
			cout << 8;
		}
		else if (n <= 799)
			cout << 7;
		else if (n <= 999)
			cout << 6;
		else if (n <= 1199)
			cout << 5;
		else if (n <= 1399)
			cout << 4;
		else if (n <= 1599)
			cout << 3;
		else if (n <= 1799)
			cout << 2;
		else if (n <= 1999)
			cout << 1;


		ln
	}
	return 0;
}


Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

//0-index 抽象化半開区間遅延セグツリー
template<typename T, typename E>
class segment_tree{
    typedef function<T(T,T)> F; //要素に適用する演算
    typedef function<T(T,E)> G; //作用素の適用
    typedef function<E(E,E)> H; //作用素の合成
    typedef function<E(E,int)> P;
private:
    int num_of_elm_;
    vector<T> dat_, lazy_;
    F f_;
    G g_;
    H h_;
    P p_;
    T ident_;
    E op_ident_;
public:
    segment_tree(int n, F f, G g, H h, P p, T ident, E op_ident):f_(f), g_(g), h_(h), p_(p), ident_(ident), op_ident_(op_ident){
        num_of_elm_ = 1;
        while(num_of_elm_<n)num_of_elm_*=2;
        dat_ .resize(2*num_of_elm_,ident);
        lazy_.resize(2*num_of_elm_,op_ident);
    }

    void eval(int k, int len){
        if(lazy_[k] == op_ident_)return ;

        if(k<num_of_elm_){
            lazy_[k*2]=h_(lazy_[k*2], lazy_[k]);
            lazy_[k*2+1]=h_(lazy_[k*2+1], lazy_[k]);
        }
        dat_[k] = g_(dat_[k],p_(lazy_[k], len));
        lazy_[k] = op_ident_;
    }
    
    T update(int L, int R, int val, int l=0, int r=0, int k=1){
        if(k==1)r = num_of_elm_;
        
        eval(k,r-l);
        if(r<=L || R<=l)return dat_[k];
        else if(L<=l && r<=R){
            lazy_[k] = h_(lazy_[k], val);
            return g_(dat_[k], p_(lazy_[k], r-l));
        }
        else{
            return dat_[k] = f_(update(L,R,val,l,(l+r)/2,k*2), update(L,R,val,(l+r)/2,r,k*2+1));
        }

    }
    
    T query(int L, int R,int l=0,int r=0, int k=1){
        if(k==1)r = num_of_elm_;

        eval(k,r-l);
        if(r<=L || R<=l)return ident_;
        else if(L<=l && r<=R){
            return dat_[k];
        }
        else{
            return f_(query(L,R,l,(l+r)/2,k*2), query(L,R,(l+r)/2,r,k*2+1));
        }
    }
};

int main(){
    int n,q;
    cin>>n>>q;
    auto f = [](int a, int b){return a+b;};
    auto g = [](int a, int b){return a+b;};
    auto h = g;
    auto p = [](int a, int len){return a*len;};
    segment_tree<int,int> st(n, f, g, h, p, 0, 0);
    rep(i,q){
        int com,x,y;
        cin>>com>>x>>y;
        if(com==0){
            st.update(x-1,x,y);
        }else{
            cout<<st.query(x-1,y)<<endl;
        }
    }
}




Measured memory_bytes: 4956
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin>>a>>b;
  vector<int>mondai(a);
  for(int i=0;i<2*b;i+=2){
    int c;
    cin>>c;
    string  seigo;
    cin>>seigo;
    if(seigo=="AC"){
      if(mondai.at(c-1)>=0){
      mondai.at(c-1)+=1000000;
      mondai.at(c-1)*=(-1);
      }
    }
    else{
      if(mondai.at(c-1)>=0){
        mondai.at(c-1)++;
      }
    }
  }
  int d,e;
    d=0;
    e=0;
    for(int j=0;j<a;j++){
      if(mondai.at(j)<0){
        d++;
      
      e+=abs(mondai.at(j)%100000);
      }
    }
   cout<<d<<" "<<e<<endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt(), b = scanner.nextInt(), c = scanner.nextInt();
		int count = 0;
		if(a != b){
			count++;
		}
		if(b != c){
			count++;
		}
		if(c != a){
			count++;
		}
		if(count == 0){
			count++;
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 9044
#include <bits/stdc++.h>
#define fast_read ios::sync_with_stdio(0);cin.tie(0);
#define ll long long
using namespace std;
int main()
{
    fast_read;
    ll x , a , b;
    cin>>x>>a>>b;
    x -= a;
    cout<<x - x / b * b<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main() {
	string s, t;
	int cnt = 0;
	cin >> s >> t;
	for (size_t i = 0; i < s.length(); i++) {
		if (s[i] != t[i]) {
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3920
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

int a[1001];
int dp[1001];
const int INF=1000000000;
int main(){
  int n,w;
  int cnt=1;
  while(cin>>n>>w&&(n|w)){
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=n;i>=0;i--){
      int res=INF;
      if(i!=n){
	int sum=0;
	for(int j=i;j<n;j++){
	  sum+=a[j];
	  if(j!=n-1)res=min(res,dp[j+1]+abs(sum-w));
	  else res=min(res,dp[j+1]+max(0,sum-w));
	}
      }
      else res=0;
      dp[i]=res;
    }
    int ans=dp[0];
    cout<<"Case "<<cnt<<": "<<ans<<endl;
    cnt++;
  }
  
  return 0;
}

Measured memory_bytes: 876