akhauriyash/Code-Regression huggingface dataset:
N = int(input())

if 1<= N < 10:
  print(N)
elif 10 <= N < 100:
  print(9)
elif 100 <= N < 1000:
  s = N - 99 + 9
  print(s)
elif 1000 <= N < 10000:
  print(909)
elif 10000 <= N < 100000:
  s = N - 9999 + 9 + 900
  print(s)
else:
  print(90909)

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

int main() {
    int C[4][3][10];
    for (int z = 0; z < 4; z++) {
        for (int y = 0; y < 3; y++) {
            for ( int x = 0; x < 10; x++) {
                C[z][y][x] = 0;
            }
        }
    }

    int n;

    cin >> n;

    for (int i = 0; i < n; i++) {
        int b, f, r, v;
        
        cin >> b >> f >> r >> v;
        
        int S = C[b-1][f-1][r-1] + v;
        if (S <= 0) {
            C[b-1][f-1][r-1] = 0;
        } else if (S > 0 || S <= 9) {
            C[b-1][f-1][r-1] = S;
        }
    }
    for (int j = 0; j < 4; j++) {
        if ( j > 0) {
            for (int k = 0; k < 20; k++) {
                cout << "#";
            }
            cout << endl;
        }
        for (int l = 0; l < 3; l++) {
            for ( int m = 0; m < 10; m++) {
                cout << " " << C[j][l][m];
            }
            cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3088
Module _20190421

    Sub Main()

        Dim sRead1 As String = Console.ReadLine()
        Dim sRead2 As String = Console.ReadLine()

        Dim iColumn As Integer = sRead1.Split(" ")(0)
        Dim iRow As Integer = sRead1.Split(" ")(1)

        Dim iBlackColumn As Integer = sRead2.Split(" ")(0)
        Dim iBlackRow As Integer = sRead2.Split(" ")(1)

        Console.WriteLine(iColumn * iRow - iBlackColumn * iRow - iBlackRow * iColumn + iBlackColumn * iBlackRow)

    End Sub

End Module

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file
#else

#endif



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Togliere nei problemi con query online

    int N;
    cin >> N;
    int k = N%10;
    if (k == 3) cout << "bon\n";
    else if (k == 0 or k == 1 or k == 6 or k == 8) cout << "pon\n";
    else cout << "hon\n";
}


Measured memory_bytes: 3668
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	signed a, b;

	cin >> a >> b;

	string A = "";

	for (int i = 0; i < a; i++) {
		A += to_string(b);
	}

	string B = "";

	for (int i = 0; i < b; i++) {
		B += to_string(a);
	}

	cout << min(A, B) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

class Point{
public:
	ll x,y;
};

int main(){
	init();
	ll N,K;cin>>N>>K;
	vector<Point>p;
	for(int i=0;i<N;i++){
		ll X,Y;
		cin>>X>>Y;
		Point poi;
		poi.x=X;
		poi.y=Y;
		p.push_back(poi);
	}
	ll ans=INF;
	for(int sx_i=0;sx_i<N;sx_i++){
		for(int sy_i=0;sy_i<N;sy_i++){
			for(int gx_i=0;gx_i<N;gx_i++){
				for(int gy_i=0;gy_i<N;gy_i++){
			ll sx=p[sx_i].x;
			ll sy=p[sy_i].y;
			ll gx=p[gx_i].x;
			ll gy=p[gy_i].y;
			ll num=0;
			for(int i=0;i<N;i++){
				//isOK?
				ll nowX=p[i].x;
				ll nowY=p[i].y;
				bool isOK=true;
				if(!(sx<=nowX&&nowX<=gx))isOK=false;
				if(!(sy<=nowY&&nowY<=gy))isOK=false;
				if(isOK)num++;
			}
			if(num>=K)ans=min(ans,(gx-sx)*(gy-sy));
				}
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,fast-math,unroll-loops")
  
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
  
#define int ll
//#define double long double
#define endl '\n'
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define mp make_pair 
#define pb emplace_back
#define dbg(x) cerr << #x << " : " << x << endl
//#define PI 3.141592653589
  
using namespace std;
//using namespace __gnu_pbds;
         
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair <int, int>;
using pll = pair <ll, ll>;
using pld = pair <ld, ld>;
 
/*
const ll MAX_MEM = 5e8;
char MEM[MAX_MEM];
ll MEM_POS = 0;
void* operator new(size_t x)
{
    auto ret = MEM + MEM_POS;
    MEM_POS += x;
    assert(MEM_POS < MAX_MEM);
    return ret;
}
void operator delete(void*)
{}
 
*/
 
template <class T>
istream& operator>> (istream &in, vector <T> &a)
{
    for (auto &i : a)
        in >> i;
    return in;
}
         
template <class T> 
ostream& operator<< (ostream &out, vector <T> a)
{
    for (auto &i : a)
        out << i << ' ';
    return out;
}
         
template <class T, class U>
istream& operator>> (istream &in, pair <T, U> &p)
{
    in >> p.first >> p.second;
    return in;
}
         
template <class T, class U>
ostream& operator<< (ostream &out, pair <T, U> p)
{
    out << p.first << " " << p.second << " ";
    return out;
}
         
inline void Start()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen("circlecover.in", "r", stdin);
    //freopen("circlecover.out", "w", stdout);
}

signed main()
{
    Start();
    int n, m;
    cin >> n >> m;
    vector <int> cntn(n, 1), can(n, 0);
    can[0] = 1;
    for (int i = 0; i < m; ++i)
    {
        int x, y;
        cin >> x >> y, --x, --y;
        if (!cntn[x])
            continue;
        if (can[x])
        {
            can[y] = 1;
            if (cntn[x] == 1)
                can[x] = 0;
        }
        cntn[x]--;
        cntn[y]++;
    }
    cout << count(all(can), 1);
    return 0;
}



Measured memory_bytes: 1792
///17571@nith.ac.in @Ankit Verma
#include <bits/stdc++.h>
using namespace std;
#define ff          first
#define ss          second
#define pb          push_back
#define MP          make_pair
#define int         long long
#define ll          long long
#define inf         0x3f3f3f3f
#define MOD         1000000007
#define ld          long double
#define eb          emplace_back
#define pii         pair<int,int>
#define ull         unsigned long long
#define all(v)      v.begin(), v.end()
#define f(i,x,n)    for(int i=x;i<n;i++)
#define fr(i,x,n)   for(int i=x;i>=n;i--)
#define fastio      ios::sync_with_stdio(false)

#define n_l '\n'
template <typename T, size_t N> int SIZE(const T (&t)[N]) { return N; } template<typename T> int SIZE(const T &t) { return t.size(); } string to_string(const string s, int x1 = 0, int x2 = 1e9) { return '"' + ((x1 < s.size()) ? s.substr(x1, x2 - x1 + 1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c) { return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1 = 0, int x2 = 1e9) { string t = ""; for (int __iii__ = min(x1, SIZE(b)),  __jjj__ = min(x2, SIZE(b) - 1); __iii__ <= __jjj__; ++__iii__) { t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1 = 0, int x2 = 1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if (l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2 - x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if (e != l) { if (rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else { t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if (l_v_l_v_l == 0) res += n_l; return res; } void dbgm() {;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T) { cout << to_string(H) << " | "; dbgm(T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl

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

int32_t main() {
	IO();
	fastio;
	cin.tie(nullptr);
	cout.tie(nullptr);
	string s; cin >> s;
	int n = s.size();
	int cnt = 0; int mx = -1;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') {
			++cnt;
		} else {
			mx = max(mx, cnt);
			cnt = 0;
		}
	}
	mx = max(mx, cnt);
	cout << mx << endl;


	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	int K;
	cin >> K;
	int v[50];
	rep(i, N) cin >> v[i];

	int saidai = 0;
	rep(i, N + 1) {
		for (int j = i; j <= N; j++) {
			int kazu = i + N - j;
			kazu = K - kazu;
			if (kazu >= 0) {
				vector<int> V;
				rep(k, i) V.pb(v[k]);
				for (int k = j; k < N; k++) V.pb(v[k]);
				sort(V.begin(), V.end());
				rep(k, min((int)V.size(), kazu)) {
					if (V[k] < 0) V[k] = 0;
				}
				int ret = 0;
				rep(k, V.size()) ret += V[k];
				saidai = max(saidai, ret);
			}
		}
	}

	co(saidai);

	Would you please return 0;
}

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

int main(){
    int N,A=0;
    cin >> N;
    int a = log10(N);
    for(int i=0; i<=a; i++){
        int b = N / pow (10, a-i);
        A = A + b % 10;
    }
    if (N % A == 0){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3972
R, C, N = map(int, input().split())

consider = []

def dist(x, y):
    if x == 0:
        return R * 2 + C + (C - y)
    if x == R:
        return R + y
    if y == 0:
        return x
    if y == C:
        return R + C + (R - x)
    
    
for i in range(N):
    x1, y1, x2, y2 = map(int, input().split())
    if ((x1 == 0 or x1 == R) or (y1 == 0 or y1 == C)) and ((x2 == 0 or x2 == R) or (y2 == 0 or y2 == C)):
        consider.append((i, dist(x1, y1)))
        consider.append((i, dist(x2, y2)))

l = []
consider = sorted(consider, key=lambda p:p[1])

for c in consider:
    if len(l) == 0:
        l.append(c[0])
        continue
    elif c[0] == l[-1]:
        l.pop()
    else:
        l.append(c[0])

if len(l) == 0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 31780
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int n,m,ans=0;
 	cin >> n>>m;
 	for (int i = 0; i < n; i++){
 		int x;
 		cin >> x;
 		if(x>=m){
 			ans++;
 		}
 	}
 	cout << ans << endl;
 }

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	long long x,k,a,i;
	cin>>k;
	x=0;a=1;
	while(k>0)
	{
		x+=a;
		a*=2;
		k/=2;
	}
	cout<<x;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][][] room = new int[4][3][10];
        for(int i = 0; i < n; i++){
            room[sc.nextInt() - 1][sc.nextInt() - 1][sc.nextInt() - 1] += sc.nextInt();
        }
        for(int b = 0; b < 4; b++){
            for(int f = 0; f < 3; f++){
                for(int r = 0; r < 10; r++){
                    System.out.print(String.format(" %d", room[b][f][r]));
                }
                System.out.println();
            }
            if (b < 3) System.out.println("####################");
        }
    }
}



Measured memory_bytes: 30588
import java.util.Scanner;

public class Main{

	public static void main (String[] args) {

		Scanner sc = new java.util.Scanner (System.in);

		String s = sc.next();

		if (s.equals("SUN")) {
			System.out.println("7");
		} else if (s.equals("MON")) {
			System.out.println("6");
		} else if (s.equals("TUE")) {
			System.out.println("5");
		} else if (s.equals("WED")) {
			System.out.println("4");
		} else if (s.equals("THU")) {
			System.out.println("3");
		} else if (s.equals("FRI")) {
			System.out.println("2");
		} else if (s.equals("SAT")) {
			System.out.println("1");
		}




	}
}

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

main() {
  int N,K,X=1;
  cin >> N >> K;
  
  for (int i=0; i<N; i++) {
    if (X<K) 
      X *= 2;
    
    else 
      X += K;
  }
  cout << X << endl;
}      

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    vector<pair<int,int> > ord(N);
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        ord[i].first = a[i];
        ord[i].second = i;
    }
    sort(ord.begin(), ord.end());

    vector<int> len(N, 1);

    long long ans = 0;
    for(int i = N-1; i >= 0; --i){
        int cur = ord[i].second;
        int left = 0;
        int right = 0;
        if(cur > 0 && a[cur-1] > a[cur]){
            left = len[cur-1];
        }
        if(cur < N-1 && a[cur+1] > a[cur]){
            right = len[cur+1];
        }
        ans += (long long)(ord[i].first) * (left+1) * (right+1);
        len[cur - left] = left+right+1;
        a[cur -left] = ord[i].first;
        len[cur + right] = left+right+1;
        a[cur + right] = ord[i].first;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
from collections import deque

sx, sy, tx, ty = map(int, input().split())
w = tx - sx
h = ty - sy
ans = 'R'*w + 'U'*h + 'L'*w + 'D'*h + 'D' + 'R'*(w+1) + 'U'*(h+1) + 'L' + 'U' + 'L'*(w+1) + 'D'*(h+1) + 'R'
print(ans)


Measured memory_bytes: 3316
// Target Expert 

/*
 * Author    : raj1307 - Raj Singh
 * Institute : Jalpaiguri Government Engineering College
 * Date      : 3.08.19
 */

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <iomanip>
#include <memory.h>
#include <assert.h>
using namespace std;


#define DEBUG
#ifdef DEBUG
#define deb(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
#define debarr(a,n) cerr<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cerr<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}

#else
#define deb(...) {}
#define debarr(a,n) {}
#define debmat(mat,row,col) {}
#define endl "\n"
#endif

#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fr(i, a, b) for(int i = (a); i < (b); ++i)
#define fb(i, b, a) for(int i = (b); i > (a); --i)
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define rr return 
#define int long long
#define pb push_back
#define sz(x) ((int)x.size())
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a>b) return b; else return a;}

const int mod = 1000*1000*1000+7;
const int INF = 1e18 +5;

int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}


const int N = 5e5 + 5;
int n,W;
 
int cache[100005][105];
int v[105],w[105];
 
int dp(int sumv,int pos){
 	
	if(sumv==0)
		return 0;

	else if(sumv<0 or pos==n)
		return 1e18;

 
	else if(cache[sumv][pos]!=-1)
		return cache[sumv][pos];
	
	else{
	
		cache[sumv][pos]=min(w[pos]+dp(sumv-v[pos],pos+1),dp(sumv,pos+1)); 
		return cache[sumv][pos];
 
	}
 
}
 
 
 
 
 
void solve(){
 
 
	cin>>n>>W;
	int sumv=0;
	fr(i,0,n){ 
		cin>>w[i];
	 	cin>>v[i];
	 	sumv+=v[i];
	}
 	
	memset(cache,-1,sizeof(cache));
 
	//cout<<dp(sumv,0);
	int ans=0;
	fr(i,1,sumv+1){
		//deb(ans);
		if(dp(i,0)<=W)
			ans=i;
	}

 	cout<<ans;
 
}
 



signed main() {
	fio;
	
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--) {
		solve();
	}

	
	return 0;
}


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

int main() {
  int N,a,b;
  cin >> N;
  vector<int> x(N);
  for(int i=0;i<N;i++){
    cin >> a;
    x.at(i)=a;
  }
  int j=0;
  for(int i=0;i<N;i++){
    b = x.at(j);
    //cout << j << endl;
    //cout << b << endl;
    if(b==2){
      cout << i+1 << endl;
      break;
    }
    j = b-1;
  }
  if (b!=2){
    cout << -1 << endl;
  }
  
}

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

int main(){
  string S;
  cin >> S;
  bool a=false;
  for(int i=0;i<S.size();i++){
    for(int j=0;j<S.size();j++){
      if(i!=j && S.at(i)==S.at(j)){
        a=true;
      }
    }
  }
  if(!a){
    cout << "yes" << endl;
  }
  else{
    cout << "no" << endl;
  }
}
  

Measured memory_bytes: 3628
N, x = map(int, input().split())
A = [int(a) for a in input().split()]
M = [a for a in A]

mi = 10**100
for j in range(N):
    s = 0
    for i in range(N):
        s += M[i]
        
    mi = min(mi, s+x*j)
    M = [min(M[i], A[(i-j-1) % N]) for i in range(N)]

print(mi)

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




int main(){
	long long r,D,x;
	cin>>r>>D>>x;
	
	for(int i=1;i<=10;i++){
		x*=r;
		x-=D;
		cout<<x<<endl;
	}
	
	
	
	return 0;
}

Measured memory_bytes: 256
def hiki(lis):
    if len(lis) == 1:
        return [0], lis[0]
    else:
        new_lis = [i-min(lis) for i in lis]
        return new_lis, min(lis)

n = int(input())
h = [int(_) for _ in input().split()]

res = 0

while True:
    if not any(h):
        print(res)
        break

    # left
    for j in range(n):
        if h[j] == 0:
            continue
        else:
            ind_left = j
            break
    # right
    right_flag = False
    for j in range(ind_left, n):
        if h[j] != 0:
            continue
        else:
            ind_right = j
            right_flag = True
            break
    if not right_flag:
        ind_right = n+1

    h[ind_left:ind_right], count = hiki(h[ind_left:ind_right])
    res += count

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
    int a,i,s=0;
    float res;
    scanf("%d",&a);
    for(i=1;i<=a;i++){
        if(i%2==0){
            continue;
        }
        else s=s+1;
    }
    res=(float)s/a;
   printf("%f0000",res);


    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
 
int main()
{
  int r;
  cin >> r;
  if(r < 1200){
    cout << "ABC" << endl;
  }
  else if(r < 2800){
    cout << "ARC" << endl;
  }
  else{
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

    int N;
    cin>>N;
    string S;
    cin>>S;
    vector<set<int>> alp(26);
    rep(i, S.size()) alp[S[i] - 'a'].insert(i);

    int Q;
    cin>>Q;
    rep(i, Q) {
        int q;
        cin>>q;
        if (q == 1) {
            int i;
            string c;
            cin>>i>>c; i--;
            alp[S[i] - 'a'].erase(i);
            alp[c[0] - 'a'].insert(i);
            S.replace(i, 1, c);
            continue;
        }
        int j, l, r, cnt;
        cin>>l>>r; l--; r--;
        cnt = 0;
        rep(j, 26) {
            set<int>::iterator iter = alp[j].lower_bound(l);
            if (iter != alp[j].end() && *iter <= r) cnt++;
        }
        cout<<cnt<<endl;
    }
}

Measured memory_bytes: 24220
def resolve():
    n,x=map(int,input().split())
    L=[1]*51
    for i in range(1,51):
        L[i]=3+2*L[i-1]
    def f(l,x,L):
        if l==0:
            return x
        elif x<=1:
            return 0
        elif x<=1+L[l-1]:
            return f(l-1,x-1,L)
        elif x==2+L[l-1]:
            return 1+f(l-1,L[l-1],L)
        elif x<=2+2*L[l-1]:
            return 1+f(l-1,L[l-1],L)+f(l-1,x-2-L[l-1],L)
        else:
            return 1+2*f(l-1,L[l-1],L)
    print(f(n,x,L))
resolve()

Measured memory_bytes: 38384
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    string s;
    getline(cin, s);
  
    int cnt=0;
    int ans=0;
    for(int i=0; i<s.size(); ++i){
      if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T') ++cnt;
      else cnt=0;
      if(ans<cnt) ans = cnt;
    }
    cout << ans << "\n";
    return 0;
}

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

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()
#define bin(x) static_cast<bitset<16> >(x)


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}


/* math_method */
int ceil(int a, int b){return a / b + (a % b > 0);}


/* main */

int n;


vec<tuple<string, int, int>> arr;

bool comp(tuple<string, int, int> a, tuple<string, int,int> b){

    if(get<0>(a) != get<0>(b)) return get<0>(a) < get<0>(b);
    else{
        return get<1>(a) > get<1>(b);
    }

}
void in(){
    cin >> n;
    rep(i,0,n){
        string a; int b;
        cin >> a >> b;
        arr.push_back(tuple<string, int, int>(a, b, i));
    }
    sort(all(arr), comp);

}

void solve(){

    rep(i,0,n){
        print(get<2>(arr[i])+1);
    }
}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
	vector<int> A(3);
	cin>>A[0]>>A[1]>>A[2];
	int aw=0;
	while(true){
		sort(A.begin(),A.end());
		if (A[0]==A[1] && A[1]==A[2]){
			cout<<aw<<endl;
			return 0;
		}
		if (A[0]<A[1] && A[1]<A[2]){
			A[0]++;
			A[1]++;
			aw++;
		}else if (A[0]<A[1] && A[1]==A[2]){
			A[0]+=2;
			aw++;
		}else if (A[0]==A[1] && A[1]<A[2]){
			A[0]++;
			A[1]++;
			aw++;
		}		
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 200000 + 1000;

typedef pair<int, int> pii;

struct Edge
{
	int next, to;
}
e[4 * MAXN];
int p[MAXN], l = 2;
bool vis[4 * MAXN];

void addE(int x, int y)
{
	e[l] = (Edge){p[x], y};
	p[x] = l++;
}

int n;
int son[MAXN], val[MAXN];

void yes()
{
	cout << "POSSIBLE" << endl;
	for(int i = 1; i <= n; i++)
		cout << val[i] << ' ';
	cout << endl;
	exit(0);
}

void no()
{
	cout << "IMPOSSIBLE" << endl;
	exit(0);
}

void dfs(int x, int fa)
{
	son[x] = 0;
	for(int i = p[x]; i; i = e[i].next)
		if(e[i].to != fa)
			dfs(e[i].to, x), son[x]++;
	// cerr << x << ' ' << son[x] << endl;
}

void find(int x)
{
	for(int &i = p[x]; i; i = e[i].next)
		if(!vis[i])
		{
			int y = e[i].to;
			// cerr << x << ' ' << y << endl;
			if((x >> 1) == (y >> 1))
				val[x >> 1] = (x & 1 ? 1 : -1);
			vis[i] = vis[i ^ 1] = true;
			find(y);
		}
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		int x = i, y;
		cin >> y;
		x = 2 * x;
		y = y == -1 ? 1 : 2 * y;
		addE(x, y), addE(y, x);
	}
	for(int i = 1; i <= n; i++)
	{
		int x = i, y;
		cin >> y;
		x = 2 * x + 1;
		y = y == -1 ? 1 : 2 * y + 1;
		addE(x, y), addE(y, x);
	}
	dfs(1, 0);
	for(int i = 1; i <= n; i++)
		if((~son[i << 1] & 1) && (~son[(i << 1) | 1] & 1))
			addE(i << 1, (i << 1) | 1), addE((i << 1) | 1, i << 1);
		else if((son[i << 1] & 1) != (son[(i << 1) | 1] & 1))
			no();
	find(1);
	yes();

	return 0;
}


Measured memory_bytes: 22400
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))


int main(void){
	vector<int> inp;
	vector<int> now;
	ll n,a;
	cin>>n;
	ll neck = LINF;
	rep(i,5){
		cin >> a;
		inp.push_back(a);
		now.push_back(0);
		chmin(neck,a);
	}
	now.push_back(0);
	now[0] = n;
	ll ans = 0;
	ans = n / neck + (n%neck==0?0:1);

	cout<<ans+4<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    string s;
    int d;
    int v[3];
    rep(i,3){
       cin >> v[i];
    }
    cin >> d;
    if (max(v[0],v[2])-min(v[0],v[2]) <= d){
       cout << "Yes" << endl;
       return 0;
    }
    if (abs(v[0]-v[1]) <= d  && abs(v[1]-v[2]) <= d ) cout << "Yes" << endl;
    else cout << "No" << endl; 
    return 0;

}

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

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

  string s;
  cin >> s;
  
  int n = s.size();
  if (s[0] == '0' || s.back() == '1' || s[n-2] == '0') {
    cout << -1 << '\n';
    return 0;
  }

  for (int i = 0; i < n / 2; ++i) {
    if (s[i] != s[n-2-i]) {
      cout << -1 << '\n';
      return 0;
    }
  }
  
  cout << 1 << " " << 2 << '\n';
  int last = 1;
  for (int i = 1; i < n - 1; ++i) {
    cout << last + 1 << " " << i + 2 << '\n';
    if (s[i] == '1') last = i + 1;
  }
}


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

int main(){
    string s;
    cin>>s;
    if(s[s.size()-1]=='2'||s[s.size()-1]=='4'||s[s.size()-1]=='5'||s[s.size()-1]=='7'||s[s.size()-1]=='9'){
    	cout<<"hon"<<endl;
	}
	if(s[s.size()-1]=='0'||s[s.size()-1]=='1'||s[s.size()-1]=='6'||s[s.size()-1]=='8'){
    	cout<<"pon"<<endl;
	}
	if(s[s.size()-1]=='3'){
		cout<<"bon"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <algorithm>

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

typedef long long ll;

using namespace std;
int main(){
    char a, b, ans;
    cin >> a >> b;
    if ((a == 'H' && b == 'H') || (a == 'D' && b == 'D')) ans = 'H';
    else ans = 'D';
    
    cout << ans << endl;
}


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

#define sint(a) scanf("%d", &a)
#define sint2(a, b) scanf("%d %d", &a, &b)
#define sll(a) scanf("%lld", &a)
#define sll2(a, b) scanf("%lld %lld", &a, &b)
#define mem(a, i) memset(a, i, sizeof(a))
#define pb push_back
#define int long long
#define ll long long
#define lson node << 1
#define rson (node << 1) + 1
#define endl "\n"
#define mp(x, y) make_pair(x, y)

const int maxn = 5e5 + 10;
const int mod = 998244353;
const double pi = acos(-1);

int gcd(int a, int b)
{
  return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b)
{
  return a * b / gcd(a, b);
}

int qpow(int a, int n)
{
  int b = 1;
  while (n)
  {
    if (n & 1)
      b = a * b % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return b;
}

class Prime_Number
{
public:
  int prime[maxn], s, v[maxn];
  void prime_init(int n)
  {
    for (int i = 2; i <= n; i++)
    {
      if (!v[i])
      {
        prime[s++] = i;
        for (int j = 1; j * i <= n; j++)
          v[i * j] = 1;
      }
    }
  }
};

//**************************
int nex1[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}, nex2[20][2] = {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}, {-2, -2}, {-2, -1}, {-2, 0}, {-2, 1}, {-2, 2}, {-1, 2}, {-1, -2}, {0, 2}, {0, -2}, {1, 2}, {1, -2}, {2, 2}, {2, 1}, {2, 0}, {2, -1}, {2, -2}};
int d[2005][2005];
char Map[20005][2005];
int n, m;
inline int check(int x, int y)
{
  if (x <= 0 || x > n || y <= 0 || y > m || Map[x][y] == '#')
    return 0;
  return 1;
}
void bfs(int a, int b)
{
  d[a][b] = 0;
  deque<pair<int, int> > que;
  que.push_back(mp(a, b));
  while (!que.empty())
  {
    int x, y;
    x = que.front().first, y = que.front().second;
    que.pop_front();
    for (int i = 0; i < 4; i++)
    {
      int _x = x + nex1[i][0], _y = y + nex1[i][1];
      if (check(_x, _y) && d[_x][_y]>d[x][y])
      {
        que.push_front(mp(_x, _y));
        d[_x][_y] = d[x][y];
      }
    }
    for (int i = 0; i < 20; i++)
    {
      int _x = x + nex2[i][0], _y = y + nex2[i][1];
      if (check(_x, _y) && d[_x][_y] > d[x][y]+1)
      {
        d[_x][_y] = d[x][y] + 1;
        que.push_back(mp(_x, _y));
      }
    }
  }
}
void init()
{
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      d[i][j] = 1e9;
}
void solve()
{
  sll2(n,m);
  int x, y, tox, toy;
  sll2(x,y),sll2(tox,toy);
  init();
  getchar();
  for (int i = 1; i <= n; i++)
    scanf("%s", Map[i] + 1);
  bfs(x, y);
  if (d[tox][toy] == 1e9)
    cout << -1 << endl;
  else
    cout << d[tox][toy] << endl;
}
signed main()
{
  solve();
  return 0;
}


Measured memory_bytes: 17604
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  for(int i=0; i<N; i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  int sum = 0;
  int count = 0;
  for(int i=0; i<N; i++){
    x -= a.at(i);
    if(x < 0){
      break;
    }
    if(x == 0){
      count++;
      break;
    }
    if(!(i == N-1 && x > 0)){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))
sum=0
realsum=0
if N%3!=0:
    for j in a:
        realsum+=j
    if realsum==0:
        print('Yes')
    else:
        print('No')
else:
    for i in a:
        sum=sum^i
    if sum==0:
        print('Yes')
    else:
        print('No')




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

namespace Volume0_0020
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine
            (
                new string
                (
                    Console
                        .ReadLine()
                        .Select(c => char.IsLower(c) ? char.ToUpper(c) : c)
                        .ToArray()
                )
            );
        }
    }
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    string s;
    cin >> s;
    string t;
    int ans = 0;
    int len = s.size();
    for(int i=0;i<len/2;i++){
        if(s[i]!=s[len-1-i])ans++;
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long

int main()
{
	ll h, w, k;	cin >> h >> w >> k;
	vector <string> a(h);	
	for (ll i = 0; i < h; i ++)	cin >> a[i];

	ll result = 1e9;
	for (ll bs = 0; bs <= (1 << (h - 1)); bs ++)
	{	
		ll st = __builtin_popcount(bs);
		vector <ll> cur(st + 1);
		ll r = st;

		bool stuck = false;
		for (ll i = 0; i < w; i ++)
		{
			ll now = 0;

			for (ll j = 0; j < h; j ++){
				if (a[j][i] == '1') cur[now] += 1;
				if ((bs >> j) & 1)	now += 1;
			}

			if (*max_element(cur.begin(), cur.end()) > k){
				if (stuck){
					r = 1e9;
					break;
				}
				r += 1;
				for (auto &x : cur)	x = 0;
				i -= 1;
				stuck = true;
				continue;
			}
			stuck = false;
		}
		result = min(result, r);
	} 
	cout << result << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int main() {
  string s; cin >> s;
  int n = s.size();
  int ans = 0;
  ans += s[0]-'0';
  ans += (n-1)*9;
  for(int i=1; i<n; i++){
    if(s[i] != '9'){
      ans--;
      break;
    }
  }
  cout << ans << endl;

  return 0;
}



//


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


void solve(std::vector<long long> M, std::vector<long long> D){
    if(M[0] == M[1]){
        cout<<0<<endl;
    }else{
        cout<<1<<endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::vector<long long> M(2);
    std::vector<long long> D(2);
    for(int i = 0 ; i < 2 ; i++){
        scanf("%lld",&M[i]);
        scanf("%lld",&D[i]);
    }
    solve(std::move(M), std::move(D));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = {1,0,-1,0},dx[4] = {0,1,0,-1};
typedef pair<ll, ll> P;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    string s;
    cin >> n >> s >> k;
    char c = s[k - 1];
    for (int i = 0; i < n; i++) {
        if (s[i] != c) {
            s[i] = '*';
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())

A=list(map(int, input().split()))
B=list(map(int, input().split()))
K=sum(B)-sum(A)
if K<0:
    print("No")
    exit()

#合計値が追い越さないように　sum(B)-sum(A)回までしかできない

anum=0
bnum=0
for i in range(N):
    a=A[i]
    b=B[i]
    if a>b:
        bnum+=a-b
    elif b>a:
        if (b-a)%2==0:
            anum+=(b-a)//2
        else:
            anum+=(b-a)//2+1
            bnum+=1

if K>=max(anum,bnum):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 4596
#include <cstdio>
#include <vector>

enum {
  MAXN = 200000 + 5
};

struct DSU {
  static const int MAXSIZE = MAXN;
  int fa[MAXSIZE];
  DSU() {
    int i;
    for (i=0; i<MAXSIZE; ++i)
      fa[i] = i;
  }
  int find(int x) {
    return x == fa[x]? x : fa[x] = find(fa[x]);
  }
  void link(int u, int v) {
    u = find(u);
    v = find(v);
    fa[u] = v;
  }
} t1, t2;

int n, k, l;
std::vector<int> vec[MAXN];
int sum[MAXN];
int ans[MAXN];

void exec() {
  int i, u, v, j;
  scanf("%d%d%d", &n, &k, &l);
  for (i=0; i<k; ++i) {
    scanf("%d%d", &u, &v), --u, --v;
    t1.link(u, v);
  }
  for (i=0; i<l; ++i) {
    scanf("%d%d", &u, &v), --u, --v;
    t2.link(u, v);
  }
  for (u=0; u<n; ++u)
    vec[t1.find(u)].push_back(u);
  for (i=0; i<n; ++i) {
    for (j=0; j<(int) vec[i].size(); ++j)
      sum[t2.find(vec[i][j])] = 0;
    for (j=0; j<(int) vec[i].size(); ++j)
      ++ sum[t2.find(vec[i][j])];
    for (j=0; j<(int) vec[i].size(); ++j)
      ans[vec[i][j]] = sum[t2.find(vec[i][j])];
  }
  for (u=0; u<n; ++u)
    printf("%d%c", ans[u], " \n"[u+1 == n]);
}

int main() {
  if (fopen("D.in", "r") != NULL) {
    freopen("D.in", "r", stdin);
    freopen("D.out", "w", stdout);
  }
  exec();
  return 0;
}






































Measured memory_bytes: 14080
/**
 *   created: 18 August 2019  19:06:17
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
    optimizeIO();
    int tt=1;
    // cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector< double > h(n);
        rep(i,0,n)
            cin>>h[i];
        vector< vector<double> > mem(n+1,vector<double>(n,0));
        mem[0][0] = 1-h[0];
        mem[1][0] = h[0];
        rep(i,1,n){
            mem[0][i] = mem[0][i-1]*(1-h[i]);
            rep(j,1,n+1){
                mem[j][i] = mem[j-1][i-1]*h[i] + mem[j][i-1]*(1-h[i]);
            }
        }
        double res = 0;
        rep(i,n/2+1,n+1){
            // trace1(i);
            res += mem[i][n-1];
        }
        // rep(i,0,n){
        //     rep(j,0,n+1)
        //         cout<<mem[i][j]<<" ";
        //     cout<<endl;
        // }
        printf("%0.10f",res);
    }
    return 0;
}


Measured memory_bytes: 70656
#include <stdio.h>
 
int main(void) {
unsigned int a, b, tmp;
unsigned int gcd, lcm;
 
while (scanf("%d %d", &a, &b) != EOF) {
if (a < b) { tmp = a; a = b; b = tmp; }
gcd = a; lcm = b;
while (b != 0) {
tmp = b;
b = gcd % b;
gcd = tmp;
}
lcm = a / gcd * lcm;
 
printf("%d %d\n", gcd, lcm);
}
 
return 0;
}

Measured memory_bytes: 592
import sys
import numpy as np


def main():
  readline = sys.stdin.readline
  
  n = int(readline().rstrip())
  a = np.array(
    tuple(int(a_i) for a_i in readline().rstrip().split())
  )
  
  b = int(np.median(a - np.arange(1, n + 1)))
  
  print(np.sum(np.abs(a - np.arange(1, n + 1) - b)))
  

if __name__ == "__main__":
  main()


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

using namespace std;

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

using ll = long long;

const int Inf = 100100100;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
	int r, d, x;
	cin >> r >> d >> x;
	rep (i, 10) {
	  x = x * r - d;
	  cout << x << endl;
	}

    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
typedef long long ll;
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int A[80];

int main() {
  int n;
  while (cin>> n) {
    inputs(A,n);
    ll cur = 1000;
    ll cur2 = 0;
    REP(i,n-1) {
      if (A[i]<A[i+1]) {
        ll t = cur / A[i];
        cur -= A[i] * t;
        cur2 += t;
      }
      else if (A[i]>A[i+1]) {
        cur += A[i] * cur2;
        cur2 = 0;
      }
    }
    cout << cur + cur2 * A[n-1] << endl;
  }
}


Measured memory_bytes: 3572
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

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

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    if (s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
l,n = map(int,input().split())
input_list = list(map(int, input().split()))
maxlens = l-input_list[-1]+input_list[0]

for i in range(1,n):
  	maxlens = max(maxlens,input_list[i]-input_list[i-1])

print(l-maxlens)


Measured memory_bytes: 26060
#include<bits/stdc++.h>
using namespace  std ;
typedef long long  ll;
#define nr()  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll ar[5000005],br[500005];

int32_t main()
{   nr();
    ll T, n, nb=0, r, m, x, sm=0,div,rr;
    cin >> n >> m;
    priority_queue<ll>Q;
    for(ll i=1; i<=n; ++i)
    {   cin >> r;
        Q.push(r);
    }
    while(!Q.empty() && m>0)
    {   ll p=Q.top();
        Q.pop();
        Q.push(p/2);
        m--;
    }
    while(!Q.empty())
    {   ll p=Q.top();
        Q.pop();
        sm+=p;
    }
    cout<<sm<<endl;
}


Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef pair<int,int> P;

int main() {
    int i,j,n,p,q;
    int temp=0;
    int t=0;
    int flag[8]={0};
    string s;
    int k;
    cin>>n;
    int a[n];
    int maxkazu=0;
    int minkazu=0;
    for(i=0; i<n; ++i){
        cin>>a[i];
    }
    for(i=0; i<n; ++i){
        if(flag[0]==0&&a[i]<=399&&a[i]>=1){flag[0]=1;temp=1;}
        if(flag[1]==0&&a[i]<=799&&a[i]>=400){flag[1]=1;temp=1;}
        if(flag[2]==0&&a[i]<=1199&&a[i]>=800){flag[2]=1;temp=1;}
        if(flag[3]==0&&a[i]<=1599&&a[i]>=1200){flag[3]=1;temp=1;}
        if(flag[4]==0&&a[i]<=1999&&a[i]>=1600){flag[4]=1;temp=1;}
        if(flag[5]==0&&a[i]<=2399&&a[i]>=2000){flag[5]=1;temp=1;}
        if(flag[6]==0&&a[i]<=2799&&a[i]>=2400){flag[6]=1;temp=1;}
        if(flag[7]==0&&a[i]<=3199&&a[i]>=2800){flag[7]=1;temp=1;}
        if(a[i]>=3200){maxkazu++;}
    }
    for(i=0; i<8; ++i){
        if(flag[i]==1){++maxkazu;++minkazu;}
    }
    if(temp==0){cout<<1<<" "<<maxkazu;}
    else{cout<<minkazu<<" "<<maxkazu;}

    return 0;
}

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

int main() {
  int N, M; cin >> N >> M;
  vector<bool> P(N);
  vector<int> W(N, 0);
  int AC = 0;
  int WA = 0;
  for (int i = 0; i < M; i++) {
    int p; cin >> p; p--;
    string S; cin >> S;
    if (P.at(p)) continue;
    if (S == "AC") P.at(p) = true;
    else W.at(p)++;
  }
  for (int i = 0; i < N; i++) {
    if (P.at(i)) {
      AC++;
      WA += W.at(i);
    }
  }
  cout << AC << " " << WA << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define db double
using namespace std;
const int M=20;
const ll INF=0x3f3f3f3f3f3f3f3f;
int n;
ll ans[M];
pair<pair<int,int>,ll> a[M];
vector<int> dis(M);
bool vis[M][2];
ll count()
{
    ll re=0;
    for(int i=0;i<n;i++)
        re+=a[i].second*dis[i];
    return re;
}
void dfs(int tot=0,int floor=0)
{
    ans[tot]=min(ans[tot],count());
    if(tot==n || floor==n) return;

    vector<int> tmp=dis;
    for(int i=0;i<n;i++)
        dis[i]=min(tmp[i],abs(a[i].first.first-a[floor].first.first));
    vis[floor][0]=1;
    dfs(tot+1,floor+1);
    vis[floor][0]=0;

    for(int i=0;i<n;i++)
        dis[i]=min(tmp[i],abs(a[i].first.second-a[floor].first.second));
    vis[floor][1]=1;
    dfs(tot+1,floor+1);
    vis[floor][1]=0;

    dis=tmp;
    dfs(tot,floor+1);
}
bool cmp(pair<pair<int,int>,int> x,pair<pair<int,int>,int> y)
{return x.second>y.second;}
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        ans[i]=INF,
        scanf("%d%d%lld",&a[i].first.first,&a[i].first.second,&a[i].second);
    for(int i=0;i<n;i++)
        dis[i]=min(abs(a[i].first.first),abs(a[i].first.second));
    dfs();
    for(int i=0;i<=n;i++)
        printf("%lld\n",ans[i]);
    //printf("%f\n",1.*clock()/CLOCKS_PER_SEC);
    return 0;
}


Measured memory_bytes: 3784
s = input()
n = len(s)

A = [[0, 0] for i in range(n+1)]

A[1] = [1, -float("inf")]

for i in range(2, n+1):
    if s[i-1] == s[i-2]:
        A[i][0] = A[i-1][1] + 1
    else:
        A[i][0] = max(A[i-1]) + 1

    if (i >= 3 and s[i-1] == s[i-3]) and (i >= 4 and s[i-2] == s[i-4]):
        A[i][1] = A[i-2][0] + 1
    else:
        A[i][1] = max(A[i-2]) + 1
    # print(A)

print(max(A[-1]))

Measured memory_bytes: 70688