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

void numChecker(int a,int **arr,bool **b){
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            if(arr[i][j] == a){
                b[i][j] = 1;
            }
        }
    }
}

bool bingoChecker(bool **b){
    return (b[0][0] && b[1][1] && b[2][2]) || (b[2][0] && b[1][1] && b[0][2]) || (b[0][0] && b[1][0] && b[2][0]) || (b[0][1] && b[1][1] && b[2][1]) || (b[0][2] && b[1][2] && b[2][2]) || (b[0][0] && b[0][1] && b[0][2]) || (b[1][0] && b[1][1] && b[1][2]) || (b[2][0] && b[2][1] && b[2][2]);
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,a;
    int **arr = new int *[3];
    bool **b = new bool*[3];
    for(int i = 0; i < 3; i++){
        arr[i] = new int[3];
    }
    for(int i = 0; i < 3; i++){
        b[i] = new bool[3];
    }
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> arr[i][j];
            b[i][j] = 0;
        }
    }
    cin >> n;
    while(n--){
        cin >> a;
        numChecker(a,arr,b);
    }
    if(bingoChecker(b)){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    string s;
    cin>>s;
    bool ans=true;
    if(n%2==1) ans=false;
    for(int i=0;i<=n/2-1;i++){
        if(s.at(i)!=s.at(i+n/2)) ans=false;
    }
    if(ans) cout<<"Yes";
    else cout<<"No";
}


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

#define int           long long
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (long long )(1e18+1)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){
    cerr << name << " = " << arg1 << endl;
}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args){
    const char *name = strchr(names, ',');
    cerr.write(names, name-names) << " = " << arg1 << endl;
    _F(name+2, args...);
}
template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2> &q){
    in >> q.F >> q.S; return in;
}
template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> &q){
    out << q.F << " " << q.S; return out;
}
template< typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F+p2.F, p1.S+p2.S};
}
template< typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F-p2.F, p1.S-p2.S};
}

void solve(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int cnt = 0;
    while(true){
        if(cnt%2 == 0){
            c -= b;
            if(c <= 0){
                cout << "Yes" <<endl;
                return;
            }
        }
        else {
            a -= d;
            if(a <= 0){
                cout << "No" <<endl;
                return;
            }
        }
        cnt++;
    }
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   

    int t = 1;
    start = clock(); 

    cout << fixed << setprecision(12);

   // #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    //freopen("error.txt", "w", stderr);
    //#endif

    //cin >> t;

    for(int i = 1; i <= t; ++i){
        //cout << "Case #" << i << ": "; 
        solve();
       // cout << endl;
    }
    //cerr << time(start);
    return 0;
}

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

int main(){
    double a, b, x; cin >> a >> b >> x;
    double ans;
    if(a*a*b/2.0 >= x) ans = atan(a*b*b/(2*x));
    else{
        double y = a*a*b - x;
        ans = atan(2*y/(a*a*a));
    }
    ans *= 180/acos(-1.0);
    cout << fixed << setprecision(10) << ans << endl; 
}

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

using namespace std;

int main(int argc, char* argv[]) {
  int W, H, N;
  cin >> W >> H >> N;

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

  int up = H;
  int bottom = 0;
  int left = 0;
  int right = W;

  for (int i = 0; i < N; ++i) {
    if (a[i] == 1) {
      left = max(left, x[i]);
    } else if (a[i] == 2) {
      right = min(right, x[i]);
    } else if (a[i] == 3) {
      bottom = max(bottom, y[i]);
    } else if (a[i] == 4) {
      up = min(up, y[i]);
    }
    if (left >= right || bottom >= up) {
      cout << 0 << endl;
      return 0;
    }
  }

  cout << (right - left) * (up - bottom) << endl;

  return 0;
}

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

int main() {
	int N, M;
	double T,ans=0;
	cin >> N>>M;
	int i, A[1000];
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (i = 0; i < N; i++) {
		ans = ans + A[i];
	}
	T = 0.25 / M;

	int  j,a;

	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			if (A[i] < A[j]) {
				a = A[i];
				A[i] = A[j];
				A[j] = a;
			}
		}
	}


	ans = A[M - 1] / ans;
	if (T > ans)cout << "No" << endl;
	else cout << "Yes" << endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	string str;
	int no, date;
	map<int, int> m;
	map<int, int> ans;
	while (1) {
		getline(cin, str);
		if (str == "")
			break;
		sscanf(str.c_str(), "%d,%d", &no, &date);
		if (m.find(no) == m.end())
			m[no] = 1;
		else
			m[no]++;
	}
	while (getline(cin, str)) {
		sscanf(str.c_str(), "%d,%d", &no, &date);
		if (m.find(no) != m.end())
			ans[no] = m[no] = m[no] + 1;
	}
	map<int, int>::iterator it = ans.begin();
	while (it != ans.end()) {
		cout << it->first << " " << it->second << endl;
		it++;
	}
	return 0;
}

Measured memory_bytes: 1240
<?php
fscanf(STDIN, "%d%d%d", $H, $W, $D);
for($i = 0; $i < $H; $i++){
    $array = array_map("intval", explode(" ", trim(fgets(STDIN))));
    foreach($array as $x =>$a){
        $map[$a] = [$i,$x];
    }
}
for($i = 1; $i <= $D; $i++){
    for($j = $i; $j <= $H*$W; $j+=$D){
        if($j==$i){
            $sum[$j] = 0;
        }else{
            $sum[$j] = $sum[$j - $D] + abs($map[$j][0] - $map[$j-$D][0]) + abs($map[$j][1] - $map[$j-$D][1]); 
        }
    }
}
fscanf(STDIN, "%d", $Q);
for($i = 0; $i < $Q; $i++){
    fscanf(STDIN, "%d%d", $f, $t);
    echo ($sum[$t] - $sum[$f])."\n";
}


Measured memory_bytes: 48376
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let a=[ssin(),ssin(),ssin(),ssin()].sort()
  out(a[0]==a[1]&&a[2]==a[3]&&a[1]!=a[2]?'Yes':'No')
}
main()

Measured memory_bytes: 11468
#include <stdio.h>
#include <algorithm>
using namespace std;
int x[100], y[100], z[100], a, b, c, d, q;
int main() {
	while (true) {
		scanf("%d,%d", &a, &b);
		if (a == 0 && b == 0) break;
		x[c] = a; y[c] = b; c++;
	}
	for (int i = 0; i < c; i++) {
		for (int j = i + 1; j < c; j++) {
			if (y[i] < y[j]) {
				swap(x[i], x[j]);
				swap(y[i], y[j]);
			}
		}
	}
	z[0] = ++d;
	for (int i = 1; i < c; i++) {
		if (y[i - 1] != y[i]) {
			d++;
		}
		z[i] = d;
	}
	while (~scanf("%d", &q)) {
		for (int i = 0; i < c; i++) {
			if (x[i] == q) {
				printf("%d\n", z[i]);
			}
		}
	}
	return 0;
}

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

int main()
{
    int n, d = 100000;
    cin >> n;
    for(; n-- ;)
    {
       if((d + d*5/100)%1000 == 0) d = d + d*5/100;
       else
       {
            d = d + d*5/100 + (1000-(d + d*5/100)%1000);
       }
    }
    cout << d << endl;
}

Measured memory_bytes: 3072
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.regex.Pattern;

public class Main {
    public void exec(Stdin stdin, PrintWriter stdout) {
        int x = stdin.nextInt();
        int y = stdin.nextInt();
        for (int t = 0; t <= x; t++) {
            int k = x - t;
            if (2*t+4*k == y) {
                stdout.println("Yes");
                return ;
            }
        }
        stdout.println("No");
    }

    public static void main(String[] args) {
        Stdin stdin = new Stdin();
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().exec(stdin, stdout);
        stdout.flush();
    }


    public static class Stdin {
        private BufferedReader stdin;
        private Deque<String> tokens;
        private Pattern delim;

        public Stdin() {
            stdin = new BufferedReader(new InputStreamReader(System.in));
            tokens = new ArrayDeque<>();
            delim = Pattern.compile(" ");
        }

        public String nextString() {
            try {
                if (tokens.isEmpty()) {
                    String line = stdin.readLine();
                    delim.splitAsStream(line).forEach(tokens::addLast);
                }
                return tokens.pollFirst();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }
    }
}


Measured memory_bytes: 34096
(* Vicfred
 * https://atcoder.jp/contests/abc145/tasks/abc145_b
 * string manipulation
 * *)
let n = read_int()
let s = read_line()
let main =
    print_endline @@
    if String.(sub s 0 @@ n/2 = sub s (n/2) @@ (n+1)/2) then "Yes"
    else "No"



Measured memory_bytes: 3588
//#typedef int ll
// include
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <tuple>
// namespace
using namespace std;
// typedef
typedef long long ll;
typedef long double ld;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pint;
// const
const int inf = 1e9;
const ll mod = ((ll)1e9 + 7);
// loop
#define rep(i, n) for(int i = 0, i##_mx = n; i < i##_mx; i++)
#define brep(i, b, e) for(int i = b; i < e; i++)
#define erep(i, b, e) for(int i = b; i <= e; i++)
#define rrep(i, b, e) for(int i = b; i >= e; i--)
// STL
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(), (v).end()
// sort
#define vsort(v, b) sort(all(v), [](auto l, auto r){return (b);})
// access
#define gt(i, n) get<n>(i)
// function
ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
void prime(vint& v, int n){brep(i, 2, n){bool fg = false; for(auto e : v){if(i % e == 0){fg = true;}} if(fg){continue;} v.pb(i);}}
void in(vint& v){for(auto& i : v){cin >> i;}}
void in(vll& v){for(auto& i : v){cin >> i;}}

signed main(){
    string s;
    cin >> s;
    
    int ab[26] = {0};
    rep(i, 4){
        ab[s[i] - 'A']++;
    }
    
    int cnt = 0;
    rep(i, 26){
        if(ab[i] == 2){
            cnt++;
        }else if(ab[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    
    cout << "Yes" << endl;
	
	return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define N 1000005
#define ll long long
#define debug(a) cout<<#a<<": ";for(auto i:a)cout<<i<<" ";cout<<endl;
#define trace(a) cout<<#a<<": "<<a<<endl;
#define int ll
int a[N];
int b[N];
ll ans[N],v[N];
int n,c;
ll solve() {
	int i;
	ll tot = 0;
	for(i = n-1;i >= 0;i--) {
		ans[i] = ans[i+1];
		tot += v[i];
		ans[i] = max(ans[i],-b[i] + tot);
	}
	tot = 0;
	ll an = 0;
	for(i = 0;i < n;i++) {
		tot += v[i];
		an = max({an,tot - a[i],tot - a[i]*2 + ans[i+1]});
	}
	return an;
}
signed main() {
	ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);
	int i,j,k,l,m,t;
	cin >> n >> c;
	for(int i = 0;i < n;i++) {
		cin >> a[i] >> v[i];
		b[i] = c - a[i];
	}
	ll an = solve();
	for(i = 0;i < n;i++) {
		a[i] = c - a[i];
		b[i] = c - b[i];
	}
	reverse(a,a+n);
	reverse(b,b+n);
	reverse(v,v+n);
	an = max(an,solve());
	cout << an << endl;
}

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

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;

int main()
{
	// freopen("input.in", "r", stdin);
	int h, a; cin >> h >> a;
	cout << (h+a-1)/a << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn=2e5+10;
int a[maxn];
int main()
{
    int h,n,sum=0;
    cin>>h>>n;
    for(int i=0;i<n;i++) scanf("%d",&a[i]),sum+=a[i];
    if(sum>=h) cout<<"Yes";
    else cout<<"No";

}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

const int INF = 1e9 + 10;


class MaxFlow {
#define MAX_V 101
  struct Edge {
    int to, cap, rev;
    Edge(int to, int cap, int rev) : to(to), cap(cap), rev(rev) { }
  };

  vector<Edge> G[MAX_V];
  bool used[MAX_V];

  int dfs(int v, int t, int f) {
    if (v == t) {
      return f;
    }
    used[v] = true;
    for (int i = 0; i < G[v].size(); i++) {
      Edge& e = G[v][i];
      if (!used[e.to] && e.cap > 0) {
        int d = dfs(e.to, t, min(f, e.cap));
        if (d > 0) {
          e.cap -= d;
          G[e.to][e.rev].cap += d;
          
          return d;
        }
      }
    }

    return 0;
  }

public:
  
  void add_edge(int from, int to, int cap) {
    G[from].push_back(Edge(to, cap, G[to].size()));
    G[to].push_back(Edge(from, 0, G[from].size() - 1));
  }

  int solve(int s, int t) {
    int flow = 0;

    while (true) {
      memset(used, 0, MAX_V);
      int f = dfs(s, t, INF);
      if (f == 0) {
        break;
      }
      flow += f;
    }

    return flow;
  }


};

int main() {
  int V, E;
  cin >> V >> E;
  int s = 0, t = V - 1;

  MaxFlow mf;

  for (int i = 0; i < E; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    mf.add_edge(u, v, c);
  }

  int ans = mf.solve(s, t);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3128
use std::io::*;
const MOD: i64 = 1_000_000_007;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: usize = itr.next().unwrap().parse().unwrap();
    let mut x: Vec<i64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    let mut y: Vec<i64> = (0..m)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    x.sort();
    y.sort();

    let mut sx = x.iter().sum::<i64>();
    let mut sy = y.iter().sum::<i64>();
    let mut allx = 0i64;
    let mut ally = 0i64;
    for i in 0..n {
        sx -= x[i];
        allx += sx - x[i] * (n - 1 - i) as i64;
        allx %= MOD;
    }
    for i in 0..m {
        sy -= y[i];
        ally += sy - y[i] * (m - 1 - i) as i64;
        ally %= MOD;
    }
    println!("{}", allx * ally % MOD);
}


Measured memory_bytes: 5816
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n,i,c=0,d=1,temp;
    cin >> n;
    for(i=1;i<=n;i++){
        cin >> temp;
        if(temp==d){
            c++;
            d++;
        }
    }
    if(c>0) cout << n-c;
    else cout << "-1";
}

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

typedef  long long ll;
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//
//
#define int long long

using namespace std;

int ctoi(char c) {
 switch (c) {
 case '0': return 0;
 case '1': return 1;
 case '2': return 2;
 case '3': return 3;
 case '4': return 4;
 case '5': return 5;
 case '6': return 6;
 case '7': return 7;
 case '8': return 8;
 case '9': return 9;
 default: return 0;
 }
}


 ll  a,b,c,i,j,k,x,y,z;
 ll A,B,C,X,Y,Z;
 ll count;
signed main(){

 cin >>  a  >>  b  ;
  
  REP(i,a+1)REP(j,a+1-i){
  	if(10000*i+5000*j+1000*(a-i-j)==b){

  		cout<<  i  <<" "<<  j  <<" "<<  a-i-j;
  
 return 0;
  	}
  }
 cout<<  -1  <<" "<<  -1 <<" "<<  -1  <<endl;
  
 return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;

int main(){
    ll A, B; cin >> A >> B;
    if(A>12){
        cout << B;
    }
    else if(A>5){
        cout << B/2;
    }
    else{
        cout << 0;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N,A,B,C,D,e,f;
    cin >>N>>A>>B>>C>>D;
    if (N%A == 0){
		e=(N/A)*B;
	}
	else {
		e=(N/A+1)*B;
	}

	if (N%C==0){
		f=(N/C)*D;
	}
	else {
		f=(N/C+1)*D;
	}

	if (e>f) {
		cout << f << endl;
	}
	else {
		cout << e << endl;
	}
}


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

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

    vector<int> B(M);
    for (int i=0; i<M; i++) cin >> B.at(i);

    int ans=0;

    for (int i=0; i<N; i++){
        vector<int> A(M);
        int count=C;
        for (int j=0; j<M; j++) {
            cin >> A.at(j);
            count += (A.at(j) * B.at(j));
            //cout << "count=" << count << endl;
        }
        if (count>0) ans++;
        //cout << count << endl;
    }

    cout << ans << endl;

}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp(26) ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  int A,B,C;cin>>A>>B>>C;
  if(A==B)cout<<C<<endl;
  else if(A==C)cout<<B<<endl;
  else cout<<A<<endl;
    
}







Measured memory_bytes: 256
num = []
i=0
roop = gets.to_i

while i<roop
      a = gets
      num = []
      num = a.split(nil)
      num = num.map{ |n| n.to_i}
      num.sort!

      if (num[2]**2) == ((num[1]**2)+(num[0]**2))
         puts "YES"
      else
        puts "NO"
      end

      i+=1
end

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

int main() {
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
    int p = 0;
    char ans;
    while (true) {
        //cout << p << endl;
        if (p == 0) {
            if (sa.size() == 0) {
                ans = 'A';
                break;
            }
            p = sa[0] - 'a';
            sa.erase(sa.begin());
            
        } else if (p == 1) {
            if (sb.size() == 0) {
                ans = 'B';
                break;
            }
            p = sb[0] - 'a';
            sb.erase(sb.begin());
            
        } else {
            
            if (sc.size() == 0) {
                ans = 'C';
                break;
            }
            p = sc[0] - 'a';
            sc.erase(sc.begin());
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
//#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n;
    cin>>n;
    string x;
    cin>>x;
    int a[10] = {0} , b[10] = {0};
    for(auto i : x){
        b[i-'0']++;
    }
    a[x[0] - '0']++;
    b[x[0] - '0']--;
    bool match[1000] = {false};
    for(int i = 1 ; i < n - 1; i++){
        b[x[i] - '0']--;

        for(int ii = 0 ; ii < 10 ; ii++){
            for(int kk = 0 ; kk < 10 ; kk++){
                int jj = x[i] - '0';
                if(a[ii] != 0 && b[kk] != 0 && !match[ii * 100 + jj * 10 + kk] ){
                    match[ii * 100 + jj * 10 + kk] = true;
                }
            }
        }
        a[x[i] - '0']++;
    }
    int c = 0;
    for(int i = 0 ; i< 1000 ; i++){
        if(match[i])
            c++;
    }
    cout<<c<<endl;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll n;
  cin >> n;
  vector<ll> h(n);
  for(i = 0; i < n; i++)
    cin >> h[i];
  ll result = 0;
  ll max = 0;
  for(i = 0; i < n; i++)
    if(max <= h[i]){
      result++;
      max = h[i];
    }
  
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
s = input()
for i in range(len(s)-1):
    s1 = s[i]
    s2 = s[i+1]
    s3 = s[i+2] if i != len(s) - 2 else "?"
    if s1 == s2:
        print(i+1, i+2)
        exit()
    elif s2 == s3:
        print(i+2, i+3)
        exit()
    elif s1 == s3:
        print(i+1, i+3)
        exit()
    else:
        continue
print('-1 -1')


Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
int gcd(int a, int b);


signed main()
{
    Int(p);
    Int(q);

    while (p && q) {
        int base = gcd(p, q);
        q /= base;
        for (int i = 2; i * i <= q; i++) {
            if (!(q % i)) {
                int ret = q / i;
                while (!(ret % i)) {
                    q /= i;
                    ret /= i;
                }
            }
        }
        cout << q << endl;
        p = 0; q = 0;
    }

    return 0;
}

int gcd(int a, int b)
{
    if (!b) {
        return a;
    } else {
        gcd(b, a%b);
    }
}

Measured memory_bytes: 3240
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
template<typename T> inline void add(T& a, T b) { a += b; if (a >= MOD) a -= MOD; }

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

  int a,b,c; cin >> a >> b >> c;
  if(a + b + c >= 22) {
    cout << "bust" << endl;
  } else {
    cout << "win" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  int s; std::cin >> s;
  std::unordered_map<int, int> L;

  auto f = [] (int n) { if ( n % 2  == 0 ) return n/2; else return 3*n+1; };
  int next = s; L[next] = 1;
  int i = 1;
  while(1) {
    i++;
    next = f(next);
    if ( L.count(next) == 0 ) L[next] = 1;
    else {
      std::cout << i << std::endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

template<typename type> vector<type> divisor(type n)
{
    vector<type> res;
    for(type i = 1; i * i <= n; i++)
    {
        if(n % i == 0)
        {
            res.push_back(i);
            if(i * i != n) res.push_back(n / i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

void solve()
{
    int a, b, k; cin >> a >> b >> k;

    int cnt = 0;
    vector<int> ans;
    for(int i = 1; i <= __gcd(a, b); i++)
    {
        if(a % i == 0 && b % i == 0) ans.push_back(i);
    }
    sort(ans.rbegin(), ans.rend());
    cout << ans[k - 1] << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
ans = 0
d = [set() for _ in range(3)]
for i in range(N - 2):
    if S[i] in d[0]:
        continue
    d[0].add(S[i])
    for j in range(i + 1, N - 1):
        if S[i] + S[j] in d[1]:
            continue
        d[1].add(S[i] + S[j])
        for k in range(j + 1, N):
            if S[i] + S[j] + S[k] in d[2]:
                continue
            d[2].add(S[i] + S[j] + S[k])
            ans += 1
print(ans)


Measured memory_bytes: 3188
//解答AC
#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>;
#define chmax(x,y) x = max(x,y)

const ll INF = 1e18;

ll dp[200005][4];

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int k = 1+n%2;
  rep(i,n+1)rep(j,k+1) dp[i][j] = -INF;
  dp[0][0] = 0;
  rep(i,n) {
    rep(j,k+1) {
      chmax(dp[i+1][j+1], dp[i][j]);
      ll now = dp[i][j];
      if ((i+j)%2 == 0) now += a[i];
      chmax(dp[i+1][j], now);
    }
  }
  ll ans = dp[n][k];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10376
#include <iostream>
#include <cmath>

int main(int argc, char* argv[])
{
    int a, b;
    std::cin >> a;
    std::cin >> b;

    if (a < b)
        std::cout << "a < b" << std::endl;

    if (a > b)
        std::cout << "a > b" << std::endl;

    if (a == b)
        std::cout << "a == b" << std::endl;

    return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int arr[100005];
int arr2[100005];
int main()
{
    int n,i,j,k,l,m,o,p,b,c,d,min1=0;
    cin>>m;
    cin>>n;
    for(i=0; i<m; i++)
        cin>>arr[i];
    sort(arr,arr+m);
    min1=arr[n-1]-arr[0];
    for(i=1; i<m; i++)
    {if(i+n-1>=m) continue;
j=arr[i+n-1]-arr[i];
if(j<min1) min1=j;
    }
    cout<<min1<<"\n";
    return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int mod[2019];

int main() {
  std::string S; std::cin >> S;
  std::fill_n(mod, 2019, 0);
  int v = 0, k = 1; ++mod[0];
  for(int i = S.size()-1; i >= 0; --i) {
    (v += k*(S[i]-'0')) %= 2019;
    ++mod[v];
    (k *= 10) %= 2019;
  }
  int64_t ans = 0;
  for(int i = 0; i < 2019; ++i) ans += (int64_t)mod[i]*(mod[i]-1)/2;
  fin(ans);
  return 0;
}


Measured memory_bytes: 3964
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<stdlib.h>
#define rep(i,s,t) for (i=s;i<=t;i++)
using namespace std;
double a[30][3];
bool vis[30];
int i,j,m,n,k,l,o,p;
double ans,temp;
inline double sqr(double x)
{
	return x*x;
}
inline double dist(int x,int y)
{
	return (sqr(a[x][0]-a[y][0])+sqr(a[x][1]-a[y][1])+sqr(a[x][2]-a[y][2]));
}
void dfs(int k,int s)
{
	if (s == m)
	{
		if (ans < temp) ans = temp;
		return;
	}
	if (k > n) return;
	double st;
	int i;
	rep(i,k,n)
	{
		vis[i] = true;
		st = temp;
		rep(j,1,i-1) if (vis[j]) temp+=dist(i,j);
		dfs(i+1,s+1);
		temp = st;
		vis[i] = false;
	}
	dfs(i+1,s);
}
int main()
{
	while (scanf("%d%d",&n,&m) != EOF)
	{
	
	rep(i,1,n) scanf("%lf%lf%lf",&a[i][0],&a[i][1],&a[i][2]);
	ans = 0;
	temp = 0;
	dfs(1,0);
	printf("%.20f\n",ans);
	}
	return 0;
}

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

#define REP(i, n) for((i) = 0; (i) < (n); (i)++)
#define READ1(n1) scanf("%d", &(n1))
#define READ2(n1, n2) scanf("%d%d", &(n1), &(n2))
#define READ3(n1, n2, n3) scanf("%d%d%d", &(n1), &(n2), &(n3))
#define P1(n1) printf("%d\n", (n1))
#define P2(n1, n2) printf("%d, %d\n", (n1), (n2))
#define P3(n1, n2, n3) printf("%d, %d, %d\n", (n1), (n2), (n3))
#define CLEAR(p) memset((p), 0, sizeof((p)))
#define MAX_WIDTH 50
#define MAX_HEIGHT 50
#define MAX_ITEMS 8

typedef struct {
	int x1, y1, x2, y2;
	char c;
	int overlay[MAX_ITEMS];
} item_t;

item_t items[MAX_ITEMS];
int item_num;

char image[MAX_HEIGHT][MAX_WIDTH+1];

int put_item_under(int a, int b) {
	//Insert a under b
	int i;
	if(items[b].overlay[a] > 0) {
		return -1;
	}
	items[b].overlay[a] = -1;
	items[a].overlay[b] = 1;
	REP(i, item_num) {
		if(items[b].overlay[i] > 0) {
			if(put_item_under(a, i) < 0) {
				return -1;
			}
		}
	}
	return 0;
}

int put_item_above(int a, int b) {
	//Insert a above b
	int i;
	if(items[b].overlay[a] < 0) {
		return -1;
	}
	items[b].overlay[a] = 1;
	REP(i, item_num) {
		if(items[b].overlay[i] < 0) {
			if(put_item_above(a, i) < 0) {
				return -1;
			}
		}
	}
	return 0;
}

main()
{
	int i, j, k, x, y, data_num;

	READ1(data_num);

	REP(i, data_num) {
		int width, height;

		READ2(height, width);

		REP(j, height) {
			scanf("%s", image[j]);
		}

		item_num = 0;

		REP(y, height) {
			REP(x, width) {
				REP(j, item_num) {
					if(items[j].c == image[y][x]) {
						if(x > items[j].x2) items[j].x2 = x;
						if(x < items[j].x1) items[j].x1 = x;
						if(y > items[j].y2) items[j].y2 = y;
						if(y < items[j].y1) items[j].y1 = y;
						break;
					}
				}
				if(j == item_num) {
					items[item_num].x1 = x;
					items[item_num].x2 = x;
					items[item_num].y1 = y;
					items[item_num].y2 = y;
					items[item_num].c = image[y][x];
					item_num++;
				}
			}
		}

		REP(j, item_num) {
			CLEAR(items[j].overlay);
		}

		/*REP(j, item_num) {
			printf("%c: (%d, %d) - (%d, %d)\n", items[j].c, items[j].x1, items[j].y1, items[j].x2, items[j].y2);
		}*/

		REP(j, item_num) {
			for(x = items[j].x1; x <= items[j].x2; x++) {
				for(y = items[j].y1; y <= items[j].y2; y++) {
					if(image[y][x] != items[j].c) {
						REP(k, item_num) {
							if(items[k].c == image[y][x]) {
								if(put_item_under(j, k) < 0) {
									goto suspicious;
								}
							}
						}
					}
				}
			}
		}
		printf("SAFE\n");
		continue;
	suspicious:
		printf("SUSPICIOUS\n");
	}

	return 0;
}

Measured memory_bytes: 584
#pragma GCC optimize("O3")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>ll(b);i--)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
#define INF 1000000000000 
#define MOD 1000000007 
#define MAXR 100000 
#define PB push_back 
#define MP make_pair 
#define F first 
#define S second 
#define Umap unordered_map
#define Uset unordered_set


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

    int X, N;
    cin >> X >> N;;
    vector<int> P(N);
    REP(i, N) cin >> P[i];

    int diff = 0;
    while (true) {
        vector<int> diff_list(2);
        diff_list[0] = -diff;
        diff_list[1] = diff;

        REP(j, 2) {
            int a = X + diff_list[j];
            bool flag = true;
            REP(i, N) {
                if (a == P[i]) {
                    flag = false; 
                    break;
                }
            }
            if (flag) {
                cout << a << endl;
                return 0;
            }

        }
        diff++;
    }

    return 0;
}

Measured memory_bytes: 3596
from sys import stdin
a = stdin.readline().strip()
b = stdin.readline().strip()
c = stdin.readline().strip()
in1 =in2 = in3 = 0
tu = 0
ans = ''
while True:
    x = 0
    #print "current turn",tu,in1,in2,in3
    if tu==0:
        if in1==len(a):
            ans = 'A'
            break
        x = a[in1]
        in1+=1
        
    elif tu==1:
        if in2==len(b):
            ans = 'B'
            break
        x = b[in2]
        in2+=1
        
    else:
        if in3==len(c):
            ans = 'C'
            break
        x = c[in3]
        in3+=1
        
    #print "at turn",tu,"character ",x
    if x=='a':
        tu = 0
    elif x=='b':
        tu = 1
    else:
        tu = 2
print ans        
           

Measured memory_bytes: 2696
#include <iostream>
#include <algorithm>

using namespace std;

const int MAX_N = 1e5 + 5;

int arr [MAX_N];

void win () {
  cout << "First" << endl;
  exit(0);
}

void lose () {
  cout << "Second" << endl;
  exit(0);
}

int main () {
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }

  sort(arr + 1, arr + n + 1, greater<int>());

  arr[n + 1] = -5;
  for (int i = 1; true; i++) {
    if (i + 1 > arr[i + 1]) {
      int upd = arr[i] - i;
      int rgd = 0;
      for (int k = 1; true; k++) {
        if (i == arr[i + k]) rgd++;
        else break;
      }

      if (upd % 2 == 1 || rgd % 2 == 1) win();
      lose();
    }
  }
}


Measured memory_bytes: 4016
import java.util.*;

/**
 * Copyright © 2018 Chris. All rights reserved.
 *
 * @author Chris
 * 2018/7/5 22:51
 */
public class Main {

    final static int MOD = 1000000007;
    static Scanner sc;

    private static int comb(int n, int m) {
        return 1;
    }

    static void getDiv(Map<Integer, Integer> map, int n) {
        int sqrt = (int) Math.sqrt(n);
        for (int i = sqrt; i >= 2; i--) {
            if (n % i == 0) {
                getDiv(map, i);
                getDiv(map, n / i);
                return;
            }
        }
        map.put(n, map.getOrDefault(n, 0) + 1);
    }

    @SuppressWarnings("unchecked")
    private static void solve() {
        System.out.println(nextInt() + (nextInt() / 2));
    }

    static long gcd(long a, long b) {
        if (a < b) {
            a ^= b;
            b ^= a;
            a ^= b;
        }
        while (b != 0) {
            long tmp = a % b;
            a = b;
            b = tmp;
        }
        return a;
    }

    public static void main(String args[]) {
        sc = new Scanner(System.in);
        solve();
    }

    private static int nextInt() {
        return sc.nextInt();
    }

    private static long nextLong() {
        return sc.nextLong();
    }

    private static String next() {
        return sc.next();
    }

    private static double nextDouble() {
        return sc.nextDouble();
    }
}

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

const long long MAX_P = 200001;
const long long MOD = 1000000007;

// 入力はすべて正とする
// 素数判定O(√n)
bool is_prime(long long n) {
	for (long long i = 2; i * i <= n; i++) {
		if (n % i == 0) return false;
	}
	return n != 1; // 1の場合は例外
}
// 約数の列挙O(√n)
vector<long long> divisor(long long n) {
	vector<long long> res;
	for (long long i = 1; i * i <= n; i++) {
  	if (n % i == 0) {
			res.push_back(i);
			if (i != n / i) res.push_back(n / i);
		}
	}
	return res;
}
// 素因数分解O(√n)
map<long long, long long> prime_factor(long long n) {
	map<long long, long long> res;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

long long extgcd(long long a, long long b, long long& x, long long& y) {
	long long d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else {
		x = 1; y = 0;
	}
	return d;
}

long long mod_inverse(long long a, long long m) {
	long long x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

long long fact[MAX_P+1];
// n! mod pのテーブルを作る O(p)
void mod_fact(long long n, long long m) {
	fact[0] = 1;
	for (long long i = 1; i <= n; i++) fact[i] = fact[i-1]*i%m;
}

// n!=a p^e としたときのa mod pを求める。O(log_p n)
long long mod_fact(long long n, long long p, long long& e) {
	e = 0;
	if (n == 0) return 1;
	// pの倍数の部分を計算
	long long res = mod_fact(n / p, p, e);
	e += n / p;
	// (p-1)!≡-1なので(p-1)!^(n/p)はn/pの偶奇だけで計算できる
	if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
	return res * fact[n % p] % p;
}

// nCk mod pを求める。O(log_p n)
long long mod_comb(long long n, long long k, long long p) {
	if (n < 0 || k < 0 || n < k) return 0;
	long long e1, e2, e3;
	long long a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n - k, p, e3);
	//if (a1 * mod_inverse(a2 * a3 % p, p) % p == 0) printf("%lld, %lld, %lld,%lld, %lld, %lld\n",n, p, e1,a1, a2, a3);
	if (e1 > e2 + e3) return 0;
	return a1 * mod_inverse(a2 * a3 % p, p) % p;
}


void solve(long long N, long long M){
	map<long long, long long> factorM = prime_factor(M);
	long long res = 1;
	mod_fact(MAX_P,MOD);
	for (auto x : factorM){
		//if (mod_comb(N-1+x.second,x.second,MOD) == 0) printf("%lld, %lld\n",x.first, x.second);
    if (x.second > 0) res = res*mod_comb(N-1+x.second,x.second,MOD)%MOD;
  }

	printf("%lld\n", res);
}

int main(){
	long long N;
	long long M;
	scanf("%lld",&N);
	scanf("%lld",&M);
	solve(N, M);
	return 0;
}


Measured memory_bytes: 1792
N, M = map(int, input().split())
l1=[False]*(N+1)
l2=[False]*(N+1)


for i in range(M):
    a, b = map(int, input().split())
    if a==1:
        l1[b]=True
    elif b==N:
        l2[a]=True
        
fl=False
for i in range(N):
    if l1[i] and l2[i]:
        fl=True
    
if fl:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 6132
//
// Created by maze on 2019/09/15.
//

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

#define INF_LL (int64)1e18
#define INF (int64)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a); i < (b); i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int32_t;
using int64 = int64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

int main(void) {
    int64 N, M;
    cin >> N >> M;
    priority_queue<int64> pq;
    REP(i, N) {
        int64 A;
        cin >> A;
        pq.push(A);
    }
    REP(i, M) {
        pq.push(pq.top()/2); pq.pop();
    }
    int64 res = 0;
    while (pq.size()) {
        res += pq.top(); pq.pop();
    }
    cout << res << endl;
}


Measured memory_bytes: 1400
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N=int(input())
A=list(map(int,input().split()))
MOD=(10**9)+7
S=list(set(A))
LCM=lcm_list(S)
ans=0

for i in range(N):
    ans+=(LCM//A[i])


print(ans%MOD)


Measured memory_bytes: 6492
#include <iostream>
#include <iomanip>
#include <cassert>

#include <utility>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;

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

constexpr int INF = numeric_limits<int>::max();

void Main()
{
	int N, M;
	cin >> N >> M;

	vector<int> EC(N, 0);
	rep(i, M)
	{
		int a, b;
		cin >> a >> b;
		--a; --b;

		++EC[a];
		++EC[b];
	}

	rep(i, N)
	{
		cout << EC[i] << endl;
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=2e3+5;
const int mod=1e9+7;
typedef long long ll;
ll fac[maxn],inv[maxn];
inline ll fpm(ll a,ll p){
	ll res=1;
	while(p){
		if (p&1) res=res*a%mod;
		a=a*a%mod;
		p/=2;
	}
	return res;
}
inline void init(){
	inv[0]=fac[0]=1;
	for (int i=1;i<=2e3;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=fpm(fac[i],mod-2);
	}
}
inline ll c(ll n,ll m){
	if (n<m||n<0||m<0) return 0;
	else return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main(){
	int n;
	cin>>n;
	init();
	ll ans=0;
	for (int i=1;i*3<=n;i++){
		ll tp=n-i*3;
		ans=(ans+c(tp+i-1,i-1))%mod;
	}
	cout<<ans<<endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

int f(int N)
{
	N++;
	int cnt = 0;
	int tN = N;
	while (tN != 0)
	{
		cnt++;
		tN /= 10;
	}
	tN = N;
	int p = tN % 10;
	int b = 10;
	rep(i, 0, cnt)
	{
		int d = tN % 10;
		if (abs(p - d) > 1)
		{
			if (d == 9)
			{
				p = d;
				int tb = b / 10;
				N = N / b * b;
				rrep(j, 0, i + 1)
				{
					N += d * tb;
					d = max(d - 1, 0LL);
					tb /= 10;
				}
			}
			else
			{
				d++;
				p = d;
				int tb = b / 10;
				N = N / b * b;
				rrep(j, 0, i + 1)
				{
					N += d * tb;
					d = max(d - 1, 0LL);
					tb /= 10;
				}
			}
		}
		else
		{
			p = d;
		}
		b *= 10;
		tN /= 10;
	}
	return N;
}

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

	int K;
	cin >> K;
	int ans = 0;
	rep(i, 0, K)
	{
		ans = f(ans);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
/*#ifndef ONLINE_JUDGE
	freopen("output.out", "w", stdout);
	freopen("input.in", "r", stdin);
#endif
	#ifdef ONLINE_JUDGE
	//freopen("output.txt", "w", stdout);
	freopen("path.in", "r", stdin);
	#endif*/
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e3 + 15;
int dx[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 0, -1, 1, -1, 1, 1, -1 };

int main()
{
	fast();
	string s;
	cin >> s;
	string arr[] = { "Sunny", "Cloudy", "Rainy" };
	int idx = find(arr, arr + 2, s) - arr;
	cout << arr[(idx + 1) % 3] << endl;
	return 0;
}

Measured memory_bytes: 256