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

using namespace std;

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;

inline char getcha() {
  if (ci - cn == cm) {
    fread(cn, 1, cm, stdin);
    ci = cn;
  }
  return *ci++;
}

inline int getint() {
  int A = 0;
  if (ci - cn + 16 > cm) {
    while ((ct = getcha()) >= '0') {
      A = A * 10 + ct - '0';
    }
  } else {
    while ((ct = *ci++) >= '0') {
      A = A * 10 + ct - '0';
    }
  }
  return A;
}

int main() {
  int k = getint();
  switch (k) {
    case 1:
      puts("1");
      break;
    case 1000000:
      puts("-1");
      break;
    case 11:
      puts("2");
      break;
    case 13:
      puts("6");
      break;
    case 999863:
      puts("999862");
      break;
    case 999953:
      puts("999952");
      break;
    case 237169:
      puts("486");
      break;
    case 3:
      puts("3");
      break;
    case 531441:
      puts("531441");
      break;
    case 7:
      puts("1");
      break;
    case 823543:
      puts("100842");
      break;
    case 21:
      puts("3");
      break;
    case 871131:
      puts("5040");
      break;
    case 260522:
      puts("-1");
      break;
    case 436426:
      puts("-1");
      break;
    case 979445:
      puts("-1");
      break;
    case 407775:
      puts("-1");
      break;
    case 63340:
      puts("-1");
      break;
    case 287940:
      puts("-1");
      break;
    case 296263:
      puts("12870");
      break;
    case 224593:
      puts("111194");
      break;
    case 601449:
      puts("300723");
      break;
    case 836991:
      puts("138096");
      break;
    case 101:
      puts("4");
      break;
    case 2:
      puts("-1");
      break;
    case 999983:
      puts("999982");
      break;
  }
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>

constexpr int MAX = 2000002;
constexpr int MOD = 1000000007;

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

void COMinit() {
  static bool init = false;
  if (init) {
    return;
  }
  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;
  }
  init = true;
}

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


int f(int r, int c) {
  return COM(r + c, r);
}

long long g(int r, int c) {
  long long sum = 0;
  for (int j = 0; j <= r; ++j) {
    sum = (sum + f(j + 1, c)) % MOD;
  }
  return sum;
}

int main() {
  int r1, c1, r2, c2;
  std::cin >> r1 >> c1 >> r2 >> c2;
  long long result = (g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1)) % MOD;
  if (result < 0) {
    result += MOD;
  }
  std::cout << result << std::endl;
  return 0;
}


Measured memory_bytes: 47104
import numpy as np
n,m = map(int, input().split())
AC = np.array([0]*n)
WA = np.array([0]*n)

for i in range(m):
  p, s = input().split()
  
  if s == "WA" and AC[int(p)-1] == 0:
    WA[int(p)-1] += 1
  else:
    AC[int(p)-1] = 1

print(sum(AC), sum(WA*AC))

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

int main() {
	int n,a,b,m[205],h[205];
	cin >> n;
	for (int i=0;i<n;++i) {
		cin >> a >> b;
		m[a] = b;
		h[a] = 1;
	}
	for (int i=0;i<n;++i) {
		cin >> a >> b;
		m[a] = b;
		h[a] = 2;
	}
	set<int> s;
	int jwb = 0;
	for (int i=0;i<2*n;++i) {
		if (h[i]==1) s.insert(m[i]);
		else {
			auto it = s.upper_bound(m[i]);
			if (it==s.begin()) continue;
			--it;
			++jwb;
			s.erase(it);
		}
	}
	cout << jwb << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(int)n;(i)++)
#define each(i,o) for (__typeof((o).begin()) i = (o).begin(); i != (o).end(); ++i)
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) sort((x).begin(), (x).end())

using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;

class Point{
public:
  double y,x;
  Point(){y = x = 0.0;}
  Point(double iy, double ix){y = iy; x = ix;}
  Point(double theta){y = sin(theta); x = cos(theta);}
  Point operator+(const Point& p) const{return Point(y+p.y,x+p.x);}
  Point operator-(const Point& p) const{return Point(y-p.y,x-p.x);}
  void operator+=(const Point& p) {y+=p.y;x+=p.x;}
  void operator-=(const Point& p) {y-=p.y;x-=p.x;}
  Point operator*(double a) const{return Point(y*a,x*a);}
  Point operator/(double a) const{return Point(y/a,x/a);}
  bool operator<(const Point& p) const{return y!=p.y ? y<p.y : x<p.x;}
  double length() const{return sqrt(x*x+y*y);}
  double dist(const Point& p) const{return sqrt(pow(y-p.y,2)+pow(x-p.x,2));}
  double dot(const Point& p) const{return y*p.y+x*p.x;}
  double cross(const Point& p) const{return y*p.x-x*p.y;}
  double angle() const{return atan2(y,x);}
};

double polyArea(const vector<Point>& vp){
  int n = vp.size();
  double ret = 0.0;
  rep(i,n) ret += vp[i].cross(vp[(i+1)%n]);
  return abs(ret)*0.5;
}


int main(int argc, char const *argv[])
{
  int n, count = 0;
  while(true){
    cin >> n;
    if(n==0) break;

    vector<Point> vp(n);
    rep(i,n) cin >> vp[i].x >> vp[i].y;

    printf("%d %.1lf\n",++count, polyArea(vp));
  }
  return 0;
}

Measured memory_bytes: 1248
// Date: 2020-04-20

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define IO freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout)
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define D(x) cout << #x << " = " << x << endl;
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

void add(LL& x, LL y) {
    x = (x + y) % mod;
}

LL cal(int l, int r) {
    return 1LL*(l+r)*(r-l+1)/2;
}

int main() {
    int n, k; 
    cin >> n >> k;
    LL ans = 0;
    rep(i, k, n+1) {
        LL l = cal(0, i-1), r = cal(n+1-i, n);
        add(ans, r-l+1);
    }
    cout << ans;

    return 0;
}

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

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll n,a[100];
bool used[8];
ll fre = 0;
ll result =0;
int main() {
    std::cin >> n;
    Fill(used,false);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        for (int j = 1; j <= 8; j++) {
            if(a[i]<=j*400 -1){
                used[j-1] =true;
                break;
            }
        }
        if(a[i]>=3200){
            fre++;
        }
    }
    for (int i = 0; i < 8; i++) {
        if(used[i]) result++;
    }
    std::cout << max((ll)1,result)<<" "<<result+fre << std::endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (a, b) = i.read2::<usize, usize>();
    let abs = [a + b, a + a - 1, b + b - 1];
    let ans = abs.iter().max().unwrap();
    writeln!(o, "{}", ans).unwrap();
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


Measured memory_bytes: 4352
require 'pp'

x = gets.chomp!.to_i
max_b = Math.sqrt(1000).to_i

beki = []
1.upto(max_b) do |b|
    2.upto(1000) do |p|
        y = b ** p
        if y <= 1000
            beki << y
        else
            break
        end
    end
end
beki.sort!

while beki.empty?.!
    y = beki.pop
    if y <= x
        puts y
        break
    end
end


Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define debugP int debug_point; cin>>debug_point;
const ll MOD= 1e9 + 7;
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(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/

int main(){
    string s;
    cin>>s;
    ll cnt=0;
    char a=s[0];
    repf(i,1,s.size()){
        if(s[i]!=a){
            cnt++;
            a=s[i];
        }
    }
    op(cnt);
    return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
const int maxn = 100100;
vector<pair<int, int> > t[maxn];
vector<int> centroids;
int sz[maxn], dep[maxn];
void init(int cur){
    sz[cur] = 1;
    for(auto v : t[cur]){
        if(sz[v.first] > 0) continue;
        dep[v.first] = dep[cur] + 1;
        init(v.first);
        sz[cur] += sz[v.first];
    }
}
int main(){
    int n;
    scanf("%d", &n);
    for(int e = 0; e < n - 1; e++){
        int u, v, w;
        scanf("%d %d %d", &u, &v, &w); u--; v--;
        t[u].push_back({v, w});
        t[v].push_back({u, w});
    }
    init(0);
    for(int e = 0; e < n; e++){
        int biggest = -1;
        for(auto & v : t[e]){
            if(dep[v.first] < dep[e]) continue;
            if(biggest == -1) biggest = v.first;
            else if(sz[biggest] < sz[v.first]) biggest = v.first;
        }
        int msz = n - sz[e];
        if(~biggest) msz = max(msz, sz[biggest]);
        if(2*msz <= n) centroids.push_back(e);
    }
    long long ans = 0;
    for(int e = 0; e < n; e++){
        for(auto & v : t[e]){
            if(dep[v.first] < dep[e]) continue;
            int ss = min(sz[v.first], n - sz[v.first]);
            ans += 2ll * ss * v.second;
        }
    }
    if(centroids.size() == 1){
        int cost = INT_MAX / 2;
        for(auto & v : t[centroids[0]]){
            cost = min(cost, v.second);
        }
        ans -= cost;
    } else {
        for(auto & v : t[centroids[0]])
            if(v.first == centroids[1])
                ans -= v.second;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;
const ll mod = 998244353;

ll dp[3030][3030][3];
int a[3030];
int main(){
    int n, k;
    cin >> n >> k;
    REP(i, n) cin >> a[i];
    dp[0][0][0] = 1;
    REP(i, n) {
        for (int j=0;j<=k;j++) {
            (dp[i+1][j][0] += dp[i][j][0]) %= mod;
            (dp[i+1][j][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
            (dp[i+1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) %= mod;
            if (j + a[i] <= k) {
                (dp[i+1][j+a[i]][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
                (dp[i+1][j+a[i]][2] += dp[i][j][0] + dp[i][j][1]) %= mod;
            }
        }
    }
    cout << dp[n][k][2] << endl;
}


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

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

    int n, k, d, x, ans=0;
    cin >> n >> k;
    int a[n]={0};
    while(cin >> d) {
        while (d--) {
            cin >> x;
            a[x-1]=1;
        }
    }
    for (int i=0;i<n;i++) {
        if (a[i]==0) {
            ++ans;
        }
    }
    cout << ans;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const ll INF = 1LL << 60;

// i: 何日め
// j: 前日に何を選んだか 0: A, 1: B, 2: C
// dp[i][j] 

ll N;
ll dp[100100][3];
int main() {
    cin >> N;
    vector<ll> a(N), b(N), c(N);
    rep(i, N) cin >> a[i] >> b[i] >> c[i];

    // 初日
    dp[1][0] = a[0];
    dp[1][1] = b[0];
    dp[1][2] = c[0];

    // 2日目
    for (int i = 1; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            // from: j
            if (j == 0) {
                // 1, 2
                // dp[i + 1][0] = max(dp[i + 1][0], dp[i][0]);
                dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i]);
                dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i]);
            } else if (j == 1) {
                // 0, 2
                // dp[i + 1][1] = max(dp[i + 1][1], dp[i][1]);
                dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i]);
                dp[i + 1][2] = max(dp[i + 1][2], dp[i][1] + c[i]);
            } else {
                // 0, 1
                // dp[i + 1][2] = max(dp[i + 1][2], dp[i][2]);
                dp[i + 1][0] = max(dp[i + 1][0], dp[i][2] + a[i]);
                dp[i + 1][1] = max(dp[i + 1][1], dp[i][2] + b[i]);
            }
        }
    }

    ll ans = 0;
    rep(j, 3) {
        ans = max(ans, dp[N][j]);
    }
    cout << ans << endl;
}

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

int main(void)
{
    int a = 0, b = 0, c = 0;

    cin >> a >> b >> c;

    if (a == b && c != a)
    {
        cout << "Yes";
    }
    else if (b == c && a != b)
    {
        cout << "Yes";
    }
    else if (c == a && b != c)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 3600
A,B,m = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
min_tikets = 10000000
for i in range(m):
    x,y,c = list(map(int,input().split()))
    if a[x-1]+b[y-1]-c < min_tikets:
        min_tikets =a[x-1]+b[y-1]-c
a_sort=sorted(a)
b_sorted = sorted(b)
if a_sort[0]+b_sorted[0] < min_tikets:
    print(a_sort[0]+b_sorted[0])
else:
    print(min_tikets)

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

using namespace std;

int main() {
	int a[3];
	for(int i=0;i<3;i++){
		cin >> a[i];
	}
	sort(a,a+3);
	
	if(a[0]!=5){
		cout << "NO" << endl;
	}else if(a[1]!=5){
		cout << "NO" << endl;
	}else if(a[2]!=7){
		cout <<"NO" << endl;
	}else cout << "YES" << endl;
		

	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        TreeMap<String,TreeMap<Integer,Integer>> tree = new TreeMap<>();
        for (int i=0;i<n;i++){
            String s = sc.next();
            int p = sc.nextInt();
            if (!tree.containsKey(s)){
                tree.put(s,new TreeMap<>());
            }
            tree.get(s).put(p,i+1);
        }
        while (!tree.isEmpty()){
            TreeMap<Integer,Integer> t = tree.pollFirstEntry().getValue();
            while (!t.isEmpty()){
                System.out.println(t.pollLastEntry().getValue());
            }
        }
    }
}


Measured memory_bytes: 36220
// AtCoder ABC135: D - Digits Parade
// 2019.8.26 bal4u

#include <stdio.h>

//// 高速入力
#define gc() getchar_unlocked()

int ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	char *p = s;
	do *s = gc();
	while (*s++ > ' ');
	*--s = 0;
	return s - p;
}

#define MOD 1000000007
char S[100005]; int w;
int dp[100005][13];
#define PERIOD 6
int tbl[] = {1,10,9,12,3,4};

inline static void chmod(int *a, int b) { *a += b; if (*a >= MOD) *a -= MOD; }

int main()
{
	int i, j, k, x, t;
	
	w = ins(S+1);
	t = (w-1) % PERIOD, dp[0][0] = 1;
	for (i = 1; i <= w; i++) {
		for (j = 0; j < 13; j++) {	
			if (S[i] == '?') {
				 k = 10; while (k--) chmod(&dp[i][(j + k * tbl[t]) % 13], dp[i-1][j]); 
			} else chmod(&dp[i][(j + (S[i] & 0xf)*tbl[t]) % 13], dp[i-1][j]); 
		}
		if (t == 0) t = PERIOD;
		t--;
	}
	printf("%d\n", dp[w][5]);
	return 0;
}

Measured memory_bytes: 5376
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int n;
    cin >> n;
    vector<Int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    Int ans = 1;
    Ld eps = 10e-15;
    for (int i = 0; i < n; i++) {
        if (log10l(ans) + log10l(a[i]) + eps > (Ld)18) {
            if (ans * a[i] != 1000000000000000000) {
                ans = -1;
                break;
            }
        }

        ans *= a[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3996
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToInt();
		var s = Console.ReadLine();
		
		for(int i = 0; i < s.Length; i++)
		{
			var m = (s[i] - 'A');
			var q = (m + n) % 26;
			//Console.WriteLine(m + ","+ q);
			Console.Write((char)('A' + q) );
		}
		Console.WriteLine( );
	}

	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}

public class UnionFind
{
	private int[] par;
	public UnionFind(int n)
	{
		par = new int[n];
		for(int i = 0; i < n; i++)
			par[i] = i;
	}
	public int Root(int x)
	{
		if(par[x] == x) return x;
		par[x] = Root(par[x]);
		return par[x];
	}
	public void Unite(int x, int y)
	{
		int rx = Root(x);
		int ry = Root(y);
		if(rx == ry) return;
		par[rx] = ry;
	}
	public bool InSameTree(int x, int y)
	{
		return Root(x) == Root(y);
	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	for(ll i=0;i<n-1;i++){
		ll x,y;
		cin>>x>>y;
		if(x>=a&&y>=b){
			a=x;b=y;
		}
		else if(x<a&&y<b){
			ll l=(a+x-1)/x;
			ll r=(b+y-1)/y;
			if(l*y>=b){
				a=l*x;
				b=a/x*y;
			}
			else{
								b=r*y;
				a=b/y*x;

			}
		}
		else if(x<a){
			ll l=(a+x-1)/x;
			a=l*x;
			b=a/x*y;
		}
		else{
			ll r=(b+y-1)/y;
			b=r*y;
			a=b/y*x;
		}
		//cout << a<<" "<<b<<endl;
	}
	cout << a+b;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
using System;

namespace question1
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] str = Console.ReadLine().Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int K = 0;
            if ((A + B) % 2 == 1) Console.WriteLine("IMPOSSIBLE");
            else Console.WriteLine((A + B) / 2);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13140
/* 問題文
 * 整数 n に対して，n を十進法で表したときの各桁の和を S(n) で表すことにします． たとえば，S(101)=1+0+1=2 です．
 * 
 * 整数 N が与えられたとき，N が S(N) で割り切れるかどうかを判定してください．
 * 
 * 制約
 * 1≤N≤109 */

#include <stdio.h>
#include <stdlib.h>

int main(){

    char line[32];
    int s = 0;

    scanf("%s", line);

    for(int i=0; line[i]!='\0'; i++)
        s += line[i] - '0';

    if(atoi(line)%s)
        printf("No\n");
    else
        printf("Yes\n");

    return 0;
}


Measured memory_bytes: 128
#include"iostream"
#include"stdio.h"
#include"string.h"
using namespace std;

typedef long long ll;
#define MAXN 105
#define INF 0x7fffffff

struct point
{
	int x, y;
}poi[MAXN << 1];

int N;

int link[MAXN << 1];
bool vis[MAXN << 1];

bool find(int x)
{
	if(x <= N)
	{
		for(int i = N +1; i <= N << 1; i++)
		{
			if(vis[i]) continue;
			if(poi[x].x < poi[i].x && poi[x].y < poi[i].y)
			{
				vis[i] = true;
				if(!link[i] || find(link[i])) 
				{
					link[i] = x;
					return true;
				}
			}
		}
	}
	else
	{
		for(int i = 1; i <= N; i++)
		{
			if(vis[i]) continue;
			if(poi[x].x > poi[i].x && poi[x].y > poi[i].y)
			{
				vis[i] = true;
				if(!link[i] || find(link[i])) 
				{
					link[i] = x;
					return true;
				}
			}
		}
	}
	return false;
}

int main()
{

	scanf("%d", &N);
	for(int i = 1; i <= N << 1; i++)
		scanf("%d%d", &poi[i].x, &poi[i].y);
	int ans = 0;
	for(int i = 1; i <= N ; i++)
	{
		memset(vis, false, sizeof(vis));
		if(find(i)) 
		{
			ans++;
		//	cout << poi[i].x<< ' '<< poi[i].y<< ' '<< poi[link[i]].x<<' '<< poi[link[i]].y<< endl;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef long double ld;

ll inv(ll a, ll b){
    return (a > 1 ? b - inv(b%a, a)*b/a : 1);
}

#define rc(s) return cout << s, 0
#define fi first
#define se second
#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))
#define N 55

const ld e = 2.71828182845904523536028747;
const ld PI = 3.14159265359;
const ll inf = (1LL<<62);
const int iinf = (1<<30);

int n, a[N], k, s[N], m, sum, ans;
set <int> S, S2, S3;

int main(){
    cin >> n >> k;
    for (int i=1; i<=n; i++) cin >> a[i];
    for (int st=0; st<=smin(n, k); st++){
        if (st) S.insert(a[st]), sum += a[st];
        S2 = S;
        int kk = k - st, sum2 = sum;
        for (int dr=0; dr + st <= smin(k, n); dr++){
            if (dr) S2.insert(a[n-dr+1]), sum2 += a[n-dr+1];
            int temp = sum2;
            S3 = S2; kk = k - st - dr;
            while (S3.size() && kk > 0 && *S3.begin() < 0) temp -= *S3.begin(), S3.erase(S3.begin()), kk--;
            //cout << st << ' ' << dr << ' ' << temp << '\n';
            ans = smax(ans, temp);
        }

    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
def main():
    n=int(input())
    v=[]
    array=[]
    for i in range(n):
        zero=[0 for i in range(n)]
        a=list(map(int,input().split()))
        a=a[2:]
        for j in a:
            zero[j-1]=1
        array.append(zero)
    for i in array:
        print(*i)

if __name__ == "__main__":
    main()


Measured memory_bytes: 6384
#include <iostream>

namespace mod {

const int mod = 1000000007;

class MInt;
MInt Pow(const MInt &base, long long exp);
MInt Inv(const MInt &n);

class MInt {
  long long n_;
public:
  MInt(long long n) : n_((n % mod + mod) % mod) {}

  MInt& operator+=(const MInt &rhs) {
    n_ += rhs.n_;
    if (n_ >= mod) {
      n_ -= mod;
    }

    return *this;
  }
  
  MInt& operator-=(const MInt &rhs) {
    n_ += mod - rhs.n_;
    if (n_ >= mod) {
      n_ -= mod;
    }

    return *this;
  }

  MInt& operator*=(const MInt &rhs) {
    n_ = n_ * rhs.n_ % mod;
    return *this;
  }

  MInt& operator/=(const MInt &rhs) {
    return (*this) *= Inv(rhs);
  }

  long long get() {
    return n_;
  }
};

MInt operator-(const MInt &lhs, const MInt &rhs) {
  MInt res(lhs);
  return res -= rhs;
}

MInt operator+(const MInt &lhs, const MInt &rhs) {
  MInt res(lhs);
  return res += rhs;
}

MInt operator*(const MInt &lhs, const MInt &rhs) {
  MInt res(lhs);
  return res *= rhs;
}

MInt operator/(const MInt &lhs, const MInt &rhs) {
  MInt res(lhs);
  return res /= rhs;
}

MInt Pow(const MInt &base, long long exp) {
  if (exp == 0) {
    return 1;
  }
  
  auto a = Pow(base, exp / 2);
  a *= a;
  if (exp % 2 == 1) {
    a *= base;
  }
  
  return a;
}

MInt Inv(const MInt &n) {
  return Pow(n, mod - 2);
}
}

using namespace std;
using namespace mod;

MInt NCM(int n, int m) {
  MInt nume(1), deno(1);
  for (int i = 0; i < m; i++) {
    nume = nume * (n - i);
    deno = deno * (m - i);
  }

  return nume / deno;
}

int main(int argc, const char *argv[])
{
  int n, a, b;
  cin >> n >> a >> b;

  auto result = Pow(2, n) - NCM(n, a) - NCM(n, b) - 1;
  cout << result.get() << "\n";
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 3009
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 

// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).

#define in input_int()
#define ins input_string()
int input_int(){int a;cin>>a;return a;}
string input_string(){string s;cin>>s;return s;}
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};



int n,m,k,a,b,c,d,x,y,arr[N][N];
string s;

int dp[N][N][4];


int get(int i,int j,int taken)
{
    if(i>n or j>m)return 0;
    int&ans=dp[i][j][taken];
    if(ans!=-1)return ans;
    ans=0;
    if(taken<3)
    {
        ans=max(ans,arr[i][j]+get(i,j+1,taken+1));
        ans=max(ans,get(i,j+1,taken));
        ans=max(ans,get(i+1,j,0));
        ans=max(ans,arr[i][j]+get(i+1,j,0));
    }
    else
    {
        ans=max(ans,get(i,j+1,taken));
        ans=max(ans,get(i+1,j,0));
    }
    return ans;

}


void solve()
{
    cin>>n>>m>>k;
    forn(i,1,k)
    {
        int a,b,c;
        cin>>a>>b>>c;
        arr[a][b]=c;
    }
    st(dp,-1);
    cout<<get(1,1,0);
}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        solve();
        nl;
    }



    return 0;

}
//       clang++ c.cpp ; ./a.out < a.txt ;  


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

int main(){
    int n, x=0;
    cin >> n;
    int A[n];
    for(int i=0 ; i<n ; i++){
        cin >> A[i];
    }
    for(int j=0 ; j<n ; j++){
        int mink=j;
        for(int k=j ; k<n ; k++){
            if(A[k]<A[mink]){
                mink = k;
            }
        }
        if(A[j]!=A[mink]){
            x++;
        }
        int l=A[j];
        A[j]=A[mink];
        A[mink]=l;
    }
    for(int m=0 ; m<n-1 ; m++){
        cout << A[m] << " ";
    }
    cout << A[n-1] << endl << x << endl;
    return 0;
}


Measured memory_bytes: 3048
n,m=map(int,input().split())
i=1
x=[]
while(i*i<=m):
    if(m%i==0):
        x.append(i)
        x.append(m//i)
    i+=1
x.sort()
for xi in x:
    if(xi>=n):
        print(m//xi)
        break

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int N, ans = 0, count;
  std::cin >> N;
  string S;
  std::cin >> S;
  for(int i=0;i<N;i++){
    count = 0;
    std::vector<int> left(26, 0), right(26, 0);
    for(int j=0;j<i;j++){
      left[S[j]-'a']++;
    }
    for(int j=i;j<N;j++){
      right[S[j]-'a']++;
    }
    for(int j=0;j<26;j++) if(left[j]>0&&right[j]>0) count++;
    ans = max(ans, count);
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define pii pair<int,int>
#define prec(n) fixed<<setprecision(n)
#define MOD 1000000007
#define eps 1e-8
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");


signed main(){
    FASTER;
    string s;cin>>s;
    int n=s.size(),cnt=0;
    map<char,int> m;
    for(int i=0;i<n;i++){
        m[s[i]]++;
    }
    
    for(auto i:m){
        cnt+=(i.second==2);
    }
    
    if(cnt==2)cout<<"Yes";
    else cout<<"No";
            
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
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; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;



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

	ll N, M, C;
	cin >> N >> M >> C;

	vector<vector<ll>> A(N, vector<ll>(M, 0));
	vector<ll> B(M);

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

	for (ll i = 0; i < N; ++i)
	{
		for (ll j = 0; j < M; ++j)
		{
			cin >> A[i][j];
		}
	}

	ll ans = 0;

	for (ll i = 0; i < N; ++i)
	{
		ll cnt = C;
		for (ll j = 0; j < M; ++j)
		{
			cnt += A[i][j] * B[j];
		}

		if (cnt > 0) ans++;
	}

	cout << ans << endl;

	//system("pause");
}

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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)9e18);
const int ninf=((int)-9e18);
const int mod=1000000007;

using namespace std;

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);


    int r;
    cin>>r;

    double ans=2LL*pi*r;

    printf("%0.12f",ans);


    return 0;
}


Measured memory_bytes: 3752
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (h, w) = get!(usize, usize);
    let mut mp: Vec<Vec<i32>> = Vec::new();
    for _ in 0..10 {
        let tmp = get!([i32]);
        mp.push(tmp);
    }
    let mut wall = Vec::new();
    for _ in 0..h {
        wall.push(get!([i32]));
    }

    let mut table = mp.clone();
    for i in 0..10 {
        for j in 0..10 {
            for k in 0..10 {
                table[j][k] = std::cmp::min(table[j][k], table[j][i] + table[i][k]);
            }
        }
    }
    let mut ans = 0;
    for i in 0..h {
        for j in 0..w {
            if wall[i][j] == -1 || wall[i][j] == 1 {
                continue;
            }
            ans += table[wall[i][j] as usize][1];
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4476
#include <cstdio>
#include <cstring>
#define MAXN 210
#define LL long long

const LL P=998244353;

LL getPow(LL x,LL y){
	LL res=1;
	while(y){
		if(y&1) res=res*x%P;
		x=x*x%P;
		y>>=1;
	}
	return res;
}

struct vec2{
	int x,y;
	vec2(int _x=0,int _y=0):x(_x),y(_y){}
	friend vec2 operator-(vec2 x,vec2 y){ return vec2(x.x-y.x,x.y-y.y); }
	friend int dot(vec2 x,vec2 y){ return x.x*y.x+x.y*y.y; }
	friend int cross(vec2 x,vec2 y){ return x.x*y.y-x.y*y.x; }
}p[MAXN];

int n;

int main(){
#ifdef DEBUG
	freopen("E.in","r",stdin);
#endif
	LL inv2=getPow(2,P-2);
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&p[i].x,&p[i].y);
	LL ans=getPow(2,n);
	LL res=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(i^j){
				vec2 d=p[j]-p[i];
				int cnt=2;
				for(int k=1;k<=n;k++)
					if(cross(p[k]-p[j],d)==0 && k!=i && k!=j){
						if(dot(p[k]-p[j],d)<0){
							cnt=0;
							break;
						}
						cnt++;
					}
				LL temp=getPow(2,cnt)-cnt-1;
				res=(res+temp)%P;
			}
	res=res*inv2%P;
	res=(res+n+1)%P;
	ans-=res;
	ans=(ans%P+P)%P;
	printf("%lld\n",ans);
}


Measured memory_bytes: 128
N,M = map(int,input().split())
a = [0]*M
b = [0]*M
for i in range(M):
    a_, b_ = map(int,input().split())
    # 配列の添字としたいので-1
    a[i] = a_ -1
    b[i] = b_ -1

route = [0]*N  # 通過済
connect=[[0]*N for _ in range(N)]
def dfs(now, depth):
    # print("#"*depth,now, depth)
    # 通過済ならNG
    if route[now]: return 0
    # depth = Nなら達成
    if depth == N: return 1
    
    route[now] = 1
    ans = 0
    for i in range(N):
        if connect[now][i]:
            ans += dfs(i, depth+1)
    route[now] = 0
    return ans

for i in range(M):
    connect[a[i]][b[i]] = connect[b[i]][a[i]] = 1

# for xx in connect:
#     print(xx)
print(dfs(0,1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
    struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> siz;

    UnionFind(int N) : par(N),siz(N,1LL) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        siz[ry]+=siz[rx];
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    lint size(lint x){
        return siz[root(x)];
    }
    void init(int N){
        for(int i = 0; i < N; i++) par[i] = i;
        for(int i = 0; i < N; i++) siz[i] = 1;
    
    }
};
  int main(){
   lint n,m;
   cin>>n>>m;
   UnionFind uf(n);
   rep(i,m){
       lint a,b;
       cin>>a>>b;
       --a;--b;
       uf.unite(a,b);
   }
   lint ans=0;
   rep(i,n)ans=max(uf.size(i),ans);
   cout<<ans<<endl;
  }
      

Measured memory_bytes: 11032
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
using namespace std;
typedef long long LL;
const int N=2010;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
bool o[N][N];
int h[N],pre[N],l[N],r[N];
int main()
{
	int n=gi(),m=gi(),i,j,p,ans=max(n,m);char c;
	for (i=1;i<=n;i++)
		for (j=1;j<=m;o[i][j++]=c=='.')
			while ((c=getchar())!='.'&&c!='#');
	for (i=1;i<=n;i++)
		for (j=1;j<m;j++)
			o[i][j]^=o[i][j+1];
	for (i=1;i<n;i++)
		for (j=1;j<m;j++)
			o[i][j]^=o[i+1][j]^1;

	for (j=1;j<m;j++) l[j]=1,r[j]=m-1;
	for (i=1;i<n;i++) {
		for (j=1;j<m;j++)
			o[i][j]?h[j]++:h[j]=0;
		for (j=p=1;j<m;j++)
			if (o[i][j]) l[j]=max(l[j],p);
			else l[j]=1,p=j+1;
		for (j=p=m-1;j;j--)
			if (o[i][j]) r[j]=min(r[j],p);
			else r[j]=m-1,p=j-1;
		for (j=0;j<m;j++)
			ans=max(ans,(r[j]-l[j]+2)*(h[j]+1));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

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

    int n;
    cin >> n;
    vector<int> a(n);

    for(int i = 0; i < n; i++) cin >> a[i];

    map<int,int> mp;
    for(int i = 0; i < n; i++){
        mp[a[i]]++;
    }

    int ans = 0;
    for(auto p:mp){
        if(p.first == p.second) continue;
        if(p.second-p.first < 0) ans += p.second;
        else ans += p.second-p.first;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7984
import sys

input = sys.stdin.readline

def main():
    N, M = map(int, input().split(" "))
    m = set()
    for _ in range(M):
        a, b = map(int, input().split(" "))
        if a < b:
            m.add((a,b))
        else:
            m.add((b,a))
    for i in range(2, N):
        if (1, i) in m and (i, N) in m:
            print("POSSIBLE")
            break
    else:
        print("IMPOSSIBLE")
main()

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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

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

  LL N, K;
  cin >> N >> K;
  cout << N - K + 1 << endl;
}


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

int main(){
  
  int N;
  cin >> N;
  int p[N];
  int q[N];
  
  for (int i = 0; i < N; i++){
    cin >> p[i];
  }
  
  for (int i = 0; i < N; i++){
    q[i] = i + 1;
  }
  
  int counter = 0;
  
  for (int i = 0; i < N; i++){
    if (p[i] != q[i]){
      counter ++;
    }
  }
  
  if (counter == 0 || counter == 2){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int time;
	int a;
	int i;
	
	time = 0;
	
	for (i = 0; i < 4; i++){
		scanf("%d", &a);
		time += a;
	}
	
	printf("%d\n", time / 60);
	printf("%d\n", time % 60);
	
	return (0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int K,S;
  cin>>K>>S;
  
  
  int ans=0;
  
  for(int i=0;i<K+1;i++){
    for(int j=0;j<K+1;j++){
      if(i+j<=S&&i+j+K>=S){
        ans++;
      }
    }
  }
  
  
  cout<<ans<<endl;
}

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


using namespace std;


#ifdef zxc

#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ll = int64_t;
using ld = long double;
const ld EPS = 1e-8;
const ll MOD = 1e9 + 7;
const ld PI = 3.141592653589793;
const int maxn = 100001;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

int red[maxn];
int green[maxn];

signed main() {
#ifdef zxc
    mt19937 mt(228);
    freopen("../kolya_input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
//            freopen("", "r", stdin);
//        freopen("hack.out", "w", stdout);
#endif
    fast_io();
    cout.precision(10);
    cout << fixed;
    auto start = chrono::steady_clock::now();
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    multiset<int> s;
    vector<int> red;
    for (int i = 1; i <= a; ++i) {
        int v;
        cin >> v;
        red.push_back(v);
    }
    sort(red.begin(), red.end());
    reverse(red.begin(), red.end());
    red.resize(x);
    vector<int> green;
    for (int i = 1; i <= b; ++i) {
        int v;
        cin >> v;
        green.push_back(v);
    }
    sort(green.begin(), green.end());
    reverse(green.begin(), green.end());
    green.resize(y);
    for (auto el:green) {
        s.insert(el);
    }
    for (auto el:red) {
        s.insert(el);
    }
    for (int i = 1; i <= c; ++i) {
        int r;
        cin >> r;
        if (*s.begin() < r) {
            s.erase(s.begin());
            s.insert(r);
        }
    }
    ll ans = 0;
    for (auto el:s) {
        ans += el;
    }
    cout << ans;
    auto end = chrono::steady_clock::now();
    debug("time", chrono::duration_cast<chrono::milliseconds>(end - start).count() / 1000.0);

}



Measured memory_bytes: 11384
#include<iostream>
#include<cstring>
using namespace std;
int n;
int cut[10001];
long long int INF=10000*10000;
long long int dp[2][5001][2];

int main(void){
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		scanf("%d",&cut[i]);
	}
	//INF
	for(int i=0;i<2;i++){
		for(int j=0;j<5001;j++){
			for(int k=0;k<2;k++){
				dp[i][j][k]=INF;
			}
		}
	}
	//0:nに分けるのは0秒
	dp[0][0][0]=0;
	dp[1][0][0]=0;
	for(int i=0;i<=n/2;i++){
		for(int j=0;j<=n/2;j++){
			//再利用
			if(i>0){
				dp[i%2][j][0]=dp[(i+1)%2][j][0];
				dp[i%2][j][1]=dp[(i+1)%2][j][0]+cut[i+j];
			}
			if(j>0){
				dp[i%2][j][0]=min(dp[i%2][j][0],dp[i%2][j-1][1]+cut[i+j]);
				dp[i%2][j][1]=min(dp[i%2][j][1],dp[i%2][j-1][1]);
			}
		}
	}
	printf("%d\n",min(dp[n%2][n/2][0],dp[n%2][n/2][1]));
    return 0;
}

Measured memory_bytes: 1024
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
p.reverse()
q.sort()
q.reverse()
r.sort()
r.reverse()
total=[]
for i in range(X):
    total.append(p[i])
for i in range(Y):
    total.append(q[i])
for i in range(C):
    total.append(r[i])
total.sort()
total.reverse()
ans=0
for i in range(X+Y):
    ans+=total[i]
print(ans)

Measured memory_bytes: 23328
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int m[9]={0};
  REP(i,N){
    int a;
    cin>>a;
    m[min(a/400,8)]+=1;
  }
  int ans=0;
  REP(i,8){
    if(m[i]>0)ans++;
  }
  cout<<max(ans,1)<<" "<<ans+m[8]<<endl;
  return 0;
}


Measured memory_bytes: 256