akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	int a, b; cin >> a >> b;
	if (a <= 5)cout << 0;
	else if (a < 13)cout << b / 2;
	else cout << b;

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
sx,sy,tx,ty = map(int,input().split())
print("U"*(ty-sy)+"R"*(tx-sx)+"D"*(ty-sy)+"L"*(tx-sx)+"L"+"U"*(ty-sy+1)+"R"*(1+tx-sx)+"D"+"R"+"D"*(ty-sy+1)+"L"*(1+tx-sx)+"U")

Measured memory_bytes: 38256
#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)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

template<typename T>
T gcd(T a, T b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    int res = a[0];
    FOR (i, 1, n) res = gcd(res, a[i]);
    cout << res << endl; 
    
    return 0;
}



Measured memory_bytes: 640
def solve(As):
    n_odd = 0
    for A in As:
        if A % 2 == 1:
            n_odd += 1
    # print As, n_odd
    if n_odd % 2 == 0:
        return 'YES'
    else:
        return 'NO'


def main():
    N = input()
    As = map(int, raw_input().split())
    print solve(As)

main()


Measured memory_bytes: 11324
#include <iostream>

int main() {
    int N, M, C;
    std::cin >> N >> M >> C;

    int B[M];
    
    for (int i = 0; i < M; i++) {
        std::cin >> B[i];
    }

    int cnt = 0;

    for (int i = 0; i < N; i++) {
        int sum = 0, val;
        for (int j = 0; j < M; j++) {
            std::cin >> val;
            sum += B[j] * val;
        }
        if (sum + C > 0) {
            cnt++;
        }
    }

    std::cout << cnt << std::endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

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

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n,l,eat,res;
    
    scanf("%d %d",&n,&l);
    
    if(l > 0)
    {
        eat = l;
    }
    else
    {
        eat = n + l - 1;
        if(eat >= 0)
        {
            eat = 0;
        }
    }
    
    res = (l + (n + l - 1)) * n / 2 - eat;
    
    printf("%d\n",res);
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  int x[n];int c[n];
  for(int i=0;i<n;i++){
    cin >>x[i];
    c[i]=x[i];
  }
  sort(x,x+n);
  int a=(n/2)-1;
  int b=a+1;
  for(int i=0;i<n;i++){
    if(c[i]<=x[a]) cout << x[b] << endl;
    else cout << x[a] << endl;
  }
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s1,s2,s3;
  	cin>>s1>>s2>>s3;
  	cout<<(char)(s1[0]+'A'-'a')<<(char)(s2[0]+'A'-'a')<<(char)(s3[0]+'A'-'a');
}

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

int main(){
    ios_base::sync_with_stdio(false) , cin.tie(0) ,cout.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	int ans = (a + b) * c;
	ans /=2;
	
	cout<<ans<<endl;
	return 0;
} 


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

int main() 
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
  char c;cin>>c;
  c++;cout<<c;
 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define FOR(i,b,e) for(int i=b;i<e;i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;

int main() {
  vector<int> s;
  int si, ti, n, q, c = 0;

  cin >> n;
  REP(i, n) {
    cin >> si;
    s.push_back(si);
  }
  sort(s.begin(), s.end());

  cin >> q;
  REP(i, q) {
    cin >> ti;
    if (*lower_bound(s.begin(), s.end(), ti) == ti) c++;
  }

  cout << c << endl;
  return 0;
}

Measured memory_bytes: 3148
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>

using namespace std;

#define int long long

signed main() {
    int n;
    cin >> n;
    map<string, int> mp;
    for(int i = 0; i < n; i++) {
        string s; 
        cin >> s;
        mp[s]++;
    }
    
    int maxv = 0;
    for(const auto& x : mp) {
        int v = x.second;
        if(v > maxv) maxv = v;
    }

    for(auto i = mp.begin(); i != mp.end(); i++) {
        if(i -> second == maxv) {
            cout << i -> first << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 25216
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main(){
  int d;
  while(cin >> d){
    int sum = 0;
    for(int i=0;i<600/d;i++){
      sum += d*pow(i*d,2);
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 1160
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int d;
    cin >> d;

    cout << "Christmas ";
    for (int i=0; i<25-d; i++) {
        cout << "Eve ";
    }
    cout << endl;
    return 0;
}

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

namespace ABC157
{
    class A
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            if (N % 2 == 0) Console.WriteLine(N / 2);
            else Console.WriteLine(N / 2 + 1);
        }
    }
}


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

int N;
int A, B, C;
int l[10];
int len = 1000000;

int main() {
    cin >> N >> A >> B >> C;
    for (int i=0; i<N; ++i) cin >> l[i];

    for (int i=0; i<(1<<(2*N)); ++i) {
        int na=0, nb=0, nc=0;
        int la=0, lb=0, lc=0;
        for (int j=0; j<=N; ++j) {
            if (i >> 2*j & 1 && i >> ((2*j)+1) & 1) {
                ++na;
                la += l[j];
            } else if (i >> 2*j & 1) {
                ++nb;
                lb += l[j];
            } else if (i >> ((2*j)+1) & 1) {
                ++nc;
                lc += l[j];
            }
        }
        if (na > 0 && nb > 0 && nc > 0) len = min(len, abs(la-A) + abs(lb-B) + abs(lc-C) + (na+nb+nc-3)*10);
    }
    cout << len << endl;

    return 0;
}

Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int x;cin>>x;int ans=0;
    for(int i=1;i<=1000;i++){
        for(int j=2;j<=1000;j++){
            if(pow(i,j)<=x)
                chmax(ans,pow(i,j));
            else
                break;
        }
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (A + B > C + D) {
		puts("Left");
	}
	else if (A + B < C + D) {
		puts("Right");
	}
	else {
		puts("Balanced");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    const int V = 100000;
    int N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    for(int i=0; i<N; i++) cin >> w[i] >> v[i];

    vector<ll> dp(V+1, 1e18);
    dp[0] = 0;
    for(int i=0; i<N; i++){
        for(int j=V; j>=0; j--){
            if(j-v[i]>=0) dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
        }
    }

    for(int i=V; i>=0; i--){
        if(dp[i]<=W){
            cout << i << endl; return 0;
        }
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include<math.h>
using namespace std;
bool GoodPrice(int price, int a, int b)
{
    return (price * 8 / 100 == a)
        && (price * 10 / 100 == b);
}
 
int main()
{
    int a, b;
    cin >> a >> b;
 
    auto price_limit = max(a * 100 / 8, b * 100 / 10);
    for (int i = 1; i <= 2 * price_limit; i += 1) {
        if (GoodPrice(i, a, b)) {
            cout << i << "\n";
            return 0;
        }
    }
 
    cout << "-1\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
const ll mo = 1e9+7;
ll qsm(ll a,ll b){
	ll res = 1;
	while(b){
		if(b & 1){
			res = res * a % mo; 
		}
		a = a*a % mo;
		b >>= 1;
	}
	return res;
}
int main(){
	ll n;
	cin >> n;
	cout<<((qsm(10ll,n)-2*qsm(9ll,n)+qsm(8ll,n))%mo+mo)%mo<< endl;
	return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

const ll INF = 1LL<<60;
vector<vector<bool> > B;

bool warshall_floyd(int n, vector<vector<ll> > &D) {
  rep(k,n) rep(i,n) rep(j,n) {
    if (D[i][j] > D[i][k]+D[k][j]) {
      return false;
    }
    else if (D[i][j] == D[i][k]+D[k][j] && k != i && k != j) {
      B[i][j] = true;
    } 
  }
  return true;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<vector<ll> > A(n,vector<ll>(n));
  rep(i,n) rep(j,n) {
    cin >> A[i][j];
  }
  B = vector<vector<bool> >(n,vector<bool>(n, false));
  bool res = warshall_floyd(n, A);
  if (!res) { //更新あり
    cout << -1 << endl;
    return 0;
  }
  ll sum = 0;
  rep(i,n) rep(j,n) {
    if (i == j) continue;
    if (B[i][j] == false) sum += A[i][j];
  }
  sum /= 2; //二回数えてる
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using maze = vector<vector<char>>;
const int dy[4] = {0, 0, 1, -1};
const int dx[4] = {1, -1, 0, 0};

int main()
{
    int h, w, count = 0;
    cin >> h >> w;
    maze M(h, vector<char>(w));
    Graph dist(h, vector<int>(w, -1));
    dist[0][0] = 0;
    queue<pair<int, int>> que;
    que.push(make_pair(0, 0));
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> M.at(i).at(j);
            if (M.at(i).at(j) == '#')
                count++;
        }
    }

    while (!que.empty())
    {
        pair<int, int> cur = que.front();
        int y = cur.first;
        int x = cur.second;
        que.pop();

        for (int i = 0; i < 4; i++)
        {
            int ny = y + dy[i];
            int nx = x + dx[i];
            if (ny < 0 || h <= ny || nx < 0 || w <= nx || M[ny][nx] == '#')
                continue;
            if (dist[ny][nx] == -1)
            {
                que.push(make_pair(ny, nx));
                dist[ny][nx] = dist[y][x] + 1;
            }
        }
    }
    int ans = h * w - count - dist[h - 1][w - 1] - 1;
    if (dist[h - 1][w - 1] == -1)
        cout << -1 << endl;
    else
        cout << ans << endl;
}

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

using namespace std;

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

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

int N;
int D[201][201];
int color[201];

bool is_bipartite(int now) {
  for (int i = 0; i < N; i++) {
    if (!D[now][i]) {
      continue;
    }
    if (color[i] == -1) {
      color[i] = color[now] ^ 1;
      if (!is_bipartite(i)) {
        return false;
      }
    } else if (color[i] == color[now]) {
      return false;
    }
  }
  return true;
}

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < N; j++) {
      D[i][j] = s[j] - '0';
    }
  }
  for (int i = 0; i < N; i++) {
    color[i] = -1;
  }
  if (!is_bipartite(0)) {
    cout << -1 << endl;
    return 0;
  }
  const int INF = 1e9;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (!D[i][j] and i != j) {
        D[i][j] = INF;
      }
    }
  }
  for (int k = 0; k < N; k++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        chmin(D[i][j], D[i][k] + D[k][j]);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (D[i][j] != INF) {
        chmax(ans, D[i][j]);
      }
    }
  }
  cout << ans + 1 << endl;

  return 0;
}


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

int dsum(int x){
    int s = 0;
    while(x){
        s += (x % 10);
        x /= 10;
    }
    return s;
}

int main(){
    int n;
    cin >> n;
    int ans = 1e9;
    for(int i = 1; i < n; i++){
        ans = min(ans, dsum(i) + dsum(n-i));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def lcs(xs, ys):
    dp = [([0] * (len(ys) + 1)) for _ in range(len(xs) + 1)]
    for i, x in enumerate(xs):
        for j, y in enumerate(ys):
            dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j], dp[i][j] + int(x == y))

    s = []
    p = (-1, -1)
    while 0 < dp[p[0]][p[1]]:
        if dp[p[0]][p[1]] == dp[p[0]-1][p[1]]:
            p = (p[0]-1, p[1])
        elif dp[p[0]][p[1]] == (dp[p[0]-1][p[1]-1] + int(xs[p[0]] == ys[p[1]])):
            s.append(xs[p[0]])
            p = (p[0]-1, p[1]-1)
        else:
            p = (p[0], p[1]-1)

    return ''.join(reversed(s))


def solve(s: str, t: str):
    return lcs(s, t)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    result = solve(s, t)
    print(result)

if __name__ == '__main__':
    main()

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

int main()
{
    int a,b,k;
    cin >> a >> b >> k;
    if(b - a + 1 < 2 * k){
        for(int i = a; i <= b; i++){
            cout << i << endl;
        }
    }else{
        for(int i = a; i < a + k; i++){
            cout << i << endl;
        }
        for(int i = b - k + 1; i <= b; i++){
            cout << i << endl;
        }
    }
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int main() {
    int n;
  cin>>n;
    vector<vector<int>> v;
    vector<int> q;
    q.push_back(3);
    q.push_back(5);
    q.push_back(7);
    v.push_back(q);
    for (int i=1;i<9;i++){
        auto q1=v[i-1];
        vector<int> q2;
        for (int x:q1){
            q2.push_back(10*x+3);
            q2.push_back(10*x+5);
            q2.push_back(10*x+7);
        }
        v.push_back(q2);
    }
    priority_queue<int, vector<int>, greater<int>> qq;
    for (int i=2;i<9;i++){
        for (int x:v[i]){
            int b3=0,b5=0,b7=0;
            string y=to_string(x);
            int num=y.size();
            rep(j,num){
                if (y.at(j)=='3'){
                    b3=1;
                }
                if (y.at(j)=='5'){
                    b5=1;
                }
                if (y.at(j)=='7'){
                    b7=1;
                }
            }
            if (b3*b5*b7){
                qq.push(x);
            }
        }
    }
    qq.push(1000000000);
    int ans=0;
    while (qq.top()<=n){
        ans+=1;
        qq.pop();
    }
    cout<<ans<<endl;

    
    

    return 0;
}

Measured memory_bytes: 560
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

dic = defaultdict(int)

for x in a:
    if 1 <= x <= 399:
        dic["灰"] += 1
    if 400 <= x <= 799:
        dic["茶"] += 1
    if 800 <= x <= 1199:
        dic["緑"] += 1
    if 1200 <= x <= 1599:
        dic["水"] += 1
    if 1600 <= x <= 1999:
        dic["青"] += 1
    if 2000 <= x <= 2399:
        dic["黃"] += 1
    if 2400 <= x <= 2799:
        dic["橙"] += 1
    if 2800 <= x <= 3199:
        dic["赤"] += 1
    if 3200 <= x:
        dic["強い"] += 1
kind = len(dic.keys())
if kind == 1 and bool(dic["強い"]):
    print(1, dic["強い"])
else:
    print(kind - bool(dic["強い"]), kind - bool(dic["強い"]) + dic["強い"])


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

int main()
{
	int i, n;
	cin >> n;
	double a[n], ans;
	for(i=0; i<n; i+=1)
		cin >> a[i];
	sort(a, a+n);
	ans=(a[0]+a[1])/2;
	for(i=2; i<n; i+=1)
		ans=(ans+a[i])/2;
	cout << fixed << setprecision(10) << ans << endl;
}

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

int main(){
	int n,k,p;
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> k >> p;
		if(k % p == 0) cout << p << endl;
		else cout << k % p << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
alpha= list("abcdefghijklmnopqrstuvwxyz")

s=input()
for x in alpha:
    if x not in s:
        print(x)
        exit()
    
print("None")

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
//int nm[10001][10001] = {0};
 
map<pair<int,int>,int> nm;
 
int b[10000];
 
int main() {
    int n,m;
 
    cin >> n >> m;
 
    while(1){
        int s,t,e;
        scanf(" %d %d %d",&s,&t,&e);
        if( (s+t+e) == 0) break;
        //nm[s][t] = e;
        nm[make_pair(s,t)] = e;
    }
 
    int l;
 
    cin >> l;
 
    pair<int,int> tmp;
 
    while(l--) {
 
        long long c[10001] = {0};
 
        for(int i=1;i<=m;i++){
            scanf(" %d",&b[i]);
        }
 
        int i, j;
        for (i = 1; i <= n; i++) {
            /*for (j = 0; j < m; j++) {
                c[i] = c[i] + nm[i][j+1] * b[j];
            }*/
        }
        for(map<pair<int,int>,int>::iterator itr = nm.begin(); itr != nm.end(); ++itr) {
            tmp = itr->first;
            c[tmp.first] += b[tmp.second] * itr->second;
            //cout << "I'm hungry " << c[tmp.first] << " " << tmp.first << " " << tmp.second << endl;
        }
 
 
        for(int i=1;i<=n;i++){
            //cout << c[i];
            printf("%d",c[i]);
            if(i!=n) printf(" ");//cout <<  ' ';
        }
        printf("\n");
 
    }
    return 0;
}

Measured memory_bytes: 6388
# -*- coding: utf-8 -*-


N=int(input())

MOD=10**9+7

A10,A9,A8=dict(),dict(),dict()

A10[1]=10
A9[1]=9
A8[1]=8

c=1
while(1):
    c*=2
    if c>N: 
        c/=2
        break
    A10[c]=A10[c/2]**2
    A9[c]=A9[c/2]**2
    A8[c]=A8[c/2]**2
    if c*2>N: break

B10,B9,B8=1,1,1
while(1):
    B10*=A10[c]
    B10%=MOD
    B9*=A9[c]
    B9%=MOD
    B8*=A8[c]
    B8%=MOD
    N-=c
    if N<=0: break
    while(1):
        c/=2
        if c<=N: break
    
ans=B10-2*B9+B8
ans%=MOD

print(ans)

Measured memory_bytes: 10992
import Control.Applicative ((<$>))
import Control.Monad (unless, forM_)
import Data.Vector.Unboxed (Vector, (!), (//))
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM

main :: IO ()
main = loop pct
  where isP x = all ((/=0).(mod x)) $ takeWhile ((x>=).(^2)) (2:[3,5..])
        pct = V.create $ do
          v <- VM.replicate 246913 0
          forM_ [2..246912] $ \i -> do
            x <- VM.read v (i-1)
            if isP i then do
              VM.write v i (x+1)
            else do
              VM.write v i x
          return v
        loop pct = do
          n <- readLn
          unless (n == 0) $ do
            print $ solve pct n
            loop pct
          
solve :: Vector Int -> Int -> Int
solve pct n = pct ! (2 * n) - pct ! n



Measured memory_bytes: 6800
import sys

read = sys.stdin.buffer.read


def main():
    N, *AB = map(int, read().split())
    T = [0] * N
    for i, (a, b) in enumerate(zip(AB[::2], AB[1::2])):
        T[i] = [b, a]

    T.sort()

    ok = True
    sum_a = 0
    for b, a in T:
        sum_a += a
        if sum_a > b:
            ok = False
            break

    if ok:
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 45020
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <climits>
#include <set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator

void solve() {
    string s; cin>>s;
    int a,b,c,d;
    a=s[0]-'0', b=s[1]-'0', c=s[2]-'0', d=s[3]-'0';
    for(int i=0;i<2;i++) {
        for(int j=0;j<2;j++) {
            for(int k=0;k<2;k++) {
                int res = a;
                if(i) res += b;
                else res -= b;
                if(j) res += c;
                else res -= c;
                if(k) res += d;
                else res -= d;
                if(res==7) {
                    char o1, o2, o3;
                    if(i) o1 = '+';
                    else o1 = '-';
                    if(j) o2 = '+';
                    else o2 = '-';
                    if(k) o3 = '+';
                    else o3 = '-';
                    cout<<a<<o1<<b<<o2<<c<<o3<<d<<"=7\n";
                    return;
                }
            }
        }
    }
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

template <class T>
std::vector<T> enum_div(T n) {
    std::vector<T> ret;
    for (T i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

bool isPrime(ll num) {
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    for (ll i = 3; i * i <= num; i += 2) {
        if (num % i == 0) { return false; }
    }

    return true;
};

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

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

template <class T>
bool is_integer(T x) {
    return std::floor(x) == x;
}

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

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

    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
    return 0;
}


Measured memory_bytes: 256
#include "stdio.h"

int main(){
  int height[10];
  for(int i = 0; i < 10; i++){
    scanf(" %d", &height[i]);
  }
  for(int numb = 0; numb < 9; numb++){
        for(int num = 0; num < 9-numb; num++){
            if(height[num] < height[num+1]){
                int stock = height[num];
                height[num] = height[num+1];
                height[num+1] = stock;
            }
        }
    }
  for(int a = 0; a < 3; a++){
    printf("%d\n", height[a]); 
  }
  return 0;
}

Measured memory_bytes: 1028
#include<iostream>
using namespace std;
int main() {
int a,b,c,d,e,f,max,count1;
cin >> a;
cin >> b;
cin >> c;
cin >> d;
cin >> e;
cin >> f;
count1=0;
max=0;
for (int i = 1; i<7; i++) {

if (a==i) count1=count1+1;
if (b==i) count1=count1+1;
if (c==i) count1=count1+1;
if (d==i) count1=count1+1;
if (e==i) count1=count1+1;
if (f==i) count1=count1+1;

if (max<count1) max=count1;
count1=0;
}

if (max<3) cout << "YES";
else cout << "NO";
cout << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int A,B;
    cin>>A>>B;
    if(A!=1&&B!=1){
    if(A>B){cout<<"Alice"<<endl;}
    else if(A<B){cout<<"Bob"<<endl;}
    else{cout<<"Draw"<<endl;}}
    else{if(A==1&&B!=1){cout<<"Alice"<<endl;}
          else if(A!=1&&B==1){cout<<"Bob"<<endl;}
          else if(A==1&&B==1){cout<<"Draw"<<endl;}}
    return 0;
}

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

int main(){
	int h, w;
	cin >> h >> w;
	vector<string> a(h);
	for(int i = 0; i < h; ++i){
		cin >> a[i];
	}
	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for(int i = 0; i < h; ++i){
		for(int j = 0; j < w; ++j){
			if(a[i][j] == '#'){
				row[i] = true;
				col[j] = true;
			}
		}
	}

	for(int i = 0; i < h; ++i){
		if(row[i]){
			for(int j = 0; j < w; ++j){
				if(col[j]){
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

double xmax,xmin,ymax,ymin;
double rmax,rmin,lmax,lmin,umax,umin,dmax,dmin;
//t秒後(t >= 0)
//xの最小値は min{xmin, lmin-t, rmin+t} 最大値は max{xmax, rmax+t, lmax-t}
//yの最小値は min{ymin, dmin-t, umin+t} 最大値は max{ymax, umax+t, dmax-t}

double f(double t){
    double xxmin = min(lmin - t, rmin + t);
    xxmin = min(xxmin, xmin);
    double yymin = min(dmin - t, umin + t);
    yymin = min(yymin, ymin);
    double xxmax = max(rmax + t, lmax - t);
    xxmax = max(xxmax, xmax);
    double yymax = max(umax + t, dmax - t);
    yymax = max(yymax, ymax);
    double ret = (xxmax - xxmin) * (yymax - yymin);
    return ret;
}


signed main(void) {
    int n;
    cin >> n;
    xmax = ymax = rmax = lmax = umax = dmax = -INF;
    xmin = ymin = rmin = lmin = umin = dmin = INF;
    rep(i,n){
        double x,y;
        char c;
        cin >> x >> y >> c;
        switch (c) {
            case 'R':
                ymax = max(ymax,y); ymin = min(ymin,y);
                rmax = max(rmax,x); rmin = min(rmin,x); break;
            case 'L':
                ymax = max(ymax,y); ymin = min(ymin,y);
                lmax = max(lmax,x); lmin = min(lmin,x); break;
            case 'U':
                xmax = max(xmax,x); xmin = min(xmin,x);
                umax = max(umax,y); umin = min(umin,y); break;
            case 'D':
                xmax = max(xmax,x); xmin = min(xmin,x);
                dmax = max(dmax,y); dmin = min(dmin,y); break;
        }
    }
    //t秒後(t >= 0)
    //xの最小値は min{xmin, lmin-t, rmin+t} 最大値は max{xmax, rmax+t, lmax-t}
    //yの最小値は min{ymin, dmin-t, umin+t} 最大値は max{ymax, umax+t, dmax-t}

    //最小値または最大値が入れ替わるタイミングだけ調べる
    double ans = f(0);
    int p[4][3] = {//0,-t,+t
        {xmin, lmin, rmin},
        {xmax, lmax, rmax},
        {ymin, dmin, umin},
        {ymax, dmax, umax}
    };
    rep(i,4){
        if(p[i][0] < p[i][1])ans = min(ans, f(p[i][1] - p[i][0]));
        if(p[i][2] < p[i][0])ans = min(ans, f(p[i][0] - p[i][2]));
        if(p[i][2] < p[i][1])ans = min(ans, f((p[i][1] - p[i][2])/2.0));
    }
    cout << shosu(15) << ans << endl;
}


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

int main() {
    
    long N, M;
    cin >> N >> M;
    
    vector<long> V;
    
    for (long i = 1; i * i <= M; i++) {
        if (M % i == 0) V.push_back(i), V.push_back(M / i);
    }
    
    sort(V.begin(), V.end());
    
    for (int i = 0; i < V.size(); i++) {
        if (V.at(i) * N > M) return cout << V.at(i - 1) << endl, 0;
    }
    
    cout << V.at(V.size() - 1) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e3 + 5;
int a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    int n , m ; cin >> n >> m;
    int tot = 0;
    for (int i = 1 ; i <= n ; i++) cin >> a[i] , tot += a[i];
    sort(a + 1 , a + 1 + n) ; reverse(a + 1 , a + 1 + n);
    tot = tot / (4 * m) + (tot % (4 * m) != 0);
    int flag = 1;
    for (int i = 1 ; i <= m ; i++){
        if(a[i] < tot) flag = 0;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n,a,b;
	while(cin>>n>>a>>b)
	{
		if(abs(a-b)%2-1==0)
		cout<<"Borys"<<endl;
		else
		cout<<"Alice"<<endl;
	}
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

var slice []int
var dp []float64

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

func main() {
	sc.Split(bufio.ScanWords)

	n, k := nextInt(), nextInt()
	slice = make([]int, n+k)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}

	dp = make([]float64, 1000000)
	for i := 0; i < len(dp); i++ {
		dp[i] = math.Inf(1)
	}

	dp[0] = 0.0
	// for i := 0; i < n; i++ {
	// 	for j := 1; j <= k; j++ {
	// 		chmin(&dp[i+j], dp[i]+float64(abs(slice[i]-slice[i+j])))
	// 	}
	// }
	for i := 1; i < n; i++ {
		for j := 1; j <= k; j++ {
			if i-j >= 0 {
				chmin(&dp[i], dp[i-j]+float64(abs(slice[i]-slice[i-j])))
			}
			// if i > 1 {
			// 	chmin(&dp[i], dp[i-j]+float64(abs(slice[i]-slice[i-j])))
			// }

		}
	}

	// fmt.Println(slice)
	// fmt.Println(dp[:n])
	fmt.Println(int(dp[n-1]))

}

func abs(a int) int {
	if a < 0 {
		return -1 * a
	}

	return a
}

func chmin(a *float64, b float64) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}

func chmax(a *float64, b float64) bool {
	if *a < b {
		*a = b
		return true
	}
	return false
}


Measured memory_bytes: 9984
#include <stdio.h>

int main() {
	int N,i,temp,num1=0,num2=0,num4=0;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d", &temp);
		if (temp % 4 == 0) {
			num4++;
		}
		else if (temp % 2 == 0) {
			num2++;
		}
		else {
			num1++;
		}
	}

	if ((num4 >= num1) || (num4 == num1 - 1 && num2==0)) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int N=0,M=0,a=0,c=0;
	cin>>N;
	cin>>M;
	int A[M]={0};
	for(int i=0;i<M;i++)
	{
		cin>>A[i];
	}
	int B[N]={0};
	for(int i=0;i<M;i++)
	{
		for(int j=0;j<N;j++)
		{
			cin>>a;
			if(a==A[i]){B[j]++;}
			else{c=A[i];
				B[c-1]++;}
		}
	}
	for(int i=0;i<N;i++)
	{
		cout<<B[i]<<endl;
	}
	return 0;
}



Measured memory_bytes: 3136
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int x[100000],y[100000],x_mod_k[100000],x_div_k[100000];
char s[100000][2];
int cnt[100000];
int n,k;

void add(int x,int t){//(x+??)/k%2=t
	if((x_div_k[x]&1)==0){
		if(t==0){//たさない
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
		else{//たす
			cnt[k-x_mod_k[x]]++;
		}
	}
	else{
		if(t==0){
			cnt[k-x_mod_k[x]]++;
		}
		else{
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
	}
}
signed main(){
	scanf("%d%d",&n,&k);
	rep(i,n){
		scanf("%d%d%s",&x[i],&y[i],s[i]);
		x_mod_k[i]=y[i]%k;
		x_div_k[i]=y[i]/k;
	}
	int Max=0;
	rep(i,k){
		memset(cnt,0,sizeof(cnt));
		rep(j,n){
			if(s[j][0]=='B'){
				if(((x[j]+i)/k)%2==0){//(y[j]+t)/K%2=0
					add(j,0);
				}
				else{
					add(j,1);
				}
			}
			else{
				if(((x[j]+i)/k)%2==0){//(y[j]+t)/K%2=1
					add(j,1);
				}
				else{
					add(j,0);
				}
			}
		}
		rep(j,k){
			if(j)cnt[j]+=cnt[j-1];
			Max=max({Max,cnt[j],n-cnt[j]});
		}
	}
	cout<<Max<<endl;
}

Measured memory_bytes: 2432
using System;

namespace abc133_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var items = Console.ReadLine().Split(' ');
            var l = long.Parse(items[0]);
            var r = long.Parse(items[1]);

            var min = 2018L;
            for (long i = l; i <= r; i++)
            {
                for (long j = i + 1; j <= r; j++)
                {
                    min = Math.Min(min, (i * j) % 2019L);
                    if (min <= 0)
                    {
                        break;
                    }
                }
                if (min <= 0)
                {
                    break;
                }
            }

            Console.WriteLine($"{min}");
        }
    }
}


Measured memory_bytes: 13268
<?php
fscanf(STDIN,'%s',$B);
if ($B=="A") {
  // code...
  echo "T";
}elseif($B=="C"){
  echo "G";
}elseif ($B=="G") {
  // code...
  echo "C";
}else{
  echo "A";
}

echo "\n";
 ?>


Measured memory_bytes: 3576
from collections import Counter
N = int(input())
l = []
for i in range(N):
  l.append(input())
  
c = Counter(l).most_common()
ma = c[0][1]
ans = []
for i in c:
  if i[1] == ma:
    ans.append(i[0])
  else:
    break;
    
ans.sort()
for i in ans:
  print(i)

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

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                var inputs = Console.ReadLine().Split(' ');
                var m = int.Parse(inputs[0]);
                var f = int.Parse(inputs[1]);
                var r = int.Parse(inputs[2]);
                if ((m == -1) && (f == -1) && (r == -1)) return;
                var sum = m + f;
                var result = "";

                if ((m == -1) || (f == -1) || (sum < 30))
                {
                    result = "F";
                }
                else if(80 <= sum)
                {
                    result = "A";
                }
                else if ((65 <= sum) && (sum < 80))
                {
                    result = "B";
                }
                else if ((50 <= sum) && (sum < 65))
                {
                    result = "C";
                }
                else if ((30 <= sum) && (sum < 50))
                {
                    result = (r >= 50) ? "C" : "D";
                }

                Console.WriteLine(result);
            }
        }
    }
}

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

using namespace std;

using LL = long long;
const int NQue = (int)2e5 + 5;

int nQue, type[NQue], a[NQue], b[NQue], nA;
LL sumB;
vector<int> compA;

int compAId(int num) { return (int)(lower_bound(compA.begin(), compA.end(), num) - compA.begin() ) + 1; }

template<class T>
struct Bit {
    T a[NQue];
    Bit() { fill(a, a + NQue, 0); }
    void upd(int pos, int val) {
        for (; pos < NQue; pos += pos & -pos) a[pos] += val;
    }
    T get(int pos) {
        T ret = 0;
        for (; pos > 0; pos -= pos & -pos) ret += a[pos];
        return ret;
    }
    T getPos(int id) {
        int ret = 0;
        for (int lg = __lg(NQue); lg >= 0; --lg) if ( (ret | (1 << lg) ) < NQue && a[ret | (1 << lg)] < id) {
            ret |= (1 << lg);
            id -= a[ret];
        }
        return ret + 1;
    }
};
Bit<int> cnt;
Bit<LL> sum;

int main() {
    scanf(" %d", &nQue);
    for (int i = 1; i <= nQue; ++i) {
        scanf(" %d", type + i);
        if (type[i] == 1) {
            scanf(" %d %d", a + i, b + i);
            compA.emplace_back(a[i]);
        }
    }

    sort(compA.begin(), compA.end() );
    compA.erase(unique(compA.begin(), compA.end() ), compA.end() );

    for (int i = 1; i <= nQue; ++i) {
        if (type[i] == 1) {
            ++nA;
            sumB += b[i];
            cnt.upd(compAId(a[i]), 1);
            sum.upd(compAId(a[i]), a[i]);
        }
        else {
            int pos = cnt.getPos(nA / 2 + (nA & 1) );
            printf("%d %lld\n", compA[pos - 1], sumB + (LL)compA[pos - 1] * (2 * cnt.get(pos) - nA) + sum.get(NQue - 1) - 2LL * sum.get(pos) );
        }
    }

    return 0;
}


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

using namespace std;
int main()
{
  string x,y,z;

   cin>>x>>y>>z;
   for( int i=0;i<100;i++)
    if(65<=y[i]<=90)
    {cout <<"A"<<y[0]<<"C";
    break;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 1000000000
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define mod 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef map<int,int> mii;
ll m;
ll fact[200001],vis[200001];
vi tree[200001];
ll sub[200001],tcnt[200001],res[200001];
ll bigmod(ll n,ll p)
{
    ll temp;
    if(p==0)
       return 1;
    else if(p==1)
       return n%mod;
    else if(p&1){
       temp=bigmod(n,p/2);
       return (((temp*temp)%mod)*(n%mod))%mod;
    }
    else {
       temp=bigmod(n,p/2);
       return (temp*temp)%mod;
    }
}

void dfs(ll n)
{
    vis[n]=1;
    sub[n]=1;
    vi vec;
    for(auto v: tree[n]){
        if(vis[v]==0){
            dfs(v);
            vec.pb(v);
            sub[n]+=sub[v];
        }
    }
    tcnt[n]=fact[sub[n]-1];
    for(int i=0;i<vec.size();i++)
        tcnt[n]=(tcnt[n]*tcnt[vec[i]])%mod;
    for(int i=0;i<vec.size();i++)
        tcnt[n]=(tcnt[n]*bigmod(fact[sub[vec[i]]],mod-2))%mod;
}
void reroot(ll n,ll p)
{
    vis[n]=1;
    //printf("%lld\n",n);
    if(n==1){
        res[n]=tcnt[n];
    }
    else {
        res[n]=(res[p]*bigmod(tcnt[n],mod-2))%mod;
        res[n]=(res[n]*fact[sub[n]])%mod;
        res[n]=(res[n]*fact[m-sub[n]-1])%mod;
        res[n]=(res[n]*tcnt[n])%mod;
        res[n]=(res[n]*bigmod(fact[sub[n]-1],mod-2))%mod;
        res[n]=(res[n]*bigmod(fact[m-sub[n]],mod-2))%mod;
    }
    for(auto v: tree[n]){
        if(vis[v]==0){
            reroot(v,n);
        }
    }
}
int main()
{
    ll i,j,k;
    fact[0]=1;
    for(i=1;i<=200000;i++)
        fact[i]=(i*fact[i-1])%mod;
    scanf("%lld",&m);
    for(i=1;i<m;i++){
        scanf("%lld %lld",&j,&k);
        tree[j].pb(k);
        tree[k].pb(j);
    }
    dfs(1);
    //res[1]=tcnt[1];
    //printf("%lld\n",tcnt[1]);
    memset(vis,0,sizeof vis);
    reroot(1,0);
    for(i=1;i<=m;i++)
        printf("%lld\n",res[i]);
}


Measured memory_bytes: 21860
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

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

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{n:i32,k:i32};

    let mut ans:i32 = 1;
    for i in 0..n {
        ans = min(ans+k, ans*2);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352