akhauriyash/Code-Regression huggingface dataset:
def gcd(x,y)
    return y==0?x:gcd(y,x%y)
end

class PriorityQueue
    @heap
    @size
    @reverse
    def initialize(str)
        @heap = Array.new()
        @size = 0
    end

    def push(x)
        x = x
        i = @size
        @size+=1
        @heap.append(x)
        while i>0 do
            par = (i-1)/2
            break if(@heap[par]<=x)
            @heap[i] = @heap[par]
            i = par
        end

        @heap[i] = x
    end

    def pop()
        ret = @heap[0]
        @size -= 1
        x = @heap[@size]
        i = 0
        while 2*i + 1<@size do
            a = 2*i+1
            b = 2*i+2
            a = b if b<@size and @heap[b] < @heap[a]
            break if @heap[a] >= x

            @heap[i] = @heap[a]
            i = a
        end

        @heap[i] = x
        @heap.pop

        return ret
    end

    def top()
        return @heap[0]
    end

    def size()
        return @size
    end

    def empty()
        return @size == 0
    end
end

class SegmentTree
    @dat
    @sz
    @mono
    def initialize(n,mono)
        @sz = 1
        while @sz < n do
            @sz*=2
        end
        @mono = mono
        @dat = Array.new(2*@sz-1){@mono}
    end

    def f(a,b)
        return gcd(a,b)
    end

    def g(a,b)
        return a+b
    end

    def setval(i,x)
        i += @sz - 1
        @dat[i] = x
        while i>0 do
            i = (i-1)/2
            @dat[i] = f(@dat[2*i+1],@dat[2*i+2])
        end
    end
    
    def update(i,x)
        i += @sz - 1
        @dat[i] = g(@dat[i],x)
        while i>0 do
            i = (i-1)/2
            @dat[i] = f(@dat[2*i+1],@dat[2*i+2])
        end
    end

    def query(l,r)
        l += @sz-1
        r += @sz-1
        vl = @mono.clone
        vr = @mono.clone
        while l<=r do
            
            vl = f(vl,@dat[l]) if l&1==0
            vr = f(@dat[r],vr) if r&1==1
            l>>=1
            r = (r>>1)-1
        end
        return f(vl,vr)
    end
end

#N個の整数 A_1,A_2,...,A_Nが黒板に書かれています。
#あなたはこの中から整数を 1つ選んで、1以上 10^9以下の好きな整数に書き換えます。
#元の整数と同じ整数に書き換えても構いません。書き換えた後の 
#N個の整数の最大公約数の最大値を求めてください。

#input
#N
#A_1 A_2 ... A_N

n = gets.to_i
a = gets.split.map(&:to_i)

seg = SegmentTree.new(n+2,0)
for i in 0...n do
    seg.setval(i+1,a[i])
end
ans = 0
for i in 0...n do
    res = gcd(seg.query(0,i),seg.query(i+2,n+1))
    ans = res if ans<res
end
puts ans


Measured memory_bytes: 22816
#include <bits//stdc++.h>
using namespace std;
int main(void){
    double p=1;
    double q=3.141592653589;
   
   double a,b,x,t;
   cin>>a>>b>>x;
   t=x/a;
   if(a*b/2>t)
   p=(a*b*b)/(2*x);
   else{
       t=-t+a*b;
       
       double s=t*2/a;
       p=s/a;
       
   }
   double i=atan(p);
   i=i/q;
   i=i*180;
   
   cout<<setprecision(10)<<i<<endl;
    
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {

	void solve() {

		int a = inint(), b = inint();
		out.println(a<=8&&b<=8 ? "Yay!" : ":(");

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public String instr() {
		return in.next();
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

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

int main() {
    int N;
    cin >> N;
    int64_t L[N];
    for (int i = 0; i < N; i++) {
        cin >> L[i];    
    }

    if (N < 3) {
        cout << 0 << endl;
        return 0;
    }

    int count = 0;
    for (int i = 0; i < N; i++) {
        for  (int j = i + 1; j < N; j++) {
            for (int k = j + 1; k < N; k++) {
                if (L[i] != L[j] && L[i] != L[k] && L[j] != L[k]) {
                    if (max(max(L[i], L[j]), L[k])*2 < L[i] + L[j] + L[k]) {
                        count++;
                    }
                }
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3612
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<iomanip>
#include<cstdint>

using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SORTVG(v) sort(v.begin(),v.end(),greater<>())
#define SORTV(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}
template<class T> void AorB(T& a, string A,string B) {if(a){cout << A << ENT;}else{cout << B << ENT;}}



int atcoder(){
  int a,b,c;
  cin>>a>>b>>c;
  bool ans = (a==b&&b==c);
  YesNo(ans);

    return 0;
}

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


Measured memory_bytes: 896
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  ll n, a, b;
  cin >> n >> a >> b;
  ll t = n / (a + b), s = n % (a + b);
  cout << t * a + min(s, a) << endl;

  return 0;
}


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



using namespace std;


int n;
int p=0,q=0;
int pp[10],qq[10],nn[10];
vector<int> A;
int cnt=1;
int a=0,b=0;
int nflag = 1;
int inf=1<<21;
int t;

void output_arr(int x[],int n){
    for(int i=0;i<n;i++){
        cout << x[i] << " ";
    }
    cout << endl;
}

bool next_permu(int x[]){
    //output_arr(x,n);
    //cout << "hello" << endl;
    int i=n-2;
    //cout << i << endl;
    while(i>-1 && x[i] > x[i+1]){
        i--; //i-1を常に持っておく 後ろから調べた大きい順でない最初の要素
        //cout << "hello" << endl;
    }
    //cout << "pass" << endl;
    if(i==-1) return false;
    int j=n-1,jj=n-1;
    int minxl=inf;
    //cout << i << " " <<  j << endl;
    while(j>i){
        if(minxl >= x[j] && x[i] < x[j]){
            jj = j;
            minxl = x[j]; 
            //cout << jj << " " << j << " " << i << endl;
            //cout << "--------------" << endl;
        }
        j--;
    }
    //cout << "pass " << endl;
    //cout << i << " " << jj << endl;
    t = x[i];
    x[i] = x[jj];
    x[jj] = t;
    sort(x+i+1,x+n);
    //output_arr(x,n);
    return true;
}
bool check_arr(int x[], int y[], int num){
    for(int i=0;i<num;i++){
        if(x[i] != y[i]) {
            return false;
        }
    }
    return true;
}


int main(){
    cin >> n;
    for(int i=0;i<n;i++){
        nn[i] = i+1;
    }
    for(int i=0;i<n;i++){
        cin >> pp[i];
    }
    for(int i=0;i<n;i++){
        cin >> qq[i];
    }
    int cnt=1;
    while(next_permu(nn)){
        if(check_arr(pp,nn,n)){
            a = cnt;
        }
        if(check_arr(qq,nn,n)){
            b = cnt;
        }
        cnt ++;
    }

    if(a > b){
        cout << a-b << endl;
    }
    else{
        cout << b-a << endl;
    }
return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <atcoder/all>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

using mint = atcoder::modint998244353;

struct S {
  ll zero, one, inv;
};

using F = bool;

S op( S a, S b ) {
  return S{
    a.zero+b.zero,
    a.one+b.one,
    a.inv+b.inv+a.one*b.zero
  };
}

S e() {
  return S{ 0, 0, 0 };
}

S mapping( F f, S x ) {
  if( !f )
    return x;

  return S{
    x.one,
    x.zero,
    x.one*x.zero-x.inv
  };
}

F composition( F f, F g ) {
  return f^g;
}

F id() {
  return false;
}

ll N, Q;

int main() {
  std::cin >> N >> Q;

  std::vector<S> a(N);

  rep( i, N ) {
    ll x;
    std::cin >> x;

    if( x )
      a[i] = S{ 0, 1, 0 };
    else
      a[i] = S{ 1, 0, 0 };
  }

  atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);

  rep( q, Q ) {
    ll T, L, R;
    std::cin >> T >> L >> R;
    --L;

    if( T == 1 ) {
      seg.apply( L, R, true );
    } else {
      std::cout << seg.prod( L, R ).inv << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 20400
N, K = map(int, input().split())
h = list(map(int, input().split()))

INF = 10 ** 10
dp = [INF] * 100010

dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i >= j:
            dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))

print(dp[N-1])

Measured memory_bytes: 52448
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef long long ll;

const int INF=1000000;
char fi[101][101];
int d[21][21];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
double EPS = 1e-10;
int N,M;
int sx,sy;
int gx,gy;
int w,h;
int ans;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003


int dp[353][353]={0};
int bow[353][353]={0};
double add(double a,double b){
	if(abs(a+b)<EPS*(abs(a)+abs(b)))
	return 0;
	return a+b;
}

struct P{
	double x,y;
	P(){}
		P(double x,double y):x(x),y(y){
		}
		P operator + (P p){
			return P(add(x,p.x),add(y,p.y));
		}
		P operator - (P p){
			return P(add(x,-p.x),add(y,-p.y));
		}
		P operator *(double d){
			return P(x*d,y*d);
		}
		double dot(P p){
			return add(x*p.x,y*p.y);
		}
		double det(P p){
			return add(x*p.y,-y*p.x);
		}
};

bool cmp_x(const P& p,const P& q){
	if(p.x!=q.x) return p.x<q.x;
	return p.y<q.y;
}

vector<P> convex_hull(P* ps, int n){
	sort(ps,ps+n,cmp_x);
	int k=0;
	vector<P> 	qs(n*2);
	
	rep(i,n){
		while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
			k--;
		qs[k++]=ps[i];
	}
	for(int i=n-2,t=k;i>=0;i--){
		while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
		k--;
		qs[k++]=ps[i];
	}
	qs.resize(k-1);
	return qs;
}

int n;
P ps[101];

int main(){
	
	while(cin>>n,n!=0){
		char comma;
		rep(i,n)
			cin>>ps[i].x>>comma>>ps[i].y;
		
		vector<P> qs=convex_hull(ps,n);
		cout<<n-qs.size()<<endl;
	}
	
	

	
}

Measured memory_bytes: 1236
<?php

while (TRUE) {
    fscanf(STDIN, "%f %f %f %f %f %f", $a, $b, $c, $d ,$e, $f);
    if (feof(STDIN)) {
        break;
    }
    $matrix = array(array($a, $b, $c), array($d, $e, $f));
    $a = solve($matrix);
    echo sprintf('%.3f %.3f', round($a[0][2], 3), round($a[1][2], 3));
    echo PHP_EOL;
}

function solve($matrix) {
    $div = $matrix[0][0];
    for ($i = 0; $i < 3; $i++) {
        $matrix[0][$i] /= $div;
    }
    $times = $matrix[1][0];
    for ($i = 0; $i < 3; $i++) {
        $matrix[1][$i] -= $times * $matrix[0][$i];
    }
    $rev = 1 / $matrix[1][1];
    for ($i = 0; $i < 3; $i++) {
        $matrix[1][$i] *= $rev;
    }
    $times = $matrix[0][1];
    for ($i = 0; $i < 3; $i++) {
        $matrix[0][$i] -= $times * $matrix[1][$i];
    }
    return $matrix;
}

Measured memory_bytes: 6692
#include <bits/stdc++.h>
#define int long long
#define gcd            __gcd
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x,y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int modi(int a, int m)
{
    return power(a, m - 2, m);
}
void multiply(vector<int>&fact,int &n,vector<int>&ans,int i)
{
    int carry=0;
    int sum=0;
    for(int j=0;j<n;j++)
    {
        fact[j]=fact[j]*i+carry;
        carry=fact[j]/10;
        fact[j]=fact[j]%10;
        sum+=fact[j];
    }
    while(carry)
    {
        fact.push_back(carry%10);
        sum+=carry%10;
        carry=carry/10;
        n++;
    }
    ans[i]=sum;
}
int32_t main()
{
    nitin;
    int n;
    cin>>n;
    string s;
    cin>>s;
    string temp="ABC";
    int cnt=0;
    for(int i=0;i<=n-3;i++)
    {
        bool flag=true;
        for(int j=0;j<3;j++)
        {
            if(s[i+j]!=temp[j])
                flag=false;
        }
        if(flag)
            cnt++;
    }
    cout<<cnt<<endl;
    return 0;

}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
    int A[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }
    int N;
    cin >> N;
    bool f[3][3] = {{}};
    for (; N; N--) {
        int b;
        cin >> b;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (A[i][j] == b) {
                    f[i][j] = 1;
                }
            }
        }
    }
    for (int i = 0; i < 3; i++) {
        if (f[0][i] && f[1][i] && f[2][i]) {
            puts("Yes");
            return 0;
        }
        if (f[i][0] && f[i][1] && f[i][2]) {
            puts("Yes");
            return 0;
        }
    }
    if (f[0][0] && f[1][1] && f[2][2]) {
        puts("Yes");
        return 0;
    }
    if (f[0][2] && f[1][1] && f[2][0]) {
        puts("Yes");
        return 0;
    }
    puts("No");
}

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

int main()
{
    int a[3],x=0,y=0;
    for(int i=0;i<3;i++){
        cin>>a[i];
        if (a[i]==5) x++;
        if (a[i]==7) y++;
    }
    if (x==2 && y==1){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<< endl;
    }
    
    
}


Measured memory_bytes: 3564
import functools, math


@functools.lru_cache(maxsize=None)
def rec(i):
    if i <= 0:
        return i == 0
    return rec(i-1) + rec(i-2) + rec(i-3)

while True:
    N = int(input())
    if not N:
        break
    print(int(math.ceil(rec(N)/3650)))

Measured memory_bytes: 8324
import java.io.*
import java.util.*

const val YES = "Yes"
const val NO = "No"
fun solve(S: String, T: String){
    if (S == T ){println(YES); return}
    val len = S.length
    // i文字切り取り
    // i = 3, len = 5: "abcde" -> "cde"(2..4) + "ab"(0..1)
    for (i in 1..len - 1){
        val s = S.slice(len - i..len - 1 ) + S.slice(0..len - i - 1)
        if (s == T) {println(YES); return}
    }
    println(NO)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val S = sc.next()
    val T = sc.next()
    solve(S, T)
}



Measured memory_bytes: 31772
// ABC095B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
	int N, X;
	int m[101];
	cin >> N >> X;
	for (int i = 1; i <= N; i++)cin >> m[i];
	int M=0;
	for (int i = 1; i <= N; i++)M+=m[i];
	X = X - M;
	for (int i = 1; i <= N; i++)if(M > m[i]) M=m[i];
	int i=0;
	//while(X>M)
	//{
	 // X = X -M;
	  //i++;
	//}
	int ans = (N + X / M);
	cout << ans << endl;
	return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
using namespace std;

int main() {
	int N, M, C;
	cin >> N >> M >> C;
	int b_row[25];
	int a[25] [25];
	int cnt= 0;
	//int a_row[25];
	for (int i = 1; i <= M; ++i) {
		cin >> b_row[i];
	}

	for (int i = 1; i <= N; ++i) {
		int sum = 0;
		for (int j = 1; j <= M; ++j) {
			cin >> a[i][j];
			sum += a[i][j] * b_row[j];
		}
		if (sum + C > 0) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int i = 0, count = 0, data[10000];
    
    while(1) {
        scanf("%d", &data[i]);
        
        if (data[i] == 0) break;
        
        i++;
    }
    
    count = i;
    
    for (i = 0; i < count; i++) {
        printf("Case %d: %d\n", i+1, data[i]);
    }
    return 0;
}


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

bool check(int n){
  while(n%2==0){
    n/=2;
  }
  while(n%3==0){
    n/=3;
  }
  while(n%5==0){
    n/=5;
  }
  if(n==1){
    return true;
  }else{
    return false;
  }
}

int main(){
  int m,n;
  while(1){
    cin>>m;
    if(m==0)break;
    cin>>n;
    int ans=0;
    for(int i=m;i<=n;i++){
      if( check(i) ){
        ans++;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3064
from collections import defaultdict


def solve(l, ss):
    xor = 0
    for d in range(min(ss), l + 1):
        sl = ss[d]
        sl.sort()
        while sl:
            s = sl.pop()
            ps = s[:-1]
            ss[d + 1].append(ps)
            if s[-1] == '1' and sl and sl[-1][:-1] == ps:
                sl.pop()
            else:
                xor ^= d & -d
        del ss[d]
    return xor


n, l = map(int, input().split())
ss = defaultdict(list)
for s in (input() for _ in range(n)):
    ss[l - len(s) + 1].append(s)

print('Alice' if solve(l, ss) else 'Bob')


Measured memory_bytes: 3836
i;
char s[9999];
main(){
  for(;~scanf("%[^\n]",s);i=!puts(s))
      for(getchar();!strstr(s,"this")&!strstr(s,"the")&!strstr(s,"that");)
          for(i=0;s[i];)s[i++]=isalpha(s[i])?s[i]-'z'?s[i]+1:'a':s[i];
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef long double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define sortvec(a) sort(a.begin(), a.end())
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define cerr if(true)cerr
void print(){cout<<endl;}
template<typename T,typename... Args>
void print(T a, Args... args) {cout<<a<<" ";print(args...);}
lli llipowerp(lli x, lli y, lli p=LLONG_MAX)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli binarySearch(vector<int> arr, int l, int r, int x)
{
    if (r >= l)
    {
        lli mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}
template <typename T>
inline void printvec(vector<T> inp){
    for(auto it:inp) cout<<it<<" ";
    cout << endl;
}
//---------------------------------------------------------------------------------
// struct con{
//     int a,b,c,d;

// };
// bool cmp(const con &x, const con &y){
//     return x.d<=y.d;
// }
// int main()
// {
//     int n,m,q,w,x,y,z;
//     cin>>n>>m>>q;
//     con temp;
//     vector<con> all;
//     fori(q){
//         cin>>w>>x>>y>>z;
//         all.pb({w,x,y,z});
//     }
//     sort(all.begin(),all.end(),cmp);
//     vector<int> ans(n+1,1);
//     fori(q){
//         ans[all[i].b]=ans[all[i].a]+all[i].c;
        
//     }
//     lli tot=0;
//     fori(q)
//     {
//         if (ans[all[i].b] == ans[all[i].a] + all[i].c){
//             tot+=all[i].d;
//         }
//     }
//     cout<<tot<<endl;
// }
int main(){
    lli a,b,n;
    cin>>a>>b>>n;
    lli ans=0;
    ans=(min(n,b-1)*(a%b))/b;
    ans+=min(n,b-1)*(a/b);
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
using namespace std;
const int N=3e3+10;
int n,mod,ans,s[N][N],t[N],fac[N],inv[N],f[N],g[N][N];
inline int MOD(int x){x-=x>=mod? mod:0;return x;}
inline int Minus(int x){x+=x<0? mod:0;return x;}
inline void Add(int &x,int y){x+=y;x-=x>=mod? mod:0;}
inline int fas(int x,int p,int M){int res=1;while(p){if(p&1)res=1ll*res*x%M;p>>=1;x=1ll*x*x%M;}return res;}
inline void Preprocess(){
	fac[0]=1;for(register int i=1;i<=n;i++)fac[i]=1ll*fac[i-1]*i%mod;
	inv[0]=inv[1]=1;for(register int i=2;i<=n;i++)inv[i]=(-1ll*mod/i*inv[mod%i]%mod+mod)%mod;
	for(register int i=2;i<=n;i++)inv[i]=1ll*inv[i-1]*inv[i]%mod;//注意long long的强制转换 
}
inline int C(int n,int m){if(n<0||m<0||n<m)return 0;return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}
int main(){
	scanf("%d%d",&n,&mod);Preprocess();
	ans=fas(2,fas(2,n,mod-1),mod);s[0][0]=1;
	for(register int i=1;i<=n+1;i++)
		for(register int j=1;j<=i;j++)
			s[i][j]=MOD(s[i-1][j-1]+1ll*j*s[i-1][j]%mod);
	for(register int i=1;i<=n;i++)f[i]=fas(2,fas(2,n-i,mod-1),mod);
	for(register int i=1;i<=n;i++)
		for(register int j=0;j<=n;j++)
			g[i][j]=fas(fas(2,n-i,mod),j,mod);
	for(register int i=1;i<=n;i++)
		for(register int j=0;j<=i;j++)
			Add(t[i],1ll*s[i+1][j+1]*C(n,i)%mod*f[i]%mod*g[i][j]%mod);
	for(register int i=1;i<=n;i++)
		if(i&1)ans=Minus(ans-t[i]);else Add(ans,t[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 71040
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string n,m;
    cin>>n>>m;
    n+=m;
    int  sum=0;
    for(int  i=0;i<n.size();i++)
    {
       sum=sum*10+(n[i]-'0');
    }
    int l=sqrt(sum);
    if(l*l==sum)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int S = 0;
	int h = 0, m = 0, s = 0;

	cin >> S;

	if(S >= 60){

		m = S / 60;

		if(m >= 60){

			h = m / 60;
			m = m % 60;
		}

		s = S % 60;
	}

	cout << h << ":" << m << ":" << s << endl;

	return 0;
}

Measured memory_bytes: 1164
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int h1 = sc.nextInt();
        int m1 = sc.nextInt();
        int h2 = sc.nextInt();
        int m2 = sc.nextInt();
        int k = sc.nextInt();
        System.out.println(h2*60+m2-h1*60-m1-k);
    }
}



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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li n, m;

PI cb[100100];
li a[100100];

int main() {
    cin >> n >> m;
    rin{
        cin >> a[i];
    }
    rep(i, m) {
        cin >> cb[i].S >> cb[i].F;
    }
    sort(a, a + n);
    sort(cb, cb + m);

    li cb_now = m - 1;
    li cnt = 0;
    li res = 0;
    rin{
        if (a[i] < cb[cb_now].F) {
            a[i] = cb[cb_now].F;
            cnt++;
            if (cnt >= cb[cb_now].S) {
                cb_now--;
                cnt = 0;
                if (cb_now < 0)break;
            }
        } else {
            break;
        }
    }

    rin{
        res += a[i];
    }
    cout << res << endl;


    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(auto i = k; i != n; i++)
#define rrep(i, n) RREP(i, n, 0)
#define RREP(i, n, k) for(auto i = n; i != k; i--)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl;

typedef long long ll;

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

    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    int ans[2] = {0};

    rep(a,31) {
        rep(b,31) {
            rep(c,3001) {
                rep(d,3001) {
                    int sugar = C*c+D*d, water = A*a+B*b;
                    if(water*E < sugar || 100*water + sugar > F)
                        break;
                    if((ans[0]==0 && ans[1]==0) ||
                    ans[1] *(100*water +sugar) < sugar *(100*ans[0] +ans[1])) {
                        ans[0] = water;
                        ans[1] = sugar;
                        // cout << a << " " << b << " " << c << " " << d << endl;
                    }
                }
            }
        }
    }
    cout << 100*ans[0]+ans[1] << " " << ans[1] << endl;
    return 0;
}


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

using namespace std;

int main(void){

    int a, b;
    cin >> a >> b;

    if(a < b){
        for(int i = 0;i < b;i++){
            cout << a;
        }
    }else{
        for(int i = 0;i < a;i++) cout << b;
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int sum=0,fushu=1;
	char c=getchar();
	while(!isdigit(c)){
		if(c=='-') fushu=-fushu;
		c=getchar();
	}
	while(isdigit(c)){
		sum=sum*10+(c^48);
		c=getchar();
	}
	return sum*fushu;
}
void write(int x){//只能输出非负整数！！！比赛的时候看清楚！！！ 
	if(x>=10) write(x/10);
	putchar(x%10+48);
}
inline void writeln(int x){
	write(x);
	putchar('\n');
}
int n,k;
char s[105];
int main(){
	scanf("%d%d",&n,&k);
	scanf("%s",s+1);
    for(int i=1;i<=n;i++)
      if(i==k) putchar(s[i]-'A'+'a');
      else putchar(s[i]);
    return 0;
} 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
int main() {
	ll N, M, c = 0, p;
	scanf("%lld", &N);
	vector<ll> A(N), B(N), D(N);
	rep(i, 0, N) {
		scanf("%lld%lld", &A[i], &B[i]);
	}
	for (int i = N - 1; i >= 0; i--) {
		c += (B[i] - A[i] % B[i]) % B[i];
		if (i)A[i - 1] += c;
	}
	printf("%lld\n", c);
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <ctype.h>

int main(void)
{
  int num[100];
  int i=0;
  int flag=0;
  int c;

  while((c=getchar())!= '\n')
  {
    if(isdigit(c)==0)
    {
      if(c==' ') i++;
      else
      {
        i=i-2;
        if(c=='+')
        {
          num[i]=num[i]+num[i+1];
        }
        else if(c=='-')
        {
          num[i]=num[i]-num[i+1];
        }
        else if(c=='*')
        {
          num[i]=num[i]*num[i+1];
        }
      }
      flag=0;
    }
    else
    {
      if(flag==0)
      {
        num[i]=c-48;
        flag=1;
      }
      else
      {
        num[i]=num[i]*10+c-48;
      }
    }
  }

  printf("%d\n",num[0]);

  return 0;

}

Measured memory_bytes: 524
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#define MOD 1000000007
#define pb push_back
using namespace std;

long long dp[404][404];
long long a[404];

long long sum(int l, int r) {
	long long sol = 0;
	for (int i = l; i <= r; i++) sol += a[i];
	return sol;
}

int main() {
	int n;
	cin >> n;
	
	for (int i = 0; i < n; i++) cin >> a[i];
	
	for (int i = 0; i < 404; i++)
		for(int j = 0; j < 404; j++) dp[i][j] = 1e18;

	for (int r = 0; r < n; r++) {
		for (int l = r; l >= 0; l--) {
			if (r == l) dp[l][r] = 0;
			else {
				for (int i = l; i < r; i++) {
					dp[l][r] = min(dp[l][r], dp[l][i] + dp[i + 1][r] + sum(l, r));
				}
			}
		}
	}

	cout << dp[0][n - 1];
	return 0;
}

Measured memory_bytes: 1664
//climpet problems are easy
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=55;
const int mxs=55*55;
int x[mx];
uli f[2][mx][mxs];
int main(){
   int n,a;
   cin>>n>>a;
   for(int i=0;i<n;i++)cin>>x[i];
   int rw=0;
   f[rw][0][0]=1ll;
   for(int i=0;i<n;i++){
      rw^=1;
      for(int s=0;s<mxs;s++)f[rw][0][s]=0ll;
      f[rw][0][0]=1ll;
      for(int q=1;q<=n;q++){         
         for(int s=0;s<mxs;s++){
            f[rw][q][s]=f[rw^1][q][s];
            if(x[i]<=s)f[rw][q][s]+=f[rw^1][q-1][s-x[i]];
         }
      }
   }
   uli ans=0ll;
   for(int x=1;x<=n;x++){
      if(a*x<mxs)ans+=f[rw][x][a*x];
   }
   printf("%lld\n",ans);
   return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
//#define pop pop_back
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define mem1(a) memset(a,-1,sizeof(a))
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define sz size() 
#define len length() 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI 3.14159265358979323846
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll k;cin>>k;
    ll ans=0;
    //map<pll,ll> m;
    rep(i,1,k+1)
    {
        rep(j,1,k+1)
        {
            rep(l,1,k+1)
            {
                ll x=__gcd(i,j);
                ans+=__gcd(x,l);
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3660
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << s1[0] << s2[1] << s3[2] << endl;
  return 0;
}

Measured memory_bytes: 256
H,W,K = gets.split.map(&:to_i)
C = $<.read.tr("#.\n",'10_').to_i(2)

h,h0,w,w0 = [],(1<<W)-1,[],0
H.times{
	h << h0
	h0 <<= W
	w0 = (w0<<W)|1
}
W.times{
	w << w0
	w0 <<= 1
}

p (2**(H+W)).times.count{|hw|
	c = C
	h.each{|h|
		c &= ~h if hw&1==1
		hw >>= 1
	}
	w.each{|w|
		c &= ~w if hw&1==1
		hw >>= 1
	}
	next c.to_s(2).count(?1) == K
}


Measured memory_bytes: 14436
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;

struct judge{
	bool operator()(const p&a,const p&b)const{
		return a.first<b.first;
	}
};

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	unordered_map<int,int>m;
	for(int i=0;i<n;++i){
		int a; cin>>a;
		++m[a];
	}
	priority_queue<p,vector<p>,judge>q;
	for(auto&i:m){
		p tmp; tmp=i;
		if(i.second>1)q.push(i);
	}
	int64_t ans;
	if(q.size()>=2){
		p tmp=q.top(); q.pop();
		if(tmp.second>=4)ans=(int64_t)tmp.first*tmp.first;
		else ans=(int64_t)tmp.first*q.top().first;
	}else if(q.size()){
		ans=(int64_t)q.top().first*q.top().first;
	}else{
		ans=0;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 4388
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int (i) = (N)-1; (i) >= 0; (i)--)
#define REP(i, N) for(int (i) = 0; (i) < (int)(N); (i)++)
 #include <iomanip>
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

int w,s;

void solve(istream& cin, ostream& cout) {
	cin >>s>>w;
	if(w >= s) {
		cout <<"unsafe";
	} else {
		cout <<"safe";
	}
}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


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

int main() {
  int n;
  cin>>n;
  int data[200];
  for(int i=0;i<n;i++)cin>>data[i];
  int a=0,b=0;
  sort(data,data+n,greater<int>());
  for(int i=0;i<n;i++){
    if(i%2==0)a+=data[i];
    else b+=data[i];
  }
  cout<<a-b<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>    
#define inf 100000000
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE long long
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
void g(char *s,int n){
    int i;
    char t;
    rep(i,n/2){
        t=s[i];
        s[i]=s[n-i-1];
        s[n-i-1]=t;
    }
}

int main(void){
    int i,j,c,f,l[100],r;
    char s[100],ans[100];
    while(1){
        chin(s);
        if(s[0]=='.')break;
        MEMSET(ans);
        MEMSET(l);
        j=0;
        c=0;
        f=-1;
        rep(i,strlen(s)){
            if(s[i]=='+')c++;
            else if(s[i]=='-')c--;
            else if(s[i]=='['){
                f++;
                l[f]=j;
            }
            else if(s[i]==']'){
                r=j-1;
                g(ans+l[f],r-l[f]+1);
                f--;
            }
            else if(s[i]=='?'){
                ans[j++]=s[i];
                c=0;
            }
            else{
                ans[j++]=(s[i]-'A'+c%26+26)%26+'A';
                c=0;
            }
        }
        rep(i,j){
            if(ans[i]=='?')ans[i]='A';
        }
        puts(ans);
    }
    return 0;
}



Measured memory_bytes: 2040
class UnionFind:
    def __init__(self, size):
        self.parent = [-1]*size#非負なら親ノード，負ならグループの要素数

    def root(self, x): #root(x): xの根ノードを返す．
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x]) #xをxの根に直接つなぐ
            return self.parent[x]

    def merge(self, x, y): #merge(x,y): xのいるグループと$y$のいるグループをまとめる
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.parent[x] > self.parent[y]: #xの要素数がyの要素数より「小さい」とき入れ替える
            x,y=y,x
        self.parent[x] += self.parent[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True

    def issame(self, x, y): #same(x,y): xとyが同じグループにあるならTrue
        return self.root(x) == self.root(y)
        
    def size(self,x): #size(x): xのいるグループの要素数を返す
        return -self.parent[self.root(x)]


n,m=[int(i) for i in input().split()]

A=[[int(i)-1 for i in input().split()] for _ in range(m)]

ans = [0]*(m+1)
a = n*(n-1)//2
ans[0] = a

uf = UnionFind(n)
for i in range(m):
    j = m-i-1
    v1 = A[j][0]
    v2 = A[j][1]
#    print(v1,v2)
    if not uf.issame(v1,v2):
#        print(uf.parent)
        a -= uf.size(v1) * uf.size(v2)
        uf.merge(v1,v2)

    ans[i+1]=a

for i in range(m):
    print(ans[m-i-1])
    
    
    
    
    
    





Measured memory_bytes: 27140
#include<iostream>
#include<cstdio>
#define N 1000000
int tl[N];

using namespace std;

void sort(int,int);
int syori(int,int);

int main(){
  int n,m,i,ans;
  while(1){
    for(i=0;i<N;i++){
      tl[i]=0;
    }
    


  cin >> n; 
  cin >> m;

  if(m==0 && n==0) break;

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

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

  sort(m,n);


  ans=syori(n,m);

  cout << ans << endl;

  }
return 0;
}


void sort(int m , int n){
  int i,j,max,hi;


  for(i=0;i<=(m+n);i++){
    max=i;
    for(j=i;j<=(m+n);j++){
      if(tl[j] < tl[max])max=j;
    }
    hi=tl[max];
    tl[max]=tl[i];
    tl[i]=hi;
  }


  //  for(i=0;i<=(m+n);i++){
  // cout << tl[i] << endl;;

  //}

}


int syori(int n, int m){
  int i,max=0;
  for(i=0;i<(m+n);i++){
    if(tl[i+1]-tl[i]>=max)max=tl[i+1]-tl[i];
  }

  return max;
}

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

using namespace std;

typedef long long ll;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    while (s.back() != 'Z') s.pop_back();
    reverse(s.begin(), s.end());
    while (s.back() != 'A') s.pop_back();
    cout << s.size();
}


Measured memory_bytes: 720
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <bitset>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

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;
    }
}
int main(void)
{
    int x;
    string s;
    cin >> x;
    s = to_string(x);
    int sum = 0;
    for (int i = 0; i < s.length(); i++)
    {
        sum += s[i] - '0';
    }
    if (x % sum == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3668
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <deque>
#include <utility>
#include <queue>

int main() {
  size_t N;
  scanf("%zu", &N);

  std::vector<std::pair<intmax_t, intmax_t>> AB(N);
  for (auto& p: AB) scanf("%jd %jd", &p.first, &p.second);

  std::sort(AB.rbegin(), AB.rend(), [&](const auto& p, const auto& q) {
      return (p.first+p.second) < (q.first+q.second);
      });

  intmax_t res = 0;
  for (size_t i = 0; i < N; ++i) {
    fprintf(stderr, "%jd %jd\n", AB[i].first, AB[i].second);
    if (i % 2 == 0) {
      res += AB[i].first;
    } else {
      res -= AB[i].second;
    }
  }

  printf("%jd\n", res);
  // ???
}


Measured memory_bytes: 1792
n = int(input())
A = [list(map(int, input().split())) for i in range(n)]
p = 10**9+7
DP = [-1 for s in range(1<<n)]
DP[0] = 1
def dp(s, l):
    if DP[s] != -1:
        return DP[s]
    tmp = 0
    for i in range(n):
        if s & (1<<i) and A[l-1][i]:
            tmp += dp(s & ~(1<<i), l-1)
    DP[s] = tmp % p
    return DP[s]
print(dp((1<<n)-1, n))


Measured memory_bytes: 123368
#include <bits/stdc++.h>
using namespace std;
int main() {
    string X,Y;
    cin>>X>>Y;
    if(X<Y){
        cout<<'<';
    }
    else if(X>Y){
        cout<<'>';
    }
    else{
        cout<<'=';
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int a,b,c,d,e,f; cin >> a >> b >> c >> d >> e >> f;
	cout << a+b+c+d-min({a,b,c,d})+max(e,f) << endl;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

int f(int a, int b) {
	if (a % b == 0) {
		return a / b - 1;

	}
	else {
		return a / b;
	}
}

int main() {
	int n, k;
	cin >> n >> k;
	int a[n];
	rep (i, n) cin >> a[i];

	int left = 0, right = 1000000001;
	int mid;

	while (left + 1 < right) {
		mid = (left + right) / 2;
		int kk = k;
		rep (i, n) {
			kk -= f(a[i], mid);
		}
		if (kk < 0) {
			left = mid;
		}
		else {
			right = mid;
		}
	}

	int cnt = 0;
	rep (i, n) {
		cnt += f(a[i], mid);
	}

	if (cnt <= k) cout << mid << endl;
	else cout << mid + 1 << endl;
	return 0;
}


Measured memory_bytes: 4308
h = list(map(int, input().split()))
h1 = h[0]
m1 = h[1]
h2 = h[2]
m2 = h[3]
k = h[4]

lh = h2 - h1
if lh < 0:
    lh = lh + 24
lm = m2 - m1

if lh == 0 and lm < 0:
    lm = lm + 24*60

l = lh * 60 + lm - k
    

print(l)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std; 
    
int main(){
  string S;
  cin >> S;
  int A=S.size();
  if(S.at(A-1)!='s'){
    cout << S << "s" << endl;
  }
  else{
    cout << S << "es" << endl;
  }
}

Measured memory_bytes: 3572