akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>//万能头文件 
using namespace std;
int main()
{
  int n;    
  string a;
  int i,ans=0,sum=0;//ans:当前爬到哪里了；sum：当前爬到过最高的海拔 
  cin>>n>>a;//输入    
  for(i=0;i<n;i++)
  {
    if(a[i]=='D')//判断如果为D的话 
      ans--;//海拔降低1米 
    else//否则 
      ans++;//海拔升高1米 
    sum=max(ans,sum);//更新当前最大的海拔 
  }
  cout<<sum<<endl;//输出，做岛国题不要忘记换行！ 
  return 0;//结束 
}

Measured memory_bytes: 256
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,k = ma()
A = list(ma())
s = 1
zeros = [0 for i in range(n+1)]
for i in range(k):
    if A[i] ==0:
        zeros[i] +=1
        zeros[min(n,i+k)] -=1
for i in range(1,n+1):
    zeros[i] += zeros[i-1]
for i in range(k,n):
    if zeros[i] >0:
        f = False
        yn(f)
        continue
    if A[i] > A[i-k]:
        f =True
    else:
        f=False
    yn(f)


Measured memory_bytes: 32176
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){

string S;
cin >> S;

int a = 0;

for (int i = 0; i < 3; i++){
     if(S.at(i) == 'o'){
          a++;
     }
}

cout << 700 + a * 100 << endl;

return 0;
}

Measured memory_bytes: 256
N,K,Q = map(int,input().split())
attend = [K-Q for i in range(N)]
A = 0
for i in range(Q):
	A = int(input())
	attend[A-1]+=1
for i in range(N):
	if(attend[i] <= 0):
		print("No")
	else:
		print("Yes")

Measured memory_bytes: 7896
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <vector>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;

int needed_roux(int r0, int w0, int c, int r) {
  if (w0 * c <= r0) return 0;
  int roux = w0 * c - r0;
  if (roux % r == 0) return roux / r;
  return roux / r + 1;
}

int main() {
  int R0, W0, C, R;
  while (cin >> R0 >> W0 >> C >> R && R0) {
    cout << needed_roux(R0, W0, C, R) << endl;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;

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

int main()
{

    int x;
    cin >> x;

    cout << (x >= 30 ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 3616
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    ll N;
    cin>>N;
    vector<ll> A(N);
    map<ll,ll> mp;
    REP(i,N){
        cin>>A[i];
        mp[A[i]]++;

    }
    sort(ALL(A),greater<ll>());
    ll ans=0;
    vector<ll> num(33,0);
    REP(i,33) num[i]=pow(2,i);
    REP(i,N){
        auto itr=upper_bound(ALL(num),A[i]);
        if(itr==num.end()) continue;
        ll pair=*itr-A[i];
        
        if(mp[A[i]]>0&&mp[pair]>0){
            if(pair==A[i]){
                if(mp[pair]>=2){
                    mp[pair]-=2;
                    ans++;
                }
            }else{
                mp[pair]--;
                mp[A[i]]--;
                ans++;
            }
        }

    }
    cout<<ans<<endl;
}

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

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

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

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

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

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

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

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

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

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

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

fn main() {
    input!(n: usize, sp: [(String, usize); n]);
    let mut spn = Vec::<(String, usize, usize)>::new();
    for i in 0..n {
        let a = (sp[i].0.clone(), sp[i].1, i + 1);
        spn.push(a);
    }
    spn.sort_by(|x, y| {
        if x.0 == y.0 {
            y.1.cmp(&x.1)
        } else {
            x.0.cmp(&y.0)
        }
    });

    for s in spn.iter() {
        println!("{}", s.2);
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d\n", 0, 0);
    } else {
      printf("%d %d\n", m, a / m * b);
    }
  }
  return 0;
}

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

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> p(N);
    for(int i = 0; i < N; i++) cin >> p.at(i);

    int count = 0;
    for(int i = 0; i < N; i++) if(p.at(i) != (i + 1)) count++;

    if(count <= 2) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
s = input()
if 1 <= int(s[:2]) <= 12 and 1 <= int(s[2:]) <= 12 :
  print('AMBIGUOUS')
elif 1 <= int(s[:2]) <= 12 :
  print('MMYY')
elif 1 <= int(s[2:]) <= 12 :
  print('YYMM')
else :
  print('NA')

Measured memory_bytes: 3060
import Control.Monad.Trans.State
 
main :: IO ()
main = do
  n <- readLn
  print $ evalState (step n) (2, 1)
 
step :: Int -> State (Int, Int) Int
step 0 = fst <$> get
step 1 = snd <$> get
step n = get >>= put . lucas >> step (n - 1)
  where lucas (x, y) = (y, x + y)

Measured memory_bytes: 508
// May this submission get accepted!

#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 STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
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) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return 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
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s, t; cin >> s >> t;

    vector<vector<ll>> cl('z' - 'a' + 1);
    REP(i, s.size()) {
        cl[s[i] - 'a'].push_back(i);
    }

    ll ans = 0;
    ll prev = -1;
    REP(i, t.size()) {
        auto &cli = cl[t[i] - 'a'];
        if (cli.empty()) {
            cout << -1 << endl;
            return 0;
        }
        auto itr = upper_bound(ALL_OF(cli), prev);
        ll curr = itr == cli.end() ? cli.front() : *itr;
        if (prev < curr) {
            ans += curr - prev;
        } else {
            ans += curr + s.size() - prev;
        }
        prev = curr;
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 1736
#include <stdio.h>
 
int main(void){
 
  char num[1000];
  int count = 0,sum = 0;
  register int i;
 
  while(1){
    scanf("%s",num);
    if(num[0] == '0'){
      break;
    }
    while(num[count] != '\0'){
    	count++;
    }
    for(i = 0;i < count;i++){
    	sum += num[i] - '0';
    }
    printf("%d\n",sum);
    count = 0;
    sum = 0;
  }
  return 0;
}

Measured memory_bytes: 536
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/

int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    int now = 1;
    Forn(i, n)
    {
        int x;
        cin >> x;
        if(x == now)
        {
            now++;
        }
        else ans++;
    }
    if(ans==n) cout << -1 << endl;
    else cout << ans << endl;
}


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

using namespace std;

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

	if (s[0] == '7' || s[1] == '7' || s[2] == '7') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

using namespace std;

#define int long long
// #define double long double
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Printv(v)                                                              \
    {                                                                          \
        REP(x, v.size()) { cout << v[x] << (x == v.size() - 1 ? "\n" : " "); } \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
const ll LINF = 1e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

void cinfast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

VVL gsb(2, VL(3, 0));
ll dp[2][25000100];

signed main() {
    LCIN(N);
    REP(i, 2) REP(j, 3) cin >> gsb[i][j];
    REP(i, 2) REP(j, 25000000) dp[i][j] = j;
    REP(i, 2) {
        REP(j, 3) {
            ll v = gsb[(i + 1) % 2][j], w = gsb[i][j];
            REP(k, N - w + 1) {
                dp[i][k + w] = max(dp[i][k + w], dp[i][k] + v);
            }
        }
        N = dp[i][N];
    }
    cout << N << "\n";
}


Measured memory_bytes: 390912
#include <bits/stdc++.h>
using namespace std;
#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
	#endif
}

int dpx[8]={1,1,1,-1,-1,-1,0,0};
int dpy[8]={-1,1,0,1,-1,0,-1,1};

int32_t main()
{
	fastIO
	inp_out();
	int n, m, k; 
	cin >> n >> m >> k; 
	

	vi a(n), b(m); 

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

	vi pre(m); 
	pre[0] = b[0]; 
	for(int i = 1; i < m;  ++ i)
		pre[i] = pre[i - 1] + b[i]; 

	int fa = 0;
	if(pre[0] <= k) 
		fa = lower_bound(pre.begin(), pre.end(), k + 1) - pre.begin(); 
		
	int val = 0; 
	for(int i = 0; i < n;  ++ i)
	{
		val += a[i]; 
		int ans = 0; 
		if(pre[0] <= k - val)
		{
			ans = lower_bound(pre.begin(), pre.end(), k - val + 1) - pre.begin(); 
		}
		if(val <= k)
			fa = max(fa, ans + i + 1); 
	}

	cout << fa; 
	return 0;
}

Measured memory_bytes: 7948
def 解():
    iN = int(input())
    iD = 10**9 + 7


    if iN < 3:
        print(iN)
        exit()

    d素={2:1}
    for i in range(2,iN + 1):
        b素 = 1
        for j in range(2,int(i**0.5)+2):
            if i % j == 0:
                b素 = 0
                break
        if b素 :
            d素[i]=1
    for i in range(2,iN+1):
        for i素 in d素:
            while i % i素 == 0:
                d素[i素]+=1
                i //= i素
            if i == 0:
                break
    iAns = 1
    for i素,num in d素.items():
        iAns *= num
        iAns %= iD
    print(iAns)
解()


Measured memory_bytes: 3444
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;


    ll k,a,b;

    ll func()
    {
        ll x=k-(a-1);
        return a+(x/2)*(b-a)+x%2;
    }

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            cin>>k>>a>>b;
            ll ans=k+1;
            ans=max(ans,func());
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
		public static void main(String[] args) {
			Scanner stdin=new Scanner(System.in);
			int n=stdin.nextInt();
			int a=stdin.nextInt();
			int amari=n%500;
			if(amari<=a)
				System.out.println("Yes");
			else
				System.out.println("No");
		}
}



Measured memory_bytes: 23124
import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        double r = Double.valueOf(line[0]);

        double d,l;

        d = (double)r * (double)r * 3.141592653589;
        l = 2 * r * 3.141592653589;
        
        System.out.printf("%.5f %.5f", d, l);

    }

}

Measured memory_bytes: 24892
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int p[3];
    p[0]=a+b;
    p[1]=b+c;
    p[2]=c+a;
    sort(p,p+3);
    cout<<p[0];
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define double long double
#define ll long long
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
#define ggr getchar();getchar();return 0
using namespace std;
int a[5],k;
signed main(){
	rep(i,5)cin>>a[i];
	cin>>k;
	sort(a,a+5);
	if(a[4]-a[0]>k)puts(":(");
	else puts("Yay!");
	ggr;
}

Measured memory_bytes: 256
def main():
    a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
         1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    print(a[int(input())-1])


main()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    FAST();
    ll n,i,j,k,t,a,b,c,d,p,q,x,y;
    string s;
    set<string>st;
    cin>>n;
    while(n--)
    {
        cin>>s;
        st.insert(s);
    }
    cout<<st.size()<<endl;

    return 0;
}



Measured memory_bytes: 19136
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,d;
	cin >> d >> n;
	if(n == 100)
		n++;
	int ans=1;
	for(int i=0;i<d;i++)
		ans *= 100;
	cout << ans*n;
	return 0;
}

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

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

    string s;
    cin >> s;

    int n = s.size();
    vector<long long> A(n + 1, 0);
    for(int i = 0; i < n; i++){
        if(s[i] == '<'){
            A[i + 1] = max(A[i + 1], A[i] + 1);
        }
    }

    for(int i = n - 1; i >= 0; i--){
        if(s[i] == '>'){
            A[i] = max(A[i], A[i + 1] + 1);
        }
    }

    long long ans = 0;
    for(auto x : A){
        ans += x;
    }
    
    cout << ans << endl;

    return 0;
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

#define INF (1<<(4*4-1))
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

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

   ll N;
   cin>>N;
   vector<ll>A(N),B(N);
   for(int i=0;i<N;i++)cin>>A[i]>>B[i];
   vector<pair<ll,ll> >p;
   for(int i=0;i<N;i++){
    p.push_back({A[i]+B[i],i});
   }
   sort(rrng(p));
   ll a=0;
   ll t=0;
   for(int i=0;i<N;i++){
     if(i%2){
       a+=B[p[i].second];
     }
     else {
       t+=A[p[i].second];
     }
   }

   cout<<t-a<<endl;
   return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }


int main() {
    ll n=5, k;
    vector<ll> a(n, 0);
    rep1(i, n) cin >> a[i];
    cin >> k;
    string ans = "Yay!";
    rep1(i, n){
        rep1(j, n){
            if (abs(a[i]-a[j])>k) ans = ":(";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define riterator reverse_iterator
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int N = 5000;
char a[N+3],b[N+3];
int ta[N+3],tb[N+3];
int wa[3*N+7],wb[3*N+7];
int n,m1,m2;

int get_ta(int x) {return x>m1?n:ta[x];}
int get_tb(int x) {return x>m2?n:tb[x];}

int main()
{
	scanf("%d%s%s",&n,a+1,b+1);
	if(a[1]=='1') {ta[++m1] = 0;} for(int i=2; i<=n; i++) if(a[i]!=a[i-1]) {ta[++m1] = i-1;} if(a[n]=='1') {ta[++m1] = n;}
	if(b[1]=='1') {tb[++m2] = 0;} for(int i=2; i<=n; i++) if(b[i]!=b[i-1]) {tb[++m2] = i-1;} if(b[n]=='1') {tb[++m2] = n;}
	for(int i=m2+1; i<=m2+m1; i++) wa[i] = ta[i-m2];
	for(int i=1; i<=m2; i++) wa[i] = 0;
	for(int i=m2+m1+1; i<=m2+m1+m2; i++) wa[i] = n;
//	printf("wa: "); for(int i=1; i<=m2+m1+m2; i++) printf("%d ",wa[i]); puts("");
	int ans = 1e9;
	for(int i=0; i<=m1+m2; i+=2)
	{
		for(int j=1; j<=m2; j++) {wb[i+j] = tb[j];}
		for(int j=1; j<=i; j++) {wb[j] = 0;}
		for(int j=i+m2+1; j<=m1+m2+m2; j++) {wb[j] = n;}
		int cur = 0;
		for(int j=1; j<=m1+m2+m2; j++) {cur += abs(wa[j]-wb[j]);}
		ans = min(ans,cur);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int nn=n;
  int cnt = 0;
  while(n!=0){
    cnt += n%10;
    n /= 10;
  }
  if(nn%cnt==0) cout << "Yes" << "\n";
  else cout << "No" << "\n";
  return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

string S;
ll N;

signed main() {
    cin >> S;
    N = S.length();
    ll ans = N;
    REP(i, N - 1) {
        if(S[i] != S[i + 1]) ans = min(ans, max(i + 1, N - i - 1));
    }
    cout << ans << "\n";
}

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

int main(){
    long long int a,v,b,w,t;
    cin >> a >> v >> b >> w >>t;
    if((b-a) >= 0){if((v-w)*t >= b - a){
        cout << "YES" <<endl;
    }else{
        cout << "NO" <<endl;
    }
                  }else{if((v - w)*t >= a -b){
        cout << "YES" <<endl;
    }else{
        cout << "NO" <<endl;
    }
                       }
      
}

Measured memory_bytes: 3636
import java.util.*;
import java.math.*;

class Main{
public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int x = sc.nextInt()-1;
   int y = sc.nextInt()-1;
   int array[] = new int[n];
   for (int i=0;i<n;i++){
     array[i] = 0;
   }
   for (int i=0;i<n-1;i++){
     for (int j=i+1;j<n;j++){
      int leng = Math.min(j-i,Math.abs(x-i)+Math.abs(y-j)+1);
      array[leng-1] += 1;
     }
   }
   for (int i=0;i<n-1;i++){
     System.out.println(array[i]);
   }
   
}
}


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

ll H, W, A, B;

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

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

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

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

int main() {
    cin >> H >> W >> A >> B;

    COMinit();

    H--;
    W--;

    ll ans = 0;
    for(ll i=0;i <= H-A; i++){
    	ans += (COM(B+i-1, i) * COM(H-i+W-B, H-i)) % MOD;
    }
    
    cout << ans % MOD << endl;
}


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

int main(){
  int N;
  cin >> N;
  map<string,int> S;
  for(int i=0;i<N;i++){
    string A;
    cin >> A;
    S[A]++;
  }
  cout << "AC x " << S["AC"] << endl;
  cout << "WA x " << S["WA"] << endl;
  cout << "TLE x " << S["TLE"] << endl;
  cout << "RE x " << S["RE"] << endl;
}

Measured memory_bytes: 3632
import sys
input = sys.stdin.readline

N = int(input())
c = input().rstrip()
white = [0] * N
red = [0] * N
if c[0] == 'W':
    white[0] = 1
for i in range(1, N):
    white[i] = white[i-1]
    if c[i] == 'W':
        white[i] += 1
for i in range(1, N)[::-1]:
    red[i-1] = red[i]
    if c[i] == 'R':
        red[i-1] += 1
if white[-1] == 0 or red[0] == 0:
    print(0)
    exit()
for i in range(N):
    if white[i] == red[i]:
        print(white[i])
        exit()

Measured memory_bytes: 71084
M=1e9+7,D[101][64];i,j,k,t,T;main(n){for(D[0][63]=scanf("%d",&n);T=i++<n;)for(j=0;k<4?:(k=0,++j<64);D[i][T]%=M)t=j*4+k++,D[i][T=t%64]+=T-9&&T-33&&T-6&&t-25&&t-41&&t-57&&t-37&&t-45?D[i-1][j]:0;for(;j--;T%=M)T+=D[n][j];printf("%d",T);}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if((b==c && a!=b) || (a==b && b!=c)|| (a==c && a!=b)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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



char word[15];
char sen[20];

void converse(char sen[]){
  int len = strlen(sen);
  for(int i=0;i<len;i++){
    if(sen[i]>='A' && sen[i]<='Z')sen[i] = sen[i] - 'A' + 'a';
  }
}


int main(){
  
  char end[20] = "END_OF_TEXT";
 
 scanf("%s",word);
 converse(word);
 
 int count = 0;
 
 while(1){
   scanf("%s",sen);
   if(strcmp(sen,end)==0)break;
   else converse(sen);
  
   if(strcmp(sen,word)==0)count++;
 }

  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 2032
import Data.List

func' :: (Int,Int,Int) -> Int -> (Int,Int,Int)
func' (a,b,i) n =
  if even i
  then (a+n, b, i+1)
  else (a, b+n, i+1)

func :: [Int] -> (Int, Int, Int)
func = foldl' func' (0,0,0)

main = do
  _ <- getLine
  line <- getLine
  let
    dat' = map read $ words line :: [Int]
    dat = sortBy (\x y -> y `compare` x) dat'
    (a,b,_) = func dat
    ans = a - b
  putStrLn $ show ans


Measured memory_bytes: 1020
#include <iostream>
#include <string.h>
#include <cmath>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin>>a>>b;
    int no = log10(b)+1;
    a = a*pow(10,no);
    int number = a+b;
    int temp = sqrt(number);
    temp *= temp;
    if(temp == number)
    cout<<"Yes"<<"\n";
    else{
        cout<<"No"<<"\n";
    }
    
    return 0;
}


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

long long n, x, m;
vector<long long> v;

int main() {
  cin >> n >> x >> m;
  vector<vector<long long>> memo, sum;
  memo.assign(60, vector<long long>(m, 0));
  sum.assign(60, vector<long long>(m, 0));
  for (int i = 0; i < m; ++i) memo[0][i] = (long long)i * i % m;
  for (int i = 0; i < m; ++i) sum[0][i] = i;
  for (int i = 1; i < 60; ++i)
    for (int j = 0; j < m; ++j) {
      long long mid = memo[i - 1][j];
      memo[i][j] = memo[i - 1][mid];
      sum[i][j] = sum[i - 1][j] + sum[i - 1][mid];
    }
  long long res = 0;
  for (int i = 0; i < 60; ++i)
    if (n >> i & 1) {
      res += sum[i][x];
      x = memo[i][x];
    }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 97900
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long a[] = new long[N];
        for(int i=0; i<N; i++){
            a[i] = sc.nextLong();
        }
        
        long sum[] = new long[N];
        sum[0] = a[0];
        for(int i=1; i<N; i++){
            sum[i] = sum[i-1] + a[i];
        }

        long c = sum[N-1] / 2;
        int center = 0;
        long min = Long.MAX_VALUE;

        for(int i=0; i<N-1; i++){
            if(Math.abs(sum[N-1] - sum[i] - sum[i]) < min){
                center = i;
                min = sum[N-1] - sum[i] - sum[i];
            }
        }
        System.out.println(Math.abs(sum[N-1] - sum[center] - sum[center]));
    


    }
}

Measured memory_bytes: 91684
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define debug cout << "Ok" << endl;

using namespace std;

long long int som(long long int n){

	return (n*(n-1))/2;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);


	map<int,long long int>qtd;
	long long int n,cont=0;
	cin >> n;
	vector<int>v(n);

	for(int i=0;i<n;i++){
		cin >> v[i];
		qtd[v[i]]++;
	}

	for(auto i = qtd.begin();i!=qtd.end();i++){
		cont+= som(i->second);
		i->second--;
	}

	for(int i=0;i<n;i++){
		cout << cont - qtd[v[i]] << endl;
	}

	return 0;
}

Measured memory_bytes: 11896
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define N 10000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

bool x[N],is[N];
int c[maxn],cnt,pri[maxn],T[maxn],ct,t1,t2;

struct node{int from,to,cap,flow,cost;};
vector <node> edges;
vector <int> mp[maxn];
int s,t,n,m,d[maxn],flow,cost,p[maxn],a[maxn];
bool inq[maxn];
queue <int> que;

inline void A(int u,int v,int w,int c)
{
	edges.push_back((node){u,v,w,0,c});
	edges.push_back((node){v,u,0,0,-c});
	int pp=edges.size();
	mp[u].push_back(pp-2);
	mp[v].push_back(pp-1);
}

inline bool spfa()
{
	for(int i=0;i<=t;i++) d[i]=inf,inq[i]=0,a[i]=inf;
	que.push(s); d[s]=0;
	while(!que.empty())
	{
		int u=que.front(); que.pop(); inq[u]=0;
		for(int i=0;i<mp[u].size();i++)
		{
			node &v=edges[mp[u][i]];
			if(v.cap-v.flow>0&&d[v.to]>d[u]+v.cost)
			{
				d[v.to]=d[u]+v.cost;
				a[v.to]=min(a[u],v.cap-v.flow);
				p[v.to]=mp[u][i];
				if(inq[v.to]==0) que.push(v.to),inq[v.to]=1;
			}
		}
	}
	if(d[t]==inf) return false;
	flow+=a[t];
	cost+=a[t]*d[t];
	for(int i=t;i!=s;i=edges[p[i]].from)
	{
		edges[p[i]].flow+=a[t];
		edges[p[i]^1].flow-=a[t];
	}
	return true;
}

inline void pre()
{
	for(int i=2;i<=(N-4);i++)
	{
		if(!is[i]) pri[++cnt]=i;
		for(int j=1;j<=cnt,pri[j]*i<=(N-5);j++)
		{
			is[pri[j]*i]=1;
			if(i%pri[j]==0) break;
		}
	}
}

int main()
{
	n=read(); pre(); is[1]=1;
	rep(i,1,n) c[i]=read(),x[c[i]]=1;
	rep(i,1,(N-4)) if(x[i]!=x[i-1]) T[++ct]=i;
	//rep(i,1,ct) cout<<T[i]<<" "; cout<<endl;
	s=0,t=ct+1;
	rep(i,1,ct)
	{
		if(T[i]%2==0)
		{
			t1++; A(s,i,1,0);
			rep(j,1,ct) if(T[j]%2==1)
			{
				int tmp=abs(T[i]-T[j]);
				if(!is[tmp]) A(i,j,1,1);
			}
		}
		else t2++,A(i,t,1,0);
	}
	while(spfa()); int ans=flow;
	int p1=(t1-ans)/2,p2=(t2-ans)/2,p3=(t1+t2-ans*2-p1*2-p2*2)/2;
	printf("%d\n",ans+p1*2+p2*2+p3*3);
	return 0;
}

Measured memory_bytes: 53760
#!/usr/bin/env python3
import sys


def solve(a: int, b: int, h: int):
    res = (a + b) * h / 2
    return int(res)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    h = int(next(tokens))  # type: int
    print(solve(a, b, h))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

vector<int> a(1000000, 1);

int main(void)
{
	a[0] = a[1] = 0;
	for (int i = 2; i < 1000000; i++) {
		if (a[i]) {
			for (int j = i * 2; j < 1000000; j += i) {
				a[j] = 0;
			}
		}
	}
	for (int i = 1; i < 1000000; i++) {
		a[i] += a[i - 1];
	}

	int n;
	while (scanf("%d", &n) != EOF) {
		cout << a[n] << endl;
	}

	return 0;
}


Measured memory_bytes: 6528
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			// unsigned int
			long a = sc.nextLong();
			long b = sc.nextLong();

			System.out.println(toPaddedBinaryString(a&b));
			System.out.println(toPaddedBinaryString(a|b));
			System.out.println(toPaddedBinaryString(a^b));
		}
	}
	/**
	 * 0パディングするのである
	 * @param bin バイナリするlong
	 * @return
	 */
	public static String toPaddedBinaryString(long bin) {
		String result = String.format("%32s", Long.toBinaryString(bin)).replaceAll(" ", "0");
		if(result.length()>32)
			return result.substring(result.length()-32);
		return result;
	}
}


Measured memory_bytes: 26384
import sys,collections as cl,bisect as bs,random
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

d = onem()

c = l()

s = []
sel = [0 for i in range(365)]

day = [[0 for i in range(26)] for j in range(365)]
ans = 0
for i in range(d):
	s.append(l())
	ss = [[s[-1][i],i+1] for i in range(26)]

	ak = 0

	for j in range(26):
		if i != 0:
			ak -= c[j] * (i-day[i-1][j]+1)
		else:
			ak -= c[j]

	ma = [-1,-1]
	for j in range(26):
		if i != 0:
			if ma[0] <= c[j] * (i-day[i-1][j]+1) + s[-1][j]:
				ma[0] = c[j] + (i-day[i-1][j]+1) + s[-1][j]
				ma[1] = j
		else:
			if ma[0] <= c[j] + s[-1][j]:
				ma[0] = c[j] + s[-1][j]
				ma[1] = j
	ans += ma[0] + ak
	sel[i] = ma[1]+1

	for j in range(26):
		if j == ma[1]:
			day[i][j] = i
		else:
			day[i][j] = day[i-1][j] if i - 1 >= 0 else 0



for _ in range(140000):
	ima = random.randrange(365)
	po = [[s[ima][i]-c[i],i+1] for i in range(26)]
	po.sort(reverse = True)
	while True:
		data = random.randrange(10)
		if sel[ima] != data+1:
			break
	data = po[data][1]-1
	ppp = 0
	for i in range(26):
		if ima == day[ima][i]:
			now = i
			break
	else:
		while True:
			now = random.randrange(26)
			if now != data:
				break 
	for i in range(ima+1,365):
		if day[i][data] == i:
			ppp += (i - ima) * c[data]
			break
	else:
		ppp += (364-ima) * c[data]
	ppp += s[ima][data]

	for i in range(ima+1,365):
		if day[i][now] == i:
			ppp -= (i - ima) * c[now]
			break
	else:
		ppp -= (364-ima) * c[now]
	ppp -= s[ima][now]
	if ppp > 0:
		for i in range(ima,365):
			if day[i][data] != i:
				day[i][data] = ima
			else:
				break
		po = ima - 1 if ima != 0 else 0
		for i in range(ima,365):
			if day[i][now] != i:
				day[i][now] = po
			else:
				break
		sel[ima] = data+1
		ans += ppp

for i in sel:
	print(i)


Measured memory_bytes: 84484
N = int(input())

D = [map(int, input().split()) for _ in range(N)]

ans = 0
flg = False
tmp = 0
for c,d in D:
    if c==d:
        if flg:
            tmp += 1
            ans = max(ans, tmp)
        else:
            tmp = 1
            flg = True
            ans = max(ans, tmp)
    else:
        flg = False

if ans >= 3:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const ll mod=1000000007;
class UnionFind {
  vector<ll> par, rank; // par > 0: number, par < 0: -par
public:
  void init(ll n) {
    par.resize(n); rank.resize(n);
    fill(par.begin(), par.end(), 1); fill(rank.begin(), rank.end(), 0);
  }
  ll getSize(ll x) {
    return par[find(x)];
  }
  ll find(ll x) {
    if (par[x] > 0) return x;
    return -(par[x] = -find(-par[x]));
  }
  void merge(ll x, ll y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) {
      par[y] += par[x];
      par[x] = -y;
    } else {
      par[x] += par[y];
      par[y] = -x;
      if (rank[x] == rank[y]) rank[x]++;
    }
  }
  bool isSame(ll x, ll y) {
    return find(x) == find(y);
  }
};
int main(void){
    ll N,M,K;
    cin>>N>>M>>K;
    UnionFind uf;
    uf.init(N);
    ll d[100001]={};
    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        uf.merge(a,b);
        d[a]--,d[b]--;
    }
    for(int i=0;i<K;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        if(uf.isSame(a,b)){
            d[a]--,d[b]--;
        }
    }
    for(int i=0;i<N;i++){
        cout<<uf.getSize(i)+d[i]-1<<" ";
    }
}

Measured memory_bytes: 3200
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val size = inputs(0).toInt
  val startNums = inputs(1).split(" ").map(_.toInt)
  val q = inputs(2).toInt
  val bi = inputs.splitAt(3)._2

  solve(size, startNums, q, bi)

  def solve(size: Int, startNums: Seq[Int], q: Int, bi: Seq[String]): Unit = {
    val array = scala.collection.mutable.HashMap.empty[Int, Int]
    var sum = 0L
    startNums.foreach { v =>
      sum = sum + v
      array.update(v, array.applyOrElse(v, (n: Int) => 0) + 1)
    }

    // 最終的に数字が何になるのかだけ処理する
    bi.foreach { str =>
      val set = str.split(" ").map(_.toInt)
      val from = set(0)
      val to   = set(1)
      var diff = 0

      if(array.isDefinedAt(from)) {
        diff = (to - from) * array(from)
        array.update(to, array.applyOrElse(to, (n: Int) => 0) + array(from))
        array.remove(from)
      }
      sum = sum + diff

      println(sum)
    }
  }
}

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

int main()
{
    ll n;
    cin >> n;
    char m[] = "abcdefghijklmnopqrstuvwxyz";
    vector<char> ans;
    while(n > 0){
        n--;
        ans.push_back(m[n%26]);
        n /= 26;
    }
    rep(i, ans.size()-1){
        cout << ans[ans.size()-i-1];
    }
    cout << ans[0] << endl;;
    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define f first
#define s second
const int MAXN=266100;
const int MAXK=19;
const int INF = 1e9;
ll N,E,K,W,a,b,c,d;
ll A[MAXN];

ll gcd(ll a, ll b){
  if(a<b)swap(a,b);
  if(b==0)return a;
  return gcd(b,a%b);
}

int main(){
  cin>>N;
  cout<<360/gcd(N,360);
}

Measured memory_bytes: 3636
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

int main()
{
	int T, N, H;
	LL K;
	scanf("%d%d%d%lld", &T, &N, &H, &K);

	if (K & 1)
		printf("%d\n", N - T);
	else
		printf("%d\n", T - N);

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int n;
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			int m, e, j;
			cin >> m >> e >> j;

			if (m == 100 || e == 100 || j == 100 || (m + e) / 2 >= 90 || (m + e + j) / 3 >= 80)cout << 'A' << endl;
			else if ((m + e + j) / 3 >= 70 || ((m + e + j) / 3 >= 50) && ((m >= 80) || (e >= 80)))cout << 'B' << endl;
			else cout << 'C' << endl;
		}
	}
	return 0;
}

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

static const int NMAX = 100;
static const int RMAX = 100;
static const int CMAX = 100;
static const int INF = (1 << 29);

int main() {
    int n; cin >> n;
    int M[NMAX+1][NMAX+1];
    int r[RMAX+1];
    int c[CMAX+1];
    int min_cost;

    for (int i = 1; i < n+1; ++i) cin >> r[i] >> c[i];

    for (int i = 0; i < n; ++i) {
        for (int j = 1; j < n+1-i; ++j) {
            for (int k = 1+i; k < n+1; ++k) {
                if (j==k) {
                    M[j][k] = 0;
                    continue;
                }

                min_cost = INF;
                for (int l = j; l < k; ++l) {
                    min_cost = min(min_cost, M[j][l] + M[l+1][k] + (r[j]*c[l]*c[k]));
                }
                M[j][k] = min_cost;
            }
        }
    } 

    // for (int i = 1; i < n+1; ++i) {
    //     for(int j = 1; j < n+1; ++j) {
    //         cout << M[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    cout << M[1][n] << endl;


    return 0;
}


Measured memory_bytes: 3112
def f(data):
  for i in range(3):
    if 0 > int(data[i]) or int(data[i]) > 10:
      print ("NO")

  if int(data[0]) == 5:
    if int(data[1])== 5:
      if int(data[2]) == 7:
        print ("YES")
      else:
        print("NO")
        
    elif int(data[1]) == 7:
      if int(data[2]) == 5:
          print ("YES")
      else:
        print("NO")
        
  elif int(data[0]) == 7:
    if int(data[1]) == 5:
      if int(data[2]) == 5:
          print ("YES")
      else:
          print("NO")
    else:
        print("NO")
  else:
    print("NO")

data = input().split()
if len(data) == 3:
  f(data)
else:
    print("NO")
  


Measured memory_bytes: 3064