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

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

    int N; cin>>N;
    int ans=0;
    int a[4]={25,10,5,1};  
    for(int i=0;i<4;i++){
        ans+=N/a[i];
        N%=a[i];
    }
    cout<<ans<<endl;
    return 0;
}


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

typedef long long ll;

#define v(T) vector<T>
#define ttt(T) tuple<T, T, T>
#define pb push_back
#define mp make_pair
#define rep(i, s, n) for(int i=s;i<n;i++)
#define repeq(i,s,n) for(int i=s;i<=n;i++)
#define poiu(n) for(int i=0; i < n; i++)
#define MOD (int)10e9+7
#define endl '\n'

template<typename T>
void max_self(T& a, T b) { a=a>b?a:b; }
template<typename T>
void min_self(T& a, T b) { a=a<b?a:b; }

using namespace std;
const int mxN = 100005;

int n;
int W;
ll temp_one, temp_two;

ll dp[mxN];
int main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> W;

    for(int i = 0; i<n;i++) {
        cin >> temp_one >> temp_two;
        for(int w=W-temp_one;w>=0;w--)
            max_self(dp[w+temp_one],dp[w]+temp_two);
    }

    ll temp_max=0;
    for(int i=0;i<=W;i++)
        max_self(temp_max,dp[i]);
    cout << temp_max << endl;
            
    


    return 0;

}



Measured memory_bytes: 1024
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>

int main(){
  
  long long int N;
  std::string S, T;

  scanf("%lld", &N);

  std::cin >> S >> T;
  
  std::cerr << "S: " << S << std::endl;
  std::cerr << "T: " << T << std::endl;

  std::cerr << "Answer: " << std::endl;

  for(long long int i = 0; i < N; i++){
    std::cout << S[i] << T[i];
  }std::cout << std::endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc=new Scanner(System.in)){
			long X=sc.nextLong();
			long Y=sc.nextLong();
			long count=0;
			for(long i=X; i<=Y; i=i*2) {
				count++;
			}
			System.out.println(count);
		}
	}	
}

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

#define int long long int 


int32_t main()
{
    int n;
    cin>>n;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        ans+=x-1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e17;

int n;
vector<ll> v(405);
ll dp[405][405]; //dp[i][j] = minimum cost of interval [i, j]
ll s[405][405]; //s[i][j] = sum of interval [i, j]

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("C.txt", "r", stdin);
    #endif
    cin >> n;
    for(int i=1; i<=n; i++)
    {
        cin >> v[i];
        for(int j=i; j<=n; j++){
            dp[i][j]=INF;
        }
        dp[i][i] = 0;
    }
    for(int i=1; i<=n; i++)
    {
        for(int j=i; j<=n; j++)
        {
            s[i][j] = s[i][j-1] + v[j];
        }
    }
    for(int x=1; x<n; x++)
    {
        int b=x+1;
        for(int i=1; b<=n; i++, b++)
        {
            for(int j=i; j<b; j++)
            {
                dp[i][b] = min(dp[i][b], dp[i][j]+dp[j+1][b]);
            }
            dp[i][b] += s[i][b];
        }
    }
    cout << dp[1][n];
}



Measured memory_bytes: 2816
S = input()
is_odd = True
is_ng = False
for c in S:
    if is_odd:
        if c == 'L':
            is_ng = True
            break
        is_odd = not is_odd
    else:
        if c == 'R':
            is_ng = True
            break
        is_odd = not is_odd
print('YNeos'[is_ng::2])

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

using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	bool ok = false;
	int size = s.size();
	for (int i = 0; i < size; i++)
		if (s.substr(i, size - i) + s.substr(0, i) == t)
			ok = true;
	cout << (ok ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define ABS(a) ((a) < 0 ? (0 - (a)) : (a))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define TRUE 1
#define FALSE 0
#define PI 3.14159265358979323846
#define HELL 1000000007ll
#define INF 1000000000000015
//#define getchar_unlocked() getchar()

long long fast_in()
{
	static long long j_fast;
	static char c_fast;
	j_fast = 0;
	c_fast = getchar_unlocked();
	while (c_fast < '0' || c_fast > '9')
		c_fast = getchar_unlocked();
	while (c_fast >= '0' && c_fast <= '9') {
		j_fast = (j_fast << 1) + (j_fast << 3) + c_fast - '0';
		c_fast = getchar_unlocked();
	}
	return j_fast;
}

long long power(long long base, long long exp)
{
	long long res = 1;
	while (exp) {
		if (exp & 1)
			res = (res * base) % HELL;
		base = (base * base) % HELL;
		exp >>= 1;
	}
	return res;
}

#define MAXN 100005
int main()
{
	static long long n, i, count[MAXN];
	n = fast_in();
	for (i = 0; i < n; i++)
		count[fast_in()]++;
	for (count[0]++, i = ~n & 1; i < n && count[i] == 2; i += 2)
		;
	if (i < n)
		printf("0");
	else
		printf("%lld", power(2, n >> 1));
	return 0;
}

Measured memory_bytes: 896
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        int n = s.length();

        String front = s.substring(0, (n - 1) / 2);
        String back = s.substring(((n + 3) / 2) - 1, n);

        if (isReversed(s) && isReversed(front) && isReversed(back)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

    static boolean isReversed(String s) {
        String reversed = new StringBuilder(s).reverse().toString();
        return s.equals(reversed);
    }
}

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

using namespace std;

int a, b, soc, num;

int main () {
	num = 0;
	soc = 1;
	cin >> a >> b;
	while(soc < b) {
		soc = soc - 1 + a;
		num++;
	}
	cout << num << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int dice[7][4] = {
    { -1, -1, -1, -1 },
    {  2,  3,  5,  4 },
    {  1,  4,  6,  3 },
    {  1,  2,  6,  5 },
    {  1,  5,  6,  2 },
    {  1,  3,  6,  4 },
    {  2,  4,  5,  3 },
};
int dp[100][100][7][7];
int f(int k, int l) {
    for (int i = 0; i < 4; i++) {
        if (dice[l][i] == k) {
            return dice[l][(i + 1) % 4];
        }
    }
    return -1;
}
int main() {
    int H, W; cin >> H >> W;
    vector<string> S(H);
    for (auto &s : S) cin >> s;
    stack<tuple<int, int, int, int>> st;
    st.emplace(0, 0, 6, 2);
    while (!st.empty()) {
        int i, j, k, l; tie(i, j, k, l) = st.top(); st.pop();
        if (dp[i][j][k][l]) continue;
        if (S[i][j] == '#' || S[i][j] - '0' != k) continue;
        dp[i][j][k][l] = 1;
        if (i - 1 >= 0) st.emplace(i - 1, j, 7 - l, k);
        if (i + 1 < H) st.emplace(i + 1, j, l, 7 - k);
        if (j - 1 >= 0) st.emplace(i, j - 1, 7 - f(k, l), l);
        if (j + 1 < W) st.emplace(i, j + 1, f(k, l), l);
    }
    bool ans = false;
    for (int k = 1; k <= 6; k++) {
        for (int l = 1; l <= 6; l++) {
            ans |= dp[H - 1][W - 1][k][l];
        }
    }
    cout << (ans ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 5212
n,k=map(int,input().split())
num=[list(map(int,input().split())) for i in range(n)]
num.sort(key=lambda s:s[0])
for i in range(n):
    a,b=num[i][0],num[i][1]
    if k-b>0:
        k-=b
    else:
        print(a)
        break

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

using namespace std;
#define ll long long

int main(){
    string a,b,c;
    cin >> a >> b >> c;
    ll p=a.size()-1,q=b.size()-1,r=c.size()-1;
    if(a[p]==b[0] && b[q]==c[0]) cout << "YES";
    else cout << "NO";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<deque>
using namespace std;

using ll = long long;

int main()
{
    int n, m;
    cin >> n >> m;
    ll result = (100 * n + 1800 * m) * pow(2, m);
    cout << result << endl;
}


Measured memory_bytes: 384
(let* ((n (read))
       (m (read))
       (c (read))
       (b (make-array (list m)))
       (ans 0))
  (loop :for i :from 0 :to (1- m)
        :do (setf (aref b i) (read)))
  (loop :for i :from 1 :to n
        :for s := (loop :for j :from 0 :to (1- m)
                        :sum (* (aref b j) (read)))
        :if (> (+ s c) 0)
        :do (incf ans))
  (format t "~A~%" ans))


Measured memory_bytes: 24808
# abc106_b.py
# https://atcoder.jp/contests/abc106/tasks/abc106_b

# B - 105 /
# 実行時間制限: 2 sec / メモリ制限: 1000 MB
# 配点: 200点

# 問題文
# 105という数は, 非常に特殊な性質を持つ - 奇数なのに, 約数が 8 個もある.
# さて, 1 以上 N 以下の奇数のうち, 正の約数を ちょうど 8個持つようなものの個数を求めよ.

# 制約
#     Nは 1 以上 200以下の整数

# 入力
# 入力は以下の形式で標準入力から与えられる.
# N

# 出力
# 条件を満たす数の個数を出力しなさい.

# 入力例 1
# 105

# 出力例 1
# 1

# 1以上 105 以下の整数の中で, ただ一つの「奇数かつ約数が 8 個」を満たす数は 105である.

# 入力例 2
# 7

# 出力例 2
# 0

# 1は約数が 1 個, 3, 5, 7 は全て素数なので約数が 2 個である. よって前述の条件を満たすような数は存在しない. 


def calculation(lines):
    # A, B = list(map(int, lines[0].split()))
    N = int(lines[0])
    cnt = 0
    for i in range(N+1):
        if i % 2 == 1:
            if get_yakusu_cnt(i) == 8:
                cnt += 1
    return [cnt]


def get_yakusu_cnt(n):
    # 3
    if n % 81 == 0:
        n3 = 4
    elif n % 27 == 0:
        n3 = 3
    elif n % 9 == 0:
        n3 = 2
    elif n % 3 == 0:
        n3 = 1
    else:
        n3 = 0
    # 5
    if n % 125 == 0:
        n5 = 3
    elif n % 25 == 0:
        n5 = 2
    elif n % 5 == 0:
        n5 = 1
    else:
        n5 = 0
    # 7
    if n % 49 == 0:
        n7 = 2
    elif n % 7 == 0:
        n7 = 1
    else:
        n7 = 0
    # 11
    if n % 121 == 0:
        n11 = 2
    elif n % 11 == 0:
        n11 = 1
    else:
        n11 = 0
    # 13
    if n % 169 == 0:
        n13 = 2
    elif n % 13 == 0:
        n13 = 1
    else:
        n13 = 0
    return (n3+1)*(n5+1)*(n7+1)*(n11+1)*(n13+1)


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['105']
        lines_export = [1]
    if pattern == 2:
        lines_input = ['7']
        lines_export = [0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9304
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007LL
#define INF 2000000000
#define PI 3.1415926

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T> inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int a, b, k; cin >> a >> b >> k;
	int cnt = 0;
	for(int i = 100; i >= 1; i--){
		if(a%(i)==0 and b%(i)==0) cnt++;
		if(cnt == k){
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}

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

int main() {

	int N,M;
	char C[256][11];
	char T[256][11];
	int i,j;
	int flag=0;
	int Unknown;

	scanf("%d",&N);
	for(i=0;i<N;i++)
		scanf("%s",C[i]);

	scanf("%d",&M);
	for(i=0;i<M;i++)
		scanf("%s",T[i]);

	for(i=0;i<M;i++) {
		Unknown = 1;
		for(j=0;j<N;j++) {
			if(strcmp(T[i],C[j])==0) {
				Unknown=0;
				if(!flag) {
					printf("Opened by %s\n",T[i]);
					flag = 1;
					break;
				}
				else {
					printf("Closed by %s\n",T[i]);
					flag = 0;
					break;
				}
			}
		}
		if(Unknown)
			printf("Unknown %s\n",T[i]);
	}
	return 0;
}

Measured memory_bytes: 612
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

#define ll long long

const unsigned long long MAXN = (int)3e5 + 5;
const int MAXI = (int)2e9;
const ll INF = (1e18);
const int K = 3;

int main(){
    int n,sz;cin >> n >> sz;
    vector<ll> dp(sz + 100);
    for (int i = 1;i <= n;i ++) {
        int w,v;cin >> w >> v;
        for (int have = sz - w;have >= 0;have --) {
            dp[have + w] = max(dp[have + w], dp[have] + v);
        }
    }
    ll ans = 0;
    for (int i = 1;i <= sz;i ++) {
        ans = max(ans, dp[i]);
    }
    cout << ans;
    return 0;
}

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

int main(void){
	string s="CODEFESTIVAL2016";
	string in;
	int cnt=0;
	cin>>in;
	rep(i,16){
		if(s[i]!=in[i])cnt++;
	}
	cout<<cnt<<endl;

	return 0;
}


Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    H = N // 2
    V = [int(v) for v in input().split()]
    odd, even = dict(), dict()
    for i, v in enumerate(V):
        if i % 2 == 0:
            if v in even: even[v] += 1
            else: even[v] = 1
        else:
            if v in odd: odd[v] += 1
            else: odd[v] = 1

    evenL = [(0, 0), (0, 0)]
    evenMax = 0
    for key in even:
        if even[key] >= evenL[0][0]: evenL = [(even[key], key), evenL[0]]
        elif even[key] >= evenL[1][0]: evenL[1] = (even[key], key)
    oddL = [(0, 0), (0, 0)]
    for key in odd:
        if odd[key] >= oddL[0][0]: oddL = [(odd[key], key), oddL[0]]
        elif odd[key] >= oddL[1][0]: oddL[1] = (odd[key], key)


    if evenL[0][1] == oddL[0][1]: print(N - max(evenL[0][0] + oddL[1][0], evenL[1][0] + oddL[0][0]))
    else: print(N - evenL[0][0] - oddL[0][0])

    return 0

if __name__ == "__main__":
    solve()

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin>>n;
  vll a(n);
  REP(i,n)cin>>a[i];

  ll maxa=a[0];
  ll mina=a[0];
  set<ll> s;
  map<ll,ll> m;
  REP(i,n){
    maxa=max(maxa,a[i]);
    mina=min(mina,a[i]);
    s.insert(a[i]);
    m[a[i]]+=1;
  }

  bool ans;
  ll diff=maxa-mina;
  if(diff==0){
    if(a[0]==n-1 || 2*a[0]<=n)
      ans=true;
    else
      ans=false;
  }
  else if(diff==1){
    ll x=m[mina];
    if(2*(maxa-x)<=m[maxa] && maxa-x>0)
      ans=true;
    else
      ans=false;
  }
  else
    ans=false;

  if(ans)
    yes;
  else
    no;
}



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

int main() {
	ll n, m, k;
	cin >> n >> m >> k;
	vector<ll> a(n), b(m);
	vector<ll> sa(n), sb(m);
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];
	rep(i, n) {
		if(i==0) sa[i] = a[i];
		else sa[i] = sa[i-1]+a[i];
	}
	rep(i, m) {
		if(i==0) sb[i] = b[i];
		else sb[i] = sb[i-1]+b[i];
	}
	// rep(i, n) cout << sa[i] << " ";
	// cout << endl;
	// rep(i, m) cout << sb[i] << " ";
	// cout << endl;
	ll ans = upper_bound(all(sb), k) - sb.begin();
	rep(i, n){
		if(sa[i]>k) break;
		ll bi = upper_bound(all(sb), k-sa[i]) - sb.begin();
		// cout << k-sa[i] << " " << bi << endl;
		ans = max(ans, i + bi + 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9588
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n, m;
	int dp[50001] = { 0 };
	cin >> n >> m;
	int c[10000];
	for (int i = 0; i < 50001; i++){
		dp[i] = 1<<13;
	}
	for (int i = 0; i < m; i++){
		cin >> c[i];
	}
	dp[0] = 0;
	for (int i = 0; i < m; i++){
		for (int i2 = 0; i2 <= 50000; i2++){
			if (i2 + c[i] <= n){
				dp[i2 + c[i]] = min(dp[i2 + c[i]], dp[i2] + 1);
			}
		}
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 1376
#include<bits/stdc++.h>
using namespace std;
     
     
typedef long long ll;
typedef vector <int> vi;
typedef pair <int,int> pi;
typedef tuple <int,int,int> ti;

#define forn(i,a,n) for(int i = a; i < n ; i++)
#define mem(str,a) memset(str, a, sizeof(str));
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(nullptr)
const int MOD = 1e9+7, N = 1e7 + 10, E = 1e-9;
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
//vector <int> show;
//for (auto x : show)
//   cout << x << " ";
getline(cin,s);


*/

int main() {
    ll a,b,x;
    cin >> a >> b >> x;
    if(a%x != 0)
        a = x * (a/x+1);
    ll res = 0;
    if(a <= b)
        res++;
    res += (b-a)/x;
    cout << res << endl;
    return 0;
}

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

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

    char d[3];
    d[0] = 'A';
    d[1] = s[0];
    d[2] = 'C';
    cout << d;
    return 0;
}

Measured memory_bytes: 256
gets
    cnt = 0
    list = gets.chomp.split(" ").map(&:to_i);
    while true do
        list.each do |n|
            if n % 2 == 1 then
                print(cnt)
                exit
            end
        end
        cnt = cnt + 1

        list.map!{|n| n / 2}
    end

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


int main() {
    int H,W;cin >> H >> W;
    int N;cin >> N;
    vector<int> A(N);
    for (int i = 0;i < N;i++){
      cin >> A.at(i);
    }

    vector<vector<int>> C(H,vector<int>(W));
    int ni = 0;
    for (int i = 0;i < H;i++){
      for (int j = 0;j < W;j++){
        if (A.at(ni) > 0){
          A.at(ni)-=1;
          C.at(i).at(j) = ni+1;
        }else{
          ni+=1;
          A.at(ni)-=1;
          C.at(i).at(j) = ni+1;
        }
      }
    }

    for (int h = 0;h < H;h++){
      if (h%2 == 0){
        for (int w = 0;w < W;w++){
          cout << C.at(h).at(w) << " ";
        }
      }else{
        for (int w = 0;w < W;w++){
          cout << C.at(h).at(W-w-1) << " ";
        }
      }
      cout << endl;
    }

  }       

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;

int Prime[55556];   //Prime[i]が1だったらiは素数。0だったら素数でない

void Eratosthenes(int m) {  //m未満の素数を求める

    rep(i, m) {
        Prime[i] = 1;
    }

    Prime[0] = 0;  Prime[1] = 0;
    for(int i = 2; i*i < m; i++) {
        if(Prime[i]) {
            for(int j = 2; i*j < m; j++) {
                Prime[i*j] = 0;
            }
        }
    }
}

int main() {
    int n;
    cin >> n;
    int a[n];
    int j = 0;    

    Eratosthenes(55556);

    for(int i = 11; i <= 55555; i += 5) {
        if(Prime[i]) {
            a[j] = i;
            j++;
        }
        if(j >= n) {
            break;
        }
    }

    rep(i, n-1) {
        cout << a[i] << " ";
    }
    cout << a[n-1];

    cout << endl;
    return 0;
}

Measured memory_bytes: 512
/*input
6
30 10 60 10 60 50
*/

#include <bits/stdc++.h>
#define pb(x) push_back(x);
#define in(y) insert(y);
#define tt(t) while(t--)
#define int long long int
#define itr ::iterator it;
#define ll long long
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define si set<int>                      
#define msi map<string, int>
#define lines printsf("\n")
#define ff(n) for(int i=0;i<n;i++)
#define fors(i,a,b) for(int i=a;i<b;i++)
#define all(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
const int MOD = 998244353;
int n,k;
vi arr;
int dp[1000000];
int solve(int pos){
	if(pos==n-1) return 0;
	if(pos>=n) return 9999999999LL;
	if(dp[pos]!=-1) return dp[pos]; 
	int ret = 999999999LL;
	//int ret = min(solve(pos+1)+abs(arr[pos]-arr[pos+1]),solve(pos+2)+abs(arr[pos]-arr[pos+2]));
	for(int i=1;i<=k;i++){
		if(pos+i<=n-1){
			ret = min(ret,solve(pos+i)+abs(arr[pos]-arr[pos+i]));
		}
	}
	return dp[pos]=ret;
}
signed main(){
	ff(1000000-1) dp[i]=-1;
	cin>>n;
	cin>>k;
	arr.resize(n);
	ff(n) cin>>arr[i];
	int ans = solve(0);
	cout<<ans;
}



Measured memory_bytes: 13568
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)



ll fast_pow(ll x,ll n,ll mod){
    if (n==0) return 1;
    ll res=fast_pow(x*x %mod,n/2,mod);
    if (n&1) res=res*x%mod;
    return res;
}

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;




int main(){
    int n;
    cin>>n;
    ll a[n];
    ll tas;
    rep(i,n){
        cin>>tas;
        a[i]=2*tas;
        //cout<<a[i];
    }
    //二部探索
    ll lb=-1,ub=1e10;
    ll a1=0;
    bool check=false;
    
    while(check==false){
        ll mid=(ub+lb)/2;
        ll cnt=mid;
        //cout<<mid<<endl;
        
        rep(i,n){
            cnt=a[i]-cnt; 
            
        }//cout<<mid<<","<<cnt<<endl;
            //cout<<i<<","<<cnt<<","<<a[i]<<endl;//i+1番目の水の量の候補を移す
        if (cnt==mid){
            a1=mid;
            check=true;
        }else if (cnt>mid){
            lb=mid;
        }else{
            ub=mid;
        }
    }
    //cout<<a1;
    rep(i,n){
        
        cout<<a1<<" ";
        a1=a[i]-a1;
    }
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll n,x;

ll f(ll a,ll b){
	if(a==0){
		return -b;
	}else return (b/a)*a*2+f(b%a,a);
}

int main(){
	cin>>n>>x;
	ll a=n-x,b=x;
	
	cout<<n+f(a,b)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	std::string s; cin >> s;
	int x, y; scanf("%d%d", &x, &y);

	std::vector<std::pair<char, int>> vec;
	for(int i = 0; i < s.size(); i++) {
		if(vec.empty() or vec.back().first == 'T' or vec.back().first != s[i]) vec.push_back({s[i], 1});
		else vec.back().second++;
	}

	const int pot = s.size();
	auto dp = make_v<bool>(2, 2 * s.size() + 1);
	if(vec.front().first == 'F') dp[0][pot + vec.front().second] = dp[1][pot] = true;
	else dp[0][pot] = dp[1][pot] = true;
	for(int i = (vec.front().first == 'F'), d = 0; i < vec.size(); i++) {
		if(vec[i].first == 'T') {
			d = (d + 1) % 2;
			continue;
		}

		int val = vec[i].second;
		auto to = make_v<bool>(2, dp[0].size());

		to[1 - d].swap(dp[1 - d]);
		for(int j = 0; j < dp[d].size(); j++) {
			if(!dp[d][j]) continue;
			int A = j + val, B = j - val;
			to[d][A] = to[d][B] = true;
		}
		dp.swap(to);
	}
	
	if(dp[0][pot + x] and dp[1][pot + y]) printf("Yes\n");
	else printf("No\n");
	return 0;
}


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

#define MAX 10000

int isprime(int x){

  int i;

  if(x == 2){
    return 0;
  }

  if(x < 2 || x%2 == 0){
    return -1;
  }

  for(i = 3;i <= sqrt(x);i += 2){
    if(x%i == 0){
      return -1;
    }
  }

  return 0;
}

int main(){

  int i;
  int num;
  int cnt = 0;
  int temp;

  scanf("%d",&num);

  for(i = 0;i < num;i++){

    scanf("%d",&temp);

    if(isprime(temp) == 0){
      cnt++;
    }
  }

  printf("%d\n",cnt);

  return 0;
}

Measured memory_bytes: 596
#include <stdio.h>

#define MAX 200000

int max(int a,int b) { return a>b ? a: b;}
int min(int a,int b) { return a<b ? a: b;}

int main(void) {
    int R[MAX], i, n;
    
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for(int i=1; i<n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    printf("%d\n",maxv);

    return 0;
}


Measured memory_bytes: 2548
#include <iostream>

using namespace std;

int main()
{
    char x;
    char y;
    char z;
    char n;
    cin >>x>>y>>z>>n;
    if (x==y&&n==z&&x!=n&&x!=z&&y!=n&&y!=z)
    cout << "Yes" << ' ';
    else if (y==z&&y==n)
    cout << "No" << ' ';
    else if (x==z&&x==n)
    cout << "No" << ' ';
    else if (n==z&&n==y)
    cout << "No" << ' ';
    else if (z==n&&x==y)
    cout << "No" << ' ';
    else if (x==z&&y==n&&x!=y&&x!=n&&z!=y&&z!=n)
    cout << "Yes" << ' ';
    else if (x==n&&y==z&&y!=n&&z!=n&&x!=y&&x!=z)
    cout << "Yes" << ' ';
    else if (z==x&&y==n&&z!=y&&z!=n&&x!=y&&x!=n)
    cout << "Yes" << ' ';
    else
    cout << "No" << ' ';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q, cnt = 0; cin >> n >> q;
  string s; cin >> s;
  vector<int> memo(n);
  for (int i = 1; i < n; i++) {
    char a = s[i - 1];
    char c = s[i];
    if (a == 'A' && c == 'C') {
      cnt++;
    }
    memo[i] = cnt;
  }
  for (int i = 0; i < q; i++) {
    int l, r; cin >> l >> r;
    cout << memo[r - 1] - memo[l - 1] << endl;
  }
  return 0;
}


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

public class Main {

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

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			char[] s = in.nextString().toCharArray();
			int n = s.length;

			int l = -1, r = -1;
			boolean isFirst = true;
			for (int i = 0; i < n; i++) {
				if (isFirst && s[i] == 'A') {
					l = i;
					isFirst = false;
				}
				if (s[i] == 'Z') {
					r = i;
				}
			}
			out.println(r-l+1);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

	static void print(int[][] dp) {
		int n = dp.length;
		int m = dp[0].length;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				System.out.print(dp[i][j] + " ");
			}
			System.out.print("\n");
		}
		System.out.print("\n");
	}

}


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

#pragma region template


// -type-
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;


// -const-
const ll MOD = 1000000007;

const string YES = "No";

const string NO = "No";

const ll MAX = (ll)0x3f0000003f000000;
const double EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1},
          dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


// -define-
#define F first
#define S second

#define reps(i, k, n) for (int i = (k), i##_len = (n); i < i##_len; ++i)
#define rep(i, n) reps(i, 0, n)
#define repsr(i, k, n) for (int i = (n)-1; 0 <= i; --i)
#define repr(i, n) repsr(i, 0, n)
#define all(o) begin(o), end(o)
#define sz(a) ((int)(a).size())
#define debug(x) cerr << x << " (L:" << __LINE__ << ")" << '\n';


// -functions-

inline bool in(string s, string c) {
    return (s.find(c) != string::npos);
}
inline bool in(string s, char c) {
    return (s.find(c) != string::npos);
}

template <class T>
void print(T& x) {
    std::cout << x << '\n';
}

struct setup_main {
    setup_main() {
        cin.tie(0);
        ios::sync_with_stdio(0);
        std::cout << fixed << setprecision(15);
    }
} setup_main_;

#pragma endregion

ll ans = 0;
using vi = vector<int>;

signed main() {
    string s;
    cin >> s;
    reverse(all(s));
    s += '0';
    vi n(s.size(), 0);
    int len = (int)s.size();
    rep(i, len) {
        n[i] = s[i] - '0';
    }

    rep(i, len) {
        if (10 == n[i]) {
            n[i] -= 10;
            n[i + 1]++;
        }
        if (5 == n[i] and n[i + 1] >= 5) {
            n[i + 1]++;
            n[i] = 5;
        }
        if (6 <= n[i]) {
            n[i + 1]++;
            n[i] = 10 - n[i];
        } 
        
    }
    rep(i, len) {
        ans += n[i];
    }

    std::cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5276
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
const ll mo=1000000007;
ll ans=10000000;
ll dp[0][0];

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

ll m=0;
ll an[n];
rep(i,n){
    if(s[i]=='E')m++;
}

if(s[0]=='W')an[0]=m;
else an[0]=m-1;
rep(i,n-1){
    if(s[i]=='W'&&s[i+1]=='W')an[i+1]=1+an[i];
    else if(s[i]=='E'&&s[i+1]=='E')an[i+1]=-1+an[i];
    else an[i+1]=an[i];
}
rep(i,n){
    ans=min(ans,an[i]);
}

cout << ans << endl;
return 0;
}





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

int main(){
	//freopen("input.txt","r",stdin);
	int a;
	cin >> a;
	int in;
	int c=0,d=0;
	while(a--){
		cin >> in;
		if(in%2==0){
			c++;
			if(in%3==0 || in%5==0)d++;
			}
	}	
	if(c==d)cout<<"APPROVED\n";
	else cout <<"DENIED\n";
	return 0;
}

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

const int MOD = 1e9 + 7;

main() {
  int N; cin >> N;
  string S[2]; cin >> S[0] >> S[1];
  ll ans;
  int left = 0;
  for (int i = 0; i < N; i++) {
    if (S[0][i] == S[1][i]) {
      switch (left) {
        case 0: ans = 3;
                break;
        case 1: ans = (ans * 2) % MOD;
                break;
        case 2: ;
      }
      left = 1;
    } else {
      switch (left) {
        case 0: ans = 6;
                break;
        case 1: ans = (ans * 2) % MOD;
                break;
        case 2: ans = (ans * 3) % MOD;
      }
      left = 2;
      i++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A ,N;
  cin >> N;
  A = N/10;
  if (A % 111 == 0||A == 111){
    cout << "Yes" <<endl;
  }else{
    A = N/1000;
    A = N - A * 1000;
    if (A % 111 == 0||A == 111){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int a,p,kakera;
		Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		p = sc.nextInt();
		kakera = a*3+p;
			System.out.println(kakera/2);
	}
}

Measured memory_bytes: 23892
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 2010
#define ll long long
#define mod 1000000007
using namespace std;
int n, m, jc[N*N], inv[N*N], f[N][N], ans;
int C(int n, int m){return (ll)jc[n]*inv[m]%mod*inv[n-m]%mod;}
int main(){
	scanf("%d%d", &n, &m);
	if(m==1){printf("1"); return 0;}
	jc[0]=1; for(int i=1; i<=4000000; i++)jc[i]=(ll)jc[i-1]*i%mod;
	inv[0]=inv[1]=1; for(int i=2; i<=4000000; i++)inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod;
	for(int i=1; i<=4000000; i++)inv[i]=(ll)inv[i]*inv[i-1]%mod;
	f[0][0]=1;
	for(int i=1; i<=n; i++)f[0][i]=(ll)f[0][i-1]*C(i*(m-1)-1, m-2)%mod;
	for(int i=1; i<=n; i++){
		f[i][i]=f[i-1][i];
		for(int j=i+1; j<=n; j++)f[i][j]=(f[i-1][j]+(ll)f[i][j-1]*C(i+j*(m-1)-1, m-2)%mod)%mod;
	}
	ans=(ll)f[n][n]*jc[n]%mod;
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 47360
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 3*1e5 , limit = 9*1e18 , MOD=1e9+7;
#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n';
int find(int n ){
    int cp=0;
    while(n){
        n/=2;
        cp++;
    }
    return cp;
}

int32_t main(){
    boost;
    int n;
    cin>>n;
    int a[n+1];
    for(int i =0 ; i<=n ; i++ ){
        cin>>a[i];
    }
    
    if(a[n] == 0){
        cout<<-1<<endl;
        return 0;
    }
    
   if(a[0]  > 0){
        if(a[0] == 1 && n==0){
            cout<<1<<endl;
        }else{
            cout<<-1<<endl;
        }
        return 0;
        
    }

    
    int curr =1 ;
    int ans =1;
    int dpm[n+1];
    dpm[0]=1;
    for(int i =1 ; i <= n ; i++ ){
        
        
        
        
        int pos = 1e17;
        
        if(curr <= pos/2){
            pos = 2*curr;
        }
        
        
        
        dpm[i] = pos;
        
        //ans  = ans + pos;
        
        if(a[i] > pos){
            cout<<-1<<endl;
            return 0;
        }
        
        curr = pos;
        curr = curr - a[i];
        
        
        
        
        
        
    }
    
    ans = 0;
   int prev = 0;
   for(int i = n ; i >=0  ; i-- ){
       
       prev  +=a[i];
       
       prev = min(prev , dpm[i]);
       ans = ans + prev;
       
    //   cout<<ans<<" "<<prev<<endl;
       
       
   }
   
   
   cout<<ans<<endl;
    
}

Measured memory_bytes: 5176
def solve(h, w, a):
    rs = []
    for r in range(h):
        ok = True
        for c in range(w):
            if a[r][c] == "#":
                ok = False
                break
        if not ok:
            rs.append(r)
    cs = []
    for c in range(w):
        ok = True
        for r in range(h):
            if a[r][c] == "#":
                ok = False
                break
        if not ok:
            cs.append(c)
    res = "\n".join(map(lambda r: "".join(map(lambda c: a[r][c], cs)), rs))
    return res


h, w = map(int, raw_input().split())
a = []
for r in range(h):
    a.append(raw_input())

#print h, w

#print a
print solve(h, w, a)



Measured memory_bytes: 2696
import java.io.*;

public class Main {
    public static void main(String[] args) {
        String S;

        try (InputScanner is = new InputScanner(System.in)) {
            S = is.next();
        }


        if (S.equals("ARC")) {
            System.out.println("ABC");
        } else {
            System.out.println("ARC");
        }

    }

    //-------------------------------------------------------------------
    public static class InputScanner implements Closeable {
        private final BufferedReader br;
        private String[] element;
        private int elementIndex;

        public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            return this.nextElement();
        }

        //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        }

        //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        }

        //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        }

        private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        }

        private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        }

        private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        }

        @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
//-------------------------------------------------------------------
}


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


int n,k,a,b,t[100000];
string s;
int main(){
    cin>>n>>k>>s;
    for(int i=0;i<n-1;i++){
        if(s[i]=='A' && s[i+1]=='C'){
            t[i+1]=t[i]+1;
        }else{
            t[i+1]=t[i];
        }
    }
    
    for(int i=0;i<k;i++){
        cin>>a>>b;
        cout<<t[b-1]-t[a-1]<<endl;
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e,n;
  string s,ss,sss;
  cin>>a>>b>>c;
  set<ll>se;
  se.insert(a);
  se.insert(b);
  se.insert(c);
  if(se.size() == 2)
    cout<< "Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 #include <math.h>
using namespace std;
#define ll long long
#define pi 3.14159265359

map<ll,ll>prime_factor(ll n){
    map<ll,ll>res;
    for(ll i=2;i*i<=n;i++){
      while(n%i==0){
        res[i];
        n/=i;
      }
    }
    if(n!=1)res[n]=1;
    return res;
  }


int main(){
 ll a,b;
  cin>>a>>b;
  ll g=__gcd(a,b);
  if(g==1){
    cout<<1<<endl;
    return 0;
  }
  cout<<prime_factor(g).size()+1<<endl;
 
}
  


Measured memory_bytes: 256
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}

/*************** テストスペース ***************/

//let input = readIntSplit(by: " ")
//let (N, M, X) = (input[0], input[1], input[2])
//let A = readIntSplit(by: " ")

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let AB = [input[0], input[1]].sorted()
print((AB[0]...AB[1])~=input[2] ? "Yes" : "No")


Measured memory_bytes: 7908
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;


int main(void) {
    int N;
    cin >> N;
    vector<int> B(N-1);
    for(int i = 0; i < N-1; i++) {
        cin >> B[i];
    }
    int ans = B[0];
    for(int i = 1; i < N-1; i++) {
        ans+=min(B[i-1], B[i]);
    }
    ans += B[N-2];
    cout << ans << endl;
    return 0;
}

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

#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long int lli;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define YES_RTN s_cout("Yes");return 0
#define NO_RTN  s_cout("No");return 0


int i_cins(int n, int* A);
int l_cins2(int n, long* A,long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);


int main(void) {

	int    A[100001], N, min, tmp, i;
	i_cin(N);
	i_cins(N, A);

	qsort(A, N, sizeof(int), s_asort);

	min = A[0];
	for (i = N - 1; i > 0; i--) {
		tmp = A[i] % min;
		if (min > tmp && tmp) min = tmp;
		A[i] = tmp;
	}

	qsort(A, N, sizeof(int), s_asort);

//	for (i = N - 1; i >= 0; i--) {
//		if (A[i] == 0)break;
//		i_cout(A[i]);
//		s_cout("min:\n", min);
//	}
	if (!A[N - 2]) { i_cout(min); return 0; }

//	for (i = N - 1; i >= 0; i--) {
//		if (A[i] == 0)break;
//		i_cout(A[i]);
//	}

	while (1) {

		for (i = N - 1; i >= 0; i--) {
			if (A[i] == 0)break;
			tmp = A[i] % min;
			if (min > tmp && tmp) min = tmp;
			A[i] = tmp;
		}
		qsort(A, N, sizeof(int), s_asort);
	
//		for (i = N - 1; i >= 0; i--) {
//			if (A[i] == 0)break;
//			i_cout(A[i]);
//			s_cout("min:\n",min);
//		}
		if (!A[N - 2]) break;

	}
	i_cout(min);
	return 0;
	}
	
//降順
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a -*(int*)b);
}
//
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	rept(i, 0, n) {
		i_cin(*(a + i));
	}
	return 0;
}



Measured memory_bytes: 1012
#include<bits/stdc++.h>
using namespace std; 
using ll=long long;
#define endl "\n"
#define F(i,n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repp(i,a,b) for(ll i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define f first
#define s second
#define ALL(v) v.begin(),v.end()
void solve(){
    
    ll n,a,b;
    cin>>n>>a>>b;
    if(n*a>b)  cout<<b;
    else     cout<<n*a;
}
signed main(){
    fast;
     
    solve();
 
    return 0;
}


Measured memory_bytes: 256