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

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


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

int main(){
    int A, B, T;
    cin >> A >> B >>T;
    cout << (T / A) * B << endl;
    return 0;
}

Measured memory_bytes: 256
ans = []

while True:
    h, w = map(int, input().split())
    if h + w == 0: break

    ans.append('#' * w + '\n' + \
        ('#' + '.' * (w - 2) + '#\n') * (h - 2) + \
        '#' * w + '\n')

for i, l in enumerate(ans):
    print(l)


Measured memory_bytes: 5708
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
struct edge {
    ll from, to, cost;
};
 
using edges = std::vector<edge>;
using graph = std::vector<edges>;
 
void add_edge(graph& g, int from, int to, int cost) {
    g[from].push_back((edge){from, to, cost});
    g[to].push_back((edge){to, from, cost});
}
 
 
class lca {
public:
    lca(graph& g, int root)
        : V(g.size()),
          log_V(0),
          depth_(V, 0)
    {
        for(int v=V; v>0; v /= 2) {
            ++log_V;
        }
        parent.assign(log_V, std::vector<int>(V, 0));
        dfs(g, root, -1, 0);
        for(int k=0; k+1 < log_V; ++k) {
            for(int v=0; v<V; ++v) {
                if(parent[k][v] < 0) {
                    parent[k+1][v] = -1;
                } else {
                    parent[k+1][v] = parent[k][parent[k][v]];
                }
            }
        }
    }
 
    void dfs(graph const& g, int v, int p, int d) {
        parent[0][v] = p;
        depth_[v] = d;
        for(int i=0; i<g[v].size(); ++i) {
            if(g[v][i].to != p) {
                dfs(g, g[v][i].to, v, d+1);
            }
        }
    }
 
    int depth(int v) const {
        return depth_[v];
    }
 
    int query(int u, int v) {
        if(depth_[u] > depth_[v]) {
            std::swap(u, v);
        }
        for(int k=0; k<log_V; ++k) {
            if((depth_[v] - depth_[u]) >> k & 1) {
                v = parent[k][v];
            }
        }
        if(u == v) {
            return u;
        }
        for(int k=log_V - 1; k>=0; --k) {
            if(parent[k][u] != parent[k][v]) {
                u = parent[k][u];
                v = parent[k][v];
            }
        }
        return parent[0][u];
    }
 
private:
    int V, log_V;
    std::vector<vector<int>> parent;
    std::vector<int> depth_;
};
 
 
void dfs(int v, int prev, graph& g, vector<ll>& d, ll sum) {
    d[v] = sum;
    for(auto& e : g[v]) {
        if(e.to == prev) {
            continue;
        }
        dfs(e.to, v, g, d, sum + e.cost);
    }
}
 
 
int main() {
    int N;
    cin >> N;
    graph g(N);
    for(int i = 0; i < N - 1; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        add_edge(g, a, b, c);
    }
 
    int Q, K;
    cin >> Q >> K;
    K--;
    vector<ll> d(N);
    dfs(K, -1, g, d, 0);
    while(Q--) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        cout << d[x] + d[y] << endl;
    }
}

Measured memory_bytes: 18944
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAX_N = 100005;

class Edge {
public:
  int nxt, to;
} e[MAX_N << 1];

int head[MAX_N], cnt;
void addedge(int u, int v) {
  e[++cnt] = (Edge){head[u], v}, head[u] = cnt;
  e[++cnt] = (Edge){head[v], u}, head[v] = cnt;
}

int N, length[MAX_N];
int que[MAX_N], top, ans2, mid, ok, ans1;

bool check(int pos) {
  for (int i = 1, j = top; i < j; ++i, --j) {
    if (i == pos) i++;
    if (j == pos) j--;
    if (i < j && que[i] + que[j] > mid) return false;
  }
  return true;
}

void dfs(int u, int v) {
  if (!ok) return;
  
  for (int i = head[u]; i; i = e[i].nxt)
    if (e[i].to != v)
      dfs(e[i].to, u);
  if (!ok) return;
  
  top = 0;
  for (int i = head[u]; i; i = e[i].nxt)
    if (e[i].to != v)
      que[++top] = length[e[i].to];
  sort(que + 1, que + top + 1);
  
  if (top % 2 == 0) {
    bool flag = 1;
    for (int i = 1; i <= top / 2; ++i)
      if (que[i] + que[top - i + 1] > mid) {
	flag = 0;
	break;
      }
    if (flag) {
      length[u] = 1, ans1 += top / 2;
      return;
    }
    if (v == 0) {
      ok = 0;
      return;
    }
    top--, ans1++;
  }
  que[top + 1] = 0;
  if (top & 1) {
    int l = 1, r = top, res = -1;
    while (l <= r) {
      int tmid = (l + r) >> 1;
      if (check(tmid)) res = tmid, r = tmid - 1;
      else l = tmid + 1;
    }
    if (res == -1) ok = 0;
    if (que[res] == mid && v != 0) ok = 0;
    length[u] = que[res] + 1, ans1 += top / 2;
    if (v == 0) ans1++;
  }
}

int main() {
  scanf("%d", &N);
  for (int i = 1, u, v; i < N; ++i) {
    scanf("%d%d", &u, &v);
    addedge(u, v);
  }
  int l = 1, r = N, ans2 = N;
  while (l <= r) {
    ans1 = 0;
    mid = (l + r) >> 1;
    ok = 1, dfs(1, 0);
    if (ok) ans2 = mid, r = mid - 1;
    else l = mid + 1;
  }
  
  ans1 = 0, ok = 1, mid = ans2;
  dfs(1, 0);
  printf("%d %d\n", ans1, ans2);
  return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	int N, M; cin >> N >> M;
	vector<ll> s(N), t(M);
	for (int i = 0; i < N; i++) {
		cin >> s[i];
	}

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

	vector<vector<ll>> dp(N + 1, vector<ll>(M + 1)), sum(N + 1, vector<ll>(M + 1));
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= M; j++) {
			if (s[i - 1] == t[j - 1])
				dp[i][j] = (sum[i - 1][j - 1] + 1) % DIV;
			sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + dp[i][j];
			sum[i][j] = (sum[i][j] + DIV) % DIV;
		}
	}

	cout << (sum[N][M] + 1 + DIV) % DIV << endl;
}


Measured memory_bytes: 66000
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

int main() {
	ll A, B, C, K; cin >> A >> B >> C >> K;
	cout << ((K % 2 == 0) ? A - B : B - A) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1e9
#define EPS 10e-8

int N,K;

int main(){
  cin >> N>> K;
  ll B=K;
  rep(i,N-1){
    B*=(K-1);
  }
  cout << B <<  endl;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;
using namespace atcoder;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t; cin>>t;
    while(t--){
        int N,M,A,B; cin>>N>>M>>A>>B;
        cout<<floor_sum(N,M,A,B)<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007 //S(vector).size()
using namespace std;
typedef long long ll;

int main(void){
  int n;
  cin >> n;
  int a[n], b[n - 1];
  rep(i, n-1) cin >> b[i];

  ll sum = 0;
  a[0] = b[0];
  a[n - 1] = b[n - 2];
  for(int i = 0; i < n - 2; i++){
    a[i + 1] = min(b[i], b[i + 1]);
  }
  rep(i, n) sum += a[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<string>
#include<algorithm>
#include<cmath>
#define REP(i,n) for(int i=0; i<int(n); i++)
using namespace std;
int main() {
	int X;
	cin >> X;
	int a, b;
	a = floor(X / 100);
	b = X - a * 100;
	if (a * 5 >= b ) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
n = int(input())
L = list(map(int,input().split()))
L = L + [0]
#print(L)
flag = False
up,down = [],[]
for i in range(n):
    if L[i] < L[i+1] and flag == False:
        flag =True
        up.append(i)
    elif L[i] > L[i+1] and flag == True:
        flag = False
        down.append(i)
#print(up,down)
sisan = 1000
div,buy,sell = 0,0,0
for i in range(n):
    if i in up:
        div = sisan//L[i]
        #print(div,sisan,i)
        buy = div*L[i]
        sisan -= buy
        #print(div,buy,sisan)
    elif i in down:
        sell = div*L[i]
        sisan +=sell
        #print(sell,sisan,i)
print(sisan)

Measured memory_bytes: 9136
sur={1:0,2:0,3:0,4:0,5:0,6:0}
inputs=input().split()
for i in range(6):
    sur[i+1]=int(inputs[i])
dir_of_roll=input()
for i in range(len(dir_of_roll)):
    copy_sur=sur.copy()
    if dir_of_roll[i]=='N':
        sur[1]=copy_sur[2]
        sur[2]=copy_sur[6]
        sur[6]=copy_sur[5]
        sur[5]=copy_sur[1]
    elif dir_of_roll[i]=='S':
        sur[1]=copy_sur[5]
        sur[5]=copy_sur[6]
        sur[6]=copy_sur[2]
        sur[2]=copy_sur[1]
    elif dir_of_roll[i]=='W':
        sur[1]=copy_sur[3]
        sur[3]=copy_sur[6]
        sur[6]=copy_sur[4]
        sur[4]=copy_sur[1]
    elif dir_of_roll[i]=='E':
        sur[1]=copy_sur[4]
        sur[4]=copy_sur[6]
        sur[6]=copy_sur[3]
        sur[3]=copy_sur[1]

print(sur[1])

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

using namespace std;
#define ll long long int
#define ed "\n"


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string a;
	ll p = 0;


	cin>>a;
ll n = a.length();

	for(ll i =0;i<n;i++)
	{
		if(a[i]=='7')
		{
			p=1;
			break;
		 } 
	}
	if(p==1)
	{
		cout<<"Yes"<<ed;
	}
	else
	{
		cout<<"No"<<ed;
	}
	
	return 0;


 }

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long

using namespace std;

const int O = 1e6 + 5;

string s;

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> s;
    if (s[1] == 'R') cout << "ABC";
    else cout << "ARC";
}

Measured memory_bytes: 3564
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;


int main() {
    
    int n;
    cin>>n;
    map<string,int> m;
    rep(i,n){
        int q;
        cin>>q;
        if(q==0){
            int x;
            string k;
            cin>>k>>x;
            m[k]=x;
        } else if(q==1) {
            string k;
            cin>>k;
            fin(m[k]);
        } else{
            string k;
            cin>>k;
            m.erase(k);
        }
    }
}


Measured memory_bytes: 27804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSR(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,t,a;
int h[1005];
int main(){
	cin>>n>>t>>a;
	t *= 1000;
	a *= 1000;
	P p = mp(INF,-1);
	rep(i,n){
		cin>>h[i];
		int x = t-h[i]*6;
		p = min(p,mp(abs(x-a),i));
	}
	cout << p.sc+1 << endl;
}

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

int main() {
    long long N,A,B;
    cin>>N>>A>>B;
    long long ans=0;
    if((B-A)%2==0){
        ans = (B-A)/2;
    }else{
        long long left=(A-1)+(B-1);
        long long right=(N-A)+(N-B);
        ans = min(left,right)/2+1;
    }
    cout << ans <<endl;
}

//15:43-15:56,miss 1

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int L = Integer.parseInt(sc.next());
        int sum = L*N;
        for(int i = 0; i <= N-1; i++) {
            sum += i;
        }
        
        if(L > 0) {
            sum -= L;
        }else {
            if(N + L <= 0) {
                sum -= (L + N - 1);
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21972
"use strict";
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
var ans = 0, d = 0, n, x;

console.log(main());
function main(){
  n = o.a();
  x = o.m(n);
  var s = "";
  for(var i = 0; i < n; i++)s += i;
  for(var i = 0; i < n; i++)
    solve(s.slice(0,i)+s.slice(i+1),s[i],0);
  return ans / d;
}

function solve(rest,p,dist){
  if(rest === ""){
    ans += dist;
    d++;
    return;
  }
  for(var i = 0; i < rest.length; i++){
    var dx = x[rest[i]][0] - x[p][0];
    dx *= dx;
    var dy = x[rest[i]][1] - x[p][1];
    dy *= dy;
    var t = dist+Math.sqrt(dx+dy);
    solve(rest.slice(0,i)+rest.slice(i+1),rest[i],t);
  }
}

Measured memory_bytes: 23804
def main():

    data = list(map(int, input().split()))

    a = data[:3]
    b = data[3:]
    ans = [0 for x in range(3)]

    t = b[2] - a[2]
    if t < 0:
        ans[2] = t + 60
        b[1] -= 1
    else:
        ans[2] = t


    t = b[1] - a[1]
    if t < 0:
        ans[1] = t + 60
        b[0] -= 1

    else:
        ans[1] = t

    ans[0] = b[0] - a[0]
    for a in ans[:-1]:
        print(a, end=' ')
    print(ans[-1])

if __name__ == '__main__':
    for a in range(3):
        main()

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

int main() {
  int N;
  cin>>N;
  vector<int> d(N);
  for(int i=0;i<N;i++)
    cin>>d.at(i);
  sort (d.begin(),d.end());
  
  int c=1;
  int s=d.at(0);
  for(int i=0;i<N-1;i++){
    if (s<d.at(i+1)) {
      c++;
      s=d.at(i+1);
    }
  }
  cout<<c<<endl;
}

Measured memory_bytes: 3524
#include<iostream>

int main()
{
	int n;
	long long expense=0;
	
	std::cin>>n;
	
	for(int i=0;i<n;i++)
	{
		int price;
		std::cin>>price;
		expense+=price;
	}
	expense/=n;
	std::cout<<expense<<std::endl;
	return 0;
}

Measured memory_bytes: 1156
#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 n; cin >> n;
	int ans = 0;
	while( n-- ){
		int l, r; cin >> l >> r;
		ans += (r-l)+1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# coding:utf-8

import sys


input = sys.stdin.readline


def inpl(): return list(map(int, input().split()))


L, N = inpl()
X = [int(input()) for _ in range(N)]

if N == 1:
    print(max(X[0], L - X[0]))
    exit()

# 累積和
Xcc = [0]  # 反時計回り
Xc = [0]  # 時計回り
for i in range(N):  #燃やして家まで戻ってきたときの距離の総和
    Xcc.append(Xcc[-1] + X[i] * 2)
    Xc.append(Xc[-1] + (L - X[-(1 + i)]) * 2)

# print(Xcc)
# print(Xc)

ans = 0
if N % 2:
    for i in range(1, N):
        # 反時計回り
        t_ccw = (N + i) // 2  # 反時計回りで最後に燃やす木
        t_cw = N - t_ccw  # 時計回りで最後に燃やす木
        ans_ccw = Xcc[t_ccw] - Xcc[i - 1] + Xc[t_cw]
        ans_ccw -= X[t_ccw - 1] if i % 2 else (L - X[-t_cw])  # 木を燃やし尽くした後家に帰らなくてよいので，その分引く

        # 時計回り
        t_cw = (N + i) // 2
        t_ccw = N - t_cw
        ans_cw = Xc[t_cw] - Xc[i - 1] + Xcc[t_ccw]
        ans_cw -= (L - X[-t_cw]) if i % 2 else X[t_ccw - 1]

        ans = max(ans, ans_ccw, ans_cw)


else:
    for i in range(1, N):
        # 反時計回り
        t_ccw = (N + i) // 2
        t_cw = N - t_ccw
        ans_ccw = Xcc[t_ccw] - Xcc[i - 1] + Xc[t_cw]
        ans_ccw -= (L - X[-t_cw]) if i % 2 else X[t_ccw - 1]

        # 時計回り
        t_cw = (N + i) // 2
        t_ccw = N - t_cw
        ans_cw = Xc[t_cw] - Xc[i - 1] + Xcc[t_ccw]
        ans_cw -= X[t_ccw - 1] if i % 2 else (L - X[-t_cw])

        ans = max(ans, ans_ccw, ans_cw)

print(ans)


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

#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int INF = 1e9 + 7;


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

	cout << (n%1000 == 0 ? 0 : 1000 - n%1000) << '\n';

	return 0;
}


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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  int n;

  scanf("%d", &n);

  int ans = 1;
  int k = 1;
  while(k <= n) {
    FOR (i, 1, n / 2) {
      FOR (j, 2, 10) {
        if (pow(i, j) == k) {
          ans = pow(i, j);
        }
      }
    }
    k++;
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 384
use warnings;
    use Data::Dumper;
    
    sub GetInputData{
    
        my @array_data;
    
        my $line = <STDIN>;
    
        chomp($line);
    
        while($line ne ""){
    
           push(@array_data,$line);
    
           $line = <STDIN>;
    
           chomp($line);
    
    }
    
        return @array_data;
    
    }
    
    sub GetSpaceInputData{
    
        my @array_temp=GetInputData();
    
        my @array_buf;
    
        foreach(@array_temp){
    
            #戻りは配列スペース区切りを分解
            # myを先頭につける必要あり
            my @array_work=split(" ",$_);

            # print "@array_work";
    
            # リファレンスを配列に代入
            push(@array_buf,\@array_work);
        }
    
        return @array_buf;
    
    }
    
    my @arr_result = GetSpaceInputData();

    my $s = $arr_result[0][0];

    my $maxdata=9999999999;

    for(my $i=0 ; $i < length($s)-2 ; $i++){

        $maxdata = $maxdata > abs(substr($s,$i,3)-753) ? abs(substr($s,$i,3)-753)  :  $maxdata;
    }

    print $maxdata;

Measured memory_bytes: 1920
n = int(input())
s = []
for _ in range(n):
    s.append(int(input()))
s.sort()
if sum(s)%10 != 0:
    print(sum(s))
else:
    for i in range(n):
        if (sum(s)-s[i])%10 != 0:
            print(sum(s)-s[i])
            break
    else:
        print(0)

Measured memory_bytes: 3060
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];
    string[][] PS;
    PS.length = N;
    foreach (_; 0..M) {
        auto ps = readln.split;
        PS[ps[0].to!int - 1] ~= ps[1];
    }
    int wa, ac;
    foreach (ss; PS) {
        int ww;
        foreach (s; ss) {
            if (s == "WA") {
                ++ww;
            } else {
                wa += ww;
                ac += 1;
                break;
            }
        }
    }
    writefln("%d %d", ac, wa);
}

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

int n, m;
multiset<int> ss;

int main(){
	scanf("%d", &n);
	for(int x; n--; ){
		scanf("%d", &x);
		ss.insert(x);
	}
	scanf("%d", &m);
	for(int x; m--; ){
		scanf("%d", &x);
		auto t = ss.find(x);
		if(t == ss.end()){
			puts("NO");
			return 0;
		}
		ss.erase(t);
	}
	puts("YES");
}

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

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define int long long

int maxn=1e18;

int32_t main()
{
    IOS;

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

    vector<int>h;

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

    vector<int>dp(n,maxn);
    dp[0]=0;

    for(int i=1;i<n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(i>=j)

            dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }

cout<<dp[n-1]<<endl;

return 0;
}


Measured memory_bytes: 1908
#pragma region Template
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RNG(i, a, b) for(int i = a; i < b; i++)
#define RBF(i, v) for(auto& i : v)
#define ALL(x) x.begin(), x.end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;
template<typename T> using VP = vector<pair<T, T>>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }
#pragma endregion

signed main()
{
    int n;
    cin >> n;
    V<int> a(n);
    RBF(ai,a) cin >> ai;

    int total = 0;
    RBF(ai, a) {
        total ^= ai;
    }

    RBF(ai, a) {
        int ans = ai ^ total;
        cout << ans << ' ';
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 3996
//#pragma GCC optimize("Ofast")

#pragma GCC optimize("O3")
//#pragma GCC target("avx,avx2,fma")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007// prime modulo value 
#define C 1000000001
#define M 998244353
#define all(x) x.begin(),x.end()
using namespace std;
// From Geeksforgeeks
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
// Power function took from geeksforgeeks
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
double dist(ll x1, ll y1, ll x2, ll y2)
{
	double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll r;
	cin >> r;
	cout << (3 * r * r);
	return 0;
}


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

// Shortcut

#define int long long
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a));
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

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

int n, m;
vi g[N];
int col[N];

bool dfs(int u, int c){
    col[u] = c;
    Fora(v, g[u]){
        if (col[v] == c){
            return 0;
        }
        if (!col[v] && !dfs(v, -c)){
            return 0;
        }
    }
    return 1;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    For(i, 0, m){
        int x, y;
        cin >> x >> y;
        g[x].pb(y);
        g[y].pb(x);
    }
    int ans;
    if (dfs(1, 1)){
        int cnt = 0;
        ForE(i, 1, n){
            if (col[i] == 1){
                cnt++;
            }
            ans = cnt * (n - cnt) - m;
        }
    }
    else{
        ans = n * (n - 1) / 2 - m;
    }
    cout << ans;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 7424
def init_road(M, road):
    for _ in range(M):
        a, b = [int(i) for i in input().split()]
        road.setdefault(a,set())
        road.setdefault(b,set())
        road[a].add(b)
        road[b].add(a)
    return road       

def good_peak_cnt(key, values):
    key = key - 1
    key_height = peaks[key]
    if len(values) == 0:
        pass
    else :
        for v in values:
            v = v -1
            v_height = peaks[v]
            if v_height >= key_height:
                return False
    return True

road = dict()
peaks = dict()

N, M = [int(i) for i in input().split()]
heights = [int(i) for i in input().split()]

for i, h in enumerate(heights):
    peaks.setdefault(i, h)

road = init_road(M,road)

cnt = 0
peaks_with_road = set()
for key, values in road.items():
    for r in values:
        peaks_with_road.add(r)
    if good_peak_cnt(key, values):
        cnt += 1

peaks_with_no_road = N - len(peaks_with_road)
output = cnt + peaks_with_no_road
print(output)

Measured memory_bytes: 60752
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <bitset>
#define ll long long int
#define ld long double
#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 << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define p pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000'000'007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;
int main(){
    string s;
    cin >> s;
    for(int i = 0;i < s.size();i++){
        if(i){
            if(s[i] == s[i-1]){
                cout << i << " " << i+1 << endl;
                return 0;
            }
            if(i > 1){
                if(s[i-2] == s[i]){
                    cout << i - 1 << " " << i+1 << endl;
                    return 0;
                }
            }
        }
    }
    cout << -1 << " " << -1 << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
const int MOD = 1e9 + 7;

int digit_sum(int n)
{
    int res = 0;
    while (n)
    {
        res += n % 10;
        n /= 10;
    }
    return (res);
}

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

    int ans = 1001001001;
    rep2(a, 1, n)
    {
        int b = n - a;
        int tmp = digit_sum(a) + digit_sum(b);
        ans = min(ans, tmp);
    }
    cout << ans << endl;

    return (0);
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
    using namespace std;
     
     
    #define ll long long
    #define pb push_back
    #define mp make_pair
    #define loop(i, a, b) for(int i = (a); i < (b); i++)
    #define loopb(i, a, b) for(int i = (a); i > (b); --i)
     
    typedef pair <int,int> ii;
    typedef vector <int> vi;
    typedef vector <ii> vii;
    typedef vector <ll> vl;
     
    const int mod = 1e9+7;
    const ll inf = 2e18+5;
     
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int n;
        cin>>n;
        double p_heads,p_tails;
     
        vector<double> dp(n+1);   //dp[i] is probability of getting i heads so far. Only 1-D array is needed. dp[heads][tails] is not needed because tails=n-heads
        //use vector, not array
      	dp[0] = 1;
     
        loop(i,1,n+1){
            cin>>p_heads;
            p_tails = 1 - p_heads;
            for(int j=i; j>=0; j--){
                if (j==0)
                    dp[j] = dp[j]*p_tails;
                else
                    dp[j] = dp[j-1]*p_heads + dp[j]*p_tails;  /*this time heads + *this time tails*/
            }
        }
        double ans = 0;
        int heads, tails;
        for(heads=0; heads<=n; heads++){
            tails = n-heads;
            if(heads>tails)
                ans += dp[heads]; 
        }
        
        printf("%.10lf",ans);
        return 0;
    } 

Measured memory_bytes: 256
#include <iostream>
using namespace std;
//using ll = long long;

int main(void) {
  int n; int i, j;
  cin >> n; //頂点の数
  int adj[n+1][n+1]; //隣接リスト
  for (i = 1; i < n+1; i++)
    for (j = 1; j < n+1; j++)
      adj[i][j] = 0;
  
  for (i = 1; i <= n; i++) {
    int u, k;
    cin >> u >> k;
      for (j = 1; j <= k; j++) {
        int m;
        cin >> m;
        adj[u][m]++;
      }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      cout << adj[i][j] ;
      if (j != n) cout << " ";
    }
    cout << endl;
  }
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int n,l; cin >>n >>l;
  if(l<=0&&n+l>0) cout <<n*(2*l+n-1)/2;
  else if(l+n-1<0) cout <<(n-1)*(2*l+n-2)/2;
  else cout <<(n-1)*(2*l+n)/2;
}

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

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,a,b;
  cin>>s;
  a={'A','B','C'};
  b={'A','R','C'};
  if(s==a)
    cout<<"ARC";
  else
    cout<<"ABC";
  return 0;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if (a <= c && c <= b) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
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>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

signed main()
{
   int n; cin >> n;
   string s; cin >> s;

   map<char,int> cnt;
   for (int i = 0; i < n; i++) {
      cnt[s[i]]++;
   }

   int ans = 1;
   for (auto it = cnt.begin(); it != cnt.end(); ++it) {
      (ans *= (it->second + 1)) %= MOD;
   }
   cout << (ans - 1 + MOD) % MOD << endl;

   return 0;
}


Measured memory_bytes: 512
import numpy as np
N,K = map(int,input().split())
A = np.array([int(i) for i in input().split()])


A = np.sort(A)
posi = A[A>0]
zero = A[A==0]
nega = A[A<0]

def f(x):
    """count the number of products , <= x"""
    cnt_tpl = 0
    # count 0
    if x >= 0:
        cnt_tpl += len(zero) * N
    # count posi
    cnt_tpl += np.searchsorted(A, x//posi, side='right').sum()
    # count nega
    cnt_tpl += (N - np.searchsorted(A, (-x - 1) // (-nega), side='right')).sum()
    # remove a^2
    cnt_tpl -= np.count_nonzero(A*A <= x)
    return cnt_tpl // 2

# 二分探索
left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)

Measured memory_bytes: 32288
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <queue>

typedef long long ll;
using namespace std;

typedef pair<ll, ll> P;

vector<P> v;

int main() {

    int N;
    cin >>  N;
    
    ll a, b;
    for (int i = 0; i < N; i++) {
        scanf("%lld %lld", &a, &b);
        v.push_back(P(b, a));
    }
    
    sort(v.begin(), v.end());

    ll time = 0;
    bool can = true;
    for (int i = 0; i < N; i++) {
        time += v[i].second;
        if (time > v[i].first)
            can = false;
    }

    if (can) cout << "Yes\n";
    else cout << "No\n";

}


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

using LL = long long;

#define ALL(a) begin((a)), end((a))
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define RFOR(i, a, b) for (int(i) = (a); (i) > (b); (i)--)
#define debug(x) cerr << #x << " : " << x << '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const LL LINF = 1e16;

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

  LL ans = 0;
  int N, K;
  cin >> N >> K;

  vector<int> l(N);
  FOR(i, 0, N) { cin >> l[i]; }

  sort(ALL(l), greater<int>());

  FOR(i, 0, K) { ans += l[i]; }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define SIZE 251

int main()
{
  int i,n,hi[SIZE];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&hi[i]);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,hi[i]);

    if(i/2>0)
      printf("parent key = %d, ",hi[i/2]);

    if(i*2<=n)
      printf("left key = %d, ",hi[i*2]);

    if(i*2+1<=n)
      printf("right key = %d, ",hi[i*2+1]);
    printf("\n");
  }

  return 0;
}
 
  




Measured memory_bytes: 2052
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;

	char a, b, c;
	a = (int)s1.at(0) - 32;
	b = (int)s2.at(0) - 32;
	c = (int)s3.at(0) - 32;

	cout << a << b << c << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using in6 = int64_t;
using ind = double;
using vi = vector<in6>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<in6,in6>;
using psi = pair<string,in6>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  in6 n;
  cin >> n;
  vi data(n);
  bool zero = 0;
  rep(i,n) {
    in6 a;
    cin >> a;
    if(a == 0) zero = 1;
    data[i] = a;
  }
  in6 ans = 1;
  if(zero) cout << 0;
  else {
    rep(i,n) {
      if(data[i] <= 1000000000000000000/ans) {
        ans *= data[i];
      }
      else {
        ans = -1;
        break;
      }
    }
    cout << ans;
  }
  hinata;
}

Measured memory_bytes: 3944
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

#define REP(I, S, E) for (decltype(S + E) I = (S), _E = (E); I < _E; ++I)
#define REP_REV(I, S, E) for (decltype(S + E) I = (E)-1, _S = (S); I >= _S; --I)

using namespace std;
using ll = long long;

int A, B, Q;

ll S[100000];
ll T[100000];
ll X[100000];
pair<ll, int> Y[100000];
ll D[100000];

auto main() -> int {
    scanf("%d %d %d", &A, &B, &Q);

    REP(si, 0, A) { scanf("%lld", &S[si]); }
    REP(ti, 0, B) { scanf("%lld", &T[ti]); }
    REP(xi, 0, Q) { scanf("%lld", &X[xi]); }

    REP(q, 0, Q) { Y[q] = {X[q], q}; }
    sort(Y, Y + Q);

    // 位置 x からみてすぐ右にある神社の番号 (なければ A)
    auto si = 0;
    auto ti = 0;

    REP(yi, 0, Q) {
        auto x = Y[yi].first;
        auto q = Y[yi].second;

        while (si < A && S[si] < x) {
            si += 1;
        }
        while (ti < B && T[ti] < x) {
            ti += 1;
        }

        auto min_dist = 1LL << 60;
        REP(s, max(0, si - 1), min(A, si + 1)) {
            REP(t, max(0, ti - 1), min(B, ti + 1)) {
                auto ds = abs(S[s] - x);
                auto dt = abs(T[t] - x);
                auto dist = abs(S[s] - T[t]) + ds + dt - max(ds, dt);
                min_dist = min(min_dist, dist);
            }
        }

        D[q] = min_dist;
    }

    REP(q, 0, Q) { printf("%lld\n", D[q]); }
    return 0;
}


Measured memory_bytes: 6016
#include <stdio.h>
#include <string.h>

using namespace std;

class Node {
public:
	int key;
	Node* prev;
	Node* next;
	Node(int _key, Node* _prev, Node* _next) {
		key = _key;
		prev = _prev;
		next = _next;
	}
};

class List {
public:
	Node* head;
	Node* last;
	List() {
		head = NULL;
		last = NULL;
	}
	void insert(int key) {
		auto node = head;
		head = new Node(key, NULL, node);
		if (node)
			node->prev = head;
		else
			last = head;
	}
	void deleteNode(Node* node) {
		if (! node)
			return;
		
		if (node == head)
			head = node->next;
		else
			node->prev->next = node->next;
		if (node == last)
			last = node->prev;
		else
			node->next->prev = node->prev;
		delete node;
	}
	Node* find(int key) {
		Node* current = head;
		while (current && current->key != key) {
			current = current->next;
		}
		return current;
	}
	void deleteFirst() {
		deleteNode(head);
	}
	void deleteLast() {
		deleteNode(last);
	}
};

int main() {
	int n;
	scanf("%d", &n);
	
	auto list = List();
	char name[100];
	int key;
	for (int i=0; i<n; i++) {
		scanf("%s", name);
		if (! strcmp(name, "insert")) {
			scanf("%d", &key);
			list.insert(key);
		} else if (! strcmp(name, "delete")) {
			scanf("%d", &key);
			list.deleteNode(list.find(key));
		} else if (! strcmp(name, "deleteFirst")) {
			list.deleteFirst();
		} else if (! strcmp(name, "deleteLast")) {
			list.deleteLast();
		}
	}
	
	auto current = list.head;
	while (current) {
		if (current != list.head)
			printf(" ");
		printf("%d", current->key);
		current = current->next;
	}
	printf("\n");
}

Measured memory_bytes: 33836
#include <bits/stdc++.h>
using namespace std;
int ans[2005];//距離iの数

int main(){
  int n, x, y;
  cin >> n >> x >> y;
  
  //円の内側同士
  int num = y-x+1;
  for(int i=0;i<num/2;i++){
    if(i==num/2-1&&num%2==0)ans[i+1]+=num/2;
    else ans[i+1]+=num;
  }
  // for(int i=1;i<n;i++)cout << ans[i] << ",";cout<<endl;
  //円の左側同士
  for(int i=1;i<x-1;i++){
    ans[i]+=x-1-i;
  }
  // for(int i=1;i<n;i++)cout << ans[i] << ",";cout<<endl;
  //円の右側同士
  for(int i=y+1;i<n;i++){
    ans[i-y]+=n-i;
  }
  // for(int i=1;i<n;i++)cout << ans[i] << ",";cout<<endl;
  //円の左側と右側
  for(int i=1;i<=x-1;i++){
    for(int j=y+1;j<=n;j++){
      ans[x-i+1+j-y]++;
    }
  }
  // for(int i=1;i<n;i++)cout << ans[i] << ",";cout<<endl;
  //円の左側と内側
  for(int i=1;i<=x-1;i++){
    ans[x-i]++;
    for(int j=0;j<num/2;j++){
      if(j==num/2-1&&num%2==0)ans[i+j+1]++;
      else ans[i+j+1]+=2;
    }
  }
  // for(int i=1;i<n;i++)cout << ans[i] << ",";cout<<endl;
  //円の右側と内側
  for(int i=y+1;i<=n;i++){
    ans[i-y]++;
    for(int j=0;j<num/2;j++){
      if(j==num/2-1&&num%2==0)ans[i-y+j+1]++;
      else ans[i-y+j+1]+=2;
    }
  }

  for(int i=1;i<n;i++)cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    const P: i64 = 1000000007;
    const L: usize = 200010;

    let mut f: Vec<i64> = vec![0; L];
    let mut rf: Vec<i64> = vec![0; L];

    f[0] = 1;
    f[1] = 1;
    for i in 2..L {
        f[i] = (f[i-1] * (i) as i64) % P;
    }

    rf[L-1] = 1;
    let mut x = f[L-1];
    let mut k = P-2;
    while k != 0 {
        if k%2 == 1 {
            rf[L-1] = (rf[L-1] * x) % P;
        }
        x = x.pow(2) % P;
        k /= 2;
    }

    for i in (0..L-1).rev() {
        rf[i] = (rf[i+1] * (i+1) as i64) % P;
    }

    let (h, w, a, b) = get!(i64, i64, i64, i64);

    let free_h = h - a;
    let free_w = w - b;
    let mut r: i64 = 0;
    for y in 1..free_h+1 {
        let i = ((f[(b+y-2) as usize] * rf[(b-1) as usize]) % P * rf[(y-1) as usize]) % P;
        let j = ((f[(free_w-1 + (h-y)) as usize] * rf[(free_w-1) as usize]) % P * rf[(h-y) as usize]) % P;
        r = (r + i*j) % P;
    }
    println!("{}", r);
}

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

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<int> d(n, -1);
    for (int i = 0; i < m; i++) {
        int s, c;
        cin >> s >> c;
        s--;
        if (d[s] != -1 && d[s] != c) {
            cout << -1;
            return 0;
        }
        d[s] = c;
    }
    if (n == 1) {
        if (d[0] == -1) d[0] = 0;
    } else {
        if (d[0] == -1) d[0] = 1;
        if (d[0] == 0) {
            cout << -1;
            return 0;
        }
        for (int i = 1; i < n; i++) {
            if (d[i] == -1) d[i] = 0;
        }
    }
    for (int i : d) cout << i;

    return 0;
}

Measured memory_bytes: 256