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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

priority_queue<string,vector<string>> pq;

set<string> have;

int main()
{
    string s;cin >> s;
    int k;cin >> k;
    int sz = s.size();
    _for(i,0,sz){
        int nex = min(sz - i , k);
        _rep(j,1,nex){
            string t = s.substr(i,j);

            if(pq.size() < k) {
                pq.push(t);
                have.insert(t);
            }
            else{
                string top = pq.top();
                if(!have.count(t)&&top > t){
                    pq.pop();
                    pq.push(t);
                    have.insert(t);
                }

            }
        }
    }

    cout << pq.top() << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define pb push_back 
#define F first 
#define S second 
#define f(i,n) for(int i=0;i<n;i++) 
#define fr(i,a,b) for(int i=a;i<b;i++) 

using namespace std;

void test(){
	ll n,m;
	cin>>m>>n;
	ll s = 0;
	ll a[n];
	f(i,n)cin>>a[i];
	f(i,n)s+=a[i];
	if(s>m)cout<<"-1\n";
	else cout<<m-s<<"\n";
}

int main(){
	int t=1;
//	cin>>t;
	while(t--){
		test();
	}
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main(){
    cin>>a>>b;
    for(int i=0;i<max(a.size(),b.size());i++){
        cout<<a[i];
        if(b[i]!=0) cout<<b[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int K,N;
	cin>>K>>N;
	int mx=-1,fst,last;
	for(int i=0;i<N;i++)
	{
		int A;
		cin>>A;
		if(i==0)fst=A;
		if(i!=0&&A-last>=mx)mx=A-last;
		last=A;
	}
	if(fst+K-last>mx)mx=fst+K-last;
	cout<<K-mx<<endl;
	return 0;
}

Measured memory_bytes: 384
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let h: usize = iterator.next().unwrap().parse().unwrap();
    let w: usize = iterator.next().unwrap().parse().unwrap();

    let mut ans = 0;
    for _ in 0..n {
        let a: usize = iterator.next().unwrap().parse().unwrap();
        let b: usize = iterator.next().unwrap().parse().unwrap();
        if a >= h && b >= w {
            ans += 1;
        }
    }
    ans.to_string()
}


Measured memory_bytes: 2140
fn main() {
    let n: usize = read::<usize>();
    let mut v: Vec<isize> = vec![];
    for _ in 0..n {
        v.push(read());
    }
    let mut dp = vec![std::isize::MAX; n];
    dp[0] = 0;
    for i in 1..n {
        let o = i.saturating_sub(1);
        let t = i.saturating_sub(2);
        dp[i] = min(
            min(dp[o] + (v[i] - v[o]).abs(), dp[t] + (v[i] - v[t]).abs()),
            dp[i],
        );
    }
    println!("{}", dp[n - 1]);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: isize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


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

using namespace std;

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

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

class UnionFind
{
    vector<int> par;
    int groupCount;

public:
    // UnionFind uf(n)でn要素のUF木uf
    UnionFind(int n = 0)
    {
        init(n);
    }

    // n要素で初期化
    void init(int n = 0)
    {
        par.resize(n);
        fill(par.begin(), par.end(), -1);
        groupCount = n;
        return;
    }

    // xが属する集合の根を求める
    int root(int x)
    {
        if (par[x] < 0)
        {
            return x;
        }
        return par[x] = root(par[x]);
    }

    // xとyが同じ集合に属するか調べる
    bool same(int x, int y)
    {
        return root(x) == root(y);
    }

    // xが属する集合の大きさを調べる
    int size(int x)
    {
        return -par[root(x)];
    }

    // xが属する集合とyが属する集合を繋ぐ
    // 既に繋がっていたらfalseが返る
    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
        {
            return false;
        }
        if (par[y] < par[x])
        {
            swap(x, y);
        }
        par[x] += par[y];
        par[y] = x;
        --groupCount;
        return true;
    }

    // UF内にある集合の個数を調べる
    int size(void)
    {
        return groupCount;
    }
};

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

    int n, m;
    cin >> n >> m;

    vector<int> a(m), b(m);
    for(int i = 0 ; i < m ; ++i){
        cin >> a[i] >> b[i];
        --a[i];
        --b[i];
    }

    UnionFind uf(n);
    vector<long long> ans(m);
    long long now = (long long)n * (n - 1LL) / 2LL;
    for(int i = m - 1 ; i >= 0 ; --i){
        ans[i] = now;
        long long as = uf.size(a[i]), bs = uf.size(b[i]);
        if(uf.unite(a[i], b[i])){
            now -= as * bs;
        }
    }

    for(int i = 0 ; i < m ; ++i){
        cout << ans[i] << endl;
    }

    return 0;
}

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

int main () {
  int A, B;
  cin >> A >> B;
  
  if (13 <= A) {
    cout << B << endl;
  }
  else if (6 <= A && A <= 12) {
    cout << B/2 << endl;
  }
  else if (A <= 5) {
    cout << 0 << endl;
  }
}  

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

const int Maxn = 100005;

int n, k;
int a[Maxn];

int gcd(int x, int y) { return x? gcd(y % x, x): y; }

int main()
{
	scanf("%d %d", &n, &k);
	int g = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		g = gcd(g, a[i]);
	}
	for (int i = 0; i < n; i++)
		if (a[i] >= k && (a[i] - k) % g == 0) { printf("POSSIBLE\n"); return 0; }
	printf("IMPOSSIBLE\n");
	return 0;
}

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

int main() {
	int n,arr[100000],x,k;
	cin>>n;
	std::fill (arr,arr+100000,0);
	for (x=0;x<n;x++){
		cin>>k;
		arr[k]=arr[k]+1;
		arr[k-1]=arr[k-1]+1;
		arr[k+1]=arr[k+1]+1;
	}
	sort (arr,arr+100000);
	cout<<arr[99999]<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int N=2e2+20;
const int inf=1e9;
//题意:n个点m条边,求不在任意两点最短路径上的边个数 n<=100 
//边(i,j) 在(s->t)的最短路径上的充要条件为 dist[s][i]+w[i][j]+dist[j][t]=dist[s][t]; 等式1 
//若暴力枚举:边和s,t复杂度为O(m*n*n)=O(1e8) 
//因为此时 边(i,j)在s->t上 所以顶点j为s->t的中间结点 dist[s][t]=dist[s][j]+dist[j][t] 等式2 
//等式联立 得充要条件为:dist[s][i]+w[i][j]=dist[s][j] 
//所以枚举:边和s即可,总复杂度为O(m*n)+O(n^3)  
 

 
int dist[N][N];//dist[u][v] u->v shortest path
struct edge{
	int a,b,c;
}e[1100];
int n,m;
void Floyd()
{
	for(int k=1;k<=n;k++)
	{
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);		
			}
		}
	}
}
int main()
{
	while(cin>>n>>m)
	{
		for(int i=1;i<=n;i++)
		{	
			for(int j=1;j<=n;j++)
			{
				if(i==j)
				dist[i][j]=0;
				else
				dist[i][j]=inf;
			}
		}
		for(int i=0;i<m;i++)
		{
			cin>>e[i].a>>e[i].b>>e[i].c;	
			dist[e[i].a][e[i].b]=e[i].c;//无中间结点 
			dist[e[i].b][e[i].a]=e[i].c;
		}
		Floyd();
	
		int ans=m;   
		for(int i=0;i<m;i++)
		{
			bool flag=false;
			for(int s=1;s<=n;s++)
			{
				int u=e[i].a,v=e[i].b,w=e[i].c;
				if(dist[s][u]+w==dist[s][v])
				flag=true;
			}
			if(flag)
			ans--;
		} 
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


vector<int> v;
int N;

void rec(ll val,bool a,bool b,bool c) {
  if(N < val) return;
  if(val && a && b && c) {
    v.push_back(val);    
  }
  rec(val * 10 + 3, true, b, c);
  rec(val * 10 + 5, a, true, c);
  rec(val * 10 + 7, a, b, true);
}




int main() {
  cin >> N;
  rec(0,false,false,false);
  sort(all(v));
  int ans = 0;
  for(auto itr : v) ans++;
  cout << ans << endl;
  return 0;
}





Measured memory_bytes: 512
#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 vi   = vector < int >;
using vl   = vector < ll >;
using vli  = vector < li >;
using vii  = vector < ii >;
using vi3  = vector < i3 >;
using vlii = vector < lii >;

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

int n , m;


void solve(int cs){
    scanf("%d %d" , &n , &m);

    printf("%d\n" , max(0 , n - 2*m));

}

main(){

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

    for(int cs = 1 ; t -- ; cs ++){
        solve(cs);
    }

    return 0;
}


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


int main(){
  int b,i,n,k,x=0;
  int a[10000001]={};
  scanf("%d %d",&n,&k);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
    b=n;
    b-=k;
    x++;
    while(b>0){
      b-=k-1;
      x++;
    }
  printf("%d",x);
  return 0;
}


Measured memory_bytes: 39168
import sys


def solve(inp):
    N = int(inp.readline().strip())
    S = inp.readline().strip()

    if S[int(N / 2):] == S[:int(N / 2)]:
        return "Yes"
    else:
        return "No"


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;
typedef pair<int, int>             pii;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

const int N = 100 + 5, V = 1e5 + 5 ;

int dp[V];
int w[N], v[N];
int n, ans = 0;
//
//int sol(int i, int vS, int wS) {
//    if(i == n) {
//        ans = max(ans, vS);
//        return 0;
//    }
//
//    int &ret = dp[i][vS];
//    if(ret != -1) return ret;
//
//    ret = sol(i + 1, vS, wS);
//
//    if(wS - w[i] >= 0) ret = max(ret, sol(i + 1, vS + v[i], wS - w[i]));
//
//    return ret;
//}

int main(){
    fIO

//    freopen("", "r", stdin);
//    freopen("", "w", stdout);

    fill(dp, dp + V, 1e9 + 5);

    int cap;
    cin >> n >> cap;

    for(int i = 0; i < n; i++) cin >> w[i] >> v[i];

    dp[0] = 0;
    for(int i = 0; i < n; i++) {
        for(int j = V - 5; j >= 1; j--) {
            if(j >= v[i]) {
               dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
            }
        }
    }


    for(int i = V - 5; i >= 1; i--) {
        if(dp[i] <= cap) {
            cout << i << "\n";
            break;
        }
    }
}









Measured memory_bytes: 640
#include <cstdio>

int main(){
    int r,c;
    scanf("%d%d",&r,&c);
    int ss[r][c];
    for(int i = 0;i < r;i++){
        for(int j = 0;j < c;j++){
            scanf("%d",&ss[i][j]);
        }
    }
    int s[r + 1][c + 1];
    for(int i = 0;i < r;i++){
        for(int j = 0;j < c;j++){
            s[i][j] = ss[i][j];
        }
    }
    for(int i = 0;i < c;i++){
        s[r][i] = 0;
        for(int j = 0;j < r;j++){
            s[r][i] += ss[j][i];
        }
    }
    for(int i = 0;i < r;i++){
        s[i][c] = 0;
        for(int j = 0;j < c;j++){
            s[i][c] += s[i][j];
        }
    }
    s[r][c] = 0;
    for(int i = 0;i < c;i++){
        s[r][c] += s[r][i];
    }
    for(int i = 0;i <= r;i++){
        for(int j = 0;j <= c;j++){
            printf("%d",s[i][j]);
            if(j != c){
                printf(" ");
            }
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2740
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
import copy
import numpy as np
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    a, b = LI()
    ans = 1
    a_div = make_divisors(a)

    for div in a_div:
        if a == 1 or b == 1:
            break
        if div == 1:
            continue
        if b % div == 0:
            ans += 1
            while b % div == 0:
                b /= div
        while a % div == 0:
            a /= div
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 27364
import java.util.*

fun main(args: Array<String>) {
    maximumDifference()
}

//問題文
//長さNの整数列
//Aが与えられます。
//Aの（添字の）異なる2要素の差の絶対値の最大値を求めてください。
//
//制約
//2≤N≤100
//1≤Ai≤10^9
//
//入力はすべて整数である。

fun maximumDifference() {
    val scanner = Scanner(System.`in`)
    val n = Integer.parseInt(scanner.next())
    val array = IntArray(n)
    val str2 = scanner.next()
    val m = Integer.parseInt(str2)
    array[0] = m
    var maximum = array[0]
    var minimum = array[0]
    for (i in 1 until array.size)
    {
        array[i] = scanner.nextInt()
        val v = array[i]
        if (v > maximum)
        {
            maximum = v
        }
        if (v < minimum)
        {
            minimum = v
        }
    }
    val delta = maximum - minimum
    println(delta)
}


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

int main(){
  int n,l;
  string str[200];
  cin >> n >> l;
  cin.ignore();
  for(int i=0; i < n;i++){
    getline(cin,str[i]);
    //cin >> str[i];
  }
  sort(str,str+n);
  for(int i=0; i < n;i++){
    cout << str[i] <<flush;
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main(void){
  int a, b, c;
  bool fail = false;
  
  cin >> a >> b >> c;
  
  if(a==b || b==c || a==c){
    if(a==b && b==c){
      fail = false;
    }
    else{
      fail = true;
    }
  }
  
  if(fail){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
while True:
    m, n_min, n_max = map(int, input().split())
    if m == n_min == n_max == 0:
        break
    prev = int(input())
    diff = [0] * m
    mx = 0

    for i in range(1, m):
        now = int(input())
        diff[i] = prev - now
        prev = now

    ans = 0
    for i in range(n_min, n_max + 1):
        if mx <= diff[i]:
            ans = i
            mx = diff[i]

    print(ans)

Measured memory_bytes: 7564
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
const int N = 2e5 + 10, OO = 0x3f3f3f3f, mod = 1e9 + 7;

#define PI acos(-1)
#define clr(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, n) for (int i = 0; i < int(n); i++)
#define rloop(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define xloop(i, a, b) for (int i = int(a); i <= int(b); i++)
#define ALL(v) ((v).begin()), ((v).end())
#define SZ(v) ((int)((v).size()))
#define sc1(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d %d", &a, &b)
#define vi vector<int>
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1}; //4 Direction
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; //8 direction
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2};
//int dy[] = {1, 2, 2, 1, -1, -2, -2, -1}; //Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

//-- "كلٌّ من يسعى لابد يصل .. كلٌّ من يسعى مضمون له الوصول" --//

int s, e;

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

  sc2(s, e);
  printf("%d\n", (s + e) % 24);

  return 0;
}


Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>

using namespace std;

struct message {
    message(int x, int y) : x(x), y(y) {};
    int x;
    int y;
};

int N;

void search(const vector<vector<message>>& messages, vector<int> truth, int idx, int& answer){
    if(idx==N+1){
        int tmp=0;
        for(int i=1; i<=N; i++) {
            if (truth[i] == 1)
                tmp++;
        }
        answer = max(answer, tmp);
        return;
    }

    if(truth[idx]==-1) {
        truth[idx]=0;
        search(messages, truth, idx+1, answer);

        truth[idx]=1;
        for (const auto& message: messages[idx]){
            if(truth[message.x]==-1){
                truth[message.x]=message.y;
            }else if(truth[message.x]!=message.y){
                return;
            }else{
                truth[message.x]=message.y;
            }
        }
        search(messages, truth, idx+1, answer);

    }else{
        if(truth[idx]==1){
            for (const auto& message: messages[idx]){
                if(truth[message.x]==-1){
                    truth[message.x]=message.y;
                }else if(truth[message.x]!=message.y){
                    return;
                }else{
                    truth[message.x]=message.y;
                }
            }
        }
        search(messages, truth, idx+1, answer);
    }
}

int main() {

    cin >> N;
    int A[16];
    vector<vector<message>> messages;
    messages.push_back(vector<message>{});
    for(int i=1; i<=N; i++){
        cin >> A[i];
        vector<message> tmp;
        for(int j=1; j<=A[i]; j++){
            int x, y;
            cin >> x >> y;
            tmp.push_back(message(x, y));
        }
        messages.push_back(tmp);
    }

    vector<int> truth(16,-1);

    int answer = 0;

    search(messages, truth, 1, answer);
    cout << answer << endl;
    return 0;
}

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

using namespace std;


int main() {

    int N, K;
    cin >> N >> K;
    vector<int> vec(N);

    for(int i = 0 ; i < N; ++i)
    {
        int n;
        cin >> n;
        vec.push_back(n);
    }

    int res = 0;


    for(int x : vec)
    {
        if(x >= K) res++;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H,W;
  cin >> H >> W;
  int M;
  cin >> M;
  vector<vector<int>> G(H);
  vector<int> cnt_W(W,0);
  for(int i=0; i<M; i++){
    int h,w;
    cin >> h >> w;
    h--;w--;
    cnt_W[w]++;
    G[h].emplace_back(w);
  }
  int mx_H=0,mx_W=0;
  for(int i=0; i<W; i++){
    chmax(mx_W,cnt_W[i]);
  }
  set<int> W_num;
  for(int i=0; i<W; i++){
    if(cnt_W[i] == mx_W){
      W_num.emplace(i);
    }
  }
  for(int i=0; i<H; i++){
    chmax(mx_H,(int)G[i].size());
  }
  bool can = false;
  // for(int i=0; i<H; i++){
  //   for(int j=0; j<G[i].size(); j++){
  //     cout << G[i][j] << " ";
  //   }
  //   cout << "\n";
  // }
  for(int i=0; i<H; i++){
    if(G[i].size() != mx_H) continue;
    int cnt = 0;
    for(int j=0; j<G[i].size(); j++){
      if(W_num.count(G[i][j])){
        cnt++;
      }
    }
    if(cnt < W_num.size()) can = true;
  }
  if(can){
    cout << mx_H + mx_W << "\n";
  }else{
    cout << mx_H + mx_W - 1 << "\n";
  }
  return 0;
}

Measured memory_bytes: 34816
N,M=map(int, input().split())
B=[]
class UnionFind():
  # 作りたい要素数nで初期化
  # 使用するインスタンス変数の初期化
  def __init__(self, n):
    self.n = n
    # root[x]<0ならそのノードが根かつその値が木の要素数
    # rootノードでその木の要素数を記録する
    self.root = [-1]*(n+1)
    # 木をくっつける時にアンバランスにならないように調整する
    self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
  def Find_Root(self, x):
    if(self.root[x] < 0):
      return x
    else:
    # ここで代入しておくことで、後の繰り返しを避ける
      self.root[x] = self.Find_Root(self.root[x])
      return self.root[x]

    # 木の併合、入力は併合したい各ノード
  def Unite(self, x, y):
    # 入力ノードのrootノードを見つける
    x = self.Find_Root(x)
    y = self.Find_Root(y)
    # すでに同じ木に属していた場合
    if (x == y):
      return 
      # 違う木に属していた場合rnkを見てくっつける方を決める
      #rnkが大きい方に結合
    elif (self.rnk[x] > self.rnk[y]):
      self.root[x] += self.root[y]
      self.root[y] = x

    else:
      self.root[y] += self.root[x]
      self.root[x] = y
      # rnkが同じ（深さに差がない場合）は1増やす
      if(self.rnk[x] == self.rnk[y]):
        self.rnk[y] += 1

  # xとyが同じグループに属するか判断
  def isSameGroup(self, x, y):
    return self.Find_Root(x) == self.Find_Root(y)

  # ノードxが属する木のサイズを返す
  def Count(self, x):
    return -self.root[self.Find_Root(x)]
for i in range(M):
  a,b=map(int, input().split())
  B.append((a-1,b-1))
  
B=B[::-1]
uni=UnionFind(N)
now=N*(N-1)//2
ans=[]
for t in B:
  ans.append(now)
  a,b=t
  if uni.isSameGroup(a,b):
    uni.Unite(a,b)
  else:
    A=uni.Count(a)
    B=uni.Count(b)
    now-=(A*B)
    uni.Unite(a,b)
    
for a in ans[::-1]:
  print(a)
  



Measured memory_bytes: 23660
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 5;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    COMinit();
    // nCrの計算
    long long X, Y;
    cin >> X >> Y;
    long long  count = 0;
    if (abs(Y - X) % 2 == 0) {
        while (true) {
            if (X * 2 == Y) break;
            if (X == 0) {
                cout << 0 << endl;
                return 0;
            }
            ++count;
            ++Y; --X;
        }
    } else {
        while (true) {
            if (X * 2 == Y) break;
            if (X == 0) {
                cout << 0 << endl;
                return 0;
            }
            ++count;
            ++Y; --X;
        }
    }
    cout << COM(X, count) << endl;
    return 0;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define fr(i,b,e) for(int i=(b); i!=(e); ++i)
#define rp(i,e) for(int i=0; i!=(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long ll;
const int INF=1000000;
const int MOD=998244353;


int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    
    if(s[3]==s[2] && s[4]==s[5]){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }

}   

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

long long N, X;
long long p_num[51];
long long sum[51];

long long get_sum(long long n)
{
    if(sum[n] == -1) {
        if(n == 0) {
            sum[0] = 1;
        } else {
            sum[n] = 3 + 2 * get_sum(n - 1);
        }
    }
    return sum[n];
}


long long get_p(long long n)
{
    if(p_num[n] == -1) {
        if(n == 0) {
            p_num[0] = 1;
        } else {
            p_num[n] = 1 + 2 * get_p(n - 1);
        }
    }
    return p_num[n];
}

long long f(long long n, long long x)
{
    //cout << "f: (n, x) = (" << n << ", " << x << ")" << endl;
    if(n == 0) {
        return 1;
    }
    if(x == 1) {
        //cout << "A" << endl;
        return 0;
    } else if(x < get_sum(n) / 2 + 1) {
        //cout << "B" << endl;
        return f(n - 1, x - 1);
    } else if(x == get_sum(n) / 2 + 1) {
        //cout << "C" << endl;
        return get_p(n - 1) + 1;
    } else if(x < get_sum(n)) {
        //cout << "D" << endl;
        return get_p(n - 1) + f(n - 1, x - get_sum(n - 1) - 2) + 1;
    } else { // x == get_sum(n)
        //cout << "E" << endl;
        return get_p(n - 1) * 2 + 1;
    }
}

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

    for(int i = 0; i <= 50; i++) {
        p_num[i] = -1;
        sum[i] = -1;
    }

    //cout << get_sum(50) << endl;
    cout << f(N, X) << endl;

    return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var varX = int.Parse(Console.ReadLine());

        Console.WriteLine(Math.Min(8, (2000 - varX + 199) / 200));
    }
}


Measured memory_bytes: 27500
#include <stdio.h>
int main(void){
int n,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
    scanf("%d",&a[i]);
}
printf("%d",a[n-1]);
for(i=n-2;i>=0;i--){
    printf(" %d",a[i]);
}
printf("\n");
return 0;
}

Measured memory_bytes: 2692
a, b, c = map(int, input().split())
k = int(input())

ans = False
for x in range(k + 1):
    for y in range(k - x + 1):
        for z in range(k - x - y + 1):
            if a * (2 ** x) < b * (2 ** y) < c * (2 ** z):
                ans = True
                break

print('Yes') if ans else print('No')


Measured memory_bytes: 9176
N = int(input())
A = list(map(int, input().split()))


def div2(n: int):
    cnt = 0
    while True:
        if n % 2 == 0:
            n = n//2
            cnt += 1
        else:
            break
    return cnt


B = list(map(div2, A))
print(sum(B))

Measured memory_bytes: 41964
#include <iostream>
#include <vector>

using namespace std;

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

    int A;
    vector<int> count(N, 0);
    for (int i = 0; i < Q; i++) {
        cin >> A;
        count[A-1]++;
    }

    for (int i = 0; i < N; i++) {
        cout << (K-(Q-count[i]) > 0 ? "Yes" : "No") << endl;
    }
}

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

int main() {
 int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
 int ans=0;
 if(a<0){ ans += -a*c + d; a=0; }
 ans += (b-a)*e;
 cout<<ans<<endl;
 return 0;
}



Measured memory_bytes: 3044
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> a(n);
  int s=0;
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    s+=a.at(i);
  }
  int c=0;
  for(int i=0;i<n;i++)
    if(a.at(i)*4*m>=s)
      c++;
  cout<<(m<=c?"Yes":"No")<<endl;
}

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

using namespace std;

long double a[1000];

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int n;
	cin >> n;
	long double ans = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		ans += 1 / a[i];
	}
	cout << 1 / ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

struct TDice
{
    int Top;
    int Front;
    int Right;
    int Back;
    int Left;
    int Bottom;
};
TDice MakeDice(std::istream& in)
{
    TDice Dice;
    in >> Dice.Top
       >> Dice.Front
       >> Dice.Right
       >> Dice.Left
       >> Dice.Back
       >> Dice.Bottom;
    return Dice;
}
void RollN(TDice& Dice)
{
    int temp    = Dice.Top;
    Dice.Top    = Dice.Front;
    Dice.Front  = Dice.Bottom;
    Dice.Bottom = Dice.Back;
    Dice.Back   = temp;
}
void RollE(TDice& Dice)
{
    int temp    = Dice.Top;
    Dice.Top    = Dice.Left;
    Dice.Left   = Dice.Bottom;
    Dice.Bottom = Dice.Right;
    Dice.Right  = temp;
}
void RollW(TDice& Dice)
{
    int temp    = Dice.Top;
    Dice.Top    = Dice.Right;
    Dice.Right  = Dice.Bottom;
    Dice.Bottom = Dice.Left;
    Dice.Left   = temp;
}
void RollS(TDice& Dice)
{
    int temp    = Dice.Top;
    Dice.Top    = Dice.Back;
    Dice.Back   = Dice.Bottom;
    Dice.Bottom = Dice.Front;
    Dice.Front  = temp;
}

void Roll(char c, TDice& Dice)
{
    switch(c){
    case 'N': RollN(Dice); break;
    case 'E': RollE(Dice); break;
    case 'W': RollW(Dice); break;
    case 'S': RollS(Dice); break;
    }
}
int main()
{
    TDice Dice = MakeDice(std::cin);
    std::string s;
    std::cin >> s;
    for(int i = 0; i < s.size(); ++i){
        Roll(s[i], Dice);
    }
    std::cout << Dice.Top << std::endl;
    return 0;
}

Measured memory_bytes: 1204
// Problem : A - Repeat ACL
// Contest : AtCoder - ACL Beginner Contest
// URL : https://atcoder.jp/contests/abl/tasks/abl_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// Macros

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(x) (int) x.size()
#define mod 1000000007
#define EPS 1e-9
#define inf 1e10
#define PI acos(-1.0)
#define int long long
#define N 100005

// Solution

void solve() {
  int k;
  cin >> k;
  string s;
  while (k--) s += "ACL";
  cout << s;
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

  int tests;
  tests = 1;
  // cin>>tests;

  for (int test = 1; test <= tests; test++) {
    // cout<<"Case #"<<test<<": ";
    solve();
  }

  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if(a==b){
		cout << c << endl;
		return 0;
	}
	if(a==c){
		cout << b << endl;
		return 0;
	}
	if(b==c){
		cout << a << endl;
	}
	return 0;
}

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

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

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

ll powMod(ll n, ll k, ll m) {
	if (k == 0) {
		return 1;
	} else if (k % 2 == 1) {
		return powMod(n, k - 1, m) * n % m;
	} else {
		ll t = powMod(n, k / 2, m);
		return t * t % m;
	}
}

template<typename TypeInt>
std::string Itoa(const TypeInt v, int base) {
	static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}

	while (n >= base) {
		ret += table[n % base];
		n /= base;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	reverse(ret.begin(), ret.end());

	return ret;
}

int main() {
	ll n, k;
	cin >> n >> k;
	
	string ans=Itoa(n, k);

	cout << ans.size() << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<queue>
#include<utility>
#include<algorithm>

using namespace std;

typedef pair<int,int> P;

const int inf=1e9;

int N,E,T;
bool ok[330];
int dis[330];

int g[1010];
vector<int> s[1010];
int unknown[1010];

vector<int> app[330];

priority_queue<P,vector<P>,greater<P> > que;

int main(){
	scanf("%d%d%d",&N,&E,&T);
	for(int i=1;i<=N;i++){
		int in;
		scanf("%d",&in);
		ok[i]=in==1;
	}
	for(int i=1;i<=N;i++){
		if(ok[i]) dis[i]=1;
		else dis[i]=inf;
	}
	for(int i=0;i<E;i++){
		scanf("%d",g+i);
		int cnt;
		scanf("%d",&cnt);
		for(int j=0;j<cnt;j++){
			int in;
			scanf("%d",&in);
			s[i].push_back(in);
			app[in].push_back(i);
			unknown[i]++;
		}
	}
	for(int i=1;i<=N;i++) if(dis[i]==1) que.push(P(1,i));
	while(!que.empty()){
		P p=que.top();
		que.pop();
		int d=p.first;
		int v=p.second;
		if(v==T) break;
		if(dis[v]<d) continue;
		for(int i=0;i<app[v].size();i++){
			int e=app[v][i];
			unknown[e]--;
			if(unknown[e]==0){
				vector<int> tmp;
				for(int j=0;j<s[e].size();j++){
					tmp.push_back(dis[s[e][j]]);
				}
				sort(tmp.begin(),tmp.end());
				reverse(tmp.begin(),tmp.end());
				int res=-1;
				for(int i=0;i<tmp.size();i++) res=max(res,tmp[i]+i);
				//dis[g[e]] res
				if(dis[g[e]]<=res) continue;
				else{
					dis[g[e]]=res;
					que.push(P(res,g[e]));
				}
			}
		}
	}
	printf("%d\n",dis[T]==inf?-1:dis[T]);
	return 0;
}

Measured memory_bytes: 1192
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, K = getNM()
memo = [-1] * (K + 1)

# 2の倍数だけで作った組み合わせ - ４の倍数だけで作った組み合わせ - ６の...
def rec(x):
    if memo[x] >= 0:
        return memo[x]
    multi = 0
    # x * 2, x * 3...について
    for i in range(x * 2, K + 1, x):
        multi += rec(i)
    memo[x] = pow(K // x, N, mod) - multi
    res = memo[x]
    return res

ans = 0
rec(1)
for i in range(1, K + 1):
    ans += i * memo[i]
print(ans % mod)

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

int main() {
  int N,M;
  cin>>N>>M;  
  vector<vector<char>> maze(N, vector<char>(M));
  for(int i=0; i<N;i++){
    for(int j=0; j<M;j++){
      cin>>maze[i][j];
    }
  }
  
  int pf=0;
  int ps=0;
    maze[0][0]='.';
    int dx[2]={1,0},dy[2]={0,1};
    while(true){
     if(pf==N-1&&ps==M-1){
       break;
     }
      bool ch=true;
      for(int i=0; i<2;i++){
        int nx=pf+dx[i],ny=ps+dy[i];
        
        if (0<=nx&&nx<N&&0<=ny&&ny<M&&maze[nx][ny]=='#'){
          
          maze[nx][ny]='.';
          pf=nx;
          ps=ny;
          ch=false;
        }
        
      }
      if(ch){
        break;
      }
    
    }
  bool ex=true;
 rep(i,N){
   rep(j,M){
     if(maze[i][j]=='#'){
       ex=false;
     }
   }
 }
  if(ex){
   cout<<"Possible"<<endl;
  }
  else{
    cout<<"Impossible"<<endl;
  }
 
}

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

#define SQ(x) ((x)*(x))

int N,M;
double x[20], y[20], z[20];

double dfs(int l, int n, int used) {
  if( (N-l) < (M-n) ) return 0;

  double res = 0;
  if( n == M) {
    double t = 0;
    for(int i=0; i<N; i++){
      for(int j=i+1; j<N; j++) {
        if(!((used>>i)&1)) continue;
        if(!((used>>j)&1)) continue;

        t += SQ(x[i]-x[j])+SQ(y[i]-y[j])+SQ(z[i]-z[j]);
      }
    }

    res = max(res, t);
  }
  else {
    for(int i=l; i<N; i++) {
      res = max(res, dfs(i+1, n+1, used|(1<<i)));
    }
  }

  return res;
}

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

  for(int i=0; i<N; i++)
    cin >> x[i] >> y[i] >> z[i];

  cout.setf(ios::fixed);
  cout.precision(10);
  cout << dfs(0,0,0) << endl;
}

Measured memory_bytes: 932
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9;

int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll>a(N);
  ll num;
  ll ans=0;
  
  for(ll i=0;i<N;i++){
    cin>>a[i];
    if(a[i]==1){
      num=i;
      
  }
  }
if(N==K){
  ans=1;
}

 else if((N-K)%(K-1)==0){
   ans+=((N-K)/(K-1));
   ans++;
 }
  else{
    ans+=((N-K)/(K-1));
    ans++;
    ans++;
  }

  cout<<ans<<endl;
}

  



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

int main(){
  long long a,b,n;
  cin >> n >> a >> b;
  long long syou = n/(a+b);
  ll amari = n%(a+b);
  if(n >= a+b){
    if(amari <= a){
      cout << syou*a + amari << endl;
    }
    else cout << syou*a + a << endl;
  }
  else{
  if(n <= a){
    cout << n << endl;
  }
    else cout << a << endl;
  }
}


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

int main(){
  int N,K; cin >> N >> K;
  ll ans = K * pow(K-1,N-1);
  //左端を塗ったら次に塗るのは前に塗った色以外の(K-1)色のうちどれか
  //これを(N-1)個分行う?
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::prelude::*;
use std::io;
use std::cmp::*;

#[derive(PartialEq, Eq, Debug)]
enum Road {
    P(u64),
    Q(u64),
}

impl PartialOrd for Road {
    fn partial_cmp(&self, other: &Road) -> Option<Ordering> {
        let cs = match *self {
            P(c) | Q(c) => c,
        };
        let co = match *other {
            P(c) | Q(c) => c,
        };
        cs.partial_cmp(&co)
    }
}

impl Ord for Road {
    fn cmp(&self, other: &Road) -> Ordering {
        self.partial_cmp(other).unwrap()
    }
}

use Road::*;

fn read_to_string() -> String {
    let mut buf = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buf);
    buf
}

fn solve(p: Vec<u64>, q: Vec<u64>) -> u64 {
    let w = p.len();
    let h = q.len();
    let mut pq: Vec<_> = p.iter()
        .map(|c| P(*c))
        .chain(q.iter()
            .map(|c| Q(*c)))
        .collect();
    pq.sort();
    let mut a = w as u64 + 1;
    let mut b = h as u64 + 1;
    pq.iter()
        .map({
            |e| match *e {
                P(c) => {
                    a -= 1;
                    b * c
                }
                Q(c) => {
                    b -= 1;
                    a * c
                }
            }
        })
        .fold(0, std::ops::Add::add)
}

fn main() {
    let input = read_to_string();
    let mut words = input.split_whitespace();
    let w: usize = words.next().unwrap().parse().unwrap();
    let h: usize = words.next().unwrap().parse().unwrap();
    let p: Vec<u64> = words.by_ref().take(w).map(|i| i.parse().unwrap()).collect();
    let q: Vec<u64> = words.by_ref().take(h).map(|i| i.parse().unwrap()).collect();
    println!("{}", solve(p, q));
}


Measured memory_bytes: 14972
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn=100;
int n, a, ans1, ans2, flag[maxn];

int main()
{
    while(~scanf("%d", &n)){
        memset(flag, 0, sizeof(flag));
        while(n--){
            scanf("%d", &a);
            if(a>3199)flag[9]++;
            else if(a>2799)flag[8]++;
            else if(a>2399)flag[7]++;
            else if(a>1999)flag[6]++;
            else if(a>1599)flag[5]++;
            else if(a>1199)flag[4]++;
            else if(a>799)flag[3]++;
            else if(a>399)flag[2]++;
            else flag[1]++;
        }
        ans1=ans2=0;
        for(int i=1;i<9;i++){
            if(flag[i])ans1++;
        }
        ans2=ans1+flag[9];
        if(ans1==0)ans1=1;
        printf("%d %d\n", ans1, ans2);
    }
    return 0;
}


Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1

x3 = x2 - dy
y3 = y2 + dx
x4 = x1 - dy
y4 = y1 + dx

print(x3, y3, x4, y4)

Measured memory_bytes: 8860
S = input()
T = input()

ns = len(list(S))
nt = len(list(T))

node = [0] * (ns-nt+1)

for i in range(ns-nt+1):
    for j in range(nt):
        if S[i+j] == T[j]:
            node[i] += 1


print(nt - max(node))


Measured memory_bytes: 9028
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n, a, b = Is()
print(min(n*a, b))

Measured memory_bytes: 38256