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

int n;
int x[24],y[24],r[24],c[24];
bool memo[1<<24];
char bit_count[1<<24];

bool ok(int a,int bit){
    for(int i=0;i<a;i++){
        if(((bit>>i)&1)==0)continue;
        int dist=(x[i]-x[a])*(x[i]-x[a])+(y[i]-y[a])*(y[i]-y[a]);
        int sum=(r[i]+r[a])*(r[i]+r[a]);
        if(dist<sum)return false;
    }
    return true;
}

int dfs(int bit){
    memo[bit]=true;

    int ret=n-bit_count[bit];

    for(int i=0;i<n;i++){
        if(((bit>>i)&1)==0||ok(i,bit)==false)continue;
        for(int j=i+1;j<n;j++){
            if(ok(j,bit)==false||((bit>>j)&1)==0||c[i]!=c[j])continue;
            int to_bit=(bit^(1<<i))^(1<<j);
            if(!memo[to_bit])ret=max(ret,dfs(to_bit));

        }
    }

    return ret;
}

void solve(){
    fill_n(memo,1<<n,false);

    cout<<dfs((1<<n)-1)<<endl;
}

bool input(){
    cin>>n;
    if(!n)return false;
    for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>r[i]>>c[i];
    return true;
}

void init(){
    for(int i=0;i<(1<<24);i++){
        for(int j=0;j<24;j++)if((i>>j)&1){
            bit_count[i]++;
        }
    }
}

int main(){
    init();
    while(input())solve();
    return 0;
}

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

int main(){
    int K,A,B;

    cin >> K >> A >>B;
    for(int i = A;i <=B;i++){
        if(i % K == 0){
            cout << "OK" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 3636
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }

    #[allow(dead_code)]
    pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
    where
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }

    #[allow(dead_code)]
    pub fn get3<S: FromStr, T: FromStr, U: FromStr>() -> (S, T, U)
    where
        <S as FromStr>::Err: Debug,
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }
}


#[allow(unused_macros)]
macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn main() {
    let (a, b, c): (i64, i64, i64) = util::get3();

    if a == b {
        println!("{}", c);
    } else if b == c {
        println!("{}", a);
    } else if a == c {
        println!("{}", b);
    }
}


Measured memory_bytes: 4352
//https://atcoder.jp/contests/diverta2019/tasks/diverta2019_a
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N, K;
    cin >> N >> K;
    cout << N - K + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    ll n;
    cin >> n;
    int a[105];
    fill(a, a + 105, 0);
    int minnum = 200;
    int maxnum = 0;
    for (int i = 0; i < n; i++) {
        int b;
        cin >> b;
        a[b]++;
        minnum = min(minnum, b);
        maxnum = max(maxnum, b);
    }
    bool ok = true;
    if (a[minnum] != 1 && a[minnum] != 2) {
        ok = false;
    }
    if (a[minnum] == 1) {
        if (maxnum != 2 * minnum) {
            ok = false;
        } else {
            for (int i = minnum + 1; i <= maxnum; i++) {
                if (a[i] < 2) {
                    ok = false;
                }
            }
        }
    } else if (a[minnum] == 2) {
        if (maxnum != 2 * minnum - 1) {
            ok = false;
        } else {
            for (int i = minnum + 1; i <= maxnum; i++) {
                if (a[i] < 2) {
                    ok = false;
                }
            }
        }
    }
    if (ok) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
}


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

//margesortは安定だが，quicksortはそうとは限らない
//quicksort
int Partition(vector<pair<string,int>> &A, int l, int r) {
    int i = l - 1; //境界のindex
    rep2(j,l,r) {
        if (A[j].second <= A[r].second) {
            i++;
            swap(A[i], A[j]);
        }
    }
    i++;
    swap(A[i], A[r]);
    return i;
}

void quickSort(vector<pair<string,int>> &A, int l, int r) {
    //l == r のとき再帰ストップ
    if (l < r) { 
        int x = Partition(A, l, r);
        quickSort(A, l, x - 1); //左側 (※右端 = x にすると無限ループ)
        quickSort(A, x+1, r); //右側 (※左端はx,x+1のどっちでも良い)   ←要チェック
    }
    return;
}

//mergesort
void Merge(vector<pair<string,int>> &A, int l, int m, int r) {
    //要素数
    int n1 = m - l + 1; //左側
    int n2 = r - m; //右側
    //格納用vectorの宣言→格納
    vector<pair<string,int>> L(n1);
    vector<pair<string,int>> R(n2);
    rep(i,n1) L[i] = A[l + i];
    rep(i,n2) R[i] = A[m + 1 + i];
    //indexの宣言
    int i = 0, j = 0, k = l;
    //比較しながらAに再格納する
    while (i < n1 && j < n2) {
        if (L[i].second <= R[j].second) {
            A[k] = L[i];
            i++;
        }
        else {
            A[k] = R[j];
            j++;
        }
        k++;
    }
    while (i < n1) {
        A[k] = L[i];
        i++;
        k++;
    }
    while (j < n2) {
        A[k] = R[j];
        j++;
        k++;
    }
    return;
}

void mergeSort(vector<pair<string,int>> &A, int l, int r) {
    //l == rのとき再帰ストップ
    if (l < r) {
        int m = (l + r) / 2;
        mergeSort(A, l, m);
        mergeSort(A, m+1, r);
        Merge(A, l, m, r);
    }
    return;
}


signed main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    int n; cin >> n;
    string s; int p;
    vector<pair<string,int>> A_quick(n);
    vector<pair<string,int>> A_merge(n);
    rep(i,n) {
        cin >> s >> p;
        A_quick[i] = make_pair(s,p);
        A_merge[i] = make_pair(s,p);
    }
    //sorting
    quickSort(A_quick, 0, n - 1);
    mergeSort(A_merge, 0, n - 1);
    //check if stable
    bool stable = true;
    rep(i,n) {
        if (A_quick[i] != A_merge[i]) {
            stable = false;
            break;
        }
    }
    //stableか出力
    if (stable) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
    //quicksortの結果を出力
    rep(i,n) {
        cout << A_quick[i].first << " " << A_quick[i].second << endl;
    }
    
    return 0;
}


Measured memory_bytes: 12108
import math
def calc(h,m): 
    if (h == 12): 
        h = 0
    if (m == 60): 
        m = 0
    hour_angle = 0.5 * (h * 60 + m) 
    minute_angle = 6 * m 
    angle = abs(hour_angle - minute_angle) 
    angle = min(360 - angle, angle) 
    return angle 

a,b,h,m = map(int,input().split())
angle = calc(h,m)
ag = math.radians(angle)
c = a**2 +b**2 - (2*a*b*math.cos(ag))
print(math.sqrt(c))

Measured memory_bytes: 9588
#include <bits/stdc++.h>
using namespace std;
int n,ans;
int pls(int x){
    int res=0;
    for(int i=1;i<sqrt(x);i++)if(!(x%i))res+=2;
    if(int(sqrt(x))*int(sqrt(x))==x)res++;
    return res;
}
int main(){
    cin>>n;
    for(int i=1;i<n;i++)
        ans+=pls(i);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3668
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	string s;
	cin >> s;
	vector<int> ans(0);
	for (char c : s) {
		if (c == '0') {
			ans.pb(0);
		}
		else if (c == '1') {
			ans.pb(1);
		}
		else if (c == 'B') {
			if (ans.size() != 0) {
				ans.pop_back();
			}
		}
	}
	rep(i, ans.size()) {
		cout << ans[i];
	}
	return 0;
}

Measured memory_bytes: 256
def palindrome(string): return 0 if string==string[::-1] else 1

s = input()

if palindrome(s) == 0:
  n = (len(s) - 1) // 2
  front = s[:n]
  end = s[(n + 1):]
  if palindrome(front) == 0 and palindrome(end) == 0:
    print("Yes")
  else:
    print("No")
else:
  print("No")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
 using namespace std;
 
 int main(){
     string s; 
     cin>>s;
     int n=s.size();
     int ans=0;
     for(int i=0;i<n/2;i++){
        if( s[i]!=s[n-i-1] ) ans++;
     }
     cout<<ans;
     
     }

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

int main() {
	string s, t;
	cin>>s;
	cin>>t;
	
	int n=s.size();
	int res=0;
	for(int i=0;i<n;i++) {
		if(s[i]!=t[i])
			res++;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3920
/* ex6_2
   key_tree */

#include <stdio.h>
// 文字列操作に関する関数が定義されたヘッダファイル
#include <string.h>
// 文字列の長さ制限
#define SIZE 101

int main(void){
    int length;
    char message[SIZE];
    // 文字列を取得
    scanf("%s", &message);
    // 文字列の長さ
    length = strlen(message);
    // 配列が0から始まることに注意して、題意の略字を求める
    printf("%c%d%c\n", message[0], length - 2, message[length - 1]);

    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;
    vector<ll> v(n);
    REP(i, n) cin >> v[i];

    map<ll, ll> dic0, dic1;
    REP(i, n) {
        (i%2 ? dic1 : dic0)[v[i]]++;
    }

    vector<pair<ll, ll>> d0, d1;
    for (auto &v : dic0)
        d0.emplace_back(v.second, v.first);
    for (auto &v : dic1)
        d1.emplace_back(v.second, v.first);

    sort(ALL_OF(d0), greater<pair<ll, ll>>());
    sort(ALL_OF(d1), greater<pair<ll, ll>>());


    ll coans;
    if (d0.front().second != d1.front().second) {
        coans = d0.front().first + d1.front().first;
    } else {
        d0.emplace_back(0, 0);
        d1.emplace_back(0, 0);
        coans = max(
            d0[0].first + d1[1].first,
            d0[1].first + d1[0].first
        );
    }
    cout << n - coans << endl;
    
}

Measured memory_bytes: 9592
use std::io;

fn solve_d(s: &str) -> (isize, isize) {
    let s = s.as_bytes();
    for (i, b) in s.iter().enumerate() {
        let first = *b as char;
        if let Some(b) = s.get(i + 1) {
            if first == *b as char {
                return ((i + 1) as isize, (i + 2) as isize);
            }
        }
        if let Some(b) = s.get(i + 2) {
            if first == *b as char {
                return ((i + 1) as isize, (i + 3) as isize);
            }
        }
    }
    (-1, -1)
}

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    let s = s.trim();
    let result = solve_d(s);
    println!("{} {}", result.0, result.1);
}

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

int main(){
    
    int n;
    cin >> n;
    vector<long long> a(n);
    long long sum = 0;
    const int MOD = 1000000007;
    for(int i=0; i<n; i++){
        cin >> a.at(i);
        sum += a.at(i);
      	sum %= MOD;
    }
    long long ans = 0;
    for(int i=0; i<n; i++){
        sum -= a.at(i);
      	if(sum < 0){
        	sum += MOD;
       	}
        ans += a.at(i)%MOD * sum%MOD;
    }
    cout << ans%MOD << endl;
}


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

using namespace std;
using ll = long long;

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> Acc(N + 1);
  for (int i = 1; i <= N; ++i) {
    ll A;
    cin >> A;
    Acc[i] = (Acc[i - 1] + A - 1 + K) % K;
  }
  map<ll, ll> now;
  for (int i = 0; i < min(N + 1, K); ++i) now[Acc[i]]++;
  ll ans = 0;
  for (pair<ll, ll> p : now) ans += (p.second) * (p.second - 1) / 2;
  if (K < N + 1)
    for (int i = K; i <= N; ++i) {
      now[Acc[i - K]]--;
      ans += now[Acc[i]];
      now[Acc[i]]++;
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14336
#include <cstdio>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

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

const int N(2e5 + 10);
int n, a[N];

int check(int mid)
{
	for (int i = 0; i < n - 1; i++)
	{
		if ((a[n - i] >= mid && a[n - i - 1] >= mid)
		  ||(a[n + i] >= mid && a[n + i + 1] >= mid)) return 1;
		if ((a[n - i] <  mid && a[n - i - 1] <  mid)
		  ||(a[n + i] <  mid && a[n + i + 1] <  mid)) return 0;
	}
	return a[1] >= mid;
}

int main()
{
	n = read();
	for (int i = 1; i <= n * 2 - 1; i++) a[i] = read();
	int l = 1, r = n * 2 - 1, ans = -1;
	while (l <= r)
	{
		int mid = (l + r) >> 1;
		if (check(mid)) ans = mid, l = mid + 1;
		else r = mid - 1;
	}
	printf("%d\n", ans);
	return 0;
}


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

const int ofst[][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};

int H, W;
string field[100];

void leveling(int x, int y, const char kind) {
    field[y][x] = '.';
    for (int i = 0; i < 4; i++) {
        int px = x + ofst[i][0];
        int py = y + ofst[i][1];
        if (px < 0 || W <= px || py < 0 || H <= py) continue;
        if (field[py][px] != kind) continue;
        leveling(px, py, kind);
    }
}

int main() {

    while (cin >> H >> W, H) {
        for (int i = 0; i < H; i++) {
            cin >> field[i];
        }

        int count = 0;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (field[i][j] != '.') {
                    leveling(j, i, field[i][j]);
                    count++;
                }
            }
        }
        cout << count << endl;
    }

    return 0;
}

Measured memory_bytes: 2156
import math

N = int(input())
s = [[""]*10 for i in range(N)]
a =[[0]*26 for i in range(N)]
b =[""]*N

cn =ord("a")

for i in range(N):
    s[i] = list(input())
    s[i].sort()
    b[i] ="".join(s[i])

b.sort()
c = 0
ans =0

for i in range(N-1):
    if b[i]==b[i+1]:
        c +=1
    else:
        if c !=0:
            ans=ans + math.factorial(c+1)/(math.factorial(2)*math.factorial(c+1-2))
            c = 0


if c !=0:
    ans = ans + math.factorial(c+1)/(math.factorial(2)*math.factorial(c+1-2))
    

print(int(ans))


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

int main() {
  int x1, x2, x3, x4, y1, y2, y3, y4;
  cin >> x1 >> y1 >> x2 >>y2;
  x3 = x2 - (y2 - y1);
  y3 = y2 + (x2 - x1);
  x4 = x3 - (y3 - y2);
  y4 = y3 + (x3 - x2);
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}


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

using namespace std;

long long a, b;

int main() {
  int n;
  cin >> n;
  vector<int> arr;
  for (int i = 0; i < n; ++i) {
    int temp;
    cin >> temp;
    arr.push_back(temp);
  }
  bool ff = true;
  sort(arr.begin(), arr.end());
  reverse(arr.begin(), arr.end());
  for (unsigned int i = 0; i < arr.size(); ++i) {
    if (ff) {
        if (arr[i] == arr[i + 1]) {
        a = arr[i];
        ff = false;
        i = i + 1;
      }
    } else {
      if (arr[i] == arr[i + 1]) {
        b = arr[i];
        break;
      }
    }
  }
  cout << (long long) a * b << '\n';
  return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;


int main()
{
   FAST/**/
   
   ll n,r;
   cin>>n>>r;
   
   if(n>=10)
        cout<<r;
   else cout<<r+100*(10-n);        
   
   return 0;        
}  
   

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

void solve() {
	ld a, b, x;
	cin >> a >> b >> x;
	ld theta;
	if (x > a * a *b / 2.0) {
		ld y = 2 * x / (a * a) - b;
		theta = atan((b - y) / a);
		//cout << theta << endl;
	}
	else {
		ld y = 2 * x / (a*b);
		theta = atan(b / y);
		//cout << theta << endl;
	}
	ld ans = 360 * theta / (2 * pi);
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(7);
	//init();
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 384
import math as ma

def dist(a, b, D):
  r = 0
  for i in range(D):
    r = r + (a[i]-b[i])**2

  return ma.sqrt(r)

N, D = (int(i) for i in input().split())
X = [[int(i) for i in input().split()] for i in range(N)]

ret = 0
for i in range(N):
  for j in range(i+1, N):
    d = dist(X[i], X[j], D)
    if (d == int(d)):
      ret = ret + 1

print(ret)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
		int x,y,i,j;
		
		while(true){
			x = sc.nextInt();
			y = sc.nextInt();
			if(x == 0 && y == 0){
				sc.close();
				return;
			}
			else{
				for(i=0;i<x;i++){
					for(j=0;j<y;j++){
						System.out.print('#');
					}
					System.out.println();
				}
				System.out.println();
			}
		}
	}

}


Measured memory_bytes: 37060
#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;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF INT_MIN 
#define INF INT_MAX 
#define MP make_pair
#define int ll int

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef map<int,int>MII;
typedef vector<int> VI;
const int MAX = 1e4 + 5;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 
//int root(int x){return x==f[x]?x:f[x]=root(f[x]);}


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{
    int h,a;
    cin>>h>>a;
    if(h%a==0)cout<<h/a<<endl;
    else cout<<h/a+1<<endl;
}


return 0;
}





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

int main() {
  vector<int> vs(2);
  cin >> vs[0] >> vs[1];
  sort(vs.begin(), vs.end());

  if (vs[0] == 2) {
    cout << 1 << endl;
  } else if (vs[1] == 2) {
    cout << 3 << endl;
  } else {
    cout << 2 << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
const int N = 105;
int main()
{
	int n,a[N] = {0};
	scanf("%d",&n);
	for(int i =0;i < n; i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i =n-1;i >= 0; i--)
	{
		if(i)
		{
			printf("%d ",a[i]);
		}
		else
		{
			printf("%d\n",a[i]);
		}
	
	}
	
	return 0;
} 


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

int main()
{
        int a, b, c;
        cin >> a >> b >> c;
        if (a < b) {
                if (b < c) {
                        cout << "Yes" << endl;
                        exit(0);
                }
        }
        cout << "No" << endl;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define MOD 1000000007
using pi = pair<int, int>;
vector<int>g[100100];
int siz[100100];

vector<int> centroid;
int n;

int main()
{
    int t = 1;
    //cin >> t;
    while(t--)
    {
       int x;
       cin >>x;
       if(x)cout << 0 <<endl;
       else cout << 1 << endl;
    }
}


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

const int MAX_N = 100009;
int N, C;
int s[MAX_N],t[MAX_N],c[MAX_N];

int used[35][MAX_N];

void solve()
{
	for(int i=0;i<N;++i) used[c[i]][s[i]-1]++, used[c[i]][t[i]]--;
	for(int ch=1;ch<=C;++ch)for(int t=1;t<MAX_N;++t) used[ch][t] += used[ch][t-1];
	
	int ans = 0;
	for(int i=0;i<MAX_N;++i){
		int cur = 0;
		for(int j=1;j<=C;++j)if(used[j][i])cur++;
		ans = max(ans, cur);
	}
	cout << ans << '\n';
}

int main()
{
	cin >> N >> C;
	for(int i=0;i<N;++i){
		cin >> s[i] >> t[i] >> c[i];
	}
	solve();
	return 0;
}

Measured memory_bytes: 16504
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b, c;
    cin >> a >> b >> c;
    if(a==b && a!=c){cout << "Yes";}
    else if(b==c && b!=a){cout << "Yes";}
    else if(c==a && c!=b){cout << "Yes";}
    else{ cout << "No";}
    return 0;
}


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

long long gcd(long long a, long long b) {
	if (b==0)
		return a;
	return gcd(b, a%b);
}
long long lcm(long long a, long long b) {
	return a*b/gcd(a,b);
}
int main() {
	int n,m;
	cin>>n>>m;
	string s1,s2;
	cin>>s1>>s2;
	long long ans = lcm(n,m);
	int step1 = ans/n;
	int step2 = ans/m;
	for (int i=0, j=0; i<n&&j<m; ) {
		int run1 = i*step1;
		int run2 = j*step2;
		if (run1 < run2)
			i++;
		else if (run1 > run2)
			j++;
		else {
			if (s1[i] != s2[j]) {
				cout<<-1<<endl;
				return 0;
			}
			i++, j++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 512
program sample
    implicit none
    character(100)::s
    integer(8) :: i,j,m,n
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) s
    if(s .eq. 'RRR')then
        write(*,*)3
    elseif(s(1:2) .eq. 'RR' .or. s(2:3) .eq. 'RR')then
        write(*,*)2
    elseif(s .eq. 'SSS')then
        write(*,*)0
    else
        write(*,*)1
    end if

    
  
    stop
end program sample
  



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

int main(){
  int N; 
  cin >> N;
  int count = 0;
  for(int i =1 ; i <= N; i+=2){
    int count8 = 0;
    for(int j = 1; j <= i; j+=2){
      if(i % j == 0){
        count8++;
      }
    }
    if(count8 == 8){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i, n) cin >> h[i];
	rrep(i, n) {
		if (h[i] > h[i - 1]) h[i]--;
	}
	rrep(i, n) {
		if (h[i] < h[i - 1]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>
#include <math.h>

int sum(int N) {
  int sumOfDigit = 0;
  while (N > 0) {
    sumOfDigit += N % 10;
    N = N /10;
  }
  return sumOfDigit;
}

int main(void){
  int N;
  int sumOfDigit = 0;

  scanf("%d", &N);

  sumOfDigit = sum(N);

  if (N % sumOfDigit == 0) {
    puts("Yes");
  }else{
    puts("No");
  }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////

int main(){
    ll a;cin>>a;
    cout << a*a << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) REP(I,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
using namespace std;
using namespace __gnu_pbds;
typedef unsigned long ul;
ul N,K,t,d,i,num,min_value,p,tmp;
vector<pair<ul,ul> >td;
bool used[100001];
priority_queue<ul,vector<ul>,greater<ul> > dd;
inline void solve(){
  IN2(N,K);
  REP(i,N){
    cin>>t>>d;
    td.push_back(make_pair(d,t));
  }
  sort(RALL(td));
  REP(i,K){
    tmp+=td[i].first;
    if(used[td[i].second]){
      dd.push(td[i].first);
    }else{
      used[td[i].second]=true;
      num++;
    }
  }
  p=tmp+num*num;
  FOR(i,K,N){
    if(!used[td[i].second]){
      if(dd.size()==0){
        break;
      }
      used[td[i].second]=true;
      num++;
      tmp+=td[i].first;
      min_value=dd.top();dd.pop();
      tmp-=min_value;
      p=max(p,tmp+num*num);
    }
  }
  OUT(p);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 2672
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<deque>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;

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

int main(){
    int r;
    cin >> r;
    double pi = 3.141592;
    double ans = 2.0*r*pi;
    printf("%.6f\n",ans);
}

Measured memory_bytes: 3720
K=38
N=K*(K-1)+1
print(N,K)
ans=[[] for i in range(K)]
for i in range(K):
  L=[j+(K-1)*i+2 for j in range(K-1)]
  ans[i]=L
  L=list(map(str,L))
  L=["1"]+L
  print(" ".join(L))
for i in range(2,K+1):#初めがi　i-2ことび
  for j in range(K-1):#jこめ
    L=[i]
    for k in range(K-1):#listのkこめ
      L.append(ans[k+1][(j+1+(i-2)*k)%(K-1)])
    L=list(map(str,L))
    print(" ".join(L))

Measured memory_bytes: 73744
def update(house, f, r, v)
  house[10 * (f - 1) + (r - 1)] += v
end

def print_house(house)
  house.each_slice(10) do |v|
    puts " %d %d %d %d %d %d %d %d %d %d" % v
  end
end

house1 = Array.new(30, 0)
house2 = Array.new(30, 0)
house3 = Array.new(30, 0)
house4 = Array.new(30, 0)

n = gets.chomp.to_i
n.times do
  b, f, r, v = gets.chomp.split.map(&:to_i)
  case b
  when 1 then update(house1, f, r, v)
  when 2 then update(house2, f, r, v)
  when 3 then update(house3, f, r, v)
  when 4 then update(house4, f, r, v)
  end
end

print_house house1
puts '#' * 20
print_house house2
puts '#' * 20
print_house house3
puts '#' * 20
print_house house4

Measured memory_bytes: 6124
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=110000;
int a[N],b[N],root1,root2,p[N*2],h[N*2],num,n,ans[N*2],f[N*2];
bool flag[N],flag1;
struct node{
    int x,y,next,k;
    bool flag;
}data[N*10];
void link(int x,int y){
    ++num;
    data[num].x=x;
    data[num].y=y;
    data[num].next=h[x];
    data[num].k=num+1;
    data[num].flag=true;
    h[x]=num;
    ++num;
    data[num].x=y;
    data[num].y=x;
    data[num].next=h[y];
    data[num].k=num-1;
    data[num].flag=true;
    h[y]=num;
    p[x]++;
    p[y]++;
}
void dfs1(int x){
    for(int &i=h[x];i!=-1&&i!=0;i=data[i].next){
    	int v=data[i].y;
        if(!data[i].flag)continue;
        if(x<=n&&v<=n){f[x]++;f[v]--;}
        if(flag1&&x==root1&&v==root2){f[x]++;f[v]--;flag1=false;}
        if(flag1&&x==root2&&v==root1){f[x]++;f[v]--;flag1=false;}
        data[i].flag=false;
        data[data[i].k].flag=false;
        dfs1(v);
    }
}
int main(){
// 	freopen("1.in", "r", stdin);
// 	freopen("a.out", "w", stdout);
    scanf("%d",&n);
    memset(h,-1,sizeof h);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(a[i]!=-1)link(a[i],i);
        else root1=i;
    }
    for(int i=1;i<=n;i++){
        scanf("%d",&b[i]);
        if(b[i]!=-1)link(b[i]+n,i+n);
        else root2=i+n;
    }
    link(root1,root2);flag1=true;
    for(int i=1;i<=n;i++){
        if((p[i]%2)!=(p[i+n]%2)){
            printf("IMPOSSIBLE\n");
            return 0;
        }else if(p[i]%2==1)link(i,i+n);
    }
    printf("POSSIBLE\n");
    dfs1(root1);
    for(int i=1;i<=n;i++)printf("%d ",f[i]);
    return 0;
}

Measured memory_bytes: 27264
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;


int solve(vector<int> a) {
	sort(a.begin(), a.end());
	if ((int)a.size() & 1) {
		return (a[a.size() / 2]);
	} else {
		return (a[a.size() / 2] + a[a.size() / 2 - 1]);
	}
}

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

	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	// if (n % 2 == 0) {
	// 	for (auto &t : a) {
	// 		t *= 2;
	// 	}
	// 	for (auto &t : b) {
	// 		t *= 2;
	// 	}
	// }
	int f = solve(b);
	int s = solve(a);
	// cout << f << ' ' << s << endl;
	cout << f - s + 1 << endl;
}

Measured memory_bytes: 5148
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner scan = new Scanner(System.in);
        
        String s = scan.nextLine();
        
        String s1 = s.substring(0 , 1);
        String s2 = s.substring(1 , 2);
        String s3 = s.substring(2 , 3);
        
        int count = 0;
        
        if (s1.equals("1")) {
            count++;
        } if (s2.equals("1")) {
            count++;
        } if (s3.equals("1")) {
            count++;
        }
        
        System.out.println(count);
    }
    
}

Measured memory_bytes: 35740
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut xor_all = a[0];
    for i in 1..n {
        xor_all ^= a[i];
    }

    for e in a {
        echo!(e ^ xor_all);
    }
}


Measured memory_bytes: 6368
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A&lang=jp
#?????\????????????????£?
#?¨?????????????????????????????????±?????????
def insertion_sort(target_list, n_list):
    
    for focus_index in range(1, n_list):
        print(*target_list)
        target = target_list[focus_index]
        if target < target_list[focus_index - 1]:#?????£?????°??????????????§??????
            compare_index = focus_index

            while compare_index > 0 and target_list[compare_index - 1] > target:
                target_list[compare_index] = target_list[compare_index - 1]
                compare_index -= 1;

            target_list[compare_index] = target
    
    return target_list

def main():
    n_list = int(input())
    target_list = [int(a) for a in input().split()]
    print(*insertion_sort(target_list, n_list))
if __name__ == "__main__":
    main()

Measured memory_bytes: 8044
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val stringS = sc.next()
    val stringT = sc.next()
    val valueS = sc.nextInt()
    val valueT = sc.nextInt()
    val pickedString = sc.next()

    val ans =
      if (pickedString == stringS) {
        val newValueS = valueS - 1
        s"$newValueS $valueT"
      } else {
        val newValueT = valueT - 1
        s"$valueS $newValueT"
      }

    println(ans)
  }
}


Measured memory_bytes: 27188
#include <cstdio>
#include <cctype>
#include <utility>
#include <string>
#include <vector>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

struct T {
	int a[256];
	char b[52];
	constexpr T() : a(), b() {
		int i = 0;
		for (int c = 'a'; c <= 'z'; c++) a[c] = i++;
		for (int c = 'A'; c <= 'Z'; c++) a[c] = i++;
		i = 0;
		for (; i < 26; i++) b[i] = 'a' + i;
		for (; i < 52; i++) b[i] = 'A' - 26 + i;
	}
};

int main() {
	constexpr T t;
	for (int n; (n = in());) {
		vector<int> k(n);
		for (int &x: k)
			x = in();
		string s;
		scan(s);
		int i = 0;
		for (int c: s)
			out(t.b[(52 + t.a[c] - k[i++ % k.size()]) % 52]);
		outl();
	}
}


Measured memory_bytes: 2752
#include<bits/stdc++.h>
using namespace std;
long long helper(long long h)
{
    if(h==1)
    {
        return 1;
    }
    return 2*helper(h/2)+1;
}
int main()
{
    long long h;
    cin>>h;
    long long ans=helper(h);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
//! Bismillahi-Rahamanirahim.
/** ========================================**
 ** @Author: Md. Abu Farhad ( RUET, CSE'15)
 ** @Category:
/** ========================================**/

#include<bits/stdc++.h>
#include<stdio.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;


#define ll                  long long
#define scl(n)              scanf("%lld",&n)
#define scll(n, m)          scanf("%lld%lld",&n, &m)
#define scc(c)	            scanf("%c",&c)
#define fr(i,n)             for (ll i=0;i<n;i++)
#define fr1(i,n)            for(ll i=1;i<=n;i++)
#define pfl(x)              printf("%lld\n",x)
#define pb                  push_back
#define debug               cout<<"I am here"<<endl;
#define pno                 cout<<"NO"<<endl
#define pys                 cout<<"YES"<<endl
#define tcas(i,t)           for(ll i=1;i<=t;i++)
#define all(x) 	            (x).begin(), (x).end()
#define allrev(x)           (x).rbegin(),(x).rend()
#define pr                  pair<ll, ll>
#define ff                  first
#define ss                  second
#define pn                  printf("\n")


int main()
{
    ll t;
    t=1;
    tcas(cs, t)
    {
        ll m,n,b,c,d,i,j,k,x,y,z,l,r, p, q;
        string s,s1, s2, s3, s4;

        ll cnt=0,cn=0,ans=0,sum=0 ;
        cin>>n>>s;

        fr(i,n)
        {
            if(s[i]=='R')cnt++;
            else cn++;
        }

        if(cnt==0 or cn==0)cout<<0<<endl;
        else
        {
            i=0, j=n-1;

            while(i<j)
            {
                if(s[i]=='W' and s[j]=='R')swap(s[i]  , s[j])  , ans++;
                if(s[i]=='R' )i++;
                if(s[j]=='W' )j--;

            }  
            cout<<ans;pn;
        }
      
    }

return 0;
}

/// **************************Before submit****************************

///    ****Please check all base case output  and printing " YES or NO " ***
///    *check for integer overflow,array bounds
///    *check for n=1


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

int main()
{
  int a;
  cin >> a;
  if(a < 1200) {
    cout << "ABC" << endl;
  }
  else if(a < 2800) {
    cout << "ARC" << endl;
  }
  else {
    cout << "AGC" << endl;
  }
}


Measured memory_bytes: 3580
n = int(input())
st_lis = []
for i in range(n):
    s, t = input().split()
    st_lis.append([s, int(t)])
x = input()
cnt = 0
for s, t in st_lis:
    if s == x:
        cnt = 0
    else:
        cnt += t
print(cnt)

Measured memory_bytes: 3316
#include <iostream>
using namespace std;
int main(){
    int x[5],num,num2;
    for(int i=0; i<5; i++){
        cin >> x[i];
    }
    num=x[4]*x[0];
    if(x[4]>x[2]){
        num2=x[1]+(x[4]-x[2])*x[3];
    }
    else{
        num2=x[1];
    }

    if(num>num2){
        cout << num2 << endl;
    }
    else{
        cout << num << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include <stdio.h>


int main()
{
  int i,cnt[26];
  char ch;
  
  for(i = 0; i < 26; i++) cnt[i] = 0;
  
  while(scanf("%c",&ch) != EOF)
  {
    if(ch >= 'A' && ch <= 'Z') cnt[ch - 'A']++;
    else if(ch >= 'a' && ch <= 'z') cnt[ch - 'a']++;
  }
  
  for(i = 0; i < 26; i++)
  {
    printf("%c : %d\n",i + 97,cnt[i]);
  }
  return 0;
}

Measured memory_bytes: 540
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            if ((n % 2 == 1) && (m % 2 == 1)) {
                out.println("Odd");
            } else {
                out.println("Even");
            }
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

Measured memory_bytes: 22996
def myAnswer(S:str)-> str:
   dic = {"a":0,"b":0,"c":0}
   for s in S:dic[s]+= 1
   ans = sorted(dic.values(),reverse = True)
   return "NO" if(max(ans) - min(ans) >=2) else "YES"
def modelAnswer():
   return
def main():
   S = (input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()


Measured memory_bytes: 3188
n=gets.to_i
blocks=gets.chomp.split().map(&:to_i)
kakuho=0
counter=1
blocks.map{|block|
 if block == counter 
   counter=counter+1
   kakuho=kakuho+1
 end  
}
if kakuho == 0
  puts -1
else
  puts blocks.count-kakuho
end  

Measured memory_bytes: 18308