akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let m: usize = sc.cin();

    let mut guess: Vec<Option<usize>> = vec![None; n];

    let mut ok = true;

    for _ in 0..m {
        let s: usize = sc.cin();
        let c: usize = sc.cin();
        if let Some(x) = guess[s - 1] {
            if c != x {
                ok = false;
            }
        } else {
            guess[s - 1] = Some(c);
        }
    }

    if ok && n == 1 {
        if let Some(x) = guess[0] {
            print!("{}", x)
        } else {
            print!("{}", 0);
        }
        return;
    }

    if guess[0] == Some(0) {
        ok = false;
    }

    if ok {
        for i in 0..n {
            if let Some(x) = guess[i] {
                print!("{}", x)
            } else {
                print!("{}", if i == 0 { 1 } else { 0 });
            }
        }
    } else {
        put!(-1);
    }
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(){
	int n, k, p, i, a;
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d%d", &k, &p);
		a = k%p;
		if (a == 0) a = p;
		printf("%d\n", a);
	}
	return 0;
}

Measured memory_bytes: 596
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}


object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(_, m, x) = in.readLine().split("\\s+").map(_.toInt)
    val as = in.readLine().split("\\s+").map(_.toInt)

    val left = as.count(_ < x)
    val right = m - left
    out.println(
      Math.min(left, right)
    )
    out.flush()
  }
}


Measured memory_bytes: 25540
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int par[100500];
lint connect[100500];

void init(int x){
  rep(i,x) par[i]=i;
}

int root(int x){
  if(par[x]==x) return x;
  else return par[x]=root(par[x]);
}

bool same(int x,int y){
  return root(x)==root(y);
}

void unite(int x,int y){
  x=root(x);
  y=root(y);
  if(x==y) return;
  par[x]=y;
}

int main(void){
  lint N,M;
  cin >> N >> M;
  init(N);
  int A[M],B[M];
  reprev(i,M){
    cin >> A[i] >> B[i];
    A[i]--,B[i]--;
  }
  rep(i,N) connect[i]=1;
  lint ans[M]={};
  ans[0]=(N*(N-1))/2;
  rep(i,M-1){
    if(same(A[i],B[i])){
      ans[i+1]=ans[i];
      continue;
    }
    else{
      lint x=connect[root(A[i])],y=connect[root(B[i])];
      ans[i+1]=ans[i]-x*y;
      lint co=x+y;
      unite(A[i],B[i]);
      connect[root(A[i])]=co;
    }
  }
  reprev(i,M) cout << ans[i] << endl;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#include<stdio.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define INF 1000000000000000
#define MAXN (int)(1e6)+1
#define MOD 1000000007
 
using namespace std;
 
typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,int> pwi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector< vector<pair<int,lli > > > wGraph;
typedef vector<vector<int> > graph;
//typedef vector<vector<int> > matrix;

int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout<<std::fixed;
    cout<<std::setprecision(4);
    
    int n,w;
    cin>>n>>w;
    
    vi val,wei;
    int som = 0,peso = 0;
    for(int i = 0;i<n;++i){
        int v,c;
        cin>>c>>v;
	    val.pb(v);
	    wei.pb(c);
	    som+=v;
	    peso+=c;
    }
    
    lli dp[n+1][som+1];
    
    for(int i = 0;i<=n;++i){
        for(int k = 0;k<=som;++k){
            dp[i][k] = INF;
        }
    }
    
    for(int i = 1;i<=n;++i){
        for(int k = 0;k<=som;++k){
            if(k == 0){
                dp[i-1][k] = 0;
                dp[i][k] = 0;
            }else if(k>=val[i-1]){
                dp[i][k] = min(dp[i-1][k-val[i-1]]+wei[i-1],dp[i-1][k]);
                //cout<<"new weight of "<<k<<" --> "<<dp[i][k]<<endl;
            }else{
                dp[i][k] = dp[i-1][k];
            }
        }
    }
    
    int ans = 0;
    for(int i = 0;i<=som;++i){
        if(dp[n][i] <= w){
            ans = max(i,ans);
        }
    }
    
    cout<<ans<<endl;
       
    return 0;
 
}

Measured memory_bytes: 79232
//Author: Herson Rezende - 2ºSemestre de CC - UFBA - 2020
//Site: hrezend.github.io/resume-web
#include <bits/stdc++.h>
#define desync ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define all(x) (x.begin(), x.end())
#define rall(x) (x.rbegin(), x.rend())
#define mkp(x,y) (make_pair(x,y))
#define out(x) cout << x << endl
using namespace std;

int main(){
	desync;
	int n, answer, resto;
	
	cin >> n;
	resto = (n % 1000);
	resto > 0 ? answer = 1000 - resto : answer = 0;
	out(answer);
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  bool jud = false;
  for(int i=0;i<s.size()-1;i++){
    if(s.at(i) == s.at(i+1)){
      cout << "Bad" << endl;
      jud = true;
      break;
    }
  }
  if(!jud) cout << "Good" <<endl;
}


Measured memory_bytes: 256
def eratosthenes(n):
    prime = []
    limit = n**0.5
    numbers = [i for i in range(2,n+1)]
    while True:
        p = numbers[0]
        if limit <= p:
            return prime + numbers
        prime.append(p)
        numbers = [i for i in numbers if i%p != 0]
    return prime

prime = eratosthenes(55555)
r1 = []
for p in prime:
    if p%5==1:
        r1.append(p)
r1 = [str(p) for p in r1][:int(input())]
print(' '.join(r1))

Measured memory_bytes: 5528
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  string S;cin>>S;
  vector<int> array(26);
  REP(i,0,S.size()){
    int tmp=(int)S.at(i)-'a';
    array[tmp]++;
  }
  REP(i,0,26){
    if(!array[i]){
      char ans=(char)i+'a';
      print(ans);
      re 0;
    }
  }
  print("None");

}


Measured memory_bytes: 512
//============================================================================
// Name        : ITP_1_5_A.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
	int H,W;
	do {
		cin >> H >> W;
		if (H==0 && W ==0) break;
		for(int j=0;j<H;++j) {
			for(int i=0;i<W;++i) {
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	} while(1);
	return 0;
}

Measured memory_bytes: 3016
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}
//---------------------------------------------------
signed main() {
	int n, k;
	cin >> n >> k;
	int ok = 0, ng = k + 1, mid;
	while (abs(ok - ng) > 1) {
		mid = (ok + ng) / 2;
		int res = k - mid, r = mid;
		for (int i = 1; i < n && r>0; i++) {
			if (res < (r / 2)) {
				ng = mid;
				goto loop;
			}
			res -= r / 2;
			r /= 2;
		}
		ok = mid;
	loop:;
	}
	cout << ok << endl;
}


Measured memory_bytes: 3120
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int A, B, C;
int main() {
    cin >> A >> B>> C;

    if (A<(B+C)) {
        cout << (C-A+B) << endl;
    } else {
        cout << "0" << endl;
    }

    return 0;
}


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

using namespace std;

const int MX_BIT = 25;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    vector<int> a = {
        1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
    };
    int k;
    cin >> k;
    cout << a[k-1] << endl;
}



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

const ll INF = 1LL << 62;
const double PI = acos(-1);
const double eps = 1e-10;

int main() {
  ll n;
  cin >> n;
  string s;
  map<char, ll> mp;
  rep(i, n) {
    cin >> s;
    mp[s[0]]++;
  }
  vector<ll> d = {mp['M'], mp['A'], mp['R'], mp['C'], mp['H']};
  ll ans = 0;
  for (int i = 0; i <= 2; i++) {
    for (int j = i + 1; j <= 3; j++) {
      for (int k = j + 1; k <= 4; k++) {
        ans += d[i] * d[j] * d[k];
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3660
from collections import Counter


N = int(input())
lstA = list(map(int, input().split()))
mod = 10**9 + 7
countA = Counter(lstA)
ans = 0

if N % 2:
    if countA[0] == 1 and all(countA[i] == 2 for i in range(2, N, 2)):
        ans = 2**(N//2) % mod
else:
    if all(countA[i] == 2 for i in range(1, N, 2)):
        ans = 2**(N//2) % mod


print(ans)


Measured memory_bytes: 14820
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on
int N;

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

  cin >> N;

  cout << ceil(N / 3) << endl;

  return 0;
}


Measured memory_bytes: 888
def examA():
    A, B, C, D = LI()
    ans = max(A*B,C*D)
    print(ans)

import sys
import copy
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Measured memory_bytes: 3444
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int H, W;
	int ct[26] = {};
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			char c;
			cin >> c;
			ct[c - 'a']++;
		}
	}
	int need4 = 0, need2 = 0, need1 = 0;
	if (W >= 2){
		for (int i = 0; i < H / 2 && i * 2 != W; i++) {
			need4 += (W / 2 - i);
		}
	}
	if (H >= 2) {
		for (int i = 0; i < W / 2 && i * 2 != H; i++) {
			need4 += (H / 2 - i);
		}
	}
	need4 -= min(H / 2, W / 2);
	if (H % 2 == 1) {
		need2 += W / 2;
	}
	if (W % 2 == 1) {
		need2 += H / 2;
	}
	if (H % 2 == 1 && W % 2 == 1)need1 = 1;

	//cout << need4 << " " << need2 << " " << need1 << endl;

	int ansct = 0;
	for (int i = 0; i < 26 && ansct != need4; i++) {
		if (ct[i] == 0)continue;
		int t = ct[i] / 4;
		for (int j = 0; j < t && ansct != need4; j++) {
			ansct++;
			ct[i] -= 4;
		}
	}
	if (ansct != need4) {
		cout << "No" << endl;
		return 0;
	}
	ansct = 0;
	for (int i = 0; i < 26 && ansct != need2; i++) {
		if (ct[i] == 0)continue;
		int t = ct[i] / 2;
		for (int j = 0; j < t && ansct != need2; j++) {
			ansct++;
			ct[i] -= 2;
		}
	}
	if (ansct != need2) {
		cout << "No" << endl;
		return 0;
	}
	ansct = 0;
	for (int i = 0; i < 26 && ansct != need1; i++) {
		if (ct[i] == 0)continue;
		if (ct[i] == 1)ansct++;
	}
	if (ansct != need1) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

K = I()
S = ST()
if len(S)<=K:
    print(S)
else:
    print(S[:K]+'...')


Measured memory_bytes: 9964
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int N; cin >> N;
  vector<ll> a(3*N);
  rep(i, 3*N) cin >> a[i];

  priority_queue<ll, vector<ll>, greater<ll>> left;
  vector<ll> lsum(N+1, 0LL);
  rep(i, N) {
    left.push(a[i]);
    lsum[0] += a[i];
  }

  for (int i = 1; i <= N; i++) {
    ll x = left.top(); left.pop();
    lsum[i] = lsum[i-1] - x;
    ll in = max(x, a[N+i-1]);
    lsum[i] += in;
    left.push(in);
  }


  priority_queue<ll> right;
  vector<ll> rsum(N+1, 0LL);
  rep(i, N) {
    right.push(a[i+2*N]);
    rsum[N] += a[i+2*N];
  }

  for (int i = N-1; i >= 0; i--) {
    ll x = right.top(); right.pop();
    rsum[i] = rsum[i+1] - x;
    ll in = min(x, a[i+N]);
    rsum[i] += in;
    right.push(in);
  }


  ll ans = lsum[0] - rsum[0];
  rep(i, N+1) {
    ans = max(ans, lsum[i]-rsum[i]);
  }

  cout << ans << endl;

  return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

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

    int ans=LLONG_MAX;
    for(int i=0;i<=200000;i++){
        int tmp=i*2*c;
        tmp+=max(0ll,x-i)*a;
        tmp+=max(0ll,y-i)*b;
        chmin(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
    string s;
    cin >> s;
    
    int cnt = 1;
    char tmp;
    REP(i, s.size()){
        if(i){
            if(s[i] == tmp);
            else{
                cnt++;
                tmp = s[i];
            }
        }else tmp = s[i];
    }
    cout << cnt - 1 << endl;


    return 0;
}

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

#define NMAX 200005

using namespace std;
typedef long long ll;
typedef long double ld;
ll cnt[NMAX];
int main()
{
    ll n;
    cin>>n;
    for(ll x=1;x<1e2;x++){
        for(ll y=1;y<1e2;y++){
            for(ll z=1;z<1e2;z++){
                ll ans=x*x+y*y+z*z+x*y+x*z+y*z;
                if(ans<=n)
                    cnt[ans]++;
            }
        }
    }
    for(ll i=1;i<=n;i++) cout<<cnt[i]<<'\n';
    return 0;
}



Measured memory_bytes: 3544
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        long n = in.nextInt();

        Set<Long> S = new HashSet<>();
        for (int i = 0; i < n; i++) {
            long a = in.nextInt();
            if (S.contains(a)) {
                S.remove(a);
            } else {
                S.add(a);
            }
        }

        System.out.println(S.size());
    }
}


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

using namespace std;
#define ll long long int
const int MAXN = 1e5 + 10;

vector<int> g[MAXN];


void solve(){
    int n,m,i,j,x,k;
	cin>>n>>m;
	int cnt[m+1];
	memset(cnt,0,sizeof(cnt));
	for(i=0;i<n;++i)
	{
		cin>>k;
		for(j=0;j<k;++j)
		{
			cin>>x;
			++cnt[x];
		}
	}
	int ans = 0;
	for(i=1;i<m+1;++i)
	{
      if(cnt[i] == n)	++ans;
	}
	cout<<ans;
}   

int main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
	//int t; cin >> t;
	//while(t--)
		solve();
}


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


typedef long long ll;
typedef pair<int,int> pii;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

int n,m;
vector<pii> g[125252];

// スパソを写経しました
vector<pii> bridges;
vector<vector<int>> islands;
int num[125252];
bool inS[125252];
stack<int> roots, S;
int tim = 0;
void visit(int v,int u){
  num[v] = ++tim;
  S.push(v);inS[v]=true;
  roots.push(v);
  for(pii P : g[v]){
    int to = P.first;
    if(num[to]==0){
      visit(to,v);
    }else if(u!=to && inS[to]){
      while(num[roots.top()] > num[to])roots.pop();
    }
  }
  if(v == roots.top()){
    bridges.push_back(pii(u,v));
    islands.push_back(vector<int>());
    while(1){
      int w = S.top(); S.pop(); inS[w] = false;
      islands.back().push_back(w);
      if(v==w)break;
    }
    roots.pop();
  }
}
void bridge(){
  REP(u,n)if(num[u]==0){
    visit(u,n);
    bridges.pop_back();
  }
}

int mp[125252];
ll wsum[125252];
ll wall;
vector<pii> g2[125252];

ll mini = 1e18;
set<pii> SS;

ll csum[125252];

void dfs(int p, int bef){
  csum[p] += wsum[p];
  for(pii P : g2[p]){
    int to = P.first;
    ll w = P.second;
    if(to == bef)continue;
    dfs(to, p);
    csum[p] += csum[to] + w;
    ll cost = abs(csum[to] - (wall - csum[to] - w));
    if(cost < mini){
      mini = cost;
      SS.clear();
    }
    if(cost == mini){
      SS.insert(pii(min(p,to),max(p,to)));
    }
  }
}

int n2 = islands.size();

int main(){
  scanf("%d%d",&n,&m);
  wall = 0;
  REP(i,m){
    int u,v,w;
    scanf("%d%d%d",&u,&v,&w);
    --u;--v;
    g[u].push_back(pii(v,w));
    g[v].push_back(pii(u,w));
    wall += w;
  }
  bridge();
  // oh じゃあないんだよ
  // if(islands.size()==1){
  //   // oh
  //   int ansu = n+1, ansv = n+1;
  //   REP(i,n)for(pii P : g[i]){
  //     int j = P.first;
  //     if(i>j)continue;
  //     if(i<ansu || (i==ansu && j<ansv)){
  //       ansu = i;
  //       ansv = j;
  //     }
  //   }
  //   printf("%d %d\n",ansu+1,ansv+1);
  //   return 0;
  // }
  REP(i,islands.size()){
    for(int x : islands[i]){
      mp[x] = i;
    }
  }
  REP(i,n)for(pii P : g[i]){
    int to = P.first;
    int w = P.second;
    if(i>to)continue;
    if(mp[i]==mp[to]){
      wsum[mp[i]] += w;
    }else{
      g2[mp[i]].push_back(pii(mp[to], w));
      g2[mp[to]].push_back(pii(mp[i], w));
    }
  }
  dfs(0,-1);
  int ansu = n+1, ansv = n+1;
  REP(i,n)for(pii P : g[i]){
    int to = P.first;
    int w = P.second;
    if(i>to)continue;
    if(mp[i]==mp[to]){
      continue;
    }else{
      pii Q = pii(min(mp[i],mp[to]),max(mp[i],mp[to]));
      if(SS.count(Q)){
        if(i<ansu || (i==ansu && to<ansv)){
          ansu = i;
          ansv = to;
        }
      }
    }
  }
  REP(i,n)for(pii P : g[i]){
    int to = P.first;
    int w = P.second;
    if(i>to)continue;
    ll cost = wall-w;
    if(cost < mini){
      mini = cost;
      ansu = i;
      ansv = to;
    }else if(cost == mini){
      if(i<ansu || (i==ansu && to<ansv)){
        ansu = i;
        ansv = to;
      }
    }
  }
  printf("%d %d\n",ansu+1,ansv+1);
  return 0;
}



Measured memory_bytes: 24036
#include <vector>
#include <iostream>
using namespace std;
bool vis[10];
int n, m, ans;
vector<int> g[10];
void dfs(int u, int cnt) {
	if (cnt == n) {
		ans++;return;
	}
	vis[u] = true;
	for (int i = 0; i < (int)g[u].size(); i++) {
		int v = g[u][i];
		if (!vis[v]) dfs(v, cnt+1);
	}
	vis[u] = false;
}
int main() {
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1, 1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
def gcd(x, y):
  r = x % y
  while r > 0:
    x = y
    y = r
    r = x % y
  return y

def lcm(x, y):
  return int(x * y / gcd(x, y))

a, b = map(int, input().split())
print(lcm(a, b))


Measured memory_bytes: 2940
#include <stdio.h>
void swap(long long int *a,long long int *b){
  long long int t;
  t = *a;
  *a = *b;
  *b = t;
}
int partition (long long int array[],long long int left,long long int right) {
  long long int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;
  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);
  swap(&array[pivot], &array[j]);
  return j;
}
void sort (long long int array[],long long int left,long long int right) {
  long long int pivot;
  if (left < right) {
    pivot = partition(array, left, right);
    sort(array, left, pivot-1);
    sort(array, pivot+1, right);
  }
}
int main(){
  int n;
  scanf("%d",&n);
  long long int a[n],ans = 0,t;
  for(int i = 0;i < n;i++){
    scanf("%lld",&a[i]);
  }
  sort(a,0,n - 1);
  for(int i = 1;i < n;i++){
    if(a[i] == a[i - 1]){
      ans++;
      i++;
    }
  }
  printf("%lld",n - ans * 2);
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
int N, x[100], y[100], p, q;
void solve()
{
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N)
    {
        cin >> x[i] >> y[i];
    }
    int ans;
    ans = N;
    FOR(i, 0, N)
    {
        FOR(j, i + 1, N)
        {
            int t;
            t = 0;
            p = x[j] - x[i];
            q = y[j] - y[i];
            t = N;
            FOR(I, 0, N)
            {
                FOR(J, I + 1, N)
                {
                    if (I == J) {
                        continue;
                    }
                    if ((x[J] - x[I] == p && y[J] - y[I] == q) || (x[J] - x[I] == -p && y[J] - y[I] == -q)) {
                        t--;
                    }
                }
            }
            ans = min(ans, t);
        }
    }
    if (N == 1) {
        ans = 1;
    }
    cout << ans << endl;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,sp[305][305],hh[305],mx,pos,st[305],ans=1000;
bitset<305>del;
vector<int>v;
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		st[i]=1;
		for(int j=1;j<=m;j++)
		{
			scanf("%d",&sp[i][j]);
		}
		hh[sp[i][1]]++;
	}
	for(int i=m;i>0;i--)
	{
		mx=0;
		for(int j=1;j<=m;j++)
		{
			if(hh[j]>=mx)mx=hh[j],pos=j;
			//printf("%d ",hh[j]);
		}	
		//printf("-------------------------\n");
		del[pos]=true;
		hh[pos]=0;
		//if(mx==0)break;
		//printf("////%d\n",mx);
		ans=min(ans,mx);
		for(int j=1;j<=n;j++)
		{
			if(del[sp[j][st[j]]])
			{
				while(del[sp[j][st[j]]])
				{
					st[j]++;	
				}
				hh[sp[j][st[j]]]++;	
			}
		}
	}
	printf("%d",ans);
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	
	public static void Main(string[] args)
	{
		string[] d = Input();
		int a = int.Parse(d[0]);
		int b = int.Parse(d[1]);
		int k = int.Parse(d[2]);
		
		for(int i = a; i <= b; i++)
		{
			if(i <= a+k-1 || b-k+1 <= i)
			{
				Console.WriteLine(i);
			}
		}
	}

	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



Measured memory_bytes: 13140
package main

import (
	"bufio"
	"container/heap"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := NewScanner(os.Stdin)
	h, _ := sc.NextInt()
	w, _ := sc.NextInt()
	k, _ := sc.NextInt()
	x1, _ := sc.NextInt()
	y1, _ := sc.NextInt()
	x2, _ := sc.NextInt()
	y2, _ := sc.NextInt()
	stage := make([]string, h)
	for i := 0; i < h; i++ {
		sc.Scan()
		stage[i] = sc.Text()
	}
	ans := solve(h, w, k, x1-1, y1-1, x2-1, y2-1, stage)
	fmt.Println(ans)
}

type state struct {
	x, y, dist int
}

type priorityQueue []*state

func (p priorityQueue) Len() int            { return len(p) }
func (p priorityQueue) Less(i, j int) bool  { return p[i].dist < p[j].dist }
func (p priorityQueue) Swap(i, j int)       { p[i], p[j] = p[j], p[i] }
func (p *priorityQueue) Push(x interface{}) { *p = append(*p, x.(*state)) }
func (p *priorityQueue) Pop() interface{} {
	x := (*p)[len(*p)-1]
	*p = (*p)[:len(*p)-1]
	return x
}
func (p priorityQueue) String() string {
	out := ""
	for _, v := range p {
		out += fmt.Sprintf("%+v ", *v)
	}
	return strings.TrimSpace(out)
}

var inf = math.MaxInt64
var dxs, dys = []int{0, 0, -1, 1}, []int{-1, 1, 0, 0}

func solve(h, w, k, x1, y1, x2, y2 int, stage []string) int {
	dists := make([][]int, h)
	for x := range dists {
		dists[x] = make([]int, w)
		for y := range dists[x] {
			dists[x][y] = inf
		}
	}

	dists[x1][y1] = 0
	q := priorityQueue{}
	// q := []*state{}
	s := &state{x1, y1, 0}
	heap.Push(&q, s)
	// q = append(q, s)
	for len(q) > 0 {
		// for idx := 0; idx < len(q); idx++ {
		//fmt.Println(q.String())
		p := heap.Pop(&q).(*state)
		// p := q[idx]
		if p.x == x2 && p.y == y2 {
			return p.dist
		}
		for d := range dxs {
			for i := 1; i <= k; i++ {
				x, y := p.x+i*dxs[d], p.y+i*dys[d]
				if x < 0 || h <= x || y < 0 || w <= y {
					break
				}
				if stage[x][y] == '@' {
					break
				}
				dist := p.dist + 1
				if dist > dists[x][y] {
					break
				}
				if dist == dists[x][y] {
					continue
				}
				dists[x][y] = dist
				s := &state{x, y, dist}
				heap.Push(&q, s)
				// q = append(q, s)
			}

		}
	}
	if dists[x2][y2] == inf {
		return -1
	}
	return dists[x2][y2]
}

// Scanner is a wrapper of bufio.Scanner which is customized for competitive programing.
type Scanner struct {
	bufio.Scanner
}

// NewScanner is a constructor for Scanner.
func NewScanner(r io.Reader) *Scanner {
	sc := Scanner{*bufio.NewScanner(r)}
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return &sc
}

// NextInt reads a integer from io stream.
func (sc *Scanner) NextInt() (int, error) {
	if !sc.Scan() {
		return -1, errors.New("failed to scan")
	}
	return strconv.Atoi(sc.Text())
}


Measured memory_bytes: 27420
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

inline int read () {
    int ret = 0, t = 1;
    char c = getchar();
    while ((c < '0' || c > '9') && c != '-') c = getchar();
    if (c == '-') t = -1, c = getchar();
    while (c >= '0' && c <= '9') ret = ret * 10 + c - '0', c = getchar();
    return ret * t;
}

string a[200200] = {};
int n;

#include <map>

map <string ,int> mp;

int main () {
    n = read();
    int i, j;
    for (i = 1; i <= n; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }
    int Max = 0;
    for (i = 1; i <= n; i++) Max = max(Max, mp[a[i]]);
    sort(a + 1, a + n + 1);
    for (i = 1; i <= n; i++) if (mp[a[i]] == Max) cout << a[i] << endl, mp[a[i]] = 0;
    return 0;
}

Measured memory_bytes: 22272
#include <cstdio>
#include <cstring>
char s[15];
int main()
{
 scanf("%s",s+1);
 int len=strlen(s+1);
 for(int i=1;i<=len;i+=2)
  if(s[i]!='h'||s[i+1]!='i')
  {
   puts("No");
   return 0;
  }
 puts("Yes");
 return 0;
}

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

int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	if ( s[0] == s[1] && s[0] != s[2] && s[2] == s[3] ) {
		cout << "Yes";
	} 
	else {
		cout << "No";
	}
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	class Edge implements Comparable<Edge>{
		int from,to, cost;
		public Edge(int from, int to, int cost) {
			this.from = from; this.to = to; this.cost = cost;
		}
		public int compareTo(Edge o) {
			if(this.cost < o.cost)return -1;
			if(this.cost > o.cost)return 1;
			return 0;
		}
	}

	class State implements Comparable<State>{
		int now;
		long cost;
		public State(int now, long cost) {
			this.now = now;
			this.cost = cost;
		}
		public int compareTo(State o) {
			if(this.cost > o.cost) return 1;
			if(this.cost < o.cost) return -1;
			return 0;
		}
	}
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			ArrayList<ArrayList<Edge>> pass = new ArrayList<>();
			for(int i = 0; i < n; i++){
				pass.add(new ArrayList<>());
			}
			
			for(int i =0; i < n-1; i++){
				int a = sc.nextInt() - 1;
				int b = sc.nextInt() - 1; 
				int c = sc.nextInt();
				pass.get(a).add(new Edge(a, b, c));
				pass.get(b).add(new Edge(b, a, c));
			}
			int q = sc.nextInt();
			int start = sc.nextInt() -1;
			
			PriorityQueue<State> open = new PriorityQueue<>();
			open.add(new State(start, 0));
			long [] close = new long[n];
			Arrays.fill(close, Long.MAX_VALUE);
			close[start] = 0;
			
			boolean [] used = new boolean[n];
			used[start] = true;
			int count = 1;
			
			while(!open.isEmpty()){
				State current = open.poll();
				if(!used[current.now]){
					used[current.now] = true;
					count++;
					if(count == n){
						break;
					}
				}
				
				int len = pass.get(current.now).size();
				for(int i = 0; i < len;i++){
					Edge e = pass.get(current.now).get(i);
					long nextcost = current.cost + e.cost;
					if(close[e.to] <= nextcost) continue;
					close[e.to] = nextcost;
					open.add(new State(e.to, nextcost));
				}
			}
			
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < q; i++){
				int x = sc.nextInt() - 1;
				int y = sc.nextInt() - 1;
				long res = close[x] + close[y];
				sb.append(res+"\n");
			}
			System.out.print(sb.toString());
		}

	}


	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 173148
#pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

void build(const string &A, const string &B, bool ab[2011]) {
    REP (i, A.size()+1u) {
	int right = min((int)A.size(), i+(int)B.size());
	bool ok = true;
	for (int j=i; j<right; j++) {
	    if (A[j] != '?' && B[j-i] != '?' && A[j] != B[j-i]) {
		ok = false;
		break;
	    }
	}
	ab[i] = ok;
    }
}

int ans;
bool ab[2011], ac[2011], bc[2011];;

void solve(const string &A, const string &B, const string &C) {
    build(A, B, ab);
    build(A, C, ac);
    build(B, C, bc);
    REP (i, A.size()+1u) if (ab[i]) {
	int right = max((int)A.size(), i+(int)B.size());
	for (int j=i; j<=right; j++) {
	    if (j < (int)A.size() && !ac[j]) continue;
	    if (j < i+(int)B.size() && !bc[j-i]) continue;
	    int tmp = max(right, j+(int)C.size());
	    amin(ans, tmp);
	}
    }
}

string A, B, C;
char buf[2011];

void MAIN() {
    scanf("%s", buf); A = buf;
    scanf("%s", buf); B = buf;
    scanf("%s", buf); C = buf;
    ans = (int)A.size() + (int)B.size() + (int)C.size();
    solve(A, B, C);
    solve(A, C, B);
    solve(B, A, C);
    solve(B, C, A);
    solve(C, A, B);
    solve(C, B, A);
    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

struct PrimeNumber
{
    //O(sqrt(n))
    bool is_prime(long long n){
        for(long long i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return n != 1;
    }

    //O(sqrt(n))  isn't sorted
    vector<long long> divisor(long long n){
        vector<long long> res;
        for(long long i = 1; i * i <= n; i++){
            if(n % i == 0){
                res.push_back(i);
                if(i != n / i) res.push_back(n / i);
            }
        }
        return res;
    }

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

    //O(n log log n)
    vector<long long> eratosthenes(long long n){
        vector<long long> prime;
        vector<bool> is_prime(n + 1, true);
        long long p = 0;
        is_prime[0] = false; is_prime[1] = false;
        for(long long i = 2; i <= n; i++){
            if(is_prime[i]) prime.push_back(i);
            for(long long j = 2 * i; j <= n; j += i) is_prime[j] = false;
        }
        return prime;
    }
};

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll n; cin >> n;
    cout << n << ": ";

    PrimeNumber p;
    map<ll, ll> res = p.prime_factor(n);

    vector<ll> ans;
    for(auto i: res){
        rep(j, i.second){
            ans.push_back(i.first);
        }
    }

    rep(i, ans.size()){
        if(i == ans.size() - 1){
            cout << ans[i] << endl;
        }else{
            cout << ans[i] << " ";
        }
    }

}


Measured memory_bytes: 3168
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

ll M = 1000000007;

ll modpow(ll x,ll k){
	if(k == 0)return 1;
	ll ret = modpow(x,k/(ll)2);
	ret *= ret;
	ret %= M;
	if(k%2 == 1){
		ret *= x;
		ret %= M;
	}
	return ret;
}

int main(){
	ll h,w,k;
	char s[1002][1002];
	scanf("%lld%lld%lld",&h,&w,&k);
	rep(i,h){
		scanf("\n");
		rep(j,w)scanf("%c",&s[i][j]);
	}
	
	
	ll a = 0;
	rep(i,h)rep(j,w)if(s[i][j] == '#')a ++;
	
	if(k == 0){
		cout << 1 << endl;
		return 0;
	}
	
	if(h == 1){
		if(s[0][0] == '#' && s[0][w-1] == '#'){
			cout << 1 << endl;
			return 0;
		}
		else cout << modpow(a,k-1) << endl;
		return 0;
	}
	if(w == 1){
		if(s[0][0] == '#' && s[h-1][0] == '#'){
			cout << 1 << endl;
			return 0;
		}
		else cout << modpow(a,k-1) << endl;
		return 0;
	}
	
	ll cnt[2] = {};
	rep(j,w){
		if(s[0][j] == '#' && s[h-1][j] == '#')cnt[0] ++;
	}
	rep(i,h){
		if(s[i][0] == '#' && s[i][w-1] == '#')cnt[1] ++;
	}
	
	if(cnt[0] > 0 && cnt[1] > 0){
		puts("1");
		return 0;
	}
	ll b = max(cnt[0],cnt[1]);
	
	if(b ==0){
		cout << modpow(a,k-1) << endl;
	}
	else {
		ll c = 0;
		if(cnt[0] > 0){
			rep(i,h-1)rep(j,w){
				if(s[i][j] == '#' && s[i+1][j] == '#')c ++;
			}
		}
		else {
			rep(i,h)rep(j,w-1){
				if(s[i][j] == '#' && s[i][j+1] == '#')c ++;
			}
		}
		k --;
		ll ret = modpow(a,k) - modpow(b,k) + M;
		ret %= M;
		ret *= modpow(a-b,M-2);
		ret %= M;
		ret *= c;
		ret %= M;
		ret = M-ret;
		ret += modpow(a,k);
		ret %= M;
		cout << ret << endl;
	}
}



Measured memory_bytes: 1280
a, b = map(int, input().split())
a -= 1
b -= 1
print(82, 51)
for i in range(41):
  for j in range(51):
    if i % 2 == 0 or j % 2 == 0 or b == 0:
      print('.', end='')
    else:
      print('#', end='')
      b -= 1
  print('')
for i in range(41):
  for j in range(51):
    if i % 2 == 0 or j % 2 == 0 or a == 0:
      print('#', end='')
    else:
      print('.', end='')
      a -= 1
  print('')


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i,ans=0;
    cin>>n;
    ll arr[n];
    for(i=0;i<n;i++){
        cin>>arr[i];
        ans=__gcd(ans,arr[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define INT_MAX 2147483647
#define INT_MIN -2147483647
using namespace std;
int n, h;
multimap<int, int> fr;

int main() {
    cin.tie(0); ios::sync_with_stdio(0);
    cin >> n;
    long long cnt = 0;

    for (int i = 1; i <= n; i++) {
        cin >> h;
        int dif = i - h;
        if (dif > 0) {
            if (fr.find(dif) != fr.end())
                cnt += fr.find(dif)->second;
        }
        int nou = i + h;
        if (fr.find(nou) == fr.end())
            fr.insert(make_pair(nou, 0));
        fr.find(nou)->second++;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 12884
#include <bits/stdc++.h>
#define xx first
#define yy second
#define MP make_pair
#define pb push_back
#define ll long long

using namespace std;

void yes()
{
    cout <<"Yes"<<endl;return;

}
void no(){
cout << "No"<<endl;return;
}

void YES()
{
    cout <<"YES"<<endl;return;

}
void NO(){
cout << "NO"<<endl;return;
}


int main()
{
     int t;

	  int n;
	  cin >> n;
	  if(n==0){
        cout <<"1"<<endl;
	  }
	  else cout << "0" << endl;
	  
	return 0;
}


Measured memory_bytes: 3564
import sys
from collections import deque,defaultdict

I=sys.stdin.readline

def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))

def mi():
	return map(int,I().strip().split())


def main():
	n=ii()
	arr=li()
	p=1000
	for i in range(n-1):
		if arr[i]==arr[i+1]:
			pass
		elif arr[i]<arr[i+1]:
			buy=p//arr[i]
			p+=(arr[i+1]-arr[i])*buy

	
	print(p)








		


		










		






if __name__ == '__main__':
	main()

Measured memory_bytes: 9496
#include <bits/stdc++.h>
using namespace std;
#define FO(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define fo(i,j,k) for(int i=(j),end_i=(k);i<=end_i;i++)
#define ff(i,j,k) for(int i=(j),end_i=(k);i< end_i;i++)
#define fd(i,j,k) for(int i=(j),end_i=(k);i>=end_i;i--)
#define DEBUG(x) cerr<<#x<<"="<<x<<endl
#define all(x) (x).begin(),(x).end()
#define cle(x) memset(x,0,sizeof(x))
#define lowbit(x) ((x)&-(x))
#define ll long long
#define ull unsigned ll
#define db double
#define lb long db
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll mod=998244353;
inline ll Add(ll x,ll y){x+=y; return (x<mod)?x:x-mod;}
inline ll Dec(ll x,ll y){x-=y; return (x<0)?x+mod:x;}
inline ll Mul(ll x,ll y){return x*y%mod;}
inline ll Pow(ll x,ll y)
{
	y%=(mod-1);ll ans=1;for(;y;y>>=1,x=x*x%mod)if(y&1) ans=ans*x%mod;
	return ans;
}
const int N=5e5+5;
ll fac[N],inv[N];
int n,k,R,B;
inline ll C(int n,int m)
{
	if(n<0||m<0||n-m<0) return 0;
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
void init(int n)
{
	fac[0]=1; fo(i,1,n) fac[i]=fac[i-1]*i%mod;
	inv[n]=Pow(fac[n],mod-2); fd(i,n,1) inv[i-1]=inv[i]*i%mod;
}
ll ans;
int main()
{
	cin>>n>>k;
	if(n>k) return puts("0")&0;
	init(k);
	fo(R,0,k)
	{
		B=k-R;
		if(R<B) continue;
		if(R>=B+n) {ans=Add(ans,C(R+B,R)); continue;}
		if(R==B) B--;
		ans=Add(ans,Dec(C(R+B,R),C(R+B,2*R-n+1)));
	}
	printf("%lld",ans);
	return 0;
}

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

int main() {
   string s, t;
   cin >> s >> t;

   cout << t << s << endl;
}

Measured memory_bytes: 256