akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

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

int main()
{
    ll A, B, K;
    cin >> A >> B >> K;

    ll cnt = 0;
    ll ans = 0;
    vector<ll> SEISU;
    for (ll i = 1; i <= 100; i++)
    {
        if (A % i == 0 && B % i == 0) {
            SEISU.push_back(i);
        }
    }

    sort(SEISU.begin(), SEISU.end(), greater<ll>());
    cout << SEISU[K - 1] << endl;
}

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

using namespace std;

using ll = long long;

const int MX = 500;

ll ans[MX][MX];

ll gcd(ll x, ll y) {
    if (y == 0) {
        return x;
    }
    return gcd(y, x % y);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

int x[2 * MX];

int y[2 * MX];

bool pr(int x) {
    for (int i = 2; i < x; i++) {
        if (x % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    int nx = 2;
    int cnt = 0;

    for (int i = 0; i < 2 * MX; i++) {
        if (i % 2 == 1) {
            x[i] = x[i - 1];
            continue;
        }
        while (!pr(nx)) {
            nx++;
        }
        x[i] = nx++;
    }
    for (int i = 0; i < 2 * MX; i++) {
        while (!pr(nx)) {
            nx++;
        }
        y[i] = nx++;
    }
    for (int i = 0; i < MX; i++) {
        for (int j = 0; j < MX; j++) {
            if ((i + j) % 2 == 1) {
                ans[i][j] = x[(i + j)] * y[(MX + i - j)];
            }
        }
    }

    set<ll> was;

    for (int i = 0; i < MX; i++) {
        for (int j = 0; j < MX; j++) {
            if ((i + j) % 2 == 0) {
                ll l = 1;
                set<ll> xx;
                auto ad = [&](int r, int c) {
                    xx.insert(x[r + c]);
                    xx.insert(y[MX + r - c]);
                };
                if (i) {
                   ad(i - 1, j);
                }
                if (j) {
                    ad(i, j - 1);
                }
                if (i + 1 < MX) {
                    ad(i + 1, j);
                }
                if (j + 1 < MX) {
                    ad(i, j + 1);
                }
                for (ll x : xx) {
                    l *= x;
                }
                l++;
                if (l > 1e15) {
                    cout << l << endl;
                }
                assert(l < 1e15);
                ans[i][j] = l;
                if (i) {
                    assert(ans[i][j] % ans[i - 1][j] == 1);
                }
                if (j) {
                    assert(ans[i][j] % ans[i][j - 1] == 1);
                }
                if (i + 1 < MX) {
                    assert(ans[i][j] % ans[i + 1][j] == 1);
                }
                if (j + 1 < MX) {
                    assert(ans[i][j] % ans[i][j + 1] == 1);
                }
            }
        }
    }
    for (int i = 0; i < MX; i++) {
        for (int j = 0; j < MX; j++) {
            if (was.count(ans[i][j])) {
                cout << i << " " << j << endl;
            }
            was.insert(ans[i][j]);
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << ans[i][j] << " ";
        }
        cout << "\n";
    }
    cout << "\n";

}




Measured memory_bytes: 16896
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a,b,ans;
cin>>a>>b;
if(a=="H" && b=="D")
ans="D";
else if(a=="D" && b=="H")
ans="D";
else if(a=="H" && b=="H")
ans="H";
else
ans="H";
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <sstream>
#include <complex>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using iii = pair<int, ii>;
using viii = vector<iii>;

using ll = long long int;
using vc = vector<char>;
using vb = vector<bool>;
using ib = pair<int, bool>;
using vib = vector<ib>;

#define MOD 1000 * 1000 * 1000 + 7
#define INF 1000 * 1000 * 1000
#define EMPTY -10
#define mp(a, b) make_pair(a,b)

bool resuelveCaso() {
	int n;
	cin >> n;
	if (!cin) return false;

	set<string> seen;
	string pAct, pAnt;
	cin >> pAnt;
	seen.insert(pAnt);
	bool pos = true;
	for (int i = 1; i < n; ++i) {
		cin >> pAct;
		if (pAnt[pAnt.size() - 1] != pAct[0]) pos = false;
		if (seen.find(pAct) != seen.end()) pos = false;
		else seen.insert(pAct);
		pAnt = pAct;
	}

	if (pos) cout << "Yes\n";
	else cout << "No\n";


	return true;
}

int main() {
	while (resuelveCaso()) {}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <map>

using namespace std;
char N[3];
int main(){
	cin>>N;
	//scanf("%s",&N)
	if(N[0]=='7'||N[1]=='7'||N[2]=='7') puts("Yes");
	else cout<<"No"<<endl;	

}


Measured memory_bytes: 3616
#![allow(unused_imports)]

use std::cmp;
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;

pub const MOD: usize = 1000000007;

fn main() {
    let s: String = input();
    let t: String = input();

    let ans = if {
        let mut v = s.chars().collect::<Vec<_>>();
        v.sort();
        v
    } < {
        let mut v = t.chars().collect::<Vec<_>>();
        v.sort_by(|a, b| b.cmp(a));
        v
    } {
        "Yes"
    } else {
        "No"
    };

    println!("{}", ans);
}

pub fn input<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


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

using namespace std;

int main()
{
	int A, B, C;
	string ans = "NO";

	cin >> A >> B >> C;

	for (int i = 1; i < B + 1; i++)
	{
		if ((A * i) % B == C)
		{
			ans = "YES";
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

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

    map<string,int> dic;
    string str;

    rep(i,N){
        cin >> str;
        dic[str]++;
    }

    int maxnum = 0;
    for (auto i : dic) {
        maxnum = max(maxnum, i.second);
    }

    map<string,int>::iterator it;
    for(it=dic.begin();it!=dic.end();it++){
        if(it->second == maxnum) cout << it->first << endl;
    }

    return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)

#define INF 2e9
#define ALL(v) v.begin(), v.end()

int N;
int A[210];

int main(int argc, char const *argv[]) {
  cin>>N;
  rep(i,N){
    cin>>A[i];
  }
  int res=0;

  while(true){
    bool exist_odd=false;
    rep(i,N){
      if(A[i]%2==1)exist_odd=true;
    }
    if (exist_odd==true)break;
    rep(i,N){
      A[i]/=2;
    }
    res++;
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  atcoderdemo
//
//  Created by apple on 2019/6/29.
//  Copyright © 2019 apple. All rights reserved.
//

#include <iostream>
#include <string.h>
#include <queue>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int sum[maxn];
int main(int argc, const char * argv[]) {
    string str;
    cin >> str;
    for(int i=0;i<str.size();i++){
        sum[str[i] - 'A']++;
    }
    for(int i=0;i<str.size();i++){
        if(sum[str[i] - 'A'] != 2){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	n = readline() |> parseInt
	s = readline() |> chomp
	r = 0
	for i in 1:n
		if s[i]=='R'
			r+=1
		end
	end
	println(r>n-r ? "Yes" : "No")
end

main()

Measured memory_bytes: 111540
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
const ll MAX_N = 1e5;
ll N;
ll h[MAX_N];
ll dp[MAX_N+1]; // メモ化テーブル
 
// i番目以降の品物から重さの総和がj以下になるように選ぶ
void rec(ll i){
	if (i==0) dp[i] = 0;
	else if (i==1) dp[i] = abs(h[1]-h[0]);
	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	return;
}

int main() {
	// 入力
	ll N;
	cin >> N;
	for (ll i = 0; i < N; ++i) cin >> h[i];
 
	
	// 解法
	// まだ調べていないことを表す-1でメモ化テーブルを初期化
	memset(dp, -1, sizeof(dp));
	
	REP(i,N) rec(i);
	
	// REP(i,N) printf("%d\n", dp[i]);
	printf("%d\n", dp[N-1]);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int int64_t
using namespace std;

const int inf = numeric_limits<int>::max(),
          MAX = 1e6,
          MOD = 1e9 + 7;


int32_t main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    int n, k; cin >> n >> k;
    vector<int> v(n);

    for (auto &i : v)
        cin >> i;

    vector<int> dp(n, 1e9);
    dp[0] = 0;

    for (int i = 1; i < n; ++i) {
        int j = i - 1;
        for (int l = 0; l < k and j >= 0; ++l, j--)
            dp[i] = min(dp[i], dp[j] + abs(v[i] - v[j]));
    }

    cout << dp.back() << "\n";

    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(void){
    int r,g,b,k,i,j;
    scanf("%d %d %d",&r,&g,&b);
    scanf("%d",&k);
    if(b > g && g > r)   printf("Yes");
    else {
        for(i=0; g<=r; i++){
            g = g*2;
        }
        for(j=0; b<=g; j++){
            b = b*2;
        }
        if(i + j <= k)  printf("Yes");
        else printf("No");
    }

    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

int main(){
  int X,A; cin>>X>>A;
  if(X<A) cout<<0<<endl;
  else cout<<10<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
static const int N = 100;

int main(){
int M[N][N];
int n, u, k, v;
    // Here you
    
cin >> n;

for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
        M[i][j] = 0;
        
    }
}
    
    
for(int i = 0; i < n; i++){
    cin >> u >> k;
    u--;
    for(int j = 0; j < k; j++){
        cin >> v;
        v--;
        M[u][v] = 1;
    }
    
}


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

return 0;
    
}

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

int main() {
  int n , m ;
  cin >> n >> m;
  vector<int> vec(m);
  for(int i=0;i<m;i++){
    int a;
    cin >> a;
    vec[i]=a;
  }
  int ans=0;
  int min=100;
  for(int i=-100;i<102;i++){
    bool hant=1;
	for(int j=0;j<m;j++){
      if(vec[j]==i)
        hant=0;
    }
    if(hant){
      if(abs(n-i)<min){
        min=abs(n-i);
        ans=i;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628
import java.util.Arrays;
import java.util.Scanner;

public class Main {


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

        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }

        Arrays.sort(H);

        int maxDis = H[0]-H[N-1]+K;

        for (int i = 1; i < N ; i++) {
            maxDis = Math.max(maxDis,H[i]-H[i-1]);
        }



        System.out.println( K-maxDis);
    }

}


Measured memory_bytes: 82556
#include <cstdio>
int main(){
	int l[10];
	float v1, v2;
	while(~scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%f",l,l+1,l+2,l+3,l+4,l+5,l+6,l+7,l+8,l+9,&v1,&v2)){

	float distance = 0, goal;
	for(int i=0;i<10;i++)distance+=l[i];
	goal = distance * v1 / (v1+v2);
	
	int a = 0, res;
	for(int i=0;i<10;i++){
		a += l[i];
		if(goal <= a){res = i + 1;break;}
	}
	printf("%d\n", res);
	}
}

Measured memory_bytes: 0
n,k = map(int,input().split())
x = [1]*n
for _ in range(k):
  di = int(input())
  ai = list(map(int,input().split()))
  for y in ai:
    if x[y-1] == 1:
      x[y-1] = 0
print(sum(x))
           
  
  

Measured memory_bytes: 67664
import collections, math

local = False
if local:
    file = open("input.txt", "r")

def inp():
    if local:
        return file.readline().rstrip()
    else:
        return input().rstrip()

def ints():
    return [int(_) for _ in inp().split()]


N = int(inp())

summed = 0
for i in range(1, N+1):
    three = i%3==0
    five = i%5==0

    if not five and not three:
        summed+=i

print(summed)

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

int main(){
  int M1,D1,M2,D2;
  cin >> M1 >> D1 >> M2 >> D2;

  if(M1!=M2)  cout << 1 << endl;
  else  cout << 0 << endl;

  return 0;
}


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

string S,T,U;
int a,b;

int main() {
	cin>>S>>T;
	cin>>a>>b;
	cin>>U;
	if(S==U) a--;
	if(T==U) b--;
	cout<<a<<' '<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math
import sys

n, m = map(int, input().split())

if math.fabs(n - m) == 1:
    k = 1
elif n == m:
    k = 2
else:
    k = 0

print(math.factorial(n) * math.factorial(m) * k % 1000000007)


Measured memory_bytes: 5180
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long LL;
const int INF = 999999999;

int main(){
    int n;
    cin >> n;
    vector<int> imos(101010, 0);
    rep(i, n){
        int a, b;
        cin >> a >> b;
        a--; b--;
        imos[a]++; imos[b+1]--;
    }
    int ans = 0;
    rep1(i, n+1){
        imos[i] += imos[i-1];
        if(i <= imos[i]) ans = max(ans, i);
    }
    cout << ans << endl;
}




Measured memory_bytes: 3348
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<unordered_map>
#include<bits/stdc++.h>
#define ll long long 
#define dd double
using namespace std;
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll x,k,d;
  cin>>x>>k>>d;
  x=abs(x);
  if(x/d>=k){
  	cout<<x-(k*d)<<endl;
  }
  
  else{
  	 k=k-x/d;
  	 x=x-(x/d)*d;
  	 if(k%2==0){
  	 	cout<<x<<endl;
	 }   
	 
	 else{
	 	cout<<abs(x-d)<<endl;
	 }
  		
  }
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repbit(n) for(ll bit=0,bit<(1<<n),bit++)
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans*(b&1?a:1);
}
signed main(){
  string s;
  cin>>s;
  vector<ll> ans(11);
  vector<char> t={'A','C','G','T'};
  ll cnt=0;
  bool f=0;
  rep(i,0,s.size()){
    rep(j,0,4){
      if(s[i]==t[j]) {
          ans[cnt]++;
          f=1;
      }
    }
    if(!f) cnt++;
    f=0;
  }
  cout<<*max_element(ans.begin(),ans.end());
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n;
	cin >> n;

	int ans = 1;
	char prev, curr;
	cin >> prev;
	for(int i = 1; i < n; i++){
		cin >> curr;
		if(curr != prev){
			ans++;
			prev = curr;
		}
	}
	cout << ans; 
}

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

const int MX = 405;
const long long INF = 1e18;
long long dp[MX][MX];
long long pref[MX];

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

    int N;
    cin >> N;

    vector<int> arr(N);
    for (int i = 0; i < N; i++) {
        cin >> arr[i];
    }
    
    pref[0] = arr[0];
    for (int i = 1; i < N; i++) {
        pref[i] = pref[i-1] + arr[i];
    }

    for (int i = N - 1; i >= 0; i--) {
        for (int j = i + 1; j < N; j++) {
            long long res = INF;
            for (int k = i; k < j; k++) {
                long long c = dp[i][k] + dp[k+1][j];
                long long s = pref[j];
                if (i > 0) s -= pref[i-1];
                res = min(res, c + s);
            }
            dp[i][j] = res;
        }
    }

    cout << dp[0][N-1] << "\n";
}



Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define INF 1145141919810364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n;
vector<int> vec[100010];
int ma;

int dfs(int x) {
	if (vec[x].empty())return 0;
	vector<int> vec2;
	for (int i = 0; i < (int)vec[x].size(); i++) {
		vec2.push_back(dfs(vec[x][i]));
	}
	sort(all(vec2));
	int ma = 0;
	for (int i = 0; i < (int)vec2.size(); i++)ma = max(ma, vec2[i] + (int)vec2.size() - i);
	return ma;
}

signed main() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int a;
		cin >> a;
		vec[a].push_back(i + 2);
	}
	cout << dfs(1) << endl;
}

Measured memory_bytes: 13568
#include <iostream>
#include <vector>
#include <stack>
#include <unordered_set>
#include <numeric>
#include <iterator>
#include <unordered_map>
#include <array>
#include <map>
#include <cstring>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctgmath>
#include <set>
#include <queue>
#include <fstream>
#include <ostream>
#include <random>
#include <chrono>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	vector<int> all;
	for (int i = 0; i < 5; i++)
	{
		int x;
		cin >> x;

		all.push_back(x);
	}
	vector<int> perm = { 0,1,2,3,4 };

	int maxi = 0;
	int time = 0;
	for (auto i : perm)
	{
		if (time % 10 != 0)
		{
			time += 10 - time % 10;
		}
		time += all[i];
	}
	maxi = time;
	while (next_permutation(perm.begin(), perm.end()))
	{
		int time = 0;
		for (auto i : perm)
		{
			if (time % 10 != 0)
			{
				time += 10 - time % 10;
			}
			time += all[i];
		}

		maxi = min(maxi,time);
	}
	cout << maxi << "\n";
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  unsigned int a, b, c, d, e, k;
  std::cin >> a;
  std::cin >> b;
  std::cin >> c;
  std::cin >> d;
  std::cin >> e;
  std::cin >> k;

  if (e - a > k) {
    std::cout << ":(" << std::endl;
  } else {
    std::cout << "Yay!" << std::endl;
  }

  return 0;
}


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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , m;

int sz[N];
int p[N];

int get(int x) { return x == p[x] ? x : p[x] = get(p[x]); }

void join(int x , int y) {
    x = get(x);
    y = get(y);

    if(x == y) return;

    if(rand() & 1) swap(x , y);

    p[x] = y;
    sz[y] += sz[x];
}


void solve(int testCase){

    scanf("%d %d" , &n , &m);

    for(int i = 1 ; i <= n ; i ++) {
            p [i] = i;
            sz[i] = 1;
    }

    for(int i = 0 ; i < m ; i ++) {
            int u , v;
            scanf("%d %d" , &u , &v);
            join(u , v);
    }

    int ans = 0;
    for(int i = 1 ; i <= n ; i ++) {
            ans = max(ans , sz[get(i)]);
    }

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

}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 8316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=7+1e9;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
ll qpow(ll a,ll b,ll p){a%=p; ll ret=1;for(;b;b>>=1,a=a*a%p) if(b&1) ret=ret*a%p; return ret;}
ll getInv(ll x,ll p){return qpow(x,p-2,p);}
const int N=5+2e5;
int fa1[N],fa2[N];
int find(int x,int* fa){ return fa[x]!=x?fa[x]=find(fa[x],fa):x;}
void merge(int x,int y,int* fa){
    x=find(x,fa),y=find(y,fa);
    if(x!=y) fa[x]=y;
}
map<pair<int,int>,int> cnt;
int main(){
    int n,k,l; cin>>n>>k>>l;
    for(int i=1;i<=n;i++) fa1[i]=fa2[i]=i;
    while(k--){
        int u,v; cin>>u>>v;
        merge(u,v,fa1);
    }
    while(l--){
        int u,v; cin>>u>>v;
        merge(u,v,fa2);
    }
    for(int i=1;i<=n;i++) fa1[i]=find(i,fa1),fa2[i]=find(i,fa2);
    for(int i=1;i<=n;i++) cnt[{fa1[i],fa2[i]}]++;
    //for(auto v:cnt) printf("{%d,%d}:%d\n",v.first.first,v.first.second,v.second);
    for(int i=1;i<=n;i++) cout<<cnt[{fa1[i],fa2[i]}]<<' ';
    puts("");
}

Measured memory_bytes: 16372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int mxN = 1e6 + 5;
bool prime[mxN];
vector<ll> primenu;
void SieveOfEratosthenes() 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
     
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=mxN-1; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=mxN-1; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    // for (int p=2; p<=mxN-1; p++) 
    //    if (prime[p]) 
    //       primenu.pb(p); 
}
void solve(){
    SieveOfEratosthenes();
    // cout<<prime[1];
    prime[1] = false;
    map<ll,ll> primes;
    ll n;
    cin>>n;
    ll a[n];
    ll gcd = 0;
    bool doing = true;
    for(int i =0;i<n;i++){
        cin>>a[i];
        if(i==0){
            gcd = a[i];
        }
        else{
            gcd = __gcd(a[i],gcd);
        }
        if(doing){
            
            for(ll j = 1;j*j<=a[i];j++){
                ll k  = a[i]/j;
                if(a[i]%j==0){
                    if(prime[j]){
                        primes[j]++;
                    
                        if(primes[j]>1)
                            doing = false;
                    }
                    if(j!=k && prime[k]){
                        primes[k]++;
                        if(primes[k]>1)
                            doing = false;
                    }
                }
                

            }
        }
    }
    bool ok = doing;
    // for(auto it : primes){
    //     cout<<it.F<<" "<<it.S<<'\n';
    // }
    if(gcd==1 && ok){
        cout<<"pairwise coprime\n";
    }
    else if(gcd==1){
        cout<<"setwise coprime\n";
    }
    else
    {
        cout<<"not coprime\n";
    }
    
}
int main(){
    IOS
    int tt;
    tt = 1;
    // cin>>tt;
    while(tt--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 12392
#include <stdio.h>

int main(void)
{
  int A, B, max, i;

  scanf("%d %d", &A, &B);

  max = A + B;
  if(A - B > max){
     max = A - B;
     if(A * B > max) max = A * B;
  }
  else{
     if(A * B > max) max = A * B;
  }
  printf("%d", max);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    int a, b;
    cin >> a >> b;
    if (b < a) {
        cout << a-1 << "\n";
    } else {
        cout << a << "\n";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;
const long long mod=1e9+7;
const long long INF=1LL<<60;

struct edge{long long to,cost;};
typedef pair<long long,long long> P;

vector<edge> G[100010];
long long d[100010];

void dijkstra(int s,int n){
    priority_queue<P,vector<P>,greater<P> > que;
    fill(d,d+n,INF);
    d[s]=0;
    que.push(P(0,s));

    while(!que.empty()){
        P p=que.top();que.pop();
        long long v=p.second;
        if(d[v]<p.first)continue;
        for(auto e:G[v]){
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

int main(){
   int n;
   cin>>n;
   vector<long long> u(n),t(n),w(n);
   for(int i=0;i<n-1;i++){
       cin>>u[i]>>t[i]>>w[i];
       u[i]--;t[i]--;
       G[u[i]].push_back({t[i],w[i]});
       G[t[i]].push_back({u[i],w[i]});
   }
   dijkstra(0,n);
   for(int i=0;i<n;i++){
       if(d[i]%2==0)cout<<0<<endl;
       else cout<<1<<endl;
   }

}

   


Measured memory_bytes: 11008
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    double l;
    cin>>l;
    cout<<fixed<<setprecision(6)<<pow((l/3),3)<<endl;
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program{
	const int mod=1000000007;
	static long[] s,k;
	static Dictionary<long,long> sb=new Dictionary<long,long>();
	static void Main(){
		s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		int a=(int)Math.Sqrt(s[1]);
		long si=s[1],ans=1,m=si;
		for(int i=2;i<=a;i++){
			while(si%i==0){
				si/=i;
				if(!sb.ContainsKey(i)){sb.Add(i,1);}
				else{sb[i]++;}
				m=i;
			}
		}
		if(si==1){}
		else if(!sb.ContainsKey(si)){sb.Add(si,1);}
		else{sb[si]++;}
		k=new long[200000];
		k[0]=1;
		for(int i=1;i<200000;i++){k[i]=(k[i-1]*i)%mod;}
		foreach(KeyValuePair<long,long> e in sb){
			long an=e.Value+s[0]-1;
			long ak=e.Value;
			ans=((k[an]*mi(k[ak]*k[an-ak])%mod)*ans)%mod;
		}
		Console.WriteLine("{0}",(ans+mod)%mod);
	}
	static long mi(long a){
		long b=mod,u=1,v=0;
		while(b>0){
			long t=a/b;
			a-=t*b;a^=b;b^=a;a^=b;
			u-=t*v;u^=v;v^=u;u^=v;
		}
		u%=mod;
		if(u<0){u+=mod;}
		return u%mod;
	}
}

Measured memory_bytes: 14816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i)
#define ALL(n) begin(n), end(n)

int main()
{
  int N;
  string S, T;
  cin >> N >> S >> T;
  rep(i, N) cout << S[i] << T[i];
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    long long N, A, B;

    cin >> N >> A >> B;
    
    long long g = N / (A+B);
    long long d = N % (A+B);

    long long ans = g * A;

    if (d > A){
        ans += A;
    }
    else{
        ans += d;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;
const int inf=1001001001;
ll absc(ll a,ll b){return (a-b>0?a-b:b-a);
}
ll mini(ll a,ll b){return (a>b?b:a);}
int main()
{
    int a,b,c;
    string s;
    cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7')cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3620
import java.util.*;
import java.io.*;

public class Main {

	public static void main (String[] args) {
	   InputReader in = new InputReader(System.in);
	   int c[][] = new int[3][3]; 
	   int a[] = new int[3];
	   int b[] = new int[3]; 
	   for(int i = 0; i<3; i++) {
		   for(int j = 0; j<3; j++) {
			   c[i][j] = in.readInt();
		   }
	   } 
	   for(int i = 0; i<3; i++) {
		   b[i] = c[0][i]; 
	   }
	   for(int i = 1; i<3; i++) {
		   a[i] = c[i][0] - b[0]; 
	   }
	   for(int i = 0; i<3; i++) {
		   for(int j = 0; j<3; j++) {
			   if(a[i] + b[j] != c[i][j]) {
				   System.out.println("No"); 
				   return; 
			   }
		   }
	   }
	   System.out.println("Yes"); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 21332
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long k = sc.nextLong();
		if(k>a) {
			if(k-a>b) {
				System.out.println("0 0");
			}else {
				System.out.println("0 " + (b-(k-a)));
			}
		}else {
			System.out.println(a-k + " " + b);
		}
	}
}


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

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


Measured memory_bytes: 256
import static java.lang.Integer.parseInt;
import static java.lang.System.out;
import java.util.Deque;
import java.util.LinkedList;
import java.io.File;
import java.util.Scanner;

public class Main extends BaseExe {

    public static void main(String[] args) {
        new Main().exeSysIn();
    }

    @Override
    protected void execute() {
        Deque<Integer> inCars = new LinkedList<>();
        while (judgeInData()) {
            setCars(parseInt(getInData()), inCars);
        }
    }

    private void setCars(int carNumber, Deque<Integer> inCars) {
        if (carNumber == 0) {
            out.println(inCars.poll());
        } else {
            inCars.addFirst(carNumber);
        }
    }

}

abstract class BaseExe {

    private Scanner scan;

    private String inData;

    public void exeSysIn() {
        try (Scanner scan = new Scanner(System.in)) {
            exeCtrl(scan);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void exeFileIn(String inDataPath) {
        try (Scanner scan = new Scanner(new File(inDataPath))) {
            exeCtrl(scan);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void exeCtrl(Scanner scan) {
        this.scan = scan;
        execute();
    }

    protected abstract void execute();

    protected String nextLine() {
        return scan.nextLine();
    }

    protected boolean judgeInData() {
        return hasNextLine() && isNotEmptyInData();
    }

    protected boolean hasNextLine() {
        return scan.hasNextLine();
    }

    protected boolean isNotEmptyInData() {
        return !"".equals(inData = nextLine());
    }

    protected String getInData() {
        return inData;
    }

}

Measured memory_bytes: 26096
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}

/*-----------------------------------------------------------------*/
map<char, string> mp;

char f(char x){
  if(mp[x].empty()) return x;
  char y = mp[x][0];
  mp[x].erase(0,1);
  return f(y);
}

int main(){
  string A, B, C;
  cin >> A >> B >> C;
  mp['a'] = A;
  mp['b'] = B;
  mp['c'] = C;
  char ans = f('a') - 'a' + 'A';
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
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 const INF = 1001001001;


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

int k;
cin >> k;
string s;
cin >> s;

int n = SZ(s);

if(n <= k) {
    cout << s << endl;
}
else {
    cout << s.substr(0,k) + "..." << endl;
}

return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using namespace std;

int main() {
    string s;
    cin >> s;
    map<char, int> m;
    for (auto &&c : s) {
        m[c]++;
    }
    for (auto &&item : m) {
        if(item.second > 1){
            cout << "no\n";
            return 0;
        }
    }
    cout << "yes\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
    while(a%b){
        int tmp=a%b;
        a=b;
        b=tmp;
    }
    return b;
}
int main(){
    int n,X;
    cin>>n>>X;
    vector<int> x(n);
    for(int i=0;i<n;i++){
        cin>>x[i];
        x[i]=abs(x[i]-X);
        //cout<<x[i]<<endl;
    }
    if(n == 1){
        cout<< x[0] <<endl;
        return 0;
    }
    int ans = gcd(x[0],x[1]);
    for(int i=2;i<n;i++){
        ans = gcd(ans,x[i]);
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


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

string manipulate(string s);

int main() {
    string s,ans;
    int n;
    
    while(1) {
	cin >> n;
	if(n == 0) break;

	cin >> s;
	ans = s;

	while(n--) {
	    ans = manipulate(ans);
	}
	cout << ans << endl;
    }
    return 0;
}


string manipulate(string s) {
    int i =0, len = s.length();
    string result = "";
    while(i<len) {
	char a = s[i];
	int r = 1;
	while(++i < len && s[i] == a) {
	    r++;
	}
	result += to_string(r) + a; 
    }
    return result;
}

Measured memory_bytes: 3348
Sa=input()
Sb=input()
Sc=input()
cur=0
while True:
  if cur==0:
    if len(Sa)==0:
      print("A")
      exit()
    cur=ord(Sa[0])-ord("a")
    Sa=Sa[1:]
  elif cur==1:
    if len(Sb)==0:
      print("B")
      exit()
    cur=ord(Sb[0])-ord("a")
    Sb=Sb[1:]
  else:
    if len(Sc)==0:
      print("C")
      exit()
    cur=ord(Sc[0])-ord("a")
    Sc=Sc[1:]


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

int n, k;

int main() {
	read(n), read(k);
	print(n - k + 1);
}


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

int main(){
  string S;
  cin >> S;
  bool mmyy = stoi(S.substr(0, 2)) <= 12 && stoi(S.substr(0, 2)) != 0;
  bool yymm = stoi(S.substr(2, 2)) <= 12 && stoi(S.substr(2, 2)) != 0;
  if(mmyy && yymm){
    cout << "AMBIGUOUS" << endl;
  }else if(mmyy){
    cout << "MMYY" << endl;
  }else if(yymm){
    cout << "YYMM" << endl;
  }else{
    cout << "NA" << endl;
  }
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REP2(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
typedef long long ll;

int main() {
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    // 中心を通る直線で半分にするのが小さい方の面積の最大値
    // x, yが中心と同じなら複数
    // それ以外は中心と(x, y)を通る直線だけ
    cout << setprecision(10) << w * h / 2.0 << " ";
    if(x * 2 == w && y * 2 == h) cout << 1 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 256