akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int64_t i=0; i<(int64_t)(n); i++)
#define all(v) v.begin(), v.end()

int main(){

    int x, n; cin >> x >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];

    int cnt=0;

    while(true){
        int ans=x-cnt;
        bool ok=true;
        rep(i, n){
            if(ans==p[i]) ok=false;
        }
        if(ok){
            cout << ans << endl;
            return 0;
        }

        ans=x+cnt;
        ok=true;
        rep(i, n){
            if(ans==p[i]) ok=false;
        }
        if(ok){
            cout << ans << endl;
            return 0;
        }

        cnt++;
    }

}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
// (setq-default c-basic-offset 2)

int main() {
  int n;
  cin >> n;
  long long ret = 1;
  long long inf = 1e18;
  bool neg1 = false;
  bool zero = false;
  for (int i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    if (a == 0) {
      zero = true;
      ret = 0;
      break;
    }

    if (ret > inf / a) {
      neg1 = true;
    }
    if (!neg1) ret *= a;
  }

  if (zero) {
    cout << "0" << endl;
  } else if (neg1) {
    cout << "-1" << endl;
  } else {
    cout << ret << endl;
  }
  return 0;
}


Measured memory_bytes: 3536
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// solution 
use std::cmp;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize,
        M: usize,
        edges: [(usize1, usize1); M],
    }

    let mut ans = 0;
    let mut par = (0..N).collect::<Vec<usize>>();
    for hind in 0..M {
        for ind in 0..hind {
            union(edges[ind].0, edges[ind].1, &mut par);
        }

        for ind in hind+1..M {
            union(edges[ind].0, edges[ind].1, &mut par);
        }

        if root(edges[hind].0, &mut par) != root(edges[hind].1, &mut par) {
            ans += 1;
        }
        
        for ind in 0..N {
            par[ind] = ind;
        }
    }

    println!("{}", ans);
}

fn root(x: usize, par: &mut [usize]) -> usize {
    if x == par[x] {
        return x
    } else {
        par[x] = root(par[x], par);
        return par[x];
    }
}

fn union(x: usize, y: usize, par: &mut[usize]) {
    let rootx = root(x, par);
    let rooty = root(y, par);
    if rootx != rooty {
        par[rootx] = rooty;
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

int main() {
    int n, k;
    cin >> n >> k;
    double cnt = 0;
    reps(i, n){
        int tmp = i;
        int tc = 0;
        while(tmp < k) {
            tmp*=2;
            tc++;
        }
        cnt += pow(0.5,tc) / n;
    }
    cout << setprecision(10) << cnt << endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int H, W, N;
  cin >> H >> W >> N;
  if(H>=W){
    if(N%H==0) cout << N/H << endl;
    else cout << N/H+1 << endl;
  }
  if(H<W){
    if(N%W==0) cout << N/W << endl;
    else cout << N/W+1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>
#include <cmath>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = true;

// xを素因数分解
map <ll, ll> primeFactorization(ll x){
    map <ll, ll> ret;
    for(ll i = 2; i * i <= x; i++){
        while(x % i == 0){
            ret[i] ++;
            x /= i;
        }
    }
    if(x != 1) ret[x] = 1;

    return ret;
}


int main(){

    ll A, B;
    cin >> A >> B;

    auto primes = primeFactorization( A );

    ll ans = 1;
    
    for(auto i = primes.begin(); i != primes.end(); i++){
        if( B % i->first == 0) ans ++;
    }
    
    cout << ans << endl;

    
}



Measured memory_bytes: 256
N,M=map(int, input().split(" "))

A=[]
B=[]

bought = 0
price = 0
for i in range(0, N):
    a,b=list(map(int, input().split(" ")))
    A.append((a, i))
    B.append(b)

A.sort()

i = 0
p=0
n=0
while bought < M:
    p,n = A[i]
    price += p*B[n]
    bought += B[n]
    i += 1

if bought > M:
    price -= (bought-M)*p

print(price)

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

int main(){
  int credit[20],n,com[291];
  for(int i=1;i<=17;i++)credit[i] = i*i;
  for(int i=0;i<291;i++)com[i] = 0;
  com[0] = 1;
  for(int i=0;i<17;i++){
    for(int j=1;j<=291;j++){
      if(j>=credit[i])com[j] += com[j-credit[i]];
    }
  }
  while(cin >> n && n){
    cout << com[n] << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
int main()
{
string s;
cin>>s;
int c=0;
int a[1000];
memset(a,0,sizeof(a));
for(int i=0;i<4;i++)
{
if(a[s[i]]==0)
{
c++;
}
a[s[i]]=1;
}
cout<<((c==2) ? "Yes" : "No");
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))


#define forr(i,n) for(i=0; i<n; i++)
#define whilee(i,t) while(i!=t)
//#define pb(x) push_back(x);

//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//accumulate(A.begin(), A.end(), 0);
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());



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

    //vector <int> A;
    //deque <int> A;
    //queue <int> A;
    //stack <int> A;
    //set <int> A;
    //map <int,int> A;
    //pair <int,int> A ;
    //vector <pair <int,int>> A ;
    //string S, T;
    int i, j, k, a, b, c, l, m, n, p, q, r, s, t, x, y, z, cnt=0;
    cin>>n>>i;
    cout<<n-(i-1)<<endl;

    return 0;
}


Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. A-BEGINNER.
 
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP     PIC X(100).
01 IN-DATA.
   03 DT-X1 PIC X(10).
   03 DT-X2 PIC X(10).
01 IN-LEN.
   03 DT-L1 PIC 9(2).
   03 DT-L2 PIC 9(2).
01 IN-A     PIC 9(10).
01 IN-B     PIC 9(10).
01 WK-K     PIC 9(10).
01 OUT-K    PIC Z(8)9.
 
PROCEDURE DIVISION.
MAIN-001.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO DT-X1 COUNT IN DT-L1
           DT-X2 COUNT IN DT-L2.
  MOVE DT-X1(1:DT-L1) TO IN-A.
  MOVE DT-X2(1:DT-L2) TO IN-B.
 
  COMPUTE WK-K = (IN-A + IN-B) / 2.
  IF (WK-K * 2 = IN-A + IN-B)
    MOVE WK-K TO OUT-K
    DISPLAY OUT-K
  ELSE
    DISPLAY 'IMPOSSIBLE'
  END-IF.

MAIN-EXIT.
  STOP RUN.

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

int main() {
	int n;
  	cin >> n;
    int mi = 1e9, ma = -1, tmp;
  	while(cin >> tmp) {
      ma = max(ma, tmp);
      mi = min(mi, tmp);
    }
    cout << ma - mi << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    ll h, w; cin >> h >> w;
    
    if(min(h,w) == 1) dunk(1);

    else dunk((h*w+1)/2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,i1,n) for(int i=(int)(i1);i<(int)(n);i++)
#define ll long long
#define vi vector<int>
#define vll vector<long long>
using graph = vector<vector<int>>;

int main() {
  int n=0;
  cin>>n;
  if(n==0){
    cout<<"1";
  }else{
    cout<<"0";
  }
}

Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC085A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            s = Console.ReadLine();

            char[] cs = s.ToCharArray();
            cs[3] = '8';

            Console.WriteLine(cs);

            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 11092
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def main():
    k=int(input())
    a=0
    b=0
    ans = 0

    w = [[0]*(k+1) for _ in range(k+1)]
    for i in range(1,k+1):
        for j in range(i,k+1):
            x = gcd(i,j)
            w[i][j] = x
            w[j][i] = x

    for i in range(1,k+1):
        for j in range(i,k+1):
            for k in range(j,k+1):
                s =set([i,j,k])
                length = len(s)
                if length == 1:
                    ans += i
                elif length == 2:
                    l = list(s)
                    ans += 3*w[l[0]][l[1]]
                else:
                    a = w[i][j]
                    b = w[a][k]
                    ans += 6*b

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9468
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

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

  sort(ALL(A));

  int ok = 0;
  int ng = INF;
  while(ng-ok > 1){
    int mid = (ok+ng)/2;
    int cur = 0;
    REP(i, N){
      cur += A.end()-lower_bound(ALL(A), mid-A[i]);
    }
    if(cur >= M) ok = mid;
    else ng = mid;
  }

  vector<int> sum = A;
  RREP(i, N-1) sum[i] += sum[i+1];
  sum.emplace_back(0);

  int cnt = 0;
  int ans = 0;
  REP(i, N){
    int now = A.end()-lower_bound(ALL(A), ok-A[i]);
    ans += now*A[i]+sum[N-now];
    cnt += now;
  }

  ans += (M-cnt)*ok;
  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 2560
n = int(input())
s = [int(input()) for _ in range(n)]
notten = sorted([i for i in s if i%10]) 
ten = [i for i in s if i%10==0] 
if notten:
    for j in range(len(notten)):
        if sum(notten[j:])%10:
            print(sum(ten)+sum(notten[j:]))
            break
        
else:
    print(0)

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

int main(void)
{
    int n;
    int mind;

    cin >> n;

    for(int i=0; i<n; ++i){

        int temp;
        cin >> temp;
        int div{0};

        while(temp%2 == 0){
            ++div;
            temp = temp/2;
        }

        if(i==0){
            mind = div;
        }
        else if(div < mind){
            mind = div;
        }
    }
    cout << mind << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	var N, L int
	fmt.Scan(&N, &L)
	a := make([]string, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < N; i++ {
		sc.Scan()
		a[i] = sc.Text()
	}
	sort.Sort(sort.StringSlice(a))
	var r string
	for _, v := range a {
		r += v
	}
	fmt.Println(r)
}

Measured memory_bytes: 1280
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

ll powmod(ll a, ll b, ll mod) {
  ll res = 1;
  for (; b; b >>= 1) {
    if (b & 1) {
      res = res * a % mod;
    }
    a = a * a % mod;
  }
  return res;
}

int main() {
  ull n;
  cin >> n;
  ll res = 0;
  ll mod = 1000000007;
  if (n > 1) {
    res = powmod(10, n, mod);
    res = (res - powmod(9, n, mod)) % mod;
    res = (res - powmod(9, n, mod)) % mod;
    res = (res + powmod(8, n, mod)) % mod;
  }
  if (res < 0) {
    res += mod;
  }
  cout << res << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(a>b) swap(a,b);
    if(a>c) swap(a,c);
    if(b>c) swap(b,c);
    if(a+b==c) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return 0;
}


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

// 要素の最大数
#define MAX 2100000

// 完全二分木ヒープの定義
struct BinaryHeap {
    int key;
    };

struct BinaryHeap Heap[MAX];

// 実際のヒープサイズ
int SIZE = 1;

// 最大ヒープ条件を満たす様にソート
void maxHeapify(BinaryHeap A[], int i)
{
    int largest = 0;
    int l = 2 * i;
    int r = 2 * i + 1;
    // 左の子、自分、右の子で値が最大のノードを選ぶ
    if (l <= SIZE && A[l].key > A[i].key) {
        largest = l;
    } else {
        largest = i;
    }

    if (r <= SIZE && A[r].key > A[largest].key){
         largest = r;
    }

    if (largest != i) {
         swap(A[i],A[largest]);
         // 再帰的に呼び出し
         maxHeapify(A, largest);
    }
}

// 適切な位置にキーを追加する
void Insert(int ikey)
{    
    int parent, pos;

    pos = ++SIZE;
    
    // 一旦末尾に追加する
    Heap[pos].key = ikey;

    // 最大ヒープ順になっていない可能性があるのでチェックする
    parent = pos / 2;
    while (pos > 1 && Heap[pos].key > Heap[parent].key)
    {
        // 適切な位置に移動する
        swap(Heap[pos], Heap[parent]);
        pos = parent;
        parent = pos / 2;
    }
}

// ヒープから最大値を持つキーを取り出し削除し、その値を返す
int ExtractMax() {
    if (SIZE < 1) return -1;

    // 最初の要素が最大値となる様にソートされているはず
    int iMax = Heap[1].key;

    // 取り出した先頭要素を削除する
    Heap[1].key = Heap[SIZE].key;
    SIZE--;

    // 最大値を更新するためにソートする
    maxHeapify(Heap, 1);

    return iMax;
}

int main()
{
    int iNodeIdx = 0;
    string strCmd = "";
    
    while(strCmd != "end")
    {
        // キーを取得
        cin >> strCmd;
        if (strCmd == "insert") {
            cin >> iNodeIdx;
            Insert(iNodeIdx);
        }
        else if (strCmd == "extract") {
            cout << ExtractMax() << "\n";
        } 
    }
    return 0;
}


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

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
 
#define INF 10e9
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
 
int main() {
    int n;
    cin >> n;
    vector<int> a(n+1);
    vector<int> b(n+1);

    int i, j;
    a[0] = 0;
    b[0] = 0;
    for(i = 1; i <= n; i++){
        cin >> a[i];
        //a[i] = 0;
        b[i] = 0;
    }

    for(i = n; i >= 1; i--){
        int sum = 0;
        //cout << i << endl;
        for(j = n/i; j >= 2; j--){
            //cout << j*i << endl;
            sum += b[j*i];
            //cout << j << " ";
        }
        //cout << endl;

        if((sum%2 == 1) && (a[i]%2 == 1)){
            b[i] = 0;
        }else if((sum%2 == 1) && (a[i]%2 == 0)){
            b[i] = 1;
        }else if((sum%2 == 0) && (a[i]%2 == 1)){
            b[i] = 1;
        }else{
            b[i] = 0;
        }
    }


    int ans = 0;
    for(i = 1; i <= n; i++){
        ans += b[i];
    }

    cout << ans << endl;

    if(ans != 0){
        for(i = 1; i <= n; i++){
            if(b[i] == 1){
                cout << i << endl;
            }
        }
    }

   /*
   for(i = 1; i <= n; i++){
       cout << b[i] << " ";
   }
   cout << endl;
    */
}


Measured memory_bytes: 2432
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
num = 0
s = 0
l = []
for i in range(n):
  if a[i] < b[i]:
    s += b[i]-a[i]
    num += 1
  if a[i] > b[i]:
    l.append(a[i]-b[i])
l = sorted(l, reverse=True)
if num == 0:
  print("0")
else:
  for i,j in enumerate(l):
    s -= l[i]
    num += 1
    if s <= 0:
      break

if num != 0 and sum(a) < sum(b):
  print("-1")
elif num != 0 and sum(a) >= sum(b):
  print(num)

Measured memory_bytes: 20084
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
  int a,b,c,d,e;
  cin >> a>>b>>c>>d>>e;
  int ans = 15-a-b-c-d-e;
  cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3524
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,d,e,k;
  cin>>a>>b>>c>>d>>e>>k;
  if(e-a>k){
    cout<<":("<<endl;
  }else{
    cout<<"Yay!"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		string a, b;
		cin >> a;
		cin >> b;
		if (a.length() > 80 || b.length() > 80) {
			cout << "overflow" << endl;
			continue;
		}

		string result(80, '0');
		int over = 0;
		int j = a.length() - 1;
		int k = b.length() - 1;
		int l = 79;
		for (; l >= 0; --j, --k, --l) {
			int numa = j < 0 ? '0' : a[j];
			int numb = k < 0 ? '0' : b[k];
			int sum = numa + numb - '0' * 2 + over;
			if (sum >= 10) {
				over = 1;
				sum -= 10;
			} else {
				over = 0;
			}
			result[l] = sum + '0';
		}
		if (over == 1) {
			cout << "overflow" << endl;
		} else {
			int j = 0;
			for (; j < result.length() && result[j] == '0'; ++j);
			if (j == result.length()) cout << '0';
			for (; j < result.length(); ++j) cout << result[j];
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1212
'use strict';
console.log(function(args){
  const _tmp = args.trim().split('\n');
  const N = _tmp[0]|0;
  const S = _tmp[1];
  let count = 0;
  for ( let i = 0; i + 3 <= N; i++ ) {
    if ( S.slice(i,i+3) === 'ABC' ) count++;
  }
  return count.toString();
}(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 7372
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,m;
int main(){
	scanf("%lld%lld",&n,&m);
    printf("%lld",(n*3+m)/2);
}

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

int main() {
  int N;
  cin >> N;
  if( N == 1 ){
    cout << "Hello World" << endl;
  }else{
    int A,B;
    cin >> A >> B;
    cout << A + B << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

// snukeさんのmodint
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

// mint N;

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

// combination c(N);
// mint ans = c(N,n);
// cout << ans.x << endl;
// Nとnはll型(mintではない)
// -------------------------------------------------------------


int main(){
  ll H,W,A,B;
  cin >> H >> W >> A >> B;
  combination c(H+W);
  mint ans = 0;
  for(ll i=1; i<=H-A; i++){
    mint res;
    res = c(i-1+B-1,i-1);
    res *= c(H-i+W-B-1,H-i);
    ans += res;
  }
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t
#include <math.h>

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

#define NUM_MAX 100000
// sqrt(1e+9)
#define M_2_MAX 31623

int main(void) {
    int num, sum;
    get_int2(&num, &sum);
    int num_2 = sqrt(0.5+sum);

    int div;
    int ans;
    for(div = 1; div <= num_2; div++) {
        if(sum%div) { continue; }
        int large = sum / div;
        if(div >= num) {ans = large; break;}
        if(sum / div >= num) ans = div;
    }
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

#define IoFast ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long int
#define float long double
#define foor(i, a, b) for ( int (i) = (a); (i)<(b); (i)++ )
#define foor2(i, a, b) for( int (i) = (a); (i)>(b); (i)-- )
#define foorl(i, a, b) for ( ll (i) = (a); (i)<(b); (i)++ )
#define foorl2(i, a, b) for( ll (i) = (a); (i)>(b); (i)-- )
#define mp make_pair
#define f1 first
#define f2 second
#define pb push_back
#define pii pair<int,int>
#define vpii vector <pii>
#define vi vector<int>
#define sz(a) (int) a.size( )
#define fillArr(n, a) foor(i, 0, n) cin >> a[i];
#define print(a) cout << #a << endl;
#define umax(a,b) a = max ( a, b )
#define umin(a,b) a = min ( a, b )
#define all(k) k.begin ( ), k.end( )
#define rall(k) k.rbegin ( ), k.rend( )
#define clean(k) memset( k, 0, sizeof(k) )
#define endl '\n'

const int maxn=1e6+50;
int ar[maxn];
 
int main(){
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> ar[i];
	}
	int c = 0;
	int ans = 0;
	ar[0] = ar[1];
	for (int i = 1; i <= n; i++) {
		if (ar[i] > ar[i - 1] && c == 2) {
			c = 0;
			ans++;
		}
		else if (ar[i] < ar[i - 1] && c == 1) {
			c = 0;
			ans++;
		}
		else if (ar[i] > ar[i - 1]) 
			c = 1;
		else if (ar[i] < ar[i - 1]) 
			c = 2;
		
	}
	cout << ans + 1 << endl;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back;
using namespace std;
int main()
{
    ll n,w,a,b;
    cin>>n>>w;
    pair<ll,ll> l[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a>>b;
        l[i]={a,b};
    }
    ll m[n][w];
    for(int x=0;x<=w;x++)
    {
        for(int i=0;i<n;i++)
        {
            if (l[i].first<=x)
            {   if (i-1<0)
                    m[i][x]=l[i].second;
                else
                    {m[i][x]=max((m[i-1][x]),(l[i].second+m[i-1][x-(l[i].first)]));}
            }
            else
            {   if (i-1<0)
                   m[i][x]=0;
                else
                  { m[i][x]=m[i-1][x];}
            }
        }
    }
    cout<<m[n-1][w]<<endl;
}


Measured memory_bytes: 81564
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define MEMSET(a, n, x) REP(i, n) a[i]=x;
#define ARRIN(a, n) REP(i, n) cin>>a[i];
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n, t;
  cin>>n>>t;
  int a[n];
  ARRIN(a, n);
  int mi=a[0], r=0, c=0;
  FOR(i, 1, n){
    if(mi>a[i]) mi=a[i];
    else if(a[i]-mi==r) ++c;
    else if(a[i]-mi>r){
      r=a[i]-mi;
      c=1;
    }
  }
  ECHO(c);
  return 0;
}


Measured memory_bytes: 640
week :: Int -> Int
week n =
  let p = n + (n * 5) `div` 100
      q = if p `mod` 1000 == 0
          then p
          else ( (p `div` 1000) + 1 ) * 1000
  in
    q

ans n =
  last $ take (n+1) $ iterate week 100000

main = do
  c <- getLine
  let i = read c :: Int
      o = ans i
  print o

Measured memory_bytes: 3612
def get_input(inp):
    li = inp.split("\n")

    def inner():
        return li.pop(0)
    return inner

INPUT="""ABCBC"""
input = get_input(INPUT)

import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))

def main():
    n = int(input())
    if n == 3:
        print(2, 5, 63)
    elif n == 4:
        print(2, 5, 20, 63)
    elif n == 5:
        print(2, 5, 20, 30, 63)
    else:
        sz = 0
        ans = set()
        anss = 0
        i = 0
        while True:
            if sz < n:
                ans.add(6 * i + 2)
                anss += 6 * i + 2
                sz += 1
            else:
                break
            if sz < n:
                ans.add(6 * i + 3)
                anss += 6 * i + 3
                sz += 1
            else:
                break
            if sz < n:
                ans.add(6 * i + 4)
                anss += 6 * i + 4
                sz += 1
            else:
                break
            if sz < n:
                ans.add(6 * i + 6)
                anss += 6 * i + 6
                sz += 1
            else:
                break
            i += 1
        if anss % 6 == 2:
            ans.remove(8)
            ans.add(6 * i + 6)
        elif anss % 6 == 3:
            ans.remove(9)
            ans.add(6 * i + 6)
        elif anss % 6 == 5:
            ans.remove(9)
            ans.add(6 * i + 4)
        for s in ans:
            print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4560
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define ll long long
#define pb push_back
#define PII pair<int,int>
#define X first
#define Y second
#define MP make_pair
#define PI acos(-1.0)
#define eps 1e-8
const int maxn=3e5+10;
const int mod=998244353;
using namespace std;

int n,m;
int a[maxn];

int main()
{
    scanf("%d%d",&n,&m);
    int mx=0,sum=0,tmp=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        mx=max(mx,a[i]);
        sum+=a[i];
    }
    for(int i=0;i<n;i++)
    {
        if(4*m*a[i]>=sum)
            tmp++;
    }
    if(tmp>=m)
        printf("Yes");
    else 
        printf("No");
    // system("pause");
    return 0;
}

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

# O(N^2)
cnt_self = 0
cnt_left = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        if A[i] > A[j]:
            cnt_self += 1
        if A[i] != A[j]:
            cnt_left += 1

ans = 0
ans = (ans + (K * cnt_self)) % (10 ** 9 + 7)

coeff = (K * (K - 1) // 2) % (10 ** 9 + 7)
ans = (ans + (coeff * cnt_left)) % (10 ** 9 + 7)

print(ans)


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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    vector<vector<vector<ll>>> dp(n+1,vector<vector<ll>>(2,vector<ll>(2)));
    dp[0][0][0] = 1;
    for(int i=0;i<n;++i){
        for(int j=0;j<2;++j){
            for(int k=0;k<2;++k){
                for(int num=0;num<=9;++num){
                    (dp[i+1][j||num==0][k||num==9] += dp[i][j][k])%=mo;
                }
            }
        }
    }
    cout << dp[n][1][1] << endl;
    return 0;
    
}


Measured memory_bytes: 151292
void main() {
	auto S = rs;
	string A = S;
	
	char[] arr = ['0', '1'];
	ulong k = 0;
	
	ulong res = ulong.max, cnt;
	foreach(i, v; A) {
		if(v != arr[i % 2]) {
			cnt++;
		}
	}
	res = cnt;
	cnt = 0;
	
	foreach(i, v; A) {
		if(v != arr[(i+1) % 2]) {
			cnt++;
		}
	}
	res = min(res, cnt);
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 2556
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int ans=1;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		if((x&1)==0)
		{
			if(x%3!=0&&x%5!=0)ans=0;
		}
	}
	if(ans)puts("APPROVED");
	else puts("DENIED");
	return 0;
}

Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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

int h(int x, int y){
	return x * x + 2 * x * y + x + 1;
}

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

	int n, a;
	cin >> n >> a;
	n %= 500;
	if(a >= n)puts("Yes");
	else puts("No");
	return 0;
}



Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
pair<int,int> b[55][55];
 
signed main(){
  int n;
  cin >> n;
 
  int a[n+1];
 
  for(int i= 0;i<n;i++){
    cin >> a[i];
 
    for(int j = 1;j<=a[i];j++){
      cin >> b[i][j].first >> b[i][j].second ;
      b[i][j].first--;
    }
  }
    int ans = 0;
  for(int i = 0; i<(1<<n) ;i++){
    bool flag = true;
    for(int j = 0;j<n;j++){
      if(i&(1<<j)){
        for(int k = 1;k<=a[j] ; k++){
          if(b[j][k].second != (bool)(i&(1<<b[j][k].first)))flag = false;
        }
    }
    }
          if(flag) ans = max(ans, (int)__builtin_popcount(i));
  
    }
 
    cout << ans <<'\n';
}

Measured memory_bytes: 256
s = input()

if s == "SAT":
    print("1")
elif s == "FRI":
    print("2")
elif s == "THU":
    print("3")
elif s == "WED":
    print("4")
elif s == "TUE":
    print("5")
elif s == "MON":
    print("6")
else:
    print("7")
    

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
using namespace std;
int main(void){
   int n,m;
   cin>>n>>m;
   int ans=n;
   
   vector<int>e[n];
   for(int i=0;i<m;i++){
       int s,t;
       cin>>s>>t;
       s--;
       t--;
       e[s].push_back(t);
       e[t].push_back(s);
      
   }
   
   for(int i=0;i<n;i++){
           int u[n];
           stack<pair<int,int>>bfs;
           for(int k=0;k<n;k++)u[k]=0;
           bfs.push(make_pair(i,0));

           while(bfs.size()){
              
               int xn=bfs.top().first,dp=bfs.top().second;
                bfs.pop();

               if(xn==i&&dp>2){
                       ans--;
                       break;
                   }
                if(u[xn]==1)continue;
                   u[xn]=1;
               for(int h=0;h<e[xn].size();h++){
                      bfs.push(make_pair(e[xn][h],dp+1));
                   
               }
               
           }
           

       }
   if(ans==n)ans--;
   cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include "iomanip"

using namespace std;

#include <cstdio>
#include <cstring>


int main() {
    int a, b;
    cin >> a >> b;
    if (a == 1){
        a += 13;
    }
    if (b == 1){
        b += 13;
    }
    cout << (a == b ? "Draw" : a > b ? "Alice" : "Bob");

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

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

  int k = 0;

  if (n < 600) {
    k = 8;
  } else if (n < 800) {
    k = 7;
  } else if (n < 1000) {
    k = 6;
  } else if (n < 1200) {
    k = 5;
  } else if (n < 1400) {
    k = 4;
  } else if (n < 1600) {
    k = 3;
  } else if (n < 1800) {
    k = 2;
  } else if (n < 2000) {
    k = 1;
  }

  cout << k << endl;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define range(i,a,b) for(long long i = (a); i < (b); i++)
#define rep(i,b) for(long long i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
 
template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

bool isUru(vector<int>& a, int x, int n){
	rep(i,a.size()){
		if(x % a[i] == 0){
			return i % 2 == 0;
		}
	}
	return n % 2 == 0;
}

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

		int ans = 0;
		range(i,l,r+1){
			ans += isUru(a, i, n);
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 3048
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	aa := make([]int, n+1)
	for i := 0; i < n; i++ {
		a := getNextInt(scanner)
		if a == aa[i] {
			i--
			n--
			continue
		}
		aa[i+1] = a
	}
	ans := 1
	for i := 3; i <= n; i++ {
		if (aa[i-2] < aa[i-1]) != (aa[i-1] < aa[i]) {
			ans++
			i++
		}
	}
	fmt.Println(ans)

	writer.Flush()
}


Measured memory_bytes: 3584
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int size = 1e6 ;


int main() {
    /*#ifndef ONLINE_JUDGE 
   freopen("input.txt","r",stdin) ;
   freopen("output.txt","w",stdout) ;
   #endif */
   int A, B ;
   cin >> A >> B ;
   if( B % A == 0 ) cout<<A+B<<endl;
   else cout<<B-A<<endl;
   return 0 ;
}


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

#define endl "\n"
#define ioss ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
//#define int long long

typedef  long long ll;

using namespace std;
ll ans=0;ll nm=1;
void kill(ll h)
{
    if(h==1){ans=ans+nm;}
  else
  {
    ans=ans+nm;nm=nm*2;
     kill(h/2);
     //<<ans<<endl;
  }
}

int main()
{
    ioss
    ll h;cin>>h;
  kill(h);
  cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll MOD = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll max(ll a, ll b) { return (a > b) ? a : b; }




ll N;

vector <ll> P;

ll S[2 * 100005];
int main() {
	cin >> N;
	P.resize(N);

	rep(i, N) {
		cin >> P[i];
	}


	rep(i, N) {

		S[P[i]] = S[P[i] - 1] + 1;

	}

	ll m = 0;

	rep(i, N) {
		m = max(m, S[i + 1]);

	}

	cout << N - m << endl;

	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
int n;
cin >> n;
ll a[n],sum=0,cnt1=0,cnt2=0;
for(int i=0;i<n;i++) cin >> a[i];
for(int i=0;i<n;i++){//奇数番目が正
   sum+=a[i];
   if(i%2==0){
      if(sum>=0) cnt1+=1+sum,sum=-1;//1にするまでの距離?を足す
   }
   else{
     if(sum<=0) cnt1+=1-sum,sum=1;//sumは1か-1になってる
   }
}
sum=0;
for(int i=0;i<n;i++){//奇数番目が負
   sum+=a[i];
   if(i%2==0){
      if(sum<=0) cnt2+=1-sum,sum=1;
   }
   else{
     if(sum>=0) cnt2+=1+sum,sum=-1;
   }
}
cout << min(cnt1,cnt2)<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
int a[1005];
int main()
{
    int n;
    int max,min,i;
    while(~scanf("%d",&n))
    {
        int gray=0,brown=0,green=0,cyan=0,blue=0,yellow=0,orange=0,red=0;
        int count=0,count2=0;
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>=1&&a[i]<=399&&gray==0)
                {count++;gray=1;}
            if(a[i]>=400&&a[i]<=799&&brown==0)
                {count++;brown=1;}
            if(a[i]>=800&&a[i]<=1199&&green==0)
                {count++;green=1;}
            if(a[i]>=1200&&a[i]<=1599&&cyan==0)
                {count++;cyan=1;}
            if(a[i]>=1600&&a[i]<=1999&&blue==0)
                {count++;blue=1;}
            if(a[i]>=2000&&a[i]<=2399&&yellow==0)
                {count++;yellow=1;}
            if(a[i]>=2400&&a[i]<=2799&&orange==0)
                {count++;orange=1;}
            if(a[i]>=2800&&a[i]<=3199&&red==0)
                {count++;red=1;}
            if(a[i]>=3200)
                count2++;
        }
        if(count!=0)
        printf("%d %d\n",count,count+count2);
        else
            printf("1 %d",count2);
    }
    return 0;
}

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int a,b;
    cin >> a >> b;
    int sum = a-1;
    if (a <= b){
        sum++;
    }
    cout << sum << 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;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m;
    cin>>n>>m;
    ll ans=(m*1900+(n-m)*100);
    for(int i=0;i<m;i++){
        ans<<=1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
def main():
  import collections
  x = int(input())
  num_list = list(map(int, input().split()))
  count = collections.Counter(num_list)
  score = 0
  for j in count.values():
    score += j * (j-1) / 2
  for k in num_list:
    k_num = count[k]
    print(int(score - k_num + 1))
main()

Measured memory_bytes: 26780
from collections import defaultdict
D = defaultdict(int)
D["WA"] = 0
D["AC"] = 0
D["TLE"] = 0
D["RE"] = 0
N = int(input())
for i in range(N):
    s = input()
    D[s] += 1
print("AC x {}".format(D["AC"]))
print("WA x {}".format(D["WA"]))
print("TLE x {}".format(D["TLE"]))
print("RE x {}".format(D["RE"]))

Measured memory_bytes: 9484
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    set<ll> s,g;
    s.insert(2LL);
    s.insert(n);
    ll maki=ll(sqrt(n));
    for(ll i=3LL;i<=maki;i++){
    	ll num=i;
    	while(num<n){
    		num*=i;
    		if(num==n){
    			s.insert(i);
    		}
    	}
    }
    vector<ll> v;

    for(ll j=2LL;j<=maki;j++){
    	if(n%j==0){
    		v.pb(j);v.pb(n/j);
    	}
    	
    }
    for(auto& i:v){
    	ll m=n;
        while(m>=i){
        	if(m%i==0)m/=i;
        	else m%=i;
        }
        if(m==1LL)s.insert(i);
    }


    n--;
    for(ll i=1LL;i<=maki;i++){
    	if(n%i==0){
    		s.insert(i);
    		s.insert(n/i);
    	}
    }
    s.erase(1LL);
    cout << s.size() <<endl;
    /*for(auto& i:s)cout << i<<" ";
    cout << endl;*/
    return 0;
}


Measured memory_bytes: 384