akhauriyash/Code-Regression huggingface dataset:
from fractions import gcd

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

a, b, c, d = map(int, input().split())
g = lcm(c, d)

alpha_c = a % c
count_c = (b - a + alpha_c) // c
if alpha_c == 0:
    count_c += 1
alpha_d = a % d
count_d = (b - a + alpha_d) // d
if alpha_d == 0:
    count_d += 1
alpha_g = a % g
count_g = (b - a + alpha_g) // g
if alpha_g == 0:
    count_g += 1

s = b - a + 1 - count_c - count_d + count_g

print(s)


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

int main() {
  int N;
  cin >> N;
  int cnt = 0, mi = 1e9+1;
  long long sum = 0;
  for (int i = 0, a; i < N && cin >> a; i++) {
    if (a < 0) cnt++;
    mi = min(mi, abs(a));
    sum += abs(a);
  }
  cout << ((cnt % 2) ? sum - mi * 2 : sum) << "\n";
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        mut s: String,
    }

    while s.len() > 0 {
        let mut ok: bool = false;
        for t in vec!["dream", "dreamer", "erase", "eraser"] {
            if s.ends_with(t) {
                for _ in 0..t.len() {
                    s.pop();
                }
                ok = true;
                break;
            }
        }

        if !ok {
            println!("NO");
            return;
        }
    }
    println!("YES");
}


Measured memory_bytes: 2344
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int x=in.nextInt(),y=in.nextInt();
		System.out.println(gcd(x,y));
	}
	
	static int gcd(int a,int b) {
		int v=a%b;
		if(v==0)return b;
		else return gcd(b,v);
	}

}



Measured memory_bytes: 26172
def main():
    a, b, c, d = input()
    for i in range(2**3):
        ls = ["+", "+", "+"]
        for j in range(len(ls)):
            if (i >> j) & 1:
                ls[j] = "-"
        sentence = a + ls[0] + b + ls[1] + c + ls[2] + d
        if eval(sentence) == 7:
            print(sentence + "=7")
            break


if __name__ == "__main__":
    main()



Measured memory_bytes: 38516
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s[3]={"Sunny","Cloudy","Rainy"};
    map<string,int> q;
    q[s[0]]=0;q[s[1]]=1;q[s[2]]=2;
    string b;
    cin>>b;
    cout<<s[(q[b]+1)%3];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    string w;
    int K[26]={};
    cin >> w;
    REP(i,w.size()){
        K[w[i]-'a']++;
    }
    REP(i,26){
        if(K[i]%2==1){
            cout << "No" << endl; 
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#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>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    Int N;
    vector<vector<Int>> tree;

    int dfs(int v, int p = -1) {
        if (tree.size() == 1 && p != -1) return 1;
        int cnt = 0;
        for (auto e : tree[v]) {
            if (e != p) {
                int tmp = dfs(e, v);
                if (tmp == -1) return -1;
                if (tmp == 1) cnt++;
            }
        }
        if (cnt > 1) return -1;
        return !cnt;
    }

    void solve() {
        cin >> N;
        tree.resize(N);
        for (int i = 0; i + 1 < N; ++i) {
            Int a, b;
            cin >> a >> b;
            a--, b--;
            tree[a].push_back(b);
            tree[b].push_back(a);
        }

        int neri = dfs(0);
        if (neri == 0) {
            cout << "Second" << endl;
        } else {
            cout << "First" << endl;
        }

//        vector<Int> dig1;
//        for (int i = 0; i < N; ++i) {
//            if (tree[i].size() == 1) dig1.push_back(i);
//        }
//
//        vector<Int> puni(N);
//        for (auto e : dig1) {
//            for (auto f : tree[e]) {
//                puni[f]++;
//            }
//        }
//        for (auto e : puni) {
//            if (e >= 2) {
//                cout << "First" << endl;
//                return;
//            }
//        }
//        cout << "Second" << endl;


    }


};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
int n;
int a[200010];
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d",a+i);
    }
    sort(a,a+n);
    bool yes=1;
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1])yes=0;
    }
    if(yes)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;



public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		List<List<String>> list = new ArrayList <>();
		for(int i = 0; i < n; i++) {
			list.add(new ArrayList<>());
			list.get(i).add(sc.next());
			list.get(i).add(sc.next());
		}
		int sum = 0;
		while(list.size() > 0) {
			int time = Integer.parseInt(list.get(0).get(1));
			if(time <= q) {
				sum += time;
				System.out.println(list.get(0).get(0) + " " + sum);
				list.remove(0);
			} else {
				sum += q;
				list.add(list.get(0));
				list.get(list.size() - 1).set(1, Integer.toString(time - q));
				list.remove(0);
			}
		}
		sc.close();
	}

}



Measured memory_bytes: 76032
#include <iostream>
#include <utility>
#include <cstdio>
#include <cmath>

using namespace std;

typedef struct{
    float x,y;
} P;

bool judge(P p1,P p2,P p3,P px){
    float s,a,b,c;
    s=0.5*abs((p1.x-p3.x)*(p2.y-p3.y)-(p2.x-p3.x)*(p1.y-p3.y));
    a=0.5*abs((p1.x-px.x)*(p2.y-px.y)-(p2.x-px.x)*(p1.y-px.y));
    b=0.5*abs((p2.x-px.x)*(p3.y-px.y)-(p3.x-px.x)*(p2.y-px.y));
    c=0.5*abs((p3.x-px.x)*(p1.y-px.y)-(p1.x-px.x)*(p3.y-px.y));
    if(s==a+b+c||(s+0.001<=a+b+c&&s-0.001>=a+b+c)){
        return true;
    }
    return false;
}

int main(void){
    P p[4];
    int i;
    bool flag;
    
    while(true){
        flag=true;
        for(i=0;i<4;i++){
            if(scanf("%f,%f,",&p[i].x,&p[i].y)==EOF)return 0;
        }
        if(judge(p[0],p[1],p[2],p[3])==false){
            if(judge(p[1],p[2],p[3],p[0])==false){
                if(judge(p[2],p[3],p[0],p[1])==false){
                    if(judge(p[3],p[0],p[1],p[2])==false){
                        cout<<"YES"<<endl;
                        flag=false;
                    }
                }
            }
        }
        if(flag){
            cout<<"NO"<<endl;
        }
    }
}

Measured memory_bytes: 1224
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Map<Integer,Integer> map = new TreeMap<Integer,Integer>();
		for(int i=0;i<3;i++) {
			map.put(scanner.nextInt(), 0);
		}
		System.out.println(map.size());
		scanner.close();
	}

}


Measured memory_bytes: 21844
/* いもす法 */
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;
vector<int> edge[100001]; 
bool visited[100001];

int dfs(int x, int y) {
    if(visited[x]) return 0;
    visited[x] = true;
    REP(i, edge[x].size()) {
        if(edge[x][i] == y) continue;
        dfs(edge[x][i], x);
    }

    return 0;
}

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

    REP(i, m) {
        int x, y, z;
        cin >> x >> y >> z;
        x--, y--;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }

    int ans = 0;

    REP(i, n) {
        if(visited[i]) continue;
        ans++;
        dfs(i, -1);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define OUT(x) cout << (x) << endl;
#define ALL(v) v.begin(), v.end()
#define REP(i, n) for (int i=0; i<n; ++i)

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    string ans;

    for(;;){
        if(A+1==B) {
            ans = "Borys";
            break;
        }
        A++;
        if(A+1==B) {
            ans = "Alice";
            break;
        }
        B--;
    }
    OUT(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    char X,Y;
    cin >> X >> Y;
    if(X - '0' > Y - '0') cout << ">" << endl;
    else if ((X - '0' < Y - '0')) cout << "<" << endl;
    else cout << "="<< endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(void){
	int a,b,c,MI;
	scanf("%d %d %d",&a,&b,&c);
	
	if(a>c){
		MI=c;
		c=a;
		a=MI;
	}
	if(b>a){
		if(b>c){
			MI=b;
			b=c;
			c=MI;
		}
	}else if(a>b){
		MI=a;
		a=b;
		b=MI;
	}
	
	printf("%d %d %d\n",a,b,c);
	return 0;
}


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

#define pb push_back
#define fi first
#define se second
#define eb emplace_back

const int N = 1000007, inf = 0x3f3f3f3f;
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;


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

	ll x; cin >> x;
	ll tot = 100;
	int cnt = 0;
	while(tot < x) {
		tot = double(tot) * 1.01;
		cnt++;
	}

	cout << cnt << endl;
}

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

using namespace std;

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

const ll INF=1e9+7;
ll n,a,b,mp[100001],l,r;
bool check(ll m){
	ll h=0;
	rep(i,n){
//		cout<<h<<' ';
		if(mp[i]-m*b<=0){
//			cout<<mp[i]<<' '<<m<<' '<<b<<' '<<m*b<<' '<<mp[i]-m*b<<endl;;
			continue;
		}
		if((mp[i]-m*b)%a==0){
			h+=(mp[i]-m*b)/a;
		}
		else{
			h+=(mp[i]-m*b)/a+1;
		}
	}
//	cout<<h<<endl;
	if(h<=m){
		return 0;
	}
	else{
		return 1;
	}
}
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n>>a>>b;
	a-=b;
	rep(i,n){
		cin>>mp[i];
	}
	l=1;
	r=INF;
	while(l<r){
		ll mid=(l+r)/2;
//		cout<<mid<<endl;
		if(check(mid)){
			l=mid+1;
//			cout<<mid<<' '<<1<<endl;
		}
		else{
			r=mid;
//			cout<<mid<<' '<<0<<endl;
		}
	}
	cout<<(l+r)/2;
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
    vector<int> c(n-1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    (--a[i]);
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n-1; i++) {
    cin >> c[i];
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] + 1 == a[i + 1] && i + 1 < n) ans += c[a[i]];
    ans += b[a[i]];
  }
  cout << ans << '\n';
}


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

int main() {
  int K;
  cin >> K;
  
  vector<int> data = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  cout << data[K-1] << endl;
  
  return 0;
}


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

typedef long long LL;
const int maxn = 1000020;
const LL INF = 100000000000000LL;
const LL mod = 998244353;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define For(i,a,b) for(int i=a;i<=b;++i)

int n;
LL a[maxn];
LL pre[maxn];

int cal(int l, int r) {
    int mid1, mid2;
    LL val1, val2;
    int L = l, R = r;
    while(l < r) {
        mid1 = (l + r) / 2;
        mid2 = (mid1 + r + 1) / 2;
        val1 = abs(pre[mid1] - pre[L - 1] - pre[R] + pre[mid1]);
        val2 = abs(pre[mid2] - pre[L - 1] - pre[R] + pre[mid2]);
        if(val1 <= val2) r = mid2 - 1;
        else l = mid1 + 1;
    }
    if(l == R) l = R - 1;
    if(r == R) r = R - 1;
    //cout << "cal1 " << L << " " << R << " " << l << " " << r << endl;
    if(abs(pre[R] - pre[l] - pre[l] + pre[L - 1]) < abs(pre[R] - pre[r] - pre[r] + pre[L - 1])) return l;
    else return r;
}

int cal1(int l, int r) {
    LL minn = abs(pre[r] - pre[l] - pre[l] + pre[l - 1]);
    int pos = l;
    for(int i = l;i < r;i++) {
        LL t = abs(pre[r] - pre[i] - pre[i] + pre[l - 1]);
        if(t < minn) pos = i, minn = t;
    }
    return pos;
}

void solve() {
    pre[0] = 0;
    for(int i = 1;i <= n;i++) {
        scanf("%lld", &a[i]);
        pre[i] = pre[i - 1] + a[i];
    }
    LL det;
    int pos;
    LL q, w, e, r;
    LL ans = (1ll)<<60;
    for(int i = 2;i < n - 1;i++) {
        pos = cal(1, i);
        q = pre[pos];
        w = pre[i] - pre[pos];
        if(q < w) swap(q, w);
        pos = cal(i + 1, n);
        e = pre[pos] - pre[i];
        r = pre[n] - pre[pos];
        if(e < r) swap(e, r);
        ans = min(ans, max(q, e) - min(w, r));
        //cout << cal1(1, i) << " " <<cal1(i + 1, n) << endl;
        //cout << cal(1, i) << " " <<cal(i + 1, n) << endl;
    }
    cout << ans << endl;
}

int main() {
	int t = 1;
    while(~scanf("%d", &n)) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
static const int INFTY = (1 << 30);
int A, B;
void func()
{
    bool v[4] = {};
    cin >> A >> B;
    v[A] = true;
    v[B] = true;
    rep(i, 1, 4)
    {
        if (v[i] == false)
        {
            cout << i << endl;
            return;
        }
    }
}
int main()
{
    func();
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        if (x == 7 || x == 5 || x == 3) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}


Measured memory_bytes: 21972
while True:
    h, w = list(map(int, input().split()))
    if h == 0 and w == 0:
        break

    for row in range(h):
        if row % 2 == 0:
            print("#." * (w // 2), end="")
            print("" if w % 2 == 0 else "#")
        else:
            print(".#" * (w // 2), end="")
            print("" if w % 2 == 0 else ".")

    print()


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define M 1000000007
typedef long long ll;
long double  fact(ll n){
    long double c=1;
    if(n==0)
    return c;
   for(int i=1;i<=n;i++){
       c*=i;
    }
return c;
}
int main() { 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t,a[1000],n,i,c=1,b[10000],j;
    long double s=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(i=0;i<n;i++){
        for(j=i;j<n;j++){
            s+=2*(sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j])));
        }
    }
    cout<<fixed<<s/n;
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i

def get_c(n)
	("a".ord+n).chr
end
def get_count(s)
	s.each_char.max.ord - "a".ord + 1
end

def f(l, c)
	if l==1
		c.times.map{|n|get_c(n)}
	elsif l==2
		f(1,c).map{|sb|"a"+sb}
	else
		f(l-1,c-1).flat_map{|sa|f(1,get_count(sa)+1).map{|sb|sa+sb}}
	end
end

puts f(n, n)


Measured memory_bytes: 17660
use std::io;
use std::collections::HashMap;

static MODULO : u64 = 1000000007;
fn main (){
    let n : u64 = get_line().trim().parse().unwrap();
    //  後から気付いたけどここまでするならもっとシンプルに出来た
    let ps = Primes::new(100);
    let fss = (2..n+1).map(|n| ps.factorize(n)).collect();
    let Factors{fs:factors} = concat_factors(&fss);
    let ans = factors.values().fold(1, |acc, x| (acc*((x+1)as u64)) % MODULO);
    println!("{}",ans);
}

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

#[derive(Debug)]
struct Primes {ps : Vec<u64>}
#[derive(Debug)]
struct Factors {fs : HashMap<u64, u32>}

// TODO make this generic............
// (Monoid v) => Monoid HashMap k v
// Monoid Factors

fn concat_factors(facts : &Vec<Factors>) -> Factors {
    // want something like foldM
    let mut cat = HashMap::new();
    // FIXME : don't know what I'm doing
    for &Factors{ref fs} in facts {
        for(&p, &t) in fs.iter() {
            // https://doc.rust-lang.org/std/collections/hash_map/enum.Entry.html
            * cat.entry(p).or_insert(0) += t;
        }
    }
    Factors{fs:cat}
}

impl Primes {
    fn new(n:usize) -> Primes {
        let mut ps : Vec<bool> = vec![true;n+1];
        ps[0] = false;
        ps[1] = false;
        let upper_limit = (n as f64).sqrt().ceil() as usize;
        for i in 2..upper_limit {
            if ps[i] {
                for j in 2..(n/i)+1 {
                    ps[i*j] = false;
                }
            }
        }
        let mut primes : Vec<u64> = vec![];
        for (i, &is_prime) in ps.iter().enumerate() {
            if is_prime { primes.push(i as u64);}
        }
        Primes{ps:primes}
    }
}

impl Primes {
    fn factorize(&self, n:u64) -> Factors {
        let mut num = n;
        let mut factors = HashMap::new();
        
        for &p in &self.ps {
            if p*p > num {
                break;
            }
            
            let mut times = 0; // how many times can this prime divide it
            while num % p == 0 {
                num = num / p;
                times = times+1;
            }
            if times != 0 { factors.insert(p,times); };
        }
        if num != 1{
            factors.insert(num,1); // the last prime
        }
        Factors{fs:factors}
    }
}

Measured memory_bytes: 4352
/*
 *
 * Author: r3gz3n
 * 
 * 3b 13 12 9 56 4e
 * 6 56 a a 5f f
 * 6 56 47 18 56 d
 * 13 46 14 1f 13 27
 * 52 52 a 5a 47 1
 * 1d 13 b 1b 49 17
 *
 */


#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;


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


#define endl '\n'


template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }


typedef vector<int> vii;


class Solution {
public:
    void solve(std::istream& in, std::ostream& out) {
        int k, n, ans, x;
        in >> k >> n;
        vii a(n);
        ans = k;
        in >> a;
        x = k - a[n-1] + a[0];
        rep(i, 0, n, 1) {
            if (i == 0) {
                ans = min(ans, k - x);
            }
            else {
                ans = min(ans, k - (a[i] - a[i-1]));
            }
        }
        out << ans << endl;
    }
};

void solve(std::istream& in, std::ostream& out)
{
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}


#include <fstream>
#include <iostream>


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


    istream& in = cin;


    ostream& out = cout;

    solve(in, out);
    return 0;
}




Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;


bool dp[2][9010][36010];

int main() {
  string s;cin >> s;
  int x,y;cin >> x >> y;
  vint d[2];
  int N = s.length();
  bool isy=false;
  bool is0=true;
  repeat(i,N){
    if(s[i] == 'T'){
      isy = !isy;
      is0 = false;
      d[isy].push_back(0);
    }else{
      if(is0){
        x--;
      }else{
        d[isy].back()++;
      }
    }
  }
  //debugArray(d[0],xsize);
  //debugArray(d[1],ysize);
  dp[0][0][18000]=true;
  dp[1][0][18000]=true;
  repeat(k,2){
    repeat(i,d[k].size()){
      repeat(z,36000){
        int nz = z+d[k][i];
        if(0<=nz&&nz<=36000){
          dp[k][i+1][nz] |= dp[k][i][z];
        }
        nz = z-d[k][i];
        if(0<=nz&&nz<=36000){
          dp[k][i+1][nz] |= dp[k][i][z];
        }
      }
    }
  }
  cout << (dp[0][d[0].size()][x+18000]&&dp[1][d[1].size()][y+18000]? "Yes":"No")<<endl;
  return 0;
}


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

int main() {
	int N, M;
	cin >> N >> M;
	vector<long long> A(N);
	vector<pair<long long, int> > change;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int b;
	long long c;
	for (int i = 0; i < M; i++) {
		cin >> b >> c;
		change.push_back(make_pair(c, b));
	}

	sort(A.begin(), A.end());
	sort(change.rbegin(), change.rend());

	vector<long long> cha;
	int n = 0; //交換できる最大枚数
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < change[i].second; j++) {
			n++;
			cha.push_back(change[i].first);
		}
		if (N < n) {
			break;
		}
	}

	for (int i = 0; i < N; i++) {
		if (A[i] < cha[i]) {
			A[i] = cha[i];
		}
		else {
			break;
		}
	}

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


	return 0;
}

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

int main(){
	int as, af , bs, bf;
	cin >> as >> af >> bs >> bf ;
	int bigger_s, lesser_f;
	if(af > bf){
		lesser_f = bf;
	} else {
		lesser_f = af;
	}
	if(as > bs){
		bigger_s = as;
	} else {
		bigger_s = bs;
	}
	int time;
	time = lesser_f - bigger_s;
	if(time<0) time = 0;
	cout << time << endl;
	return 0;
}

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

struct Node{
    int to, cost;
};

vector<Node> graph[100005];
bool checked[100005]={0};
int d[100005]={0};

bool dfs(int v){
    bool res = true;
    for(auto e : graph[v]){
        if(!checked[e.to]){
            d[e.to] = d[v] + e.cost;
            checked[e.to] = true;
            res &= dfs(e.to);
        }else if(d[e.to] != d[v] + e.cost){
            res = false;
        }
    }
    return res;
}

int main(){
    int n, m;
    cin >> n >> m;
    for(int i=0;i<m;++i){
        int l, r, d;
        cin >> l >> r >> d;
        graph[l].push_back((Node){r, d});
        graph[r].push_back((Node){l, -d});
    }

    bool ok = true;
    for(int i=1;i<=n;++i){
        if(!checked[i]){
            checked[i] = true;
            ok &= dfs(i);
        }
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 12032
def main():
    s = input()
    up = int(s[0:2])
    lo = int(s[-2:])
    if can_month(up):
        if can_month(lo):
            print('AMBIGUOUS')
        else:
            print('MMYY')

    else:
        if can_month(lo):
            print('YYMM')
        else:
            print('NA')


def can_month(v):
    if v > 0 and v <= 12:
        return True
    else:
        return False

if __name__ == '__main__':
    main()



Measured memory_bytes: 2940
#! /usr/bin/env python3

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

res = 0

if d == 0:
    res = 1
elif n >= 2 * d:
    res = 1 + (n - 2 * d) / n
else:
    res = (n - d) * 2 / n

print(res / n * (m - 1))


Measured memory_bytes: 2940
#include<stdlib.h>
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<cstring>
#include<time.h>
#include<queue>
using namespace std;
#define INF 10000000
struct set{
	int a;
	int b;
	int c;
	int x;
};
int a,b,c,d,n,ch[301];
set s[1000];
int main(){
	while(1){
		
		cin>>a>>b>>c;
		d=a+b+c;
		if(d==0)break;
		for(int i=1;i<=d;i++)ch[i]=2;
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>s[i].a>>s[i].b>>s[i].c>>s[i].x;
			if(s[i].x==1){
				ch[s[i].a]=1;ch[s[i].b]=1;ch[s[i].c]=1;
			}
		}
		int flg=1;
		while(flg==1){
			flg=0;
			for(int i=1;i<=d;i++){
				if(ch[i]!=2)continue;
				for(int j=0;j<n;j++){
					if(s[j].x==1)continue;
					if(s[j].a==i){
						if(ch[s[j].b]==1&&ch[s[j].c]==1){
							ch[i]=0;flg=1;
						}
					}else if(s[j].b==i){
						if(ch[s[j].c]==1&&ch[s[j].a]==1){
							ch[i]=0;flg=1;
						}
					}else if(s[j].c==i){
						if(ch[s[j].a]==1&&ch[s[j].b]==1){
							ch[i]=0;flg=1;
						}
					}
				}
			}
		}
		for(int i=1;i<=d;i++){
			cout<<ch[i]<<endl;
		}
		
	}
	return 0;
}	

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

int main()
{
  string S;
  string ans;
  cin >> S;
  int A=S[0]-'0';
  int B=S[1]-'0';
  int C=S[2]-'0';
  int D=S[3]-'0';
  
  if(A+B+C+D==7) {
    ans="+++";
  }
  if(A+B+C-D==7) {
    ans="++-";
  }if(A+B-C+D==7) {
    ans="+-+";
  }if(A+B-C-D==7) {
    ans="+--";
  }
  if(A-B+C+D==7) {
    ans="-++";
  }
  if(A-B+C-D==7) {
    ans="-+-";
  }if(A-B-C+D==7) {
    ans="--+";
  }if(A-B-C-D==7) {
    ans="---";
  }
  
  
  cout<<A<<ans[0]<<B<<ans[1]<<C<<ans[2]<<D<<"=7";
  
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  using ll = long long;
  int n;
  cin >> n;

  vector<ll> va(n);
  unordered_map<ll, vector<int>> l_dict, r_dict;
  for (int i = 0; i < n; ++i) {
    cin >> va[i];
    int l = i - va[i], r = va[i] + i;
    l_dict[l].push_back(i);
    r_dict[r].push_back(i);
  }

  ll ans = 0;
  for (auto [l, indices] : l_dict) {
    ans += indices.size() * r_dict[l].size();
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 48228
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define in(s) ll s; cin >> s
#define prarr(a, i ,n) fab(j, i , n) cout << a[j] << " "
#define wh(t) ll t; cin >> t; while(t--)
#define sz(u) u.size()
#define deb(x) cout << #x << " " << x << endl
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define arr(a,n) vl a(n, 0); fab(i, 0, n) cin >> a[i]
#define fab(i,a,b) for(ll i = a; i < b; i++)
#define fba(i,b,a) for(ll i = b; i >= a; i--)
#define fa(i, x) for(auto i: x)
#define mem(s, j) memset(s, j, sizeof(s))
#define sup ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define ll long long int
#define vl vector<ll>
#define vpl vector<pl>
#define pl pair<ll, ll>
#define pll pair<ll, pl>
#define vvl vector<vl>
#define vvpl vector<vpl>
#define mxe(x) *max_element(x)
#define mne(x) *min_element(x)
#define mp make_pair
#define pb push_back
#define fs first
#define sd second
#define fr front()
#define bk back()
#define rr return
const ll N = (ll)3e5;
const ll inf = (ll)1e18 + 7;
const ll mod = (ll)1e9 + 7;
const ll MX = (ll)1e9 + 7;
const ll MAX = (ll)1e12 + 7;

bool sortbysec(const pair<ll, ll> &a,const pair<ll, ll> &b){ return (a.second < b.second);}

//-------------policy based-----------------------------
typedef tree<int, null_type, less<int>, rb_tree_tag, 
        tree_order_statistics_node_update> pb_set;
//------------------------------------------------------


vector<char> dir = {'L', 'R', 'U', 'D'};
vl dx = {-1, 1, 0, 0};
vl dy = {0, 0, -1, 1};

void add(ll &x, ll y){
    x = ((x % mod) + (y % mod)) % mod;
}

void mul(ll &x, ll y){
    x = ((x % mod) * (y % mod)) % mod;
}

ll sm(vl a) {
    ll sum = 0;
    for(auto i: a)
        sum += i;
    return sum;
}

ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    else if (y % 2 == 0) 
        return power(x, y / 2) * power(x, y / 2); 
    else
        return x * power(x, y / 2) * power(x, y / 2); 
}
 
bool isPrime(ll p)
{
    for(ll i = 2;i * i <= p; i++)
        if(p % i == 0)
            rr false;
    rr true;
}


int main()
{
	sup;
    
    ll k, n, ans = inf;
    cin >> k >> n;
    arr(a, n);
    sort(all(a));
    fab(i, 0, n) {
        if(i < n - 1) {
            ans = min(ans, k - (a[i + 1] - a[i]));
        }
        else {
            ans = min(ans,k - (k - a[i] + a[0]));
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

string rot(string& s) {
  string ret;
  ret = s.substr(1) + string({s[0]});
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  rep(i, s.size()) {
    if (s == t) {
      cout << "Yes" << endl;
      return 0;
    }
    t = rot(t);
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
    int A,B,K;
    scanf("%d%d%d",&A,&B,&K);
    for(int i = 0;i < K;i++){
        if(i % 2 == 0){
            if(A % 2 == 1){
                A --;
            }
            A /= 2;
            B += A;
        }else{
            if(B % 2 == 1){
                B --;
            }
            B /= 2;
            A += B;
        }
    }
    printf("%d %d\n",A,B);
    return 0;
}

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

#define FAST ios_base::sync_with_stdio(false); \
			 cin.tie(nullptr);                 \
	         cout.tie(nullptr)

vector<long long> data;

long long a, b, k, n, m, tmp, ans = 0;





int main()
    {
    FAST;


    cin >> n >> m;





    cout << n + m/2 << endl;

    return 0;
    }


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

struct X{
	int a,b,c,d;
	X(int a0,int b0,int c0,int d0):a(a0),b(b0),c(c0),d(d0){};
	X() : a(),b(),c(),d() {}
	
};

void dfs(vector<int> &v,int sz, int r, vector<X> &x,int &msum){
	
	if(sz>0){
		for(int i=0; i<=r; i++){
			v.at(v.size()-sz) = i;
			dfs(v,sz-1, r-i,x,msum);
		}
	}
	else {
		
		vector a(v.size()+1,0);
		a.at(0) = 1;
		for(int i=0; i<v.size(); i++){
			a.at(i+1) = a.at(i) + v.at(i);
		}
		int sum{};
		for(auto y:x){
			if(a.at(y.b-1)-a.at(y.a-1)==y.c) sum += y.d;
		}
		msum = max(msum,sum);
	}
	
	
}

int main(){
	
	int n,m,q; cin >>n>>m>>q;
	vector<X> x(q);
	for(int i=0; i<q; i++){
		cin >>x.at(i).a>>x.at(i).b>>x.at(i).c>>x.at(i).d;
	}
	vector<int> v(n-1,0);
	int msum{};
	dfs(v,n-1,m-1,x,msum);
	cout << msum << endl;
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n,w;
	cin>>n>>w;
	vector<P> item(n);
	rep(i,n)cin>>item[i].first>>item[i].second;

	vector<vector<ll>> dp(n+1, vector<ll>(w+1,0));
	repi(i,1,n+1){
		repr(j,w,0){
			if(j-item[i-1].first<0) dp[i][j] = dp[i-1][j];
			else dp[i][j] = max(dp[i-1][j], dp[i-1][j-item[i-1].first]+item[i-1].second);
		}
	}

	cout<<dp[n][w]<<endl;
	return 0;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define int long long
#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++)
using namespace std;
signed main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int cnt = 0;
    rep(i,n){
        int mn = i;
        rep2(j,i,n){
            if(a[j] < a[mn]) mn = j;
        }
        if (i != mn){
            swap(a[i], a[mn]);
            cnt++;
        }
    }
    rep(i,n){
        if(i == n-1) cout << a[i] << endl;
        else cout << a[i] << " ";
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    int ans = 0;
    int x = 1;
    while(x < B){
      x --;
      x += A;
      ans ++;
    }
    System.out.println(ans);
  }
}

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

typedef long long int ll;

const int MAX_N =100001;
const ll MOD = 998244353;
int N;

int main(){
  cin >> N;
  vector<ll>vec;
  for(int i = 0 ; i < N; i++){
    int d; cin >> d;
    vec.push_back(d);
  }

  if(vec[0] != 0){
    cout << 0 << endl;
    return 0;
  }

  for(int i = 1 ; i < N ; i++){
    if(vec[i] == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  
  sort(vec.begin(), vec.end());

  ll res = 1;
  ll pre = 0;
  ll count = 1;
  ll pre_count = 1;
  
  for(int i = 1 ; i < vec.size() ; i++){
    if(pre != vec[i]){
      if(pre + 1 != vec[i]){
        cout << 0 << endl;
        return 0;
      }
      ll num = 1;
      for(int  j = 0 ; j < count ; j++){
        num = (num * pre_count) % MOD;
      }
      res = (res * num) % MOD;
      pre = vec[i];
      pre_count = count;
      count = 0;
    }
    count++;
  }
  ll num = 1;
  for(int  j = 0 ; j < count ; j++){
    num = (num * pre_count) % MOD;
  }
  res = (res * num) % MOD;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4256
#include <stdio.h>


int main(void) {

	// 1_5-B Print a Frame

	int h,w;
	int i,j;
	
	scanf("%d %d",&h,&w);

	while(h!=0 && w!=0){
		for(j=0; j<w; j++){
			printf("#");	//?????????
		}
		printf("\n");
		for(i=1; i<h-1; i++){
			printf("#");		//??????
			for(j=1; j<w-1; j++){
				printf(".");
			}
			if(1<w){
				printf("#");	//??????
			}
			printf("\n");
		}
		if(1<h){
			for(j=0; j<w; j++){
				printf("#");	//?????????
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d",&h,&w);
	}
        return 0;
}

Measured memory_bytes: 572
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var A, B int
	fmt.Scan(&A, &B)

	ans := 0
	for i := A; i <= B; i++ {
		s1 := strconv.Itoa(i)
		s2 := reverse(s1)
		if s1 == s2 {
			ans++
		}
	}
	fmt.Println(ans)
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


Measured memory_bytes: 1920
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = 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")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n = read::<i64>();

  let mut x = 1;

  while x * x <= n {
    x += 1;
  }

  println!("{}", (x - 1) * (x - 1));
}



Measured memory_bytes: 4352
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//a??¨b?????§?????????

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//a??¨b????°??????????

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//a??¨b???????????¶??????

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//p????´???°,a???b??????p??§?????£?????????

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//p????´???°,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//?????§??¬?´???°

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//????°???¬?????°

void call(int n) {
	int i = 1;
CHECK_NUM:
	int x = i;
	if (x % 3 == 0) {
		cout << " " << i;
		goto END_CHECK_NUM;
	}
INCLUDE3:
	if (x % 10 == 3) {
		cout << " " << i;
		goto END_CHECK_NUM;
	}
	x /= 10;
	if (x) goto INCLUDE3;
END_CHECK_NUM:
	if (++i <= n) goto CHECK_NUM;

	cout << endl;
}
int main() {
	
	int n;

	cin >> n;
	call(n);

	return 0;
}

Measured memory_bytes: 3156
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long ll;
#define pb push_back

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //your code starts here
    string s,t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0;i<s.size();i++) 
    {
        if(s[i]!=t[i])++cnt;
    }
    cout<<cnt<<"\n";
    return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, A, B, C);
  print(A == B ? C : B == C ? A : B);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
ll N;
ll A[100100];
ll B[100100];
int main(){
	cin >> N;
	ll sum = 0ll;
	for(int i=0;i<N;i++){
		cin >> A[i];
		sum += A[i];
	}
	if(sum%(N*(N+1ll)/2ll)!=0ll){
		cout << "NO" << endl;
		return 0;
	}
	ll K = sum/(N*(N+1ll)/2ll);
	ll M = -LLINF;
	for(int i=0;i<N-1;i++){
		B[i] = A[i+1]-A[i];
		chmax(M,B[i]);
	}
	/*if(M<0ll){
		cout << "NO" << endl;
		return 0;
	}*/
	for(int i=0;i<N-1;i++){
		if((M-B[i])%N!=0ll){
			cout << "NO" << endl;
			return 0;
		}
	}
	if(M>=0ll){
		if(K-M<0ll || (K-M)%N!=0ll){
			cout << "NO" << endl;
			return 0;
		}
	}/*else{
		if(K-(N-1ll)*M<0ll || (K-(N-1ll)*M)%N!=0ll){
			cout << "NO" << endl;
			return 0;
		}
	}*/
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 1792
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let a: u64 = read_as_vec()[0];

    println!("{}", a + a * a + a * a * a);
}


Measured memory_bytes: 2136
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 300002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()

int32_t main()
{ 
  IOS

  char c;
  cin>>c;
  if(c>='A' and c<='Z'){
    cout<<"A";
  }
  else{
    cout<<'a';
  }
    
  
  
  
}

Measured memory_bytes: 3632
N = int(input())
nums = list(map(int,input().split(" ")))
ans = 0
cot = 0
before = nums[0]
for num in nums[1:]:
    if num <= before:
        cot += 1
    else:
        ans = max(ans, cot)
        cot = 0
    before = num
ans = max(ans,cot)


print(ans)

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

using namespace std;

int main()
{
    int no_of_moves, no_of_stones;
    cin >> no_of_moves >> no_of_stones;

    vector <int> move(no_of_moves + 1);
    for(int i = 1; i <= no_of_moves; i++)
        cin >> move[i];

    vector <int> winner(no_of_stones + 1, 2);
    for(int i = 1; i <= no_of_stones; i++)
    {
        for(int j = 1; j <= no_of_moves; j++)
        {
            if(move[j] > i) continue;

            if(winner[i - move[j]] == 2)
                winner[i] = 1;
        }
    }

    cout << (winner[no_of_stones] == 1 ? "First\n" : "Second\n");
    return 0;
}

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

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

  int ans = 0;
  int n = max(X, Y);
  for (int i = 0; i <= (n * 2); i = i + 2) {
    int ab = i;
    int a = max((X - (ab / 2)), 0);
    int b = max((Y - (ab / 2)), 0);
    int amount = A * a + B * b + C * ab;

    if (ans == 0) {
      ans = amount;
    } else {
      ans = min(ans, amount);
    }
  }

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

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int A,B; cin >> A >> B;
    cout << (A-1)*(B-1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int K;
	int A;
	int B;

	scanf("%d %d %d",&K, &A, &B);
        for(int i=1;i<1001;i++)
	{
		int Ki=i*K;
		if(( Ki <= B) && (Ki>=A))
		{
			printf("OK\n");
			return 0;
		}
	}
	printf("NG\n");
	return 0;
}


Measured memory_bytes: 1620