akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    print(10 * a[2] + a[1] + a[0]);

}


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

using namespace std;
typedef long long ll;
const int maxn = 2e5 + 5;

int a[maxn], t[maxn];

int main() {
    int n, pos = 0;
    ll k;
    scanf("%d%lld", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]), t[i] = -1;
    int l = 0, r = 1;
    while (t[r] == -1) {
        t[r] = l++;
        r = a[r];
    }
    if (k < l) pos = k;
    else pos = (k - t[r]) % (l - t[r]) + t[r];
    for (int i = 1; i <= n; i++) if (t[i] == pos) {
        return printf("%d\n", i), 0;
    }
    return 0;
}

Measured memory_bytes: 5372
pub fn read_parameters<T>() -> Result<Vec<T>, String>
where
    T: std::str::FromStr,
{
    let mut line = String::new();

    std::io::stdin()
        .read_line(&mut line)
        .map_err(|err| format!("{:?}", err))?;

    line.trim()
        .split_whitespace()
        .map(|x| x.parse::<T>())
        .collect::<Result<Vec<T>, _>>()
        .map_err(|_| format!("{}", "parse error"))
}

fn main() {
    let x = read_parameters::<usize>().unwrap();
    let (n, m) = (x[0], x[1]);

    let mut a = Vec::with_capacity(n);
    for _ in 0..n {
        let raw = read_parameters::<usize>().unwrap();
        a.push(raw);
    }

    let mut b = Vec::with_capacity(m);
    for _ in 0..m {
        let col = read_parameters::<usize>().unwrap();
        b.push(col[0]);
    }

    let mut c = Vec::with_capacity(n);
    for i in 0..n {
        let mut sum = 0;
        for j in 0..m {
            sum += a[i][j] * b[j];
        }
        c.push(sum);
    }

    for x in c {
        println!("{}", x);
    }
}



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

int main() {
    ll n;
    cin >> n;
    ll ans = 1001001001001;
    for (ll i = 1; i <= sqrt(n); ++i) {
        if (n % i == 0) {
            ll res = i + n/i - 2;
            ans = min(ans, res);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int m,n,l,f,sum,ans;
	while(cin>>l){
	if(l==0)break;
	sum=0;
	ans=-1;
	for(int i=1;i<=12;i++){
	cin>>m>>n;
	sum+=m-n;
	if(l<=sum&&ans==-1)ans=i;
	}
	if(ans==-1)cout<<"NA"<<endl;
	else cout<<ans<<endl;
}
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	private Scanner sc;
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		String[] nico = sc.nextLine().split(" ");
		int h = Integer.parseInt(nico[0]);
		int w = Integer.parseInt(nico[1]);
		
		int[][] map = new int[h][w];
		for (int i = 0; i < map.length; i++) {
			for (int j = 0; j < map[0].length; j++) {
				map[i][j] = 0;
			}
		}
		
		int n = Integer.parseInt(sc.nextLine());
		
		int ix = 0;
		int iy = 0;
		for (int i = 0; i < n; i++) {
			int c = sc.nextInt();
			
			for (int j = 0; j < c; j++) {
				map[iy + (ix + j) / w][(ix + j) % w] = (i + 1);
			}

			int tx = ix;
			ix = (c + tx) % w;
			iy = ((c + tx) / w) + iy;
		}
		
		for (int i = 0; i < map.length; i++) {
			for (int j = 0; j < map[0].length; j++) {
				int index = j;
				if ((i % 2) != 0) index = map[0].length - j - 1;
				
				if (j == 0) System.out.print(map[i][index]);
				else System.out.print(" " + map[i][index]);
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 31896
class Union_Find():
    def __init__(self,N):
        """0,1,...,n-1を要素として初期化する.

        n:要素数
        """
        self.n=N
        self.parents=[-1]*N
        self.rank=[0]*N

    def find(self, x):
        """要素xの属している族を調べる.

        x:要素
        """
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        """要素x,yを同一視する.

        x,y:要素
        """
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x]>self.rank[y]:
            self.parents[x] += self.parents[y]
            self.parents[y] = x
        else:
            self.parents[y] += self.parents[x]
            self.parents[x] = y

            if self.rank[x]==self.rank[y]:
                self.rank[y]+=1

    def size(self, x):
        """要素xの属している要素の数.

        x:要素
        """
        return -self.parents[self.find(x)]

    def same(self, x, y):
        """要素x,yは同一視されているか?

        x,y:要素
        """
        return self.find(x) == self.find(y)

    def members(self, x):
        """要素xが属している族の要素.
        ※族の要素の個数が欲しいときはsizeを使うこと!!

        x:要素
        """
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """族の名前のリスト
        """
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        """族の個数
        """
        return len(self.roots())

    def all_group_members(self):
        """全ての族の出力
        """
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
#================================================
N,M=map(int,input().split())
U=Union_Find(N)
for _ in range(M):
    X,Y,_=map(int,input().split())
    U.union(X-1,Y-1)

print(U.group_count())

Measured memory_bytes: 78284
#include <iostream>
#include <vector>
using namespace std;
int main(){
    long long N, M, Q;
    cin >> N >> M >> Q;
    vector<vector<int>> d(N + 1, vector<int> (N + 1, 0));
    for(int i = 0; i < M; i++){
        int l, r;
        cin >> l >> r;
        d[l][r]++;
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            d[i + 1][j + 1] = d[i + 1][j] + d[i + 1][j + 1];
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            d[j + 1][i + 1] = d[j][i + 1] + d[j + 1][i + 1];
        }
    }
    for(int i = 0; i < Q; i++){
        int p, q;
        cin >> p >> q;
        cout << d[q][q] - d[p - 1][q] - d[q][p - 1] + d[p - 1][p - 1] << endl;
    }
}

Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  int T[N];
  long long int all = 0LL;
  for(int i = 0; i < N; i++){
    cin >> T[i];
    all += T[i];
  }
  int M;
  cin >> M;
  pair<int, int> D[M];
  for(int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    a--;
    D[i] = make_pair(a, b);
  }
  
  for(int i = 0; i < M; i++){
    all -= T[D[i].first];
    all += D[i].second;
    cout << all << endl;
    all -= D[i].second;
    all += T[D[i].first];
  }
  



}


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

int main(){
    ll n;
    cin >> n;
    vector<ll> l(n+1,0);
    rep(i,n+1,1){
        Rep(j,n+1,i,i){
            l.at(j)++;
        }
    }
    ll ans=0;
    rep(i,n+1,1){
        ans+=i*l.at(i);
    }
    cout << ans << endl;
}


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

main(){
    int a , b , k;
    scanf("%d %d %d" , &a , &b , &k);

    for(int i = min(a , b) ; i >= 1 ; i --){
        if(a%i == 0 && b%i == 0){
            k --;
        }
        if(k == 0){
            printf("%d\n" , i);
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,v[500001],a[500001];
int pd(int l,int r){
	int i;
	if(l>r)return 0;
	if(l==r)return a[l]!=l;
	int mn=1e9,mx=0;
	for(i=l;i<=r;i++){
		mn=min(mn,a[i]);
		mx=max(mx,a[i]);
	}
	if(mn!=l||mx!=r)return 1;
	for(i=l+1;i<=r;i+=2)if(a[i]!=i)return 1;
	for(i=l;i<=r;i+=2)if(a[i]==i)return 1;
	int lax=0,lay=0;
	for(i=l;i<=r;i+=2){
		if(i<a[i]){
			if(a[i]<lax)return 1;
			lax=a[i];
		}
		if(i>a[i]){
			if(a[i]<lay)return 1;
			lay=a[i];
		}
	}
	return 0;
}
int main(){
	int i,la;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	for(i=1;i<=n;i++)v[i]=(a[i]==i);
	v[0]=1;
	la=1;
	for(i=1;i<=n;i++){
		if(v[i]==1&&v[i-1]==1){
			if(pd(la,i-2))return puts("No"),0;
			la=i+1;
		}
		 else if(v[i]==1&&v[i-2]==1)continue;
		  else if(v[i]==1&&v[i-3]==1){
		  	if(pd(la,i-2))return puts("No"),0;
		  	la=i-1;
		  }
		   else if(v[i])return puts("No"),0;
	}
	if(pd(la,n))puts("No");
	 else puts("Yes");
}

Measured memory_bytes: 2560
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Data.Array.Unboxed
import Data.List
import Data.Char
import qualified Data.ByteString.Char8 as B
main = replicateM 2 B.getLine >>= main'
    where
        main' [s, t] = readLn >>= flip replicateM breadIs >>= mapM_ B.putStrLn . solve s t

solve :: B.ByteString -> B.ByteString -> [[Int]] -> [B.ByteString]
solve ss ts = fmap mapf
    where
        mapf [a, b, c, d]
            | (sarr ! b - sarr ! (a - 1)) `mod` 3 == (tarr ! d - tarr ! (c - 1)) `mod` 3 = "YES"
            | otherwise = "NO"
        sarr = build ss
        tarr = build ts


build :: B.ByteString -> UArray Int Int
build bs = array (0, n) xs
    where
        (xs, n) = fst $ B.foldl' ff (([(0, 0)], 1), 0) bs
        ff ((ys, i), acc) b = (((i, next) : ys, i + 1), next)
            where
                next = acc + ord b - ord 'A' + 1

breadIs :: IO [Int]
breadIs = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)


Measured memory_bytes: 48892
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <iostream>
#include <sstream>
#include <random>
#include <cmath>
#include <cstring>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl

class timer {
    vector<timer> timers;
    int n = 0;
public:
    double limit = 9.8;
    double t = 0;
    timer() {}
    timer(int size) : timers(size) {}
    bool elapses() const {
        return time() - t > limit;
    }
    void measure() {
        t = time() - t;
        ++n;
    }
    void measure(char id) {
        timers[id].measure();
    }
    void print() {
        if (n % 2)
            measure();
        for (int i = 0; i < 128; ++i) {
            if (timers[i].n)
                cerr << (char)i << ' ' << timers[i].t << 's' << endl;
        }
        cerr << "  " << t << 's' << endl;
    }
    static double time() {
#ifdef LOCAL
        return __rdtsc() / 3.3e9;
#else
        unsigned long long a, d;
        __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
        return (d << 32 | a) / 2.8e9;
#endif
    }
} timer(128);

class {
    unsigned y = random_device()();
public:
    unsigned next() {
        return y ^= (y ^= (y ^= y << 13) >> 17) << 5;
    }
    int next(int b) {
        return next() % b;
    }
    int next(int a, int b) {
        return next(b - a) + a;
    }
    double nextDouble(double b = 1) {
        return b * next() / 4294967296.0;
    }
    double nextDouble(double a, double b) {
        return nextDouble(b - a) + a;
    }
    int operator() (int b) {
        return next(b);
    }
} rando;

int main() {
    string s;
    int w;
    while (cin >> s >> w) {
        for (int i = 0; i < (int)s.size(); i += w)
            cout << s[i];
        cout << endl;
    }
    return 0;
}


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

using namespace std;

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

    vector<int> p(m), y(m);
    vector<vector<int>> city_count(n);
    for (int i=0; i<m; i++) {
        cin >> p[i] >> y[i];
        city_count[p[i]-1].push_back(y[i]);
    }

    for (int i=0; i<n; i++)
        sort(city_count[i].begin(), city_count[i].end());

    for (int i=0; i<m; i++) {
        int id = distance(city_count[p[i]-1].begin(), lower_bound(city_count[p[i]-1].begin(), city_count[p[i]-1].end(), y[i]))+1;
        printf("%06d%06d\n", p[i], id);
    }
}


Measured memory_bytes: 7808
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
double dp[305][305][305],ep[305][305][305];

int main() {
	int n,j,k;
	cin>>n;
	vector<int> c(4);
	
	
	int i; 
	for(i=0;i<n;i++)
{	
    cin>>j;
    c[j]++;
}
dp[c[1]][c[2]][c[3]]=1;

	for(i=n;i>=0;i--)
	for(j=n;j>=0;j--)
	for(k=n;k>=0;k--)
	{  
         if(i == 0 && j == 0 &&  k==0)
         continue;
         
	    if(i+j+k>n)
	    continue;
	    
         
	    double p1=(double)(n-(i+j+k))/n;
	    
	    double e1=p1/(1-p1)+1;
	    ep[k][j][i]+=(double)e1*dp[k][j][i];
	    if(k!=0)
	    {
	        dp[k-1][j][i]+=dp[k][j][i]*(double)k/(i+j+k);
	        ep[k-1][j][i]+=ep[k][j][i]*(double)k/(i+j+k);
	    }
	    if(j!=0)
	    {
	        dp[k+1][j-1][i]+=dp[k][j][i]*(double)j/(i+j+k);
	       ep[k+1][j-1][i]+=ep[k][j][i]*(double)j/(i+j+k);
	    }
	    if(i!=0)
	    {
	        dp[k][j+1][i-1]+=dp[k][j][i]*(double)i/(i+j+k);
	        ep[k][j+1][i-1]+=ep[k][j][i]*(double)i/(i+j+k);
	    }
	    
	}
	
	cout<<setprecision(15)<<ep[0][0][0];
	return 0;
	
}


Measured memory_bytes: 438528
H,W=list(map(int, input().split()))
G=[['#' for j in range(W+1)]]
for i in range(H):
    G.append(['#']+(list(input())))
# print(G)
C=10**9+7

# dp[i][j]:(i,j)に辿り着く場合の数
# 左や上に壁がないときその場合の数を加算
# 上の行と左の列に壁'#'を追加することにする
# Gだけ1-indexなことに注意

dp=[[0 for j in range(W)] for i in range(H)]
dp[0][0]=1

for i in range(H):
    for j in range(W):
        if G[i+1][j+1]=='#':
            continue
        if G[i][j+1]!='#':
            dp[i][j]+=dp[i-1][j]
            dp[i][j]%=C
        if G[i+1][j]!='#':
            dp[i][j]+=dp[i][j-1]
            dp[i][j]%=C
    # print(dp[i])
print(dp[H-1][W-1])

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define double      long double
//std::cout << std::fixed;std::cout << std::setprecision(10);

const int N=1e5 + 5;
const int M=1e9 + 7;

string s;

string sub(int l,int r)
{
	string str = "";
	rep(i,l,r)
	{
		str += s[i];
	}
	return str;
}

int32_t main()
{
	IOS;
	//memset(dp,-1,sizeof(dp));
	int n;
	cin >> n;
	cin >> s;
	if(n%2==1)
	{
		cout << "No" << endl;
		return 0;
	}
	int x = n/2;
	string s1 = sub(0,x-1);
	string s2 = sub(x,n-1);
	if(s1!=s2)
	{
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int N = 1000 + 5;
 
int main()
{
	int turtle,crane;
	int sum, ans;
	cin >> sum >> ans;
	turtle = (ans - 2 * sum) / 2;
	crane = sum - turtle;
	if(turtle >= 0 && crane >= 0 && turtle*4+2*crane == ans)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
    return 0; 
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const signed INF_=1001001001; const ll INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
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(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N=IN;
    int x=0,y=0;
    int t=0;
    REP(i,N) {
        int T=IN;
        int X=IN,Y=IN;
        int dX=abs(X-x);
        int dY=abs(Y-y);
        int dT=abs(T-t);
        if(!(dX+dY<=dT && (dT-dX-dY)%2==0)) {
            cout<<"No"<<endl;
            return 0;
        }
        x=X,y=Y,t=T;
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
ans = []
def divisor(n):
  ret = [0]
  for i in range(2,int(n**(1/2))+1):
    if n%i==0:
      ret.append(i-1)
      
      comp=n//i
      if i!=comp:
        ret.append(comp-1)
      
  return ret

for i in reversed(range(N)):
  if a[i]:
    ans.append(i+1)
    lis = divisor(i+1)
    for j in lis:
      a[j]^=1
      
l = len(ans)
if l>0:
  print(l)
  print(*ans)
else:
  print(l)

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

#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#define endl        '\n'
#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

namespace InOp{
template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
}
using namespace InOp;

namespace ModOp{
template<class x,class y,class z> z add(x a,y b,z m){return (a+b)%m;}
template<class x,class y,class z> z sub(x a,y b,z m){return (a-b+m)%m;}
template<class x,class y,class z> z mul(x a,y b,z m){return ((ll)a*b)%m;}
template<class y,class z> z expo(ll b,y e,z m){ll a=1;b%=m;while(e!=0){if((e&1)==1){a=a*b;a=a%m;}b=b*b;b%=m;e>>=1;}return a%m;}
template<class x,class z> z inv(x b,z m){return expo(b,m-2,m);}
template<class x,class y> x invGeneral(x a,y b){if(a==0)return b==1?0:-1;x m=invGeneral(b%a,a);return m==-1?-1:((1-(ll)b*m)/a+b)%b;}
template<class x,class y,class z> z div(x a,y b,z m){ll c=inv(b,m);return mul(a,c,m);}
}
using namespace ModOp;

namespace Debug{
template<class x> void deb(x a){cerr<<"a"<<": "<<a<<endl;}
template<class x,class y> void deb(x a,y b){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<endl;}
template<class x,class y,class z> void deb(x a,y b,z c){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<endl;}
template<class x,class y,class z,class xy> void deb(x a,y b,z c,xy d){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<" | "<<"d"<<": "<<d<<endl;}
}
using namespace Debug;

#define N  1000005

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
        ll i,j,k,l,r,x,y,m,n;
        ll a,b,c;
        cin>>a>>b>>c;
        cin>>k;
        ll ans=0;
        while(b<=a)
        {
            b*=2;
            ans++;
        }
        while(c<=b)
        {
            c*=2;
            ans++;
        }
        if(ans<=k)cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int k;
typedef long long ll;
int main()
{
	queue<long long> q;
	cin >> k;
	for(int i = 1; i <=9; i++) q.push(i);
	while(!q.empty())
	{
		ll x=q.front();
		q.pop(),k--;
		if(k == 0)
		{
			cout << x;
			return 0;
		 } 
		 else
		 {
		 	for(int j = x%10-1; j <= x%10+1; j++)
		 	{
		 		if(j < 0 || j > 9) continue;
		 		q.push(x*10+j);
			 }
		 }
	}
	return 0;
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string a,b;
	int c,d;
	cin>>a>>b;
	if(a.length()>b.length()){
		cout<<"GREATER"<<endl;
	}else if(a.length()<b.length()){
		cout<<"LESS"<<endl;
	}else{
		for(int i=0;i<a.length();i++){
			c=stoi(a.substr(i,1));
			d=stoi(b.substr(i,1));
			if(c>d){
				cout<<"GREATER"<<endl;
				return 0;
			}else if(c<d){
				cout<<"LESS"<<endl;
				return 0;
			}
		}
		cout<<"EQUAL"<<endl;
	}

}


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

#ifdef DEBUG
#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))

#define LOGM(msg) (cerr << (msg))

#define LOGV(vec, sep) {                                        \
    cerr << #vec << " =";                                       \
    for (const auto& v : (vec)) cerr << " " << v;               \
    cerr << (sep); }

#define LOGA(arr, N, sep) {                                     \
        cerr << #arr << " =";                                   \
        for (int i = 0; i < N; ++i) cerr << " " << (arr)[i];    \
        cerr << (sep); }

#define LOGA2(arr, N, M, sep) {                                 \
        cerr << #arr << " =\n";                                 \
        for (int i = 0; i < N; ++i) {                           \
            for (int j = 0; j < M; ++j)                         \
                cerr << (arr)[i][j] << " ";                     \
            cerr << endl;                                       \
        } cerr << (sep); }
#else
#define LOG(var, sep)
#define LOGM(msg)
#define LOGV(vec, sep)
#define LOGA(arr, N, sep)
#define LOGA2(arr, N, M, sep)
#endif

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll solve(int N, const vector<ll>& xs)
{
    return 0;
}

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

    int X;
    cin >> X;

    cout << (X >= 30 ? "Yes" : "No") << '\n';

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
   
const ll Mod = 1e9 + 7;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
    int n ; cin >> n;
    ll A[n] , sum = 0;
    for(int i = 0 ;i < n ; i++){
        cin >> A[i];
        A[i] *= 2;
        sum += A[i];
    }
    ll tot = sum/2;
    
    ll Ans[n] , tmp = 0;
    for(int i = 1 ;i < n-1 ; i+= 2)
        tmp += A[i];
    
    Ans[0] = (tot-tmp);
    
    for(int i = 1 ;i < n; i++)
        Ans[i] = A[i-1] - Ans[i-1];
    
    for(int i = 0 ;i < n ; i++)
        cout << Ans[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        //Scanner
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String p = sc.nextLine();
        sc.close();
        //sをつなげる
        s = s + s;
        //条件分岐
        String result = s.contains(p) ? "Yes":  "No";
        //結果表示
        System.out.println(result);
        

    }

}

Measured memory_bytes: 17236
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, a, b, c, d;
    cin>>n>>a>>b>>c>>d;

    ll r = a + (n - 1) * d, l = a + (n - 1) * c;
    rep(i, n - 1) {
        if (b >= l && b <= r) {
            cout<<"YES"<<endl;
            return 0;
        }
        r -= c + d;
        l -= c + d;
    }
    cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	
	int a,b,c,d,e;
	cin >> a >> b >> c >> d >> e;
	int answer = -a * c + d + b * e;
	if (a < 0) {
		answer = -a *c + d + b * e;
	}
	if (a>0) {
		answer = ( b - a )* e;
	}
	cout << answer << endl;
	
}


Measured memory_bytes: 3080
N,A,B = map(int,input().split())
MOD = 10**9+7

ans = pow(2,N,MOD)-1
Ab,Ac = 1,1
for i in range(A):
    Ac = ((N-i)*Ac)%MOD
    Ab = (Ab*(i+1))%MOD
Bb,Bc = 1,1
for i in range(B):
    Bc = ((N-i)*Bc)%MOD
    Bb = (Bb*(i+1))%MOD
A = Ac * pow(Ab,MOD-2,MOD)
B = Bc * pow(Bb,MOD-2,MOD)


ans = (ans-A-B)%MOD

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,j,v,n,a[1000];
  cin>>n;
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  
  for(i=1;i<n;i++){
     for(j=0;j<n;j++){
      if(j==n-1)cout<<a[j];
      else cout<<a[j]<<" ";
    }
    cout<<endl;
    v=a[i];
    j=i-1;
    while(j>=0&&a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
  }
  for(j=0;j<n;j++){
    if(j==n-1)cout<<a[j];
    else cout<<a[j]<<" ";
  }
  cout<<endl;
  
  return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define assign(x,val) memset(x,val,sizeof(x))
#define all(x) (x).begin(), (x).end()
#define for0(i,n) for(ll i=0;i<n;++i)
#define for1(i,n) for(ll i=1;i<=n;++i)
#define ford(i,n) for(ll i=n;i>=1;--i)
#define forg(i,a,b) for(ll i=a;i<b;++i)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpl;
long long mod = 1000000007;
const long double PI = (long double)(3.1415926535897932384626433832795);
 
 
void solve(){
  int n;cin>>n;
  int arr[n];
  for0(i,n) cin>>arr[i];
  int cnt = 0, go = 1;
  for0(i,n){
    if(arr[i]==go){
      ++go;
      ++cnt;
    }
  }
  if(cnt) cout<< n - cnt<<endl;
  else cout<< -1<<endl;
}
 
int main(){
	ll t = 1;
	//cin>>t;
	for0(i, t){
		solve();
	}
	return 0;
}

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

using namespace std;

typedef long long Int;

struct Circle {
	int x, y, z;
	int r;
	Int p;
};

inline double sq(double v)
{
	return (v * v);
}

inline double dist(double x, double y, double z, Circle c)
{
	return (sqrt(sq(x - c.x) + sq(y - c.y) + sq(z - c.z)));
}

int main()
{
	int N, Q;

	scanf("%d %d", &N, &Q);

	Circle circ[50];

	for (int i = 0; i < N; i++) scanf("%d %d %d %d %lld", &circ[i].x, &circ[i].y, &circ[i].z, &circ[i].r, &circ[i].p);

	for (int i = 0; i < Q; i++){
		int sx, sy, sz, dx, dy, dz;
		scanf("%d %d %d %d %d %d", &sx, &sy, &sz, &dx, &dy, &dz);

		dx -= sx; dy -= sy; dz -= sz;

		Int ans = 0;
		for (int j = 0; j < N; j++){
			double lf = 0, rg = 1;
			bool inside = false;
			for (int k = 0; k < 100; k++){
				double p1 = (2 * lf + rg) / 3, p2 = (lf + 2 * rg) / 3;
				double p1x = sx + p1 * dx, p1y = sy + p1 * dy, p1z = sz + p1 * dz;
				double p2x = sx + p2 * dx, p2y = sy + p2 * dy, p2z = sz + p2 * dz;
				double d1 = dist(p1x, p1y, p1z, circ[j]), d2 = dist(p2x, p2y, p2z, circ[j]);
				if (d1 < d2) rg = p2;
				else lf = p1;
				if (min(d1, d2) <= circ[j].r) inside = true;
			}
			ans += inside * circ[j].p;
		}
		printf("%lld\n", ans);
	}

	return (0);
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

string A, B, C;

signed main()
{
    cin >> A >> B >> C;
    if(A[A.length()-1] == B[0] && B[B.length()-1] == C[0]) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

uint64_t dp[100000+1][13];
string s;
static const uint64_t divnum = 1000000007LL;

void printdp() {
    int i, j;
    cout << "call printdp\n";
    for (i = 1; i <= s.length(); i++) {
        for (j = 0; j < 13; j++) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
}

int main(void) {
    uint64_t i, j, k, d, dmod;
    int mul = 1;
    
    cin >> s;
    reverse(s.begin(), s.end());
    dp[0][0] = 1;
    for (i = 0; i < s.length(); i++) {
        if (s[i] == '?') {
            for (j = 0; j < 10; j++) {
                for (k = 0; k < 13; k++) {
                    dp[i+1][(j*mul+k)%13] += dp[i][k];
                }
            }
        } else {
            j = s[i] - '0';
            for (k = 0; k < 13; k++) {
                dp[i+1][(j*mul+k)%13] += dp[i][k];
            }
        }
        for (j = 0; j < 13; j++) dp[i+1][j] %= divnum;
        //printdp();
        mul *= 10;
        mul %= 13;
    }
    cout << dp[s.length()][5] << endl;
    return 0;
}


Measured memory_bytes: 10624
#include <iostream>

using namespace std;

void add(int a, int b) {
    cout << (a+b);
    return;
}

void sub(int a, int b) {
    cout << (a-b);
    return;
}

int main () {
    int a,b;
    char op;
    cin >> a >> op >> b;
    if (op == '+')
        add(a,b);
    else 
        sub(a,b);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int r=sc.nextInt();
int c =sc.nextInt();
int [][]hy =new int[r+1][c+1];
for(int i=0; i<r; i++){
	for(int s=0; s<c; s++){
		hy[i][s]=sc.nextInt();
	}
}
for(int l=0; l<c+1; l++){
	for(int m=0; m<r+1; m++){
		if(m<r) hy[r][l] += hy[m][l];
		}
	}
for(int j=0; j<r+1; j++){
	for(int k=0; k<c+1; k++){
		if(k<c){System.out.print(hy[j][k]+" ");
		hy[j][c] += hy[j][k];
		}
		else System.out.println(hy[j][k]);
	}
}
}
}

Measured memory_bytes: 39336
#include<bits/stdc++.h>
//#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const ll mask30 = (1ll << 30) - 1;
const ll mask31 = (1ll << 31) - 1;
const ll RHmod = (1ll << 61) - 1;
const ll len = 1000100;
ll POW[len + 1], RH[len + 1];
ll RHmul(ll A, ll B) {
	ll A1 = A >> 31;
	ll A2 = A & mask31;
	ll B1 = B >> 31;
	ll B2 = B & mask31;
	ll ret = 2 * A1 * B1 + A2 * B2 + ((A1 * B2 + A2 * B1 & mask30) << 31) + (A1 * B2 + A2 * B1 >> 30);
	return ret % RHmod;
}
ll RHcalc(int i, int j) {
	ll kari = (RH[j] - RH[i] + RHmod) % RHmod;
	return RHmul(kari, POW[len - i]);
}


int E[500001] = {};
int N;
int memo[500001];
int mugen;
int sagasu(int A, int B) {
	if (memo[A] >= 0) return memo[A];
	if (mugen) return 0;
	if (A == B) {
		mugen = 1;
		return 0;
	}
	if (B == -1) B = A;
	if (E[A] == -1) return memo[A] = 0;
	return memo[A] = sagasu(E[A], B) + 1;
}

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


	string S, T;
	cin >> S >> T;

	N = S.size();
	while(S.size() < max(N * 2, (int)T.size() * 2)) S += S;
	int N2 = min(1000010, (int)S.size());
	int M = T.size();

	POW[0] = 1;
	rep(i, len) POW[i + 1] = RHmul(POW[i], 30);
	RH[0] = 0;
	rep(i, N2) RH[i + 1] = (RH[i] + RHmul(POW[i], S[i] - 'a' + 1)) % RHmod;

	ll RHT = 0;
	rep(i, M) RHT = (RHT + RHmul(POW[i], T[i] - 'a' + 1)) % RHmod;
	RHT = RHmul(RHT, POW[len]);

	rep(i, N) {
		if (RHT == RHcalc(i, i + M)) E[i] = (i + M) % N;
		else E[i] = -1;
	}

	rep(i, N) memo[i] = -1;

	int kotae = 0;
	rep(i, N) {
		kotae = max(kotae, sagasu(i, -1));
		if (mugen) break;
	}
	
	if (mugen) co("-1");
	else co(kotae);

	Would you please return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define rep(i, j, k) for (int i = j; i < k; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define mt make_tuple

#define iv inline void
#define ii inline int
#define ill inline ll

template <typename S, typename T>
inline bool smin(S &l, T r) {
  return r < l ? l = r, 1 : 0;
}
template <typename S, typename T>
inline bool smax(S &l, T r) {
  return l < r ? l = r, 1 : 0;
}

constexpr int MOD = 1e9 + 7;  // 998244353;

template <typename S>
inline S mod(S &l) {
  return l = (l % MOD + MOD) % MOD;
}
template <typename S, typename T>
inline S add(S &l, T r) {
  return mod(l += r);
}
ill po(ll v, ll u) {
  return u ? po(v * v % MOD, u >> 1) * (u & 1 ? v : 1) % MOD : 1;
}

void fileIO(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}

constexpr int N = 1e6 + 10;

int n, m, a[N], b[N], color[N];
ll n_[3], answer, cnt;
vi adj[N];

bool dfs(int v) {
  bool flag = false;
  for (auto e : adj[v]) {
    cnt++;
    int must = (color[v] + (v == b[e])) % 3 + 1;
    int u = a[e] ^ b[e] ^ v;
    if (color[u])
      flag |= color[u] != must;
    else {
      color[u] = must;
      flag |= dfs(u);
    }
  }
  n_[color[v] - 1]++;
  return flag;
}

int main() {
#ifndef LOCAL
  // fileIO("");
#endif

  cin >> n >> m;

  rep(i, 0, m) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    adj[a[i]].pb(i);
    adj[b[i]].pb(i);
  }

  rep(i, 0, n) if (!color[i]) {
    color[i] = 1;
    if (dfs(i)) {
      ll val = accumulate(n_, n_ + 3, 0);
      answer += val * val;
    } else if (*min_element(n_, n_ + 3) == 0)
      answer += cnt / 2;
    else
      rep(i, 0, 3) answer += n_[i] * n_[(i + 1) % 3];
    memset(n_, 0, sizeof(n_));
    cnt = 0;
  }

  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 38272
import math
h,w = map(int,input().split())
ans = 0
if h == 1 or w == 1:
    ans = 1
elif (h % 2 == 0 and w % 2 == 1) or (w % 2 == 0 and h % 2 == 1) or (h % 2 == 0 and w % 2 == 0):
    ans += (h/2)*w
else:
    ans += (math.ceil(h/2)*math.ceil(w/2)+math.floor(h/2)*math.floor(w/2))
print(round(ans))

Measured memory_bytes: 3064
def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  a,b = list(map(int,input().split()))
  #c = [input().split() if i in range(n)]
  ans = 0
  
  for i in range(2):
    if a >= b:
      ans += a
      a -= 1
    else:
      ans += b
      b -= 1
  print(ans)
  
if __name__ == '__main__':
  main()

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

//????????¨??¢??°???
string MrJ(string s)
{
    string res = "";
    int len = s.length();
    res += s[len - 1];
    for (int i = 0; i < len - 1; i++)
        res += s[i];
    return res;
}
string MissC(string s)
{
    string res = "";
    int len = s.length();
    for (int i = 1; i < len; i++)
        res += s[i];
    res += s[0];
    return res;
}
string MrE(string s)
{
    string res = "";
    int len = s.length();
    if (len % 2 == 0)
    {
        for (int i = len / 2; i <= len - 1; i++)
            res += s[i];
        for (int i = 0; i <= len / 2 - 1; i++)
            res += s[i];
    }
    else
    {
        for (int i = (len + 1) / 2; i <= len - 1; i++)
            res += s[i];
        res += s[(len - 1) / 2];
        for (int i = 0; i <= (len - 3) / 2; i++)
            res += s[i];
    }
    return res;
}
string MrA(string s)
{
    string res = "";
    int len = s.length();
    for (int i = len - 1; 0 <= i; i--)
        res += s[i];
    return res;
}
string DrP(string s)
{
    string res = "";
    int len = s.length();
    for (int i = 0; i < len; i++)
    {
        if (48 < s[i] && s[i] <= 57)
        {
            res += s[i] - 1;
        }
        else if (s[i] == 48)
            res += "9";
        else
            res += s[i];
    }
    return res;
}
string MrM(string s)
{
    string res = "";
    int len = s.length();
    for (int i = 0; i < len; i++)
    {
        if (48 <= s[i] && s[i] < 57)
        {
            res += s[i] + 1;
        }
        else if (s[i] == 57)
            res += "0";
        else
            res += s[i];
    }
    return res;
}

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

    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string order;
        string s;
        cin >> order >> s;
        int len = order.length();
        for (int j = len - 1; 0 <= j; j--)
        {
            if (order[j] == 'J')
                s = MrJ(s);
            else if (order[j] == 'C')
                s = MissC(s);
            else if (order[j] == 'E')
                s = MrE(s);
            else if (order[j] == 'A')
                s = MrA(s);
            else if (order[j] == 'P')
                s = DrP(s);
            else
                s = MrM(s);
        }
        cout << s << endl;
    }
}


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

int main() {
  string s;
  cin >> s;
  bool flg = false;
  for(int i = 0; i < s.size(); i++){
    if(flg){
      if(s[i] == 'C'){
        cout << "Yes" << endl;
        return 0;
      }else{
        flg =false;
      }
    }else{
      if(s[i] == 'A') flg = true;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): #xは64bit整数
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, D = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    d2=D**2
    cnt=0
    for x,y in S:
        if x**2+y**2<=d2:
            cnt+=1
    print(cnt)


if __name__ == "__main__":
    main()


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

int main(){
    int N, X;
    cin >> X >> N;
    vector<bool> num(101, true);

    int p[N];

    for(int i=0; i<N; i++){
        cin >> p[i];
        num[p[i]] = false;
    }


    for(int i=0; i<N+10; i++){
        bool flag_l = false;
        bool flag_r = false;

        if(num[X-i]){
            flag_l=true;
        }if(num[X+i]){
            flag_r = true;
        }

        if(flag_l){
            cout << X-i << endl;
            return 0;
        }if(flag_r){
            cout << X+i << endl;
            return 0;
        }
        
    }
    
}

Measured memory_bytes: 3632
#include <stdio.h>
 
int a,b,c,ans=3 ;
 
int main(void){
    
    scanf ("%d%d%d",&a,&b,&c) ;
    
    if (a==b) {
        ans-- ;
    }
    if (b==c) {
        ans-- ;
    }
    if (c==a) {
        ans-- ;
    }
    if (a==b && b==c) {
        ans++ ;
    }
    
    printf ("%d",ans) ;
    
    return 0 ;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, h;
    cin >> n >> h;

    vector<int> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];
    sort(all(a),greater<int>());
    sort(all(b),greater<int>());

    int ans = 0;
    REP(i, n){
        if(a[0] > b[i] || h <= 0) break;
        h -= b[i];
        ans++;
    }
    if(h > 0) ans += ceil(1.0*h/a[0]);
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
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(){
    int n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n){
        cin >> a[i];
    }
    ll fi=0;
    rep(i,n){
        if(i%2==1)fi-=a[i];
        else fi+=a[i];
    }
    fi/=2;
    vector<ll>ans(n);
    ans[0]=fi;
    rep(i,n-1){
        ans[i+1]=a[i]-ans[i];
    }
    rep(i,n)ans[i]*=2;
    rep(i,n){
        cout << ans[i] <<endl;
    }
    return 0;
}

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

int main(){
  int N;
  cin >>N;
  vector<int> V(N);
  for(int i=0;i<N;i++){
    cin >>V.at(i);
  }
  set<int> S;
  
  for(int i=0;i<N;i++){
    S.insert(V.at(i));
  }
  if(V.size() == S.size()){
    cout <<"YES"<<endl;
  }
  else {
    cout << "NO" << endl;
  }
}


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

using namespace std;

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

  std::vector<int> A(n);
  for(int i=0; i<n; ++i){
    cin >> A[i];
  }

  int q;
  cin >> q;

  int b, e, k;
  int count = 0;
  for(int i=0; i<q; ++i){
    cin >> b >> e >> k;
    for(int j=b; j<e; ++j){
      if(A[j] == k) count ++;
    }
    cout << count << endl;
    count = 0;
  }

  return 0;
}


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

int main()
{
  int n,flag = 1;;
  cin>>n;
  string str = to_string(n);
  for(int i=0;i<str.length();i++)
  {
    if(str[i] == '7')
    {
      flag = 0;
      cout<<"Yes";
      break;
    }
  }
  if(flag)
    cout<<"No";


  return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<long long>a(n);
  vector<long long>sum(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sum[0]=a[0];
  for(int i=1;i<n;i++){
    sum[i]=a[i]+sum[i-1];
  }
  long long sa=LLONG_MAX;
  for(int i=0;i<n-1;i++){
    long long a=sum[i];
    long long b=sum[n-1]-sum[i];
    //cout<<a<<" "<<b<<endl;
    sa=min(sa,abs(a-b));
  }
  cout<<sa<<endl;
  return 0;
}

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

using ll=long long;



void solve(){
    char c;
    cin>>c;
    map<char, char> a;
    a['A']='T';
    a['C']='G';
    a['G']='C';
    a['T']='A';
    cout<<a[c]<<endl;
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256