akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! debug {
  ($($e:expr), *) => {println!(concat!($(stringify!($e), " = {:?}\n"), *), $($e), *)}
}

fn main() {
  let (n, a, b) = get::tuple3::<usize,usize,usize>();

  let ans = std::cmp::min(n*a, b);
  println!("{}", ans)
}

#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;

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

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn list<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat: Vec<Vec<T>> = vec![];
    for _ in 0 .. h {
      mat.push(list());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().chars().collect()
  }
}


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

m = sorted(m)
ans = 0

for i in range(n):
    if x >= m[i]:
        ans += 1
        x -= m[i]
    else:
        break
if x >= min(m):
    ans += x // min(m)
print(ans)


Measured memory_bytes: 3060
# 1つだけaであとはa-1個
# a, b = map(int, input().split())
# if b <= a:
#     print(1)
# else:
#     cur = a
#     c = 1
#     while cur < b:
#         c += 1
#         cur += a - 1
#     if cur -
#     print(c)
# なぜかダメなので愚直
a, b = map(int, input().split())
c = 0
cur = 1
while True:
    if cur >= b:
        break
    cur += a - 1
    c += 1
print(c)


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

# S = [0] * (N + 1)
# for i in range(N):
#     S[i + 1] = S[i] + A[i]


ans = K
for i in range(1, N - 1):
    right = K - (A[i] - A[i - 1])
    left = K - (A[i + 1] - A[i])
    ans = min(ans, min(right, left))

# 0
right = A[N - 1] - A[0]
left = K - A[0] - (K - A[N - 1])
ans = min(ans, min(right, left))

# N - 1
left = A[N - 1] - A[0]
right = K - A[0] - (K - A[N - 1])
ans = min(ans, min(right, left))


print(ans)


Measured memory_bytes: 26444
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////


//////////////////////////////////////

int main() {
    
    int A, B;
    cin >> A >> B;
    if (A != 1 && B != 1) {
        cout << 1 << endl;
        return 0;
    } else if (A != 2 && B != 2) {
        cout << 2 << endl;
        return 0;
    } else {
        cout << 3 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#include <math.h>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <functional>
#include <stdio.h>
#include <queue>
#define ll long long
#define pl pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define vvvb vector<vector<vector<bool> > >
#define rep(i,a) for(ll i = 0;i<a;++i)
#define rep1(i,a) for(ll i = 1;i<a;++i)
#define rrep(i,a) for(ll i = a;i>=0;--i)
#define mod 1000000007
#define inf 10010010010
using namespace std;

//O(logB)
ll mpow(ll a, ll b, ll m){
	if (!b) return 1 % m;
	if (b == 1) return a % m;
	if (b % 2) return (a*mpow(a, b - 1, m)) % m;
	else return mpow((a*a) % m, b / 2, m) % m;
}

bool isKaibun(string s,ll l,ll r){
    for(ll i=l;i<=r;++i){
        if(s[i] != s[r-(i-l)]) return false;
    }
    return true;
}

int main(){
    string s;
    cin>>s;
    if(isKaibun(s,0,s.size()-1) && isKaibun(s,0,s.size()/2-1) && isKaibun(s,s.size()/2+1,s.size()-1)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (n % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    if (s.substr(0, n / 2) == s.substr(n / 2, n / 2)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
a  = input()
if a[-1] == '2' or a[-1] == '4' or a[-1] == '5' or a[-1] == '7' or a[-1] == '9':
    print('hon')
elif a[-1] == '0' or a[-1] == '1' or a[-1] == '6' or a[-1] == '8':
    print('pon')
elif a[-1] == '3':
    print('bon')

Measured memory_bytes: 9128
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 100000000000;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

int main(void){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if(A + B > C + D){
    cout << "Left" << endl;
  }else if(A + B == C + D){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

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

  ll n;
  cin >> n;

  vll l(n);
  rep(i, n) {
    cin >> l[i];
  }

  sort(all(l));

  ll sum = accumulate(l.begin(), prev(l.end()), 0ll);
  if (sum > l[n - 1]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int N, X = 0;
    int ans = 0;

    cin >> N >> X;
    int m[N];
    int totalN = 0;
    int minM = 1000;
    for(int i = 0; i < N; i++) {
        m[i] = 0;
        cin >> m[i];
        totalN += m[i];
        if(m[i] < minM){
            minM = m[i];
        }
    }
    int surplus = X - totalN;
    ans = surplus / minM + N;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    string s, p;
    cin >> s >> p;
    repi(i, s.length(), 0)
    {
        if (s.substr(0, p.length()) == p)
        {
            cout << "Yes" << endl;
            return 0;
        }
        char tmp = s.at(0);
        s.erase(s.begin());
        s.push_back(tmp);
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3236
H, W = map(int, input().split())
a = [input() for _ in range(H)]
for i in range(H):
    if a[i].count('#') > 0:
        s = ''
        for j in range(W):
            if [A[j] for A in a].count('#') > 0:
                s += a[i][j]
        print(s)


Measured memory_bytes: 73316
import sys
input = sys.stdin.readline
from collections import defaultdict
n = int(input())
UR = defaultdict(list)
UD = defaultdict(list)
UL = defaultdict(list)
DR = defaultdict(list)
DL = defaultdict(list)
RL = defaultdict(list)

for i in range(n):
    x,y,u = input().split()
    x,y = int(x), int(y)
    if u == "U":    
        UD[x].append((y,1))
        UR[x+y].append((x-y,0))
        UL[y-x].append((x+y,1))
    elif u == "D":    
        UD[x].append((y,0))
        DR[y-x].append((x+y,0))
        DL[x+y].append((x-y,1))
    elif u == "R":   
        RL[y].append((x,1))
        DR[y-x].append((x+y,1))
        UR[x+y].append((x-y,1))
        
    else:
        RL[y].append((x,0))
        UL[y-x].append((x+y,0))
        DL[x+y].append((x-y,0))

ans = float("INF")

for x in [UD, UL, UR, DR, DL, RL]:
    for v in x.values():
        V = sorted(v)

        for i in range(len(V)-1):
            if V[i][1] and not V[i+1][1]:
                ans = min(ans,V[i+1][0]-V[i][0])


if ans == float("INF"):
    print("SAFE")
else:
    print(ans*5)


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

using namespace std;

int main()
{
	int n, t[100], m, p[100][2];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> t[i];
	cin >> m;
	for (int i = 0; i < m; i++)
		cin >> p[i][0] >> p[i][1];
	int sum = 0;
	for (int i = 0; i < n; i++)
		sum += t[i];
	for (int i = 0; i < m; i++)
		cout << sum - t[p[i][0] - 1] + p[i][1] << endl;

	return 0;
}


Measured memory_bytes: 256
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    int n, m;
    cin >> n >> m;
    int l = n, r = 1, diff = 1;
    bool done = !(n%2 == 0);
    for (int i = 0; i < m; i++) {
        cout << l << " " << r << "\n";
        l--, r++;
        diff += 2;
        if (!done and (diff >= (l - r)))
            l--, done = true;
    }
}



Measured memory_bytes: 3612
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int result = 0;

        switch(str){
            case "RRR":
                result = 3;
                break;
            case "RRS":
                result = 2;
                break;
            case "SRR":
                result = 2;
                break;
            case "SSS":
                result = 0;
                break;
            default:
                result = 1;
                break;
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 35612
#include <iostream>
#include <cstdio>
#define EPS 1e-10
using namespace std;

int main(){
    double a,b,c,d,e,f,x,y;
    while(cin >> a >> b >> c >> d >> e >> f){
        if(cin.eof()) break;
        x = (c*e-b*f)/(a*e-b*d);
        y = (f*a-c*d)/(a*e-d*b);
        printf("%.3f %.3f\n",x+EPS,y+EPS);
    }
}

Measured memory_bytes: 1240
import sys
N = int(input())
A = list(map(int, input().split()))+[0] 
B = list(map(int, input().split()))
C = list(map(int, input().split()))+[0] 
sum=sum(B)

for i in range(N):
    if A[i+1]-A[i]==1:
        sum+=C[A[i]-1]
        
print(sum)

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	ans := 0
	for i := 1; i*i <= n; i++ {
		if n%i == 0 && i < n/i-1{
			ans += n/i-1
		}
	}

	fmt.Fprintln(wr, ans)
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = 0, max = 0;
		int n = sc.nextInt();
		String s = sc.next();
		for(int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if(c == 'I') {
				x++;
			}else if(c == 'D') {
				x--;
			}
			//System.out.println(x);//デバッグ
			if(x > max) {
				max = x;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21844
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

vector<pii> edges[100005];
bool seen[100005];
ll dist[100005];

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i++) {
        int a, b, d;
        scanf("%d%d%d", &a, &b, &d);
        edges[a].push_back(pii(b, d));
        edges[b].push_back(pii(a, -d));
    }
    for(int i = 0; i < n; i++) {
        if(seen[i]) continue;
        queue<int> q;
        q.push(i);
        while(!q.empty()) {
            int curr = q.front();
            q.pop();
            for(pii out: edges[curr]) {
                if(!seen[out.first]) {
                    dist[out.first] = dist[curr] + out.second;
                    seen[out.first] = true;
                    q.push(out.first);
                }
            }
        }
    }
    for(int i = 0; i < n; i++) {
        for(pii out: edges[i]) {
            if(dist[out.first] != dist[i] + out.second) {
                printf("No\n");
                return 0;
            }
        }
    }
    printf("Yes\n");
}


Measured memory_bytes: 9856
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    if(s[0]==t[2]){
    if(s[1]==t[1]){
    if(s[2]==t[0]){
    cout<<"YES"<<endl;
    return 0;
    }
    }
    }
      cout<<"NO"<<endl;
      return 0;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#define int long long
int n,q;
int mi[200001],sum[200001];
int summ[1000001],s,t,lazi[1000001];
using namespace std;

void bui(int k,int l,int r)
{
	if(l==r)
	{
		summ[k]=mi[l];
		return;
	}
	int mid=(l+r)>>1;
	bui(k<<1,l,mid),bui(k<<1|1,mid+1,r);
	summ[k]=(summ[k<<1]+summ[k<<1|1])%998244353; 
	return ;
}

void add(int k,int l,int r,int v)
{
	lazi[k]=v;
	summ[k]=(((sum[r]-sum[l-1]+998244353)%998244353)*v)%998244353;
	return;
}

void pushd(int k,int l,int r,int mid)
{
	if(lazi[k]==0)
		return;
	add(k<<1,l,mid,lazi[k]);
	add(k<<1|1,mid+1,r,lazi[k]);
	lazi[k]=0;
	return;
}

void updata(int k,int l,int r,int v)
{
	if(l>=s&&r<=t)
	{
		add(k,l,r,v);
		return;
	}
	int mid=(l+r)>>1;
	pushd(k,l,r,mid);
	if(s<=mid) updata(k<<1,l,mid,v);
	if(mid<t) updata(k<<1|1,mid+1,r,v);
	summ[k]=(summ[k<<1]+summ[k<<1|1])%998244353;
}

signed main()
{
	scanf("%lld%lld",&n,&q);
	mi[1]=1,sum[1]=1;
	for(int i=2;i<=n;i++)
	{
		mi[i]=(mi[i-1]*10)%998244353;
		sum[i]=(mi[i]+sum[i-1])%998244353;
	}
	bui(1,1,n);  
	int num;
	for(int i=1;i<=q;i++)
	{
		int ss,tt;
		scanf("%lld%lld%lld",&ss,&tt,&num);
		s=n-tt+1,t=n-ss+1;
		updata(1,1,n,num);
		printf("%lld\n",summ[1]);
	}

	return 0;
 } 

Measured memory_bytes: 15104
n,m,x = map(int,input().split())
a = list(map(int,input().split()))

c1 = [i for i in range(x)]
c2 = [i for i in range(x,n+1)]
y=0
z=0
for i in c1:
  if i in a:
    y += 1
for i in c2:
  if i in a:
    z += 1
print(min(y,z))

Measured memory_bytes: 61804
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(VECTOR) (VECTOR).begin(),(VECTOR).end()

int main(){

	int N, M, C;
	int B[25];
	int A[25][25];
	ll ans = 0;
	cin >> N >> M >> C;
	ll tmp;
	ll inc;
	for(int i = 0; i < M; i ++)cin >> B[i];
	for(int i = 0; i < N; i ++){
		tmp = C;
		for(int j = 0; j < M; j ++){
			cin >> inc;
			tmp += inc * B[j];
		}
		if(tmp > 0)ans ++;
	}
	cout << ans << endl;

	return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    string s1, s2, s3; cin >> s1 >> s2 >> s3;
    transform(all(s1), s1.begin(), ::toupper);
    transform(all(s2), s2.begin(), ::toupper);
    transform(all(s3), s3.begin(), ::toupper);
    cout << s1[0];
    cout << s2[0];
    cout << s3[0] << endl;
}


Measured memory_bytes: 256
num_animals, num_legs = list(map(int, input().split()))
# print(crane, turtle)

num_turtle = -num_animals + (num_legs / 2)
num_cranies = num_animals - num_turtle
# print(num_turtle, num_cranies)

answer = num_turtle >= 0 and num_turtle.is_integer() and num_cranies >= 0 and num_cranies.is_integer()
answer = 'Yes' if answer else 'No'

print(answer)

# a + b = X
# 2a + 4b = Y

# a = X - b
# 2(X - b) + 4b = Y
# 2X - 2b + 4b = Y
# 2X + b(-2 + 4) = Y
# 2X + 2b = Y
# 2b = -2X + Y
# b = -X + Y

Measured memory_bytes: 9180
//#define LOCAL

#include<cstdio>
#include<algorithm>
#include<vector>

using namespace std;

#define rep(a, b) for(int i = a; i <= b; i++)

const int MAX = 1e2 + 10;

struct Ufs
{
	int prt[MAX];

	void init(int n)
	{
		rep(1, n)
			prt[i] = i;
		return;
	}

	int findprt(int x)
	{
		while(x != prt[x])
			x = prt[x];
		return x;
	}

	bool unite(int x, int y)
	{
		int px = findprt(x);
		int py = findprt(y);
		prt[x] = prt[y] = prt[px] = prt[py] = min(px, py);
		return px != py;
	}
};

struct Kruskal
{
	struct Edge
	{
		int u, v, w;
		Edge(int uu, int vv, int ww):u(uu), v(vv), w(ww){}
		friend bool operator <(Edge a, Edge b)
		{
			return a.w < b.w;
		}
	};

	vector<Edge> e;
	Ufs u;

	void init(void)
	{
		e.clear();
		return;
	}

	void addedge(int u, int v, int w)
	{
		e.push_back(Edge(u, v, w));
		return;
	}

	int solve(int n)
	{
		u.init(n);
		int ans = 0, cnt = 0;
		int len = e.size();
		sort(e.begin(), e.end());
		rep(0, len - 1)
		{
			if(u.unite(e[i].u, e[i].v))
			{
				cnt++;
				ans += e[i].w;
			}
			if(cnt == n - 1)
				break;
		}
		return ans;
	}
} k;

int main()
{

#ifdef LOCAL
	freopen("in.txt", "r", stdin);
#endif

	int n;
	while(~scanf("%d", &n))
	{
		k.init();
		rep(1, n)
		{
			for(int j = 1; j <= n; j++)
			{
				int w;
				scanf("%d", &w);
				if(j > i && w != -1)
					k.addedge(i, j, w);
			}
		}
		printf("%d\n", k.solve(n));
	}
	return 0;
}



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

int main() {
  int n, x;
  int max = 0;

  cin >> n;

  vector<int> v(n);
  map<int, int> m;

  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (m[v[i]]) {
      m[v[i]]++;
    } else {
      m[v[i]] = 1;
    }
  }

  sort(v.begin(), v.end());

  for (int i = 0; i <= v.back(); i++) {
    x = m[i] + m[i+1] + m[i+2];
    if (max < x) {
      max = x;
    }
  }

  cout << max << endl;
}


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

int main() {
  //入力
  string str;
  string ans = "No";
  cin >> str;

  //計算
  if(str.at(0) == str.at(1) && str.at(1) != str.at(2) && str.at(2) == str.at(3)){
    ans = "Yes";
  }else if(str.at(0) == str.at(2) && str.at(2) != str.at(1) && str.at(1) == str.at(3)){
    ans = "Yes";
  }else if(str.at(0) == str.at(3) && str.at(3) != str.at(1) && str.at(1) == str.at(2)){
    ans = "Yes";
  }

  //出力
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);

		while(stdIn.hasNext()){
			boolean[] answerWeight = {false,false,false,false,false,false,false,false,false,false};
			int questionWeight = stdIn.nextInt();
			if(questionWeight >= 512){
				questionWeight -= 512;
				answerWeight[9] = true;
			}
			if(questionWeight >= 256){
				questionWeight -= 256;
				answerWeight[8] = true;
			}
			if(questionWeight >= 128){
				questionWeight -= 128;
				answerWeight[7] = true;
			}
			if(questionWeight >= 64){
				questionWeight -= 64;
				answerWeight[6] = true;
			}
			if(questionWeight >= 32){
				questionWeight -= 32;
				answerWeight[5] = true;
			}
			if(questionWeight >= 16){
				questionWeight -= 16;
				answerWeight[4] = true;
			}
			if(questionWeight >= 8){
				questionWeight -= 8;
				answerWeight[3] = true;
			}
			if(questionWeight >= 4){
				questionWeight -= 4;
				answerWeight[2] = true;
			}
			if(questionWeight >= 2){
				questionWeight -= 2;
				answerWeight[1] = true;
			}
			if(questionWeight >= 1){
				questionWeight -= 1;
				answerWeight[0] = true;
			}
			for(int i = 0;i < answerWeight.length; i++){
				if(answerWeight[i]){
					System.out.print((int)Math.pow(2, i));
					if(!(i == answerWeight.length - 1)){
						for(int j = i + 1;j < answerWeight.length; j++){
							if(answerWeight[j]){
								System.out.print(" ");
								break;
							}
						}
					}
				}
			}
			System.out.println();
		}
	}
}

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

int main(){
	int n,i;
	string T,H;
	int score_T = 0,score_H = 0;


	cin>>n;
	for(i = 0;i < n;i++){
		cin>>T;
		cin>>H;
		if(T > H)
			score_T += 3;
		else if(T < H)
			score_H += 3;
		else {
			score_T++;
			score_H++;
		}
	}
	cout<<score_T<<" "<<score_H<<endl;
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;

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

    sort(a, a + n);

    int ans = 999999999;
    for (int i = 0; i < n - k + 1; i++)
        ans = min(ans, a[i + k - 1] - a[i]);

    cout << ans << endl;

    return 0;
}

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

int main() {
  string s;
  bool isHard = false;
  cin >> s;
  for(int i=0; i<s.size()-1; i++) {
    if(s[i]==s[i+1]) isHard = true;
  }
  if(isHard) cout << "Bad" << endl;
  else cout << "Good" << endl;
}


Measured memory_bytes: 3640
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
char S[12];
char out[2<<20];
int outsz,Slen;
main()
{
	int N,K;
	scanf("%d%d ",&N,&K);
	gets(S);
	Slen=strlen(S);
	S[Slen++]='\n';
	for(int i=0;i<K;i++)
	{
		memcpy(out+i*Slen,S,Slen);
	}
	outsz=K*Slen;
	N-=K;
	for(int i=0;i<N;i++)
	{
		out[outsz+i*2]='7';
		out[outsz+i*2+1]='\n';
	}
	write(1,out,outsz+N*2);
}

Measured memory_bytes: 2304
import numpy as np

h, w = map(int, input().split())
grid = np.array([list(input()) for _ in range(h)])

dp = np.full((h+1, w+1), h+w, dtype=np.int)

for i in range(h):
    for k in range(w):
        if i == k == 0:
            dp[i+1, k+1] = 1 if grid[i, k] == '#' else 0
        else:
            if grid[i, k] == '#':
                a = dp[i, k+1] if grid[i-1, k] == '#' else dp[i, k+1] + 1
                b = dp[i+1, k] if grid[i, k-1] == '#' else dp[i+1, k] + 1
                dp[i+1, k+1] = min(a, b)
            else:
                dp[i+1, k+1] = min(dp[i, k+1], dp[i+1, k])

print(dp[h, w])


Measured memory_bytes: 12752
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{    
    int q;
    cin >> q;
    rep(i,q)
    {
        double a,b;
        cin >> a >> b;
        double m = a+b-2*sqrt(a*b);
        if(m<0)
            cout << int(a+b-2) << endl;
        else if(m>fabs(a-b)-1)
            cout << 2*int(min(a,b)-1) << endl;
        else
        {
            int n = floor(m)+1;
            cout << int(a+b-2-n) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = str(input())
score = 0
win = ["others" for i in range(len(t))]
for i in range(n):
	if t[i] == "r":
		if win[i - k] != "p":
			win[i] = "p"
		else:
			win[i] = "others"
	elif t[i] == "s":
		if win[i - k] != "r":
			win[i] = "r"
		else:
			win[i] = "others"
	elif t[i] == "p":
		if win[i - k] != "s":
			win[i] = "s"
		else:
			win[i] = "others"
#print(win)
for i in range(n):
	if win[i] == "r": score += r
	elif win[i] == "s": score += s
	elif win[i] == "p": score += p 
	else: continue
print(score)

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 1e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};


int main() {
    int n; cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    vector<int> a(4,0);
    rep(i,n) {
        if (s[i]=="AC") a[0]++;
        if (s[i]=="WA") a[1]++;
        if (s[i]=="TLE") a[2]++;
        if (s[i]=="RE") a[3]++;
    }
    cout << "AC x " << a[0] << endl;
    cout << "WA x " << a[1] << endl;
    cout << "TLE x " << a[2] << endl;
    cout << "RE x " << a[3] << endl;
}

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



int main()
{
    long long N, P;
    cin >> N >> P;


    vector<int> prime(sqrt(P)+1LL, 0);  // prime[i]: i が素数なら0, そうでないなら-1
    prime[0] = prime[1] = -1;
    for( long long i = 2; i*i <= P; ++i ){
        // 素数 i の倍数は素数ではない
        if( prime[i] == 0 ){
            for( int j = 2; i*j <= sqrt(P); ++j ) prime[i*j] = -1;
        }
    }

    // P を因数分解しその指数を prime[i] に入れる
    long long tmp = P;
    for( long long i = 2; i*i <= P; ++i ){
        if( prime[i] == 0 ){
            while( tmp%i == 0 ){
                tmp /= i;
                ++prime[i];
            }
        }
    } 

    int ans = 1;
    for( long long i = 2; i*i <= P; ++i ){
        ans *= pow(i, prime[i]/N);
    }
    if( N == 1 ) cout <<  P  << endl;
    else         cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4096
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
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; }
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;
// const ll k=998244353;

const ll MAX = 510000;
const ll MOD =998244353;



int main(){

  int r;cin>>r;

  out(r*r);

  return 0;
}


Measured memory_bytes: 764
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Debug = System.Diagnostics.Debug;
using static System.Math;
using System.Runtime.CompilerServices;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        string s = Console.ReadLine();
        string last = "";
        string current = "";
        int res = 0;
        int ind = 0;
        while (ind < s.Length)
        {
            current += s[ind++];
            if (last != current)
            {
                last = current;
                current = "";
                res++;
            }
        }
        if (current != "" && last != current) res++;
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 15712
#include <bits/stdc++.h>
//#include <ext/numeric>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)
#define ll long long

using namespace std;
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;
//template<typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0);

const int N = 1e6 + 5 , MOD = 1e9 + 7;
long long fact[N] , fact_inv[N];

long long mul(long long a , long long b) {
    return a * b % MOD;
}

long long power(long long a , long long b) {
    if (!b) return 1;
    long long r = power(a , b / 2);
    r = mul(r , r);
    if (b&1) return mul(r , a);
    return r;
}

long long mod_inv(long long x) {
    return power(x , MOD - 2);
}

long long nCr(long long n , long long r){
    if (!n) return !r;
    if(r>n) return  0;
    return mul(fact[n] , mul(fact_inv[n - r] , fact_inv[r]));
}

void pre() {
    fact[0] = fact_inv[0] = 1;
    for(int i = 1 ; i < N ;i++) {
        fact[i] = mul(fact[i - 1] , i);
        fact_inv[i] = mod_inv(fact[i]);
    }
}


int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("friday.out", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout
            << fixed;

    pre();
    int x, y;
    cin >> x >> y;
    long long ans = 0;
    for (int i = 0; i <= x; ++i) {
        int a = x - i;
        int b = y - 2 * i;
        if (a % 2 == 0 && a / 2 == b) {
            ans += nCr(i + b, b);
            ans %= MOD;
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 16000
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
struct unifnd{
  VI ht,pr;
  in fnd(in a){
    in ta=a;
    while(a!=pr[a])a=pr[a];
    in tt=ta;
    while(ta!=a){
      tt=pr[ta];
      pr[ta]=a;
      ta=tt;
    }
    return a;
  }
  void uni(in a, in b){
    a=fnd(a);
    b=fnd(b);
    if(a==b)return;
    if(ht[b]<ht[a])swap(a,b);
    pr[a]=b;
    ht[b]+=(ht[a]==ht[b]);
  }
  void ini(in n){
    ht.resize(n);
    pr.resize(n);
    forn(i,n){
      ht[i]=0;
      pr[i]=i;
    }
  }
};
unifnd tfd;
const in tn=1e5+9;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  tfd.ini(2*tn);
  in n,m;
  cin>>n>>m;
  in k,a;
  forn(z,n){
    cin>>k;
    forn(zz,k){
      cin>>a;
      tfd.uni(z,tn+a);
    }
  }
  for(in i=1;i<n;++i){
    if(tfd.fnd(i)!=tfd.fnd(0)){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}


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

int main() {
	long long n,k,i,j,ans=0,cur=0;
	cin >> n;
	vector<long long> p(n);
    for(i=0; i<n; i++){
    	cin >> p[i];
    }
    for(i=1; i<=n; i++){
    	if(p[i-1]!=i) cur++;
    }
    if(cur<=2){
    	cout << "YES";
    }else{
    	cout << "NO";
    }
}

Measured memory_bytes: 256
public class Main {


  private static void solve() {
    int n = ni();
    int k = ni();
    
    double ret = 0;
    for (int i = 1; i <= n; i ++) {
      int now = i;
      double p = 1.0 / n;
      while (now < k) {
        p *= 0.5;
        now *= 2;
      }
      ret += p;
    }
    System.out.printf("%.12f\n", ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 21332
#include "bits/stdc++.h"

using namespace std;
using int64 = long long int;

struct Work
{
	int day, salary;

	bool operator<(const Work &work) const
	{
		return salary < work.salary;
	}
};

constexpr int MaxN = 100000 + 10;
Work W[MaxN];

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

	for (int i = 0; i < n; i++)
	{
		cin >> W[i].day >> W[i].salary;
	}

	sort(W, W + n, [](auto a, auto b) { return a.day < b.day; });
	priority_queue<Work> queue;

	int index = 0;
	int ans = 0;
	for (int day = 1; day <= m; day++)
	{
		while (index < n && W[index].day <= day)
		{
			queue.push(W[index++]);
		}

		if (!queue.empty())
		{
			ans += queue.top().salary;
			queue.pop();
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 2168
#include<stdio.h>
int main()
{
	int i,arr[5];
	for(i=1;i<=5;i++)
	{
		scanf("%d ",&arr[i]);
	}
	for(i=1;i<=5;i++)
	{
		if(arr[i]==0)
		{
			printf("%d\n",i);
		}
	}
	
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int n;
    cin>>n;
    int f[4] = {};
    while(n--){
        string s;
        cin>>s;
        if(s == "AC")
            f[0]++;
        else if(s == "WA")
            f[1]++;
        else if(s == "TLE")
            f[2]++;
        else if(s == "RE")
            f[3]++;
    }
    cout<<"AC x "<<f[0]<<"\n";
    cout<<"WA x "<<f[1]<<"\n";
    cout<<"TLE x "<<f[2]<<"\n";
    cout<<"RE x "<<f[3]<<"\n";
    return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  int N,Q; cin >>N >>Q;
  queue<pair<string,int>> que;
  rep(i, N){
    string s; int time; cin >>s >>time;
    que.push({s, time});
  }
  int T = 0;
  while (!que.empty()){
    string s = que.front().first;
    int time = que.front().second;
    que.pop();
    if (time <= Q){
      T += time;
      cout <<s <<" " <<T <<endl;
    }else{
      T += Q;
      time -= Q;
      que.push({s, time});
    }
  }
}


Measured memory_bytes: 6312
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#define ll long long
#define space putchar(' ')
#define endl putchar('\n')
#define debug puts("------------------------")
#define F(i,x,n) for(int i=x;i<=n;++i)
#define F_(i,x,n) for(int i=x;i>=n;--i)
using namespace std;
inline void read(int &a) {a=0;int c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();a*=b; }
inline int  Rem() {int a=0,c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();return a*=b; }
inline void write(int x) {if(x>9)write(x/10);putchar('0'+x%10);}
inline void W(int x) {if(x<0){putchar('-'),x=-x;}write(x);}
/**/
double a,b,x;
/**/
int main()
{
    // freopen("test.in","r",stdin);
    // freopen("test.out","w",stdout);
    cin>>a>>b>>x;
    double V=(a*a*b)/2;
    if(x>V)
    {
        double v=a*a*b-x;
        double c=(2*v)/(a*a);
        double ans=atan(a/c);
        printf("%.10f\n",90-(ans/(acos(-1))*180));
        return 0;
    }
    double c=x*2/a/b;
    double ans=atan(b/c);
    // cout<<b<<' '<<c<<'\n';
    printf("%.10f\n",ans/(acos(-1))*180);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

bool fc(vector<string> &s, int n){
  rep(i, n){
    rep2(j, i+1, n){
      if(s.at(i).at(j) != s.at(j).at(i)) return false;
    }
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s.at(i);
  vector<string> sn = s;
  int ans = 0;
  rep(q, n){
    if(fc(sn, n) == true) ans++;
    rep(i, n){
      int ni = (i + q + 1) % n;
      rep(j, n){
        sn.at(i).at(j) = s.at(ni).at(j);
        // cerr << sn.at(i).at(j) << " ";
      }
      // cerr << endl;
    }
  }
  cout << ans*n << endl;
  return 0;
}

Measured memory_bytes: 3864
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	long long a,b,c,d,i,j,mx;
	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	mx=a*c;
	if(mx<a*d)	mx=a*d;
	if(mx<b*c)	mx=b*c;
	if(mx<b*d)	mx=b*d;
	printf("%lld\n",mx);
	return 0;
}

Measured memory_bytes: 1700
ans = 0
def count_ans(level, index, len_dic, p_dic):
    global ans
    if level == 0:
        ans += 1
    else:
        if index == 0:
            pass
        elif index == len_dic[level] // 2:
            ans += 1
            ans += p_dic[level - 1]
        elif index == len_dic[level] - 1:
            ans += p_dic[level]
        elif index > len_dic[level] // 2:
            ans += p_dic[level - 1] + 1
            index_next = index - len_dic[level - 1] - 2
            count_ans(level - 1, index_next, len_dic, p_dic)
        else:
            index_next = index - 1
            count_ans(level - 1, index_next, len_dic, p_dic)


def get_len_dic(level):
    len_dic = [1]
    for i in range(level):
        len_dic.append(len_dic[-1] * 2 + 3)
    return len_dic

def get_p_dic(level):
    p_dic = [1]
    for i in range(level):
        p_dic.append(p_dic[-1] * 2 + 1)
    return p_dic

def main():
    global ans
    level, eat_num = map(int, input().split())
    len_dic = get_len_dic(level)
    p_dic = get_p_dic(level)
    count_ans(level, eat_num - 1, len_dic, p_dic)
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;


int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;
    }
    return sum;
}
int main(){
   int N, K;
   cin >> N >> K;
   int m = 1;
   for(int i = 0; i < N; i++){
           
            m = min(m*2,m+K);
  
   }
cout << m << endl;
}


Measured memory_bytes: 256