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

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORTASC(c) sort((c).begin(), (c).end())
#define SORTDESC(c, t) sort((c).begin(), (c).end(), std::greater<t>());
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

const double PI = acos(-1.0);

using ll = long long;
using namespace std;

int main()
{
    ll n;
    ll v[110];

    cin >> n;
    REP(i, n){
        cin >> v[i];
    }

    ll mn = 999999;
    REP(i, n){
        ll sum1 = 0;
        ll sum2 = 0;
        REP(j, i){
            sum1 += v[j];
        }
        REP(k, n-i){
            sum2 += v[i + k];
        }
        mn = min(mn, abs(sum1 - sum2));
    }

    cout << setprecision(20) << mn << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace abc139_c
{
    static class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine().ToInteger();
            var h = Console.ReadLine().ToIntArray();
            
            var max = 0;
            var count = 0;
            for(var i = 1; i < h.Length; i++){
                if(h[i - 1] >= h[i]){
                    count++;
                    if(count > max){
                        max = count;
                    }  
                } else {
                    count = 0;
                }
            }
            
            Console.WriteLine($"{max}");
        }

        static int ToInteger(this string s)
        {
            return int.Parse(s);
        }

        static int[] ToIntArray(this string s, char separator = ' ')
        {
            return s.Split(separator).Select(m => m.ToInteger()).ToArray();
        }
    }
}


Measured memory_bytes: 26204
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  
  
  string s[110];
  
  
  string t[110];
  
  for(int i=0; i<n; i++){
    cin >> s[i];
  }
  cin >> m;
  for(int i=0; i<m; i++){
    cin >> t[i];
  }
  int maxx=0;
  for(int i=0; i<=100; i++){
    int cnt = 0;
    for(int j=0; j<n; j++){
      if(s[i]==s[j]){
        cnt++;
      }
    }
    for(int j=0; j<m; j++){
      if(s[i]==t[j]){
        cnt--;
      }
    }
    maxx = max(maxx, cnt);
  }
  cout << maxx << endl;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  
  int cnt[31] = {0};
  for (int i=0;i<N;i++) {
    int K;
    cin >> K;
    for (int j=0;j<K;j++) {
      int content;
      cin >> content;
      cnt[content-1] += 1;
    }
  }
  
  int s=0;
  for (int i=0;i<M;i++) {
    if (cnt[i]==N) {
      s += 1;
    }
    
  }
  cout << s << endl;
  
  return 0;
}

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

int main(){
	volatile clock_t c = clock();
	string s;
	cin >> s;
	c += (s[2] - 'a' + 1) * 0.01 * CLOCKS_PER_SEC;
	while(clock() < c);
	if(s[2] == s[3] && s[4] == s[5]){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    int A, B, C;

    cin >> A >> B >> C;

    if(A+B+C==17 && ((A==5&&B==5) || (A==5&&B==7) || (A==7&&B==5))){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int H,W; cin>>H>>W;
  int ans=MOD;
  vi P={H/3,H/3+1,W/3,W/3+1};
  rep(i,0,2){
    int K=H-P[i];
    int Q=K/2,R=W/2;
    int S1=P[i]*W,S2=Q*W,S3=(K-Q)*W;
    ans=min(ans,max(S1,max(S2,S3))-min(S1,min(S2,S3)));
    S1=P[i]*W;
    S2=R*K;
    S3=(W-R)*K;
    ans=min(ans,max(S1,max(S2,S3))-min(S1,min(S2,S3)));
   // cout<<P[i]<<" "<<Q<<" "<<R<<endl;
  }
  rep(i,2,4){
    int K=W-P[i];
    int Q=K/2,R=H/2;
    int S1=P[i]*H,S2=Q*H,S3=(K-Q)*H;
    ans=min(ans,max(S1,max(S2,S3))-min(S1,min(S2,S3)));
    S1=P[i]*H;
    S2=R*K;
    S3=(H-R)*K;
    ans=min(ans,max(S1,max(S2,S3))-min(S1,min(S2,S3)));
   //cout<<P[i]<<" "<<Q<<" "<<R<<endl;
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>

using namespace std;

int n;

void maxHeapify (int H[], int i) {
  int l = i * 2;
  int r = i * 2 + 1;
  int largest;

  if (l <= n && H[i] < H[l])
    largest = l;
  else
    largest = i;
  if (r <= n && H[i] < H[r])
    largest = H[r] > H[l] ? r : l;

  // cout << i << " " << largest << endl;

  if (largest != i) {
    swap(H[i], H[largest]);
    maxHeapify(H, largest);
  }
}

void buildMaxHeap (int H[]) {
  for (int i = n / 2; i >= 1; i--)
    maxHeapify(H, i);
}

int main () {
  int H[500002];

  cin >> n;

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

  buildMaxHeap(H);
  // maxHeapify(H, 3);
  // maxHeapify(H, 2);
  // maxHeapify(H, 1);

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

  cout << endl;

  return 0;
}



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

int main(void)
{
    string s;
    cin >> s;
    int n = s.size();

    if(s == "zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
        return 0;
    }

    vector<int> counts(26, 0);
    for (int i = 0; i < n ; i++)
    {
        counts[s[i] - 97] = i + 1;
    }

    if(n < 26){
        for (int i = 0; i < 26; i++)
        {
            if(counts[i] == 0){
                s += (char) (i + 97);
                break;
            }
        }

        cout << s << endl;
    } else {
        int edge = 0;
        for(int i = n; i > 0; i--){
            if(s[i] > s[i-1]) {
                edge = i;
                break;
            }
        }
        char minchar = 'z'+1;
        for(int i = edge; i < n; i++){
            if(minchar > s[i] && s[i] > s[edge-1]){
                minchar = s[i];
            }
        }

        s[edge - 1] = minchar;
        s.resize(edge);
        cout << s << endl;
    }

    return 0;
}


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

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, b, e) for (i64 i = (b); i <= (e); ++i)
#define repr(i, b, e) for (i64 i = (b); i >= (e); --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? " " : "");
  outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? "\n" : "");
  outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
  return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
  return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

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

  var(int, N, M);

  priority_queue<i64> que;
  rep(i, N) {
    var(int, a);
    que.emplace(a);
  }

  while (M--) {
    i64 tmp = que.top();
    que.pop();
    que.emplace(tmp / 2);
  }

  i64 res = 0;
  rep(i, N) {
    res += que.top();
    que.pop();
  }

  outl(res);

  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define fr(i,f,t) for(ll i=(f);i<t;i++)
#define fb(i,f,t) for(ll i=(f);i>=t;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector<int> vec(n+1,0);
    map<ll,ll> mp1;
    map<ll,ll> mp2;
    for(int i=1;i<=n;i++){
    	cin>>vec[i];
    	mp1[i-vec[i]]++;
    	mp2[i+vec[i]]++;
    }
    ll cnt=0;
    map<ll,ll>::iterator itr;
    for(itr=mp1.begin();itr!=mp1.end();itr++){
    	if(mp2.find(itr->ff)!=mp2.end()){
    		cnt+=(itr->ss*mp2[itr->ff]);
    	}
    }
    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 27068
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll a[5]={};
ll counter=0;
ll i=0;
string s;
for(ll k=0; k<n; k++){
cin>>s;
if(s.at(0)=='M'){
a[0]++;}
else if(s.at(0)=='A'){
a[1]++;}
else if(s.at(0)=='R'){
a[2]++;}
else if(s.at(0)=='C'){
a[3]++;}
else if(s.at(0)=='H'){
a[4]++;}}
for(ll i=0; i<5; i++){
for(ll n=i+1; n<5; n++){
for(ll m=n+1; m<5; m++){
counter+=a[i]*a[n]*a[m];}}}
cout<<counter<<endl;}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  int N; cin >> N;
  map<int,int> mp;
  rep(i,N){
    int a; cin >> a;
    mp[a]++;
  }
  fore(i,mp){
    if(i.second!=1){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


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

int main(){
  int N,W;
  cin>>N>>W;
  int v[N],w[N];
  for(int i=0;i<N;i++){
    cin>>v[i]>>w[i];
  }
  int DP[N+1][W+1];
  for(int j=0;j<=W;j++){
    DP[0][j]=0;
  }
  for(int i=1;i<=N;i++){
    for(int j=0;j<=W;j++){
      if(j<w[i-1]){
        DP[i][j]=DP[i-1][j];
      }
      else{
        if(DP[i-1][j]>DP[i][j-w[i-1]]+v[i-1]){
          DP[i][j]=DP[i-1][j];
        }
        else{
          DP[i][j]=DP[i][j-w[i-1]]+v[i-1];
        }
      }
    }
  }
  cout<<DP[N][W]<<endl;
}



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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, n, m) for(int i = n; i < (int)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()

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

ll MOD = 1000000007;

int main()
{
    ll S;
    cin >> S;
    ll tmp = 1000000000;
    ll n = S / tmp;
    ll m = S % tmp;
    if (n == tmp) {
        PRINT(0 << " " << 0 << " " << tmp << " " << 0 << " " << 0 << " " << tmp);
    } else {
        PRINT(0 << " " << 0 << " " << 1 << " " << tmp << " " << n+1 << " " << tmp - m);
    }

    return 0;
}


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

int main(){
  int H, W; cin >> H >> W;
  vector<string> glid(H);
  for(int h = 0; h < H; h++){
    cin >> glid[h];
  }
  
  bool ok = true;
  for(int h = 0; h < H; h++){
    for(int w = 0; w < W; w++){
      if(glid[h][w] == '.') continue;
      bool pok = false;
      if(w > 0) {
        if(glid[h][w-1] == '#') pok = true;
      }
      if(w < W - 1) {
        if(glid[h][w+1] == '#') pok = true;
      }
      if(h > 0) {
        if(glid[h-1][w] == '#') pok = true;
      }
      if(h < H - 1) {
        if(glid[h+1][w] == '#') pok = true;
      }
      if(!pok) ok = false;
    }
    if(!ok) break;
  }
  cout << (ok?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <functional>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

const int MAX = 510000;
const int MOD = 1e9 + 7;

LL fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
LL COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	COMinit();

	LL n, k;
	cin >> n >> k;

	LL red = n - k;
	rep(i, 1, k + 1) {
		cout << COM(red + 1, i) * COM(k - 1, i - 1) % MOD << endl;
	}
	return 0;
}

Measured memory_bytes: 12160
from math import pi,sqrt,cos
a,b,h,m=map(int,input().split())
theta1=360*(m/60)
theta2=360*(h/12)+360*(m/60)/12
theta=abs(theta2-theta1)
theta=min(theta,360-theta)*2*pi/360
c=sqrt(a**2+b**2-2*a*b*cos(theta))
print(c)



Measured memory_bytes: 9432
#!/usr/bin/env python3
inf = 10**6+1
visit = [0]*inf
s = int(input())
visit[s] = 1
cnt = 1
while True:
    cnt += 1
    if s % 2: s = s*3 + 1
    else: s = s // 2
    if visit[s]:
        print(cnt)
        exit(0)
    else: visit[s] = 1

Measured memory_bytes: 10868
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

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

	ll n;
	cin >> n;
	vll a(n);
	for (ll i = 0; i < n; i++) cin >> a[i];

	vll v(n + 1, 0);
	ll ans1 = 0;
	for (ll i = 0; i < n; i++) {
		v[i + 1] = v[i] + a[i];
		if (i % 2 == 0 && v[i + 1] <= 0) {
			ans1 += 1 - v[i + 1];
			v[i + 1] = 1;
		}
		else if (i % 2 == 1 && v[i + 1] >= 0) {
			ans1 += v[i + 1] + 1;
			v[i + 1] = -1;
		}
	}

	vll w(n + 1, 0);
	ll ans2 = 0;
	for (ll i = 0; i < n; i++) {
		w[i + 1] = w[i] + a[i];
		if (i % 2 == 1 && w[i + 1] <= 0) {
			ans2 += 1 - w[i + 1];
			w[i + 1] = 1;
		}
		else if (i % 2 == 0 && w[i + 1] >= 0) {
			ans2 += w[i + 1] + 1;
			w[i + 1] = -1;
		}
	}

	cout << min(ans1, ans2) << endl;
}


Measured memory_bytes: 2560
# 2020/06/21
# AtCoder Beginner Contest 171 - A

# Input
s = input()

# Calc
sord = ord(s)
# print(ord('A')) # 65
# print(ord('Z')) # 90
# print(ord('a')) # 97
# print(ord('z')) # 122

if 65 <= sord and sord <= 90:
    ans = 'A'
elif 97 <= sord and sord <= 122:
    ans = 'a'

# Output
print(ans)


Measured memory_bytes: 8952
def main():
    l,r = map(int,input().split(' '))
    tmp = 2019
    if l//2019 < r//2019:
        print(0)
    else:
        for i in range(l,r):
            for j in range(i+1,r+1):
                if tmp > (i*j)%2019:
                    tmp = (i*j)%2019
        print(tmp)

if __name__ == '__main__':
    main()

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e6+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

int n;
vector<int> G[MAX_N];
int inDeg[MAX_N];

int mapTo(int x, int y) {
    return 1000 * min(x, y) + max(x, y);
}

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

    cin >> n;

    for (int i=1; i<=n; i++) {
        int early;
        cin >> early;
        for (int j=0; j<n-2; j++) {
            int later; cin >> later;
            int u = mapTo(early, i);
            int v = mapTo(later, i);
            G[u].push_back(v);
            inDeg[v]++;
            early = later;
        }
    }

    int processed = 0;
    int ans = 0;

    vector<int> q;
    for (int i=1; i<MAX_N; i++) {
        if (inDeg[i] == 0) q.push_back(i);
    }

    while (!q.empty()) {
        ans++;
        vector<int> tmp;
        processed += q.size();
        for (int i=0; i<q.size(); i++) {
            int v = q[i];
            for (auto adj: G[v]) {
                inDeg[adj]--;
                if (inDeg[adj] == 0) tmp.push_back(adj);
            }
        }
        q = tmp;
    }

    if (processed != MAX_N-1) {
        cout << -1;
    } else {
        cout << ans;
    }


    return 0;
}


Measured memory_bytes: 45432
#レート 1-399：灰色
    #レート 400-799：茶色
    #レート 800-1199：緑色
    #レート 1200-1599：水色
    #レート 1600-1999：青色
    #レート 2000-2399：黄色
    #レート 2400-2799：橙色
    #レート 2800-3199：赤色

from collections import Counter
n = input()
c = Counter([min(int(i) // 400, 8) for i in input().split()])
ans = 0
for i in range(8):
    ans += (1 if c[i] > 0 else 0)
print(max(ans, 1), ans + c[8])

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

using namespace std;

int a[105];
bool dp[100005] = {false};
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;++i)
	scanf("%d",a+i);
	for(int i=0;i<=k;++i)
	{
		for(int j=0;j<n;++j)
		{
			if(i == 0)
			dp[i] = false;
			else if(i >= a[j] && dp[i-a[j]] == false)
			{
				dp[i] = true;
				break;		
			}
		}
	}
	if(dp[k] == true)
	printf("First\n");
	else
	printf("Second\n");
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cctype>
#include<cmath>
using namespace std;
#define max 1001
int main()
{
	int n;
	double  a[max];
	double m, su,biao;
	cin >> n;

	cout.setf(ios::fixed);
	cout.setf(ios::showpoint);
	cout.precision(8);

	while (n != 0)
	{
		su = 0;
		biao=0;
		for (int i = 0; i < n; i++)
		{
			cin >> a[i];
			su += a[i];
		}
		m = su / n;
		for (int i = 0; i < n; i++)
			biao += pow(a[i] - m, 2);
		biao/=n;
		cout << sqrt(biao)<< endl;	
		cin>>n;	
	}
	return 0;
}


Measured memory_bytes: 3244
//submitted by Himj
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const int mxn=2e5+1;

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

  int t=1;
  //cin>>t;
    while(t--){
      int n=4,i,arr[4];
      fr(i,0,n)
      cin>>arr[i];
      sort(arr,arr+n);
      int c[]={1,4,7,9};
      fr(i,0,n)
      {
        if(c[i]!=arr[i])
        {
          cout<<"NO";
          return 0;
        }
      }
      cout<<"YES";
      
       
    }
  return 0;
  }



Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
#include<bits/stdc++.h>
 
using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); 
#define nl "\n"
#define sz(a) (int)(a).size() 
#define all(a) (a).begin(),(a).end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;  
#define mt make_tuple 
#define vec vector
 
#define int long long 
 
const int mod = (int) 1e9 + 7 ;
const int MOD = (int) 998244353 ;
const int INF = (int) 1e18 ;
 
typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve(int test) {
	
	int l,r,d ; cin >> l >> r >> d ;
	int ans = 0 ;
	for(int i = l ; i <= r ;++i) {
		if(i%d==0) ++ans;
	}
	cout << ans ;
}
 
int32_t main() {
 

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve(i) ;
	}
 
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

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

int main()
{
	int n, m, l;
	cin >> n >> m >> l;
	long long A[100][100];
	long long B[100][100];
	long long C[100][100];

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++){
			cin >> A[i][j];
		}
	}
	for (int i = 0; i < m; i++){
		for (int j = 0; j < l; j++){
			cin >> B[i][j];
		}
	}

	for (int i = 0; i < 100; i++){
		for (int j = 0; j < 100; j++){
			C[i][j] = 0;
		}
	}

	for (int i = 0; i < n; i++){
		for (int j = 0; j < l; j++){
			for (int k = 0; k < m; k++){
				C[i][j] += A[i][k] * B[k][j];
			}
		}
	}

	for (int i = 0; i < n; i++){
		for (int j = 0; j < l; j++)
		{
			if (j != l - 1)cout << C[i][j] << " ";
			if (j == l - 1) cout << C[i][j] << endl;
		}
	}
	return 0;
}




Measured memory_bytes: 3336
N = gets.to_i
s_list = []

start_b = 0
end_a = 0
both = 0

count = 0
N.times{
	s = gets.strip
	s_list << s
	s.scan(/AB/){
		count += 1
	}
	if s[0] == "B"
		if s[-1] == "A"
			both += 1
		else
			start_b += 1
		end
	elsif s[-1] == "A"
		end_a += 1
	end
}

if both >= 1
	count += (both - 1)
	if start_b > 0
		count += 1
		start_b -= 1
	end
	if end_a > 0
		count += 1
		end_a -= 1
	end
end

count += [start_b, end_a].min

puts count


Measured memory_bytes: 3068
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

char c[333][333];
vector<pair<int, pii> > v[123][123];
int dis[123][123];
int main()
{
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; i ++)
	for(int j = 1; j <= m; j ++)
		cin >> c[i][j];
	for(int i = 1; i <= n; i ++)
	for(int j = 1; j <= m; j ++)
	{
		if(c[i][j] == '.')
		{
			if(c[i][j + 1] == '#')
				v[i][j].pb(M(1, M(i, j + 1)));
			else
			if(c[i][j + 1] == '.')
				v[i][j].pb(M(0, M(i, j + 1)));
			if(c[i + 1][j] == '#')
				v[i][j].pb(M(1, M(i + 1, j)));
			else
			if(c[i + 1][j] == '.')
				v[i][j].pb(M(0, M(i + 1, j)));				
		}
		else
		{
			if(c[i][j + 1] == '#' || c[i][j + 1] == '.')
				v[i][j].pb(M(0, M(i, j + 1)));
			if(c[i + 1][j] == '#' || c[i + 1][j] == '.')
				v[i][j].pb(M(0, M(i + 1, j)));
		}
	}
	priority_queue<pair<int, pii> > q;
	q.push(M(0, M(1, 1)));
	for(int i =1 ; i <= n; i ++)
	for(int j = 1; j <= m; j ++)
		dis[i][j] = 1e9;
	dis[1][1] = (c[1][1] == '#');
	while(q.size())
	{
		int x = q.top().S.F, y = q.top().S.S, d = -q.top().F;
		q.pop();
		if(d > dis[x][y])
			continue;
		for(auto it : v[x][y])
		{
			if(dis[it.S.F][it.S.S] > dis[x][y] + it.F)
			{
				dis[it.S.F][it.S.S] = dis[x][y] + it.F;
				q.push(M(-dis[it.S.F][it.S.S], it.S));
			}
		}
	}
	cout << dis[n][m];



	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

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

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int x,y;cin>>x>>y;

  int ans=0;
  if (x==1){
    ans += 300000;
  }
  if (x==2){
    ans += 200000;
  }
  if (x==3){
    ans += 100000;
  }
  if (y==1){
    ans += 300000;
  }
  if (y==2){
    ans += 200000;
  }
  if (y==3){
    ans += 100000;
  }
  if (x==1 && y==1){
    ans += 400000;
  }
  cout << ans << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include <utility>
#include <vector>
#include <iostream>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    long N, M;   
    cin >> N >> M;
    long ans = 0;
    if (N == 1){
        if (M >= 2){
            ans = M-2;    
        }else if(M==1){
            ans = 1;
        }
    }else if (M==1){
        ans = N-2;
    }else{
        ans = (N-2) * (M-2);
    }

    cout << ans <<endl;
}

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

int main() {
	map<string,int> mp;
	int n,count=0;
	cin >> n;
	for (int i=0; i<n; i++) {
		string s;
		cin >> s;
		if (!mp[s]) {
			mp[s]++;
			count++;
		} 
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 19224
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws IOException
	{
		int n=nextInt();
		int low=0,high=n-1;
		boolean lowmale=guess(low);
		while(high-low>1)
		{
			int mid=(low+high)/2;
			boolean midmale=guess(mid);
			if((mid-low)%2==0)
			{
				if(lowmale==midmale)
				{
					low=mid;
					lowmale=midmale;
				}
				else
					high=mid-1;
			}
			else
			{
				if(lowmale==midmale)
					high=mid-1;
				else
				{
					low=mid;
					lowmale=midmale;
				}
			}
		}
		guess(high);
		guess(low);
	}
	boolean guess(int x)throws IOException
	{
		System.out.println(x);
		String s=nextLine();
		if(s.equals("Vacant"))
			System.exit(0);
		else if(s.equals("Male"))
			return true;
		return false;
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 23844
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
template <typename T>inline T read()
{
	register T sum=0;
	char cc=getchar();
	int sym=1;
	while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
	if(cc=='-')sym=-1,cc=getchar();
	sum=sum*10+cc-'0';
	cc=getchar();
	while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
	return sym*sum;
}
template <typename T>inline T read(T &a)
{
	a=read<T>();
	return a;
}
int ans=0x7fffffff,n,T;
int main()
{
	n=read<int>(),T=read<int>();
	for(int i=1;i<=n;i++)
	{
		int x=read<int>(),y=read<int>();
		if(y<=T)ans=min(ans,x);
	}
	if(ans<0x7fffffff)
		printf("%d",ans);
	else
		printf("TLE");
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Arrays;
import java.util.Set;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
       int A=sc.nextInt();
       int B=sc.nextInt();
       int C=sc.nextInt();
       int D=sc.nextInt();
       int E=0;
       if(A>=B){
           E=B;
       }else{
           E=A;
       }
       int F=0;
       if(C>=D){
           F=D;
       }else{
           F=C;
       }
       System.out.println(E+F);


        

       
        
    }}

Measured memory_bytes: 23892
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] split = line.split(" ");
        
        int n = Integer.parseInt(split[0]);
        int m = Integer.parseInt(split[1]);
        
        
        
        if (n == m) {
        	System.out.println(factorial(n)*factorial(m)*2%1000000007);
        } else if (n+1 == m || n-1 ==m) {
        	System.out.println(factorial(n)*factorial(m)%1000000007);
        } else {
        	System.out.println(0);
        }

        
	}
	
	public static long factorial(int n) {
		long ans = 1;
		for (long i = 2; i <= n; i++) {
			ans *= i;
			ans %= 1000000007;
		}
		return ans;
	}

	

}


Measured memory_bytes: 22996
#include <stdio.h>
 
int main(void){
    int a, b, max;
    scanf("%d %d",&a, &b);
 
    max = a*b;
 
    if(max < a-b){
        max = a-b;
    }
 
    if(max < a + b){
        max = a + b;
    }
 
    printf("%d", max);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) for(ll i=1;i<=(n);i++)
#define MOD 1000000007
#define int long long
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9;

string A;
int ne[202020][26];
int dp[202020];
P memo[202020];

int rec(int i)
{
    if (i >= A.length()) {
        memo[i].second = -1;
        return 1;
    }
    if (dp[i] != 0) return dp[i];

    int minV = 90909090;
    char minC;

    REP(j,26) {
        if (ne[i][j] == A.length()) {   //見つからなかった場合
            minV = 1;
            minC = j;
            memo[i].first = minC;
            memo[i].second = -1;
            break;
        }
        int V = 1 + rec(ne[i][j]+1);
        if (V < minV) {
            minV = V;
            minC = j;
            memo[i].first = minC;
            memo[i].second = ne[i][j]+1;
        }
    }

    return dp[i] = minV;
}

signed main()
{
    cin >> A;

    REP(i,26) {
        ne[A.length()][i] = A.length();
    }
    for (int i=A.length()-1; i>=0; i--) {
        REP(j,26) {
            ne[i][j] = ne[i+1][j];
            if (A[i] - 'a' == j) ne[i][j] = i;
        }
    }

    /*
    REP(i,A.length()+1) {
        cout << ne[i][0] << " ";
    }
    */

    rec(0);
    //cout << rec(0) << endl;
    for (int i=0; i!=-1; i=memo[i].second) {
        cout << (char)(memo[i].first + 'a');
    }
    cout << endl;
}


Measured memory_bytes: 46340
n=int(input())
x=sorted(map(int,input().split()))
m=sum(x)//n

s1=0
s2=0
s3=0
for i in range(n):
    s1 += (x[i]-m)**2
    s2 += (x[i]-m-1)**2
    s3 += (x[i]-m+1)**2
print(min(s1,s2,s3))

Measured memory_bytes: 3064
import sys
import pdb
input = sys.stdin.readline

N, W = map(int, input().split())
ws = []
vs = []
for _ in range(N):
  w, v = map(int, input().split())
  ws.append(w)
  vs.append(v)

# Value[i番目までの品番][重さj以下]
Value = [[0 for _ in range(W+1)] for __ in range(N)]

for load in range(W+1):
  if load < ws[0]:
    # 1番目の品物を入れようがなければスキップ
    Value[0][load] = 0
  else:
    Value[0][load] = vs[0]

for num in range(1, N):
  for load in range(W+1):
    if load >= ws[num]:   # 新しい品物を入れられるとき
      Value[num][load] = max(Value[num][load], Value[num-1][load], Value[num-1][load-ws[num]] + vs[num])
    else:   # 新しい品物を入れられないとき
      # 価値を変えることはできない
      Value[num][load] = Value[num-1][load]
      # Value[num][load] = max(Value[num][load], Value[num-1][load])

print(Value[N-1][W])


Measured memory_bytes: 178292
import Data.Bool
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V
import qualified Data.IntMap as IM
main=putStrLn.solve.map(unfoldr$B.readInt.B.dropWhile isSpace).B.lines=<<B.getContents
solve([n]:ab)=f 0 IM.empty[0][n-1]where
  f _ m[][]=bool"Snuke""Fennec"$(n`div`2<).length.filter(==0).IM.elems$m
  f i m vs us=f(1-i)mm us ws where
    (mm,ws)=((,)=<<foldr(\v->IM.insert v i)m).filter(`IM.notMember`m)$concatMap(g V.!)vs
  g=V.accum(flip(:))(V.replicate n [])$concatMap(\[a,b]->[(a-1,b-1),(b-1,a-1)])ab

Measured memory_bytes: 50052
#pragma region Include/Defines
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <limits.h>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <memory.h>
#include <string.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <queue>
#include <time.h>

using namespace std;
typedef long long lli;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
typedef vector<pii> vpii;
typedef vector <pll> vpll;
typedef long double ld;
#define all(a) std::begin(a), std::end(a)

const int INF = 0x3f3f3f3f;
const lli LINF = 0x3f3f3f3f3f3f3f3f;

template<typename T, typename T2> inline void _max(T &a, T2 b) { a = max((T)a, (T)b); }
template<typename T, typename T2> inline void _min(T &a, T2 b) { a = min((T)a, (T)b); }

#ifdef _DEBUG
#define epr(...) fprintf(stderr,__VA_ARGS__)
#else
#define epr(...) 
#endif
#pragma endregion

const int MAX = 1e5 + 10;
int n;
vi g[MAX];
int sz[MAX], p[MAX];

void clear() {
	for (int i = 0; i < MAX; i++) g[i].clear();
}

void read() {
	for (int i = 0; i < n - 1; i++) {
		int f, t;
		scanf("%d%d", &f, &t);
		f--, t--;
		g[f].push_back(t);
		g[t].push_back(f);
	}
}

void dfs(int v, int pr = -1) {
	p[v] = pr;
	sz[v] = 1;
	for (auto &to : g[v]) {
		if (to == pr) continue;
		dfs(to, v);
		sz[v] += sz[to];
	}
}

void solve() {
	dfs(0);
	int v = n - 1;
	vi stack(1, v);
	while (v != 0) {
		v = p[v];
		stack.push_back(v);
	}
	int nSnuke = sz[stack[(stack.size() - 2) / 2]];
	int nFennec = sz[0] - nSnuke;
	if (nSnuke >= nFennec) printf("Snuke\n");
	else printf("Fennec\n");
}

int main() {
#ifdef _LOCAL_VAN
	freopen("in.txt", "r", stdin);
#endif
	while (scanf("%d", &n) == 1) {
		clear();
		read();
		solve();
#ifndef _LOCAL_VAN
		return 0;
#endif
	}
	return 0;
}

Measured memory_bytes: 11772
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
using namespace std;
signed main(){
	int r,g;
	cin >> r >> g;
	int sa = g-r;
	cout << g + sa << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll n, ans;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)cin >> a[i];
    ans = a[0];
    REP(i, n-1)ans = __gcd(ans, a[i]);
    cout << ans << endl;
}

Measured memory_bytes: 1024
import fractions
a, b, c, d = [int(v) for v in input().split()]

gcd_cd = fractions.gcd(c, d)
e = c * d // gcd_cd

a_c = a // c
if a % c != 0:
  a_c += 1
b_c = b // c

a_d = a // d
if a % d != 0:
  a_d += 1
b_d = b // d

a_e = a // e
if a % e != 0:
  a_e += 1
b_e = b // e

print(b - a + 1 - ( (b_c - a_c + 1) + (b_d - a_d + 1) - (b_e - a_e + 1) ) )

Measured memory_bytes: 5076
import itertools

def count_order(numbers, str_P, str_Q):
    p_list = list(itertools.permutations(range(numbers), numbers))
    p_index = p_list.index(str_P)
    q_index = p_list.index(str_Q)
    return abs(q_index - p_index)

if __name__ == "__main__":
    num_of_index = int(input())
    str_P = tuple([int(i) - 1 for i in input().split()])
    str_Q = tuple([int(i) - 1 for i in input().split()])
    index = count_order(num_of_index, str_P, str_Q)
    print(index)

Measured memory_bytes: 8052
import java.util.Arrays;
import java.util.Scanner;

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

		for (int i = 0; i < n; i++) {
			String city = sc.next();
			int point = sc.nextInt();
			sp[i] = city + "_" + (1100 - point) + "_" + (i + 1);
		}

		Arrays.sort(sp);

		for (String s : sp) {
			String ans = s.split("_")[2];
			System.out.println(ans);
		}

		sc.close();
	}
}


Measured memory_bytes: 21844
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	s := 0
	for i := 0; i < n; i++ {
		a[i] = nextInt()
		s += a[i]
	}

	x := make([]int, n)
	for i := 1; i < n; i += 2 {
		s -= 2 * a[i]
	}
	x[0] = s

	for i := 0; i < n-1; i++ {
		x[i+1] = 2*a[i] - x[i]
	}

	for _, v := range x {
		fmt.Printf("%d ", v)
	}

}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w
using namespace std;

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

vector<int> prime;
bool flag[100001] = {true,true};

void list_prime(int N){
	for(int i = 4;i <= N;i += 2) flag[i] = true;
	for(int i = 3;i * i <= N;i += 2){
		if(flag[i]) continue;
		for(int j = i * 2;j <= N;j += i) flag[j] = true;
	}
	for(int i = 0;i <= N;i++) if(!flag[i]) prime.push_back(i);
}

signed main(){
	int q,cnt[100001] = {};
	cin >> q;
	list_prime(100000);
	for(int i = 100000;i >= 0;i--){
		if(!flag[i] && flag[(i + 1) / 2]) flag[i] = true;
	}
	for(int i = 1;i <= 100000;i++){
		cnt[i] = cnt[i - 1];
		if(!flag[i]) cnt[i]++;
	}
	for(int i = 0;i < q;i++){
		int l,r;
		cin >> l >> r;
		cout << cnt[r] - cnt[l - 1] << endl;
	}
	return 0;
}

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

int main() {
  vector<int> a(4);
  cin >> a.at(0) >> a.at(1) >> a.at(2) >> a.at(3);
  sort(a.begin(),a.end());
  if (a.at(0)==1 && a.at(1)==4 && a.at(2)==7 && a.at(3)==9) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int H, W;
vector<string> S;
vector<vector<bool>> seen;

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

pair<int, int> dfs(int x, int y){
    seen[x][y] = true;    
    pair<int, int> ret = {0, 0};
    if (S[x][y] == '.') ret.first++;
    else ret.second++;

    REP(i, 0, 4) {
        int nx = x + dx[i];
        int ny = y + dy[i];
        if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
        if (seen[nx][ny] || S[x][y] == S[nx][ny]) continue;
        auto p = dfs(nx, ny);
        ret.first += p.first;
        ret.second += p.second;
    }

    return ret;
}

int main() {
    cin >> H >> W;
    S.resize(H);
    REP(i, 0, H) cin >> S[i];

    ll ans = 0;
    seen.assign(H, vector<bool>(W, false));
    REP(i, 0, H) {
        REP(j, 0, W) {
            if (seen[i][j]) continue;
            auto p = dfs(i, j);
            ans += (ll)p.first * p.second;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 20480
import math
N,M = map(int, input().split())
ans = 0
if abs(N - M) >= 2:
    print(ans)
elif (N + M)%2 == 0:
    ans = (math.factorial(N) * math.factorial(M)) * 2
    print(ans%(10**9+7))
else:
    ans = math.factorial(N) * math.factorial(M)
    print(ans%(10**9+7))


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

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a*b)/gcd(a,b)
#define ff              first
#define ss              second
#define int             long long
#define pb              emplace_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             INT64_MAX
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define digits(x)		floor(log10(x))+1
#define FIO				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

class dsu {
private:
	int *id;
	int* sz;

	int root(int i) {
		while (i != id[i]) {
			id[i] = id[id[i]];
			i = id[i];
		}
		return i;
	}
public:
	int n;
	dsu(int v) {
		n = v;
		id = new int[n];
		sz = new int[n];

		for (int i = 0; i < n; i++) {
			id[i] = i;
			sz[i] = 0;
		}
	}

	bool find(int p , int q) {
		return root(p) == root(q);
	}

	void join(int p , int q) {
		int i = root(p);
		int j = root(q);
		if (i == j) {
			return;
		}
		if (sz[i] < sz[j]) {
			id[i] = j ;
			sz[j] += sz[i];
		}
		else {
			id[j] = i;
			sz[i] += sz[j];
		}
	}
};

class BIT {
private:
	int* FT;
	int n;
public:
	void updateBIT(int index , int val) {
		index += 1;
		while (index <= n) {
			FT[index] += val;
			index += (index & (-index));
		}
	}

	int getSum(int index) {
		index += 1;
		int sum = 0 ;
		while (index > 0) {
			sum += FT[index];
			index -= (index & (-index));
		}
		return sum;
	}


	BIT(int* a , int v) {
		n = v ;
		FT = new int[n + 1];
		for (int i = 1 ; i <= n ; i++) {
			FT[i] = 0 ;
		}
		for (int i = 0 ; i < n ; i++) {
			updateBIT(i, a[i]);
		}
	}
};

int nCr(int n , int r ) {
	int p = 1, k = 1;

	if (n - r < r ) {
		r = n - r;
	}
	if (r != 0) {
		while (r != 0) {
			p *= n ;
			k *= r ;
			int m = __gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else {
		p = 1;
	}
	return p ;
}

int modPower(int x, int y , int p) {
	//Used to calculate (x^y)%p
	int res = 1;
	if (y == 0) {
		return 1;
	}

	x = x % p;
	if (x == 0) {
		return 0  ;
	}

	while (y > 0) {
		if (y & 1) {
			res = (res * x) % p;
		}

		y >>= 1;
		x = (x * x) % p;
	}
	return res ;

}

int32_t main() {
	FIO;



	int n ;
	cin >> n;
	int k ;
	cin >> k;


	vi a(n);
	for (int i = 0 ; i < n ; i++) {
		cin >> a[i];
	}

	int count = 1;
	int i = k ;
	while (i < n) {
		i += (k - 1);
		count++;
	}
	cout << count;







	return 0;
}


Measured memory_bytes: 3952