akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<cmath>


using namespace std;



int main() {
	int n;
	string s;
	int count = 0;
	cin >> n;
	cin >> s;

	if (n % 2 != 0) {
		cout << "No";
	}
	else
	{
		for (int i = 0; i < n / 2; i++) {
			if (s[i] != s[i + n / 2]) {
				count += 1;
			}
		}

		if (count > 0) {
			cout << "No";
		}
		else
		{
			cout << "Yes";
		}
	}
}

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


int main() {
	int N, C, K;
	cin >> N >> C >> K;
	int Bus = 0;
	int Waiting = 0;
	vector<int> Schedule(N, 0);
	for (int i = 0; i < N; i++) cin >> Schedule[i];
	int AngryTime = Schedule[0] + K;
	sort(Schedule.begin(), Schedule.end());
	for (int i = 0; i < N; i++) {
		int T = Schedule[i];
		Waiting++;
		if (AngryTime < T) {
			Bus++;
			Waiting = 1;
		}
		if (AngryTime == T) {
			Bus++;
			if (Waiting <= C) {
				Waiting = 0;
				AngryTime = Schedule[i + 1] + K;
			}
			else Waiting = 1;
		}
		if (Waiting == C) {
			Bus++;
			Waiting = 0;
			AngryTime = Schedule[i + 1] + K;
		}
		if (Waiting == 1) {
			AngryTime = T + K;
		}
	}
	if (Waiting > 0) Bus++;
	cout << Bus;
}

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

int main(){
	int t;
	cin >> t;
	for(int i=0 ; i < t ; i++ ){
		int X, Y, W, H, n, ans=0;
		cin >> X >> Y >> W >> H >> n;
		for(int j=0 ; j < n ; j++ ){
			int x,y;
			cin >> x >> y;
			if( X <= x && x <= X+W && Y <= y && y <= Y+H ){
				ans++;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#D
H=int(input())
memo=[0]*(10**7)
memo[1],memo[2]=1,3
def atk(N):
    if N>10**6:
        return 2*atk(N//2)+1
    else:
        if memo[N]==0:
            memo[N]=2*atk(N//2)+1
        return memo[N]
    
print(atk(H))

Measured memory_bytes: 81140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = int.Parse(ReadLine());
        var a = new bool[n];
        for(int i = 0; i < n; i++)
        {
            var s = ReadLine().Split();
            if(s[0] == s[1])
            {
                a[i] = true;
            }
        }
        for(int i = 2; i < n; i++)
        {
            if(a[i -2] && a[i - 1] && a[i])
            {
                WriteLine("Yes");
                return;
            }
        }
        WriteLine("No");
    }
}


Measured memory_bytes: 17888
fn main() {
    let (a, b, c) = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut ws = line.split_whitespace();
        let a: i32 = ws.next().unwrap().parse().unwrap();
        let b: i32 = ws.next().unwrap().parse().unwrap();
        let c: i32 = ws.next().unwrap().parse().unwrap();
        (a, b, c)
    };
    println!("{}", std::cmp::min(b / a, c));
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+5;
vector<ll> V;
int pre[maxn];
int main() {
    int n,k;cin>>n>>k;
    for(int i=1;i<=k;i++){
        int cnt;cin>>cnt;
        for(int j=1;j<=cnt;j++) {
            int tem;cin>>tem;pre[tem]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(pre[i]==0) ans++;
    }cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3648
<?php
  $res = 1000000007;
  $s = str_split(trim(fgets(STDIN)));
  $n = count($s);
  for($i=0;$i<13;$i++){
    $dp[$i] = 0;
    $ndp[$i] = 0;
  }
  $dp[0] = 1;
  $keta = 1;
  for($i=$n-1;$i>=0;$i--){
    if($s[$i]=="?"){
      for($j=0;$j<=9;$j++){
        for($l=0;$l<13;$l++){
          $ndp[(($j*$keta+$l)%13)] += $dp[$l]%$res;
          //if($i!=$n-1)echo($j."?-".(($j*$keta+$l)%13)."=".$dp[$l]."/");
        }
      }
      //echo("ndpの結果:");
      for($j=0;$j<13;$j++){
        //echo($ndp[$j].".");
        $dp[$j] = $ndp[$j]%$res;
        $ndp[$j] = 0;
      }
    }else{
      for($j=0;$j<13;$j++){
        //echo(($s[$i]*($keta%13)+$j)%13);
        //echo("/");
        $ndp[(($s[$i]*$keta+$j)%13)] += $dp[$j]%$res;
      }
      for($j=0;$j<13;$j++){
        $dp[$j] = $ndp[$j]%$res;
        $ndp[$j] = 0;
      }
    }

    $keta = ($keta*10)%13;
    //echo("for文のi=".$i."終了後\n");
    //for($j=0;$j<13;$j++){
    //  echo("/dp[".$j."]=".$dp[$j]."/");
    //}
    //echo("\n");
  }
  echo($dp[5]%$res);


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

using namespace std;

int main()
{
    int n;
    double m;
    cin>>n>>m;
    double a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    double sum=0;
     for(int i=0; i<n; i++)
    {
        sum=sum+a[i];
    }
    int p=0;
    sort(a,a+n);

    for(int i=n-1; i>n-m-1; i--)
    {
        //cout<<a[i]<<" "<<sum<<" "<<sum/(4*m)<<endl;
        if(a[i]<(sum/(4*m)))
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
        cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b);  i++)
#define REP(i, n)    for(int i=0;   i<(n);  i++)
#define REP1(i, n)   for(int i=1;   i<=(n); i++)
#define pb push_back
#define mp make_pair
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define EPS 1e-7
#define ALL(obj) (obj).begin(), (obj).end()
using ul    = unsigned long;
using ll    = long long;
using ld    = long double;
using vint  = vector<int>;
using vll   = vector<ll>;
using pint  = pair<int, int>;
using pll   = pair<ll, ll>;
using vpint = vector<pint>;
using vpll  = vector<pll>;
const int INF = (int)1e9 + 1;
const int MOD = (int)1e9 + 7;

int n;

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

  int a, b ,t;
  cin >> a >> b >> t;
//  vint s(n);
//  REP(i, n) scan(s[i]);

  cout << (int)((t+0.5)/a)*b << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>

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

using namespace std;

inline int max(int a, int b) {
	if (b > a) swap(a, b);
	return a;
}

inline int min(int a, int b) {
	if (a > b) swap(a, b);
	return a;
}




int main() {
	int l, r;
	int ans = 2019;
	cin >> l >> r;
	int num = min(r - l, 2019);
	for (int i = l; i < l + num; i++) {
		for (int j = i + 1; j <= l + num; j++) {
			ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

class Main {

	public static void main(String[] args) {
	
		Scanner sc = new Scanner(System.in);
		
		ArrayList<Integer> height = new ArrayList<Integer>();
        ArrayList<Integer> width = new ArrayList<Integer>();
        //??\???????????????????¨??????????????´?????????¬??????????????????

        int H,W;
        //??\?????????????????????????????£??\???????????°?????°????????????????????????????????????????????????
         
        while(true){
            H = sc.nextInt();
            W = sc.nextInt();
             
            if(H == 0 && W == 0)
                break;
             
            height.add(H);
            width.add(W);
             
        }
        //??\??????????????°????????¨???????????\????????¨????????????height?????????width???????´???????
        
        int countH = 0;
        int countW = 0;
        //height??¨width???????´??????´????????¨????????°
        int t;
        
        for(countH = 0; countH < height.size(); countH++)
        {
        	//????????????????????\????????????????????°??????????????§????????¢?????????????????¨?????°?????????
        	for(int i = 0; i < height.get(countH); i++)
            {
        		//????????°??????????????????????????????????????§????????????
        		switch(i % 2)
        		{
        		case 0:for(t = 0; t < width.get(countW); t++)
        		{
        			switch(t % 2)
        			{
        			case 0:System.out.print("#");
        			break;
        			
        			case 1:System.out.print(".");
        			break;
        			}
        			if(t == width.get(countW) - 1)
                		System.out.println("");	
        			
        		}
        		break;
        		
        		case 1:for(t = 0; t < width.get(countW); t++)
        		{
        			switch(t % 2)
        			{
        			case 0:System.out.print(".");
        			break;
        			
        			case 1:System.out.print("#");
        			break;
        			}
        			if(t == width.get(countW) - 1)
                		System.out.println("");	
        		}
        		break;
        		
            		}
            	}
        	System.out.println("");
        	countW++;
        	//?¬????????????¢??¨??????????????????????????????????????????????????????
        	//countW??????????¶????????¬????????????¢????¨???????????????´???????????????
            }
        }

	}

Measured memory_bytes: 36040
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int n;
  cin >> n;
    
  map<string,int> p;
  rep(i,n){
    string s;
    cin >> s;
    sort(all(s));
      if(p.count(s)) p.at(s)++;
      else p[s]=1;
  }
  
  ll ans = 0;
  for(auto x : p){
    auto t = x.se;
    ans+=(ll)t*(t-1)/2;
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 11136
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
    int N;
    long long int a[100010];
    a[1]=1;
    for(int i=2;i<100010;i++)
        a[i]=(a[i-1]*i)%1000000007;
    while(scanf("%d",&N)!=EOF)
    {
    long long int sum=a[N];
    printf("%lld\n",sum);
    }

}


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

using namespace std;

const int MOD=1e9+7;
const double PI=3.14159265359;


int main(){
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    long long n,x;
    cin>>n>>x;
    //cout<<5*x+2*((n-x)/x);
    cout<<3ll*(n-__gcd(n,x));
    
    
    
    
    return 0;
    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
vector<long long> enum_divisors(long long N)
{
  vector<long long> res;
  for (long long i = 1; i * i <= N; ++i)
  {
    if (N % i == 0)
    {
      res.push_back(i);
      // 重複しないならば i の相方である N/i も push
      if (N / i != i) res.push_back(N / i);
    }
  }
  // 小さい順に並び替える
  sort(res.begin(), res.end());
  return res;
}

int main()
{
  ll N;
  cin >> N;
  vector<ll> vec = enum_divisors(N);
  int M = vec.size();
  if(M%2==1)
  {
    int digits = 0;
    ll n = vec[M/2];
    while(n>0)
    {
      n /= 10;
      digits ++;
    }
    cout << digits << endl;
  }
  else
  {
    int digits1 = 0;
    int digits2 = 0;
    ll n1 = vec[M/2-1];
    ll n2 = vec[M/2];
    while(n1>0)
    {
      n1 /= 10;
      digits1 ++;
    }
    while(n2>0)
    {
      n2 /= 10;
      digits2 ++;
    }
    cout << max(digits1,digits2) << endl;
  }
  return 0;
}


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

int main(){
	char s[52], t[52];
	scanf("%s%s", s, t);
	int n = strlen(s), m = strlen(t), f, p;
	for(int i = n-m;i >= 0;i--){
		f = 0, p = i;
		for(int j = i;j < i+m;j++){
			if(s[j] == '?')continue;
			if(s[j] != t[j-i])f = 1;
		}
		if(f == 0)break;
		if(i == 0 && f == 1)p = -1;
	}
	if(p == -1)printf("UNRESTORABLE\n");
	else{
		for(int i = 0;i < n;i++){
			if(p <= i && i < p+m)printf("%c", t[i-p]);
			else{
				if(s[i] == '?')printf("a");
				if(s[i] != '?')printf("%c", s[i]);
			}
		}
	}
	return 0;
}

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

ans = 0
x = 0
C = []
D = []
if N == 1:
    print(A[0] + B[0])
    exit()
for i in range(N):
    C = A[0:i]
    D = B[i - 1:N]
    x = sum(C) + sum(D)
    ans = max(ans, x)

print(ans)


Measured memory_bytes: 9184
import sys
# import math
# import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

# sys.setrecursionlimit(10000)

#### input
input = sys.stdin.readline
N = int(input())
# a, b = map(int, input().split())
Ps = list(map(int, input().split()))

mind = [None for _ in range(N)]
mind[0] = Ps[0]

for i in range(1, N):
  mind[i] = min(mind[i-1], Ps[i])


count = 0
for i in range(0, N):
  if mind[i] >= Ps[i]:
    count += 1

print(count)

Measured memory_bytes: 81488
import sys
s = input()
mod = 10**9+7
memo_ls = [[0 for j in range(4)] for i in range(len(s) + 1)]
memo_ls[0][0] = 1
for i, _s in enumerate(s, 1):
    memo_ls[i][0] = memo_ls[i-1][0]
    memo_ls[i][1] = memo_ls[i-1][1]
    memo_ls[i][2] = memo_ls[i-1][2]
    memo_ls[i][3] = memo_ls[i - 1][3]
    if _s == "A":
        memo_ls[i][1] += memo_ls[i-1][0]
    elif _s == "B":
        memo_ls[i][2] += memo_ls[i-1][1]
    elif _s == "C":
        memo_ls[i][3] += memo_ls[i-1][2]
    else:
        memo_ls[i][0] *= 3
        memo_ls[i][1] *= 3
        memo_ls[i][2] *= 3
        memo_ls[i][3] *= 3
        memo_ls[i][1] += memo_ls[i - 1][0]
        memo_ls[i][2] += memo_ls[i - 1][1]
        memo_ls[i][3] += memo_ls[i - 1][2]
    memo_ls[i][0] %= mod
    memo_ls[i][1] %= mod
    memo_ls[i][2] %= mod
    memo_ls[i][3] %= mod
print(memo_ls[-1][-1] % mod)

Measured memory_bytes: 56540
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#define ll long long
#include <unordered_map>
using namespace std;
 
int main() {
  ll X, Y;
  cin >> X >> Y;
  bool judge = 0;
  for(ll i = 0; i <= X; i++) {
    if(i * 4 + (X - i) * 2 == Y) judge = 1;
  }
  if(judge) cout << "Yes"<< endl;
  else cout << "No"<< endl;
}

Measured memory_bytes: 3616
use input::*;
use std::cmp::*;
use std::io::*;
use std::num::*;
use std::str::*;

mod input {
    use super::*;
    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }
    pub fn string() -> String {
        read()
    }
    pub fn int() -> i64 {
        read()
    }
    pub fn char() -> char {
        read::<String>().pop().unwrap()
    }
    pub fn vecchar() -> Vec<char> {
        string().chars().collect()
    }
    pub fn vecint(n: i64) -> Vec<i64> {
        let mut vec = Vec::new();
        for i in 0..n {
            vec.push(int())
        }
        vec
    }
}
fn main() {
    let (h, w) = (int() as usize, int() as usize);
    let mut a = Vec::new();
    for _ in 0..h {
        a.push(vecchar())
    }
    let mut count = 0;
    for i in 0..h {
        for j in 0..w {
            if a[i][j] == '#' {
                count += 1
            }
        }
    }
    println!(
        "{}",
        if count == h + w - 1 {
            "Possible"
        } else {
            "Impossible"
        }
    )
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 1000000007;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX

void solve(){
    ll n;
    cin >> n;
    ll a[n];
    forn(i,n) cin >> a[i];
    map<ll,ll> dp;
    ll fact = 1e6;
    forsn(i,1,n-1){
    	dp[fact*i]=0;
    }
    ll ans=0;
    forsn(i,1,n-1){
    	forsn(j,1,(n-2)/i){
    		if((n-1)%i==0 && 2*i*j>=n-1) continue;
    		dp[fact*i+j]=dp[fact*i+j-1]+a[j*i]+a[n-1-i*j];
    		// cout << i << " " << j << " " << dp[fact*i+j] << ln;
    		ans = max(ans,dp[fact*i+j]);
    	}
    }
    cout << ans << ln;
}


int main()
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    // cin >> t;
    forn(i,t) solve();
    return 0;
}

Measured memory_bytes: 69376
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>
#include <map>

using namespace std;

template<typename value_type>
class extended_euclidean
{
public:
	value_type gcd;
	value_type lcm;
	value_type x0;
	value_type y0;

public:
	extended_euclidean(value_type a, value_type b)
		: gcd(0), lcm(0), x0(0), y0(0)
	{
		tie(gcd, x0, y0) = process(a, b);
		lcm = a * b / gcd;
	}

public:
	tuple<value_type, value_type, value_type> process(value_type a, value_type b)
	{
		if (a == 0) return make_tuple(b, 0, 1);

		value_type g, x, y;
		tie(g, x, y) = process(b % a, a);

		return make_tuple(g, y - (b / a) * x, x);
	}
};

//extended_euclidean<long long> ee(a, b);
//long long gcd = ee.gcd;
//long long lcm = ee.lcm;



namespace math_helper
{
	const double pi = acos(-1.0);

	template<typename value_type>
	value_type mod(const value_type a, const value_type m)
	{
		if (a >= 0) return a % m;
		return ((-a / m + 1) * m + a) % m;
	}

	template<typename value_type>
	value_type mod_inverse(const value_type a, const value_type m)
	{
		extended_euclidean<value_type> ee(a, m);

		if (ee.gcd != 1) return -1;
		return mod<value_type>(ee.x0, m);
	}

	template<typename value_type>
	map<value_type, int> factorization(value_type num)
	{
		map<value_type, int> factor_map;

		for (value_type factor_num = 2; factor_num * factor_num <= num; factor_num++)
		{
			if (num % factor_num != 0) continue;

			while (num % factor_num == 0)
			{
				num /= factor_num;
				factor_map[factor_num]++;
			}
		}

		if (num != 1) factor_map[num]++;

		return factor_map;
	}

	template<typename value_type>
	map<value_type, int> factorization(value_type num, const vector<value_type>& prime_list)
	{
		map<value_type, int> factor_map;

		while (num > 1)
		{
			for (value_type prime_num : prime_list)
			{
				if (prime_num > num) break;
				if (num % prime_num != 0) continue;

				while (num % prime_num == 0)
				{
					num /= prime_num;
					factor_map[prime_num]++;
				}
			}
		}

		return factor_map;
	}

	template<typename value_type>
	value_type fast_power(const value_type a, const value_type n)
	{
		if (n == 1) return a;

		value_type ret = fast_power(a, n / 2);
		ret = (ret * ret);
		if (n % 2 != 0) ret = (a * ret);
		return ret;
	}
};

//double pi_value = math_helper::pi;
//long long mod_value = math_helper::mod<long long>(value, mod);
//long long mod_inverse_value = math_helper::mod_inverse<long long>(value, mod);
//map<long long, int> factor_map_naive = math_helper::factorization<long long>(value);
//map<long long, int> factor_map = math_helper::factorization<long long>(value, prime_list);
//long long power_value = math_helper::fast_power<long long>(value, power);

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

	long long A, B;
	cin >> A >> B;

	extended_euclidean<long long> ee(A, B);
	map<long long, int> factor_map_naive = math_helper::factorization<long long>(ee.gcd);

	cout << factor_map_naive.size() + 1;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    int N;
    cin >> N;
    for(int i=0; i<=50000; i++){
        if(int(i*1.08)==N){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll n, a[111111], vv, T, ans;
ll mi[111111], ma[111111];
map< ll, vector<ll> > S;
map< ll, int > ex;
// 1 1 1 1 0 0 0 0 0
// 0 0 0 1 1 0 0 0 1

int tryout(ll v_1, ll v_2)
{
	int i, j, ret=1e9, cur=0;
	vector< pair<ll, int> > res; res.clear();
	vector<ll> V_1=S[v_1];
	vector<ll> V_2=S[v_2];
	for(i=0 ; i<V_1.size() ; i++) res.push_back(make_pair(V_1[i],0));
	for(i=0 ; i<V_2.size() ; i++) res.push_back(make_pair(V_2[i],1));
	sort(res.begin(),res.end());
	for(i=0 ; i<res.size() ; i++) if(res[i].second==1) cur++;
	ret=cur;
	for(i=0 ; i<res.size() ; i++)
	{
		if(res[i].second==1) cur--;
		else cur++;
		ret=min(ret,cur);
	}
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n>>T; int i; mi[0]=1e9; ma[n+1]=0;
	for(i=1 ; i<=n ; i++) cin>>a[i];
	for(i=1 ; i<=n ; i++) mi[i]=min(mi[i-1],a[i]);
	for(i=n ; i>=1 ; i--) ma[i]=max(ma[i+1],a[i]);
	for(i=1 ; i<=n ; i++) vv=max(vv,ma[i+1]-a[i]);
	for(i=1 ; i<=n ; i++) ex[a[i]]++, S[a[i]].push_back(i);
	for(i=1 ; i<=n ; i++)
		if(ex[a[i]]!=0 && ex[a[i]+vv]!=0)
			ans+=tryout(a[i],a[i]+vv);
	cout<<ans; return 0;
}



// it may be easier than you think
// it may be harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

Measured memory_bytes: 26112
N=input()
n=len(N)-1

for i in range(1<<n):
    ans=N[0]
    for j in range(n):
        if ((i>>j)&1) == 1:
            ans +='+'
            ans +=N[j+1]
        elif ((i>>j)&1) ==0:
            ans+='-'
            ans+=N[j+1]

    if eval(ans)==7:
        temp = ans

temp += '=7'
print(temp)


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

ind_A = {}

for i in range(N):
  if A[i] in ind_A:
    ind_A[A[i]] += 1
  else:
    ind_A[A[i]] = 1

ans = 0

for (i, v) in ind_A.items():
  ans += (v * v - v) // 2


for i in range(N):
  value = ind_A[A[i]]
  print(ans - value + 1)


Measured memory_bytes: 32292
n=int(input())
ll=list(map(int,input().split()))
t=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if ll[i]==ll[j]:continue
      if ll[i]==ll[k]:continue
      if ll[k]==ll[j]:continue
      sa=[ll[i], ll[j], ll[k]]
      ma=max(sa)
      sal=sum(sa)-ma
      if ma<sal:t+=1
      
print(t)

Measured memory_bytes: 68500
/*
	0051:Differential II
*/
#include	<iostream>
#include	<cstdio>
#include	<cstdlib>
#include	<algorithm>
#include	<functional>

using namespace std;

int main(void) {
	int n;
	
	cin >> n;
	
	while(n-- > 0) {
		int a, b, dif;
		char str[9];
		scanf("%s", str);
		sort(str, str+8);
		a = atoi(str);
		sort(str, str+8, greater<char>() );
		b = atoi(str);
		
		dif = b - a;
		cout << dif << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1212
function main()
  # 整数の入力
    a = parse(Int, readline())
    # 出力
    if a == 25
        println("Christmas")
    elseif a == 24
        println("Christmas Eve")
    elseif a == 23
        println("Christmas Eve Eve")
    else
        println("Christmas Eve Eve Eve")
    end
end
main()

Measured memory_bytes: 158680
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>


#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S,False(1,-1);
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

template<typename A,size_t N,typename T>
void Fill(A(&array)[N],const T &val){
    fill((T*)array,(T*)(array+N),val);
}

const ll INF = 1e10;
int main(){
    int n;
    cin >> n;
    VEC(ll, a, 3 * n);
    sort( ALL(a) , greater<ll>());
    ll res = 0;
    rep(i, n){
        res += a[2 * i + 1];
    }
    cout << res << endl;
}

Measured memory_bytes: 2560
<>=~$";
$s+=$-=$_ for@a=glob<>;
$_>0?$p:$m+=abs for@a[0..$'-1];
$P=$p;
$M=$m;
for($'..$#a){
	$a[$_]>0?$p:$m+=abs$a[$_];
	$a[$_-$']>0?$p:$m-=abs$a[$_-$'];
	$P-=$-=$P-$p;
	$M-=$-=$M-$m
}
print$s-($P<$M?$P:$M)


Measured memory_bytes: 27136
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n; 
    cin >> n;
    int total = 0;
    vector<int> vec(n);
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        vec[i] = x;
        total = total ^ x;
    }
    for(int i =0; i < n; i++){
        int t = total ^ vec[i];
        cout << t << " ";
    }
}









Measured memory_bytes: 3984
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    int w,h,n;
    int ans=0;
    cin >>w>>h>>n;
    pair<pair<int,int>,pair<int,int>>data(mp(mp(0,w),mp(0,h)));
    
    int x,y,a;
    rep(i,n){
        cin>>x>>y>>a;
        switch(a){
            case 1:
                chmax(data.F.F,x);
                break;
            case 2:
                chmin(data.F.S, x);
                break;
            case 3:
                chmax(data.S.F, y);
                break;
            case 4:
                chmin(data.S.S, y);
                break;
        }
    }
    if(data.F.F < data.F.S and data.S.F <data.S.S){
        ans=(data.F.S-data.F.F)*(data.S.S-data.S.F);
    }
    cout<<ans<<endl;
}

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

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = lr()
BC = [lr() for _ in range(M)]
BC.sort(key=lambda x: x[1], reverse=True)
D = []
count = 0
for b, c in BC:
    x = [c] * b
    D.extend(x)
    count += b
    if count >= N:
        break

A += D
A.sort(reverse=True)
answer = sum(A[:N])
print(answer)


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

bool f[100001];
int c[100002];
int N, L, R;

int main()
{
    for (int i=2; i<=100000; i++){
        if (!f[i]){
            for (int j=i+i; j<=100000; j+=i){
                f[j] = true;
            }
        }
    }

    for (int i=3; i<=100000; i+=2){
        if (!f[i] && !f[(i+1)/2]){
            c[i]++;
        }
    }

    for (int i=3; i<=100000; i++){
        c[i] += c[i-1];
    }
    
    scanf("%d", &N);
    while(N--)
    {
        scanf("%d%d", &L, &R);
        printf("%d\n", c[R] - c[L-1]);
    }
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <string.h>
#define LEN 100005
 
typedef struct pp {
  char name[100];
  int t;
} P;
 
P Q[LEN];
int head, tail, n;
 
void enqueue(P x) {
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}
 
P dequeue() {
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}
 
int min(int a,int b) {
  return a < b ? a : b; 
}
 
int main() {
  int elaps = 0, c;
  int i, q;
  P u;
  
  scanf("%d %d",&n ,&q);
  for(i=1; i<=n; i++) {
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;
 
  while(head != tail) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0) enqueue(u);
    else {
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}


Measured memory_bytes: 11924
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
using namespace std;

int main() {
	int n, q, a = 0;
	cin >> n >> q;
	pair<string, int> b;
	queue<pair<string, int>> c;
	for (int i = 0; i < n; ++i) {
		cin >> b.first >> b.second;
		c.push(b);
	}
	while (!c.empty()) {
		a += min(q, c.front().second);
		if (c.front().second > q) c.push(make_pair(c.front().first, c.front().second - q));
		else cout << c.front().first << ' ' << a << endl;
		c.pop();
	}
}


Measured memory_bytes: 6332
#include <bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
using namespace std;

void printV(vll v){
	cout << "size (" << v.size() << "): ";
	for(ll i = 0; i < v.size(); i++){
		cout << v[i] << " ";
	}
	cout << "\n";
}

void printM(vector<vll> v){
	cout << "size (" << v.size() << "," << v[0].size() << "): ";
	for(ll i = 0; i < v.size(); i++){
		for(ll j = 0; j < v[i].size(); j++){
			cout << v[i][j] << " ";
		}
		cout << "\n";
	}
}

ll powermod(ll x, ll y){
	ll res = 1;
	x = x % mod;
	while (y > 0)
	{
		if (y & 1){
			res = (res * x) % mod;
		}
		y = y >> 1;
		x = (x * x) % mod;
	}
	res %= mod;
	return res;
}

ll factmod(ll n)
{
	ll res = 1;
	while (n > 1)
	{
		res = (res * ((n / mod) % 2 ?  mod - 1 : 1)) % mod;
		for (ll i = 2; i <= n % mod; ++i){
			res = (res * i) % mod;
		}
		n /= mod;
	}
	res %= mod;
	return res;
}

void solve(){
	ll red, green, blue, k = 0, K;
	cin >> red >> green >> blue >> K;
	while(green <= red){
		green = 2 * green;
		k++;
	}	
	while(blue <= green){
		blue = 2 * blue;
		k++;
	}
	if(k <= K) cout << "Yes\n";
	else cout << "No\n";
}


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

Measured memory_bytes: 3648
a,b=map(int,input().split())
if a==b:
    n=str(a)
    for i in range(a-1):
        n+=str(a)
    print(n)
else:
    if a>b:
        n=str(b)
        for i in range(a-1):
            n+=str(b)
        print(n)
    else:
        n=str(a)
        for i in range(b-1):
            n+=str(a)
        print(n)
        



Measured memory_bytes: 3060
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

//Main
var sc = bufio.NewScanner(os.Stdin)
var N, M int
var A map[string]int

const MAX = 200

func main() {
	sc.Split(bufio.ScanWords)
	A := make(map[string]int, MAX)
	N = nextInt()
	for i := 0; i < N; i++ {
		s := nextStr()
		//mapにkeyが存在するか判定
		if _, ok := A[s]; ok {
			A[s]++
		} else {
			A[s] = 1
		}
	}

	M = nextInt()
	for i := 0; i < M; i++ {
		s := nextStr()
		//mapにkeyが存在するか判定
		if _, ok := A[s]; ok {
			A[s]--
		} else {
			A[s] = -1
		}
	}

	ans := -200
	for _, v := range A {
		if v > ans {
			ans = v
		}
	}

	fmt.Println(maxInt(0, ans))
}


Measured memory_bytes: 640
from fractions import gcd

n = int(input())
list_ = list(map(int, input().strip().split()))

gcd_from_left = [0]
gcd_from_right = [0]
for i in range(n):
    gcd_from_left.append(gcd(gcd_from_left[i], list_[i]))
    gcd_from_right.append(gcd(gcd_from_right[i], list_[-(i + 1)]))

gcd_from_left.insert(0, 0)
gcd_from_right.insert(0, 0)
gcd_from_right.reverse()

print(max(gcd(gcd_from_left[i], gcd_from_right[i]) for i in range(n + 2)))


Measured memory_bytes: 16056
def main():
    s = list(input())
    dic = {}
    cnt = 0
    for i in s:
        if i not in dic:
            dic[i]  = 1
        else:
            dic[i] += 1
    for key,i in dic.items():
        cnt += 1
        if i != 2 or cnt > 2:
            print('No')
            exit()
    print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    a[i] -= i + 1

a.sort()

b = a[n//2]

print(b * (n//2) - sum(a[:n//2]) + sum(a[n//2:]) - b * (n - n//2))

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

int main(){
  
  int N;
  cin >> N;
  
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  
  sort(A.begin(), A.end());
  
  cout << A.at(N - 1) - A.at(0) << endl;
}

Measured memory_bytes: 256
(function(input) {
  var p = input.replace(/\n$/, '').split('\n');
  var n = Number(p.shift());
  var i = 0;
  while (i++ < n) {
    var args = p.shift().split(' ').map(Number);
    var x1 = args.shift();
    var y1 = args.shift();
    var x2 = args.shift();
    var y2 = args.shift();
    var x3 = args.shift();
    var y3 = args.shift();
    var x4 = args.shift();
    var y4 = args.shift();
    console.log(((y2 - y1) / (x2 - x1)).toFixed(6) === ((y4 - y3) / (x4 - x3)).toFixed(6) ? 'YES' : 'NO');
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7644
N,T = map(int,input().split())
A = list(map(int,input().split()))
minA = [[A[0],0]] + [[-1,-1]]*(N-1)
for i in range(1,N):
  if minA[i-1][0] >= A[i]: minA[i] = [A[i],i]
  else: minA[i] = minA[i-1]
  
maxA = [[-1,-1]]*(N-1) + [[A[-1],N-1]]
for i in range(N-2,-1,-1):
  if maxA[i][0] <= A[i]: maxA[i] = [A[i],i]
  else: maxA[i] = maxA[i-1]

max_dif = -float('inf')
max_i = []
cnt = 0
for mina, maxa in zip(minA, maxA):
  if max_dif < maxa[0]-mina[0]:
    max_dif = maxa[0]-mina[0]
    max_i = [cnt]
  elif  max_dif == maxa[0]-mina[0]:
    max_i.append(cnt)
  cnt += 1

print(len(max_i))

Measured memory_bytes: 74476
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    
    int[] a = new int[3];
    
    a[0] = sc.nextInt();
    a[1] = sc.nextInt();
    a[2] = sc.nextInt();

    Arrays.sort(a);
    
    System.out.println(a[0] + a[1] + 10 * a[2]);
  }
}

Measured memory_bytes: 22996
//Guidebook

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define nnn "\n"
const int inf = 2147483647;
typedef pair<pair<string,int>,int> p;

int main (){
    int n;cin>>n;
    p pp;
    vector<p>m(n);
    rep(i,0,n){
        string a;
        int b,c=i+1;
        cin>>a>>b;
        m[i]=mp(mp(a,-b),c);
    }
    sort(range(m));
    rep(i,0,n)cout<<m[i].second<<nnn;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    string s;
    cin >> s;
    if(s.at(0) == s.at(1) || s.at(1) == s.at(2) || s.at(2) == s.at(3)){
        cout << "Bad" << endl;
    }
    else cout << "Good" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N), B(N, 1);
    REP(i, N) cin >> A[i];

    vector<int> acum(N + 1, 0);
    REP(t, min(K, 41)) {
        vector<int> flag(N + 1, 0);
        REP(i, N) {
            // if(A[i] == 0) continue;
            int begin = max(0, i - A[i]);
            int end = min(N-1, i + A[i]);
            // cerr << "i: " << i << " begin: " << begin << " end: " << end << endl; 
            flag[begin]++;
            flag[end+1]--;
        }

        REP(i, N+1) acum[i] = 0;
        acum[0] = flag[0];
        FOR(i, 1, N-1) acum[i] = acum[i-1] + flag[i];
        REP(i, N) A[i] = acum[i];

    }

    REP(i, N) cout << A[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 6436
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

int main() {

	int N;
	cin >> N;

	vector<int> L(N);
	for (int i = 0; i < N; i++) cin >> L[i];
	sort(L.begin(), L.end());

	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			for (int k = j + 1; k < N; k++) {
				if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) continue;
				if (L[i] + L[j] > L[k]) ans++;
			}
		}
	}

	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 3648
#include<algorithm>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<stack>
#include<string>
#include<deque>
#include<queue>
#include<vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
const double PI = acos(-1);  // PI = 3.141593...

int main() {
    ll N, K, Q;
    cin >> N >> K >> Q;
    vector<ll> O(N, 0);
    
    rep(i, Q) {
        int A;
        cin >> A;
        ++O[A-1];
    }

    rep(i, N) {
        if (K - Q + O[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

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

int main() {
    double a_yen, b_yen;

    cin >> a_yen >> b_yen;

    int a_count = 0;

    for (double ans = 1.0; ans <= 1009.0; ans += 1.0) {
        if (floor(ans * 0.08) == a_yen && floor(ans * 0.10) == b_yen) {
            cout << ans << endl;
            a_count++;
        }
        if (a_count) break;
    }

    if (a_count == 0){
        cout << -1 << endl;
    }
}

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

int n,m,x,ans,sum,flag=0;
int c[12]={0},a[12][12];
int check(int num){
    int re=0;
    int ok[12]={0};
    stringstream ss;
    ss << bitset<12>(num);
    string s=ss.str();
    rep(i,12){
        if(s[s.size()-i-1]-'0'){
            re+=c[i];
            rep(j,m){
                ok[j]+=a[i][j];
            }
        }
    }
    rep(i,m){
        if(ok[i]<x){
            return -1;
        }
    }
    return re;
}

int main() {
    cin>>n>>m>>x;
    rep(i,n){
        cin>>c[i];
        rep(j,m)cin>>a[i][j];
        ans+=c[i];
    }
    sum=ans;
    ans++;
    int temp;
    rep(i,pow(2,n)){
        temp=check(i);
        if(temp!=-1){
            ans=min(ans,temp);
            flag=1;
        }
    }
    cout << (!flag ? -1:ans) <<endl;
}

Measured memory_bytes: 4092
#include<bits/stdc++.h>
#define jizz ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) x&-x
#define F first 
#define S second 
#define pb push_back
#define MP make_pair
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=1e9;
const int MAXN=200005;
struct link{
	int f;
};
ll n, d1, ans, a[MAXN], t;
bool tmp(int d1, int d2){
	return d1>d2;
}
int main()
{
	cin >> n;
	for (int i=0;i<n;i++)
		cin >> a[i];
	sort (a, a+n, tmp);
	ans=a[0], n-=2;
	for (int i=1;n>=2;i++){
		n-=2;
		ans+=a[i]*2;
		t=i;
	}
	if (n==1) ans+=a[t+1];
	cout << ans << "\n";
}

Measured memory_bytes: 5120
#include<stdio.h>
#include<string.h>
int main(){
  char s[205],t[101];
  scanf("%s %s",s,t);
  int a=0,b=strlen(s),c=0;
  for(int i=0; i<101; i++){
    if(strcmp(&s[i],t)==0){c=1;break;}
    s[b++]=s[i];s[b]='\0';
  }
  printf(c?"Yes":"No");
  return 0;}

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

int main(){
    int A, B;
    cin >> A >> B;
    
    if(A<=8 && B<=8 && A+B <= 16){
        cout << "Yay!" << endl;
    }
    else
        cout << ":(" << endl;
    
    return 0;
}

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

#define int long long
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; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

signed main(){
    int n,m,x; cin >> n>> m>>x;
    vector<vector<int>> a(n,vector<int>(m));
    vector<int> c(n);
    rep(i,n){
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    
    int res=INF;

    for(int bit=0; bit<(1<<n); bit++){
        vector<int> skill(m,0);
        int money=0;
        for(int i=0; i<n; i++){
            if(bit&(1<<i)){
                money+=c[i];
                rep(j,m){
                    skill[j]+=a[i][j];
                }
            }
        }
        bool can=true;
        rep(i,m){
            if(skill[i]<x) can=false;
        }
        if(can) chmin(res,money);
    }
    if(res==INF) cout<<-1<<endl;
    else cout<<res<<endl;



}

Measured memory_bytes: 3608
S = input()
T = input()
ct_f = len(T)
for i in range(len(S)-len(T)+1):
    ct = len(T)
    S_sub = S[i:i+len(T)]
    for j in range(len(T)):
        if S_sub[j] == T[j]:
            ct -= 1

    if ct_f > ct:
        ct_f = ct
        
print(ct_f)

Measured memory_bytes: 9132
# -*- coding: utf-8 -*-
S = list(map(int,input()))
A = S[0] * 10 + S[1]
B = S[2] * 10 + S[3]
if A <= 12 and A > 0:
  if B <= 12 and B > 0:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if B <= 12 and B > 0:
    print("YYMM")
  else:
    print("NA")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    const int K = 4;
    
    int dp[n+1][K+1];
    rep(i, n+1) {
        rep(j, K+1) {
            dp[i][j] = -1;
        }
    }
    
    dp[0][0] = 0;
    rep(i, n) {
        for(int j = 0; j <= K; j++) {
            if(dp[i][j] == -1) {
                continue;
            }
            for(int k = 1; k <= K && i + k <= n; k++) {
                if( j != k || s.substr(i - j, j) != s.substr(i, k) ) {
                    dp[i + k][k] = max(dp[i + k][k], dp[i][j] + 1);
                }
            }
        }
    }

    int ans = 0;
    for(int j = 0; j <= K; j++) {
        ans = max(ans, dp[n][j]);
    }

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

Measured memory_bytes: 4484