akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <set>


using namespace std;

template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1LL << 60;

#define rep(i, e) for(int i = 0; i < e; i++)
#define repp(i, s, e) for(int i = s; i < e; i++)
#define MAX_N 100
#define Card_Max 36
#define p(a) printf("%d\n", a);
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define NIL -1

void print(const std::vector<ll>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

int par[MAX_N];

void init(int n){
    rep(i,n) par[i]=i;
}

int find(int x){
    if(par[x]==x){
        return x;
    }else
    {
        return par[x] = find(par[x]);
    }
}

bool same(int x, int y){
    return find(x) == find(y);
}

void tree_union(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    par[x] = y;
}

int main() {
    ull N,M, ac = 0, wa = 0;
    ull p[100005]={},wa_cnt[100005]={};
    string S[100005];
    map<ull, string> m;
    set<int> s;

    cin>>N>>M;
    rep(i,M){
        cin>>p[i]>>S[i];
        s.insert(p[i]);
        if(m.find(p[i]) != m.end() && m[p[i]] == "AC") continue;
        m[p[i]] = S[i];
        if(m[p[i]] == "AC"){
            ac++;
        }else{
            wa_cnt[p[i]]++;
        }
    }


    for(auto i: s){ 
        if(m[i] == "AC"){
            wa += wa_cnt[i];
        }
    }

    cout << ac << " " << wa << endl;
}


Measured memory_bytes: 18176
#include <cstdio>

int N;
long long T, A;
long long x1, x2;

int main()
{
	int i;
	scanf("%d", &N);
	scanf("%lld %lld", &T, &A);
	x1 = T;
	x2 = A;
	for(i=1; i<N; i++){
		scanf("%lld %lld", &T, &A);
		long long t1 = ((x1-1)/T+1)*T;
		long long t2 = ((x2-1)/A+1)*A;
		if(t1/T*A >= t2){
			x1 = t1;
			x2 = t1/T*A;
		}
		else{
			x1 = t2/A*T;
			x2 = t2;
		}
	}
	printf("%lld\n", x1+x2);
	return 0;
}

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

class Pg
{
    static void Main()
    {
        Prime p = new Prime();
        List<bool> Pmlst = p.GetPrimeNums().ToList();
        string st;
        while ((st = Console.ReadLine()) != null)
        {
            var n = Convert.ToInt32(st);
            int count = 0;
            for (int i = 2; i <= n; ++i)
            {
                if (Pmlst[i])
                {
                    ++count;
                }
            }
            Console.WriteLine(count);
        }
    }
}
class Prime
{
    const int MAX = 999999;
    internal IEnumerable<bool> GetPrimeNums()
    {
        for (int i = 0; i <= MAX; ++i)
        {
            if (IsPrime(i))
                yield return true;
            else
                yield return false;
        }
    }
    private bool IsPrime(int num)
    {
        if (num < 2)
            return false;
        else if (num == 2)
            return true;
        else if (num % 2 == 0)
            return false;
        var n = Math.Sqrt(num);
        for (int i = 3; i <= n; i += 2)
        {
            if (num % i == 0)
                return false;
        }
        return true;
    }
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl


int main(){
    int n;
    cin>>n;
    vector<vector<bool>> f(n,vector<bool>(10));
    vvi p(n,vi(11));
    REP(i,n){
        REP(j,10){
            int a;
            cin>>a;
            f[i][j]=a;
        }
    }
    REP(i,n){
        REP(j,11){
            int a;
            cin>>a;
            p[i][j]=a;
        }
    }
    int ma=-INF;
    REP(open,1,1024){
        int score=0;
        REP(i,n){
            int cnt=0;
            REP(j,10){
                if((open&bit(j))&&f[i][j]){
                    ++cnt;
                }
            }
            score+=p[i][cnt];
        }
        chmax(ma,score);
    }
    cout<<ma<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm> 
#include <vector>
#include <cstring>
using namespace std;
int main(void){
	int N;
	cin>>N;
	int dat[360];
	memset(dat, -1, sizeof(dat));
	for(int i=0;i<N;i++){
		int M,D,S,V;
		cin>>M>>D>>V>>S;
		for(int j=0;j<V;j++){
			int currentday = ((M-1)*30+D-1+j)%360;
			dat[currentday]=max(S,dat[currentday]);
		}
		for(int j=0;j<360;j++){
			int currentday = ((M-1)*30+D-1+j)%360;
			dat[currentday]=max(dat[currentday],max(0,S-min(360-j,(j+1-V+360)%360)));
		}
	}
	int mi=1000;
	for(int i=0;i<360;i++){
		mi=min(mi,dat[i]);
	}
	cout<<mi<<endl;
	return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int S;
    cin >> S;
    int h,m,s;
    h = S/3600;
    S -= h*3600;
    m = S/60;
    S -= m*60;
    s = S;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


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

int main() {
	int r, g, b;
	cin >> r >> g >> b;

	if (((r * 100) + (g * 10) + b)% 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
#define LLINF 2000000000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
// #define int long long

signed main(){
  string s;
  cin >> s;
  LOOP(i,s.length()){
    cout << "x";
  }
  cout << endl;
}


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

int main() {
    int n, b, f, r, v;
	int a[4][3][10] = {};
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		a[b-1][f-1][r-1] += v;
	}
	for(int i = 0; i < 4; i++) {
	    for(int j = 0; j < 3; j++) {
	        for(int k = 0; k < 10; k++) {
	            cout << " " << a[i][j][k];
	        }
	        cout << endl;
	    }
	    if(i != 3) cout << "####################" << endl;
	}
}


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

#define ff first
#define ss second
#define pb push_back

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 200005;

int main() {
	int n;
	int v[N];
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d", v+i);
	}
	vector<int> ans;
	ans.pb(0);
	for(int i = 0; i < n; i++){
		if(v[i] == ans.back() + 1){
			ans.pb(v[i]);
		}
	}
	if(ans.size() == 1){
		printf("-1\n");
	}
	else{
		printf("%d\n", n - (int)ans.size() + 1);
	}

	return 0;
}


Measured memory_bytes: 2168
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

N = int(input())
T = [0] + list(map(int, input().split()))
V = [0] + list(map(int, input().split()))

left = [0] * (N + 1)
right = [0] * (N + 1)

for i in range(1, N):
    start = left[i - 1]
    left[i] = min(start + T[i], V[i], V[i + 1])

for i in range(N - 1, 0, -1):
    start = right[i + 1]
    right[i] = min(start + T[i + 1], V[i], V[i + 1])

total = [min(left[i], right[i]) for i in range(N + 1)]
ans = 0
for i in range(1, N + 1):
    x = (V[i] - total[i - 1]) + (V[i] - total[i])
    if x >= T[i]:
        V[i] = (total[i - 1] + T[i] + total[i]) / 2
        x = T[i]
    d =(total[i - 1] + V[i]) * (V[i] - total[i - 1]) / 2 #台形左側
    d += (total[i] + V[i]) * (V[i] - total[i]) / 2 #台形右側
    d += V[i] * (T[i] - x) #真ん中の定速部分

    ans += d

print (ans)

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
#include <utility>

using namespace std;
using ll = long long;

int main()
{
	ll mod = 1000000007;
	int n;
	cin >> n;

	unordered_map<int, ll> frac;
	frac[0] = 1;

	for (int i = 1; i <= n; i++)
	{
		frac[i] = frac[i - 1] * i % mod;
	}

	vector<int> mp(n, 0);

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

	//err check
	for (int i = 0; i < n; i++)
	{
		bool err = false;
		if (n % 2 == 0)
		{
			if (i % 2 == 0 && mp[i] > 0)
			{
				err = true;
			}
		}
		else
		{
			if (mp[0] != 1)
			{
				err = true;
			}

			if (i % 2 == 1 && mp[i] > 0)
			{
				err = true;
			}
		}

		if (err)
		{
			cout << 0 << endl;
			return 0;
		}
	}

	ll ans = 1;
	for (int i = 0; i < n; i++)
	{
		ans = ans * frac[mp[i]] % mod;
	}

	cout << ans << endl;
}

Measured memory_bytes: 4772
import sys 
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X, N = map(int, readline().split())
A = list(map(int,readline().split()))
B = [i for i in range(102)]
for a in A:
    B.remove(a)
index = bisect.bisect_left(B,X)
if (X-B[index-1]) <= (B[index]-X):
  print(B[index-1])
else:
  print(B[index])


Measured memory_bytes: 9260
#include<iostream>
using namespace std;
int main() {
        	int A,B,C,D;
            cin >> A>>B>>C>>D;      

          if((A+D-1)/D >= (C+B-1)/B){
          	cout << "Yes" <<endl;
          }
          else{
            cout << "No" << endl;
          }
        }

Measured memory_bytes: 3632
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
// ============ template finished ============

int main()
{
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N)cin >> A[i];
    for (auto a : A)if (a == 0) {
        cout << 0 << endl;
        return 0;
    }

    double lsum = 0;
    for (auto a : A)lsum += log10(a);
    if (lsum > 18.5) {
        cout << -1 << endl;
    }
    else {
        ll res = 1;
        for (auto a : A)res *= a;
        if (res <= 1000'000'000'000'000'000) {
            cout << res << endl;
        }
        else {
            cout << -1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4116
N=int(input())
a=[x for x in map(int,input().split(' '))]

def f(num):
  n=1
  r=0
  while 2**n <= num:
    if num%2**n == 0:
      r=n
    n+=1
  return r


s=0
for i in range(N):
  if a[i]%2==0:
    s+=f(a[i])

print(s)


Measured memory_bytes: 4148
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<set>
#include<map>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> Pi;

constexpr int INF = 1e9 + 7;
constexpr int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main() {
    int N; cin>>N;
    int A,cnt[N];
    REP(i,N) cnt[i]=0;
    REP(i,N) {
        cin>>A;
        cnt[A]++;
    }
    if (N%2==0 && cnt[0]!=0) {
        cout<<0<<endl;
        return 0;
    }
    if (N%2==1 && cnt[0]!=1) {
        cout<<0<<endl;
        return 0;
    }
    REP(i,N-1) {
        if (N%2==0 && i%2==0 && cnt[i+1]!=2) {
            cout<<0<<endl;
            return 0;
        }
        if (N%2==0 && i%2==1 && cnt[i+1]!=0) {
            cout<<0<<endl;
            return 0;
        }
        if (N%2==1 && i%2==0 && cnt[i+1]!=0) {
            cout<<0<<endl;
            return 0;
        }
        if (N%2==1 && i%2==1 && cnt[i+1]!=2) {
            cout<<0<<endl;
            return 0;
        }
    }
    i64 ans = 1;
    REP(i,N/2) {
        ans *= 2;
        ans %= INF;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h> //AtCoder
#include <atcoder/all> //AtCoder
#include <iostream> //Codeforces
#include <vector> //Codeforces

#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Vc vector<char>
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define cyes cout<<"yes"<<endl
#define cno cout<<"no"<<endl

using namespace std;
using namespace atcoder;

/*int gcd(int a,int b){return b?gcd(b,a%b):a;}//最大公約数
int lcm(int a,int b){return a/gcd(a,b)*b;}//最小公倍数*/

/****************************** START ******************************/

signed main(){
  int T;
  cin >> T;
  int n,m,a,b;
  rep(i,0,T){
    cin >> n >> m >> a >> b;
    cout << floor_sum(n,m,a,b) << endl;
  }
}      

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007

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

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    int k, x;
    cin>>k>>x;
    int start=x-k+1;
    int end=x+k-1;
    for(int i=start;i<=end;i++){
        cout<<i<<" ";
    }
    cout<<"\n";



    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll m = max(a, max(b, c));
    ll d = a + b + c;
    if(d % 2 == m % 2){
        cout << (3 * m - d) / 2 << endl;
    }else{
        cout << (3 * (m + 1) - d) / 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import scipy as sp

def mod10(x):
    return x%10
def kirisute(x):
    return x//10*10


l = []
total = 0

for i in range(5):
    l.append(int(input()))
    
for i in range(5):
    if l[4-i] % 10 == 0:
        total += l.pop(4-i)
if len(l) != 0:    
    lmd = list(map(mod10, l))
    lmd.sort()
    total += sum(map(kirisute, l))
    total += lmd.pop(0)
    total += 10*(len(l)-1-lmd.count(0))
print(total)

Measured memory_bytes: 12516
W, H, x, y = list(map(int, input().split()))
# L = list(map(int, input().split()))
# S = [list(map(int, input().split())) for i in range(n)]

ans = W * H / 2
if W / 2 == x and H / 2 == y:
    many = 1
else:
     many = 0

print(ans, many)

Measured memory_bytes: 2940
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
#define PI  3.14159265

 
main()
{
	long long int t, i;
 cin >> t;
 string s;
 cin >> s;
 if(s.size() > t)
 {
 	long long int i;
 	for(i=0;i<t;i++)
 	cout << s[i];
 	cout << "...";
 }
 else
 cout <<  s << endl;
return 0;	
}

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

int main()
{
    string c = "", d = "";
    int a, b;
    cin>>a>>b;
    for(int i = 0; i < a; i++) c += (b + 48);
    for(int i = 0; i < b; i++) d += (a + 48);
    cout<<min(c, d)<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
const double PI = 3.14159265;
int main() {
  double n;
  cin >> n;
  cout << setprecision(6) << n * PI * 2;
  return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 555;
const int dx[]={0,0,-1,1};
const int dy[]={-1,1,0,0};
int n,a[N][N],vis[N*N],ans[N*N];
pii pos[N*N];
queue<int> q;
int main() {
	scanf("%d", &n);
	int now = 0;
	REP(i,1,n) REP(j,1,n) {
		a[i][j]=++now,vis[now]=1;
		pos[now]=pii(i,j);
		ans[now]=min({i-1,j-1,n-i,n-j});
	}
	int tot = 0;
	REP(i,1,n*n) {
		int t;
		scanf("%d", &t);
		tot+=ans[t],vis[t]=0;
		q.push(t);
		while (q.size()) {
			int u(q.front()); q.pop();
			REP(k,0,3) {
				int x=pos[u].x+dx[k],y=pos[u].y+dy[k];
				if (1<=x&&x<=n&&1<=y&&y<=n&&ans[a[x][y]]>ans[u]+vis[u]) {
					ans[a[x][y]]=ans[u]+vis[u];
					q.push(a[x][y]);
				}
			}
		}
	}
	printf("%d\n", tot);
}









Measured memory_bytes: 8696
#include <iostream>

using namespace std;

#define int long long
#define rep(i,n) for(int i=0; i<(int)(n); i++)

const int mod = (int)1e9 + 7;

int pow(int k, int n) {
  if(n <= 0) return 1;
  int m = pow(k, n / 2);
  return (n % 2 ? k : 1) * m % mod * m % mod;
}

int comb(int n, int a) {
  int r = 1;
  rep(i,a) r = r * (n-i) % mod;
  rep(i,a) r = r * pow(i+1, mod-2) % mod;
  return r;
}

signed main() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << (pow(2,n) - 1 + (mod - comb(n,a)) + (mod - comb(n,b))) % mod << endl;
  return 0;
}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll q;
  cin >> q;
  vl primes;
  ll n = 1e5+10;
  vector<bool> isp(n,true);
  isp[0] = false;
  isp[1] = false;
  for(ll i=2;i<n;i++){
    if(isp[i]){
      for(ll j=i*2;j<n;j+=i) isp[j] = false;
      primes.push_back(i);
    }
  }
  vl rui(n,0);
  REP(i,primes.size()){
    if(isp[(primes[i]+1)/2]) rui[primes[i]] = 1;
  }
  REP(i,n-1) rui[i+1] += rui[i];
  REP(i,q){
    ll r,l;
    cin >> l >> r;
    cout << rui[r] - rui[l-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int> >;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int ab,bc,ca;
cin>>ab>>bc>>ca;
cout<<ab*bc/2<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;

long long gcd(long long x, long long y) {
  return y ? gcd(y, x % y) : x;
}
long long lcm(long long x, long long y) {
  return x/gcd(x, y)*y;
}

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

  int n; cin >> n;
  map<int, int> mp;

  rep(i, n) {
    int a; cin >> a;
    mp[a]++;
  }

  int ans = 0;
  for (std::map<int, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    int key   = (*it).first;
    int value = (*it).second;
    if ( value < key ) { ans += value; }
    else { ans += value-key; }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4736
#include<stdio.h>

int main(void)
{
    char str[100001],ans='a';
    int i=0;
    scanf("%s",str);
    while(str[i] != '\0')
    {
        if(ans == str[i])
        {
            ans++;
            i=0;
            continue;
        }
        if(ans == 'z'+1)
           {
            printf("None\n");
            return 0;
        }
        i++;
    }
    
    printf("%c\n",ans);
    return 0;
}


Measured memory_bytes: 256
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let x: i64 = sc.read();
    for i in -2000..2000 {
        for j in -2000..2000 {
            if f(i as i64, j as i64) == x {
                println!("{} {}", i, j);
                return;
            }
        }
    }
}

fn f(a: i64, b: i64) -> i64 {
    a * a * a * a * a - b * b * b * b * b
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	int a,b; cin >> a >> b;
	string s; cin >> s;
	if(s.size() != a+b+1) goto no;
	rep(i,a+b+1){
		if(i == a){
			if(s[i] != '-') goto no;
		}else{
			if(s[i] < '0' || '9' < s[i]) goto no;
		}
	}
	cout << "Yes\n";
	return 0;
	no:
		cout << "No\n";
		return 0;
}

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

int main(){
	ll n,k;
	cin >> n >> k;
	if(k % 2 == 1){
		cout << (n / k) * (n / k) * (n / k) << endl;
	}else{
		cout << (n / k) * (n / k) * (n / k) + (n / (k / 2) - n / k) * (n / (k / 2) - n / k) * (n / (k / 2) - n / k) << endl;
	}
}

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

int main() {
	int q;
	cin >> q;
	for (int x = 0; x < q; x++) {
		int n;
		cin >> n;
		int ans = 0;
		vector<int>v;
		while (n > 9) {
			v.push_back(n);
			string a = to_string(n);
			int mx = 0;
			for (int i = 0; i < a.size() - 1; i++) {
				string b, c;
				for (int j = 0; j <= i; j++)b.push_back(a[j]);
				c = a.substr(i + 1);
				int ba = stoi(b);
				int ca = stoi(c);
				mx = max(mx, ba*ca);
			}

			int flg = 1;
			for (int i = 0; i < v.size(); i++) {
				if (mx == v[i])flg = 0;
			}
			if (!flg) {
				ans = -1;
				break;
			}
			else {
				v.push_back(mx);
				n = mx;
				ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3284
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}
int main(){
    CIN(A);CIN(B);
    COUT(gcd(A,B));
    return 0;
}



Measured memory_bytes: 3092
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cmath>
using namespace std;

int ax,ay,bx,by,becx,becy;
double s,c,kyori;

void solve(int x,int y){

    int becp,becq;
    becp=(x-ax);
    becq=(y-ay);

    double d= sqrt((double)becp*(double)becp+(double)becq*(double)becq);
    if(d==0) cout<<"0 0"<<endl;
    else{
    double cc=((double)becx*(double)becp+(double)becy*(double)becq)/(d*kyori);
    double k = d*cc;
    double ansx,ansy;
    ansx=(double)ax+ k*c;
    ansy=(double)ay+ k*s;
    printf("%.8f %.8f\n",ansx, ansy);
    }
}

int main(){

cin>>ax>>ay>>bx>>by;

kyori= sqrt(((double)ax-(double)bx)*((double)ax-(double)bx)+((double)ay-(double)by)*((double)ay-(double)by));
s=((double)by-(double)ay)/kyori;
c=((double)bx-(double)ax)/kyori;
becx=(bx-ax);
becy=(by-ay);
int n,x,y;
cin>>n;
for(int i=0;i<n;i++){
    cin>>x>>y;

    solve(x,y);
}

    return 0;
}


Measured memory_bytes: 3224
/*s1190073  Rina Sato
  File name: prog4c.c
  This is double hashing program.
*/
#include <stdio.h>
#include <string.h>

#define M 1000003
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch == 'A') return 1;
  else if(ch == 'C') return 2;
  else if(ch == 'G') return 3;
  else if(ch == 'T') return 4;
}

/*convert a string into an integer value*/
long long getKey(char str[]){
  long long sum=0,p=1,i;
  for(i = 0 ; i < strlen(str) ; i++){
     sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){
  return key%M;
}
int h2(int key){
  return 1+(key%(M-1));
}
int find(char str[]){
  int i,g,x=0;
  g = (int)getKey(str);
  for(i = 0 ; i < M ; i++){
    x = (h1(g)+i*h2(g))%M;
    if(strcmp(H[x],str) == 0) return 1;
    else if(strlen(H[x]) == 0) return 0;
  }
}
void insert(char str[]){
  int i,x=0,g;
  g = (int)getKey(str);
  for(i = 0 ; i < M ; i++){
    x = (h1(g)+i*h2(g))%M;
    if(strlen(H[x]) == 0){
      strcpy(H[x],str);
      return;
    }
  }
}

int main(void){
  int i,n,h;
  char str[L],com[9];

  for(i = 0 ; i < M ; i++){
    H[i][0] = '\0';
  }
  
  scanf("%d",&n);
  
  for(i = 0 ; i < n ; i++){
    scanf("%s %s",com,str);
    
    if(com[0] == 'i'){
      insert(str);
    }
    else {
      if(find(str)){
	printf("yes\n");
      }
      else printf("no\n");
    }
  }
  return 0;
}

Measured memory_bytes: 13000
#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>

using namespace std;
typedef long long ll;

int main(){
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> abs;
    for(int i = 0; i < n; ++i){
        ll a, b;
        cin >> a >> b;
        abs.push_back(make_pair(a, b));
    }
    sort(abs.begin(), abs.end());
    ll rest = m;
    ll money = 0;
    for(auto ab : abs){
        if(rest >= ab.second){
            rest -= ab.second;
            money += ab.first * ab.second;
        }else{
            money += ab.first * rest;
            rest = 0;
        }
        if(rest <= 0){
            break;
        }
    }
    cout << money << endl;
    return 0;
}


Measured memory_bytes: 2420
package main

import (
	"fmt"
)

func main() {

	var n, x int

	for {
		fmt.Scan(&n, &x)
		if n == 0 && x == 0 {
			break
		}

		var result int
		for i := 1; i <= n; i++ {
			for j := 1; j <= n; j++ {
				for k := 1; k <= n; k++ {
					if i == j || i == k || j == k {
						continue
					}
					if i+j+k == x {
						result++
					}
				}
			}
		}
		fmt.Println(result / 6)
	}
}



Measured memory_bytes: 1120
N = int(input())
S = list(input())

c1 = 0 #"("の数
c2 = 0 #")"の数

for i in range(N-1, -1, -1):
    if S[i] == "(":
        c1 += 1
    else:
        c2 += 1
    if c1 > c2:
        S.append(")")
        c2 += 1
        
if c2 > c1:
    T = ["("]*(c2-c1)
    S = T + S
    
print("".join(S))

Measured memory_bytes: 3064
//
//  sublime text 3,
//  emre yazicioglu
//

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
#define pb push_back
#define INF (ll) (1e18 + 7)
#define MOD (ll) (1e9 + 7)
#define F first
#define S second

const int N = 2e6 + 7;
ll mn = INF, mx = -INF;
ll n, m, k, s, q, t[N];
ll a, b, c, d, e;
ll ans[N], cur, sum, cnt;
ll ar[N], p[N], dp[N];
string tr; bool h[N];
pll pp[N]; vll v;

inline void fastInputOutput () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
}

inline void ReadWriteFromFile () {
  freopen("../in.txt", "r", stdin);
  freopen("../out.txt", "w", stdout);
}

void U (int n, int s, int e, int i, int v) {
  if (s == e) 
    t[n] += v;
  else {
    int m = s + (e - s) / 2;
    if (i <= m)
      U(n * 2, s, m, i, v);
    else 
      U(n * 2 + 1, m + 1, e, i, v);
    t[n] = max(t[n * 2], t[n * 2 + 1]);
  }
}

int Q (int n, int s, int e, int l, int r) {
  if (l <= s && r >= e)
    return t[n];
  if (l > e || r < s)
    return 0;
  int m = s + (e - s) / 2;
  return max(Q(n * 2, s, m, l, r), Q(n * 2 + 1, m + 1, e, l, r));
}

bool comp (pll &a, pll &b) {
  if(a.F != b.F)
    return a.F < b.F;
  return a.S > b.S;
}

int main() {
  fastInputOutput();
  // ReadWriteFromFile();

  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
    pp[i] = {ar[i], i};
  }
  sort(pp + 1, pp + n + 1, comp);
  for (int i = 1; i <= n; i++) {
    q = Q(1, 1, n, pp[i].S + 1, n);
    U(1, 1, n, pp[i].S, q + 1);
    ans[pp[i].S] = q + 1;
    mx = max(mx, ans[pp[i].S]);
  }
  cout << mx;
}

Measured memory_bytes: 12032
///     へ　　　　　／|
///　　/＼7　　　 ∠＿/
///　 /　│　　 ／　／
///　│　Z ＿,＜　／　　 /`ヽ
///　│　　　　　ヽ　　 /　　〉
///　 Y　　　　　`　 /　　/
///　?●　?　●　　??〈　　/
///　()　 へ　　　　|　＼〈
///　　>? ?_　 ィ　 │ ／／
///　 / へ　　 /　?＜| ＼＼
///　 ヽ_?　　(_／　 │／／
///　　7　　　　　　　|／
///　　＞―r￣￣`?―＿
#include<bits/stdc++.h>
#define ll long long
using namespace std;

char s[110]; 
int len;

int main() {
	gets(s);
	len = strlen(s);
	for(int i = 0; i < len; i++) {
		if(s[i] == 'C') { 
			for(int j = i + 1; j < len; j++) {
				if(s[j] == 'F') {
					puts("Yes");
					return 0;
				}
			}
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
	int a, b, q;
	cin >> a >> b >> q;
	vector<ll> s(a), t(b);
	rep(i, a) cin >> s[i];
	rep(i, b) cin >> t[i];
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	rep(_, q) {
		ll x;
		cin >> x;
		vector<ll> cs, ct;
		auto its = lower_bound(s.begin(), s.end(), x);
		auto itt = lower_bound(t.begin(), t.end(), x);
		if (its != s.end()) cs.push_back(*its);
		if (itt != t.end()) ct.push_back(*itt);
		if (its != s.begin()) cs.push_back(*(its-1));
		if (itt != t.begin()) ct.push_back(*(itt-1));
		ll ans = 1001001001001001001LL;
		for(auto p: cs) for(auto q: ct) {
			if (p <= x && q <= x || p >= x && q >= x) {
				chmin(ans, max(abs(x-p), abs(x-q)));
			} else {
				chmin(ans, min(abs(x-p), abs(x-q)) + abs(p - q));
			}
		}
		cout << ans << endl;
	}
}


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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 60);

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int X;
    cin >> X;

    int ans = 0;
    int m = 100;
    while (m < X) {
        // debug2(ans, m);
        m = ll(double(m) * 1.01);
        ans++;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>

using namespace std;

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

  long long ans = 0;
  if(0 == (n-1)%2){
    ans = n * (long long)((n-1)/2);
  }else{
    ans = n * (long long)((n-1)/2) + (long long)(n/2);
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
  int a,b,c,d,n;
  cin >> n;
  a = n % 10;
  b = (n % 100 - a) /10;
  c = (n % 1000 - b*10 - a ) /100;
  d = (n -c*100 -b*10 -a)/1000;
  
  if ((a==b && b==c) || (b==c && c==d)  ){
  	cout << "Yes";
  }
  else {
  	cout << "No";
  }
}



Measured memory_bytes: 3632
//Author:- S_Aditya

#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;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const ll mod=1e9+7;         
const int N=1e5+4;

string s;

int d;

int dp[N][2][104];

void add_self(int &a,int b)
{
    a+=b;
    
    if(a>=mod)
    a-=mod;
}

int rec(int ind,int flag,int rem)
{
    if(ind==s.size())
    {
        return rem==0;
    }
    
    int &ans=dp[ind][flag][rem];
    
    if(ans!=-1)
    return ans;
    
    ans=0;
    
    int lim=9;
    
    if(flag==0)
    lim=s[ind]-'0';
    
    rep(i,0,lim+1)
    {
        int hf=flag,hrem=rem;
        
        if(i<lim)
        hf=1;
        
        hrem=(hrem+i)%d;
        
        ll here=rec(ind+1,hf,hrem);
        
        add_self(ans,here);
    }
    
    return ans;
}

int main()                  
{
    memset(dp,-1,sizeof(dp));
    
    cin>>s;
    
    scn(d);
    
    int ans=rec(0,0,0);
    
    ans--; //we have to count from 1 to given number, so subtract contribution of 0
    
    //beware that ans could go negetive after subtraction
    if(ans==-1)
    ans+=mod;
    
    printf("%d ",ans);
} 

Measured memory_bytes: 82304
#include<stdio.h>
main(){
  int a[4],b[4],i,j,hit=0,blow=0;

  while(scanf("%d",&a[0]) != EOF){
    
    for(i=1;i<4;i++){
      scanf("%d",&a[i]);
    }
    for(i=0;i<4;i++){
      scanf("%d",&b[i]);

      if(a[i]==b[i]) hit++;

      else{
	for(j=0;j<4;j++){
	  if(a[j]==b[i]) blow++;
	}
      }

    }

    printf("%d %d\n",hit,blow);
    hit=0;
    blow=0;
  }
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

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

int main() {
  int r;
  cin >> r;
  if (r < 1200) cout << "ABC" << endl;
  else if (r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
  return 0;
}


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

using namespace std;

#define ll long long

const ll nmax=200000;
ll n,ap[30],T;
char s[nmax+5];

int main()
{
    cin.getline(s,nmax+5);
    n=strlen(s);
    for(int i=0;i<n;i++)
        ap[s[i]-'a']++;
    for(int i=0;i<26;i++)
        T+=ap[i]*(ap[i]-1)/2;
    cout<<n*(n-1)/2-T+1;
    return 0;
}
/**
a...a

**/


Measured memory_bytes: 384
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include<set>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define DIVCEIL(a,b) ((a+b-1)/b)
//int CHMAX

int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int NUMOFDIV(int n) {
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
int CEIL1(int n) {
	return (n + 9) / 10 * 10;
}
int DIGITSUM(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
// 順位付け
using namespace std;
#pragma endregion
signed main() {
	double N, K;
	cin >> N >> K;
	vector <double> X(N - K + 1),x(N);
	rep(i, N)
		cin >> x[i];
	rep(i, K)
		X[0] += x[i];
	rep(i, N - K)
		X[i + 1] = X[i] - x[i] + x[K + i];
	sort(ALL(X), greater<double>());
	cout << setprecision(15)<< (X[0]+K)/2.0<<endl;
}

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

#define MAX 100005
#define NIL -1

struct Node{
  int p, l, r;
};

struct Node T[MAX];
int n, D[MAX];

void print(int u){
  int i, c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p  << ", ";
  cout << "depth = " << D[u] << ", ";
  if(T[u].p==NIL) cout << "root, ";
  else if(T[u].l==NIL) cout << "leaf, ";
  else cout << "internal node, ";
  cout << "[";
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i!=0) cout << ", ";
    cout << c;
  }
  cout << "]" <<endl;
}

int setDepth(int u, int p){
  D[u]=p;
  if(T[u].r!=NIL) setDepth(T[u].r,p);
  if(T[u].l!=NIL) setDepth(T[u].l,p+1);
}

int main(){
  int i,j,d,v,c,l,r;
  cin >> n;
  for(i=0;i<n;i++) T[i].p=T[i].l=T[i].r=NIL;

  for(i=0;i<n;i++){
    cin >> v >> d;
    for(j=0;j<d;j++){
      cin >>c;
      if(j==0) T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL) r=i;
  }

  setDepth(r,0);
  for(i=0;i<n;i++) print(i);

  return 0;
}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<int> a, b;

int main()
{
    int n;
    cin>>n;
    b.resize(n-1);
    REP(i,n-1) cin>>b[i];
    b.push_back(INF);

    //REPALL(i,b) cout<<b[i]<<" ";

    int ans = b[0];
    REP(i,n) {
        ans += min(b[i], b[i+1]);
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int member;
  for(int j = 0; j < N; j++){
    int l,i;
  	cin >> l >> i;
    member = member + i - l + 1;
  }
  cout << member << endl;
}

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

int main(){
  int a,b; cin>>a>>b;
  int max=a,min=b;
  int ans=0;
  if(a<b){
    max=b;
    min=a;
  }
  ans+=max;
  max=max-1;
  if(max<min){
    ans+=min;
  }
  else{
    ans+=max;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int M=100001;
int n,m,a,b,mi[M],s,t;
vector<int>d[M];
struct node{
	int x,step,cnt;
};
queue<node>Q;
bool mark[M][5];
int main(){
	scanf("%d%d",&n,&m);
	memset(mi,32,sizeof(mi));
	for(int i=1;i<=m;i++){
		scanf("%d%d",&a,&b);
		d[a].push_back(b);
	}
	scanf("%d%d",&s,&t);
	Q.push((node)<%s,0,0%>);
	mark[s][0]=1;
	while(!Q.empty()){
		node a=Q.front();
		Q.pop();
		if(a.step==0&&a.x==t){
			printf("%d\n",a.cnt/3);
			return 0;
		}
		int nst=(a.step+1)%3,ncnt=a.cnt+1;
		for(int i=0;i<(int)d[a.x].size();i++){
			int y=d[a.x][i];
			if(!mark[y][nst]){
				Q.push((node)<%y,nst,ncnt%>);
				mark[y][nst]=1;
			}
		}
	}
	puts("-1");
}

Measured memory_bytes: 6528
s = input()
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
isEasy = True
for i, t in enumerate(s):
    if i % 2 == 0 and not t in odd:
        isEasy = False
        break
    elif i % 2 != 0 and not t in even:
        isEasy = False
        break
if isEasy:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,cnt=0,maxcnt=0;
	string b;
	cin>>a>>b;
	for (int i=0;i<a;i++)
	{
		if (b[i]=='I')
			cnt++;
		else
			cnt--;
		maxcnt=max(cnt,maxcnt);
	}
	maxcnt=max(cnt,maxcnt);
	cout<<maxcnt;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

countA = [0]*(max(A)+1)
ans = 1
mod = 10**9 + 7
for i in range(N):
    if A[i] == 0:
        ans *= (3 - countA[A[i]])
    else:
        ans *= (countA[A[i]-1] - countA[A[i]])
    countA[A[i]] += 1
    ans %= mod
print(max(ans, 0))


Measured memory_bytes: 14020
import java.util.*;

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

        int k = sc.nextInt() - 1;
        int x = sc.nextInt();


        for (int i = x-k; i <= x+k; i++) {
            System.out.print(i + " ");
        }
    }
}

Measured memory_bytes: 22228
import java.util.Scanner;

public class Main {
  public static void main(String[] arg) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    sc.close();
    printGCM(a, b);;
  }

  private static void printGCM(int a, int b) {
    if (b == 0) {
      System.out.println(a);
    } else {
      printGCM(b, a % b);
    }
  }
}


Measured memory_bytes: 26420