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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  ll N;
  cin >> N;

  cout << N*(N-1)/2 << endl;

  return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $n);
$h = array_map('intval', explode(' ', trim(fgets(STDIN))));
$aft = 10 ** 10;
for ($i = $n - 1; $i >= 0; $i--) {
    if ($h[$i] === $aft + 1) {
        $aft = $h[$i] - 1;
    } elseif ($h[$i] < $aft + 1) {
    	$aft = $h[$i];
    } else {
        exit ('No'.PHP_EOL);
    }
}
echo 'Yes'.PHP_EOL;

Measured memory_bytes: 16884
#include<bits/stdc++.h>
using namespace std;
#define LL  long long
#define MOD  998244353

LL N, M, K;

LL qpow(LL base, LL pow) {
    return pow?((pow&1?base:1)*qpow(base*base%MOD, pow/2))%MOD:1;
}
LL qpow2(LL base, LL pow) {
    LL res = 1;
    while(pow) {
        if(pow&1) {
            res = res*base%MOD;
        }
        base = base*base%MOD;
        pow /= 2;
    }
    return res%MOD;
}

int main() {
    cin >> N >> M >>K;
    LL ans = 0;
    LL temp = 1;
    for(int k=0; k<=K; k++) {
        ans += ((M * temp)%MOD * qpow(M-1, N-1-k))%MOD;
        ans %= MOD;
        temp = (temp * (N-k-1))%MOD * qpow(k+1, MOD-2);
        temp %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
 
int main() {
  int N;
  cin >> N;
  int sum = 0;
  int count = 0;
  vector<int> s;
  rep (i, N) {
    int ss;
    cin >> ss;
    sum += ss;
    if (ss % 10 > 0 ) {
      s.push_back(ss);
    }
  }
  
  if (sum % 10 > 0) {
      cout << sum << endl;
  }
  else if ( s.size() == 0 ) {
    cout << 0 << endl;
  }
  else {
    sort(s.begin(), s.end());
    cout << sum - s[0] << endl;
  }
  
  return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

bool alpha1[29], alpha2[29];
vector<int> V[29];

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

	string S1, S2; cin >> S1 >> S2;
	for (int i = 0; i < S1.size(); i++) {
		alpha1[S1[i] - 'a'] = true;
		V[S1[i] - 'a'].push_back(i);
	}
	for (int i = 0; i < S2.size(); i++) alpha2[S2[i] - 'a'] = true;

	bool flag = true;
	for (int i = 0; i < 26 && flag; i++) {
		if (alpha2[i]) {
			if (!alpha1[i]) flag = false;
		}
	}

	int N = S1.size();
	if (!flag) cout << -1 << endl;
	else {
		ll ans = 1LL;
		int pos = -1; // pos以降の文字を使える

		for (int i = 0; i < S2.size(); i++) {
			int m = S2[i] - 'a'; // m番目のアルファベット

			//cout << "m is " << m << endl;
			//for (int j = 0; j < V[m].size(); j++) cout << V[m][j] << " "; cout << endl;

			if (V[m][V[m].size() - 1] <= pos) {
				ans += N;
				pos = V[m][0];
				//cout << pos << " ";
			}
			else {
				auto it = upper_bound(V[m].begin(), V[m].end(), pos);
				pos = *it;
				//cout << pos << " ";
			}
		}

		cout << ans + pos << endl;
	}

	return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
 
 
void PrintStack(stack<int> s) 
{ 
    if (s.empty()) {return;}
    int x = s.top(); 
    s.pop(); 
    PrintStack(s); 
    cout << x; 
    s.push(x); 
} 
 
 
int main() {
  string x;
  stack<int> v;
  cin >> x;
  for (int i = 0; i < x.size(); i++) {
  	if (x[i] == 'B') {
      if (v.size()) {
      v.pop();
      }
    }
    else if (x[i] == '0') {
      v.push(0);
    }
    else if (x[i] == '1') {
      v.push(1);
    }
  }

  PrintStack(v);
}

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

int main(){
    double a,b,c,d=0,e=0,m=0;
    cin>>a>>b;
    int z=a;
    while(z>0){
        z-=b;
        m++;
    }
    cout<<m;
    return 0;
}


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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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 N, W;

vector<ll> w;
vector<ll> v;
vector<vector<ll>> dp(110, vector<ll>(100100, 0));

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

    cin >> N >> W;

    w.resize(N + 1);
    v.resize(N + 1);

    REP(i, N) {
        cin >> w[i + 1] >> v[i + 1];
    }

    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= W; j++) {
            if (w[i] <= j) {
                chmax(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
            }
            chmax(dp[i][j], dp[i - 1][j]);
        }
    }

    cout << dp[N][W] << endl;
    
    return 0;
}

Measured memory_bytes: 87296
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long K = sc.nextLong();
		int N = sc.nextInt();
		long A[] = new long[N];
		for(int i = 0 ; i < N ; ++i){
			A[i] = sc.nextLong();
		}
		long ret = A[N - 1] - A[0];
		for(int i = 1 ; i < N ; ++i){
			long D = A[i - 1];
			D += K - A[i];
			ret = Math.min(D, ret);
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 79320
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

vector<int> G[707];
vector<int> c(707, -1);
int cnt = 0;

void dfs(int v, int st) {
  if (c[v] != -1) {
    if (c[v] != st) {
      cout << -1 << '\n';
      exit(0);
    }
    return;
  }
  c[v] = st;
  if (st) cnt++;
  else cnt--;
  for (int u: G[v]) dfs(u, st ^ 1);
}

int calc(int n) {
  return n * (n - 1) / 2;
}

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

  int n, m;
  cin >> n >> m;
  vector<vector<bool>> f(n, vector<bool>(n, true));
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    f[a][b] = false;
    f[b][a] = false;
  }
  rep(i, n) rep(j, n) if (i != j && f[i][j]) G[i].push_back(j);

  vector<int> diff;
  rep(i, n) {
    if (c[i] == -1) {
      cnt = 0;
      dfs(i, 0);
      diff.push_back(abs(cnt));
    }
  }
  set<int> res;
  res.insert(0);
  for (int d: diff) {
    set<int> nxt;
    for (auto x: res) {
      nxt.insert(x + d);
      nxt.insert(abs(x - d));
    }
    res = nxt;
  }
  int mindiff = *res.begin();
  int ans = calc((n - mindiff) / 2) + calc((n + mindiff) / 2);
  cout << ans << '\n';


  




  
  return 0;
}

Measured memory_bytes: 6308
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long A, B, C, K;
    scan(A, B, C, K);
    writeln((K & 1) ? (B - A) : (A - B));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c[526];
  cin>>a>>b;
  c[0]=a+b;
  c[1]=a-b;
  c[2]=a*b;
  sort(c,c+3);
  cout<<c[2]<<'\n';
  return 0;
}


Measured memory_bytes: 256
from enum import Enum, auto

INFTY = float('inf')

class Color(Enum):
    WHITE = auto()
    GRAY = auto()
    BLACK = auto()

n = int(input())
M = [[-1 for i in range(n)] for i in range(n)]
for i in range(n):
    line = list(map(int, input().split(' ')))
    if line[1] == 0: continue
    for j in range(2, 2+2*line[1], 2):
        M[i][line[j]] = line[j+1]


colors = []
d = []
p = [-1 for i in range(n)]

def dijkstra(s):
    global d
    colors = [Color.WHITE for i in range(n)]
    d = [INFTY for i in range(n)]
    d[s] = 0
    p[s] = -1

    while True:
        mincost = INFTY
        for i in range(n):
            if colors[i] != Color.BLACK and d[i] < mincost:
                mincost = d[i]
                u = i

        if mincost == INFTY: break
        colors[u] = Color.BLACK

        for v in range(n):
            if colors[v] != Color.BLACK and M[u][v] != -1:
                if d[u] + M[u][v] < d[v]:
                    d[v] = d[u] + M[u][v]
                    p[v] = u
                    colors[v] = Color.GRAY

dijkstra(0)
for i in range(n):
    print(i, d[i])


Measured memory_bytes: 6456
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int K = scan.nextInt();
        int C = scan.nextInt();
        String S = scan.next();

        int l[] = new int[N];
        int r[] = new int[N];

        int day = 0;
        int lastL[] = new int[N];
        int lastPos = -1;
        int notAvailable = 0;
        for(int i = 0; i < N; i++) {
            if(S.charAt(i) == 'o' && notAvailable == 0) {
                notAvailable = C;
                l[i] = day++;
                lastL[i] = lastPos;
                lastPos = i;
            } else {
                if(notAvailable != 0)
                    notAvailable--;
                l[i] = day;
                lastL[i] = lastPos;
            }
        }

        day = 0;
        int lastR[] = new int[N];
        lastPos = -1;
        notAvailable = 0;
        for(int i = N-1; i >=0 ; i--) {
            if(S.charAt(i) == 'o' && notAvailable == 0) {
                notAvailable = C;
                r[i] = day++;
                lastR[i] = lastPos;
                lastPos = i;
            } else {
                if(notAvailable != 0)
                    notAvailable--;
                r[i] = day;
                lastR[i] = lastPos;
            }
        }

        for(int i = 0; i < N; i++) {
            if(S.charAt(i) == 'o'){
                int lrc = l[i] + r[i];
                if(lastL[i] != -1 && lastR[i] != -1 && lastR[i]-lastL[i] <= C) lrc--;
                if(lrc >= K) continue;
                os.println(i+1);
            }
        }
    }
}

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

public class Program{
    public static void Main(){
        
        var n = int.Parse(Console.ReadLine());
        string line = Console.ReadLine();
        var k = int.Parse(Console.ReadLine());
        
        var word = line[k - 1];
        char[] words = new char[n];
        for(var i = 0; i < n; i++){
            if(line[i] == word){
                words[i] = word;
            }else{
                words[i] = '*';
            }
        }
        Console.WriteLine("{0}",new string(words));
    }
}


Measured memory_bytes: 13140
"""

ありうるものは？
差の分だけ塗れる

ｄｐ？
dp[i][j] = dp[i-1][j] * j + dp[i][j-1] * i
i,jの中に 丁度i-A,j-B個ある置き方は全部できる

dp[i][j] = dp[i-1][j] * j + dp[i][j-1] * i - dp[i-1][j-1] * (i-1) * (j-1)

i,j置いた時に
i+j個の黒が入っているはず
→ i-1,jにi+j-1こはいってる * j + i-1,jにi+j-1こはいってる* i - どっちも満たしてる

"""

A,B,C,D = map(int,input().split())

dp = [[0] * (D+1) for i in range(C+1)]

dp[A][B] = 1
mod = 998244353

for i in range(A,C+1):

    for j in range(B,D+1):

        if i == A and j == B:
            continue

        dp[i][j] = dp[i-1][j] * j + dp[i][j-1] * i - dp[i-1][j-1] * (i-1) * (j-1)
        dp[i][j] %= mod

print (dp[C][D]%mod)


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  vsort(a);
  
  ll ans=0;
  rep(i,n){
    irep(j,i+1,n){
      irep(k,j+1,n){
        if(a[i]==a[j] || a[j]==a[k] || a[k]==a[i]) continue;
        if(a[i]+a[j]>a[k]) ans++;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3652
require 'bigdecimal'
puts gets.strip.to_i.times.map{ gets.split }.map {|xu|
  value,currency = xu
  if currency == 'JPY'
    BigDecimal(value)
  else
    BigDecimal(value) * BigDecimal('380000.0')
  end
}.inject(&:+).to_s('F')


Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
bool isPrime(ll n){
    for(ll i=2;i*i<=n;i++)if(n%i==0)return false;
    return n!=1;
}
map<ll,int> primeFactor(ll n){
    map<ll,int> ret;
    for(ll i=2;i*i<=n;i++)if(n%i==0){n/=i;ret[i--]++;}
    if(n-1)ret[n]++;
    return ret;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    range(i,n,n+100000){
        if(isPrime(i)){
            puta(i);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve(){

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>n;
  ll a[n];
  set<ll>s;
  for (ll i = 0; i < n; ++i)
  {
  cin>>a[i];
  s.insert(a[i]);
  if(*s.begin()==a[i])
    c++;
  }
  c(c);
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  ll T=1;
  //cin>>T;
  while(T--){
  solve();
  }
  return 0;
}


Measured memory_bytes: 11264
s=input()
if len(s)==2:
  if s[0]==s[1]:
    print(1,2)
  else:
    print(-1,-1)
  exit(0)
for i, (a,b,c) in enumerate(zip(s,s[1::],s[2::]),1):
  if a==b:
    print(i,i+1)
    exit(0)
  if a==c:
    print(i,i+2)
    exit(0)
print(-1,-1)


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

int main(){
  long r , g , b, n ;
  cin >> r >> g >> b >> n;
  long ans = 0;
  long t = 0;
  for(long i = 0; r * i <= n ; i++){
      for(long j = 0 ; (r * i + g * j) <= n ; j++ ){
          if( (n - (r * i + g * j)) % b == 0){
              ans += 1;
          }
      }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
//02-03-2020

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;

    if(n%2==0)
        cout<<n/2<<"\n";
    else
        cout<<(n/2)+1<<"\n";
    return 0;

}


Measured memory_bytes: 256
class Node
  attr_accessor :parent, :rank

  def initialize
    @parent = -1
    @rank = 0
  end
end

class UnionFindTree
  def initialize(n)
    @nodes = (0..n).to_a.map { |i| Node.new }
  end

  def find(x)
    return @nodes[x].parent < 0 ? x : @nodes[x].parent = find(@nodes[x].parent)
  end

  def unite(a, b)
    a = find(a)
    b = find(b)
    return if a == b

    if @nodes[a].rank < @nodes[b].rank
      # p [@nodes[a].parent , @nodes[b].parent]
      @nodes[b].parent += @nodes[a].parent
      @nodes[a].parent = b
    else
      # p [@nodes[a].parent , @nodes[b].parent]
      @nodes[a].parent += @nodes[b].parent
      @nodes[b].parent = a
      @nodes[a].rank += 1 if @nodes[a].rank == @nodes[b].rank
    end
  end

  def same?(a, b)
    find(a) == find(b)
  end
  
  def size(a)
    -@nodes[find(a)].parent
  end

  # 確認用。アルゴリズムとは関係無い
  def parents
    @nodes.map(&:parent)
  end
end

# n, q = gets.split.map(&:to_i)

# uft = UnionFindTree.new(n)
# q.times do |i|
  
#   com, x, y = gets.split.map(&:to_i)
  
#   if com == 0
#     uft.unite(x, y)
#   else
#     puts uft.same?(x, y) ? "Yes" : "No"
#     p [uft.size(x), uft.size(y)]
#   end
# end


N, M = gets.split.map(&:to_i)

class Bridge
  attr_accessor :first, :second

  def initialize
    @first = nil
    @second = nil
  end
end

bridges = (0...M).to_a.map { Bridge.new }

M.times do |i|
  tmp = gets.split.map(&:to_i)
  a = tmp[0]
  b = tmp[1]
  a -= 1
  b -= 1
  a, b = b, a if a > b
  bridges[i].first = a
  bridges[i].second = b
end
# p bridges

f = Array.new(N, N)
ans = Array.new(M, 0)

inco = N * ( N - 1 ) / 2 # inconvenience
# p ["inco", inco]

n = N
q = M

uft = UnionFindTree.new(n)
# p [uft.find(0), uft.find(1), uft.find(2), uft.find(3)]

q.times do |i|
  
  j = (M-1)-i
  ans[j] = inco
  
  x, y = bridges[j].first, bridges[j].second
  
  # p uft.same?(x, y)

  if !uft.same?(x, y)
    
    # p q = uft.find(x)
    # p r = uft.find(y)
    
    inco -= uft.size(x) * uft.size(y)
  
  end
  
  break if inco == 0
  
  uft.unite(x, y)
  
end

puts ans


Measured memory_bytes: 18940
use std::io::*;
use std::str::FromStr;
//https://qiita.com/tubo28/items/e6076e9040da57368845
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")
}

fn main() {
    let n: usize = read();
    let a: u64 = read();
    let b: u64 = read();
    let x: Vec<u64> = (0..n).map(|_| read()).collect();

    let mut ret = 0;
    for i in 0..n-1{
        ret += std::cmp::min((x[i+1]-x[i])*a,b);
    }
    println!("{}",ret);
}


Measured memory_bytes: 2744
#include <iostream>
#include <unordered_map>
using lint = int64_t;
using P = std::pair<lint, lint>;

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

class union_find {
private:

	static const lint array_size = 2 * 100010;
	lint par[array_size], rank[array_size], size[array_size];

public:

	void init(lint n) noexcept {
		if (array_size <= n) return;
		for (lint i = 0; i < n; ++i) {
			par[i] = i;
			rank[i] = 0;
			size[i] = 1;
		}
	}

	lint root(lint x) noexcept {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}
  
	void unite(lint x, lint y) noexcept {
		x = root(x); y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) {
			par[x] = y;
			size[y] += size[x];
		}
		else {
			par[y] = x;
			if (rank[x] == rank[y]) ++rank[x];
			size[x] += size[y];
		}
	}
};

namespace std {
	template<class T1, class T2>
	struct hash<pair<T1, T2>> {
		size_t operator()(const pair<T1, T2>& value) const noexcept {
			auto hash1 = hash<T1>{}(value.first);
			auto hash2 = hash<T2>{}(value.second);

			size_t seed = hash<string>{}(to_string(hash1) + to_string(hash2));
			return seed;
		}
	};
}

lint n, k, l;
std::unordered_map<P, lint>mp;
union_find a, b;
int main() {
	scanf("%lld %lld %lld", &n, &k, &l);
	a.init(n), b.init(n);
	rep(i, k) {
		lint p, q;
		scanf("%lld %lld", &p, &q);
		a.unite(p - 1, q - 1);
	}
	rep(i, l) {
		lint r, s;
		scanf("%lld %lld", &r, &s);
		b.unite(r - 1, s - 1);
	}
	rep(i, n) mp[P(a.root(i), b.root(i))]++;
	rep(i, n) printf("%lld%c", mp[P(a.root(i), b.root(i))], " \n"[i == n - 1]);
}

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

int parent(int i){
    return i/2;
}

int left(int i){
    return i*2+1;
}

int right(int i){
    return i*2+2;
}

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    
    int H[n];
    for(int i=0;i<n;i++){
       cin >> H[i];
    }
    
    for(int i=0;i<n;i++){
        cout << "node " << i+1 << ": ";
        cout << "key = " << H[i] << ", ";
        if(i!=0 && 0<=parent(i) &&parent(i)<n)
            cout << "parent key = " << H[parent(i-1)] << ", ";
        if(0<=left(i) && left(i)<n)
            cout << "left key = " << H[left(i)] << ", ";
        if(0<=right(i) && right(i)<n)
            cout << "right key = " << H[right(i)] << ", ";
        cout << endl;
    }
    return 0;
}

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

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
		sort(all(H));

		ll ans = 0;
		rep(i,N-K){
			ans+=H[i];
		}
		cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,i,l,r,sum;
  sum=0;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>l>>r;
    sum+=r-l+1;
  }
  cout<<sum<<endl;
  
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
int y=1,x=1,f,s;
while(y!=0||x!=0){
scanf("%d %d",&x,&y);
if(x==0&&y==0)break;
f=x;
s=y;
if(f>s){
f=y;
s=x;
}
printf("%d %d\n",f,s);
}
return 0;
}

Measured memory_bytes: 596
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
rows = [int(input()) for _ in range(N)]
cnt = Counter(rows)
ans = 0
for k,v in cnt.items():
    if v%2 == 1:
        ans += 1
        
print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 25252
import re

data = input().split(' ')
stack = []
for w in data:
    if re.match(r'[0-9]', w):
        stack.append(w)
        # print(stack)
    else:
        r = stack.pop()
        l = stack.pop()
        stack.append(eval(str(l) + w + str(r)))
        # print(stack)

print(stack[0])

Measured memory_bytes: 6512
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_intで宣言
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////


int main(){
    
    ll a,b,k;cin>>a>>b>>k;
    rep(i,1,k){
        if(i%2==1){
            a=a/2;
            b+=a;
        }else{
            b=b/2;
            a+=b;
        }
    }
    cout<<a<<" "<<b<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;
int main() {
	int n; cin >> n;
	string s; cin >> s;

	if (s.size()%2 == 1)
		cout << "No";
	else if (s.substr(0, n / 2) == s.substr(n / 2, n / 2))
		cout << "Yes";
	else
		cout << "No";
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  string S;
  int C=0,cnt=0;
  cin>>S;
  if(S[0]=='A') cnt++;
  for(int i=1;i<S.size()-1;i++){
    if(S[i]=='C') C++;
  }
  if(C==1) cnt++;
  if(S[1]>='a'&&S[1]<='z') cnt++;
  for(int i=2;i<S.size();i++){
    if(S[i]>='a'&&S[i]<='z'){
      if(i==S.size()-1) cnt++;
      continue;
    }
    else if(S[i]=='C') continue;
    else break;
  }
  if(cnt==4) cout<<"AC"<<endl;
  else cout<<"WA"<<endl;
}

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

void solve(int K, int N, std::string S)
{
  int score = 0;
  int num_group = 0;
  for (int i = 1; i < N; i++)
  {
    if(S[i]==S[i-1]){
      score++;
    }
  }
  int sum_score = std::min(score+2*K, N-1);
  std::cout << sum_score << std::endl;


}

int main(void)
{
  int K;
  int N;
  std::string S;
  std::cin >> N;
  std::cin >> K;
  std::cin >> S;
  solve(K,N,S);
  return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <cstring>
#define INF 0x3f3f3f3f
using namespace std;
int num[30];
char ar[105];

int main()
{
    while(~scanf(" %s",ar)){
        memset(num,0,sizeof(num));
        int len = strlen(ar);
        for(int i=0;i<len;i++){
            num[ar[i]-'a']++;
        }
        bool flag = true;
        for(int i=0;i<26;i++){
            if(num[i]%2 != 0){
                flag = false;
                break;
            }
        }
        if(flag){
            printf("Yes\n");
        }
        else
            printf("No\n");

    }
    return 0;
}


Measured memory_bytes: 256
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
int dp[3001][3001];

int main(int argc, char const* argv[])
{
  string s, t;
  cin >> s >> t;
  rep(i, s.size()){
    rep(j, t.size()){
      dp[i+1][j+1] = dp[i][j];
      dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1]);
      dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j]);
      if(s[i] == t[j]){
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
      }
    }
  }
  string res = "";
  int a = s.size() - 1, b = t.size() - 1;
  while(dp[a+1][b+1]){
    if(s[a] == t[b] && dp[a+1][b+1] == 1 + dp[a][b]){
      res += s[a];
      a--;
      b--;
    }else if(dp[a+1][b+1] == dp[a][b+1]){
      a--;
    }else if(dp[a+1][b+1] == dp[a+1][b]){
      b--;
    }else{
      a--;
      b--;
    }
  }
  reverse(res.begin(), res.end());
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 35456
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

typedef long long ll;

#define INF int(1e9)

ll dp[105][100005];//dp[i][j]:i番目の品物までを使ってWまでの重さの価値の最大値

int main() {
  int N, W; cin >> N >> W;
  vector<int> w(N), v(N);
  
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
  }
  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= W; j++) {
      if (j - w[i] < 0) dp[i+1][j] = dp[i][j];
      else dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
    }
  }
  cout << dp[N][W] << endl;
  return 0;
}

Measured memory_bytes: 79360
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<set>
#include<iterator>
#include<algorithm>
#include<functional>

typedef long long ll;

struct solver_abc_137_a {

};

int main(void) {
	int A, B;

	std::cin >> A >> B;

	int t = A + B;
	t = std::max(t, A - B);
	t = std::max(t, A * B);

	std::cout << t << std::endl;

	return 0;
}


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush

input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]

def mod_pow(x,n):
    res = 1
    while n > 0:
        if n & 1:
            res = res * x
            x = x * x
            n >>= 1
    return res


def main():
    S = input().rstrip()
    K = I()
    for i in range(len(S)):
        if int(S[i]) >= 2 or K == 1:
            print(S[i])
            break
        else:
            K -= 1
            
        
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9604
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#define INF 1000000007
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
signed main(){
    int n;
    cin>>n;
    int a[114514];
    int b[114514];
    int c[114514];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        cin>>c[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);
    int k=0;
    for(int i=0;i<n;i++){
        if(c[0]>b[i]){
            k++;
        }
        else break;
    }
    c[0]=k;
    for(int i=1;i<n;i++){
        int l=c[i];
        c[i]=c[i-1];
        for(int j=c[i-1];j<n;j++){
            if(b[j]<l)c[i]++;
            else break;
        }
    }
    k=0;
    for(int i=0;i<n;i++){
        if(b[0]>a[i]){
            k++;
        }
        else break;
    }
    b[0]=k;
    for(int i=1;i<n;i++){
        int l=b[i];
        b[i]=b[i-1];
        for(int j=b[i-1];j<n;j++){
            if(a[j]<l)b[i]++;
            else break;
        }
    }
    k=0;
    for(int i=0;i<c[0];i++){
        k+=b[i];
    }
    a[0]=k;
    for(int i=1;i<n;i++){
        a[i]=a[i-1];
        for(int j=c[i-1];j<c[i];j++)a[i]+=b[j];
    }
    int ans=0;
    for(int i=0;i<n;i++)ans+=a[i];
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 2816
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
#include<iomanip>
using namespace std;
using ll = long long int;
const ll mod = 1e9 + 7;
#define rep(i, a, b) for(int i = a; i < b; i++)

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

	if (a % 2 == 0 || b % 2 == 0) cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

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

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

  vector<long long> A(N);
  vector<long long> B(N);

  for(long long i = 0; i < N; i++){
    cin >> A.at(i);
  }
  long long dist = 0;
  for(int i = 1; i < N; i++){
    dist = max(dist, abs(A.at(i) - A.at(i - 1)));
  }
  dist = max(dist, K - (A.at(N - 1) - A.at(0)));
  cout << K - dist << endl;
}

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

vector<vector<int>> dist;
const int dx[4]={0,0,-1,1};
const int dy[4]={1,-1,0,0};

int main(void)
{
  int height,width;
  cin >> height >> width;
  vector<string> field(height);
  for(int h = 0; h < height; h++) cin >> field[h];
  
  vector<vector<int>> dist(height,vector<int>(width,-1));
  dist[0][0]=0;
  
  vector<vector<int>> prev_x(height,vector<int>(width,-1));
  vector<vector<int>> prev_y(height,vector<int>(width,-1));

  queue<pair<int,int>> que;
  que.push(make_pair(0, 0));
  while(!que.empty())
  {
    const auto current=que.front();
    const int x=current.first;
    const int y=current.second;
    que.pop();

    for(int direction = 0; direction < 4; direction++)
	{
      int next_x = x + dx[direction];
      int next_y = y + dy[direction];
      if(next_x < 0 || next_x >= height || next_y < 0 || next_y >= width)
		  continue;
      if(field[next_x][next_y]=='.')
		  continue;
      if(dist[next_x][next_y] == -1)
	  {
        que.push(make_pair(next_x,next_y));
        dist[next_x][next_y] = dist[x][y] + 1;
		prev_x[next_x][next_y] = x;
		prev_y[next_x][next_y] = y;
      }
    }
  }
  /*int x = height - 1,y = width - 1;
  while(x != -1 && y != -1)
  {
    field[x][y] = dist[x][y] + '0';
    int px = prev_x[x][y];
    int py = prev_y[x][y];
    x = px,y = py;
  }
  for(int h=0;h<height;h++)
  {
    for(int w=0;w<width;w++)
	{
      cout << std::setw(3)<<field[h][w];
    }
     cout << endl;
   }
  cout << dist[height - 1][width - 1] <<endl;*/
  int maxi = -1;
  rep(i, height)
  {
	  rep(j, width)
	  {
		  if (dist[i][j] == -1) continue;
		  if (dist[i][j] > maxi)
			  maxi = dist[i][j];
		  else
		  {
			  cout << "Impossible" << endl;
			  return 0;
		  }
	  }
  }
  cout << "Possible" << endl;
  return 0;
}


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

int main(void){
	
	char n_str[5];
	int n;
	char p_str[60];
	char *p_tmp;
	int p[20];
	int c;
	
	int ans;
	
	fgets(n_str,sizeof(n_str),stdin);	
	fgets(p_str,sizeof(p_str), stdin);

//	printf("n_str = %s\n", n_str);
//	printf("p_str = %s\n", p_str);
	
	n = strtol(n_str,NULL,10);

//	printf("n = %d\n", n);
	
	for(c=0;c<n;c++)
	{
		if(c==0)
			p_tmp = strtok(p_str," ");
		else
			p_tmp = strtok(NULL," ");
		p[c] = strtol(p_tmp,NULL,10);
	}
	
//	for(c=0;c<n;c++)
//	{
//		printf("p[%d] = %d\n",c,p[c]);
//	}
	
	ans = 0;
	
	for(c=0;c<(n-2);c++)
	{
		if(p[c]<p[c+1] && p[c+1] < p[c+2])
			ans++;
		
		if(p[c+2]<p[c+1] && p[c+1] < p[c])
			ans++;
	}
	
	printf("%d",ans);

	return 0;
}

Measured memory_bytes: 128
// 素因数分解

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

/// Sieve of Eratosthenes　エラトステネスの篩
// https://youtu.be/UTVg7wzMWQc?t=2774
struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};

int main(){
    Sieve s(1000000); // 使う素数の最大＞√(因数分解したい数)　大きすぎると遅い(10^７くらいまで)
    ll a,b;
    cin>>a>>b;
    auto fa = s.factor(a);
    auto fb = s.factor(b);
    map<ll,int> mb;
    for(auto p : fb){
        mb[p.first] = p.second;
    }
    ll ans=0;
    for(auto p : fa){
        if(mb.count(p.first)) ans++;
    }
    cout<<ans+1<<endl;
    return 0;
}

Measured memory_bytes: 7612
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

string N;
int main(){
    cin >> N;
    if(N[0] == '9' || N[1] == '9') pr(yes);
    else pr(no);
}

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 110, mod = 1e9 + 7;

int n, a[N];
int sum;

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

    if(sum % 10) cout << sum << endl;
    else
    {
        sort(a, a + n);
        for(int i = 0; i < n; i++)
            if(a[i] % 10)
            {
                sum -= a[i];
                cout << sum << endl;
                return 0;
            }
        cout << 0 << endl;
    }
    return 0;
}


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

int main(){
  int n[10000];
  string k[10000];
  int i=0,a;
  
  while(1){
    cin>>n[i]>>k[i];
    if(k[i]=="="){break;}
    i++;
  }

  a=n[0];
  for(int h=0;;h++){
    if(k[h]=="+"){a+=n[h+1];}
    if(k[h]=="-"){a-=n[h+1];}
    if(k[h]=="*"){a=a*n[h+1];}
    if(k[h]=="/"){a=a/n[h+1];}
    if(k[h]=="="){cout<<a<<endl; break;}
  }
  
  return 0;
}



Measured memory_bytes: 3180
function main(input) {
  input = input.trim();
  const [n, k] = input.split(" ").map(a => Number(a));
  let result = 0;
  result += Math.floor(n/k)**3;
  if (k%2 === 0) {
    let cnt = 0;
    while (k*cnt + k/2 <= n) {
      cnt++;
    }
    result += cnt**3;
  }
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

int selectionSort(vector<int> &a,int n){
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int mi = i;
        bool flag = false;
        for(int j = i; j < n; j++){
            if(a[j] < a[mi] ){
                mi = j;
                flag = true;
            }
        }
        if(flag)cnt++;
        swap(a[i],a[mi]);
    }
    return cnt;
}


int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n){
        cin >> a[i];
    }

    int ans = selectionSort(a,n);

    rep(i,n){
        cout << a[i];
        if(i < n - 1){
            cout << " ";
        }
    }
    cout << endl << ans << endl;




}


Measured memory_bytes: 3116
N = int(input())
A = [int(_) for _ in input().split()]+[0]
sumsub = A[0]
sumall = sum(A)
ans = abs(2*sumsub-sumall)
for i in range(1, N-1):
    sumsub += A[i]
    ans = min(ans, abs(2*sumsub-sumall))
print(ans)


Measured memory_bytes: 24936
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        int[] menu = new int[5];
        for (int i = 0; i < 5; i++)
        {
            menu[i] = int.Parse(Console.ReadLine());
        }
        int ans = 0;
        int max = 10 - menu[0] % 10;
        int index = 0;
        for (int i = 1; i < 5; i++)
        {
            if (max < 10 - menu[i] % 10 && menu[i] % 10 != 0)
            {
                max = 10 - menu[i] % 10;
                index = i;
            }
        }
        for (int i = 0; i < 5; i++)
        {
            if (index != i)
                ans += (int)Math.Ceiling(menu[i] / 10.0) * 10;
            else
                ans += menu[i];
        }
        Console.WriteLine(ans);
    }
}

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

using namespace std;
using ll = long long;

int main() {
	int n; scanf("%d", &n);
	vector<int> arr(n);
	for (int i = 0; i < n; ++i) scanf("%d", &arr[i]);
	map<int, int> occs;
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += occs[i - arr[i]];
		++occs[i + arr[i]];
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main()
{
    
    ll n,k;
    ll sum=0;
    cin>>n>>k;
    ll arr[n];
    ll i;
    for(i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    sort(arr, arr+n);
    for(i=0; i<k; i++)
        sum+=arr[i];
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int n;
	cin>>n;
	
	vi dp(n+1,1);
	bool jud[n+1]={};
	for(int i=2;i<=n;++i){
		if(jud[i]){}
		else{
			for(int j=i;j<=n;j+=i){
				int cnt=0;
				int tmp=j;
				while(tmp%i==0){
					tmp/=i;
					cnt++;
				}
				dp[j]*=cnt+1;
				jud[j]=true;
			}
		}
	}
	
	llong ans=0;
	for(llong i=1;i<=n;++i){
		ans+=i*dp[i];
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 52096
#include<bits/stdc++.h>
#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)
#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)
#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)
#define For(i,u) for(int i=H[u];i;i=nxt[i])
#define re(i,a,b) for (int i=a;i<b;++i)
#define si(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}
template<class T> inline void read(T&x,T&y){read(x);read(y);}
template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}
typedef long long ll;
typedef pair<int,int> pii;
const int N=111111;
//head
int a,b,c,cnt;
int v[5555];
int main() {
	read(a,b,c);
	v[a]++;v[b]++;v[c]++;
	rep(i,0,1000)if(v[i])++cnt;
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())

if H > 1 and W > 1:
  if H*W % 2 == 0:
    s = (H * W) // 2
  elif H*W % 2 != 0:
    s = (H * W + 1) // 2

elif H == 1 or W  == 1:
  s = 1


print(s)

Measured memory_bytes: 9176