akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
    int N;
    double T, A;
    cin >> N >> T >> A;

    vector<double> H;
    double h;
    for (int i=0; i<N; i++)
    {
        cin >> h;
        H.push_back(T - h*0.006);
    }

    double ret = abs(H[0]-A), temp=0;
    int index = 0;
    for(int i=1; i<N; i++)
    {
        temp = abs(H[i]-A);
        if(temp < ret)
        {
            ret = temp;
            index = i;
        }
    }
    cout << index+1 <<  endl;
    return 0;
}

Measured memory_bytes: 256
BIG_NUM = 2000000000

N = int(input())

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

maximum = -BIG_NUM
minimum = BIG_NUM
total = 0

for x in table:
    if maximum < x:
        maximum = x
    if minimum > x:
        minimum = x
    total += x
    
print("%d %d %d"%(minimum,maximum,total))


Measured memory_bytes: 6592
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
//作者:中国江苏南京丁天行
using namespace std;
//数组不要开小了
//数组不要开反了
int n,ans,x,o;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
            scanf("%d",&x);
            if(x!=i)o=0;
            else if(o)o=0;
            else o=1,ans++;
    }
    printf("%d\n",ans);
	//system("pause");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

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

    vector<int64_t> x(N), v(N);
    vector<int64_t> x2(N), v2(N);
    for(int i = 0; i < N; ++i){
        cin >> x[i] >> v[i];
        x2[i] = C - x[i];
        v2[i] = v[i];
    }
    v[0] -= x[0];
    int64_t ans = 0;
    ans = max(ans, v[0]);
    //cout << v[0] << endl;
    for(int i = 1; i < N; ++i){
        v[i] += x[i-1];
        v[i] -= x[i];
        v[i] += v[i-1];
        //cout << v[i] << endl;
        ans = max(ans, v[i]);
    }
    v2[N-1] -= x2[N-1];
    ans = max(ans, v2[N-1]);
    /*cout << "po" << endl;
    cout << v2[N-1] << endl;*/
    for(int i = N-2; i >= 0; --i){
        v2[i] += x2[i+1];
        v2[i] -= x2[i];
        v2[i] += v2[i+1];
        //cout << v2[i] << endl;
        ans = max(ans, v2[i]);
    }
    vector<int64_t> vm(N), vm2(N);
    vm[0] = 0;
    vm[0] = max(vm[0], v[0]);
    for(int i = 1; i < N; ++i){
        vm[i] = max(v[i], vm[i-1]);
    }
    vm2[N-1] = 0;
    vm2[N-1] = max(vm2[N-1], v2[N-1]);
    for(int i = N-2; i >= 0; --i){
        vm2[i] = max(v2[i], vm2[i+1]);
    }

    for(int i = 0; i < N-1; ++i){
        int64_t sum = v[i] - x[i] + vm2[i+1];
        ans = max(ans, sum);
    }
    for(int i = 1; i < N; ++i){
        int64_t sum = v2[i] - x2[i] + vm[i-1];
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
// finish date: 2018/2/14

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>>
        vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


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 <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int N,tmp,n,m;
    string s = "";
    cin >> N;

    while(N != 0){
        tmp = N % 2;
        if(tmp < 0) tmp = 1;
        N = (N - tmp) / -2;
        s += (char)(tmp + '0');
    }
    reverse(s.begin(), s.end());
    if(s == "") s = "0";
    cout << s << endl;
    
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)
A.append(0)
my_sum = 0
for i in range(1, N + 2):
    my_sum += abs(A[i] - A[i - 1])
for i in range(1, N + 1):
    if A[i - 1] <= A[i] <= A[i + 1] or A[i + 1] <= A[i] <= A[i - 1]:
        print(my_sum)
    elif A[i + 1] <= A[i - 1] <= A[i] or A[i] <= A[i - 1] <= A[i + 1]:
        print(my_sum - 2 * abs(A[i] - A[i - 1]))
    elif A[i - 1] <= A[i + 1] <= A[i] or A[i] <= A[i + 1] <= A[i - 1]:
        print(my_sum - 2 * abs(A[i] - A[i + 1]))

Measured memory_bytes: 13920
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    char s[16], tmp;
    int n, k, i;

    scanf("%d %s %d", &n, s, &k);

    tmp = s[k - 1];
    for (i = 0; i < n; i++)
    {
        if (s[i] != tmp)
        {
            s[i] = '*';
        }
    }

    printf("%s", s);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MX 200005

using namespace std;

template <typename T> void read(T &x)
{
	x = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

int fst[MX], nxt[MX], v[MX], lnum;
int deg[MX], c[MX], val[MX];
int n;

void addeg(int nu, int nv)
{
	nxt[++lnum] = fst[nu];
	fst[nu] = lnum;
	v[lnum] = nv;
	deg[nv]++;
}

int stk[MX], top;
bool vis[MX];

int topo_sort()
{
	for(int i=1; i<=n; i++)
		if(deg[i] == 1)
			stk[++top] = i;
	int p = 1, sum = 0;
	while(top)
	{
		int x = stk[top--];
		if(vis[x]) continue;
		vis[x] = 1;
		if(deg[x]) sum += c[p];
		val[x] = c[p++];
		for(int i=fst[x]; i; i=nxt[i])
			if((--deg[v[i]]) <= 1 && !vis[v[i]])
				stk[++top] = v[i];
	}
	return sum;
}

int main()
{
	int a, b;
	read(n);
	for(int i=1; i<n; i++)
	{
		read(a), read(b);
		addeg(a, b);
		addeg(b, a);
	}
	for(int i=1; i<=n; i++) read(c[i]);
	sort(c+1, c+n+1);
	printf("%d\n", topo_sort());
	for(int i=1; i<=n; i++) printf("%d ", val[i]);
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
std::string s;
char x;
int f(int a,int b,int c){
    char i=s[a];
	x=((i!='s'&&i==s[b]&&i==s[c])?i:0);
    return x;
}
int main(){
    int i,j;
    while(getline(std::cin,s)){
        x=(f(0,4,8)||f(2,4,6))?s[4]:0;
        if(!x){
            for(i=0;i<3;i++){
                f(i,i+3,i+6);
                if(x)break;
                j=i*3;
                f(j,j+1,j+2);
                if(x)break;
            }
            if(!x)x='d';
        }
        std::cout<<x<<"\n";
    }
}

Measured memory_bytes: 1164
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (int i = 0; i < (n); ++i)	
//setprecision(16)

void outi(int x) { cout << x << endl;}
void soutl(ll x) { cout << x << endl;}
void outs(string x) { cout << x << endl;}
ll max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
ll min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}
//---------------------------------------------------------------

int main() {
	int n, d;
	
	int x[12][12];

	cin >> n >> d;
	rep(i, n) {
		rep(j, d) cin >> x[i][j];
	}
	int ans = 0;
	rep(i, n)rep(j,i) {//j < i
		int sq = 0;
		rep(k, d) {
			int s = x[i][k] - x[j][k];
			sq += s * s;
		}
		int s = sqrt(sq) + 0.5;
		if (s * s == sq) ans++;

	}
	outi(ans);
	
}

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

using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()

int const inf = 1 << 29;
struct Edge {
    Edge(int dst, int weight)
        : dst(dst), weight(weight){}
    int dst, weight;
};

struct State{
    State(int dst, int weight, int rest)
        :dst(dst), weight(weight), rest(rest){}
    int dst, weight, rest;
    bool operator<(const State &s) const {
        return weight > s.weight;
    }
};

typedef vector<vector<Edge>> Graph;

// M : テ・ツ按カテゥツ卍静ヲツ卍づゥツ鳴?
// L : テ・ツ?キテ・ツ?催」ツ?ァテ」ツ?催」ツつ凝ゥツ?づァツつケテ」ツ?ョテヲツ閉ー
// A : テ・ツァツ凝ァツつケ
// H : テァツオツづァツつケ
int V, M, L, E, A, H;
bool isL[128];
Graph g;

int dp[128][128];

int solve(){
    priority_queue<State> q;
    rep(i, V)rep(j, M + 1)dp[i][j] = inf;
    dp[A][M] = 0;
    q.emplace(A, 0, M);
    while (q.size()){
        State s = q.top(); q.pop();
        int src = s.dst, weight = s.weight, rest = s.rest;
        if (src == H) return weight;
        if (dp[src][rest] < weight) continue;
        rep(i, g[src].size()){
            int dst = g[src][i].dst;
            int weight = g[src][i].weight;
            if (rest - weight >= 0 && dp[dst][rest - weight] > dp[src][rest] + weight){
                dp[dst][rest - weight] = dp[src][rest] + weight;
                q.push(State(dst, dp[src][rest] + weight, rest - weight));
            }
            if (isL[src]){
                for (int j = 1; rest + j <= M; j++){
                    if (rest + j - weight >= 0 && dp[dst][rest + j - weight] > dp[src][rest] + weight + j){
                        dp[dst][rest + j - weight] = dp[src][rest] + weight + j;
                        q.push(State(dst, dp[src][rest] + weight + j, rest - weight + j));
                    }
                }
            }
        }
    }
    return inf;
}

int main(){
    while (cin >> V >> M >> L >> E >> A >> H && V){
        memset(isL, 0, sizeof(isL));
        g.assign(V, {});
        isL[A] = isL[H] = true;
        rep(i, L){
            int v; cin >> v;
            isL[v] = true;
        }
        rep(i, E){
            int u, v, t;
            cin >> u >> v >> t;
            g[u].push_back(Edge(v, t));
            g[v].push_back(Edge(u, t));
        }
        int ans = solve();
        if (ans >= inf) cout << "Help!";
        else cout << ans;
        cout << endl;
    }
}

Measured memory_bytes: 1592
import sys

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

# print(gcd(54, 20))
# print(gcd(147, 105))

input = sys.stdin.readline()
input = input.split(" ")
input = [int(i) for i in input]

print(gcd(input[0], input[1]))

Measured memory_bytes: 7684
from fractions import gcd
from functools import reduce
n=int(input())
l=[int(input()) for i in range(n)]

def lcm(x,y):
    return (x*y)//gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm,numbers,1)
if n==1:
    print(l[0])
else:
    print(lcm_list(l))

Measured memory_bytes: 5332
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

struct e{
  vector<int> l;
};

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

  vector<struct e> v(n+1);

  rep(i,0,m){
    int a,b;
    cin >> a >> b;
    v[a].l.push_back(b);
    v[b].l.push_back(b);
  }

  rep(i,1,n+1){
    P(v[i].l.size());
  }
  ret 0;
}

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

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

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<int>high(N);
  vector<int>vec(N,1);
  
  rep(i,N) cin >> high.at(i);
  
  rep(i,M){
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    
    if(high.at(A) <= high.at(B)) vec.at(A) = 0;
    if(high.at(B) <= high.at(A)) vec.at(B) = 0;
  }
    
  int count = 0;
  
  rep(i,N) count += vec.at(i);
  
  cout << count << endl;
}
    

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

using namespace std;

#define MAX_N 100000

typedef pair<int, int> pii;
vector<pii> edge[MAX_N + 1];
bool visited[MAX_N + 1];
int dist[MAX_N + 1];

bool dfs(int v) {
    visited[v] = true;
    for (int i = 0; i < edge[v].size(); ++i) {
        int next = edge[v][i].first;
        int cost = edge[v][i].second;
        if (!visited[next]) {
            dist[next] = dist[v] + cost;
            if (!dfs(next)) {
                return false;
            }
        } else {
            if (dist[next] != dist[v] + cost) {
                return false;
            }
        }
    }
    return true;
}

int main(void) {
    int N, M;
    cin >> N >> M;
    if (M == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    for (int i = 0; i < M; ++i) {
        int l, r, val;
        cin >> l >> r >> val;
        edge[l].push_back(make_pair(r, val));
        edge[r].push_back(make_pair(l, -val));
    }

    for (int i = 0; i < MAX_N + 2; ++i) {
        visited[i] = false;
    }

    for (int i = 1; i < N; ++i) {
        if (!visited[i]) {
            dist[i] = 0;
            if (!dfs(i)) {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 12032
#include<stdio.h>
#include<map>
#include<string>
#include<string.h>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<math.h>
#include<stack>
#include<set>
#define INF 2147483647
#define n 300000
#define loop(i, a, b) for(int i=a; i<=b; i++)
#define mem(arr) memset(arr, 0, sizeof(arr));
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
struct edge{
	int to, weight;
};
const llf hehe = 180 / (3.14159265358979323846);
void solve();
int main()
{
	int times = 1;
//	cin >> times;
	loop(i, 1, times)
	{
		solve();
		cout << '\n';
	}
	return 0;
}
vector<edge> V[n + 50];
llf a, b, c, d, e, f;
int arr[n + 50], arr1[n + 50], arr2[n + 50];
string str, str1, str2;

void solve()
{
	cin >> a >> b >> c;
	if(c / (a * a) >= b / 2)
	{
		llf one = 2.0 * b / a;
		llf two = 2.0 * c / a / a / a;
		llf three = one - two;
		llf ans = atan(three);
		printf("%.13lf", ans * hehe);
	}
	else
	{
		llf one = (llf)2.0 * c / a / b / b;
		llf two = atan(one) * hehe;
		llf ans = 90.0 - two;
		printf("%.13lf",ans);
	}
}

Measured memory_bytes: 8704
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections

N, = map(int, sys.stdin.readline().rstrip().split(" "))
Ws = list(map(int, sys.stdin.readline().rstrip().split(" ")))
total = sum(Ws)
T1, T2 = 0, total
result = total
for w in Ws:
    T1 += w
    T2 -= w
    result = min(result, abs(T1-T2))
print(result)
exit(0)

Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
#define int ll
string padd6(string s)
{
  if (s=="0")
    while(1);
	while (s.length() != 6)
      s = "0" + s;
  return s;
}
signed main()
{
 int n,m;
  cin >> n >> m;
  vector<pair<int,int>> v;
  vector<pair<int,int>> vv;
  for (int i = 0;i < m;i++)
  {
   int p,y;
    cin >> p >> y;
    v.push_back(make_pair(p,y));
    vv.push_back(make_pair(p,y));
  }
  sort(vv.begin(),vv.end());
  
  map<int, map<int, int>> mp;
  int num = 1;
  int prev = vv[0].first;
  for (int i= 0;i < m;i++)
  {
    if (prev != vv[i].first)
      num = 1;
    mp[vv[i].first][vv[i].second] = num;
    prev = vv[i].first;
	num++;
  }
  for (int i = 0;i < m; i++)
  {
    cout << padd6(to_string(v[i].first)) +  padd6(to_string(mp[v[i].first][v[i].second])) << endl;
  }
}


Measured memory_bytes: 20196
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <stack>
#include <queue>
#include <deque>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <bitset>

/*----------------------------------------------------------------*/

using ld = long double;
using vld = std::vector<ld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using str = std::string;
using vstr = std::vector<str>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;

/*----------------------------------------------------------------*/

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

/*----------------------------------------------------------------*/

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

/*----------------------------------------------------------------*/

ll gcd(ll n, ll m) { return m != 0 ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; sqr(i) <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll popcnt(ll n) {
    n = ((n & 0xaaaaaaaaaaaaaaaa) >> 1) + (n & 0x5555555555555555);
    n = ((n & 0xcccccccccccccccc) >> 2) + (n & 0x3333333333333333);
    n = ((n & 0xf0f0f0f0f0f0f0f0) >> 4) + (n & 0x0f0f0f0f0f0f0f0f);
    n = ((n & 0xff00ff00ff00ff00) >> 8) + (n & 0x00ff00ff00ff00ff);
    n = ((n & 0xffff0000ffff0000) >> 16) + (n & 0x0000ffff0000ffff);
    n = ((n & 0xffffffff00000000) >> 32) + (n & 0x00000000ffffffff);
    return n;
}

/*----------------------------------------------------------------*/

void solve();

/*----------------------------------------------------------------*/

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

    solve();
}

void solve() {
    ll n, max_w; std::cin >> n >> max_w;

    vll v(n), w(n);
    for (ll i = 0; i < n; i++)
        std::cin >> v[i] >> w[i];

    vll dp(max_w + 1, 0);
    for (ll i = 0; i < max_w; i++) for (ll j = 0; j < n; j++)
        if (i + w[j] <= max_w)
            chmax(dp[i] + v[j], dp[i + w[j]]);

    std::cout << dp[max_w] << '\n';
}



Measured memory_bytes: 3296
A, B, C, D, E, F = map(int, input().split())

lst = []

for a in range(0, F, 100*A):
    for b in range(0, F, 100*B):
        x = a + b
        if x == 0 or x > F:
            continue
            
        for c in range(0, F, C):
            for d in range(0, F, D):
                y = c + d
                if x + y > F or 100*y/(x+y) > 100*E/(100+E):
                    break
                lst.append((100*y/(x+y), x+y, y))
                
print(max(lst)[1], max(lst)[2])

Measured memory_bytes: 107556
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (1 ? 1e9 + 7 : 998244353);



int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	ll a, b, c, d, e, f, g, T;
	cin >> a >> b;
	b *= 2; b++;
	a += (b - 1);
	a /= b;
	cout << a << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

int main(){
lli x;
cin >> x;
cout << (x < 1200 ? "ABC" : "ARC") << endl;
return 0;
}

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

using namespace std;

int n;

int ar[]={300000,200000,100000};

int main(){
	int X;
	int Y;
	cin>>X>>Y;
	X--;
	Y--;
	int ans=0;
	if(X<3){
		ans+=ar[X];
	}
	if(Y<3){
		ans+=ar[Y];
	}
	if(X==0&&Y==0){
		ans+=400000;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> l(n * 2);
  REP(i, n * 2) cin >> l[i];
  sort(l.begin(), l.end());
  int sum{};
  for (int i = 0; i < n * 2; i += 2) {
    sum += min(l[i], l[i + 1]);
    // cout << l[i] << " " << l[i + 1] << endl;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
// 1_abc138_a
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
#define MOD (1000000007)
typedef long long ll;

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

    string s, t;
    cin >> s >> t;
    int ns = s.length();
    int nt = t.length();
    vector<bool> used_in_s(26);
    vector<bool> used_in_t(26);

    rep(i, 26){
        used_in_s[i] = false;
        used_in_t[i] = false;
    }

    rep(i, ns){
        used_in_s[s[i] - 'a'] = true;
    }
    rep(j, nt){
        used_in_t[t[j] - 'a'] = true;
    }
    rep(i, 26){
        if(used_in_t[i] && (!used_in_s[i])){
            cout << -1 << endl;
            return 0;
        }
    }

    vector<vector<int>> itr_s(26);
    rep(i, ns){
        int ch = s[i] - 'a';
        itr_s[ch].push_back(i);
    }

    ll ans = 1;
    int ch = t[0] - 'a';
    int now = itr_s[ch][0];

    for(int i = 1; i < nt; i++){
        ch = t[i] - 'a';
        auto it = upper_bound(itr_s[ch].begin(), itr_s[ch].end(), now);
        if(it == itr_s[ch].end()){
            now = itr_s[ch][0];
            ans++;
        }else{
            now = *it;
        }
    }

    ans = (ans - 1) * ns;
    ans += now + 1;

    cout << ans << endl;

    return 0;
}


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

int main() {
  int N;
  cin >>N;
  long long int  Sum;
  int  A[N];
 int  B[100001];
    for(int i=0;i<100002;i++){
    B[i]=0;
  }

  for( int  i=0;i<N;i++){
    cin >>A[i];
    Sum=Sum+A[i];
    B[(A[i])]=B[(A[i])]+1;
  }
  int  Q;
  cin >>Q;
  int  K;
   int  C;
  
  for(int  i=0;i<Q;i++){
  cin >>K;
    cin >>C;
    Sum=Sum+(C-K)*B[K];
    cout << Sum<<endl;
    B[C]=B[C]+B[K];
    B[K]=0;
  }
  
  
 return 0;
}


Measured memory_bytes: 4416
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>

using namespace std;

int main()
{
    int h, w, d;
    cin >> h >> w >> d;

    vector<pair<int, int> > locate(h * w);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int input;
            scanf("%d", &input);
            input--;
            locate[input].first = i;
            locate[input].second = j;
        }
    }

    int q;
    cin >> q;

    vector<int> l(q);
    vector<int> r(q);
    for (int i = 0; i < q; i++) {
        scanf("%d %d", &l[i], &r[i]);
        l[i]--; r[i]--;
    }

    vector<int> mp_sum(h * w);
    for (int i = 0; i < d; i++) {
        mp_sum[i] = 0;
        for (int j = i; j + d < h * w; j = j + d) {
            int mp = abs(locate[j].first - locate[j+d].first)
                    + abs(locate[j].second - locate[j+d].second);
            mp_sum[j + d] = mp_sum[j] + mp;
        }
    }

    for (int i = 0; i < q; i++) {
        cout << mp_sum[r[i]] - mp_sum[l[i]] << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    string a;
    cin>>a;
    if(a=="SUN")cout<<7<<endl;
    else if(a=="MON")cout<<6<<endl;
    else if(a=="TUE")cout<<5<<endl;
    else if(a=="WED")cout<<4<<endl;
    else if(a=="THU")cout<<3<<endl;
    else if(a=="FRI")cout<<2<<endl;
    else if(a=="SAT")cout<<1<<endl;

    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
def main():
    A, B = map(int, input().split())
    r = 1
    for i in reversed(range(2, min(A, B) + 1)):
        if A % i == 0 and B % i == 0:
            A //= i
            B //= i
            r *= i
    print(r * A * B)


main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <iterator>
#include <iomanip>
#include <climits>
using namespace std; 
#define ll long long int

struct pt{
    ll x, y, in;
};

vector<ll> p;

ll dsu_get (ll v) {
    return (v == p[v]) ? v : (p[v] = dsu_get (p[v]));
}

void dsu_unite (ll a, ll b) {
    a = dsu_get (a);
    b = dsu_get (b);
    if (rand() & 1)
        swap (a, b);
    if (a != b)
        p[a] = b;
}

int main(){
    ll n;
    cin >> n;
    vector<pt> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i].x >> a[i].y;
        a[i].in = i;
    }

    vector < pair < ll, pair<int,int> > > g;

    sort(a.begin(), a.end(), [](pt&a, pt&b){
        return a.x < b.x;
    });

    for(int i = 0; i < n - 1; ++i){
        g.push_back({a[i + 1].x - a[i].x, {a[i].in, a[i + 1].in}});
    }

    sort(a.begin(), a.end(), [](pt&a, pt&b){
        return a.y < b.y;
    });

    for(int i = 0; i < n - 1; ++i){
        g.push_back({a[i + 1].y - a[i].y, {a[i].in, a[i + 1].in}});
    }

    ll cost = 0;
    vector < pair<int,int> > res;

    sort (g.begin(), g.end());
    p.resize(n);
    for (int i=0; i<n; ++i)
        p[i] = i;
    for (int i=0; i<g.size(); ++i) {
        int a = g[i].second.first,  b = g[i].second.second,  l = g[i].first;
        if (dsu_get(a) != dsu_get(b)) {
            cost += l;
            res.push_back (g[i].second);
            dsu_unite (a, b);
        }
    }

    cout << cost;
}


Measured memory_bytes: 9196
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i, k, N) for (decltype(N + k) i = k; i < N; i++)
#define rep(i, N) for (decltype(N) i = 0; i < N; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
template <class X>
void pr(X test) { cout << test << endl; }
template <class X>
void prr(X test)
{
    for (auto it : test)
    {
        cout << it << " ";
    }
    cout << endl;
}
template <class X>
void prrr(X test)
{
    int f = 0;
    for (auto it : test)
    {
        cout << (f++ != 0 ? " " : "") << it;
    }
    cout << endl;
}
template <typename X>
istream &operator>>(istream &i, vector<X> &v)
{
    for (X &x : v)
        i >> x;
    return i;
}

int main()
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll R{}, G{}, B{};
    rep(i, s.size())
    {
        switch (s[i])
        {
        case 'R':
            R++;
            break;
        case 'G':
            G++;
            break;
        case 'B':
            B++;
            break;
        }
    }
    ll bad = 0;
    rep(i, s.size())
    {
        rep(j, s.size())
        {
            ll diff = j + 1;
            ll i1 = i, i2 = i + diff, i3 = i + 2 * diff;
            if (i3 >= s.size())
                break;
            if (s[i1] != s[i2] && s[i1] != s[i3] && s[i3] != s[i2])
                bad++;
        }
    }
    ll ans = 0;
    rep(i, s.size())
    {
        auto c = s[i];
        if (c == 'R')
        {
            R--;
            ans += G * B;
        }
        if (c == 'G')
        {
            G--;

            ans += R * B;
        }
        if (c == 'B')
        {
            B--;

            ans += G * R;
        }
        // pr(R + G + B);
    }

    pr(ans - bad);
    // pr(bad);
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long FINV(int n){
    if (n < 0) return 0;
    return finv[n];
}

ll mod_pow(ll x, ll n, ll mod){ 
    ll res = 1;
    while(n > 0){
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    // 前処理
    COMinit();

    int n;
    cin >> n;
    ll c[n];
    rep(i,n)cin >> c[i];

    sort(c, c+n);

    ll ans = 0;

    if(n == 1){
        ans = c[0] * 2 % MOD;
        cout << ans << endl;
        return 0;
    }

    rep(i,n){
        ll tmp = mod_pow(4, n-1, MOD) * (n + 1 - i) % MOD * c[i] % MOD;
        ans += tmp;
        ans %= MOD;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13696
n, k = map( int, input().split() )
mod = 10 ** 9 + 7

f = [ 1 ] * ( n + 1 ) 
inv = [ 1 ] * ( n + 1 )

for i in range( 1, n + 1 ):
  f[ i ] = ( f[ i - 1 ] * i ) % mod
  
inv[ n ] = pow( f[ n ], mod - 2, mod )
for i in range( n, 0, - 1 ):
  inv[ i - 1 ] = ( inv[ i ] * i ) % mod
  
def nCr( n, r ):
  if r < 1:
    return 1
  return ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod

ans = 0
for i in range( min( k, n - 1 ) + 1 ):
  ans = ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod
  
print( ans )




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

int main(void){
    
    int N,M,C,count=0;
    cin >> N >> M >> C;
    vector<int> B{};
    
    for(int i=0;i<M;i++){
        int b_i;
        cin >> b_i;
        B.push_back(b_i);
    }
    
    
    for(int i=0;i<N;i++){
        int sum = 0;
        for(int j=0;j<M;j++){
            int a_i;
            cin >> a_i;
            sum += (B.at(j)*a_i);
        }
        if(sum + C > 0) count++;
    }
    
    
    cout << count << endl;
    
}

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

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

  ll A; cin >> A;
  ll B; cin >> B;
  ll C; cin >> C;
  if (C - A - B <= 0) {
    cout << "No" << '\n';
  } else if (4 * A * B < (C - A - B) * (C - A - B)) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }

  return 0;
}

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

const int INF = 1e9;

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

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  int n, m;
  cin>>n>>m;

  COMinit();
  vector<int> factors;
  for (int i=2; i <= m; i++) {
    if (m % i != 0) {
      continue;
    }
    int tmp = 0;
    while (m % i == 0) {
      ++tmp;
      m = m / i;
    }
    factors.push_back(tmp);
  }
  long long ans = 1;
  for (int f: factors) {
    ans = (ans * COM(f + n - 1, n - 1)) % MOD;
  }
  cout<<ans<<endl;
}


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

int main(){
  int i,j,cnt=0;
  int h,w;
  cin>>h>>w;
  char b[h+2][w+2];
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      cin>>b[i][j];
    }
  }
  for(i=0;i<=h;i++){
    b[i][0]='.';
    b[i][w+1]='.';
  }
  for(i=0;i<=w;i++){
    b[0][i]='.';
    b[h+1][i]='.';
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(i==h && j==w)break;
      if(b[i][j]=='#'){
        if((b[i+1][j]=='.' && b[i][j+1]=='.') || (b[i+1][j]=='#' && b[i][j+1]=='#')){
          cout<<"Impossible";
          return 0;
        }
        if(i!=1 || j!=1){
          if((b[i-1][j]=='.' && b[i][j-1]=='.') || (b[i-1][j]=='#' && b[i][j-1]=='#')){
            cout<<"Impossible";
            return 0;
          }
        }
      }
    }
  }
  cout<<"Possible";
}

Measured memory_bytes: 256
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for {
		sc.Scan()
		s := sc.Text()
		if s == "0" {
			return
		}

		sc.Scan()
		s = sc.Text()
		ns := strings.Split(s, " ")

		m := float64(0)
		var fs []float64
		for _, v := range ns {
			d, _ := strconv.ParseFloat(v, 64)
			m += d
			fs = append(fs, d)
		}
		m = m / float64(len(fs))

		b := float64(0)
		for _, v := range fs {
			b += math.Pow(m-v, 2)
		}
		b = b / float64(len(ns))

		fmt.Println(math.Sqrt(b))
	}
}



Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define int         int64_t

using namespace std;

const int N = int(3e5) + 7;
const int mod = 998244353;

int n, m, cnt[4], ind[N];
string s;
vector<int> r, g, b;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> s; m = 3 * n;
    for(int i = 0; i < m; ++i) {
        if(s[i] == 'R') r.pb(i + 1);
        else if(s[i] == 'G') g.pb(i + 1);
        else b.pb(i + 1);
    }
    for(int i = 0; i < n; ++i) {
        ind[min({r[i], g[i], b[i]})] = 1;
        ind[max({r[i], g[i], b[i]})] = 3;
        ind[r[i] + g[i] + b[i] - min({r[i], g[i], b[i]}) - max({r[i], g[i], b[i]})] = 2;
    }
    cnt[0] = n; cnt[1] = cnt[2] = 0;
    int res = 1;
    for(int i = 1; i <= m; ++i) {
        res = res * cnt[ind[i] - 1] % mod;
        ++cnt[ind[i]]; --cnt[ind[i] - 1];
    }
    cout << res;
}


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

int main() {
  int N,T,c,t;
  cin >> N >> T;
  int cnt=10000;
  for (int i=0; i<N; i++) {
    cin >> c >> t;
    if (T>=t) {
      cnt=min(cnt,c);
    }
  }
  if (cnt!=10000) {
    cout << cnt << endl;
  }
  else {
    cout << "TLE" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
class Main {
	public static void main(String...args) {
		Scanner scan = new Scanner(System.in);
		Map<Character , Integer >strs = new HashMap<>();
		
		for(int i = 97; i <= 122; i++) {
			strs.put((char)i,0);
		}
		//input
		while(scan.hasNext()) {
		    String str = scan.nextLine();
		    str = str.toLowerCase().replaceAll(" ","");
		    char[] str2 = str.toCharArray();
		    for(int i = 0; i < str2.length; i++) {
		        if(str2[i] > 96 && str2[i] < 123){
		            int	count = strs.get(str2[i]);
		            strs.put(str2[i],++count);
		        }
		    }
		}
		//output
	    for(int i = 97; i <= 122 ; i++) {
		System.out.println((char)i + " : " + strs.get((char)i)); 
		}
	}
}
		
		


Measured memory_bytes: 26232
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		int N = nextInt();
		ArrayList<Integer> list = nextIntArray();
		int output = 1000000000;
		for(int i = 1; i <= 100; i++){
			int sum = 0;
			for(int j = 0; j < N; j++){
				sum += (int)Math.pow(i - list.get(j), 2);
			}
			output = Math.min(output, sum);
		}
		myout(output);
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 32552
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
int test[213456];
int keta(int x) {
	int res = 0;
	while(x >= 1) {
		x /= 10; res++;
	}return res;
}
signed main() {
	double n, a, b, x, c = 0, d = 0; cin >> a >> b >> x;
	x /= a;
	if (x > a * b / 2) {
		c = (a * b - x) / a * 2;
		d = a;
	}
	else {
		c = b;
		d = x / b * 2;
	}
	printf("%.15f\n", atan(c / d) * 180/ 3.1415926535897932384626433832795028841971693993751058209749445923078);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <set>

using namespace std;
using ll = long long;

template<typename T> void print(T t) { cout << t << endl; }
ll MOD = 1000000007;


int main() {
	ll D, T, S;
	cin >>D >> T >> S;
	
	if (D <= S*T) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3620
N, A, B, C, D = map(int, input().split())
S = '#' + input()

for i in range(C - A):
    if S[A + i: A + i + 2] == '##':
        print('No')
        exit(0)
for i in range(D - B):
    if S[B + i: B + i + 2] == '##':
        print('No')
        exit(0)

if C > D:
    if '...' not in S[B - 1: D + 2]:
        print('No')
        exit(0)

print('Yes')


Measured memory_bytes: 3572
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let N = lines[0].split(/\s/).map((v) => v - 0)[0];
    let res = N;
    for (let i = 0; i <= N; i++) {
        let cc = 0, t = i;
        while (t > 0) cc += t % 6, t /= 6, t |= 0;
        t = N - i;
        while (t > 0) cc += t % 9, t /= 9, t |= 0;
        if (res > cc) res = cc;
    }
    console.log(res);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9932
import java.io.PrintWriter;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    private static Scanner in = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    public static class Node {
        private int counter;
        private List<Integer> children;

        public Node() {
            this.children = new ArrayList<>();
        }

        public void addChild(int child) {
            this.children.add(child);
        }
    }

    private static void solve() {
        int n = in.nextInt();
        int q = in.nextInt();

        Node[] nodes = new Node[n];
        for (int i=0; i < n; i++)
            nodes[i] = new Node();

        for (int i=0; i < n-1; i++) {
            int a = in.nextInt();
            int b = in.nextInt();

            nodes[a - 1].addChild(b - 1);
            nodes[b - 1].addChild(a - 1);
        }

        for (int i=0; i < q; i++) {
            int p = in.nextInt();
            int x = in.nextInt();
            nodes[p - 1].counter += x;
        }

        /*
        boolean[] visited = new boolean[n];
        Queue<Integer> toVisit = new ArrayDeque<>();
        visited[0] = true;
        toVisit.add(0);
        while (!toVisit.isEmpty()) {
            int i = toVisit.poll();
            Node p = nodes[i];
            List<Integer> toAdd = p.children;
            for (int a : toAdd) {
                if (!visited[a]) {
                    visited[a] = true;
                    toVisit.add(a);
                    nodes[a].counter += p.counter;
                }
            }
        }
        */

        // https://atcoder.jp/contests/abc138/submissions/7003907
        dfs(nodes, -1, 0);

        out.println(
                Arrays.stream(nodes).map(p -> String.valueOf(p.counter)).collect(Collectors.joining(" "))
        );
    }

    private static void dfs(Node[] nodes, int parent, int index) {
        if (parent >= 0) {
            nodes[index].counter += nodes[parent].counter;
        }

        for (int child : nodes[index].children) {
            if (child != parent)
                dfs(nodes, index, child);
        }
    }

}


Measured memory_bytes: 223324
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <set>

using namespace std;

void A();
void B();
void C();
void D();
void E();
void F();

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

	B();

}

void A() {

	string day;
	cin >> day;

	int daysAways = 0;
	
	if (day == "SUN") daysAways = 7;
	if (day == "MON") daysAways = 6;
	if (day == "TUE") daysAways = 5;
	if (day == "WED") daysAways = 4;
	if (day == "THU") daysAways = 3;
	if (day == "FRI") daysAways = 2;
	if (day == "SAT") daysAways = 1;


	int result = 0;


	cout << daysAways << endl;

	
}

void B() {

	int N;
	string S;
	cin >> N >> S;

	for (int i = 0; i < S.length(); i++) {

		int ch = (int)(S[i]-'A');

		S[i] = (ch + N) % 26 + 'A';


	}




	cout << S << endl;

	
}

void C() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {

		int N;
		cin >> N;


		int result = 0;

		cout << "Case #" << t << ": ";

		cout << result << endl;

	}
}

void D() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {

		int N;
		cin >> N;


		int result = 0;

		cout << "Case #" << t << ": ";

		cout << result << endl;

	}
}

void E() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {

		int N;
		cin >> N;


		int result = 0;

		cout << "Case #" << t << ": ";

		cout << result << endl;

	}
}

void F() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {

		int N;
		cin >> N;


		int result = 0;

		cout << "Case #" << t << ": ";

		cout << result << endl;

	}
}



Measured memory_bytes: 256