akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

int n;
vector<vector<int> > A;
vector<vector<int> > T;
int t = 0;

void dfs(int cur){ // cur????¨????
    // cur ????¨??????????????¨????
    t += 1;
    T[cur][0] = t;
    // ???????¢??????¨??¨???
    // cerr << "visiting " << cur << " " << t << endl;

    for(int dst = 0; dst < n; ++dst){ // ??¨???????????? dst ????????????
        if(A[cur][dst] == 1 && T[dst][0] == -1){ // cur??????dst??????????????????,dst???????¨??????????
            dfs(dst);
        }
    }
    // cur ????¨????????????????????¨????
    t += 1;
    T[cur][1] = t;
    // ??¢??°?????????????????????????????? (?????¢??°)
    return; // ?????\???
}

int main(){
    cin >> n;
    A = vector<vector<int> >(n, vector<int>(n, 0));
    T = vector<vector<int> >(n, vector<int>(2, -1));
    for(int i=0; i<n; ++i){
        int k;
        cin >> k;
        // 1~n???index?????¨????????????????????????????????????1????????????0~n-1????????????
        k -= 1;
        int u;
        cin >> u;
        for(int j=0; j<u; ++j){
            int v;
            cin >> v;
            v -= 1;
            A[k][v] = 1;
        }
    }
    for(int i=0; i<n; ++i){
        if(T[i][0] == -1){
          dfs(i);
        }
    }
    for(int i=0; i<n; ++i){
        cout << i+1 << " " << T[i][0] << " " << T[i][1] << endl;
    }
}

Measured memory_bytes: 3228
// <------------- Template -----------------------> //


#include<bits/stdc++.h>
using namespace std;

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(2);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 
 
typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	2 * 1e18;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAX5]; ll visit[] = {};

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, y, q, m;
string s, t, d;
ll sum = 0;
ll cou = 0;


// <------------- Implement Functions Here ----------> //

bool factor(ll x) {
	vll f;
	for(ll i=1;i*i<=x;i++) {
		if(x%i == 0) {
			f.pb(i);
			if(i*i != x) f.pb(x/i);
		}
	}
	return f.size() == 8;
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n;
	ll cou = 0;
	for(ll i=1;i<=n;i+=2) cou+=factor(i);
	cout<<cou;
}

int main() {
	fastio; randomINT;
	//cin>>T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 5840
a, b = map(int, input().split())
a, b = min(a, b), max(a, b)
cd = []
for i in range(1,int(a**0.5)+1):
    if a % i == 0:
        if b % i == 0:
            cd.append(i)
        if i != a // i and b % (a//i) == 0:
            cd.append(a//i)
ans = 1
for n in cd:
    prime = True
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            prime = False
            break
    if n == 1:
        prime = False
    if prime == True:
        ans += 1
print(ans)

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

using namespace std;

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

	long long a = n / k;

	if (k % 2 == 1) {
		cout << a * a*a << endl;
	}
	else {
		long long b = 0;
		for (int i = k / 2; i <= n; i++) {
			if (i%k == k / 2) { b++; }
		}
		cout << a * a*a+b*b*b << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000000)
N = int(input())
graph = [[] for _ in range(N)]
for _ in range(N-1):
  u, v, w = map(int, input().split())
  u -= 1
  v -= 1
  graph[u] += [[v, w]]
  graph[v] += [[u, w]]

color = [-1]*N 
def dfs(v, c):
  color[v] = c
  for next_v, w in graph[v]:
    if color[next_v] == c and w % 2 != 0:
      return 
    if color[next_v] == -1 and w % 2 == 0 and dfs(next_v, c) == False:
      return False
    if color[next_v] == -1 and w % 2 != 0 and dfs(next_v, abs(1-c)) == False:
      return False
  return True

dfs(0, 0)
for c in color:
  print(c)

Measured memory_bytes: 85212
#include <bits/stdc++.h>
 using namespace std;
 
int main(){
	string input;
  	cin>>input;
  	for(int i=0; i<input.length(); i++){
    	if(input[i]=='7') {
          cout<<"Yes";
          return 0;
        }
     }
  	cout<<"No";
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 1000005
ll arr[MAX+2];
bool check()
{
    for(int i=2;i<MAX;i++){
        if(arr[i]>1) return false;
    }
    for(int i=2;i<MAX;i++)
    {
        ll cnt=0;
        for(int j=i;j<MAX;j+=i){
            if(arr[j]==1) cnt++;
        }
        if(cnt>1) return false;
    }
    return true;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n; cin>>n;
    ll gcd=0;
    for(int i=1;i<=n;i++) {
        ll a; cin>>a;
        gcd=__gcd(gcd,a);
        arr[a]++;
    }
    if(check())
    {
        cout<<"pairwise coprime"<<endl;
        return 0;
    }
    if(gcd==1){
        cout<<"setwise coprime"<<endl;
        return 0;
    }
    cout<<"not coprime"<<endl;
    
    
}


Measured memory_bytes: 11480
// #include <ext/pb_ds/assoc_container.hpp> 
        // #include <ext/pb_ds/tree_policy.hpp> 
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <unordered_set>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        #define trace(x) cerr << #x << ": " << x << " " << endl;
         
        typedef int64_t ll;
         
        #define endl '\n'
        #define int ll
        ll mod=1e18;
        ll mod1=1e9+5;
         
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
         
        // using namespace __gnu_pbds;
        // #define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
        //find_by_order(k)  returns iterator to kth element starting from 0;
        //order_of_key(k) returns count of elements strictly smaller than k;
        //erase,insert same as normal set
       
        int32_t main()
        {
            IOS
         


            int n;
            cin>>n;
            cout<<(n+1)/2;

            
           
        }       

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


int main()
{
	int mx=120,n;
	scanf("%d",&n);
	for(int i=-mx;i<=mx;++i)
		for(int j=i+1;j<=mx;++j)
			if(pow(j,5)-pow(i,5)==n) {printf("%d %d",j,i);return 0;}
}

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

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

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	string s;
	cin >> s;

	set<char> ss;
	for(auto x : s)
		ss.insert(x);

	if(ss.size() == (int)s.size())
		cout << "yes" << endl;
	else
		cout << "no" << endl;

	return 0;
}

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

 
int main() {
  
  	ll A, B, C, D;
  	cin >> A >> B >> C >> D;
  
	int i=0;
  	while(1){
    	if(i%2==0){
        	C-=B;
          	if(C<=0){
            	cout << "Yes" << endl;
              	break;
            }
        }
      	else{
         	A-=D;
          	if(A<=0){
            	cout << "No" << endl;
              	break;
            }
        }
      	i++;
    }

}

Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 1005
#define ML 33 
using namespace std;
inline int in(){
    int x=0;bool f=0;char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
int x[MN],y[MN],d[ML];
int n,m;
bool par[2];
int main()
{
	n=in();
	for (int i=1;i<=n;++i)
	x[i]=in(),y[i]=in(),par[(x[i]^y[i])&1]=1;
	if (par[0]&&par[1]){printf("-1");return 0;}
	m=31;printf("%d\n",m+par[0]);
	for (int i=30;i>=0;--i)
	d[30-i]=(1<<i),printf("%d ",d[30-i]);
	if (par[0]) d[31]=1,printf("1");puts("");
	for (int i=1;i<=n;++i){
		x[i]+=par[0];
		for (int j=0;j<m;++j){
			if (abs(x[i])>abs(y[i])){
				if (x[i]>0) putchar('R'),x[i]-=d[j];
				else putchar('L'),x[i]+=d[j];
			}else{
				if (y[i]>0) putchar('U'),y[i]-=d[j];
				else putchar('D'),y[i]+=d[j];
			}
		}if (par[0]) putchar('L');puts("");
	}return 0;
}

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

int main(){
long long int N, A, B;
cin >> N >> A >> B;


if(A==0){
cout << 0 << endl;
}else if(B==0){
cout << N << endl;
}else{
long long int k =N/(A+B);
if(N <= k*(A+B)+A){
cout << N-k*B << endl;
}else{
cout << (k+1)*A << endl;
}
}
}

Measured memory_bytes: 256
/*input
41 10
40 36 34 17 29 46 12 10 16 47 36 25 8 11 30 15 50 48 30 25 10 34 39 2 45 27 48 36 44 34 34 12 16 43 50 37 4 30 14 21 39
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;
const ld PI = 4*atan((ld)1);

ll dp[51][2600][51];
vl x;
ll N, A, ans;
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> A;
	x.pb(0);
	ll sum = 0;
	FOR(i, 1, N + 1) {
		x.pb(0); cin >> x[i];
		sum += x[i];
	}
	//cout << sum << '\n';
	dp[0][0][0] = 1;
	ll ans = 0;
	FOR(i, 1, N + 1) {
		F0R(j, sum + 1) {
			F0R(k, i + 1) {
				dp[i][j][k] = dp[i - 1][j][k];
				if (x[i] <= j && k > 0) dp[i][j][k] += dp[i - 1][j - x[i]][k - 1];
				if (i == N && k != 0 && j == k * A) ans += dp[i][j][k];
			}
		}
	}
	//cout << dp[1][40][1] << '\n';
	//int tot = ((sum + A - 1) / A);
	//if (sum % A > 0) tot++;
	/*FOR(i, 1, sum / A + 1) {
		ans += dp[N][A * i][i];
	}*/
	cout << ans << '\n';
}




Measured memory_bytes: 51968
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

#define MAX_N 1120
#define MAX_K 15

int main(){
  bool p[MAX_N+1];
  memset(p, true, sizeof(p));
  p[0] = p[1] = false;
  for(int i = 2 ; i*i <= MAX_N ; i++){
    if(p[i]){
      for(int j = i*i ; j <= MAX_N ; j += i){
	p[j] = false;
      }
    }
  }
  vector<int> prime;
  for(int i = 0 ; i <= MAX_N ; i++){
    if(p[i]) prime.push_back(i);
  }
  
  int dp[MAX_K+1][MAX_N+1]; // dp[used number][sum] = number of ways
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  
  for(int i = 0 ; i < prime.size() ; i++){
    for(int j = MAX_N ; j >= prime[i] ; j--){
      for(int k = 14 ; k > 0 ; k--){
	dp[k][j] += dp[k-1][j - prime[i]];
      }
    }
  }

  int n, m;
  while(cin >> n >> m, n|m){
    cout << dp[m][n] << endl;
  }
  
  return 0;
}

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

int main() {
  int n;
  std::string p;
  std::cin >> n;
  std::set<std::string> s;
  for (int i = 0; i < n; i++) {
    std::cin >> p;
    s.insert(p);
  }
  std::cout << s.size() << std::endl;
}

Measured memory_bytes: 19228
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <unordered_set>
#include <cmath>
#define endl '\n'
#define ll long long
//#define mod 1000000007
#define NCONS 100001

using namespace std;

int alpha[26];

int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	string str; cin >> str;
	for (int i = 0; i < str.size(); i++)
		alpha[str[i] - 'a'] += 1;
	for (int i = 0; i < 26; i++)
		if (alpha[i] == 0)
		{
			cout << (char)(i + 'a');
			return 0;
		}
	cout << "None";

	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstring>
#include <cmath>
#include <cstdio>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()

using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;

int dp[5][1000][5];
int main(){
	int w, h;
	while(cin >> w >> h, w|h){
		vector<P> pos[5];
		P start, goal;
		rep(i, h) rep(j, w){
			char c;
			cin >> c;
			if(c == 'S') start = MP(j, i);
			if(c == 'G') goal = MP(j, i);
			if(c >= '1' && c <= '5'){
				pos[c-'1'].push_back(MP(j, i));
			}
		}

		int ans = INF;
		int idx = -1;
		rep(i, 5){
			rep(l, 5) rep(j, 1000) rep(k, 5) dp[l][j][k] = INF;
			int first = (i+1)%5;
			for(int j = 0; j < pos[first].size(); j++){
				int dist = abs(start.X-pos[first][j].X)+abs(start.Y-pos[first][j].Y);
				dp[first][j][0] = dist;
			}
			rep(j, 3){
				int cur = (i+j+1)%5;
				int next = (i+j+2)%5;
				rep(k, pos[next].size()){
					rep(l, pos[cur].size()){
						int dist = abs(pos[next][k].X-pos[cur][l].X)+abs(pos[next][k].Y-pos[cur][l].Y);
						dp[next][k][j+1] = min(dp[next][k][j+1], dp[cur][l][j]+dist);
					}
				}
			}
			int last = (i+4)%5;
			for(int j = 0; j < pos[last].size(); j++){
				int dist = abs(goal.X-pos[last][j].X)+abs(goal.Y-pos[last][j].Y);
				if(ans > dp[last][j][3]+dist){
					ans = dp[last][j][3]+dist;
					idx = i+1;
				}
			}
		}
		if(idx == -1) cout << "NA" << endl;
		else cout << idx << ' ' << ans << endl;
	}

    return 0;
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    int n;
    cin >> n;
    V<int> a;
    V<ll> lz;
    ll cnt = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x == 0) {
            cnt++;
        } else {
            a.push_back(x);
            lz.push_back(cnt);
            ans += cnt*(cnt+1)/2;
            cnt = 0;
        }
    }
    lz.push_back(cnt);
    ans += cnt*(cnt+1)/2;
    n = int(a.size());
    for (int l = 0; l < n; l++) {
        int sm = 0, xsm = 0;
        for (int i = l; i < min(l+25, n); i++) {
            sm += a[i];
            xsm ^= a[i];
            if (sm == xsm) {
                ans += (lz[l]+1) * (lz[i+1]+1);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int n;
    cin >> n;
    int a[n];
    rep(i, n) { cin >> a[i]; }
    // check
    // rep(i, n) {
    //     if (i > 0) cout << " ";
    //     cout << a[i];
    // }

    // 処理
    sort(a, a + n);

    // 出力
    cout << a[n - 1] - a[0] << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            int tmp = 0;
            if (j < A) tmp ^= 1;
            if (i < B) tmp ^= 1;
            printf("%d", tmp);
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
const ll INF = LLONG_MAX;
const long double PI = acosl(-1);
const char Z = '\n';
void Yes() {cout << "Yes" << Z;}
void No() {cout << "No" << Z;}
void YES() {cout << "YES" << Z;}
void NO() {cout << "NO" << Z;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll mod = 1e9 + 7;
	//const ll mod = 998244353;

	ll n;
	cin >> n;
	ll ans = 0;

	for (ll i = 0; i < n; i++) ans += (i + 1) * (n - i);

	for (ll i = 0; i < n - 1; i++) {
		ll u, v;
		cin >> u >> v;
		if (u > v) swap(u, v);
		ans -= u * (n - v + 1);
	}
	cout << ans << Z;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    int n;
    while(cin>>n&&n){
        int sum=0; int hoge=INF;bool s=true;
        rep(i,12){pii p; cin>>p.first>>p.second;sum+=p.first-p.second;if(sum>=n&&s){hoge=i+1;s=false;}}
        if(hoge==INF){cout<<"NA"<<endl;}else cout<<hoge<<endl;
    }
    return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
const ll INF = 9e18;

struct pqpoint {
    ll h;
    ll w;
    ll dist;
};
bool operator<(const pqpoint& l, const pqpoint& r) {
    return (l.dist < r.dist);
}
bool operator==(const pqpoint& l, const pqpoint& r) {
    return (l.dist == r.dist);
}
bool operator>(const pqpoint& l, const pqpoint& r) {
    return !(l == r) && !(l < r);
}
bool operator!=(const pqpoint& l, const pqpoint& r) {
    return !(l == r);
}
bool operator>=(const pqpoint& l, const pqpoint& r) {
    return (l == r) || (l > r);
}
bool operator<=(const pqpoint& l, const pqpoint& r) {
    return (l == r) || (l < r);
}

int main() {
    ll H, W;
    cin >> H >> W;
    ll sh, sw, gh, gw;
    cin >> sh >> sw;
    cin >> gh >> gw;
    sh--;
    sw--;
    gh--;
    gw--;

    vector<vector<bool>> roads(H, vector<bool>(W, false));
    for (ll h = 0; h < H; h++) {
        for (ll w = 0; w < W; w++) {
            char c;
            cin >> c;
            while (c != '.' && c != '#') {
                cin >> c;
            }
            if (c == '.') {
                roads[h][w] = true;
            }
        }
    }

    priority_queue<pqpoint, vector<pqpoint>, greater<pqpoint>> pq;
    vector<vector<bool>> done(H, vector<bool>(W, false));
    pq.push({sh, sw, 0});
    while (!pq.empty()) {
        auto src = pq.top();
        pq.pop();
        ll h = src.h;
        ll w = src.w;
        ll d = src.dist;
        if (h == gh && w == gw) {
            cout << d << endl;
            return 0;
        }
        if (done[h][w]) {
            continue;
        }
        done[h][w] = true;
        for (ll y = h - 2; y <= h + 2; y++) {
            for (ll x = w - 2; x <= w + 2; x++) {
                if (y >= 0 && y < H && x >= 0 && x < W && roads[y][x] && !done[y][x]) {
                    if (abs(x - w) + abs(y - h) == 1) {
                        pq.push({y, x, d});
                    } else {
                        pq.push({y, x, d + 1});
                    }
                }
            }
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 6584
/*
 * FileName:     rotate
 * CreatedDate:  2020-05-24 16:16:25 +0900
 * LastModified: 2020-07-10 22:06:17 +0900
 */

#include <stdio.h>
#include <stdlib.h>
void rotate(long int *a, long int *c, int b, int m, int e){
    for(int k=0; k<e-b; k++){
        int modul = (k+(e-m))%(e-b);
        c[b+modul] = a[b+k];
    }
}
void copy(long int *a, long int *c, int n){
    for(int i=0; i<n; i++){
        a[i] = c[i];
    }
}
int main(void){
    int n;scanf("%d", &n);
    long int *a = malloc(n*sizeof(long int));
    long int *c = malloc(n*sizeof(long int));
    for(int i=0; i<n; i++){
        scanf("%ld", a+i);
        c[i] = a[i];
    }

    int q;scanf("%d", &q);
    for(int i=0; i<q; i++){
        int b, m, e;scanf("%d%d%d", &b, &m, &e);
        rotate(a, c, b, m, e);
        copy(a, c, n);
    }
    printf("%ld", a[0]);
    for(int i=1; i<n; i++){
        printf(" %ld", a[i]);
    }
    printf("\n");
    free(a);
    free(c);
    return 0;
}



Measured memory_bytes: 2088
N = int(input())
Xn = list(map(int,input().split()))

# Sigma_n (Xn-P)**2 = Sigma_n (Xn**2 + P**2 -2*P*Xn)
# diff => Sigma_n (2P - 2Xn)

su = 0
P = round(sum(Xn) / N)
for x in Xn:
  su += (x-P) ** 2
print(int(su))


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#define MOD 2017
#define LL long long
#define INF 0x3f3f3f3f
#define maxn 100009
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _  ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;

int main()
{
    LL A,B,K;
    cin>>A>>B>>K;
    LL mid = B - A;
    if(mid & 1)
        mid = (mid + 1) / 2;
    else
        mid = mid / 2 + 1;
    if(K >= mid)
        for(int i = A;i<=B;i++)
            cout<<i<<endl;
    else
    {
        for(int i=A;i<=A+K-1;i++)
            cout<<i<<endl;
        for(int i=B-K+1;i<=B;i++)
            cout<<i<<endl;

    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b +c >= 22) {
        println("bust");
    }
    else {
        println("win");
    }
    return 0;
}

Measured memory_bytes: 3572
#!/usr/bin/env python3
import sys
import math
import bisect
INF = float("inf")


def solve(N: int):

    if N == 1:
        print(0)
        return
    count = 0
    for r in range(1, int(math.sqrt(N))+1):  # 商
        # 余りは二分探索で良い
        lower = -(-N//r+1)
        upper = N//r
        while lower + 1 < upper:
            mid = (lower+upper)//2
            if N % mid >= r:
                lower = mid
            else:
                upper = mid
        if N % lower == r:
            count += lower
    print(count)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int N = sc.nextInt();
			if(N <= 9) {
				System.out.println("Yes");
				return;
			}
			if(N <= 81) {
				for(int i = 2; i <= 9; i++) {
					if(N % i == 0 && (N / i) < 10) {
						System.out.println("Yes");
						return;
					}
				}
			}
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23764
n,m = map(int,input().split())
h = list(map(int,input().split()))
r = ['t'] * n
for i in range(m):
  x,y = map(int,input().split())
  if h[x-1] > h[y-1]:
    r[y-1] = 'f'
  elif h[x-1] < h[y-1]:
    r[x-1] = 'f'
  else:
    r[y-1] = 'f'
    r[x-1] = 'f'
    
s = 0
for i in range(n):
  if r[i] == 't':
    s += 1
    
print(s)    

Measured memory_bytes: 19968
#include<iostream>
using namespace std;
int n,ans,x;
int bucket[100007];
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i)
	{
        cin>>x;
        if(x<=100000) bucket[x]++;
        else ans++;
    }
    for(int i=1;i<=100000;++i)
    		if(bucket[i]>=i) ans+=bucket[i]-i; else ans+=bucket[i];
	cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;


int main()
{
	string a;
	cin >> a;
	a.replace(5, 1, " ");
	a.replace(13, 1, " ");
	cout << a << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    char b;
    cin >> b;
    if(b == 'A') cout << "T";
    else if(b == 'T') cout << "A";
    else if(b == 'C') cout << "G";
    else if(b == 'G') cout << "C";
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

fn main() {
    input! {
        A: i32,
        P: i32,
    }
    let ret = (3 * A + P) / 2;
    println!("{}", ret);
}


Measured memory_bytes: 2124
#include<cstdio>
#include<iostream>
using namespace std;
long long n;
long long a[200020],ans;
int main()
	{
		cin>>n;
		for(int i=1;i<=n;i++)
			{
				cin>>a[i];
			}
		if(a[1]!=0) 
			{
				cout<<"-1"<<endl;
				return 0;
			}
		for(int i=1;i<=n;i++)
			{
			if(a[i+1]-a[i]>1) 
				{
				cout<<"-1"<<endl;
				return 0;	
				}
				
			}			
			for(int i=1;i<=n;i++)
			{
				if(a[i]==1&&a[i+1]<=1) ans++;
				if(a[i]>1&&a[i+1]<=a[i]) ans+=a[i];
			}
		cout<<ans<<endl;
		}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
using namespace std;
const int N=4000007;
char A[N],B[N];
int a,b,l,F[N],G[N];
int main() {
	scanf("%s%s",A+1,B+1);
	a=strlen(A+1),b=strlen(B+1);
	while(a<(b<<1)) {
		For(i,1,a) A[i+a]=A[i];
		a<<=1;
	}
	For(i,1,a) A[i+a]=A[i];
	a<<=1;
	F[0]=-1;
	For(i,1,b) {
		int j=i-1;
		while(j&&B[F[j]+1]!=B[i]) j=F[j];
		F[i]=F[j]+1;
	}
	int j=0,ans=0;
	For(i,1,a) {
		while(~j&&A[i]!=B[j+1]) j=F[j];
		if(++j==b) {
			G[i]=G[i-b]+1;
			ans=max(ans,G[i]);
			l=i;
		}
	}
	if(ans>=a/b-1) puts("-1");
	else printf("%d\n",ans);
	return 0;
}

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

bool exist(int a,int b,int c){
    bool flag=false;
    if(a>0&&b>0&&c>0&&a+b>c&&a+c>b&&c+b>a)flag=true;
    return flag;
}
int type_check(int a,int b,int c){
    if(a*a==c*c+b*b)return 0;
    else if(a*a<b*b+c*c)return 1;
    else if(a*a>c*c+b*b)return 2;
    else return 3;
}
void max_sort(int t[]){
    for(int i=0;i<3;i++){
        if (t[0]<t[i]){
            int tmp=t[0];
            t[0]=t[i];
            t[i]=tmp;
        }
    }
}

int main(){
    int c1=0,c2=0,c3=0,c4=0;
    int t_side[3];
    while(true){
        cin >> t_side[0]>>t_side[1]>>t_side[2];
        max_sort(t_side);
        if(!exist(t_side[0],t_side[1],t_side[2]))break;
        switch(type_check(t_side[0],t_side[1],t_side[2])){
            case 0: c1++; break;
            case 1: c2++; break;
            case 2: c3++; break;
        }
        c4++;
    }
    cout <<c4<<" "<<c1<<" "<<c2<<" "<<c3<<endl;
    return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define ull unsigned long long
using namespace std;
const int maxx = 1007;
const ll mod1 = 1e7;
const ll mod = 1e9 + 7;
const ll base = 311;
const ll base1 = 113;
const ll maxn = 1e6 + 7;
bool check;
ll t, T, n, a[maxn], b[maxn], m1, m, tong, r, ans, mx, k, ma[maxx][maxx], pw[maxx][maxx];
//ll , c[maxx], st1[maxx];
//ll  , pw[maxx];
//string s[maxx], ss[maxx], str, f[maxx][10];
struct dang
{
    ll mn, gcd, val, pos, dd, n1, n2, n3;
};
dang f[maxx][maxx];
string s;
struct les
{
    bool operator()(ll x, ll y)
    {
        return x > y;
    }
};
dang c[maxn];
deque<ll> st;
priority_queue<ll, vector<ll>, les >st1;
map<ll, ll> mp;
vector<ll> adj;
void sol()
{

    cin >> n;
    ans = 0;
    for(int i = 1; i <= n; i ++)
        cin >> a[i];
    for(int i = 1; i <= n; i ++)
        cin >> b[i];
    for(int i = 1; i <= n; i ++)
    {
        while(!st.empty() && b[st.back()] < b[i])st.pop_back();
        while(!st.empty() && b[st.front()] > a[i])st.pop_front();
        if(a[i] != b[i] && (st.empty() || b[st.back()] != b[i]))
        {
            ++ans;
            st.push_back(i);
        }
    }
    cout << ans;
}

void ntu()
{
    cin >> n >> k;
    ans = 0;
    for(ll i = k; i <= n + 1; i ++)
    {
        ans += ((n + n - i + 1) * i / 2 - i * (i - 1) / 2 + 1);
        ans %= mod;
        //cout << ans<<" ";
    }
    cout << ans;
}
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    //freopen("Test.INP", "r", stdin);
    ntu();
}
/*
3 4
0 3 -1 2
3 3 3 3
3 1 3 0
*/


Measured memory_bytes: 3652
#!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>

"""
from __future__ import division, print_function

import itertools
import math
import os
import sys
from atexit import register
from io import BytesIO


class dict(dict):
    """dict() -> new empty dictionary"""

    def items(self):
        """D.items() -> a set-like object providing a view on D's items"""
        return dict.iteritems(self)

    def keys(self):
        """D.keys() -> a set-like object providing a view on D's keys"""
        return dict.iterkeys(self)

    def values(self):
        """D.values() -> an object providing a view on D's values"""
        return dict.itervalues(self)


def gcd(x, y):
    """greatest common divisor of x and y"""
    while y:
        x, y = y, x % y
    return x


range = xrange

filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip

sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))

input = lambda: sys.stdin.readline().rstrip('\r\n')

n = int(input())
p = [float(i) for i in input().split()]

dp = [[0.0] * (n + 1) for _ in range(n)]
dp[0][0], dp[0][1] = 1 - p[0], p[0]

for i in range(1, n):
    dp[i][0] = (1 - p[i]) * dp[i - 1][0]
    for j in range(1, n + 1):
        dp[i][j] = (p[i] * dp[i - 1][j - 1]) + ((1 - p[i]) * dp[i - 1][j])

print(sum(dp[-1][(n + 1) // 2:]))


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

int main()
{
    int r,g,b;
    cin >> r >> g >> b;
    int a = r*100 + g*10 + b;

    if(a%4==0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3528
#include<stdio.h>
typedef long long LL;
LL IN(void)
{
  LL x=0;int f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
int main(void)
{
  LL N=IN();static int i,str[11],sz=0;
  while(N){N--;str[sz++]=97+N%26;N/=26;}
  for(i=0;i<sz;i++)printf("%c",str[sz-i-1]);
}

Measured memory_bytes: 1532
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())

    pt, px, py = 0, 0, 0
    for _ in range(N):
        t, x, y = map(int, input().split())
        dt = t - pt
        dx = abs(x - px)
        dy = abs(y - py)
        dl = dx + dy

        if dt < dl or dl % 2 != dt % 2:
            print('No')
            return

        pt, px, py = t, x, y

    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;

int main(){
    int n,a;cin>>n;
    int ans=0;
    lol(i,n){
	cin>>a;
	while(a%2==0){
	    ans++;
	    a/=2;
	}
    }
    cout<<ans<<endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

// h(n, r) = c(n+r-1, r)
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
    fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
    ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
    return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};



int main()
{
  int n;
  cin >> n;
  if(n <= 999) cout << "ABC" << endl;
  else cout << "ABD"  << endl;
}


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

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

    int n; cin >> n;

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

    int ans = 0;
    for (int i = 1; i < n - 1; i++) {
        if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++;
        if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++;
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
(defparameter *inf* (expt 10 9))

(defun solve (n k h)
  (let ((memo (make-array (+ n k 1) :initial-element *inf*)))
    (setf (aref memo 0) 0)
    (dotimes (x n)
      (dotimes (i k)
        (setf (aref memo (+ x (1+ i))) (min (aref memo (+ x (1+ i)))
                                       (+ (aref memo x)
                                          (abs (- (aref h (+ x (1+ i)))
                                                  (aref h x))))))))
    (aref memo (1- n))))


(defun main ()
  (let* ((n (read))
         (k (read))
         (h (make-array 104000 :adjustable t :initial-element 0)))
    (dotimes (i n)
      (setf (aref h i) (read)))
    (princ (solve n k h))
    (fresh-line)))


(main)


Measured memory_bytes: 76984
#include <bits/stdc++.h>
using namespace std;
int main(){
long long int q,h,s,d;
  long long int n;
  cin>>q>>h>>s>>d>>n;
  vector<long long int> a = {d,2*s,4*h,q*8};
  sort(a.begin(),a.end());
  long long int k;
  k=a[0];
  vector<long long int> b = {s,2*h,q*4};
  sort(b.begin(),b.end());
  long long int z;
  z=b[0];
  long long int f;
  f= (n/2)*k+(n%2)*z;
  cout<<f<<endl;
  return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
long double pi = 2 * acos(0.0);
const ll mod = 1e9 + 7;

void solve() {
    ll n;
    cin >> n;
    if(n >= 400 && n <= 599) cout << "8\n";
    else if(n >= 600 && n <= 799) cout << "7\n";
    else if(n >= 800 && n <= 999) cout << "6\n";
    else if(n >= 1000 && n <= 1199) cout << "5\n";
    else if(n >= 1200 && n <= 1399) cout << "4\n";
    else if(n >= 1400 && n <= 1599) cout << "3\n"; 
    else if(n >= 1600 && n <= 1799) cout << "2\n"; 
    else if(n >= 1800 && n <= 1999) cout << "1\n"; 
    
}
           

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(nullptr);   
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
import sys


def input(): return sys.stdin.readline().strip()


def solve(count, amount):
    for x in range(count+1):
        for y in range(count-x+1):
            z = count - x - y
            s = 10000*x + 5000*y + 1000*z
            if s == amount:
                return (x, y, z)
    return (-1, -1, -1)


def main():
    N, Y = map(int, input().split())
    print(*solve(N, Y), sep=" ")


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import java.util.*;

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

    int a = sc.nextInt();
    int b = sc.nextInt();
    //2塔の差が2なら左の塔は1
    //差が3なら1+2,差が4なら1+2+3.....
    //差がnなら1+2+3+.....+(n-1)=n(n-1)/2
    //右の塔はn(n+1)/2

    int c = b - a;

    int left_monu = c*(c-1)/2;
    int right_monu = c*(c+1)/2;

    //System.out.println(left_monu-a);
    System.out.println(right_monu-b);






  }
}

Measured memory_bytes: 22356
#include <iostream>
#include <vector>

int main() {
  int N, M; std::cin >> N >> M;
  const int MOD = 1000000007;
  std::vector<bool> issafe;
  
  issafe.assign(N+1, true);
  for (int i = 0; i < M; ++i) {
    int bs; std::cin >> bs;
    issafe[bs] = false;
  }
  
  std::vector<int> dp(N+1, 0); 
  dp[0] = 1; // 0段目の行き方は0通り
  if (issafe[1]) dp[1] = 1;
  // 貰うDP
  for (int i = 2; i <= N; ++i) {
    if (issafe[i-1]) dp[i] += dp[i-1];
    if (issafe[i-2]) dp[i] += dp[i-2];
    dp[i] %= MOD;
  }
  
  std::cout << dp[N] << std::endl; // N段目の階段k
}

Measured memory_bytes: 3768
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;

int price[1010];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, m;
	while(cin >> n >> m && n != 0 && m != 0){
	
		for(int i = 0; i < n; ++i){
			cin >> price[i];
		}
		
		sort(price, price + n, greater<int>());
		
		int ans = 0;
		/*int s = 0;
		while(s < n){
			int sum = 0;
			for(int i = s; i < s + m - 1 && i < n - 1; ++i){
			   sum	+= price[i];
			}
			++s;
			ans += sum;
		}*/
		/*if(m == 1){
			for(int i = 0; i < n; ++i){
				ans += price[i];
			}
			cout << ans << endl;
			return 0;
		}*/
	
		for(int i = 0; i < n; ++i){
			if((i + 1) % m != 0){
				ans += price[i];
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
int a,b;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
    
	ld a,b,x;
	cout << fixed << setprecision(10);
	cin >> a >> b >> x;
	if(a*a*b == x){
		cout << 0.00000000 << endl;
		return 0;
	}
	ld h = b;
	ld base = (2.00*x)/(a*b);
	//cout << base << " " << h << endl;
	if(base<=a){
	ld pi = acos(-1);
	ld ans = atan(h/base);
	ans = ans*(180.000/pi);
  cout << ans << endl;  
	}
	else {
		ld y =  b - ((2.000*x)/(a*a) - b);
		ld pi = acos(-1);
		ld ans = atan(a/y);
		ans = ans*(180.000/pi);
		ans = 90-ans;
		cout << ans << endl;		
	}
return 0;
}
///....


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

#define int long long
const int INF = LLONG_MAX/10;

string S;

signed main()
{
	cin >> S;
	cout << S.substr(0, 5) << " " << S.substr(6, 7) << " " << S.substr(14, 5) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	int[][] land;
	int w,h,count;
	int[] dx={-1,-1,-1,0,0,1,1,1},dy={-1,0,1,-1,1,-1,0,1};
	Scanner stdin =new Scanner(System.in);
	
	public void Solve(){
		
		while(true){
			count=0;
			w=stdin.nextInt();
			h=stdin.nextInt();
			
			if(w==0&&h==0) break;
			land=new int[h][w];
			
			
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					land[i][j]=stdin.nextInt();
				}
			}
			
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					if(land[i][j]==1){
						dfs(i,j);
						count++;
					}
				}
			}
			
			System.out.println(count);
			
			
			
			
			
		}
		
		
	}
	
	public void dfs(int i,int j){
		land[i][j]=0;
		for(int k=0;k<8;k++){
			int xx=i+dx[k];
			int yy=j+dy[k];
			if(0<=xx&&xx<h&&0<=yy&&yy<w){
				if(land[xx][yy]==1) dfs(xx,yy);
				
			}
			
		}
	}
	
	public static void main (String args[]){
		Main m=new Main();
		m.Solve();
	}
	
}

Measured memory_bytes: 43224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()	
{
	int n,t,a,b,p=0,q=0,r=0,dis;
	bool flag=true;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>t>>a>>b;
		dis=abs(p-a)+abs(q-b);
		if(dis>t-r)flag=false;
		else if(((t-r)-dis)%2)flag=false;
		p=a,q=b,r=t;
	}
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256