akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define INF 1007654321
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }

bool CanMakeSum(vector<int> &A, int goal) {
    int N = sz(A), M = 0;
    if(N == 0) return goal == 0;
    for(auto &x : A) M += x;
    if(abs(goal) > M) return false;
    vector<vector<bool>> DP(N, vector<bool>(2*M + 1, false));
    rep(i, N) {
        rep(j, 2*M + 1) {
        	if(i == 0) {
        		DP[i][j] = (j == M + A[i] || j == M - A[i]);
        		continue;
        	}
            if(j - A[i] < 0 && j + A[i] <= 2*M) DP[i][j] = DP[i-1][j + A[i]];
            else if(j + A[i] > 2*M && j - A[i] >= 0) DP[i][j] = DP[i-1][j - A[i]];
            else DP[i][j] = DP[i-1][j - A[i]] || DP[i-1][j + A[i]];
        }
    }
    return DP[N-1][M+goal];
}

int main() {
    FAST_IO();
    string S; cin >> S;
    S.push_back('T');
    int FX, FY; cin >> FX >> FY;
    int N = sz(S);
    vector<int> X, Y;
    int cntT = 0, cntF = 0;
    rep(i, N) {
        if(S[i] == 'T') {
            if(cntT == 0) {
                FX -= cntF;
            } else if(cntT % 2 == 0) {
                if(cntF != 0) X.push_back(cntF);
            } else {
                if(cntF != 0) Y.push_back(cntF);
            }
            cntT++;
            cntF = 0;
        }
        else {
            cntF++;
        }
    }
    if(CanMakeSum(X, FX) && CanMakeSum(Y, FY)) {
        cout << "Yes\n";
    } else cout << "No\n";
    return 0;
}



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

int main() {
	int n;
	
	cin>>n;
	int arr[n],dp[n+1];
	for(int i=0;i<n;i++){
		cin>>arr[i];
		
	}
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	}
	
	cout<< dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
#define priority_queue __gnu_pbds::priority_queue
typedef long long LL;
typedef long double LD;
typedef unsigned int ui;
typedef unsigned long long ul;
#define ri register int
#define pb push_back
#define fi first
#define se second
#define mid ((l + r) >> 1)
#define ls (i << 1)
#define rs (i << 1 | 1)
#define enum(i, j, k) for(int i = j; i <= k; i ++)
#define FO(x) { freopen(#x".in", "r", stdin); freopen(#x".out", "w", stdout); }
using namespace std;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<int, LL> pil;
typedef pair<LL, int> pli;
typedef vector<int> vi;
#define ae(x) for(node *p = h[x]; p; p = p->nxt)
#define G \
	struct node { int v; node *nxt; } e[maxm], *h[maxn]; int z;\
	void adde(int u, int v) { e[++z].v = v; e[z].nxt = h[u]; h[u] = &e[z]; }\
	void addrev(int u, int v) { adde(u, v); adde(v, u); }
#define W \
	struct node { int v, w; node *nxt; } e[maxm], *h[maxn]; int z;\
	void adde(int u, int v, int w) { e[++z].v = v; e[z].w = w; e[z].nxt = h[u]; h[u] = &e[z]; }\
	void addrev(int u, int v, int w) { adde(u, v, w); adde(v, u, w); }
inline int _() // ret >= 0
{
	int ret = 0; char ch = getchar();
	while(ch < '0' || ch > '9') ch = getchar();
	do { ret = ret * 10 + ch - '0'; ch = getchar(); } while('0' <= ch && ch <= '9');
	return ret;
}
inline void _(int x) // x >= 0
{
	if(x < 10) { putchar(x + '0'); return ; }
	_(x / 10); putchar(x % 10 + '0');
}
void What_are_you_doing_at_the_end_of_the_world_Are_you_busy_Can_you_save_us()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(16);
}
/* Default Code Ends Here. */

void yes()
{
	cout << "Yes\n";
}
void no()
{
	cout << "No\n";
}

LL gcd(LL x, LL y)
{
	return x == 0 ? y : gcd(y % x, x);
}

int main()
{
	What_are_you_doing_at_the_end_of_the_world_Are_you_busy_Can_you_save_us();
	
	int T;
	cin >> T;
	while(T --)
	{
		LL a, b, c, d;
		cin >> a >> b >> c >> d;
		if(d < b || a < b)
		{
			no();
			continue;
		}
		if(c >= b)
		{
			yes();
			continue;
		}
		LL g = gcd(b, d);
		LL k = (a - c - 1) / g;
		if(a - k * g < b)
			no();
		else
			yes();
	}
	return 0;
}


Measured memory_bytes: 256
_, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = []
pre = []
d = {0: None}
s = a[0] - 1
while True:
    l.append(s)
    if s in d:
        ind = l.index(s) + 1
        break
    else:
        d[s] = None
        s = a[s] - 1
if ind == len(l):
    pass
else:
    pre = l[: ind]
    l = l[ind:]
if len(pre) < k:
    num = (k - len(pre)) % len(l) - 1
    ans = l[num] + 1 
else:
    ans = pre[k - 1] + 1
print(ans)

Measured memory_bytes: 39068
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
bou2 = []
bou4 = []
for k, v in c.items():
    if v > 1:
        bou2.append(k)
    if v > 3:
        bou4.append(k)

bou2.sort(reverse=True)
bou4.sort(reverse=True)
ans = 0
if len(bou2) >= 2:
    ans = bou2[0]*bou2[1]
if len(bou4) != 0:
    ans = max(ans, bou4[0]*bou4[0])
print(ans)




Measured memory_bytes: 93428
S = list(input())
N = len(S)
dp=[]
MOD = (10 ** 9) + 7
f = S.pop(0)
if f == '?':
  dp_low = [1,1,1,1,1,1,1,1,1,1,0,0,0]
else:
  dp_low = [0] * 13
  dp_low[int(f)] = 1
  
dp.append(dp_low)
for i in range(N-1):
  dp_low = [0] * 13
  if S[i] == '?':
    for j, val in enumerate(dp[i]):
      for k in range(10):
        temp = ((j * 10) + k) % 13
        dp_low[temp] += val
  else:
    for j, val in enumerate(dp[i]):
      temp = ((j * 10) + int(S[i])) % 13
      dp_low[temp] += val
  for i in range(13):
    dp_low[i] %= MOD
  dp.append(dp_low)
print(dp[-1][5])

Measured memory_bytes: 94764
#include<stdio.h>

int ans;

void func(int n, int index, int count){
	if(n < 0)return;
//	printf("%d %d %d\n", n, index, count);
	if(count == 0 && n == 0){
		ans++;
		return;
	}
	if(index==0)return;
	
	for(int i = index-1; i >= 0; i--){
		func(n-i, i, count-1);
	}
}
	

int main(void){
	
	int n,s;
	
	while(scanf("%d %d", &n, &s)){
		if(n == 0 && n==s)break;
		ans = 0;
		
		func(s, 10, n);
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1028
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    // // 1つの数字
    // let a: usize = {
    //     let mut s = String::new();
    //     std::io::stdin().read_line(&mut s).unwrap();
    //     let s = s.trim_right().to_owned();
    //     s.parse().unwrap()
    // };
    //
    // // 複数数字
    let (s, t): (String, String) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        let mut ws = s.split_whitespace();
        let a = ws.next().unwrap().parse().unwrap();
        let b = ws.next().unwrap().parse().unwrap();
        (a, b)
    };

    println!("{}{}", t, s);
}


Measured memory_bytes: 4352
c = [list(map(int, input().split())) for _ in range(3)]


a0 = 0
b = [0, 0, 0]
for i in range(3):
    b[i] = c[0][i] - a0

a1 = c[1][0] - b[0]
a2 = c[2][0] - b[0]
a = [a0, a1, a2]
is_ok =True
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i] + b[j]:
            is_ok=False
if is_ok:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i, b in enumerate(B):
    if A[i] >= b:
        ans += b
    else:
        ans += A[i]
        diff = b - A[i]
        if A[i+1] >= diff:
            ans += diff
            A[i+1] -= diff
        else:
            ans += max(A[i+1], 0)
            A[i+1] = 0
print(ans)

Measured memory_bytes: 81892
x = input()
t_num = 0
s_num = 0
total = 0
for i in range(len(x)):
  if x[i] == 'S' and t_num == 0:
    s_num += 1
  elif x[i] == 'T':
    t_num += 1
  elif x[i] == 'S' and t_num > 0:
    total += min(s_num, t_num) * 2
    if s_num >= t_num:
      s_num = 1 + s_num - t_num
      t_num = 0
    else:
      s_num = 1
      t_num = 0
total += min(s_num, t_num) * 2
ans = len(x) - total
print(ans)

Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
int n,a[300001],sum,f;
int main(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++){
		sum=max(sum-10,a[i]);
		if(sum<10)f++;
	}
	sum=0;
	for(int i=n-1;i>=0;i--){
		sum=max(sum-10,a[i]);
		if(sum<10)f++;
	}
	cout<<(f?"no":"yes")<<endl;
}

Measured memory_bytes: 4260
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <malloc.h>

#define char_max 200000

int Pow(int n, int m);
int Max(int N[], int n);
int Min(int N[], int n);
int Sum(int N[], int n);





int main()
{
	char* S = (char*)calloc(char_max + 1, sizeof(char));
	char* T = (char*)calloc(char_max + 1, sizeof(char));

	scanf("%s", S);
	scanf("%s", T);

	char listS[27] = { NULL };
	char listT[27] = { NULL };

	int len = (int)strlen(S) / sizeof(char);

	for (int i = 0; i <len; i++) {
		if (listS[(int)S[i] - (int)'a'] == NULL) {
			listS[(int)S[i] - (int)'a'] = T[i];
		}
		else {
			if (listS[(int)S[i] - (int)'a'] != T[i]) {
				printf("No");
				return 0;
			}
		}

		if (listT[(int)T[i] - (int)'a'] == NULL) {
			listT[(int)T[i] - (int)'a'] = S[i];
		}
		else {
			if (listT[(int)T[i] - (int)'a'] != S[i]) {
				printf("No");
				return 0;
			}
		}
	}

	printf("Yes");
	return 0;

}

int Pow(int n, int m) {
	int ret = 1;

	for (int i = 0; i < m; i++) {
		ret *= n;
	}

	return ret;
}

int Max(int N[], int n) {
	int max = N[0];

	for (int i = 0; i < n; i++) {
		max = max < N[i] ? N[i]: max;
	}

	return max;
}

int Min(int N[], int n) {
	int min = N[0];

	for (int i = 0; i < n; i++) {
		min = min > N[i] ? N[i] : min;
	}

	return min;
}

int Sum(int N[], int n) {
	int sum = 0;

	for (int i = 0; i < n; i++) {
		sum += N[i];
	}

	return sum;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#define MAXN 100010
#define MAX 500010

using namespace std;

int n,q;
string s[MAXN];
int ch[MAX][27],ct[MAX][27],sz;
int num[MAX][27][27],pre[MAX];
string p;

int main() {
    ios::sync_with_stdio(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
        int u = 0;
        for (char cc : s[i]) {
            int c = cc - 'a' + 1;
            int v = ch[u][c];
            if (v == 0) v = ch[u][c] = ++sz;
            ct[u][c]++;
            u = v;
        }
        ct[u][0]++;
    }

    for (int i = 1; i <= n; i++) {
        int u = 0;
        for (char cc : s[i]) {
            int c = cc - 'a' + 1;
            for (int d = 1; d < 27; d++) {
                if (d != c)
                    num[i][d][c] += ct[u][d];
            }
            pre[i] += ct[u][0];
            u = ch[u][c];
        }
    }

    cin >> q;
    while (q--) {
        int k;
        cin >> k >> p;
        int ans = pre[k] + 1;
        for (int i = 0; i < 26; i++)
            for (int j = i+1; j < 26; j++)
                ans += num[k][p[i]-'a'+1][p[j]-'a'+1];
        cout << ans << '\n';
    }
}


Measured memory_bytes: 312064
n=int(input())
field=[[0 for i in range(20)]for j in range(15)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    h=(b-1)*4+f-1
    w=r*2-1
    n=v
    field[h][w]+=n
for y in range(15):
    for x in range(20):
        if(y%4==3):field[y][x]='#'
        elif x%2==0 :field[y][x]=' '
        print(field[y][x],end='')
    print()



Measured memory_bytes: 5644
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    map<int, int> cnt;
    REP(i,n){
        cnt[in()]++;
    }
    VI a(n + 1);
    for (P p : cnt) a[p.second]++;
    VI ans(n + 1);
    int d = n, s = n, c = 0;
    FOR(x,1,n){
        while (1){
            if ((x - c) * d <= s) break;
            c += a[d];
            s -= d * a[d];
            d--;
        }
        ans[x] = d;
    }
    FOR(x,1,n) printf("%d\n", ans[x]);

    return 0;
}


Measured memory_bytes: 16640
Option Strict On

Module Module1

    Sub Main()
        'let'
        Dim tmp() As Long = Array.ConvertAll(Of String, Long) _
            (Console.ReadLine().Split(), AddressOf Long.Parse)
        Dim A As Long = tmp(0)
        Dim B As Long = tmp(1)

        'var
        Dim ans() As Long = New Long() {A + B, A - B, A * B}

        Array.Sort(ans)
        Array.Reverse(ans)

        Console.WriteLine(ans(0))

    End Sub
End Module

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

class Main{
	public static void main(String Args[]){
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		BigInteger A = new BigInteger(str);
		str = sc.next();
		BigInteger B = new BigInteger(str);
		System.out.println(A.subtract(B));
	}
}



Measured memory_bytes: 75164
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[][] a = new int[n+1][n+2];
		for(int i = 0; i < n; i++) {
			String[] str = br.readLine().split(" ");
			int u = Integer.parseInt(str[0]);
			for(int j = 1; j < str.length; j++){
				a[u][j-1] = Integer.parseInt(str[j]);
			}
		}
		
		int[] d = new int[n+1];
		int[] f = new int[n+1];
		int t = 0; // time
		int[] st = new int [n*n]; // stack
		int p = 0; // stack pointer
		
		for(int i = 1; i <= n; i++){
			if(d[i] != 0){
				continue;
			}
			p = 0;
			st[p] = i; // first node
			
			while(p >= 0){
				int pn = st[p]; // present node
				if(d[pn] == 0){
					t += 1;
					d[pn] = t;
				}
				
				for(int j = a[pn][0]; j > 0; --j){
					if(d[a[pn][j]] == 0){
						// push the adjacent nodes
						p += 1;
						st[p] = a[pn][j];
					}
				}

				if(st[p] == pn){
					if(f[pn] == 0){
						// write finish time
						t += 1;
						f[pn] = t;
					}
					// pop 
					p -= 1;
				}
			}
		}
		
		StringBuilder sb = new StringBuilder();
		for(int i = 1; i <= n; i++){
			sb.append(i + " " + d[i] + " " + f[i] + "\n");
		}
		System.out.print(sb);
	}

}

Measured memory_bytes: 24680
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

int getRP(int n,int m){
    int c=0;
    while(n%m==0){
        c++;
        n/=m;
    }
    return c;
}

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

    int tmp;cin >> tmp;
    int res = getRP(tmp,2);
    for(int i=1;i<n;i++){
        cin >> tmp;
        res = min(res,getRP(tmp,2));
    }
    p(res)
}

Measured memory_bytes: 256
#include <iostream>
std::string s1, s2, s3;
int main(void){
    std::cin >> s1 >> s2 >> s3;
    std::cout << (char)(s1[0]-'a'+'A') << (char)(s2[0]-'a'+'A') << (char)(s3[0]-'a'+'A') << std::endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;

LL n,m,k;

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	cout << ((n * 500 >= m) ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
// Code By H~$~C
#include <bits/stdc++.h>
using namespace std;

constexpr int inf = 0x3f3f3f3f;
constexpr long long lnf = 0x3f3f3f3f3f3f3f3f;

unordered_map<long long, long long> dp;
long long n, a, b, c, d;

long long dfs(long long x) {
  if (x == 0) return 0;
  if (x == 1) return d;
  if (dp.find(x) != dp.end()) return dp[x];
  long long &ans = dp[x];
  ans = lnf;
  long long A, B, C;
  A = x / 2 * 2;
  B = x / 3 * 3;
  C = x / 5 * 5;
  ans = min(ans, dfs(A / 2) + a + d * (x - A));
  ans = min(ans, dfs(B / 3) + b + d * (x - B));
  ans = min(ans, dfs(C / 5) + c + d * (x - C));
  A += 2;
  B += 3;
  C += 5;
  ans = min(ans, dfs(A / 2) + a + d * (A - x));
  ans = min(ans, dfs(B / 3) + b + d * (B - x));
  ans = min(ans, dfs(C / 5) + c + d * (C - x));
  if (x < lnf / d) ans = min(ans, x * d);
  return ans;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr); 
  cout << fixed << setprecision(12);
  int tests;
  cin >> tests;
  while (tests--) {
    cin >> n >> a >> b >> c >> d;
    unordered_map<long long, long long> emp;
    dp = emp;
    cout << dfs(n) << endl;
  }
  return 0;
}


Measured memory_bytes: 4704
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int t, a;
    scanf("%d%d", &t, &a);
    vector<float> temp;
    for (int i = 0; i < n; i++) {
       int d;
       scanf("%d", &d);
       temp.push_back(abs((t-d*0.006)-a));
    }
    vector<float>::iterator iter = min_element(temp.begin(), temp.end());
    size_t index = std::distance(temp.begin(), iter);
    printf("%ld\n", index+1);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int n; 
    int r;
    cin >> n >> r;
    if(n >= 10) cout << r <<endl;
    else cout << r+100*(10-n) <<endl; 
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool devidable(int n)
{
    for (int i = 9; i > 0; i--)
    {
        if (n % i == 0 && n / i < 10)
        {
            return true;
        }
    }

    return false;
}

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

    cout << (devidable(n) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007
#define MODB  998244353 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	int d, t , s; cin >> d >> t >> s;
	if (s * t >= d) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	//cout << ans << endl;
}

Measured memory_bytes: 3576
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
   int n,S[1000];

   while(1){
       cin >> n;
       if(n==0)break;

       for(int i=0;i<n;i++)cin >> S[i];
       int s = 0;
       for(int i=0;i<n;i++) s += S[i];
       double m,x=0.0;
       m = 1.0*s/n;
       for(int i=0;i<n;i++) x += (S[i]-m)*(S[i]-m);

       printf("%f\n",sqrt(x/n));
   }
}


Measured memory_bytes: 3128
N=int(input())
p=[list(map(int, input().split())) for _ in range(N)]
ax, ay, ah = list(filter(lambda x: x[2], p))[0]#ピラミッドの高さがないところを抜かないといけないんだ
for i in range(101):
  for j in range(101):
    center=[i,j,ah+abs(ax-i)+abs(ay-j)]
    if all(t[2]==max(center[2]-abs(t[0]-center[0])-abs(t[1]-center[1]),0) for t in p) :
      print(center[0],center[1],center[2])

Measured memory_bytes: 3064
#include <iostream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <string>

using namespace std;

string result;

void search(int i, int sum, string S, int ABCD)
{
		if (i == 4) {
				if (sum == 7) {
						result = S;
				}
		}
		else {
				int dig, num;
				dig = ABCD % 10;
				num = ABCD / 10;
				search(i+1, sum + dig, "+" + to_string(dig) + S, num);
				search(i+1, sum - dig, "-" + to_string(dig) + S, num);

		}
}

int main(int argc, char const* argv[])
{
		int ABCD;
		cin >> ABCD;
		string S = "";
		search(0, 0, S, ABCD);
		cout << result.substr(1) << "=7" << endl;
		return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String s= sc.next();
		String buff= "";
		//double n = sc.nextInt()/1000.0;
		int m = sc.nextInt();
		//int k = sc.nextInt();
		//String s=sc.next();
		long count=0,flag=0;
		long count1=0,count2=0;
		int count3=9999999;
		int[] array1 = new int[m];
		int[] array2 = new int[m];
		int[] array3 = new int[m-1];
		/*array[0]=n-m;
		array[1]=n*m;
		array[2]=n+m;*/
		//Arrays.sort(array);

		for(int i=0;i<m;i++) {
			array1[i]=sc.nextInt();
		}
		for(int i=0;i<m;i++) {
			array2[i]=sc.nextInt();
		}
		for(int i=0;i<m-1;i++) {
			array3[i]=sc.nextInt();
		}
		for(int i=0;i<m;i++) {
			if(count3+1==array1[i])count+=array3[count3-1];
			count+=array2[array1[i]-1];
			count3=array1[i];
		}

		/*if(count==0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}*/

		System.out.println(count);
	}
}




Measured memory_bytes: 23252
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

int n, m, v[100100];
vector<int> G[100100];

int main()
{
	scanf ("%d %d", &n, &m);
	for (int i = 0; i < m; i++){
		int x, y; scanf ("%d %d", &x, &y);
		G[x].push_back(y);
		G[y].push_back(x);
	}

	for (int i = 1; i <= n; i++) v[i] = -1;
	queue<int> q; q.push(1);
	while (!q.empty()){
		int x = q.front(); q.pop();
		for (auto& y : G[x]) if (v[y] == -1){
			q.push(y); v[y] = x;
		}
	}

	for (int i = 2; i <= n; i++) if (v[i] == -1){
		puts("No");
		return 0;
	}
	puts("Yes");
	for (int i = 2; i <= n; i++) printf ("%d\n", v[i]);
	return 0;
}


Measured memory_bytes: 10128
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL; 
typedef struct{
	LL d;	//等价为2升 
	LL x;	//原数据 
	LL n;	//1升需要几杯 
}LIT;

bool cmp(LIT a,LIT b)
{
	return a.d<b.d;
}

int main()
{
	LIT a[5];
	int t=8,n;
	for(int i=1;i<=4;i++){
		cin>>a[i].x;
		a[i].n=t;
		a[i].d=a[i].x*a[i].n;
		t/=2;
	}
	cin>>n;
	sort(a+1,a+5,cmp);
	LL s=0; 
	//2升的最小 
	if(a[1].n==1){
		s+=n/2*a[1].x;
		if(n%2)
			s+=a[2].x*a[2].n/2;
	}
	else
		s+=n*a[1].x*a[1].n/2;
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public static partial class Program
{
    public static void Main()
    {
        var n = CRL().ToInt();
        var txis = CRL().ArrayInts();
        var sum = txis.Sum();

        var m = CRL().ToInt();
        for (int i = 0; i < m; i++)
        {
            var px = CRL().ArrayInts();
            CWL(sum - txis[px[0] - 1] + px[1]);
        }
    }
}

public static partial class Program
{
    //テンプレここから
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static long[] dx = new long[] {0, -1, 0, 1};
    public static long[] dy = new long[] {-1, 0, 1, 0};
    public static long mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);

    public static long LCM(long a, long b) => a * b / GCD(a, b);

    //テンプレここまで
}

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

int main() {

    std::string str;

    std::getline(std::cin, str);

    for ( int i = 0; i < str.size(); i++ ) {
        char c = str[i];

        if      ( c >= 'A' && c <= 'Z' ) c += 'a' - 'A';
        else if ( c >= 'a' && c <= 'z' ) c -= 'a' - 'A';

        str[i] = c;
    }

    std::cout << str << std::endl;

    return 0;
}



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

int main (void)
{
    int a,b,n,x;
    scanf("%d",&x);
    a=0;
    n=3;
    while(1)
    {
            for (b=0;b<=a;b++)
            {
                if(a*a*a*a*a-b*b*b*b*b==x)
                {
                n=0;
                break;
                }
                if(a*a*a*a*a+b*b*b*b*b==x)
                {
                n=1;
                break;
                }
            }
            if(n!=3){
                break;
            }
            a++;
     }
     if(n==0){
     printf("%d %d\n",a,b);
     }
     if(n==1){
     printf("%d %d\n",a,-b);
     }
     return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int A[2][105];
int dp[2][105];

int main(){
  int N;
  cin >> N;
  rep(i,2){
    rep(j,N){
      cin >> A[i][j];
    }
  }
  dp[0][0] = A[0][0];
  dp[1][0] = A[0][0] + A[1][0];
  REP(j,1,N){
    dp[0][j] = dp[0][j-1] + A[0][j];
    dp[1][j] = max(dp[1][j-1] + A[1][j], dp[0][j] + A[1][j]);
  }

  cout << dp[1][N-1] << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int a[100010];

int main(){
    int N, K;
    cin >> N >> K;
    int x = -1;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        if(a[i] == 1){
            x = i;
        }
    }
    cout <<  (N - K + K -2) / (K-1) + 1 << endl;

    return 0;
    int res1 = 0;
    res1 += (x + K-2) / (K-1);
    res1 += (N - x - 1 + K-2) / (K-1);

    if(x == 0 || x == N-1) {
        cout << res1 << endl;
        return 0;
    }

    int res2 = 1;
    res2 += (x - 1 + K-2) / (K-1);
    res2 += (N - x - 2 + K-2) / (K-1);

    cout << min(res1, res2) << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int i=0; i<n; i++)
#define REP2(i, a, b) for(int i=a; i<b; i++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int func(int a, int b){
    return (a+b)/2;
}

int func(int a0, int b0, int a1, int b1){
    if(b0 < b1){
        swap(a0, a1);
        swap(b0, b1);
    }
    int ans = min(b0, a1+b1);
    a1 = max(0, a1 - (b0-b1));
    ans += a0/2;
    ans += a1/2;
    return ans;
}

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

    vector<int> A(M), B(M);
    for(auto x : mp){
        int num = x.first % M;
        int rem = x.second % 2;
        A[num] += x.second - rem;
        B[num] += rem;
    }
    int ans = 0;
    REP(i, M/2+1){
        int j = (M - i) % M;
        if(i == j) ans += func(A[i], B[i]);
        else ans += func(A[i], B[i], A[j], B[j]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6144
#include <stdio.h>

int main(){

  int i;
  int j;
  int n;
  int num;
  int count=0;
  int judge;

  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&num);
    judge=0;
    if(num==2) count++;
    if(num%2==0) continue;
    for(j=3;j<=num/j;j+=2){
      if(num%j==0){
	judge=1;
	break;
      }
    }
    if(judge==0) count++;
  }
  
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;

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

  if(a>8 || b>8) cout << ":(" << endl;
  else cout << "Yay!" << endl;

  return 0;
}

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

using namespace std;

int main(){
  int n, k, q;
  cin >> n >> k >> q;

  vector<int> p(n);

  p.resize(n);
  rep(i,n) p[i] = k - q;

  rep(i,q) {
    int in;
    cin >> in;
    p[in - 1]++;
  }


  rep(i,n){
    if(p[i] < 1) cout << "No" << endl;
    else cout << "Yes" << endl;

  }


  return 0;

}


Measured memory_bytes: 1024
A=[[0 for i in range(3)] for j in range(3)]
for i in range(3):
  A[i] = list(map(int,input().split()))
N=int(input())
for i in range(N):
  b=int(input())
  for j in range(3):
    for k in range(3):
      if A[j][k] == b:
        A[j][k] = 0
bingo=0
sum1=0
sum2=0
sum3=0
sum4=0
sum5=0
for i in range(3):
  if sum(A[i]) == 0:bingo=1
  sum1 += A[i][0]
  sum2 += A[i][1]
  sum3 += A[i][2]
  sum4 += A[i][i]
  sum5 += A[i][2-i]
if 0 in [sum1,sum2,sum3,sum4,sum5]:bingo=1
print(['No','Yes'][bingo])

Measured memory_bytes: 9220
n = int(input())
t = list(map(int, input().split()))
r = {}
ans = 0
for i in range(len(t)):
  try:
    r[i+1 + t[i]] += 1
  except KeyError:
    r[i+1 + t[i]] = 1
for i in range(len(t)):
  if((i+1 - t[i]) >= 1):
    try:
      ans += r[i+1-t[i]]
    except KeyError:
      continue
print(ans)


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll X;
  scanf("%lld",&X);
  ll A;
  scanf("%lld",&A);
  ll B;
  scanf("%lld",&B);
  cout << (X-A)%B << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n;
  string s;
  cin>>n>>s;
  int l[n],r[n];
  l[0] = 0; r[n - 1] = 0;
  for(int i = 1; i < n; i++)
  {
    if(s[i - 1] == 'W') {
      l[i] = l[i - 1] + 1;
    } else {
      l[i] = l[i - 1];
    }
  }
  for(int i = n - 2; i > -1; i--)
  {
    if(s[i + 1] == 'E') {
      r[i] = r[i + 1] + 1;
    } else {
      r[i] = r[i + 1];
    }
  }
  int minv = l[0] + r[0];
  
  for(int i = 0; i < n; i++)
  {
    minv = min(minv, l[i] + r[i]);
  }
  cout << minv << endl;
  
  

  return 0;
}


Measured memory_bytes: 2964
import re


def bubble_sort(C, N):
    for i in range(N):
        for j in reversed(range(1, N)):
            if C[j][1] < C[j-1][1]:
                # 1???????????????????°????????????°??????
                C[j], C[j-1] = C[j-1], C[j]
    return C


def selection_sort(C, N):
    for i in range(N):
        # i ?????????????????¨????????????
        minj = i
        for j in range(i, N):
            # ?????????????????¨??????????°???????????????????
            if C[j][1] < C[minj][1]:
                minj = j
        # ??????????????¨??????????°????????????????????????\????????????
        C[i], C[minj] = C[minj], C[i]
    return C


def is_stable(C, sorted):
    # ????????°???????????????????¨???????????????????????´???????????????????
    c_container = []
    s_container = []
    for i in range(len(C)):
        # C ??§ i ????????\?????????????????§????????°????????????????????¢???
        for j in range(len(C)):
            # ????????°???????????????????????£?????´???
            if C[i][1] == C[j][1]:
                # C ????????????????¨?????????????
                c_container.append(C[j][0])
        # ????????°???????????????????????¨????????´???
        if len(c_container) >= 2:
            # C ??§ i ???????????????????????°?????¨????????°????????????????????¢???
            for k in range(len(sorted)):
                # ????±??????????????????°?????¨????????°???????¨?????????????????????????????????????????????????????´?
                if sorted[k][1] == C[i][1]:
                    s_container.append(sorted[k][0])
            # ??????????????´?????????????????£?????´???
            if c_container != s_container:
                # Not Stable
                return False
        # ?????????????????????
        c_container = []
        s_container = []

    return True


if __name__ == '__main__':
    N = int(input())
    # ??????????????????????????????????????¨?????¨??°?????¨?????????????????????????´?
    cards = input().split()
    C = [[] for i in range(N)]
    for i in range(N):
        # ??????????¨??????¨??°????????????
        symbol_and_num = re.findall(r'(\d+|\D+)', cards[i])
        C[i] = [symbol_and_num[0], int(symbol_and_num[1])]

    # ??????????????????????????????
    bubble_sorted = bubble_sort(C.copy(), N)
    # ?¨??????¨???????????????
    bubble_sorted_cards = [val[0] + str(val[1]) for val in bubble_sorted]
    # ?????????????????????
    print(' '.join(bubble_sorted_cards))
    # stable or not stable
    print('Stable' if is_stable(C, bubble_sorted) else 'Not stable')

    # ?????????????????????
    selection_sorted = selection_sort(C.copy(), N)
    # ?¨??????¨???????????????
    selection_sorted_cards = [val[0] + str(val[1]) for val in selection_sorted]
    # ?????????????????????
    print(' '.join(selection_sorted_cards))
    # stable or not stable
    print('Stable' if is_stable(C, selection_sorted) else 'Not stable')

Measured memory_bytes: 7928
fun main(args: Array<String>){
    val AB = listOfInt().sorted()
    val A = AB.min() ?: 0
    val B = AB.max() ?: 0
    val K = (B - A) / 2
    if (K + K == B - A)
        println(A + K)
    else
        println("IMPOSSIBLE")
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toLong() }


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

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

    vector<int> p(N);
    rep(i, N) {
        cin >> p[i];
    }

    sort(p.begin(), p.end());
    const auto ret = accumulate(p.begin(), p.begin() + K, 0);

    cout << ret << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>

using namespace std;
static const int N = 100;

void inputArray(int a[], int n){
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
}

void swap(int a, int b){
    int v;
    v = a; a = b; b = v;
}

void printArray(int a[], int n){
    int k = 0;
    while(1){
        if(k==n-1) break;
        else{
            printf("%d ", a[k]);
        }
        k++;
    }
    printf("%d\n", a[n-1]);
}

int selectionSort(int a[], int n){
    int minj,count=0,v;
    for (int i = 0; i < n; ++i)
    {
        minj = i;
        for (int j = i; j < n; ++j)
        {
            if(a[j] < a[minj]){
                minj = j;
            }
        }
        if (i!=minj)
        {
            v = a[i]; a[i] = a[minj]; a[minj] = v;
            count++;
        }
    }
    return count;
}

int main(int argc, char const *argv[])
{
    int A[N];
    int n,m;

    cin >> n;
    inputArray(A,n);
    m = selectionSort(A,n);
    printArray(A,n);
    printf("%d\n", m);

    return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
  ll  n; cin>>n;  
for(ll i=1;i<10;i++){
if(n%i==0){
if(n/i<=9){
cout<<"Yes"<<endl;
return 0;
}
}
}
  cout<<"No"<<endl;
  
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<bits/stdc++.h>
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)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll ans=0;
  int n,k;
  cin >> n >> k;
  int r,s,p;
  cin >> r >> s >> p;
  string t;
  cin >> t;
  vector<vector<char>> c;
  c.resize(k);
  rep(i,k){
    for(int j=i;j<n;j+=k){
      c[i].push_back(t[j]);
    }
  }
  rep(i,k){
    rep(j,c[i].size()){
      if(c[i][j]=='r')ans+=p;
      if(c[i][j]=='s')ans+=r;
      if(c[i][j]=='p')ans+=s;
      if(j+1<c[i].size() && c[i][j]==c[i][j+1])j++;
    }
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 5120
#include <iostream>
#include <string>
#define MOD 1000000007

using namespace std;
int main() {

	int N;
	string S1, S2;
	cin >> N >> S1 >> S2;

	string tmp;
	int strBegin = 0;
	long long pattern = 0;

	while (strBegin < N) {
		tmp = S1.substr(strBegin, 4);
		if (pattern == 0) {
			//AA??
			//BB??
			if (tmp[0] == tmp[1]) {
				pattern = 6;
			//A???
			//A???
			} else {
				pattern = 3;
			}
		} else {
			//AA??
			//BB??
			if (tmp.length() >= 3 && tmp[0] == tmp[1]) {
				strBegin += 2;
				//AACC
				//BBDD
				if (tmp.length() == 4 && tmp[2] == tmp[3]) {
					pattern = (pattern * 3) % MOD;
					//AAC?
				//BBC?
				} else {
					pattern *= 1;
				}
			//A???
			//A???
			} else if (tmp.length() >= 2 && tmp[0] != tmp[1]) {
				strBegin++;
				//ABB? AB??
				//ACC? AB??
				if ((tmp.length() >= 3 && tmp[1] == tmp[2]) || (tmp.length() >= 2)) {
					pattern = (pattern * 2) % MOD;
				}
			} else {
				break;
			}
		}
	}

	cout << pattern;

	return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t,a,b;
	t = 1;
	while(t--) {
	 cin >> a >> b;
	 if(a > b)
	  cout << a - b << endl;
	 else
	  cout << 0 << endl;
	}
	return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.math.BigInteger;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String r = sc.next();
		String q = sc.next();
		BigInteger t = BigInteger.ONE;
		BigInteger m = new BigInteger("1000000007");
		BigInteger two = new BigInteger("2");
		BigInteger three = new BigInteger("3");
		int p = -1; // Previous config 0 - 2x1, 1 - 1x2
		for (int i=0; i<N; i++) {
			if (r.charAt(i)==q.charAt(i)) {
				if (p==-1) t = new BigInteger("3");
				if (p==0) t = t.multiply(two).mod(m);
				p=0;
			} else { 
				if (p==-1) t = new BigInteger("6");
				if (p==0) t = t.multiply(two).mod(m);
				if (p==1) t = t.multiply(three).mod(m);
				p=1; i++;
			}
		}
		System.out.println(t);
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

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

int main(){
  string c;
  cin >> c;
  if (c[0] == 'a' ||
      c[0] == 'i' ||
      c[0] == 'u' ||
      c[0] == 'e' ||
      c[0] == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
  
  return 0;
  
}

Measured memory_bytes: 3592
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math #math.factorial(n)
from copy import copy, deepcopy
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 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
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

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#N = int(input())
#N, K = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]


S=input()
if S=='ABC':print('ARC')
else: print('ABC')


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

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int d[] = { 300000, 200000, 100000 };
  int x, y; cin >> x >> y;

  int ans = 0;
  if (x <= 3) ans += d[x-1];
  if (y <= 3) ans += d[y-1];

  if (x == 1 && y == 1) ans += 400000;

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define pll pair<ll,ll>
#define pld pair<ld,ld>
using namespace std;

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
ll modInv(ll a, ll m);
ll gcdExtended(ll a, ll b, ll *x, ll *y);
bool isPrime(ll n);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,i,j,k,l,h,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;
    char ch,ch2,ch3;
    string s,s1,s2,s3;
    // freopen ("input.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
    t=1;
    // cin>>t;
    while(t--){
        vector<ll> v,w;
        unordered_map<ll,ll> N;
        set<ll> S,SS;
        cin>>n>>k;
        ll A[n];
        for(i=0;i<n;i++){
            cin>>A[i];
        }
        i=0;
        j=k;
        f=0;
        while(j<n){
            if(A[j]<=A[i]){
                cout<<"No\n";
            }
            else{
                cout<<"Yes\n";
            }
            i++;
            j++;
        }
    }
    return 0;
}

ll modInv(ll a, ll m){
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y){
    if (a == 0){
        *x = 0, *y = 1;
        return b;
    }
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;
    return gcd;
}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}

bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}


Measured memory_bytes: 5232
S = int(input())
cnt = 0
if S//1000 == (S//100)%10:
  cnt += 1
if (S//100)%10 == (S//10)%10:
  cnt += 1
if (S//10)%10 == S%10:
  cnt += 1
if cnt == 0:
  print('Good')
else:
  print('Bad')

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define debug cerr
using namespace std;
const int maxn = 53;

char in[maxn * maxn];
int lson[maxn], rson[maxn], id[maxn], cnt;
int tar[maxn], pts[maxn];

stack<int> nums, ope;

inline void gen() {
	for(int i = 1; i <= 26; i++) id[cnt = i] = i;
	int len  = strlen(in + 1);
	for(int i = 1; i <= len; i++) {
		if(in[i] == '[') ope.push(0);
		if(in[i] == ']') {
			// assert(nums.size() >= 2 && ope.top() == 0);
			++cnt, ope.pop();
			lson[cnt] = nums.top(), nums.pop();
			rson[cnt] = nums.top(), nums.pop();
			nums.push(cnt);
		}
		if('a' <= in[i] && in[i] <= 'z') nums.push(in[i] - 'a' + 1);
	}
	// assert(!ope.size() && nums.size() == 1);
}
inline void getTar() {
	static char tp[maxn];
	static int tt;
	memset(tar, -1, sizeof tar);
	while(scanf("%s%d", tp, &tt) == 2) {
		if(tar[*tp - 'a' + 1] != -1 && tar[*tp - 'a' + 1] != tt) exit((puts("No"), 0));
		tar[*tp - 'a' + 1] = tt;
	}
	for(int i = 1; i <= 26; i++) if(!~tar[i]) tar[i] = 0;
}
inline bool test(int sta) {
	memset(pts + 1, 0, (sizeof(int)) * 26);
	for(int i = 27, cur; i <= cnt; i++) {
		cur = sta & 1, sta >>= 1;
		if(cur) id[i] = id[lson[i]];
		else id[i] = id[rson[i]];
		++pts[id[i]];
		if(pts[id[i]] > tar[id[i]]) return 0;
	}
	for(int i = 1; i <= 26; i++) if(pts[i] != tar[i]) return 0;
	return 1;
}

int main() {
	scanf("%s", in + 1), gen(), getTar();
	const int fs = 1 << (cnt - 26);
	for(int i = 0; i < fs; i++) if(test(i)) return puts("Yes"), 0;
	return puts("No"), 0;
}



Measured memory_bytes: 3176