akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define P(x) cout << x << endl
#define D(x) P(#x << ": " << x)
#define F(i,n) for (int i=0; i<(int)(n); i++)
#define DEC(i,n) for (int i=(int)(n); --i>=0;)
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;
void MI(int &a, int v) {a = min(a,v);}
void MA(int &a, int v) {a = max(a,v);}
const int N=2e5, MOD=1e9+7, INF=1e12;

void euclid(int a, int b, int &x, int &y, int &d) {
    if (b == 0) {x=1, y=0, d=a; return;}
    euclid(b, a%b, x, y, d);
    x -= a/b*y; swap(x,y);
}

int inv(int a, int b) { // of a modulo b
    int x,y,d; euclid(a,b,x,y,d);
    return (x%b+b)%b;
}

signed main() {
    int n,x,y; cin>>n>>x>>y;
    array<int,N> mi; mi.fill(INF);
    vector<int> ofc[n];
    int mimi=INF, mimi2=INF;
    F(i,n) {
        int w,c; cin>>c>>w;
        c--;
        ofc[c].pb(w);
        MI(mi[c], w);
    }
    F(c,n) {
        if (mi[c] < mimi) {
            mimi2 = mimi;
            mimi = mi[c];
        } else if (mi[c] < mimi2) {
            mimi2 = mi[c];
        }
    }
    //D(mimi), D(mimi2);
    //D(unique);
    vector<int> mults;
    F(c,n) {
        int direct=0, indirect=0;
        int ext = (mi[c] == mimi) ? mimi2 : mimi;
        for (int w : ofc[c]) {
            if (ext+w <= y)
                direct++;
            if (mi[c]+w <= x)
                indirect++;
        }
        if (direct > 0)
            MA(direct, indirect);
        mults.pb(direct);
    }
    int sum=0, res=1;
    for (int mult : mults) {
        //if (mult) D(mult);
        F(i,mult) {
            sum++;
            res = (res*sum)%MOD;
            res = (res*inv(mult-i,MOD))%MOD;
        }
    }
    P(res);
}

Measured memory_bytes: 13300
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d;
  
  cin>>a >>b >> c>> d;
  if(a+b < c+d){
  	cout<<"Right"<<endl;}
  if(a+b == c+d){
  	cout<<"Balanced"<<endl;}
  if(a+b > c+d){
  	cout<<"Left"<<endl;}
  
}

Measured memory_bytes: 3572
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	string s;
	cin >> s;
	int cnt[2]={0, 0};
	for(int i = 0; i < s.size(); i++) {
		cnt[s[i]-'A']++;
	}
	cout << (cnt[0]&&cnt[1] ? "Yes": "No");

	return 0;
}


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

using namespace std;

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	cout << max(A * B, C * D) << endl;;
	return 0;
}

Measured memory_bytes: 3588
#pragma GCC optimize("Ofast", "unroll-loops")

// #define TEST

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

const ll mod = 1000000007LL;

int main() {
	int N, K; cin >> N >> K;
	ll res = 0;
	for (int i = K; i <= N + 1; ++i) {
		ll small = ((ll)i - 1LL) * i / 2;
		ll largest = N * (ll)i - small;
		res += (largest - small + 1);
		res %= mod;
	}
	cout << res << endl;

	return 0;
}

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

int main(){
  string s,t;
  cin >> s >> t;
  int cnt = 0;
  if(s[0] == t[0]) cnt++;
  if(s[1] == t[1]) cnt++;
  if(s[2] == t[2]) cnt++;
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include<vector>
#include <algorithm>
#include <utility>
#include<stack>
#include<queue>
#include<map>
#include <fstream>
#include<set>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long


    /// 17 35
    int inf=1e9;
    int a[200010],pos[200010];

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

       int n;
       cin>>n;
       for(int i=0;i<n;i++){
        cin>>a[i];
        pos[ a[i] ]=i;
       }
    pos[0]=pos[n+1]=inf;
    int res=inf;
    int len=1,maxlen=0;
    for(int i=n;i>0;i--){
        if( pos[i] < pos[i-1] ){
            maxlen=max( maxlen,len );
            len=0;
        }
        len++;
    }
    for( int i=1;i<=n;i++ ){
        if( pos[i+1]<pos[i] ){
            maxlen=max(maxlen,len);
            len=0;
        }
        len++;
    }

    cout<<n-maxlen<<endl;

    return 0;
    }





















Measured memory_bytes: 1792
import java.util.*;
 
public class Main {
	
    public static void main( String args[] ) {
        Scanner scan = new Scanner( System.in );

        int n = scan.nextInt();
		int m = scan.nextInt();
		int l = scan.nextInt();
		
		
		int[][] vecA = new int[n][m];
		int[][] vecB = new int[m][l];
		
		// input
		for( int i = 0; i < n; i++ ) {
			for( int j = 0; j < m; j++ ) {
				vecA[i][j] = scan.nextInt();
				
			}
		}
		
		for( int i = 0; i < m; i++ ) {
			for( int j = 0; j < l; j++ ) {
				vecB[i][j] = scan.nextInt();
				
			}
		}
		
		int[][] vecC = new int[n][l];
		for( int i = 0; i < n; i++ ) {
			for( int k = 0; k < l; k++ ) {
				long sum = 0;
				
				for( int j = 0; j < m; j++ ) {
					sum += vecA[i][j] * vecB[j][k];
					
				}
				
				System.out.print((k == 0 ? "" : " ") + sum);
				
			}
			System.out.println();
		}
		
	}
}

Measured memory_bytes: 44704
#include<vector>
#include <iostream>
#include<string>
#include <complex>
#include <algorithm>
#include<string>
#include <map>
#include <utility>

using namespace std;


int main(){
    int n;
     cin >> n;
     vector<string> s(n);

     string pre = "";
     string now = "";

     bool flag = true;
     
     for(int i = 0 ; i < n; i++){
         cin >> s[i];
         now = s[i];
         if(i != 0 ){

             if(now[0] != pre[pre.length()-1]){
                 flag = false;
                 //cout << "a";
             }
         }
         pre = now;

     }


     for(int i = 0; i < n; i++){
         if(count(s.begin(), s.end(), s[i]) > 1){
             flag = false;
         }
     }


     if(flag){
         cout << "Yes" << endl;
     }else{
         cout << "No" << endl;
     }

}

Measured memory_bytes: 3628
def cmb(n, r):
    if n - r < r:
      r = n - r
    if r == 0: 
      return 1
    if r == 1: 
      return n
    numerator = [] 
    mod = 10**9+7
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result %= mod

    return result
def power_func(a,n,p):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res
n, a, b = map(int, input().split())
mod = 10**9+7
ALL = power_func(2,n,mod)-1
A = cmb(n,a)
B = cmb(n, b)
ans = ALL-A-B
while ans < 0:
  ans = mod + ans
print(ans)


Measured memory_bytes: 27700
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <ctype.h>
#include <iomanip>
#include <limits>

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 1000000000;

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; }

using namespace std;

int main() {
	double a, b, x, theta;
	cin >> a >> b >> x;

	if (x > a * a * b / 2) {
		theta = atan(2 * (a * a * b - x) / (a * a * a));
	}
	else {
		theta = atan((a * b * b) / (2 * x));
	}

	double PI = 3.14159265358979;
	theta = theta * (180 / PI);
	cout << fixed << setprecision(10) << theta << endl;

}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  int l=0;
  int r=N/2+1;
  while(r-l>1){
    int c=(r+l)/2;
    bool f=false;
    REP(s,N-2*c+1){
      auto subS=S.substr(s+c,N);
      auto itr=subS.find(S.substr(s,c));
      // cerr<<S.substr(s,c)<<endl;
      // cerr<<subS<<endl;
      if(itr!=string::npos){
        f=true;
        break;
      }
    }
    if(!f)r=c;
    else l=c;
  }
  cout<<l<<endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))

ll solve(ll m, vector<ll> &v, int n)
{
    ll brojac = 0;

    for(int i = 0; i < n; i++)
    {
        if(v[i] >= 0)
        {
            int l = i + 1, r = n - 1;
            int resenje = i;

            while(l <= r)
            {
                int mid = l + (r - l) / 2;

                if((ll)v[mid] * v[i] <= m)
                {
                    l = mid + 1;
                    resenje = mid;
                }

                else
                {
                    r = mid - 1;
                }
            }

            brojac += (ll)resenje - (ll)i;
        }

        else
        {
            int l = i + 1, r = n - 1;
            int resenje = n;

            while(l <= r)
            {
                int mid = l + (r - l) / 2;

                if((ll)v[i] * v[mid] <= m)
                {
                    resenje = mid;
                    r = mid - 1;
                }

                else
                {
                    l = mid + 1;
                }
            }

            brojac += (ll)n - (ll)resenje;
        }
    }

    return brojac;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    ll n, k;
    cin >> n >> k;
    vector<ll> v(n);

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

    sort(all(v));

    ll l = -1000000000LL * 1000000000LL;
    ll r = -l;
    ll resenje = r;

    while(l <= r)
    {
        ll m = l + (r - l) / 2;

        if(solve(m, v, n) >= k)
        {
            resenje = m;
            r = m - 1;
        }

        else
        {
            l = m + 1;
        }
    }

    cout << resenje << '\n';

    return 0;
}


Measured memory_bytes: 1792
class Node():
  def __init__(self, parent = -1, left = -1, right = -1):
    self.parent = parent
    self.left = left
    self.right = right

def preorder(ns,i):
  print(' '+ str(i), end="")
  if ns[i].left != -1:
    preorder(ns, ns[i].left)
  if ns[i].right != -1:
    preorder(ns, ns[i].right)

def inorder(ns,i):
  if ns[i].left != -1:
    inorder(ns, ns[i].left)
  print(' '+ str(i), end="")
  if ns[i].right != -1:
    inorder(ns, ns[i].right)

def postorder(ns, i):
  if ns[i].left != -1:
    postorder(ns, ns[i].left)
  if ns[i].right != -1:
    postorder(ns, ns[i].right)
  print(' '+ str(i), end="")

n = int(input())
ns = [Node() for i in range(n)]
for i in range(n):
  p, l, r = map(int, input().split())
  if l != -1:
    ns[p].left = l
    ns[l].parent = p
  if r != -1:
    ns[p].right = r
    ns[r].parent = p

for i in range(n):
  if ns[i].parent == -1:
    print("Preorder")
    preorder(ns, i)
    print()
    print("Inorder")
    inorder(ns, i)
    print()
    print("Postorder")
    postorder(ns, i)
    print()



Measured memory_bytes: 5616
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define endl '\n'
using namespace std;
ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}
int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input4.txt", "r", stdin);
    //freopen("output4.txt", "w", stdout);
   string s;
   cin>>s;
   if(s=="Rainy")
    cout<<"Sunny"<<endl;
   else if(s=="Cloudy")
    cout<<"Rainy"<<endl;
   else
    cout<<"Cloudy"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<complex>
#include<bitset>
#include <list>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

list<int> li;
int N;
int b[110];

signed main() {
    cin >> N;
    rep(i, N) {
        cin >> b[i];
    }
    for (int k = 1; k <= N; ++k) {
        int cnt = 0;
        for (int i = N - 1; i >= 0; --i) {
            if (b[i] <= k)++cnt;
            if (b[i] == k) {
                auto iter = li.begin();
                //cerr << k - 2 + cnt << endl;
                rep(a, k - 2 + cnt) {
                    if (iter != li.end())
                        ++iter;
                    else {
                        cout << -1 << endl;
                        return 0;
                    }
                }
                li.insert(iter, k);
            }
        }
    }
    for (int x:li) {
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    N = int(input())
    A_list = list(map(int, input().split()))

    sum_x = sum(A_list)//2
    x1 = sum_x
    for i in range(2, N, 2):
        x1 -= A_list[i-1]

    x_list = [-1] * N
    x_list[0] = x1
    for i in range(N-1):
        x_list[i+1] = A_list[i] - x_list[i]

    answer = ' '.join([str(2*x) for x in x_list])
    print(answer)

Measured memory_bytes: 19224
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll x = 0;
    ll ans = 0 ;
    string s;
    ll n;cin>>n;
    cin >> s;
    rp(i,s.length()){
        if(s[i] == 'D') x--;
        if(s[i] == 'I') x++;
        ans = max(x,ans);
    }
    cout << ans << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
fun main(args: Array<String>) {
  val N = readInt()
  val abList = (2..N).map { readInts() }
  val graph = Graph()
  abList.forEach { graph.addEdge(it[0], it[1]) }
  val resultMap = mutableMapOf<Pair<Int, Int>, Int>()

  var maxNum = 0

  fun search(i: Int, from: Int, fromNum: Int) {
    val edgeSet = graph.nodeMap[i]!!.edgeList
    var num = 1
    edgeSet.forEach { j ->
      if (j == from) return@forEach
      val a = Math.min(i, j)
      val b = Math.max(i, j)
      if (num == fromNum) num++
      resultMap[a to b] = num
      search(j, i, num)
      if (maxNum < num) maxNum = num
      num++
    }
  }
  search(1, 0, 0)
  println(maxNum)
  abList.forEach {
    println(resultMap[it[0] to it[1]])
  }
}

fun readString() = readLine()!!
fun readStrings() = readString().split(' ')
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }


class Node {
  //  val edgeSet = mutableSetOf<Int>()
  val edgeList = mutableListOf<Int>()
}

class Graph {
  val nodeMap = mutableMapOf<Int, Node>()
  fun addEdge(a: Int, b: Int) {
    val nodeA = nodeMap.getOrPut(a) { Node() }
    val nodeB = nodeMap.getOrPut(b) { Node() }
    nodeA.edgeList.add(b)
    nodeB.edgeList.add(a)
  }
}


Measured memory_bytes: 111656
/*
 * atcoder/abc140/e.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


/*
 * 区間の最大値から2番目を準最大値と呼ぶことにする.
 * 区間を列挙するとO(N^2)かかるので、N-1個ある準最大値を１つずつxに固定した時に、
 * それを満たす区間のうち作れるものの組み合わせ数を数える.
 *
 * 順列Pの大きい方からx =（N-1, N-2, ..., 2, 1)見ていき、
 * すでにチェック済み集合Xをもっておくと、Xにはxよりも大きいもののみの集合になる.
 * xが準最大値とすると、自身より左右どちらかにちょうど1つXの要素を含み、
 * その反対サイドには１つも含まない組み合わせ.
 * 左右２つの和.
 */
#include <set>
const int k = 2;
void solve() {
  int n;
  cin >> n;
  vector<int> A(n);
  vector<int> idx(n);
  loop(i,0,n) {
    cin >> A[i];
    A[i]--;
    idx[A[i]] = i;
  }

  set<int> S;
  ll total = 0;
  for (int x=n-1; x>=0; x--) {
    int i = idx[x]; // oooxooooxoooioooxooxoox
    ll com = 0; // 組み合わせ
    {
      S.insert(i);
      vector<ll> ls(k, -1); // xよりも左にある大きい整数のインデックス. 大きい整数が無ければ距離をとった時に正しい値になるように-1
      vector<ll> rs(k, n); // xよりも右にある
      {
        // 左
        auto iter = S.find(i);
        loop(j,0,k) {
          if (iter == S.begin()) break; // begin=0, それより左のインデックスはない.
          iter--;
          ls[j] = *iter;
        }
      }
      {
        // 右
        auto iter = S.find(i);
        loop(j,0,k) {
          iter++;
          if (iter == S.end()) break; // end=n, それより左のインデックスはない.
          rs[j] = *iter;
        }
      }

      /*
       *    ls1  ls0     rs0  rs1
       * oooxooooxoooioooxooxoox
       *     -----
       *          ----
       *             ----
       *                 ---
       */
      // 自分より大きいのが左にある区間の数
      com += abs(ls[0]-ls[1]) * abs(rs[0] - i);
      // 自分より大きいのが右に
      com += abs(rs[1]-rs[0]) * abs(ls[0] - i);
    }
    total += com * (x+1);
  }

  cout << total << endl;
}


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

bool is_prime(int x, vector<int>& primes) {
    for (int p : primes) {
        if (x%p == 0) return false;
    }
    primes.push_back(x);
    return true;
}

int solve(int x) {
    if (x == 2) return 2;
    vector<int> primes = {2};
    int y = 3;
    while (!(is_prime(y, primes) && y >= x)) {
        y += 1;
    }
    return y;
}

int main () {
    int x; 
    cin >> x;
    cout << solve(x) << endl;
    return 0;
}

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

using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;

int32_t main() {
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall


        
    ini(n);
    ini(n1);
    ini(n2);
    out(n2,n,n1);
    
    


    return 0;
}


Measured memory_bytes: 256
// #includes {{{
#include <bits/stdc++.h>
using namespace std;
// }}}
// pre-written code {{{
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
 
#define EXIST(e,s) ((s).find(e)!=(s).end())
 
#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;
 
const int INF=0x3f3f3f3f;
 
typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;
 
typedef pair<int,int> pii;
 
/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}
 
int N;
 
int main(){
	map<int,int> a;
	cin>>N;
	REP(i,N){
		int t;
		cin>>t;
		a[t]++;
	}
	map<int,int> b;
	for(auto &t:a)b[t.second%2]++;
	int ans = b[1]+b[0];
	if(b[0]%2==1)ans--;
	cout<<ans<<endl;
}



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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int ans = 0;
    int L, R, d; cin >> L >> R >> d;
    for(int i = L; i <= R; i++) if(i % d == 0) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
/*
  AOJ #1564
  title:String Compression
  @kankichi573
 */
#include <stdio.h>
#include <string.h>
#define min(x,y) (((x)<(y))?(x):(y))
int alp[28];
int num[10];
char s[101];
int get_longest_span(int a[],int lim,int *st,int * h)
{
  int i,c;
  for(i=0;a[i]==0 && i<lim;i++)
    ;
  for(*h=100,*st=i;a[i] && i<lim;i++)
    { c=a[i];
      *h=min(*h,c);
    }

  return(i-*st);
}
void subtract_span(int a[],int st,int len,int h)
{
  int i;
  for(i=st;i<st+len;i++)
    a[i] -= h;
}

int solve(int a[],int lim)
{
  int ret,len,st,h;
  ret=0;

  while(1)
    {
      len=get_longest_span(a,lim,&st,&h);
      if(len==0)
	break;
      //printf("st=%d len=%d h=%d\n",st,len,h);
      subtract_span(a,st,len,h);
      
      ret += min(3,len)*h;
      
    }
  return(ret);
}


int main()
{
  int ret;
  char *p;

  
  scanf("%s",s);

  for(p=s;*p;p++)
    {
      if((*p >= 'a') && (*p <= 'z'))
	 alp[*p-'a']++;
      if((*p >= '0') && (*p <= '9'))
	num[*p-'0']++;
    }
  ret=solve(alp,26)+solve(num,10);
  printf("%d\n",ret);
  
  return(0);
}



Measured memory_bytes: 2112
#include <stdio.h>
#include <math.h>
 
using namespace std;
 
int main(){
    int n;
    double students[1000] = {0},sum,m,div;
 
    while(true){
        scanf("%d",&n);
        if(n == 0) break;
        div = sum = 0;
        for(int i = 0; i < n; i++){
            scanf("%lf",&students[i]);
            sum += students[i];
        }
        m = sum/n;
        for(int i = 0; i < n;i++){
            div += (students[i] - m)*(students[i] - m);
            students[i] = 0;
        }
        printf("%.8lf\n",sqrt(div/n));
    }
}


Measured memory_bytes: 2768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int score;
		Scanner sc = new Scanner(System.in);
		while(true) {
			int h=sc.nextInt();
			if(h==0) break;
			
			int[][] map = new int[h][5];
			for(int j=0;j<h;++j) {
				for(int i=0;i<5;++i) {
					map[j][i] = sc.nextInt();
				}
			}
			score=0;
			
			while(true) {
				int cs = check(h,map);
				if(cs==0) {
					System.out.println(score);
					break;
				}
				score+=cs;
				map=down(h,map);
			}
		}
		
	}
	
	public static int check(int h, int[][] map) {
		int len,score=0;
		for(int j=0;j<h;++j) {
			for(int i=0;i<=2;++i) {
				for(len=1;len+i<=4;++len) {
					if(map[j][i] != map[j][i+len]) break;
				}
				if(len<=2) continue;
				score += map[j][i]*len;
				for(int z=0;z<len;++z) {
					map[j][i+z]=0;
				}
			}
		}
		return score;
	}
	
	public static int[][] down(int h, int[][] map) {
		for(int i=0;i<5;++i) {
			for(int min=1;min<h;++min) {
				for(int j=h-1;j>=min;--j) {
					if(map[j][i]==0) {
						map[j][i]=map[j-1][i];
						map[j-1][i]=0;
					}
				}
			}
		}
		return map;
	}
}



Measured memory_bytes: 56276
class Question:
    def __init__(self, AC, WAcount):
        self.AC = AC
        self.WAcount = WAcount


def WelcomeTo():
    N, M = map(int, input().split())
    Qlist = []
    ACcount = 0
    WAcount = 0
    for _ in range(0, N + 1):
        Qlist.append(Question('False', 0))
    for _ in range(M):
        num, judge = input().split()
        num = int(num)
        if Qlist[num].AC == 'True':continue

        if judge == 'AC':
            ACcount += 1
            WAcount += Qlist[num].WAcount
            Qlist[num].AC = 'True'
        elif judge == 'WA':
            Qlist[num].WAcount += 1

    print('{} {}'.format(ACcount, WAcount))


WelcomeTo()


Measured memory_bytes: 20340
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i,n) for (ll i=(ll)n-1;i>=0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}//最大公約数
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}//最小公倍数
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
const int MOD = 1000000007;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

int main(){
   ll n,k;cin>>n>>k;
   VI a(n);rep(i,n)cin>>a[i];
   ll G=a[0];
   ll a_max=0;
   rep(i,n){
      G=GCD(G,a[i]);
      chmax(a_max,a[i]);
      if(k==a[i]){
         cout<<"POSSIBLE"<<endl;
         return 0;
      }
   }
   if(k%G==0 && k<=a_max){
      cout<<"POSSIBLE"<<endl;
   }
   else cout<<"IMPOSSIBLE"<<endl;
}

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

int main()
{
    ll A, B, C;
    scanf("%ld %ld %ld", &A, &B, &C);
    // printf("%ld %ld %ld", A, B, C);
    if(A==B && B==C && C==A || (A!=B&&B!=C&&A!=C)){
        printf("No");
    } else {
        printf("Yes");
    }

    return 0;
}


Measured memory_bytes: 256
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#define REP(i, N) for(int i=0; i<N; i++)
using namespace std;

//#include "atcoder.hpp"

long long gcd(long long a, long long b) {
    if (a>b) swap(a,b);
    
    auto r = b % a;
    
    return (r ? gcd(r, a) : a);
}

int main() {
    int N, K;
    string S;
    int now = 0;
    char tmp = '0';
    vector<int> seq;
    
    cin >> N >> K >> S;
    
    seq.push_back(0);
    for (auto i : S) {
        if (i == tmp)
        now++;
        else {
            seq.push_back(now);
            now=1;
            tmp = (tmp == '0') ? '1' : '0';
        }
    }
    seq.push_back(now);
    seq.push_back(0);
    
    int pos = 1, pmax = seq[0] + seq[1];
    
    int left = 0;
    pos = min(1 + 2 * (K - 1) + 1, (int)seq.size() - 1);
    int r = accumulate(seq.begin() + left, seq.begin() + pos + 1, 0);
    int rmax = r;
    for (;;) {
        if (++pos < seq.size()) {
            r += seq[pos];
            r -= seq[left++];
            if (++pos < seq.size()) {
                r += seq[pos];
                r -= seq[left++];
            }
            if (r > rmax) rmax = r;
        }
        else
        break;
    }
    
    
    
    cout << rmax << endl;
    
    return 0;
}



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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){

  int s,n;
  cin >> s >> n;
  if(s > n)cout << "safe" << endl;
  else cout << "unsafe" << endl;



  

  return 0;
}


Measured memory_bytes: 3624
import numpy as np
N,M,X = map(int,input().split())
C = []
A = []
for _ in range(N):
    l = list(map(int,input().split()))
    C.append(l[0])
    A.append(np.array(l[1:]))
ans = 10**100
for i in range(2**N):
    rikaido = np.zeros(M)
    c = 0
    for j in range(N):
        if (i >> j) & 1:
            c += C[j]
            rikaido += A[j]
    if all([x >= X for x in rikaido]):
        ans = min(ans, c)
print(ans if ans != 10**100 else -1)

Measured memory_bytes: 27096
while True:
    num_list = input().split()
    a = int(num_list[0])
    b = int(num_list[2])
    op = num_list[1]
    if op == "?":
        break
    if op == "+":
        c = a+b
    if op == "-":
        c = a-b
    if op == "*":
        c = a*b
    if op == "/":
        c = a//b
    print(c)


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    const int T = 1000 * 1000 * 1000;
    
    int n;
    cin >> n;
    vector <int> p(n + 1), val(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> p[i];
        val[p[i]] = T - n + i;
    }   
    vector <int> a(n + 1), b(n + 1);
    const int INF = 1e9 + 7;
    int cur = INF, ra = 0;
    for (int i = 1; i <= n; ++i) {
        cur = min(cur - 1, val[i] - ra - 1);
        b[i] = cur;                         
        a[i] = val[i] - b[i];

        if (b[i] < 0 || a[i] < 0)
            exit(1);

        ra = a[i];
    }   
    for (int i = 1; i <= n; ++i)
        cout << a[i] << ' ';
    cout << endl;
    for (int i = 1; i <= n; ++i)
        cout << b[i] << ' ';
    cout << endl;
}

Measured memory_bytes: 1280
import sys
from collections import deque
input = sys.stdin.readline

def main():
  h, w = map(int, input().split())
  s = [input() for _ in range(h)]
  
  ans = 0
  already = [[False]*w for _ in range(h)]
  for i in range(h):
    for j in range(w):
      if already[i][j] or s[i][j] == ".":
        continue
      already[i][j] = True
      black, white = 0, 0
      not_yet = deque([(i, j)])
      while not_yet:
        p, q = not_yet.pop()
        if s[p][q] == "#":
          black += 1
        else:
          white += 1
        if p > 0 and s[p-1][q] != s[p][q] and not already[p-1][q]:
          not_yet.append((p-1, q))
          already[p-1][q] = True
        if p < h-1 and s[p+1][q] != s[p][q] and not already[p+1][q]:
          not_yet.append((p+1, q))
          already[p+1][q] = True
        if q > 0 and s[p][q-1] != s[p][q] and not already[p][q-1]:
          not_yet.append((p, q-1))
          already[p][q-1] = True
        if q < w-1 and s[p][q+1] != s[p][q] and not already[p][q+1]:
          not_yet.append((p, q+1))
          already[p][q+1] = True
      ans += black*white
  
  print(ans)

  
if __name__ == "__main__":
  main()

Measured memory_bytes: 18032
allst = list(input().split())
stk = []
ans = 0
for i in range(0, len(allst)):
    if allst[i] == '+':
        stk[len(stk)-2] = stk[len(stk)-2] + stk[len(stk)-1]
        del stk[len(stk)-1]
    elif allst[i] == '-':
        stk[len(stk)-2] = stk[len(stk)-2] - stk[len(stk)-1]
        del stk[len(stk)-1]
    elif allst[i] == '*':
        stk[len(stk)-2] = stk[len(stk)-2] * stk[len(stk)-1]
        del stk[len(stk)-1]
    else:
        stk.append(int(allst[i]))
print(stk[len(stk)-1])

Measured memory_bytes: 7736
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

T1, T2 = MAP()
A1, A2 = MAP()
B1, B2 = MAP()

if (A1-B1)*T1 + (A2-B2)*T2 == 0:
	print("infinity")

elif 0 < ((A1-B1)*T1) * ((A1-B1)*T1 + (A2-B2)*T2):
	print(0)

else:
	p = A1*T1-B1*T1
	q = 2*A1*T1+A2*T2-2*B1*T1-B2*T2
	if p*q < 0:
		print(1)
	elif p%(p-q):
		print(2*(p//(p-q))+ 1)
	else:
		print(2*(p//(p-q)))


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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const int N = 100010;
const int mod = (int)1e9 + 7;
const ull BS = 10000019ULL;

inline int in() {int x; scanf("%d",&x); return x;}
inline ll lin() {ll x; scanf("%lld",&x); return x;}

char s[N + N];

vector < int > g[26];

int dp[N + N][26];

int go(int pos, int now){
    if(pos == N + N - 5) return dp[N + N - 5][now] = 1;
    if(dp[pos][now] != -1) return dp[pos][now];
    int ret = INT_MAX;
    for(int i = 0; i < 26; i++){
        if(g[i].size() == 0) ret = min(ret, 1 + go(N + N - 5, i));
        else if(g[i].back() <= pos) ret = min(ret, 1 + go(N + N - 5, i));
        else {
            int p = upper_bound(g[i].begin(), g[i].end(), pos) - g[i].begin();
            ret = min(ret, 1 + go(g[i][p], i));
        }
    }
    return dp[pos][now] = ret;
}

void print(int pos, int now){
    printf("%c", char(now + 'a'));
    if(pos == N + N - 5){
        return ;
    }
    int nxt = 0, what = 25, tot = INT_MAX;
    for(int i = 0; i < 26; i++){
        if(g[i].size() == 0){
            if(1 + dp[N + N - 5][i] < tot){
                tot = 1 + dp[N + N - 5][i];
                nxt = N + N - 5;
                what = i;
            }
        }
        else if(g[i].back() <= pos){
            if(1 + dp[N + N - 5][i] < tot){
                tot = 1 + dp[N + N - 5][i];
                nxt = N + N - 5;
                what = i;
            }
        }
        else {
            int p = upper_bound(g[i].begin(), g[i].end(), pos) - g[i].begin();
            if(1 + dp[g[i][p]][i] < tot){
                tot = 1 + dp[g[i][p]][i];
                nxt = g[i][p]; what = i;
            }
        }
    }
    print(nxt, what);
}

int main(){
    scanf("%s", s + 1);
    int len = strlen(s + 1);
    for(int i = 1; i <= len; i++){
        g[s[i] - 'a'].pb(i);
    }
    memset(dp, -1, sizeof dp);
    int ans_len = INT_MAX, st = 25;
    for(int i = 0; i < 26; i++){
        if(g[i].size() == 0){
            if(ans_len > 1){
                ans_len = 1;
                st = i;
            }
        }else {
            if(go(g[i][0], i) < ans_len){
                ans_len = go(g[i][0], i);
                st = i;
            }
        }
    }
    if(g[st].size() == 0) printf("%c", char(st + 'a'));
    else {
        print(g[st][0], st);
    }
    puts("");
    //printf("%d %d\n", ans_len, st);
}


Measured memory_bytes: 22272
package main

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

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	
	n := scanInt()
	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}

	m := make([]int, n)

	for i := 0; i < n; i++ {
		if i%2 == 0 {
			m[0] += a[i]
		} else {
			m[0] -= a[i]
		}
	}

	fmt.Print(m[0])
	fmt.Print(" ")
	for i := 1; i < n; i++ {
		m[i] = 2*a[i-1]-m[i-1]
		fmt.Print(m[i])
		if i != n-1 {
			fmt.Print(" ")
		}
	}
	fmt.Println()
}


Measured memory_bytes: 6528
c=[0,2,5,5,4,5,6,3,7,6];N,M=gets.split.map &:to_i;A=gets.split.map &:to_i;d=[0]+Array.new(N,p);0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	//freopen("in.txt", "r", stdin);
	
	cin >> n;
	rep(i, 1, n) {
		cin >> a;
		if (i % 2 && a % 2) c++;
	}
	cout << c;
}

Measured memory_bytes: 3540
#include <iostream>
#include <vector>
#include <map>
#include <functional>
using namespace std;

typedef long long ll;

int N;
map<int, int, greater<int> > M;

int main(void) {
	cin >> N;
	M.clear();
	for (int i = 0; i < N; ++i) {
		int a;
		cin >> a;
		if (M.find(a) == M.end())
			M[a] = 1;
		else
			++M[a];
	}
	vector<int> V;
	map<int, int>::iterator it;
	for (it = M.begin(); it != M.end(); ++it) {
		if (it->second >= 2)
			V.push_back(it->first);
		if (V.size() >= 2)
			break;
		if (it->second >= 4) {
			V.push_back(it->first);
			break;
		}
	}

	ll ans = 0;
	if (V.size() >= 2)
		ans = (ll)V[0] * (ll)V[1];

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 4992
n = int(input())
count = 0
stack = [0]
def check(n):
  s = str(n)
  if "3" in s and "5" in s and "7" in s:
    return True
  else:
    return False
while len(stack)>0:
  now = stack.pop()
  if check(now) and now <= n:
    count += 1
  if now < n:
    stack.append(now*10+3)
    stack.append(now*10+5)
    stack.append(now*10+7)
print(count)
      


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    ll n, d;
    cin >> n >> d;
    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        ll x, y;
        cin >> x >> y;
        if(x * x + y * y <= d * d) ans++;
    }
    cout << ans << endl;
}




Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define sz(x) (int)x.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(a) (1ll<<(a))
#define endl "\n"
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
/*并查集
 * int f[];
 * int Find(int x){x==f[x]?return f[x]:f[x]=Find(f[x]);}
 * int join(int x,int y){if(Find(x)!=Find(y))f[Find(x)]=Find(y);}
 * 快速幂*/
int qpow(ll a,ll b,ll m){ll c=1;while(b){if(b&1)c=c*a%m;b>>=1;a=a*a%m;}return c;}
ll a;
const int N=120;
ll s[N];
int main(){
	ios::sync_with_stdio(false);
	cin>>a;
	rep(i,1,N){
		s[i]=i*i*i*i*i;
	}
	rep(i,-120,120){
		rep(j,-120,120){
			if(pow((ll)i,5)-pow((ll)j,5)==a){
				cout<<i<<" "<<j;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 4080
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;



int A,B,H,M;
double theta;

int main(){

    cin >>A >> B >> H >>M;

    long double timeh = H + (double)M/60;
    long double thetaA = timeh * 2 * M_PI / 12; // 0< < pi
    long double thetaB = timeh * 2 * M_PI; // 0 < < 2 pi
    long double theta = thetaB - thetaA;
   if(theta> M_PI)
    {
        theta = 2* M_PI - theta;
    }

    long double l = sqrt(A*A + B*B - 2 * A * B * cos(theta));
    cout <<  fixed << setprecision(11) <<l << endl;

    return 0;

}


Measured memory_bytes: 4068
#include <bits/stdc++.h>
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define memo(a,v) memset(a,v,sizeof(a))
#define all(v) (v.begin(), v.end())
#define sar(a,n) ll a[n];for(i=0; i<n; i++)cin>>a[i] //*declare* and scan array
#define pars(a,n) for(ll i=0; i<n; i++)cout<<a[i]<<" " //prints array with spaces between the elements
#define parl(a,n) for(ll i=0; i<n; i++)cout<<a[i]<<"\n" //prints array with new line between the elements
#define debug(x) cout << '>' << #x << ':' << x << endl
#define debuga() cout<<"AAAAA\n"
#define debugb() cout<<"BBB\n"
#define rep(n) for (ll i=0; i<n; i++)
#define elif else if
#define eb emplace_back
#define pb push_back
#define bitcount __builtin_popcount
using namespace std;
using ll = long long;

ll fastpow(ll a, ll p, ll mod){ll ans=1; a%=mod; for(; p; p>>=1){ if(p&1) ans=ans*a%mod; a=a*a%mod;} return ans;}

void solve() {
    int n;
    cin >> n;
    int a[n];
    bool f = 0;
    for (int i = 0; i < n; ++i) {
        int x; cin >> x;
        if (x % 2 == 0) {
            if (x % 3 == 0 or x % 5 == 0) {
                continue;
            } else {
                cout << "DENIED\n";
                return;
            }
        } 
    }
    cout <<"APPROVED\n";
}

int main() {
    
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "rt", stdin);
    //     freopen("output.txt", "wt", stdout);
    // #endif
    
    fastIO;
    int T;
    T=1;
    // cin>>T;
    for (int tt = 1; tt <= T; tt++){
        // cout << "Case #" << tt << ": ";
        solve();
    }
	// your code goes here
	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
using namespace std;
 
int a[4];
int c[8];
int k;
 
int calc(){
    int op = c[k++];
    int ret = 0;
    if(op >= 0){
        ret = op;
    }
    else if(op >= -3){
        int x = calc();
        int y = calc();
        if(op == -1){
            ret = x + y;
        }
        else if(op == -2){
            ret = x - y;
        }
        else{
            ret = x * y;
        }
    }
    else{
        throw 0;
    }
    return ret;
}
 
void print(){
    int op = c[k++];
    if(op >= 0){
        printf("%d", op);
    }
    else{
        char ch;
        if(op == -1){ ch = '+'; }
        else if(op == -2){ ch = '-'; }
        else{ ch = '*'; }
 
        putchar('(');
        print();
        printf(" %c ", ch);
        print();
        putchar(')');
    }
}

const int brnum = 100000;
 
void solve(int i, int S, int oprem, int numrem){
    if(i == 6){
        for(int j = 0; j < 4; ++j){
            if(S >> j & 1){
                c[6] = a[j];
            }
        }
        try{
            k = 0;
            if(calc() == 10 && k == 7){
                k = 0;
for(int j=0;j<=brnum;++j)putchar('(');
                print();
for(int j=0;j<brnum;++j)putchar(')');
                puts("");
                throw "";
            }
        }catch(int){}
        return;
    }
 
    if(oprem > 0){
        for(int op = -1; op >= -3; --op){
            c[i] = op;
            solve(i + 1, S, oprem - 1, numrem + 1);
        }
    }
 
    if(numrem > 0){
        for(int j = 0; j < 4; ++j){
            if(S >> j & 1){
                c[i] = a[j];
                solve(i + 1, S ^ 1 << j, oprem, numrem - 1);
            }
        }
    }
}
 
int main(){
    while(1){
        for(int i = 0; i < 8; ++i){
            c[i] = -9;
        }
        for(int i = 0; i < 4; ++i){
            scanf("%d", &a[i]);
        }
        if(a[0] == 0){ break; }
        try{
            solve(0, 15, 3, 0);
            puts("0");
        }catch(...){}
    }
}

Measured memory_bytes: 1128
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	long long T1,T2;
	cin>>T1>>T2;
	
	pair<long long,long long> A,B;
	cin>>A.first>>A.second>>B.first>>B.second;
	
	if(A.first<B.first)swap(A,B);
	
	long long a = (A.first-B.first)*T1;
	long long b = (A.second-B.second)*T2;
	
	if(a==-b){
		cout<<"infinity"<<endl;
	}
	else if(a>-b){
		cout<<0<<endl;
	}
	else{
		long long ok = (a-1)/(-a-b);
		ok+=1;
		//cout<<a<<','<<b<<endl;
		long long ans = ok*2-1;
		if(a%(-b-a)==0)ans++;
		cout<<ans<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256