akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include<iomanip>
#include <algorithm>
#include <map>
#include <vector>
#include<queue>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include <map>
#include<string.h>
#include<sstream>
#include<stack>
#include <iostream>
#define ll long long
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 2e5 + 5, inf = 1e9 + 7;
const double ep = 0.0000000001;
const double pi = 3.14159265359;

ll fact(ll n) {
	ll ans = 1;
	for (int i=2;i<=n;++i){
		ans *= i;
		}
	
	return ans;
}
vector < vector<int>>v;

int main() {
	int n,d=-1,b=-1,a;
	vector <int>arr,ar2;
	
	vector <int>v1;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		arr.push_back(a);
		v1.push_back(i + 1);
	}
	v.push_back(v1);
	for (int i = 0; i < n; ++i) {
		cin >> a;
		ar2.push_back(a);
	}
	for (int i = 0; i < fact(n); ++i) {
		next_permutation(v1.begin(), v1.end());
		v.push_back(v1);
	}
	//sort(v.begin(), v.end());
	for (int i = 0; i < fact(n); ++i) {
	bool isfound =true, found = true;
	    for (int l = 0; l <v[i].size(); ++l) {
			if (v[i][l] != arr[l]) {
				isfound = false;
				break;
			}
		}
		if (isfound == true) {
			d = i;
		}
		for (int l = 0; l < v[i].size(); ++l) {
			if (v[i][l] != ar2[l]) {
				found = false;
				break;
			}
		}
		if (found == true) {
			b = i;
		}
		if (isfound == true && found == true)
			break;
	}
	cout << abs(b - d);
		return 0;

}


Measured memory_bytes: 3256
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
#define ll  long long 
  vector<ll>to[1000005];
int main(){
  ll a,b=0,c,d;cin>>a>>b>>c;
  if(b-a==c-b)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 23680
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N , K; cin >> N >> K;
  vector<ll> a(N);
  rep(i,N){
    ll v; cin >> v; v--;
    a[i] = v;
  }


  vector<ll> reach;
  ll tmp = 0;
  map<ll, ll> m;
  // reachの作成
  reach.pb(0);
  m[0]++;
  ll ka = K;
  while(1){
    ka--;
    tmp = a[tmp];
    if(ka == 0){
      cout << tmp + 1 << endl;
      return 0;
    }
    m[tmp]++;
    reach.pb(tmp);
    if(m[tmp] > 1) break;
  }

  ll si = reach.back();
  reach.pop_back();
  ll start;
  rep(i,reach.size()){
    // startの探索
    if(reach[i] == si){
      start = i;
      break;
    }
  }

  // startからlastを繰り返す
  ll cir = reach.size() - start;

  /*
  rep(i,reach.size()) cout << reach[i] << " ";
  cout << endl;
  cout << start << " " << reach.size() << endl;
  */

  ll mar = (K - start) % cir;
  cout << reach[start + mar] + 1 << endl;

}


Measured memory_bytes: 16040
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << "\n"
static const int INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[1010][1010];
double w[1000],v[1000];
double box[200010];
char field[200][200];

int main(){
  cin >> s;
  l = 0;
  rep(i,0,s.sz)if(s[i] == 'o')l++;
  print(700 + l * 100);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<map>
#define mod 1000000007
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;


int main(){
    int n,m;
    cin>>n>>m;
    int l[100000],r[100000];
    int lmax=-1,rmin=1000000;
    rep(i,m){
        cin>>l[i]>>r[i];
        lmax=max(l[i],lmax);
        rmin=min(r[i],rmin);
    }
    if(lmax>rmin)cout<<0;
    else{
        cout<<rmin-lmax+1;
    }

    return 0;
}

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

const int sz = 1e6 + 1;
vector<bool> p(sz);
vector<int> g(sz);

void solve() {
    // INPUT
    int n; cin >> n;
    set<int> st;
    bool pairwise = true;
    int cp = 0;
    for (int i = 0; i < n; ++i) { 
        int a;
        cin >> a;
        if (st.count(a) && a != 1) pairwise = false;
        st.insert(a);
        cp = __gcd(cp, a);
    }

    // LOGIC
    int M = *st.rbegin();
    fill(g.begin(), g.end(), 0);
    fill(p.begin(), p.end(), true);
    p[0] = false;
    p[1] = false;
    for (int i = 2; i <= M; i++) {
        if (st.count(i)) g[i]++;
        if (p[i]) {
            for (int j = 2 * i; j <= M; j += i) {
                p[j] = false;
                if (st.count(j)) g[i]++;
            }
        }
        if (g[i] > 1) {
            pairwise = false;
            break;
        }
    }

    for (int i = 2; i <= sz; ++i) {
        pairwise = pairwise && (g[i] < 2);
    }

    if (pairwise) cout << "pairwise coprime\n";
    else if (cp == 1) cout << "setwise coprime\n";
    else cout << "not coprime\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    while(t--) {
        solve();
    }
}


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

#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define rev(a) (a).rbegin(),(a).rend()
#define pll pair<ll,ll>
#define rep(i,a,b) for(long long i = (a); i <= (b); i++)

const int mod = 1e9+7;
const int N = 1e5+5; 

int main(){
	fast;
	string s; cin >> s;
	set<char> st;
	for(auto x : s){
	    st.insert(x);
	}
	
	if(st.size() == 2)
	cout << "Yes\n";
	else cout << "No\n";
}

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


class A
{
	public static void Main ()
	{
	
		while( true ){
			string s = Console.ReadLine ();
	

			if (s == "-") {
				break;
			}
			int m = int.Parse (Console.ReadLine ());
			int[] h = new int[m];	

			for (int i = 0; i< m; i++) {
				h[i] = int.Parse (Console.ReadLine ());
			}
		
			for (int i = 0; i< h.Length; i++) {
				s = string.Concat (s.Remove(0,h[i]), s.Substring (0, h[i]) );
			}
			Console.WriteLine( s );
		}
	}
}

Measured memory_bytes: 8880
import std.stdio;
import std.array;
import std.conv;
import std.string;
import std.algorithm;

void main() {
  long N = readln.chomp.to!int;
  auto A = readln.chomp.split.map!(to!long).array;
  auto B = readln.chomp.split.map!(to!long).array;
  auto C = readln.chomp.split.map!(to!long).array;

  sort!("a < b")(A);
  sort!("a < b")(B);
  sort!("a < b")(C);

  long ans;

  foreach(b; B) {
    long a, c, ok, ng, m;
    ng = N;

    if (A[$ - 1] < b) {
      a = N;
    }
    else if (A[0] < b) {
      while ((ng - ok) > 1) {
        m = (ok + ng) / 2;

        if (A[m] < b) {
          ok = m;
        }
        else {
          ng = m;
        }
      }
      a = ok + 1;
    }

    ok = N, ng = 0;

    if (C[0] > b) {
      c = N;
    }
    else if (C[$ - 1] > b) {
      while ((ok - ng) > 1) {
        m = (ok + ng) / 2;

        if (C[m] <= b) {
          ng = m;
        }
        else {
          ok = m;
        }
      }
      c = (N - ok);
    }

    ans += a * c;
  }

  ans.writeln;
}

Measured memory_bytes: 12872
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#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")
 
using namespace std;
 
#define int long long
//typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD = 1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
 
int n,k,a[15],mi = INF;
int aa[15];
 
void dfs(int num,int h){
	if(num == n){
		int sum = 0,ma = 0,cnt = 0;
		for(int i = 0;i < n;i++){
			if(ma < aa[i]) cnt++;
			ma = max(ma,aa[i]);
			sum += max(0ll,aa[i] - a[i]);
		}
		if(cnt >= k) mi = min(mi,sum);
		return;
	}
	if(a[num] >= h + 1){
		aa[num] = a[num];
		dfs(num + 1,a[num]);
	}
	else{
		aa[num] = a[num];
		dfs(num + 1,h);
		aa[num] = h + 1;
		dfs(num + 1,aa[num]);
	}
}
 
signed main(){
	cin >> n >> k;
	for(int i = 0;i < n;i++) cin >> a[i];
	if(n == k){
		int h = a[0] - 1,sum = 0;
		for(int i = 0;i < n;i++){
			h = max(h + 1,a[i]);
			sum += max(0ll,h - a[i]);
		}
		cout << sum << endl;
		return 0;
	}
	dfs(0,0);
	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 888
import math
n,a,b=map(int,input().split())
h=[int(input()) for i in range(n)]

def explode(x):
    global n
    c=0
    for i in range(n):
        if h[i]-x*b>0:
            c+=math.ceil((h[i]-x*b)/(a-b))
    return c<=x

#二分探索用のコード

#(1)l,rは両端点でl<=r
l,r=0,10**9
#(2)l=rもしくはl=r-1のときにbreak
while l+1<r:
    #(3)その閉区間の中点(の小数部分を切り捨てたもの)
    #オーバーフローを考慮すると以下の書き方になる
    k=l+(r-l)//2
    #ここでは境目以上のxで真になるので、
    #x=kで真の場合は大きい方の端点をkにし、x=kで偽の場合は小さい方の端点をkにする
    if explode(k):
        r=k
    else:
        l=k

print(r)

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

using namespace std;

string s,t,ns;
int len;
int ans;

int main() {
    while (cin>>s>>t) {
        ans = 0;
        len = s.length();

        for (int i=0; i<len; i++) {
        //cout<<"# "<<s<<endl<<"$ "<<t<<endl;

            if (s==t) {
                ans = 1;
                break;
            }

            len = s.length();
            ns = s.at(len-1);
            s.erase(s.begin()+len-1);
            ns.append(s);
            s = ns;
        }

        if(ans == 1)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


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

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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    string ans = "Yes";
    rep(i, h) {
        rep(j, w) {
            if(s[i][j] == '.') continue;
            bool t = false;
            rep(d, 4) {
                int nx = j + dx[d];
                int ny = i + dy[d];
                if(nx < 0 || nx >= w) continue;
                if(ny < 0 || ny >= h) continue;
                if(s[ny][nx] == '#') t = true;
            }
            if(t == false) ans = "No";
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int n,i,j,k;
  cin >> n;
  if(n==1){
    cout << 1 << endl;
    return 0;
  }
  vector<ll> x(n),y(n);
  vector<pair<ll,ll>> p(n*(n-1)/2);
  for(i=0;i<n;i++){
    cin >> x.at(i) >> y.at(i);
  }
  
  k=0;
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      p.at(k).first=x.at(j)-x.at(i);
      p.at(k).second=y.at(j)-y.at(i);
      if(p.at(k).first<0||(p.at(k).first==0&&p.at(k).second<0)){
        p.at(k).first *= -1;
        p.at(k).second *= -1;
      }
      k++;
    }
  }
  
  sort(p.begin(),p.end());
  
  int c=1,maxc=0;
  //cout << p.at(0).first << ' ' << p.at(0).second << endl;
  for(k=1;k<n*(n-1)/2;k++){
    //cout << p.at(k).first << ' ' << p.at(k).second << endl;
    if(p.at(k-1)==p.at(k)){
      c++;
    }else{
      maxc=max(maxc,c);
      c=1;
    }
  }
  maxc=max(maxc,c);
  cout << n-maxc << endl;
}

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

int saisho(int a, int b)
{
  int keta_a, keta_b;
  keta_a = 0;
  keta_b = 0;
  while(a>0)
  {
    keta_a += a%10;
    a /= 10;
  }
   while(b>0)
  {
    keta_b += b%10;
    b /= 10;
  }
  return keta_a + keta_b;
}

int main()
{
  int n, i, sum, ans, amari;
  ans = INT_MAX;
  cin >> n;
  for(i=1; i<n; i++)
  {
    amari = n-i;
    sum = saisho(i, amari);
    if(sum < ans) ans = sum;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import numpy as np
from numba import njit

#'''
N, K = map(int, input().split())
As = list(map(int, input().split()))
'''
N = 200000
K = 100000
As = [0] * N
#'''

@njit(cache = True)
def update(A_array):
    before_csum = np.zeros(N+1, np.int32)
    for i, A in enumerate(A_array[:N]):
        before_csum[max(0, i-A)] += 1
        before_csum[min(N, i+A+1)] -= 1
    return np.cumsum(before_csum)
    
A_array = np.array(As + [0], dtype = np.int32)
for k in range(min(K, 50)):
    A_array = update(A_array)
    
print(*A_array.tolist()[:N])


Measured memory_bytes: 134748
import numpy as np
def dprint(*args):
  if debug:
    if len(args)==1:
      print(args[0])
    else:
      print(args)

debug = False
if debug:
  N=3
  ABC=[[10, 40, 70], [20, 50, 80], [30, 60, 90]]
else:
  N = int(input())
  ABC=[]
  for i in range(N):
    ABC.append(list(map(int,input().split())))

dprint(N,ABC)

# i -> 1 to N
# ABC -> 012

H = np.zeros((N,3))
H[0]=ABC[0]

for j in range(1,N):
  H[j][0]=max(H[j][0], H[j-1][1]+ABC[j][0], H[j-1][2]+ABC[j][0])
  H[j][1]=max(H[j][1], H[j-1][0]+ABC[j][1], H[j-1][2]+ABC[j][1])
  H[j][2]=max(H[j][2], H[j-1][0]+ABC[j][2], H[j-1][1]+ABC[j][2])

print(int(max(H[-1])))

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, k, a[100];
bool dp[100001];

int main() {
	cin >> n >> k;
	inc(i, n) { cin >> a[i]; }
	
	incII(j, 0, k) {
		inc(i, n) {
			if(j - a[i] < 0) { break; }
			dp[j] |= (! dp[j - a[i]]);
		}
	}
	
	cout << (dp[k] ? "First" : "Second") << endl;
	
	return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;
#include <string>
typedef long long int ll;
#include <algorithm>
#include <stack>
#include <vector>
#include <array>


int main(){

  int K,X;
  cin >> K >> X;
  int s=max(-1000000,X-K+1);
  int e=min(1000000,X+K-1);
  for(int i=s;i<=e;i++){
    cout << i <<endl;
  }


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair;

int main(){
	int n,m,i;
	int a;
	string b;
	int count[100005]={0},val[100002]={0};
	scanf("%d%d",&n,&m);
	int ans=0,p=0;
	for(i=0;i<m;i++)
	{
		cin>>a>>b;
		if(b[0]=='W' && !val[a]){
			count[a]++;
		}
		if(b[0]=='A' && !val[a]){
			p++;
			val[a]=1;
			ans+=count[a];
		}
		
	}

	printf("%d %d\n",p,ans );

	return 0;
}


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

vector<pair<int, int> > v;

signed main() {

    int n;
    cin >> n;

    for ( int i = 0; i < n; i++ ) {
        int a, b;
        cin >> a >> b;
        v.push_back( make_pair ( b, -a ) );
    }

    int time = 0;
    sort(v.begin(), v.end());
    for ( int i = 0; i < n; i++ ) {
        time -= v[i].second;
        if ( time > v[i].first ) {
            puts("No");
            return 0;
        } 
    }
    puts("Yes");

    return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> v(n);
	vector<int> c(n);
	vector<int> a(n);
	rep(i, n) cin >> v[i];
	rep(i, n) cin >> c[i];
	rep(i, n) a[i] = max(0, v[i] - c[i]);
	int ans = 0;
	rep(i, n) ans += a[i];
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int x, y = 0;
		while(true) {
			x = sc.nextInt();
			y = sc.nextInt();
			if(x == 0 && y == 0) break;
			System.out.println(Math.min(x, y) + " " + Math.max(x, y));
		}
	}
}


Measured memory_bytes: 36068
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repr(i,n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll left = 4 * a * b;
    ll right = (c - a - b)*(c - a - b);
    if (c - a - b < 0) cout << "No" << endl;
    else if (left < right) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define mod (1000*1000*1000+7)
#define modd (1000*1000*1000+9)
#define flush fflush(stdout)
#define pi 3.14159265358979323846264338327950
#define read_in_arr(a, n) for(int i=0;i<n;i++){ cin>>a[i];}
#define print_arr(a, n) for(int i=0;i<n;i++){ cout<<a[i]<<" ";} cout<<endl;
// cout<<fixed<<setprecision(12)<<ans<<endl;
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	int n;
	cin>>n;
	string a[n];
	//read_in_arr(a, n);
	int p = 0;
	int q = 0;
	int r = 0;
	int s = 0;
	
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]=="AC"){
			p++;
		}
		else if(a[i]=="WA"){
			q++;
		}
		else if(a[i]=="TLE"){
			r++;
		}
		else if(a[i]=="RE"){
			s++;
		}
	}
	
	cout<<"AC x "<<p<<endl;
	cout<<"WA x "<<q<<endl;
	cout<<"TLE x "<<r<<endl;
	cout<<"RE x "<<s<<endl;
	
	return 0;
}

Measured memory_bytes: 6736
#include <iostream>
#include <vector>
#include <map>
#include <functional>
#include <cmath>
#include <algorithm>

using namespace std;

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

    vector<int> A(N);
    int max = 0,idx=0,sc=0;
    for (size_t i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    vector<int> sA(A);
    sort(sA.begin(), sA.end(),greater<int>());

    for (size_t i = 0; i < N; i++)
    {
        if(A[i]!=sA[0]){
            cout << sA[0] << endl;
        }else{
            cout << sA[1] << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3200
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <memory.h>
#include <cstring>
#include <fstream>

using namespace std;

long long int psum[100001];
bool possible[100001];
vector <long long int> v;
long long int t;
int n;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> t;
		v.push_back(t);
	}

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

	memset(psum, 0, sizeof(psum));
	memset(possible, false, sizeof(possible));

	for (int i = 1; i <= n; i++)
	{
		psum[i] = psum[i - 1] + v[i - 1];
	}

	possible[n] = true;
	for (int i = n - 1; i >= 1; i--)
	{
		if (2 * psum[i] < v[i])
		{
			possible[i] = false;
			break;
		}
		possible[i] = true;
	}

	int res = 0;
	for (int i = n; i >= 0; i--)
	{
		if (possible[i] == false)
		{
			break;
		}
		res++;
	}

	cout << res << '\n';

	return 0;
}

Measured memory_bytes: 2036
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)

int main() {
    string str;
    cin >> str;
    int N = str.length();

    string ans = "Yes";
    for (int i = 0; i < N; i++) {
        if (i%2==0) {
            if (str[i]=='L') {
                ans = "No";
                break;
            }
        } else {
            if (str[i]=='R') {
                ans = "No";
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
k,s=map(int,input().split())
x=0
b=0
while x<=k and x<=s//3:
  y=x
  while x+y<=s and y<=k and y<=(s-x)//2:
    z=s-x-y
    if z>=0 and z<=k:
      if x==y and y==z:
        b=b+1
      elif x==y:
        b=b+3
      elif y==z:
        b=b+3
      else:
        b=b+6
    y=y+1
  x=x+1
print(b)
      


Measured memory_bytes: 3060
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;

typedef complex<double> P;

struct L : public vector<P>{//??´???
  L(const P &a, const P &b){
    push_back(a);push_back(b);
  }
};

struct C{//???
  P c; double r;
  C(const P &c,double r): c(c),r(r){}
};

namespace std{//??????????????????
  bool operator < (const P& a,const P& b){
    return real(a)!= real(b) ? real(a) < real(b) : imag(a) < imag(b);
    //return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b)
  }
  bool operator == (const P& a,const P& b){
    return a.real()==b.real()&&a.imag()==b.imag();
  }
}

double dot(P a,P b){
  return real(conj(a)*b);
}

double cross(P a,P b){
  return imag(conj(a)*b);
}

int ccw(P a, P b, P c){
  b-=a;c-=a;
  if(cross(b,c)>0)   return +1;// counter clockwise 
  if(cross(b,c)<0)   return -1;// clockwise 
  if(dot(b,c)<0)     return +2;// c-a-b on line
  if(norm(b)<norm(c))return -2;// a-b-c on line
  return 0;                    // a-c-b on lone
}

int across(P p1,P p2,P p3,P p4){
    P s1(p2-p1);
    P s2(p4-p3);
    if(s1.real()*s2.imag()==s1.imag()*s2.real())return 2;//parallel
    if(dot(s1,s2)==0)return 1;//Orthogonal
    return 0;//others
}

int main()
{
  int i;
  int q;

  cin>>q;

  rep(i,q){
    double xp,yp;

    cin>>xp>>yp;  P p1(xp,yp);
    cin>>xp>>yp;  P p2(xp,yp);
    cin>>xp>>yp;  P p3(xp,yp);
    cin>>xp>>yp;  P p4(xp,yp);

    cout<<across(p1,p2,p3,p4)<<endl;
  }

}

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

#define pu push_back
#define fi first
#define se second
#define mp make_pair
#define int long long
#define pii pair<int,int>
#define mm (s+e)/2
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(int i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define sz 200000
signed main()
{
	
		int x;
		cin>>x;
		for(int i=1;i<200000;i++)
		{
           if((x*i)%360==0)
           {
           	cout<<i<<endl;
           	break;
           }
		}

	
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 100100100100
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

 
int main(){
    int n; cin >> n;
    int a,b;
    a = n/1.08;
    b = a +1;
    int x = a*1.08;
    int y = b*1.08;
    if(x == n) {
        cout << a << endl;
        return 0;
    }
    if(y == n){
        cout << b << endl;
        return 0;
    }
    cout << ":("<< endl;
    
}


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

using namespace std;
#define ll long long
#define ff first
#define ss second
#define rep(i,a,b) for(ll i = a;i <= b;i++)
#define repv(i,a,b) for(ll i = a;i >= b;i--)
#define e endl
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
typedef pair<ll,ll> pp;


void solve(){
    ll n; cin >> n;
    ll a[n];
    ll m = 0;
    ll count = 0;
    for(ll i = 0;i < n;i++){
        cin >> a[i];
        if(m <= a[i]){
            m = a[i];
        }
        else{
            count += m-a[i];
        }
    }
    cout << count << endl;
}
        
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    //ll t; cin >> t; while(t--)
        solve();
}


Measured memory_bytes: 5204
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;
long long dis[100005];
long long vis[100005];
long long y[100005];
long long z[100005];
int main()
{
    long long C,N,form=0;
    long long you=0,temp=0,zuo=0,ymax=0,zmax=0;
    scanf("%lld %lld",&N,&C);
    for(int i=1; i<=N; i++)
    {
        scanf("%lld %lld",&dis[i],&vis[i]);
        temp=vis[i]+temp-dis[i]+form;
        form=dis[i];
        if(ymax<temp-dis[i])
            ymax=temp-dis[i];
        y[i+1]=ymax;
        if(you<temp)
            you=temp;
    }
    y[1]=0;
    temp=0;
    form=C;
    for(int i=N; i>0; i--)
    {
        temp=vis[i]+temp-(form-dis[i]);
        if(zmax<temp-(C-dis[i]))
            zmax=temp-(C-dis[i]);
        z[i-1]=zmax;
        if(zuo<temp+y[i])
            zuo=temp+y[i];
        form=dis[i];
    }
    z[N]=0;
    temp=0;
    form=0;
    for(int i=1; i<=N; i++)
    {
        temp=vis[i]+temp-dis[i]+form;
        form=dis[i];
        if(you<temp+z[i])
            you=temp+z[i];
    }
    if(zuo>you)
        printf("%lld\n",zuo);
    else
        printf("%lld\n",you);
    return 0;
}

Measured memory_bytes: 3328
import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.List;

public class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int A[]=new int[n+1];
        int B[]=new int[n];
        for (int i=0;i<n+1;i++){
            A[i]=sc.nextInt();
        }
        for (int i=0;i<n;i++){
            B[i]=sc.nextInt();
        }
        long tot=0;
        for (int i=0;i<n;i++){
            if (B[i]>A[i]){
                B[i]-=A[i];
                tot+=A[i];
                if (B[i]>A[i+1]){
                    tot+=A[i+1];
                    A[i+1]=0;
                }else {
                    tot+=B[i];
                    A[i+1]-=B[i];
                }
            }else {
                tot+=B[i];
            }
        }
        System.out.println(tot);


    }

}



Measured memory_bytes: 66388
#include<cstdio>
using namespace std;
int d2b(int n,int b,char c[])
{
    int i=0,k;                                                                                                                                                   
    while(n!=0)
    {
        k=n%b;
        n/=b;
        if(k<0){k-=b;n+=1;}
        if(k>9)c[i]=char(k-10+'A');
        else c[i]=char(k+'0');
        i++;
    }
    return i-1;
}
int main()
{
    int a,n,i;
  	n=-2;
    char b[40];
    scanf("%d",&a);
    if(a==0)printf("0");
    for(i=d2b(a,n,b);i>=0;i--)printf("%c",b[i]);
  	return 0;
}

Measured memory_bytes: 128
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

N = int(input())

ans = 100
A = 1
while A * A <= N:
    if N % A == 0:
        B = N // A
        ans = min(ans, len(str(B)))
    A += 1

print(ans)

Measured memory_bytes: 20332
H,W,D = map(int,input().split())
A = [list(map(int,input().split()))for _ in range(H)]
Q = int(input())
lis = [[0,0] for _ in range(H*W+1)]
for i in range(H):
    for j in range(W):
        x = A[i][j]
        lis[x] = [i,j]
li = [[] for _ in range(D)]
su = [[] for _ in range(D)]
for d in range(D):
    li[d] = lis[d::D]
    for i,l in enumerate(li[d]):
        if i == 0:
            su[d].append(0)
            continue
        Power = su[d][i-1]+abs(li[d][i][1]-li[d][i-1][1]) + abs(li[d][i][0]-li[d][i-1][0])
        su[d].append(Power)

for _ in range(Q):
    L,R = map(int,input().split())
    syoL = L//D
    syoR = R//D
    ama = L%D
    print(su[ama][syoR]-su[ama][syoL])


Measured memory_bytes: 36376
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

s = I()
su = [s]
while True:
    if s % 2 == 0:
        s /= 2
    else:
        s = (3*s)+1
    if s in su:
        break
    su.append(s)
print(len(su)+1)

Measured memory_bytes: 9256
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <inttypes.h>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

[[maybe_unused]] constexpr ll LL_MAX = numeric_limits<ll>::max();
[[maybe_unused]] constexpr ll LL_MIN = numeric_limits<ll>::min();
[[maybe_unused]] constexpr ull ULL_MAX = numeric_limits<ull>::max();

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

template<typename T>
void chmin(T& x, T y) {
    x = min(x, y);
}

template<typename T>
void chmax(T& x, T y) {
    x = max(x, y);
}

ll csum(ll x, ll y) {
    if (x > 0 && y > 0 && x > LL_MAX - y) {
        return LL_MAX;
    }
    if (x < 0 && y < 0 && x < LL_MIN - y) {
        return LL_MIN;
    }
    return x + y;
}

ll readl() {
    ll ret;
    scanf("%" PRId64 "", &ret);
    return ret;
}

vector<ll> readvl(ll n) {
    vector<ll> ret(n);
    rep(i, 0, n) { ret[i] = readl(); }
    return ret;
}

void writel(ll x) {
    printf("%" PRId64 "\n", x);
}

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
	ll N = readl(), K = readl();
	auto As = readvl(N);
	auto is_ok = [&As, N, K](ll C) {
		ll sum = 0;
		rep(i,0,N) {
			sum += As[i]/C + (As[i]%C != 0) - 1;
		}
		return sum <= K;
	};
	if (is_ok(1)) {
		writel(1);
		return 0;
	}
	ll mx = LL_MIN;
	rep(i,0,N) {
		chmax(mx, As[i]);
	}
	ll ok = mx;
	ll ng = 1;
	while (ok - ng >= 2) {
		ll mid = (ng + ok) / 2;
		if (is_ok(mid)) {
			ok = mid;
		} else {
			ng = mid;
		}
	}
	writel(ok);
}



Measured memory_bytes: 4428
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		
		ll n;
		cin>>n;

		ll ones = n%10;
		if(ones == 3) {
			cout<<"bon"<<endl;
		} 
		else if(ones == 0 || ones == 1 || ones == 6 || ones == 8) {
			cout<<"pon"<<endl;
		}
		else {
			cout<<"hon"<<endl;
		}
		return 0;
	}


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

int l,r;
int n,m;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> m;
    l = 1;
    r = n;
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin >> x >> y;
        l = max(x, l);
        r = min(y, r);
    }
    cout << max(r-l+1, 0);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,1,1,0,-1,-1,-1};
const static int ty[] = {-1,-1,0,1,1,1,0,-1};
 
static const double EPS = 1e-12;
static const int MOD = 1000000007;

int dp[201][10001];

int main(){
  int total_friends;
  int weight_limit;
  while(~scanf("%d %d",&total_friends,&weight_limit)){
    memset(dp,0,sizeof(dp));
    int friends[201];
    int remaining[201];
    memset(friends,0,sizeof(friends));
    memset(remaining,0,sizeof(remaining));
    for(int friend_idx = 0; friend_idx < total_friends; friend_idx++){
      scanf("%d",friends + friend_idx);
    }
    sort(friends,friends + total_friends,greater<int>());

    remaining[total_friends] = 0;
    for(int i=total_friends-1;i>=0;i--){
      remaining[i] = remaining[i+1] + friends[i];
    }

    dp[0][0] = 1;    
    for(int i=0;i<total_friends;i++){
      for(int w = 0; w <= 10000; w++){
	if(w + remaining[i] > weight_limit){
	  dp[i+1][w] += dp[i][w] % MOD;
	  dp[i+1][w] %= MOD;
	}

	if(w + friends[i] > 10000) continue;
	dp[i+1][w + friends[i]] += dp[i][w] % MOD;
	dp[i+1][w + friends[i]] %= MOD;
      }
    }

    int res = 0;
    for(int w = 0; w<= weight_limit; w++){
      res += dp[total_friends][w] % MOD;
      res %= MOD;
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 9064
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	int N,K;
	string S;
	
	cin >> N >> K >> S;
	
	int btos = 'A' - 'a';
	
	S.at(K-1) -= btos;
	
	cout << S << endl;
	
	
	return 0;
}


Measured memory_bytes: 764
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int countMinus = 0;
		ArrayList<Integer> candle = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			int c = sc.nextInt();
			candle.add(c);
			if(c < 0) {
				countMinus++;
			}
		}
		
		// 要素数１の時は処理が面倒臭くなりそうなので最初に除外
		if(candle.size() == 1) {
			System.out.println(Math.abs(candle.get(0)));
			System.exit(0);
		}
		
		int minusMax = 0;
		for(int i = candle.size() - 1; i >=0; i--) {
			if(candle.get(i) > 0) {
				continue;
			}else {
				if(minusMax == k) {
					candle.remove(i);
					continue;
				}else {
					minusMax++;
				}
			}
		}
		
		int minTime = 0;
		for(int i = 0; i <= candle.size() - k; i++) {
			int first = candle.get(i);
			int end = candle.get(i + k - 1);
			
			int time = 0;
			if((first < 0) & (end > 0)) {
				first = Math.abs(first);
				time = Math.min(first, end) * 2 + Math.max(first, end);
			}else if(end < 0){
				time = Math.abs(first);
			}else if(first > 0) {
				time = end;
			}
			
			if(i == 0) {
				minTime = time;
			}else {
				minTime = Math.min(minTime, time);
			}
		}
		
		System.out.println(minTime);
	}

}

Measured memory_bytes: 62744
/* Author darklight13 -_- 
   IIT Patna 
*/
#define _CRT_SECURE_NO_DEPRECATE
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds; 
using namespace std;
#define int long long int
#define SYNC std::ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii>   vii;
//typedef tree<int, null_type, less<int>, rb_tree_tag, 
//             tree_order_statistics_node_update> 
//    data_set;
#define rep(i,l,r)   for(int i=(l);i<(r);i++)
#define deb(x)     cout << (#x) << " is " << (x) << endl
#define dbg(x)     cout << x << ' '
#define here cout << " Hey baitch!!\n";
#define  pb push_back
#define  F  first
#define  S  second
#define all(v) (v).begin(),(v).end()
#define sz(a) (int)((a).size())
#define sq(x) ((x)*(x))
const int MOD = 1e9+7;
const int MOD1 = 998244353;
const int N = 1e5+5;
const int INF = 1000111000111000111LL;
const ld PI = 3.1415926535898;
int dp[100][N+1];
int32_t main()
{
	SYNC
	int n,k; 
	cin >>  n >> k;
	vi a(n);
	for(auto &it : a)	cin >> it;
	memset(dp,0,sizeof dp);
	rep(i,0,a[0]+1)	dp[0][i] = 1;
	for(int i = 1; i < n; i++) {
		for(int j = 0; j < N; j++) {
			if(dp[i-1][j] != 0) {
				int r = min(N,j+a[i]+1);
				int l = j;
				dp[i][l] += dp[i-1][j];
				dp[i][r] -= dp[i-1][j];
			}
		}
		int cnt = 0;
		for(int j = 0; j < N; j++) {
			cnt += dp[i][j];
			cnt %= MOD;
			cnt = (cnt + MOD)%MOD;
			dp[i][j] = cnt;
		}
	}
	int res = 0;
	cout << dp[n-1][k];
    return 0;
}

Measured memory_bytes: 78336
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)


typedef map<string, int> map_type;
typedef pair<string, int> value_type;

struct second_order {
  bool operator()(const value_type& x, const value_type& y) const {
    if( x.second != y.second) return x.second < y.second;
    return x.first > y.first;
  }
};

typedef priority_queue<value_type, vector<value_type>, second_order> pqueue_type;


pqueue_type map_to_pqueue(map_type m) {
    pqueue_type que;
    for(auto it=m.begin(); it!=m.end(); ++it) {
        que.push(*it);
    }
    return que;
}

bool check(int x) {
    if(x >= 2000) return true;
    REP(i, 19) {
        if(100*(i+1) <= x && x <= 105*(i+1)) 
            return true;
    }
    return false;
}

int main(void){
    int x;
    cin >> x;
    if(check(x)) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;

int main() {
	string a;
	cin >> a;
	if (a[0] == a[1] && a[0] == a[2]) {
		cout << "Yes" << endl;
	}
	else if (a[1] == a[2] && a[1] == a[3]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


int main()
{ 
    int x[5] ;
    for (int i = 0; i < 5; i++)
    {
        cin >> x[i] ;
    }
    int  k , c = 0; cin >> k;
    for (int i = 0; i < 4; i++)
    {
        for (int j = i+1; j < 5; j++)
        {
            if(abs(x[i] - x[j]) > k){
                c = 1;
            }
        }
        
    }
    if(c == 0){
        cout << "Yay!" << endl ;
        return 0;
    }
    cout << ":(" << endl ;
 
    
    return 0 ;
}

Measured memory_bytes: 256
// Author: πα

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

int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> f(n);
    vector<bool> g(n);
    while(m--)
    {
        int p;
        string s;
        cin >> p >> s;
        --p;
        if(s.front() == 'W')
        {
            if(not g[p])
                f[p]++;
        }
        else
            g[p] = 1;
    }
    vector<int> ans(2);
    for(int i = 0; i < n; ++i)
        ans[0] += g[i], ans[1] += g[i]*f[i];
    cout << ans[0] << ' ' << ans[1];
    return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int64_t n,a,b;
    cin >> n >> a >> b;
    vector<int64_t> x(n);
    rep(i,0,n) cin >> x[i];
    int64_t ans=0;
    rep(i,1,n) ans+=min((x[i]-x[i-1])*a,b);
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int n;
  cin>>n;
  if(n<1200) cout<<"ABC\n";
  else if (n<2800) cout<<"ARC\n";
  else cout<<"AGC\n";
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3652
import sys,bisect
input = sys.stdin.buffer.readline

hh,ww,m = map(int,input().split())

dg = 10**6
HW = []

W = [0]*ww
for i in range(m):
    h,w = map(int,input().split())
    HW.append((h-1)*dg+w-1)
    W[w-1] += 1

ma = max(W)
c = 0
for e in W:
    if ma == e:
        c += 1

HW.sort()

res = 0

for i in range(hh):
    kf = bisect.bisect_left(HW,i*dg)
    ke = bisect.bisect_left(HW,(i+1)*dg)

    tmp = ke-kf
    ctr = 0
    for j in range(kf,ke):
        w = HW[j]%dg
        if W[w] == ma:
            ctr += 1
    if ctr == c:
        tmp += ma-1
    else:
        tmp += ma
    res = max(res,tmp)
print(res)



Measured memory_bytes: 90928