akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<map>
#include<stack>
#define FOR(i,a,b) for(int i=(a); i<int(b); ++i)
#define RFOR(i,a,b) for(int i=(b)-1; i>=int(a); --i)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,int(n)+1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
#define al(d) d.begin(),d.end()
using namespace std;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(int n){
	vector<T> vec;
	rep(i,n){
		T input;
		cin >> input;
		vec.emplace_back(input);
	}
	return vec;
}
using AdjList = vector<vector<int>>;
using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

// Recieve edge(=(int,int)) as an adj list.
vector<vector<int>> getadj(int N, int M){
	// Initialize all lists of the graph as a empty vector.
	vector<int> init;
	vector<vector<int>> graph(N,init);

	rep(i,M){
		int a, b;
		cin >> a >> b;
		graph[a-1].emplace_back(b-1);
		graph[b-1].emplace_back(a-1);
	}
// rep(i,N)
// 	putv(graph[i]);
	return graph;
}

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
using namespace std;

int N,M;
vector<string> A,B;
bool search(int x, int y);
int main(){
	cin >>N>>M;
	A = getv<string>(N);
	B = getv<string>(M);

	int lim = N-M+1;
	rep(x,lim)
		rep(y,lim)
			if(search(x,y)){
				cout << "Yes" << endl;
				return 0;
			}
	cout << "No" << endl;
}


bool search(int x, int y){
	rep(px,M)
		rep(py,M)
			if(A[x+px][y+py] != B[px][py]) return false;
	return true;
}

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

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            var input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
            Console.WriteLine("{0} {1} {2:f5}", input[0] / input[1], input[0] % input[1], (double)input[0] / input[1]);
        }
    }
}

Measured memory_bytes: 20244
#include<utility>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<numeric>
#include<functional>
#include<string>
#include<iostream>

using namespace std;
const int one = 1;
const int big = (one<<20);
typedef long long int llint;

int main(void){
	int ifN=0,ifW=0,ifS=0,ifE=0,i=0;
	string S;
	cin>>S;
	for(i=0;i<S.size();i++){
		if(S[i]=='N'&&ifN==0){ ifN=1; }
		if(S[i]=='S'&&ifS==0){ ifS=1; }
		if(S[i]=='W'&&ifW==0){ ifW=1; }
		if(S[i]=='E'&&ifE==0){ ifE=1; }
	}
	if((ifN==ifS)&&(ifW==ifE)){
		printf("Yes\n");
	} else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = unsigned long long;
typedef pair<int,int> P;
typedef priority_queue<int> Pr;
typedef vector<int> V;
typedef vector<P> Vp;
typedef map<int,int> MP;
const int MOD = 1000000007;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define END cout<<ans<<'\n'; return 0;
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; }

MP p; Int fac[200001],finv[200001],inv[200001];

void COMinit(int n) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i <= n; 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;
    }
}

Int C(int n,int k){
    if(n<0||k<0||n<k)return 0;
    return fac[n] * (finv[n-k]*finv[k]%MOD) %MOD;
}


void dic(int n){
    for (int i = 2; i*i <= n; i++){
        if(!(n%i)){p[i]++; dic(n/i); return;}
    }
    if(n!=1)p[n]++;
    return;
}

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

    int n,m; cin>>n>>m; Int ans=1;
    if(n==1){END}
    dic(m); COMinit(200000);
    for(auto k:p)ans=ans*C(n+k.second-1,k.second)%MOD;
    END
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    vector<int> N(4);
    for(int i=0;i<4;i++) cin >> N[i];

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

    if(N[0] == 1 && N[1] == 4 && N[2] == 7 && N[3] == 9){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

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

int main() {
    ll N, a, b;
    cin >> N >> a >> b;
    ll ans;
    if((a-b)%2 == 0){
        ans = min({(b-a)/2, b-1, N-a, (2*N-a-b)/2, (a+b)/2});
    }else{
         ans = min({b-1, N-a, (2*N+1-a-b)/2, (a+b-1)/2});
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int X; cin >> X;
    int times = X / 100;
    int nums = X % 100;
    while (nums > 0 && times > 0) {
        nums -= 5;
        --times;
    }
    cout << ((int) nums <= 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n, a, b;
ll cnta, cntb, cntc;
int main(){
    cin>>n>>a>>b;

    REP(i, 0, n){
        ll p;
        cin>>p;
        if(p<=a) cnta++;
        else if(a<p && p<=b) cntb++;
        else cntc++;
    }
    cout<<min(min(cnta, cntb), cntc)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

ll gcd(ll x, ll y){
    if (x > y) swap(x,y);
    ll m = 1;
    while(m != 0){
        m = y % x;
        y = x;
        x = m;
    }
    return y;
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}


int main() {
    int x;
    cin >> x;
    cout << lcm(360, x) / x << endl;

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
typedef long long ll;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define debug(x)             cout <<#x<<": "<<x<<endl;
#define debug2(x, y)         cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define debug3(x, y, z)      cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define debug4(a, b, c, d)   cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
template <typename T>  using orderedSet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // order_of_key find_by_order

int main() {
    FAST
    string s,t;
    cin>>s>>t;
    int n=s.length();
    int ans=0;
    for(int i=0;i<n;i++){
        if(s[i]!=t[i]) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3808
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
ll ans;
void solve()
{
    ll n,m;cin>>n; 
    ans+=(n/500)*1000;
    ans+=((n%500)/5)*5;
    cout<<ans<<endl;
}
int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
N,M,K = list(map(int,input().split()))
mod = 998244353

pattern = [1]*(N+1)
pattern[1] = M
for i in range(2,N+1):
    pattern[i] = pattern[i-1]*(M-1)
    pattern[i] %= mod
factorial = [1]*(N+1)
for i in range(1,N+1):
    factorial[i] = factorial[i-1]*i
    factorial[i] %= mod

ans = pattern[N]
for k in range(1,K+1):
    bunbo = factorial[N-1-k]*factorial[k]
    bunbo %= mod
    bunshi = pattern[N-k]*factorial[N-1]
    bunshi %= mod
    ans += (bunshi*pow(bunbo,mod-2,mod))%mod
    ans %= mod
print(ans)


Measured memory_bytes: 74048
# coding: utf-8
import sys
from itertools import accumulate

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W, K = lr()
S = [list(map(int, sr())) for _ in range(H)]
Scum = [list(accumulate(row)) for row in S]
# H方向はbit全探索、W方向はGreedyに
INF = 10 ** 10
answer = INF
for pattern in range(1<<(H-1)):
    slice = set()
    cnt = 0
    for i in range(H-1):
        if pattern>>i & 1:
            slice.add(i)
            cnt += 1
    slice.add(H-1)  # 最後の区切り
    w = 0
    prev = -1
    while w < W:
        cut = False
        white = 0
        for i in range(H):
            white += Scum[i][w] - (Scum[i][prev] if prev >= 0 else 0)
            if i in slice:
                if white > K:
                    cut = True
                    break
                white = 0
        if cut:
            if prev == w - 1:  # 1列でKをオーバーしたので無理
                break
            cnt += 1
            prev = w-1
        else:
            w += 1
    else:
        answer = min(answer, cnt)

print(answer)
# 43

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

// @author: pashka

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

    int x;
    cin >> x;
    int k = 1;
    while (x * k % 360 != 0) k++;
    cout << k << "\n";

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define INF 100000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = inx(x, y)
#define print(x) cout << x << "\n"
#define printv(vec) rep(i, vec.size()) cout << vec[i] << " "; print("");
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;

/*
ダブリング
10**100のビットがたっているか否かってC++でわかる?
*/

void solve(){
	
	string S;
	cin >> S;
	ll length = S.size();
	vvl v(60, vl(length));
	vl ans(length);
	rep(i, length){
		if(S[i] == 'R') v[0][i] = i + 1;
		else v[0][i] = i - 1;
	}
	rep(i, 59) rep(j, length) v[i + 1][j] = v[i][v[i][j]];
	rep(i, length) ans[v[59][i]] += 1;
	printv(ans);
	
}	

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

Measured memory_bytes: 51488
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
 
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    char s[1000005]={};
    ll n[1000005];
    ll b[1000005]={};
    ll c[1000005]={};
    scanf("%s",s);
    ll len = strlen(s);
    ll sum=0;
    REP(i,len)n[i] = s[i]-'0';
    while(n[len-1]==0)len--;
    b[len-1]= n[len-1]<=5 ? n[len-1] : 11-n[len-1];
    c[len-1]= n[len-1]>=5 ? 10-n[len-1] : n[len-1]+1;
    for(ll i=len-2; i>=0;i--){
        ll p = n[i];
        b[i] = std::min( p+b[i+1] , (p+1)%10+(p+1)/10+c[i+1]);
        p=9-p;
        c[i] = std::min( p+c[i+1], (p+1)%10+(p+1)/10+b[i+1] );
    }
    cout << std::min(b[0], 1+c[0]) << endl;
}

Measured memory_bytes: 24704
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
const double phi = (1 + sqrt(5)) / 2;
const double phi_ = (1 - sqrt(5)) / 2;
ll fib(ll n){
    double res = pow(phi, n+1) - pow(phi_, n+1);
    return res / sqrt(5);
}
ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}
ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}
string to_bin_string(int n){
    stringstream ss;
    ss << bitset<3>(n); //任意の桁数<m>
    string s = ss.str();
    return s;
}
int main()
{
    string s; cin >> s;
    vector<int> d(4), op(4);
    rep(i, 4) d[i] = s[i] - '0';
    rep(i, 8) {
        int s = d[0];
        string t = to_bin_string(i);
        //cout << t << endl;
        rep(j, 3) {
            if(t[j] == '1')s += d[j + 1];
            else s -= d[j + 1];
            //cout << ((t[j] == '1')?'+':'-');
        }
        //cout << s << endl;
        if(s == 7) {
            rep(j, 4) {
                cout << d[j];
                if(j < 3)cout << ((t[j] == '1')?'+':'-');
            }
            cout << "=7" << endl;
            return 0;
        }
    }
    return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int x[3], y, i, k;
  for(i=0;i<3;i++){
    scanf("%d", &x[i]);
  }
  for(i=0;i<3;i++){
    for(k=i+1;k<3;k++){
      if(x[i]>x[k]){
        y=x[i];
        x[i]=x[k];
        x[k]=y;
      }
    }
  }
  printf("%d %d %d\n", x[0], x[1], x[2]);
  return 0;
}

Measured memory_bytes: 1852
#coding:utf-8

import itertools

def goukei(b , x):
    count = 0
    for i in range(len(b)):
        if sum(b[i]) == x:
            count += 1
    return count

n =1
x =1

while n+x != 0:
    n , x = [int(i) for i in input().rstrip().split(" ")]

    if n + x == 0:
        break
    
    a = [i for i in range(1,n+1)]
#?????????????????????????????????
    kumi = list(itertools.combinations(a ,3))
    
    print(goukei(kumi,x))

Measured memory_bytes: 33228
#![allow(unused_mut)]
#![allow(non_snake_case)]

#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        l: i64,
        r: i64,
    }
    if r - l >= 2019 {
        println!("{}", 0);
        return;
    }
    let mut ans = std::i64::MAX;
    for i in l..r {
        for j in i+1..r+1 {
            ans = min(ans, (i * j) % 2019);
        }
    }
    println!("{}", ans)
}

Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int N; 
	double x[1000],ans;
	string u[1000];
	ans = 0;
	cin >> N;

	for (int i = 0; i < N; i++){
		cin >> x[i] >> u[i];
	}

	for (int i = 0; i < N; i++){
		if (u[i] == "BTC"){
			ans += x[i] * 380000.0;
		}
		else ans += x[i];
	
	}

	cout << fixed << setprecision(5) <<  ans << endl;

	return 0;
}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<long long> a(N);
    long long sum = 0;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        sum += a[i];
    }

    long long ans = __LONG_LONG_MAX__;
    long long L = 0;
    for(int i = 0; i < N; i++){
        L += a[i];
        if(i < N-1){
            ans = min(ans, abs(sum-2*L));
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 1792
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


struct UnionFind {
    parent: Vec<usize>,
    rank: Vec<usize>,
    size: Vec<usize>,
}

impl UnionFind {
    fn new(n: usize) -> UnionFind {
        let mut p = vec![0; n];
        for i in 0..n {
            p[i] = i;
        }
        return UnionFind {
            parent: p,
            rank: vec![0; n],
            size: vec![1; n],
        };
    }

    fn find(&mut self, x: usize) -> usize {
        if x == self.parent[x] {
            x
        } else {
            let p = self.parent[x];
            let pr = self.find(p);
            self.parent[x] = pr;
            pr
        }
    }

    fn same(&mut self, a: usize, b: usize) -> bool {
        self.find(a) == self.find(b)
    }

    fn unite(&mut self, a: usize, b: usize) {
        let a_root = self.find(a);
        let b_root = self.find(b);
        if self.rank[a_root] > self.rank[b_root] {
            self.parent[b_root] = a_root;
            self.size[a_root] += self.size[b_root];
        } else {
            self.parent[a_root] = b_root;
            self.size[b_root] += self.size[a_root];
            if self.rank[a_root] == self.rank[b_root] {
                self.rank[b_root] += 1;
            }
        }
    }

    fn get_size(&mut self, x: usize) -> usize {
        let root = self.find(x);
        self.size[root]
    }
}

fn main() {
    input! {
        n: usize,
        k: usize,
    }
    let ans = n-k+1;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}

int p[310];
long long dp[310][110000];
long long dp2[310][110000];

long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	int S=0;
	for(int i=0;i<a;i++)S+=p[i];
	dp[0][0]=dp2[0][0]=1;
	for(int i=0;i<a;i++){
		for(int j=0;j<=i*300;j++){
			if(dp[i][j]==0)continue;
			dp[i+1][j]=(dp[i+1][j]+dp[i][j]*2)%mod;
			dp[i+1][j+p[i]]=(dp[i+1][j+p[i]]+dp[i][j])%mod;
			
		}
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<=i*300;j++){
			if(dp2[i][j]==0)continue;
			dp2[i+1][j]=(dp2[i+1][j]+dp2[i][j])%mod;
			dp2[i+1][j+p[i]]=(dp2[i+1][j+p[i]]+dp2[i][j])%mod;
			
		}
	}
	
	long long ret=pw(3,a);
	for(int i=0;i<=a*300;i++){
		if(i>=S-i){
		//	if(dp[a][i])printf("%d: %lld\n",i,dp[a][i]);
			ret=(ret+mod-dp[a][i]*3%mod)%mod;
		}
		if(i==S-i){
			ret=(ret+dp2[a][i]*3%mod)%mod;
		}
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 518272
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=100000000000000LL;

int main() {
	int n,k,x[101],r=0;
	cin>>n>>k;
	for(int i=0;i<n;++i){
		cin>>x[i];
		r+=min(x[i],abs(k-x[i]))*2;
	}
	cout<<r<<endl;

		return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;


int main(){
    
    int H,N;
    cin>>H>>N;
    vector<long long >dp(H+1,INF);
    dp[0]=0;

    rep(i,N){
        int effect,cost;
        cin>>effect>>cost;
        rep(k,H+1){
        int nk=min(H,k+effect);
        dp[nk]=min(dp[nk],dp[k]+cost);
        }
    }

    cout<<dp[H]<<endl;




    
    return 0;

}
/*
9 3
8 3
4 2
2 1


4

100 6
1 1
2 3
3 9
4 27
5 81
6 243

100

9999 10
540 7550
691 9680
700 9790
510 7150
415 5818
551 7712
587 8227
619 8671
588 8228
176 2461

139815
*/




Measured memory_bytes: 384
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


N = int(input())
L = [int(i) for i in input().split()]
L.sort()
SL = set(L)
ans = 0

if(len(SL)<3):
    print(0)
else:
    for i in range(N):
        for j in range(i, N):
            for k in range(j, N):
                if(L[i]!=L[j] and L[j]!=L[k]):
                    if(L[i]+L[j]>L[k]):
                        ans += 1

    print(ans)


Measured memory_bytes: 70544
def main():
    import sys
    input=sys.stdin.readline
    k=int(input())
    dp=[[0]*10 for _ in range(1000)]
    for i in range(10):
        dp[0][i]=1
    for i in range(999):
        dp[i+1][0]=dp[i][0]+dp[i][1]
        for j in range(1,9):
            dp[i+1][j]=dp[i][j-1]+dp[i][j]+dp[i][j+1]
        dp[i+1][9]=dp[i][8]+dp[i][9]
    flag=0
    for i in range(1000):
        for j in range(1,10):
            if k>dp[i][j]:
                k-=dp[i][j]
            else:
                flag=1
                break
        if flag==1:
            break
    ans=j*10**i
    while i>0:
        if j!=0:
            if k>dp[i-1][j-1]:
                k-=dp[i-1][j-1]
            else:
                i-=1
                ans+=(j-1)*10**i
                j-=1
                continue
        if k>dp[i-1][j]:
            k-=dp[i-1][j]
        else:
            i-=1
            ans+=j*10**i
            continue
        if j!=9:
            if k>dp[i-1][j+1]:
                k-=dp[i-1][j+1]
            else:
                i-=1
                ans+=(j+1)*10**i
                j+=1
                continue 
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 40688
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;
vi g[N];
int vis[N];
int dist[N];
int in_degree[N];
void dfs(int src){
	vis[src]=1;
	for(auto i: g[src]){
		dist[i]=max(dist[i],dist[src]+1);
		--in_degree[i];
		if(in_degree[i]==0){
			dfs(i);
		}
	}
}
void raushan_kumar(){
	int n,m;cin>>n>>m;
	fo0(i,m){
		int u,v;cin>>u>>v;
		g[u].push_back(v);
		++in_degree[v];
	}
	
	for(int i=1;i<=n;i++){
		if(!vis[i] and in_degree[i]==0){
			dfs(i);
		}
	}

	int ans=0;
	fo1(i,n){
		ans=max(ans,dist[i]);
	}

	cout<<ans<<endl;
	
}

int32_t main()
{
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

Measured memory_bytes: 22016
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var NK = ReadSplitInt();
            var N = NK[0];
            var K = NK[1];

            var h = new List<int>();
            for (int i = 0; i < N; i++)
                h.Add(ReadInt());

            h = h.OrderBy(x => x).ToList();

            var s = new int[N];
            for (int i = 0; i < N-1; i++)
                s[i + 1] = s[i] + (h[i + 1] - h[i]);

            var min = int.MaxValue;
            for (int i = 0; i <= N - K; i++)
                min = Min(s[i + K - 1] - s[i], min);

            Println(min);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 21084
<?php

fscanf(STDIN, "%s", $str);

$map = str_split($str);

$count = count($map);
$half = intdiv($count, 2);

$ans = 0;
for($i=0;$i<$half;$i++){
    $inv = $count - $i - 1;
    if($map[$i] != $map[$inv]){
        $ans++;
    }

}
echo $ans;


Measured memory_bytes: 4728
# N = int(input())
H, W = [int(i) for i in input().split()]
A = [[]]
for i in range(H):
    a = [0] + [int(i) for i in input().split()]
    A.append(a)

print_list = []
for y in range(1, H+1):
    if y % 2 == 1:
        for x in range(1, W+1):
            coin_num = A[y][x]
            if coin_num % 2 == 1:
                if x < W:
                    A[y][x+1] += 1
                    A[y][x] -= 1
                    print_list.append([y, x, y, x+1])
                elif y < H:
                    A[y+1][x] += 1
                    A[y][x] -= 1
                    print_list.append([y, x, y+1, x])
    else:
        for x in range(W, 0, -1):
            coin_num = A[y][x]
            if coin_num % 2 == 1:
                if x > 1:
                    A[y][x-1] += 1
                    A[y][x] -= 1
                    print_list.append([y, x, y, x-1])
                elif y < H:
                    A[y+1][x] += 1
                    A[y][x] -= 1
                    print_list.append([y, x, y+1, x])
print(len(print_list))
for p in print_list:
    print(*p)


Measured memory_bytes: 71260
var = input()
x = int(var.split()[0])
k = int(var.split()[1])
d = int(var.split()[2])
x = abs(x)
cnt = x // d
if (k <= cnt) :
  print(x - d * k)
else :
  kk = k - cnt
  if (kk % 2 == 0) :
    print(x - d * cnt)
  else :
    print(d - (x - d * cnt))

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

int main(){
    int N, K;
    cin >> N >> K;
    vector<ll> H(N);
    for(int i=0;i<N;i++) cin >> H[i];
    sort(H.begin(), H.end(), greater<ll>());
    ll ans = 0;
    for(int i=K;i<N;i++) ans += H[i];
    cout << ans << endl;
}

Measured memory_bytes: 1792
sub ceil {
	my $val = shift;	# 切り上げる数
	my $col = shift;	# 小数点以下のどこまで残すか
	my $r = 10 ** $col;
	if ($val > 0) {
		my $tmp = $val * $r;
		if ($tmp == int($tmp)) {
			return $tmp / $r;
		} else {
			return int($tmp + 1) / $r;
		}
	} else {
		return int($val * $r) / $r;
	}
}

my $s = <STDIN>;
my @s = split(/ /,$s);
my $ans = &ceil($s[0]/$s[1],0);
print "$ans";


Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void){
    
    double a;
    double b;
    double x;
    double ans=0;
    double pai=3.141592653589793238462643383279;
    
    scanf("%lf %lf %lf", &a, &b, &x);
    
    if(2*x>a*a*b){ // 1
        
        // printf("1\n"); // debug
        ans = (180/pai) * atan( ( 2/(a*a*a) ) * (a*a*b-x) );
        
    } else if(2*x==a*a*b){ // 2
        
        // printf("2\n"); // debug
        ans = 90 - (180/pai) * atan(a/b);
        
    } else { // 3
        
        // printf("3\n"); // debug
        ans = 90 - (180/pai) * atan(2*x/(a*b*b));
        
    }
    
    printf("%.16f", ans);
    
    return 0;
    
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(d>0){
	    if(a>=b)b*=2;
	    else if(b>=c)c*=2;
	    else {
	        break;
	    }
	    d--;
	}
	if(a<b and b<c){
	        cout<<"Yes"<<endl;
	        return 0;
	    }
	cout<<"No";
}


Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main{
	static int[][] weights;
	static long[][] memo;
	static int w , n;
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String inp[] = br.readLine().split(" ");
		 n = Integer.parseInt(inp[0]);
		 w = Integer.parseInt(inp[1]);
		weights = new int[n][2];
		memo = new long[n][w+1];
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<w;j++)
				memo[i][j]=-1;
		}
		for(int i=0;i<n;i++)
		{
			inp=br.readLine().split(" ");
			weights[i][0]=Integer.parseInt(inp[0]);
			weights[i][1]=Integer.parseInt(inp[1]);
		}
		System.out.println(dp(0,0));
		
	}
	
	public static long dp(int i , int weight)
	{
		if(i==n)return 0;
		
		if(memo[i][weight]!=-1)return memo[i][weight];
		long take=-1;
		if (weight+weights[i][0]<=w)
			take = dp(i+1,weight+weights[i][0])+weights[i][1];
		long leave = dp(i+1,weight);
		return memo[i][weight] = Math.max(take, leave);	
		
	}

}


Measured memory_bytes: 130216
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
void myrev(string &a){reverse(a.begin(),a.end()) ;}

int main(){
	string s ; cin >> s ;
	if(s.size()==3) myrev(s) ;
	cout << s << endl ;
}


Measured memory_bytes: 256
use proconio::input;
// ordtools {{{
#[allow(dead_code)]
mod ordtools {
    pub trait Ordtools: PartialOrd + Sized {
        fn change_min(&mut self, mut rhs: Self) {
            if self > &mut rhs {
                *self = rhs;
            }
        }

        fn change_max(&mut self, mut rhs: Self) {
            if self < &mut rhs {
                *self = rhs;
            }
        }
    }

    impl<T: PartialOrd + Sized> Ordtools for T {}
}
// }}}
use ordtools::Ordtools;
fn main() {
    input!(n: usize, a: [u64; n]);
    let mut map = std::collections::BTreeMap::new();
    for x in a {
        *map.entry(x).or_insert(0) += 1;
    }
    let seq = map.iter().filter(|&(_, &cnt)| 2 <= cnt).collect::<Vec<_>>();
    let mut ans = 0;
    if let Some((&x, _)) = seq.iter().rfind(|&(_, &cnt)| 4 <= cnt) {
        ans.change_max(x * x);
    }
    if 2 <= seq.len() {
        ans.change_max(seq[seq.len() - 2].0 * seq[seq.len() - 1].0);
    }
    println!("{}", ans);
}


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

using namespace std;

const int MAXN = 10100;
bool sieve[MAXN] = {true, true};

int main(){
  for (int i = 2; i * i < MAXN; i++){
    if (sieve[i]) continue;
    for (int j = i * i; j < MAXN; j += i) sieve[j] = true;
  }
  int N;
  while (cin >> N, N){
    while (sieve[N] or sieve[N - 2]) N--;
    cout << N - 2 << " " << N << endl;
  }
  return 0;
}

Measured memory_bytes: 1168
import math

inputs = input().split(" ")
health, moves_num = int(inputs[0]), int(inputs[1])

moves_inp = input().split(" ")
moves = [int(move) for move in moves_inp]

can_win = False

for move in moves:
    health -= move
    if health <= 0:
        can_win = True
        break
print("Yes" if can_win else "No")

Measured memory_bytes: 14012
K = int(input())
if K%2 == 0:
    print(-1)
elif K%5 == 0:
    print(-1)
else:
    res = 7
    for i in range(K):
        if res % K == 0:
            break
        res = (res * 10 + 7) % K
    print(i + 1)

Measured memory_bytes: 9156
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 3009
ll n,i,j,k,l,arr[sz],dp[sz][sz],dp1[sz][sz],a;
vector<ll>v;
int main()
{
    scanf("%lld",&n);
    for(i=1; i<=n; i++)
        scanf("%lld",&arr[i]);
    a=1000;
    for(i=1;i<=n;i++)
    {
        v.push_back(arr[i]);
        j=i+1;
        while(j<=n && arr[j]>=arr[j-1])
            j++;
        j--;
        if(arr[j]<=arr[i])
            v.pop_back();
        else{
            a+=(a/arr[i])*(arr[j]-arr[i]);
        }
        i=j;
    }
    printf("%lld\n",a);
    return 0;
}


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

#define all(x) x.begin(),x.end()
#define fi first
#define sd second
#define lson (nd<<1)
#define rson (nd+nd+1)
#define PB push_back
#define mid (l+r>>1)
#define MP make_pair
#define SZ(x) (int)x.size()

using namespace std;

typedef long long LL;

typedef vector<int> VI;

typedef pair<int,int> PII;

inline int read(){
    int res=0, f=1;char ch=getchar();
    while(ch<'0'|ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){res=res*10+ch-'0';ch=getchar();}
    return res*f;
}

const int MAXN = 200'005;

const int MOD = 1000000007;

void addmod(int& a, int b){a+=b;if(a>=MOD)a-=MOD;}
int mulmod(int a, int b){return 1ll*a*b%MOD;}

template<typename T>
void chmin(T a, T b){if(a>b)a=b;}

template<typename T>
void chmax(T a, T b){if(b>a)a=b;}


int main(){
    int n=read();
    LL ans=0;
    for(int i=1;i<=n;++i){
        if(i%3==0||i%5==0){
            continue;
        }
        else{
            ans+=i;
        }
    }

    cout<<ans;

    return 0;
}


Measured memory_bytes: 3620
n, a, b = map(int, input().split())
MOD = 1_000_000_007

def C(r):
    num = 1
    den = 1
    for i in range(r):
        num *= n - i
        num %= MOD
        den *= i + 1
        den %= MOD
    return ((num * pow(den, MOD - 2, MOD)) % MOD)


print((pow(2, n, MOD) - 1 - C(a) - C(b)) % MOD)


Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
  int n;
  string s;
  cin >> n >> s;
  for(auto a : s) {
    cout << (char)('A' + (((a - 'A') +n) % 26));
  }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){ 
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A'){
            s[i]='T';
        }else if(s[i]=='T'){
            s[i]='A';
        }else if(s[i]=='G'){
            s[i]='C';
        }else{
            s[i]='G';
        }
    }

    cout<<s<<endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}


int main(){

  int N;
  cin>>N;
  map<string,int> m;
  for(int i=0;i<N;i++){
    string s;
    int num;
    cin>>s>>num;
    m[s]+=num;
  }
  vector<pair< pair<int,string> , int> > vp;
  for(map<string,int>::iterator it=m.begin();it!=m.end();it++){
    string s=it->first;
    vp.push_back(make_pair(make_pair(s.size(),s),it->second));
  }
  sort(vp.begin(),vp.end());
  for(int i=0;i<(int)vp.size();i++){
    cout<<vp[i].first.second<<" "<<vp[i].second<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1240
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

// UnionFind  ex.)UnionFind uf(N);  という風に定義する
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}	//コンストラクタ(n:頂点数)
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N, M, K;
	cin >> N >> M >> K;
	UnionFind uf(N);
	vector<int> count(N,1);
	while (M--)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		uf.unite(a, b);
		count.at(a)++;
		count.at(b)++;
	}
	
	vector<int> ans(N);
	FOR(i,0,N){
		ans.at(i) = uf.size(i);
	}

	while(K--){
		int c, d;
		cin >> c >> d;
		--c;
		--d;
		if(uf.same(c,d)==true){
			ans.at(c)--;
			ans.at(d)--;
		}
	}

	FOR(i,0,N){
		cout << ans.at(i)-count.at(i) << " ";
		}
		cout << endl;

		return 0;
}



Measured memory_bytes: 4472
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
using namespace std;

long long int A[100008];

int main() {
	int N, T;
	cin >> N >> T;
	int a,b;
	b = 0;
	int Y = 0;
	for (int i =0 ; i < N; i++) {
		cin >> a;


		if (a-b <= T) {
			Y += a-b;
		}
		else {
			Y += T;
		}
		b = a;
	}
	cout << Y+T << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int x;
    cin >> x;
    int yen500 = x/500;
    int yen5 = (x - (500*yen500))/5;
    int ans = 1000*yen500+5*yen5;
    cout << ans << endl;
    return 0;  
}

Measured memory_bytes: 3640
n,m=list(map(int,input().split()))

section=[]

for i in range(m):
    aa,bb=list(map(int,input().split()))
    section.append([aa,bb])

section.sort(key=lambda x: x[1])

maxr=-10**6
cnt=0

for a,b in section:
    if maxr<=a:
        maxr=b
        cnt+=1

print(cnt)


Measured memory_bytes: 21788
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	double d;
	cin >> d;
	double ans = sqrt(2)*d;

	for(int b=1;b<10;b++){
		if((d*d-b*b)<0) continue;
		double a = sqrt(d*d-b*b);
		if(a<1) ans = max(ans,(double)b+1);
	}
	cout << shosu(10) << ans << endl;
}

Measured memory_bytes: 1280
line = list(input())
count = len(line)
start = 0
for i in range(count):
  if line[i] == "A":
    start = i
    break

stop = 0
for j in range(count -1,0,-1):
  if line[j] == "Z":
    stop = count -1 - j
    break
    
answer = count - start - stop
print(answer)

Measured memory_bytes: 4840
sen = ''
while True:
    try:
        sen += input().lower()
    except:
        break
res = [0 for i in range(26)]
for c in sen:
    if 'a' <= c <= 'z':
        res[ord(c)-ord('a')] += 1
alp = [chr(i) for i in range(ord('a'), ord('z')+1)]
for i in range(26):
    print(alp[i] + ' : ' + str(res[i]))

Measured memory_bytes: 7556