akhauriyash/Code-Regression huggingface dataset:
import sys


def main():
    t = input()
    s = input()

    appear_pos = {}  # 文字が出てくる場所
    for idx, T in enumerate(t):
        if T not in appear_pos:
            appear_pos[T] = [idx]
        else:
            appear_pos[T].append(idx)

    search_idx = {}
    for key in appear_pos.keys():
        search_idx[key] = -1

    loop_count = 0
    find_idx = -1
    for S in s:
        if S not in appear_pos:
            print(-1)
            sys.exit()

        while True:
            search_idx[S] += 1
            if len(appear_pos[S]) == search_idx[S]:
                # 次のループに移動する
                loop_count += 1
                for key in appear_pos.keys():
                    search_idx[key] = -1
                find_idx = appear_pos[S][0]
                break

            idx_new = appear_pos[S][search_idx[S]]
            if idx_new > find_idx:
                find_idx = idx_new
                break

    print(find_idx+loop_count*len(t)+1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 46320
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        int train = a <= b ? a : b;
        int bus = c <= d ? c : d;

        System.out.println(train + bus);
    }
}


Measured memory_bytes: 21844
w, h, x, y = map(lambda x: int(x), input().split())

def is_eq(x, y):
    if abs(x-y) < 1e-9:
        return True
    else:
        return False

if is_eq(w/2, x) and is_eq(h/2, y):
    print("{} 1".format(w*h/2))
else:
    print("{} 0".format(w*h/2))


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

int main(){
	int n;
	int cnt_AC=0;
	int cnt_WA=0;
	int cnt_TLE=0;
	int cnt_RE=0;
	cin>>n;
	rep(i,n){
		string s;
		cin>>s;
		if(s=="AC"){
			cnt_AC++;
		}
		else if(s=="WA"){
			cnt_WA++;
		}
		else if(s=="TLE"){
			cnt_TLE++;
		}
		else if(s=="RE"){
			cnt_RE++;
		}
	}
	cout<<"AC x "<<cnt_AC<<endl;
	cout<<"WA x "<<cnt_WA<<endl;
	cout<<"TLE x "<<cnt_TLE<<endl;
	cout<<"RE x "<<cnt_RE<<endl;

	return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <string>
 
using namespace std;
 
char calc(char x,char y,char z,bool &C){
  int a = x - '0',b = y - '0',c = z - '0';
  int d = a + b + c;
 
  if(d >= 10){
    C = true;
    d -= 10;
  }
 
  return d + '0';
}
 
string sum(string a,string b){
  string res = "";
 
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
 
  int length;
  if((int)a.size() > (int)b.size()){
    length = (int)a.size();
     
    for(int i = (int)b.size() ; i < length ; i++){
      b += '0';
    }
 
  }
  else{
    length = (int)b.size();
 
    for(int i = (int)a.size() ; i < length ; i++){
      a += '0';
    }
 
  }
 
  for(int i = 0 ; i <= length ; i++)
    res += '0';
 
  for(int i = 0 ; i < length ; i++){
    bool C = false;
    res[i] = calc(a[i],b[i],res[i],C);
    if(C) res[i+1] = ((res[i+1]-'0') + 1) + '0';
  }
 
  for(int i = length ;; i--){
     
    if(res[i] == '0'){
      res.erase(res.begin()+i);
    }
    else{
      break;
    }
     
  }
 
  reverse(res.begin(),res.end()); 
 
  return res;
}

int main(){
  int n;

  cin >> n;
  while(n--){
    string a,b;

    cin >> a >> b;

    if(a == "0" && b == "0"){
      cout << "0" << endl;
      continue;
    }

    string c = sum(a,b);    

    if((int)c.size() > 80) cout << "overflow" << endl;
    else cout << c << endl;
  }

  return 0;
}

Measured memory_bytes: 1220
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main() {
    int N;
    cin >> N;
    vector<int> ais;
    ais.push_back(-1);
    for (int i = 0; i < N; i++) {
        int ai;
        cin >> ai;
        ais.push_back(ai);
    }
    vector<int> put(N+1, -1);
    for (int i = N; i >= 1; i--) {
        int sum = 0;
        int j = i;
        while (true) {
            j += i;
            if (j > N) {
                break;
            }
            sum += put[j];
            sum = sum % 2;
        }
        if (sum == ais[i]) {
            put[i] = 0;
        } else {
            put[i] = 1;
        }
    }
    vector<int> ans;
    for (int i = 1; i <= N; i++) {
        if (put[i]) {
            ans.push_back(i);
        }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i];
        if (i < ans.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;
}



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

int main() {
    string s;
    cin >> s;
    int counter = 0;
    if (s[0] == '1') ++counter;
    if (s[1] == '1') ++counter;
    if (s[2] == '1') ++counter;
    cout << counter << endl;
    return 0;
}


Measured memory_bytes: 256
A,B,C = (int(X) for X in input().split())
K = int(input())
Count = 0
while True:
    if B>A:
        break
    else:
        B *= 2
        Count += 1
while True:
    if C>B:
        break
    else:
        C *= 2
        Count += 1
if Count<=K:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
int fare[101][101], dist[21][101][101];
int P[21];
int N, M, C, S, G;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N >> M >> C >> S >> G && N){
        S--; G--;
        rep(i, 21) rep(j, 101) rep(k, 101) dist[i][j][k] = INF;
        rep(i, 21) rep(j, 101) dist[i][j][j] = 0;
        rep(i, 101) rep(j, 101) fare[i][j] = INF;
        rep(i, 101) fare[i][i] = 0;
        int x_, y_, d_, c_;
        rep(i, M){
            cin >> x_ >> y_ >> d_ >> c_;
            x_--; y_--; c_--;
            dist[c_][x_][y_] = dist[c_][y_][x_] = min(dist[c_][x_][y_], d_);
        }
        rep(c, C) rep(k, N) rep(i, N) rep(j, N)
          dist[c][i][j] = min(dist[c][i][j], dist[c][i][k] + dist[c][k][j]);
        rep(i, C) cin >> P[i];
        rep(c, C){
            vector<int> Q(P[c] + 1, INF), R(P[c]), f(P[c]);
            REP(i, 1, P[c]) cin >> Q[i];
            Q[0] = 0;
            rep(j, P[c]) cin >> R[j];
            f[0] = 0;
            REP(i, 1, P[c]) f[i] = R[i - 1] * (Q[i] - Q[i - 1]) + f[i - 1];
            rep(i, N - 1) REP(j, i + 1, N){
                if(dist[c][i][j] == INF) continue;
                int it = lower_bound(Q.begin(), Q.end(), dist[c][i][j]) - Q.begin();
                it--;
                int temp = f[it] + R[it] * (dist[c][i][j] - Q[it]);
                fare[i][j] = fare[j][i] = min(fare[i][j], temp);
            }
        }
        rep(k, N) rep(i, N) rep(j, N) fare[i][j] = min(fare[i][j], fare[i][k] + fare[k][j]);
        int ans = fare[S][G];
        if(ans == INF) ans = -1;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2080
#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()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    if ((a * 100 + b * 10 + c) % 4 == 0)
    {
        cout << "YES" << endl;
        return (0);
    }
    cout << "NO" << endl;
    return (0);
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int N;
    cin >> N;
    vector<int> V(N);
    rep(i, N) cin >> V.at(i);
    vector<int> C(N);
    rep(i, N) cin >> C.at(i);

    int sum = 0;
    rep(i, N) {
        if(V.at(i) > C.at(i)) sum+= V.at(i) - C.at(i);
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
using System;
class Program
    {
        static void Main(string[] args)
        {
            var numList = System.Console.ReadLine().Split(' ');
            var a = Int32.Parse(numList[0]);
            var b = Int32.Parse(numList[1]);
            var c = Int32.Parse(numList[2]);
            var result = a <= c && c <= b;
            System.Console.WriteLine(result? "Yes":"No");
            System.Console.Read();
        }
    }

Measured memory_bytes: 13140
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n;
    cin>>n;
    string w[101];
    bool ans=true;
    for(int i=0;i<n;i++){
        cin>>w[i];
        for(int j=0;j<i;j++){
            if(w[i]==w[j]) ans=false;
        }
        if(i!=0){
            if(w[i].front()!=w[i-1].back()) ans=false;
        }
    }
    if(ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

const LL inf = (1LL << 31) - 1;

class RMQ
{
private:
	LL n;
	std::vector<LL>dat;

public:
	void init(LL n_)
	{
		n = 1;
		while (n < n_) n *= 2;
		dat.resize(2 * n - 1, inf);
	}

	void update(LL k, LL x)
	{
		k += n - 1;
		dat[k] = x;
		while (k > 0)
		{
			k = (k - 1) / 2;
			dat[k] = std::min(dat[2 * k + 1], dat[2 * k + 2]);
		}
	}

	// [a, b)
	LL get_min(LL a, LL b, LL k = 0, LL l = 0, LL r = -1)
	{
		if (r < 0) r = n;
		if (b <= l || r <= a) return inf;
		if (a <= l && r <= b) return dat[k];
		LL vl = get_min(a, b, k * 2 + 1, l, (l + r) / 2);
		LL vr = get_min(a, b, k * 2 + 2, (l + r) / 2, r);
		return std::min(vl, vr);
	}
};

int main()
{
	LL n, q;
	in >> n >> q;

	RMQ tree;
	tree.init(n);
	rep(loop, q)
	{
		LL com, x, y;
		in >> com >> x >> y;
		if (com == 0) tree.update(x, y);
		else out << tree.get_min(x, y + 1) << std::endl;
	}
}



Measured memory_bytes: 4872
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

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

    int cnt = 0;
    if (N % 2 == 1){
        cnt++;
    }
    cnt = cnt + N / 2;
    
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
A, B, C = map(int, input().split())
D = A % B 
ans_list = list()


for i in range(100000):
  E = D*i % B
  if E in ans_list:
    break
  ans_list.append(E)
  
    
if C in ans_list:
  print("YES")
else:
  print("NO")
  

Measured memory_bytes: 2940
use std::io;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let mut list = [[[0; 10]; 3]; 4];
    let n: i32 = read();
    for _i in 0..n {
        let input: Vec<i32> = read_vec();
        let b = (input[0] - 1) as usize;
        let f = (input[1] - 1) as usize;
        let r = (input[2] - 1) as usize;
        list[b][f][r] += input[3];
    }
    for b in 0..4 {
        for f in 0..3 {
            for r in 0..10 {
                print!(" {}", list[b][f][r]);
            }
            println!();
        }
        if b != 3 {
            println!("####################");
        }
    }
}



Measured memory_bytes: 5032
S = input()
if S=='SAT':
    print(1)
if S=='FRI':
    print(2)
if S=='THU':
    print(3)
if S=='WED':
    print(4)
if S=='TUE':
    print(5)
if S=='MON':
    print(6)
if S=='SUN':
    print(7)

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

const int MAX = 1e5+200;

int dp[MAX][4];
int happy[MAX][3];

int n;

int solve(int day, int past) {
    if(day==n) return 0;
    if(~dp[day][past]) return dp[day][past];

    int ans=-1;

    for(int i=0;i<3;i++) {
        if(i!=past) ans=max(ans,happy[day][i]+solve(day+1,i));
    }

    return dp[day][past]=ans;
}

int main() {

    memset(dp,-1,sizeof(dp));
    scanf("%d",&n);

    for(int i=0;i<n;i++) {
        for(int j=0;j<3;j++) scanf("%d",&happy[i][j]);
    }

    solve(0,3);
    printf("%d\n",dp[0][3]);

    return 0;
}


Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N, 0);
  for(int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    vec[a - 1]++;
    vec[b - 1]++;
  }
  for(int i = 0; i < N; i++) {
    cout << vec[i] << endl;
  }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    // それぞれの地点からスタート、mapで（現在位置、スタート）を保持
    // multisetで横移動の長さを保持
    int H, W;
    cin >> H >> W;
    vector<int> Left(H);
    vector<int> Right(H);
    rep(i, H) {
        cin >> Left[i] >> Right[i];
        --Left[i];
    }
    map<int, int> mp;
    rep(i, W) mp[i] = i;
    multiset<int> vals;
    rep(i, W) vals.insert(0);

    rep(i, H) {
        int l = Left[i], r = Right[i];
        auto it = mp.lower_bound(l);
        int edge = -1; // lとrの中でスタートの右端
        while (it != mp.end() && it->first <= r) {
            edge = max(edge, it->second);
            int x = it->first - it->second;
            mp.erase(it++);
            vals.erase(vals.find(x));
        }
        if (edge >= 0 && r < W) {
            vals.insert(r-edge);
            mp[r] = edge;
        }
        if (vals.empty()) puts("-1");
        else {
            int ans = *vals.begin() + i + 1;
            printf("%d\n", ans);
        }        
    }
    return 0;
}


Measured memory_bytes: 23556
#include<stdio.h>
int main(void)
{
	int a,b,c,d,x[1001],i,j,X,S,max=0;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	for(i=0;i<a;i++){
		scanf("%d",&x[i]);
	}
	for(i=0;i<a;i++){
		for(j=i;j<a;j++){
			if(x[i]<x[j]){
				X=x[i];
				x[i]=x[j];
				x[j]=X;
			}
		}
	}
	for(i=0;i<a;i++){
		S=d;
		for(j=0;j<i;j++){
			S+=x[j];
		}
		if(max<S/(b+c*i)){
			max=S/(b+c*i);
		}
	}
	printf("%d\n",max);
	return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/
int main(){
    int n;cin>>n;
    ll ans=0;
    rep(i,n){
        ll tmp;
        cin>>tmp;
        while(1){
            if(tmp%2!=0)break;
            tmp/=2;
            ans++;
        }
    }
    cout<<ans<<endl;
}

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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<double> p(N);
    for (int i=0;i<N;i++) cin >> p[i];
    vector<vector<double>> dp(N+1,vector<double>(N+1));
    dp[0][0] = 1;
    for (int i=0;i<N;i++){
        for (int j=0;j<N;j++){
            dp[i+1][j] += dp[i][j]*(1.0-p[i]);
            dp[i+1][j+1] += dp[i][j]*p[i];
        }
    }
    double ans = 0.0;
    int NN = (N+1)/2;
    for (int i=NN;i<=N;i++){
        ans += dp[N][i];
    }
    cout << fixed << setprecision(9) << ans << "\n";
}

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

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

	int x, y, s;
	while(cin >> x >> y >> s, x) {
		int ans = -1;
		for(int i = 1; i <= s - 1; i++) {
			for(int j = 1; j <= s - 1; j++) {
				if(i * (100 + x) / 100 + j * (100 + x) / 100 == s) {
					ans = max(ans, i * (100 + y) / 100 + j * (100 + y) / 100);
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
int main(){
	int r;
	cin>>r;
	if(r<1200){
		cout<<"ABC";
	}
	else if(r>=1200&&r<2800){
		cout<<"ARC";
	}
	else if(r>=2800){
		cout<<"AGC";
	}
} 

Measured memory_bytes: 256
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_STR_MAX		200005									// 最大文字列数
#define D_CHAR_MAX		20										// 最大文字数

// 内部構造体 - 文字列情報
typedef struct Str {
	char mc1Str[D_CHAR_MAX];									// 文字列
	int miSNo;													// 同一文字列
	int miSCnt;													// 同一文字列数
} Str;

// 内部変数
static FILE *szpFpI;											// 入力
static Str sz1Str[D_STR_MAX];									// 文字列
static int siSCnt;												// 文字列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// ソート関数 - 文字列昇順
int
fSortFnc(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	Str *lzpVal1 = (Str *)pzpVal1;
	Str *lzpVal2 = (Str *)pzpVal2;

	// 文字列昇順
	return strcmp(lzpVal1->mc1Str, lzpVal2->mc1Str);
}

// 改行カット
// 戻り値：文字数
int
fCutCrLf(
	char *pcpStr				// <I> 文字列
)
{
	int i;

	for (i = 0; pcpStr[i] != '\0'; i++) {
		if (pcpStr[i] == '\n') {
			pcpStr[i] = '\0';
			break;
		}
	}

	return i;
}

// 最大値 - 取得
int
fGetMax(
	int piVal1					// <I> 値１
	, int piVal2				// <I> 値２
)
{
	if (piVal1 > piVal2) {
		return piVal1;
	}
	else {
		return piVal2;
	}
}

// 実行メイン
int
fMain(
)
{
	int i, liRet;
	char lc1Buf[1024];

	// 文字列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siSCnt);

	// 文字列 - 取得
	sz1Str[0].mc1Str[0] = 1;
	for (i = 1; i <= siSCnt; i++) {
		fgets(sz1Str[i].mc1Str, sizeof(sz1Str[0].mc1Str), szpFpI);
		fCutCrLf(sz1Str[i].mc1Str);
	}
	qsort(sz1Str, siSCnt + 1, sizeof(Str), fSortFnc);

	// 同一文字列 - セット
	int liMax = 0;
	for (i = 1; i <= siSCnt; i++) {
		liRet = fSortFnc(&sz1Str[i], &sz1Str[i - 1]);
		if (liRet == 0) {
			sz1Str[i].miSNo = sz1Str[i - 1].miSNo;
			sz1Str[i].miSCnt = 0;
			sz1Str[sz1Str[i].miSNo].miSCnt++;
			liMax = fGetMax(liMax, sz1Str[sz1Str[i].miSNo].miSCnt);
		}
		else {
			sz1Str[i].miSNo = i;
			sz1Str[i].miSCnt = 1;
			liMax = fGetMax(liMax, 1);
		}
	}

	// 出力
	for (i = 1; i <= siSCnt; i++) {
		if (sz1Str[i].miSCnt == liMax) {
			sprintf(lc1Buf, "%s\n", sz1Str[i].mc1Str);
			fOutLine(lc1Buf);
		}
	}

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 11132
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <tuple>

using namespace std;

// (dy, dx)
pair<int, int> next_diff(int dy, int dx) {
    return make_pair(dx, -dy);
}

int main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int dy, dx;
    tie(dy, dx) = next_diff(y2 - y1, x2 - x1);
    int y3 = y2 + dy;
    int x3 = x2 + dx;

    tie(dy, dx) = next_diff(dy, dx);
    int y4 = y3 + dy;
    int x4 = x3 + dx;

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int w,h,n;
	cin>>w>>h>>n;
	int xst=0,xen=w,yst=0,yen=h;
	for(int i=0;i<n;i++){
		int x,y,a;
		cin>>x>>y>>a;
		if(a==1&&xst<=x){
			xst=x;
		}
		else if(a==2&&xen>=x){
			xen=x;
		}
		else if(a==3&&yst<=y){
			yst=y;
		}
		else if(a==4&&yen>=y){
			yen=y;
		}
	}
	if(xst<xen&&yst<yen){
		cout<<(xen-xst)*(yen-yst)<<endl;
	}
	else{
		cout<<0<<endl;
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int strNum = sc.nextInt();

		if (strNum % 2 == 0){
			String str  = sc.next();
			String str1 = str.substring(0, strNum/2);
			String str2 = str.substring(strNum/2, strNum);
			if (str1.equals(str2)){
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}


		} else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 23892
import java.util.*;

public class Main {
    static long[][] kyuyu;
    static long[][] dist;
    static int L;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        int M = sc.nextInt();
        L = sc.nextInt();
        kyuyu = new long[N][N];
        dist = new long[N][N];
        for(int i=0;i<N;i++){
            Arrays.fill(kyuyu[i], Integer.MAX_VALUE);
            Arrays.fill(dist[i], Integer.MAX_VALUE);
        }
        for(int i=0;i<M;i++){
            int A=sc.nextInt()-1;
            int B=sc.nextInt()-1;
            int C=sc.nextInt();
            if(C <= L){
//                kyuyu[A][B]=0;
//                kyuyu[B][A]=0;
                dist[A][B]=C;
                dist[B][A]=C;
            }else{
                kyuyu[A][B]=Integer.MAX_VALUE;
                kyuyu[B][A]=Integer.MAX_VALUE;
                dist[A][B]=Integer.MAX_VALUE;
                dist[B][A]=Integer.MAX_VALUE;
            }
        }
        //System.out.println(map);
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                for(int k=0;k<N;k++){
                    dist[j][k] = Math.min( dist[j][i] + dist[i][k], dist[j][k]);
                    if(dist[j][k] <= L){
                        kyuyu[j][k] = 1;
                    }
                }
            }
        }

        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                for(int k=0;k<N;k++){
                    kyuyu[j][k] = Math.min(kyuyu[j][i] + kyuyu[i][k] , kyuyu[j][k]);
                }
            }
        }
        //System.out.println(fuelMap);
        int Q = sc.nextInt();
        for(int q=0;q<Q;q++){
            int s=sc.nextInt()-1;
            int t=sc.nextInt()-1;
            if(kyuyu[s][t] == Integer.MAX_VALUE) {
                System.out.println(-1);
            }else{
                System.out.println(kyuyu[s][t] - 1);
            }
        }
    }



}


Measured memory_bytes: 93364
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x; cin >> x;
    cout << 1 - x << endl;

    return 0;
}


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

const int INF = 1001001001;
vector<int> to[100005];

int main() {
  int n, m;
  cin >> n >> m;
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a; --b;//0からスタートだから頂点番号をデクリメント
    to[a].push_back(b);//toというリストを各頂点ごとに持っておいてaに繋がってる頂点のリスト
    to[b].push_back(a);
  }

  queue<int> q;
  vector<int> dist(n, INF);//まだたどり着いてないところがINF(フラグ管理)
  vector<int> pre(n, -1);//直前の頂点を持つ
  dist[0] = 0;
  q.push(0);//初期状態をqueueに入れる
  //queueが空になるか解が見つかるまでqueueから状態を取り出しそこから遷移できる、
  //全ての訪れたことのない状態をqueueに入れるということを繰り返すby蟻本
  while (!q.empty()) {
    int v = q.front(); q.pop();
    for (int u : to[v]) {
      if (dist[u] != INF) continue;
      dist[u] = dist[v]+1;
      pre[u] = v;//直前の頂点を記録
      q.push(u);
    }
  }

  cout << "Yes" << endl;
  rep(i,n) {
    if (i == 0) continue;
    int ans = pre[i];
    ++ans;
    cout << ans << endl;
  }
  return 0;
}
//BFSは同じ状態は一度しか通らないから計算量がDFSより少ない(今回みたいに最短経路のときとかはBFS)


Measured memory_bytes: 10536
n, t = gets.split.map(&:to_i)
ts = gets.split.map(&:to_i)
if n == 1
  p t
else
  p n * t - ts.each_cons(2).map { |i| i[1] - i[0] }.map { |i| [t - i, 0].max }.inject(:+)
end


Measured memory_bytes: 23044
#include<stdio.h>
#include<stdlib.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
    int N,Q;
    scanf("%d%d",&N,&Q);

    char S[N+1];
    scanf("%s",S);

    //A[0]~A[N]に、S[0]~S[i]にACが何個あったかを格納する
    int A[N];
    A[0]=0;
    for(int i=1;i<N;i++){
        if(S[i-1]=='A' && S[i]=='C') A[i]=A[i-1]+1;
        else A[i]=A[i-1];
    }

    int ans[Q];

    for(int i=0;i<Q;i++){
        int l,r;
        scanf("%d%d",&l,&r);

        ans[i]=A[r-1]-A[l-1];
        
    }

    for(int i=0;i<Q;i++){
        printf("%d\n",ans[i]);
    }

    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long int n;
	cin>>n;
	long long int arr[n],sub[n]={0};
	for(long long int i=1;i<n;i++)
	{
		cin>>arr[i];
		sub[arr[i]-1]++;
	}
	for(long long int i=0;i<n;i++)
		cout<<sub[i]<<endl;

	return 0;
}


Measured memory_bytes: 6756
#include<bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(NULL);
    ios::sync_with_stdio(false);    
    int  n;
    cin>>n;
    int a[n];
    bool ok=1;
    for(int i = 0; i < n; ++i)
    {  
        cin>>a[i];
        if(a[i]%2==0)
        {
            if(a[i]%3==0 || a[i]%5==0)
            {
                continue ;
            }
            else
            {
                ok=0;
                break;
            }
        }      
    } 
    cout<<(ok? "APPROVED":"DENIED")<<endl;
    return 0;
}


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

typedef int32_t i32;
typedef int64_t i64;

i32 kth_element (const i32 k, const i32 *a, const i32 n) {
  i32 *b = (i32 *) calloc (n, sizeof (i32));
  memcpy (b, a, sizeof (i32) * n);
  i32 l = 0;
  i32 r = n;
  while (r - l > 1) {
    i32 p = rand() % (r - l) + l;
    const i32 pivot = b[p];
    b[p] = b[l];
    i32 lp = l + 1;
    i32 rp = r;
    i32 ll = l;
    while (lp < rp) {
      if (b[lp] == pivot) {
        lp++;
      } else if (b[lp] < pivot) {
        b[ll++] = b[lp++];
      } else {
        i32 swap = b[--rp];
        b[rp] = b[lp];
        b[lp] = swap;
      }
    }
    if (ll <= k && k < rp) {
      b[k] = pivot;
      l = k;
      r = k + 1;
    } else if (k < ll) {
      r = ll;
    } else {
      l = rp;
    }
  }
  i32 ress = b[k];
  free (b);
  return ress;
}

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *a = (i32 *) calloc (n, sizeof (i32));
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, a + i);
    a[i] -= i + 1;
  }
  i32 val = kth_element (n/2, a, n);
  i64 ans = 0;
  for (i32 i = 0; i < n; ++i) {
    i32 d = a[i] - val;
    ans += d > 0 ? d : -d;
  }
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run ();
  return 0;
}


Measured memory_bytes: 1664
#include "bits/stdc++.h"
#pragma GCC optimize ("Ofast")
#define int long long 
#define ld long double
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,l,r) for(int i=l;i<r;i++)
#define watch(x) cerr<<(#x)<<"= "<<(x)<<endl;
#define watcharr(a) cerr<<(#a)<<"("<<a.size()<<")= ";rep(i,a.size())cerr<<a[i]<<",";cerr<<'\n';
#define inf 2000000000000000000LL
#define mod 1000000007LL
#define mod1 998244353LL
#define FASTIO std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;

signed main() {
    FASTIO;
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    //     freopen("stderr.txt", "w", stderr);
    // #endif

    int n; cin>>n;
    vector<ld> p(n+1);
    vector<vector<ld>> dp(n+1,vector<ld>(n+1)); // dp[#toss][#heads]
    loop(i,1,n+1) cin>>p[i];
    dp[0][0]=1.0;
    loop(toss,1,n+1){
        dp[toss][0]=dp[toss-1][0]*(1-p[toss]); //no heads
        loop(heads,1,n+1){
            dp[toss][heads]=dp[toss-1][heads]*(1-p[toss])+dp[toss-1][heads-1]*p[toss];
        }
    }
    
    ld ans=0.0;
    loop(heads,(n+1)/2,n+1) ans+=dp[n][heads];
    cout<<fixed<<setprecision(20)<<ans;

    
    return 0;
}

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

int main() {
  string s1, s2;
  cin >> s1 >> s2;;
  
  if(s1[0]==s2[2] && s1[1]==s2[1] && s1[2]==s2[0])
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <valarray>
#include <cstdio>
using namespace std;
typedef valarray<int>V;
int N,M,A,B,C,T;
V mul(const V &a, const V &b){
	V c(N*N);
	int i=0,j;
	for(;i<N;i++)for(j=0;j<N;j++)c[i*N+j]=(a[slice(i*N,N,1)]*b[slice(j,N,N)]).sum()%M;
	return c;
}
V exp(const V &a, const int n){
	if(n==1)return a;
	if(n&1)return mul(exp(a,n-1),a);
	V b=exp(a,n>>1);
	return mul(b,b);
}
V s;
void output(const V &r){
int i=0;
	for(i=0;i<N-1;i++)printf("%d ",(r[slice(i*N,N,1)]*s).sum()%M);
	printf("%d\n",(r[slice(i*N,N,1)]*s).sum()%M);
}
V z(){
	V x(N*N);
	int i;
	if(T){
		x[0]=B;
		x[1]=C;
		for(i=1;i<N-1;i++){
			x[i*N+i-1]=A;
			x[i*N+i]=B;
			x[i*N+i+1]=C;
		}
		x[i*N+i-1]=A;
		x[i*N+i]=B;
		return exp(x,T);
	}else{
		for(i=0;i<N;i++)x[i*N+i]=1;
		return x;
	}
}
main(){
	int i;
	for(;scanf("%d%d%d%d%d%d",&N,&M,&A,&B,&C,&T),N;){
		s.resize(N);
		for(i=0;i<N;i++)scanf("%d",&s[i]);
		output(z());
	}
}

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

int main() {
  long long int N;
  cin >> N;
  vector<long long int> A(N);
  for (long long int i = 0; i < N; i++) cin >> A.at(i);
  
  vector<long long int> B(60, 0);
  for (long long int i = 0; i < N; i++) {
    for (long long int j = 0; j < 60; j++) {
      if ((A.at(i) >> j) & 1) B.at(j)++;
    }
  }
  
  long long int ans = 0;
  long long int MOD = 1000000007;
  for (long long int i = 0; i < 60; i++) {
    long long int X = 1;  
    ans += ((B.at(i) * (N - B.at(i)) % MOD) * ((X << i) % MOD)) % MOD;
    ans %= MOD;
  }
  
  cout << ans << endl;
}

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

const int N = 200005;
const int mod = 1e9 + 7;

void add(int& x, int y) {
	x += y; if (x >= mod) x -= mod;
}

void sub(int& x,int y) {
	x -= y; if (x < 0) x += mod;
}

int mul(int x,int y) {
	return (long long) x * y % mod;
}

int pw(int x,int y) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = mul(res, x);
		}
		x = mul(x, x);
		y >>= 1;
	}
	return res;
}

int h, w, n;
int fac[N], ifac[N];
vector<pair<int,int>> z;
int f[N];

int C(int n,int k) {
	if (n < k || k < 0) {
		return 0; 
	} else {
		return mul(fac[n], mul(ifac[k], ifac[n - k]));
	}
}

int main() {
	fac[0] = 1;
	for (int i = 1; i < N; ++i) {
		fac[i] = mul(fac[i - 1], i);
	}
	ifac[N - 1] = pw(fac[N - 1], mod - 2);
	for (int i = N - 2; ~i; --i) {
		ifac[i] = mul(ifac[i + 1], i + 1);
	}
	scanf("%d %d %d", &h, &w, &n);
	for (int i = 1; i <= n; ++i) {
		int x, y; scanf("%d %d", &x, &y);
		z.push_back(make_pair(x, y));
	}
	z.push_back(make_pair(h, w));
	sort(z.begin(), z.end());
	for (int i = 0; i <= n; ++i) {
		f[i] = C(z[i].first + z[i].second - 2, z[i].first - 1);
		for (int j = 0; j < i; ++j) {
			sub(f[i], mul(f[j], C(z[i].first + z[i].second - z[j].first - z[j].second, z[i].first - z[j].first)));
		}
	}
	printf("%d\n", f[n]);
}

Measured memory_bytes: 1920
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    string s;
    cin>>s;
    bool flag=true;
    int n=s.size();
    for(int i=0;2*i<n-1;i++){
        if(s[i]!=s[n-1-i])flag=false;
    }
    for(int i=0;2*i<(n-1)/2-1;i++){
        if(s[i]!=s[(n-1)/2-1-i])flag=false;
    }
    for(int i=(n+3)/3-1;2*i<n-1;i++){
        if(s[i]!=s[n-1-i])flag=false;
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
    double r = 0;
    cin >> r;
    
    cout << fixed << setprecision(6) << r * r * M_PI << " " << 2 * M_PI * r << endl;

    return 0;
}

Measured memory_bytes: 1288
<?php
$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
//list($N,$K) = array_map('intval',explode(" ",trim(fgets(STDIN))));
$A = array_map('intval',explode(" ",trim(fgets(STDIN))));
$Q = (int)trim(fgets(STDIN));
$sum = array_sum($A);
$cv = array_count_values($A);
for($i=0;$i<$Q;$i++) {
  list($B,$C) = array_map('intval',explode(" ",trim(fgets(STDIN))));
  //$C-$B * $cv[$B]増えるはず
  $cv[$C]+=$cv[$B];
  $sum+=($C-$B)*$cv[$B];
  printf("%d\n",$sum);
  $cv[$B]=0;
}


Measured memory_bytes: 28148
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

long long calcurate_cost(pair<long long, long long> M1, pair<long long, long long> M2)
{
  return M1.first * M1.second * M2.second;
}

pair<long long, long long> product_M(pair<long long, long long> M1, pair<long long, long long> M2)
{
  return make_pair(M1.first, M2.second);
}

int main()
{
  int n;
  cin >> n;
  vector<long long> M(n + 1);
  rep(i, n)
  {
    cin >> M[i] >> M[i + 1];
  }

  vector<vector<long long>> dp(n, vector<long long>(n, INT64_MAX));

  rep(i, n)
  {
    dp[i][i] = 0;
  }
  rep(i, n - 1)
  {
    dp.at(i).at(i + 1) = M[i] * M[i + 1] * M[i + 2];
  }

  for(int step = 2; step < n; step++)
  {
    for(int l = 0; l + step < n; l++)
    {
      int r = l + step;

      for(int c = l; c < r; c++)
      {
        long long cost = M[l] * M[c + 1] * M[r + 1];
        dp[l][r] = min(dp[l][r], dp[l][c] + dp[c + 1][r] + cost);
      }
    }
  }

  long long ans = dp[0][n - 1];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <climits>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP1(i,n) for(ll i=1;i<=(ll)(n);i++)

ll gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

ll power(ll a, ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p);
    if (n % 2)
        return (p * a);
    else
        return p;
}

int main() {
    ios_base::sync_with_stdio(false);    //for fast I/O operation
    cin.tie(NULL);

    double n;
    cin >> n;

    cout << n * M_PI * 2 << endl;
}


Measured memory_bytes: 3804
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define もし if(
#define そうでなくてもし }else if(
#define ならば ){
#define そうでないならば }else{
#define を実行する }

#define が ==
#define を =
#define とする

#define 文字列を読み込む(s) scanf("%s", s)
#define 整数を読み込む(x) int x; scanf("%d", &x)
#define 文字を読み込む(c) char c; scanf(" %c", &c)

#define 文字列を書き出す(s) printf("%s", (s))
#define 文字を書き出す(c) printf("%c", (c))
#define 改行する putchar(10)

#define 文字列の長さ(s) (strlen(s))

typedef int 整数;
typedef char 文字;

int main(void){
	文字 s[500001];
	文字列を読み込む(s+200000);
	整数 l を 200000 とする;
	整数 r を 200000+文字列の長さ(s+200000)とする;
	整数 f を 1 とする;

	整数を読み込む(q);
	整数 i;
	for(i=0; i<q; i++){
		整数を読み込む(Q);
		もし Q が 1 ならば
			もし f が 1 ならば
				f を 2 とする;
			そうでないならば
				f を 1 とする;
			を実行する
		そうでないならば
			整数を読み込む(F);
			文字を読み込む(c);
			もし F が f ならば
				s[--l] を c とする;
			そうでないならば
				s[r++] を c とする;
			を実行する
		を実行する
	}
	もし f が 1 ならば
		s[r] を 0 とする;
		文字列を書き出す(s+l);
		改行する;
	そうでないならば
		for(i=r-1; i>=l; i--){
			文字を書き出す(s[i]);
		}
		改行する;
	を実行する
}



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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    for (int i = 1; i <= B; i++) {
        if ((i * A) % B == C) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
ifprime = [1]*(1000000)
ifprime[0] = ifprime[1] = 0
a = 2
while a < 1000000:
  if ifprime[a]:
    b = a*a
    while b < 1000000:
      ifprime[b] = 0
      b += a
  a += 1
for n in sys.stdin:
  print sum(ifprime[:int(n)+1])

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  reverse(a.begin(), a.end());
  cout << a[0];
  for(int i = 1; i < n; i++) {
    cout << " " << a[i];
  }
  cout <<endl;
}


Measured memory_bytes: 3080
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long i=0,n,m=1,a[114514];
	for(cin>>n;i<n;cin>>a[i++]);
	sort(a,a+n);
	for(i--;i>0;i--)if(a[i]==a[i-1]){m*=a[i--];break;}
	for(i--;i>0;i--)if(a[i]==a[i-1]){m*=a[i];cout<<m;return 0;}
	cout<<0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
void func(int,int,double,int);
int p,q,a,n,cnt;
double k;
 
int main(){
  while(1){
    cin>>p>>q>>a>>n;
    if(!p&&!q&&!a&&!n) break;
    k=1.0*p/q;
    cnt=0;
    func(0,1,0,1);
    cout<<cnt<<endl;
  }
  return 0;
}
 
void func(int x,int w,double y,int I){
  if(-0.00000001<=k-y&&k-y<=0.00000001) cnt++;
  if(x==n) return ;
  for(int i=I;w*i<=a;i++){
    if(y+1.0/i>k+1) continue;
    func(x+1,w*i,1.0/i+y,i);
  }
}

Measured memory_bytes: 1160
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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; }



int main() {
	
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> ans;
	rep(i, n) {
		cin >> a[i];
		if (a[i] % 2 == 0) ans.push_back(a[i]);
	}
	bool ok = true;
	rep(i, ans.size()) {
		if (ans[i] % 3 == 0 || ans[i] % 5 == 0) continue;
		else ok = false;
	}
	if (ok) cout << "APPROVED" << endl;
	else cout << "DENIED" << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define TMAX 100000;
using namespace std;
int main() {
    int N, M;
    cin >> N;
    int T[110000];
    int t_sum = 0;
    for(int i = 0; i < N; i++) {
        cin >> T[i];
        t_sum += T[i];
    }
    cin >> M;
    for(int i = 0; i < M; i++) {
        int p, x;
        cin >> p >> x;
        int px = T[p - 1] - x;
        cout << t_sum - px << "\n";
    }
    return 0;
}

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

int main(void){
    
    //入力
    int A, B, C, D, E;
    cin >> A >> B >> C >> D >> E;
    
    //最後に頼んだ時の時間
    vector<int> Time = {A, B, C, D, E};
    
    //最後以外に頼んだ時の時間
    vector<int> NextTime(5);
    for (int i = 0; i < 5; i++){
        if (Time[i] % 10 == 0) NextTime[i] = Time[i];
        else{
            NextTime[i] = Time[i] - Time[i] % 10 + 10;
        }
    }
    
    //全通りの注文方法を試し、一番短い時間のものを答えにする
    int ans = 999999999;
    for (int i = 0; i < 5; i++){
        int totalTime = 0;
        for (int j = 0; j < 5; j++){
            if (i == j) totalTime += Time[i];
            else totalTime += NextTime[j];
        }
        ans = min(ans, totalTime);
    }
    
    //答えを出力する
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int invGeneral(int a, int b=MOD) {
    a %= b; if (a == 0) return b == 1 ? 0 : -1;
    int x = invGeneral(b,a); 
    return x == -1 ? -1 : ((1-(ll)b*x)/a+b)%b;
}
int factorial[2000005];
long long binomial_coefficient(int n, int k) {
    return factorial[n] * invGeneral(factorial[k]) % MOD * invGeneral(factorial[n - k]) % MOD;
}
int32_t main(){
	boost;
	factorial[0]=factorial[1]=1;
	for (int i = 2; i <= 2000001; ++i)
		factorial[i]=(factorial[i-1]*i)%MOD;
	int x,y;
	cin>>x>>y;
	if((x+y)%3){cout<<0;return 0;}
	int n=(x+y)/3,I;
	v vec;
	for (int i = 0; i <= n; ++i)
	{
		if((i*2+(n-i))==x&&(i+(n-i)*2)==y)
			vec.pb(i);
	}
	int ans=0;
	for(auto it:vec)
		ans=(ans+(binomial_coefficient(n,it)%MOD))%MOD;
	cout<<ans;
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
	par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){

}*/
signed main(){
  string a;
  cin>>a;
  int b=1,c=0;
  if(a[0]!='A')
    b=0;
  for(int i=2;i<a.sz-1;i++){
    if(a[i]=='C')
      c=1;
  }
  Sort(a);
  if(a[2]<'a')
    b=0;
  if(b&&c)
    cout<<"AC"<<endl;
  else
    cout<<"WA"<<endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int Z = sc.nextInt();
        System.out.println(Z + " " + X + " " + Y);
        
    }
} 

Measured memory_bytes: 23892