akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int n;
  long long ans = 0;
  scanf("%d", &n);
  for (long long i = 1; i <= n ; i++){
    if(i % 3 == 0 || i % 5 == 0){
    }else{
      ans += i;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3256
/*
 * cpp_filepath
 */

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


void solve() {
  string s, t; cin >> s >> t;
  if (s == t) {
    cout << "EQUAL" << endl;
    return;
  }
  
  if (s.size() < t.size()) {
    cout << "LESS" << endl;
    return;
  }
  
  if (s.size() > t.size()) {
    cout << "GREATER" << endl;
    return;
  }
  
  if (s > t) {
    cout << "GREATER" << endl;
    return;
  }
  
  cout << "LESS" << endl;
}


Measured memory_bytes: 3612
N, K = map(int, input().split())
lists = list(map(int, input().split()))
if K == 0:
    print(sum(lists))
    exit()

if K <= len(lists):
    # for i in range(K):
    #     max_lists = lists.remove(max(lists))
    lists = sorted(lists)[:N - K]
    print(sum(lists))
    exit()
else:
    print(0)
    exit()

# print(lists)



Measured memory_bytes: 26024
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;

int k, d[111111];
priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > que;

int main() {
    scanf("%d", &k);
    que.push({ 1,1 });
    fill(d, d+110000, 1e9);
    d[1] = 1;
    while (!que.empty()) {
        auto now = que.top();
        que.pop();

        if (d[now.first] != now.second) {
            continue;
        }

        int nxt = (now.first*10)%k;
        if (d[nxt] > now.second) {
            d[nxt] = now.second;
            que.push({ nxt,now.second });
        }
        nxt = (now.first+1)%k;
        if (d[nxt] > now.second+1) {
            d[nxt] = now.second+1;
            que.push({ nxt,now.second+1 });
        }
    }

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

    return 0;
}


Measured memory_bytes: 2804
class Dice
 
	def initialize(aryDice)
    	@dice = aryDice;
    end
 
    #???????¢????
    def checkOperation(operation)
    	case operation
    	when "E" then
    		moveE;
    	when "N" then
    		moveN;
    	when "S" then
    		moveS;
    	when "W" then
    		moveW;
    	end
    end
 
    def searchRightNum(top,front)
 
    	for countMoveN in 0..3 do
    		if @dice[0] == top then
    			break;
    		end
    		moveN;
    	end
 
    	for countMoveE in 0..3 do
    		if @dice[0] == top then
    			break;
    		end
    		moveE;
    	end
 
    	for countMoveR in 0..3 do
    		if @dice[1] == front then
    			break;
    		end
    		moveR;
    	end
 
    end
 
    #E???????????????????§????
    def moveE
    	tmp = @dice[0];
        @dice[0] = @dice[3];
        @dice[3] = @dice[5];
        @dice[5] = @dice[2];
        @dice[2] = tmp;
    end
 
    #N???????????????????§????
    def moveN
    	tmp = @dice[0];
        @dice[0] = @dice[1];
        @dice[1] = @dice[5];
        @dice[5] = @dice[4];
        @dice[4] = tmp;
    end
 
    #S???????????????????§????
    def moveS
    	tmp = @dice[0];
        @dice[0] = @dice[4];
        @dice[4] = @dice[5];
        @dice[5] = @dice[1];
        @dice[1] = tmp;
    end
 
    #W???????????????????§????
    def moveW
    	tmp = @dice[0];
        @dice[0] = @dice[2];
        @dice[2] = @dice[5];
        @dice[5] = @dice[3];
        @dice[3] = tmp;
    end
 
    #R???????????????????§????
    def moveR
    	tmp = @dice[1];
        @dice[1] = @dice[2];
        @dice[2] = @dice[4];
        @dice[4] = @dice[3];
        @dice[3] = tmp;
    end
 
    #???????????????????????????????????¨???
    def getTopNum
    	return @dice[0];
    end
 
    def getBottomNum
    	return @dice[5];
    end
 
    def getRightNum
    	return @dice[2];
    end
 
    def getLeftNum
    	return @dice[3];
    end
 
    def getFrontNum
    	return @dice[1];
    end
 
    def getBackNum
    	return @dice[4];
    end
 
end
 
def checkAllDice(insDice1,insDice2)
	if insDice1.getTopNum == insDice2.getTopNum && 
		insDice1.getBottomNum == insDice2.getBottomNum && 
		insDice1.getRightNum == insDice2.getRightNum && 
		insDice1.getLeftNum == insDice2.getLeftNum && 
		insDice1.getFrontNum == insDice2.getFrontNum && 
		insDice1.getBackNum == insDice2.getBackNum then
 
		isMatch = true;
	end
end
 
aryDice1 = gets.split(' ').map(&:to_i);
insDice1 = Dice.new(aryDice1);
aryDice2 = gets.split(' ').map(&:to_i);
insDice2 = Dice.new(aryDice2);
 
isMatch = false;
 
for indexMoveN in 0..3 do
	if checkAllDice(insDice1,insDice2) then
		isMatch = true;
	end	
 
	insDice2.moveN;
	for indexMoveR in 0..3 do
		if checkAllDice(insDice1,insDice2) then
			isMatch = true;
		end
		insDice2.moveR;
	end
end
 
for indexMoveE in 0..3 do
	if checkAllDice(insDice1,insDice2) then
		isMatch = true;
	end
	insDice2.moveE;
	for indexMoveR in 0..3 do
		if checkAllDice(insDice1,insDice2) then
			isMatch = true;
		end
		insDice2.moveR;
	end
end
 
if isMatch then
	puts "Yes";
else
	puts "No";
end

Measured memory_bytes: 8764
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 1000008
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;


void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void solve(string s){
FOR(i,s.length()-1){
     if(s[i]==s[i+1]) {
    cout<<i+1<<" "<<i+2<<endl;
    return;
  }}
  FOR(i,s.length()-2){
       if(s[i]==s[i+2]) {
    cout<<i+1<<" "<<i+3<<endl;
    return;
  }}
  cout<<-1<<" "<<-1<<endl;
}
int main() {
string s;
cin>>s;
solve(s);
}





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

int main(){
  int X,Y;
  cin >> X >> Y;
  bool ans = false;
  for(int i=0;i<=X;i++){
    int j = X - i;
    if( Y == 2*i + 4*j) ans = true;
  }
  if(ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3616
#include <cstdio>
#include <algorithm>

using namespace std;

int a[400][400];
int b[400];

int main() {
    int n, m, ans = 0, i, j;
    
    scanf("%d %d", &n, &m);
    
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            a[i][j] = 1;
        }
    }
    
    for (i = 0; i < m; i++) {
        int x, y;
        
        scanf("%d %d", &x, &y);
        
        x--;
        y--;
        
        if (a[x][y] == 0 || b[x] == 1 && b[y] == 1) b[x] = b[y] = 1;
        
        a[x][y] = a[y][x] = 0;
        
        for (j = 0; j < n; j++) {
            if (a[x][j] == 0 || a[y][j] == 0 || b[x] == 1 || b[y] == 1) {
                a[x][j] = a[j][x] = a[y][j] = a[j][y] = 0;
            }
        }
    }
    
    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            ans += a[i][j];
        }
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 768
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws Exception {
        int x = scanInt(), y = scanInt();
        if (y % 2 != 0) {
            System.out.println("No");
        } else if (x * 4 < y) {
            System.out.println("No");
        } else {
            if (x * 2 == y) {
                System.out.println("Yes");
                return;
            }
            for (int i = 1; i <= x; i++) {
                if ((i * 4) + ((x - i) * 2) == y) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");
        }
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}

Measured memory_bytes: 32852
N=int(input())
A=list(map(int,input().split()))
d={}
for i in range(1,N+1):
    if not i+A[i-1] in d:
        d[i+A[i-1]]=1
    else:
        d[i+A[i-1]]+=1

ans=0
for i in range(1,N+1):
    if i-A[i-1] in d:
        ans+=d[i-A[i-1]]

print(ans)


Measured memory_bytes: 40292
from sys import stdin
import math

l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(stdin.readline().rstrip())

print(l[k-1])


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int par[10000];
int _rank[10000];
	//n????´???§?????????
void init(int n){
	rep(i,0,n){
		par[i]=i; _rank[i]=0;
	}
}
	//??¨??????????±???????
int find(int x){
	if(par[x]==x) return x;
	else return par[x]=find(par[x]);
}
	//x??¨y????±??????????????????????
void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y) return;
	if(_rank[x]<_rank[y]) par[x]=y;
	else{
		par[x]=y;
		if(_rank[x]==_rank[y]) _rank[x]++;
	}
}
	//x??¨y???????????????????±????????????????
bool same(int x,int y){
	return find(x)==find(y);
}


int main(){
	int n,m;
	cin>>n>>m;
	init(n+1);
	vi d(n+1,0);
	int a,b,city=0,mura=n;
	rep(i,0,m){
		cin>>a>>b;
		/*if(d[a]==0 && d[b]==0) city++;
		if(d[a] && d[b]) city--;*/
		unite(a,b);
		if(d[a]==0){
			d[a]=1; mura--;
		}
		if(d[b]==0){
			d[b]=1; mura--;
		}
	}
	vi ct(n+1);
	rep(i,1,n+1){
		int tmp=find(i);
		//o(tmp);
		if(ct[tmp]==0){
			ct[tmp]=1;
			city++;
		}
	}
	o((int)abs(city-2*mura));
}

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

#define ll long long
#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf (int)(1e18)
#define ps(x, y) fixed << setprecision(y) << x
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(p) p.begin(), p.end()
#define ub(a, b) upper_bound(all(a), b)
#define lb(a, b) lower_bound(all(a), b)
#define sz(x) (int)x.size()
#define PI 3.14159265
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void run()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
void solution()
{
    int n;
    cin >> n;
    int ans = 0;
    vi a(n);
    rep(i, 0, n)
    {
        cin >> a[i];
    }
    int sum = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        ans += (a[i] * sum);
        ans %= mod;
        sum += a[i];
        sum %= mod;
    }
    cout << ans << endl;
    return;
}
int32_t main()
{
    run();
    solution();
    return 0;
}

Measured memory_bytes: 4776
N = int(input())
A = [int(x) for x in input().split()]

cash = 1000
stock = 0
for i in range(N-1):
  if A[i] < A[i+1]:
    stock += cash // A[i]
    cash %= A[i]
  else:
    cash += A[i] * stock
    stock = 0
  #print(cash, stock)

cash += A[N-1] * stock
print(cash)

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

                            typedef long long ll;
                            typedef  double ld;
                            #define rep(i,a,n) for(ll i=(a); i<(n); i++)
                            #define per(i,a,n) for(ll i=(n-1); i>=(a); i--)
                            #define F first
                            #define S second
                            #define maxx(a,b) a=max(a,b)
                            #define minn(a,b) a=min(a,b)
                            #define db(x) cerr<<#x<<" = "<<x<<endl
                            #define N 1111111
                            #define mod 1000000007
                            #define rt return
                            #define inf 12345678908761

                            using namespace std;

                            ll a[111111];
                            ll w[111],v[111];

                            int main(){

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

                                //freopen("Ulug'bek","r",stdin);
                                //freopen("Abdimanabov","w",stdout);

                                ll n,W; cin>>n>>W;
                                rep(i,1,n+1)cin>>w[i]>>v[i];
                                memset(a,-1,sizeof a);
                                a[0]=0;
                                rep(i,1,n+1)
                                {
                                    per(j,v[i],111111)
                                    {
                                        if(a[j-v[i]]==-1)continue;
                                        if(a[j]==-1)a[j]=inf;
                                        if(a[j-v[i]]+w[i]<=W&&a[j-v[i]]+w[i]<a[j])a[j]=a[j-v[i]]+w[i];
                                    }
                                }

                                ll ans=0;

                                rep(i,1,111111)
                                if(a[i]>0&&a[i]!=inf)maxx(ans,i);

                                cout<<ans;

                            rt 0;
                            }



















Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    long long A,B,C,K; cin>>A>>B>>C>>K;
    long long a=B+C,b=A+C,c=A+B;
    if(K%2==0){
        if(A-B>1000000000000000000||A-B<-1000000000000000000){
            cout<<"Unfair"<<endl;
        }else{
            cout<<A-B<<endl;
        }
    }else{
        if(a-b>1000000000000000000||a-b<-1000000000000000000){
            cout<<"Unfair"<<endl;
        }else{
            cout<<a-b<<endl;
        }
    }
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define ct(string) cout << string << endl

int main() {
    char c;
    int flag = 0;
    while (cin >> c) {
        if (c == 'C') flag++;
        if (flag && c == 'F') {ct("Yes"); return 0;}
    }
    ct("No");
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


vector<int> to_s(long long n, int base) {
	vector<int> s;
	do { s.push_back(n % base) ; n /= base; } while (n);
	reverse(s.begin(), s.end());
	return s;
}


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long ans = -1;
	long long n, s;
	cin >> n >> s;
	if (n == s) {
		cout << n+1 << endl;
		return 0;
	}

	for (long long b = 2; b*b <= n; b++) {
		vector<int> str(to_s(n,b));
		long long sum = 0;
		for (int c : str)sum += c;
		if (sum==s) {
			ans = b;
			break;
		}
	}
	if (ans == -1) {
		long long sq = ceil(sqrt(n)) + 1e-10;
		for (long long p = sq-1; p > 0 ;p--) {
			long long q = s - p;
			if ((n - q) % p || q<0)continue;
			long long b = (n - q) / p;
			if (q >= b || p >= b)continue;
			if(b*p+q==n){
				ans = b;
				break;
			}
		}
	}

	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
k = int(input())
if k % 2 == 0:
    print(-1)
    exit()

ten = 1
now = 0
for i in range(10**8):
    x = (ten*7)%k
    now = (now+x)%k
    if now == 0:
        print(i+1)
        exit()
    ten = ten*10%k
print(-1)

Measured memory_bytes: 63344
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.NothingToLearn
{
    class ABC047_B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] whn = ReadInts();
            int w = whn[0];
            int h = whn[1];
            int n = whn[2];
            int l = 0;
            int r = w;
            int t = h;
            int b = 0;
            for(int i = 0; i < n; i++)
            {
                int[] xya = ReadInts();
                int x = xya[0];
                int y = xya[1];
                int a = xya[2];
                switch (a)
                {
                    case 1:
                        l = Max(l, x);
                        break;
                    case 2:
                        r = Min(r, x);
                        break;
                    case 3:
                        b = Max(b, y);
                        break;
                    case 4:
                        t = Min(t, y);
                        break;
                }
            }

            if(r<=l || t <= b)
            {
                WriteLine(0);
            }
            else
            {
                WriteLine((r - l) * (t - b));
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin>>N;
	vector<int> A(N);
	for(int i=0;i<N;++i){
		cin>> A[i];
	}
	int ans = 0;
	for(int i=1;i<N;++i){
		if(A[i-1] == A[i]){
			A[i] = -1;
			++ans;
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
n,x,y=map(int,input().split())
ans=[0]*(n-1)
graph=[[] for _ in range(n)]
for i in range(n-1):
    graph[i].append(i+1)
    graph[i+1].append(i)

graph[x-1].append(y-1)
graph[y-1].append(x-1)

for i in range(n-1):
    for j in range(i+1,n):
        dist=min(abs(j-i),(abs(j-(y-1))+1+abs(x-1-i)))
        ans[dist-1]+=1

for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 3700
//abc130_b.cpp
//Sun Sep  1 20:45:36 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int l[n];
	int ans = 1;
	int accum = 0;
	for (int i=0;i<n;i++){
		cin >> l[i];
		accum += l[i];
		if (x>=accum){
			ans++;
		}
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
ll po[35];
int main(){
    REP(i,35){
        po[i] = 1ll<<i;
    }
    ll n; cin >> n;
    map<ll, ll> m;
    REP(i,n){
        ll tmp; cin >> tmp;
        m[tmp]++;
    }
    ll ans = 0;
    auto itr = m.end();
    REP(j, m.size()){
        itr--;
        FORR(i,34,0){
            if(itr->second==0)break;
            if(po[i]> 2*itr->first) continue;
            if(po[i]<=itr->first) break;
            auto itrtmp = m.find(po[i]-itr->first);
            if(itrtmp!=m.end() && itrtmp->second ){
                ll cnt;
                if(itrtmp == itr){
                    cnt = itr->second/2;
                }else{
                    cnt = min(itr->second, itrtmp->second);
                }
                ans += cnt;
                itr->second-=cnt;
                itrtmp->second-=cnt;
            }
        }
    }
    
    cout << ans << endl;
  

}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	double d,t,s;
	cin>>d>>t>>s;
	if(ceil(d/s)<=t)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <algorithm>
#include <cctype>
using namespace std;

template<class T> using vec = vector<T>;
constexpr int inf = 1e9;

struct edge{
    int s,t,d;
    bool isnear;
};

int solve(int N,vec<edge>& edges){
    vec<int> dist(N,inf);
    dist[0] = 0;
    for(int i=0;i<N;i++){
        bool update = false;
        for(auto& e:edges){
            if(dist[e.s]+e.d<dist[e.t]){
                update = true;
                dist[e.t] = dist[e.s]+e.d;
            }
        }
        if(i==N-1 && update) return -1;
    }
    for(int i=0;i<N;i++){
        if(dist[i]<0) return -1;
    }
    return *max_element(dist.begin(),dist.end());
}

int main(){
    int N,C;
    cin >> N >> C;
    vec<edge> edges;
    vec<edge> changable;
    for(int i=0;i<C;i++){
        string S;
        cin >> S;
        int id = 0,a = 0,b = 0,d = 0;
        int qid = 0,isnear = 0;
        while(isdigit(S[id])){
            a = 10*a+(S[id]-'0');
            id++;
        }
        if(S[id]=='*'){
            qid = 2;
            id++;
        }else if(S[id]=='>'){
            qid = 1;
            id += 2;
        }else id += 2;
        while(isdigit(S[id])){
            b = 10*b+(S[id]-'0');
            id++;
        }
        if(S[id]=='-') isnear = 1;
        id++;
        while(id<S.size()){
            d = 10*d+(S[id]-'0');
            id++;
        }
        a--; b--;
        if(qid==2){
            changable.push_back({a,b,d,isnear});
            continue;
        }
        if(qid==1) swap(a,b);
        edges.push_back({b,a,0,false});
        if(isnear){
            edges.push_back({a,b,d,true});
        }else{
            edges.push_back({b,a,-d,false});
        }
    }
    int ans = 0;
    bool valid = false;
    int n = changable.size();
    for(int S=0;S<(1<<n);S++){
        vec<edge> now = edges;
        for(int i=0;i<n;i++){
            int a = changable[i].s,b = changable[i].t;
            if(S&(1<<i)) swap(a,b);
            now.push_back({b,a,0,false});
            if(changable[i].isnear){
                now.push_back({a,b,changable[i].d,true});
            }else{
                now.push_back({b,a,-changable[i].d,false});
            }   
        }
        int res = solve(N,now);
        if(res!=-1){
            valid = true;
            ans = max(ans,res);
        }
    }
    if(!valid) cout << -1 << endl;
    else if(ans==inf) cout << "inf" << endl;
    else cout << ans << endl;
}


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

const int N = 8;
const int cap[N] = {4,1,4,1,2,1,2,1};
int num[N];

int main() {
  while(1) {
    for(int i = 0; i < N; ++i) {
      if(cin >> num[i]) ; else return 0;
    }
    int res = (1<<30);
    vector<int> v;
    for(int j = 0; j < N; ++j) {
      int sum = 0;
      for(int i = 0; i < N; ++i) {
        sum += max(0, num[i] - cap[(i+j)%N]);
      }
      if(sum <= res) {
        vector<int> t;
        for(int i = 0; i < N; ++i) t.push_back(cap[(i+j)%N]);
        if(sum == res) {
          v = min(v, t);
        } else {
          res = sum;
          v = t;
        }
      }
    }
    for(int i = 0; i < N; ++i) {
      if(i) cout << " ";
      cout << v[i];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>


int main()
{
    char x;
    INX(x);

    if(0x61 <= x && x <= 0x7a)
    {
        OUTX('a');
    }
    else
    {
        OUTX('A');
    }
    


    return 0;
}


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

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT=-2;
static const int ON_SEGMENT=0;

class Point {
public:
    double x,y;

    Point(double x=0,double y=0):x(x),y(y) {}
    Point operator + (Point p) {return Point(x+p.x,y+p.y);}
    Point operator - (Point p) {return Point(x-p.x,y-p.y);}
    Point operator * (double a) {return Point(a*x,a*y);}
    Point operator / (double a) {return Point(x/a,y/a);}

    double abs() {return sqrt(norm());}
    double norm() {return x*x+y*y;}

    bool operator<(const Point &p) const {
        return x!=p.x ? x<p.x : y<p.y;
    }
    bool operator==(const Point &p) const {
        return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
    }
};

typedef Point Vector;
struct Segment {Point p1,p2;};
typedef Segment Line;

class Circle {
public:
    Point c;
    double r;
    Circle(Point c=Point(),double r=0.0): c(c),r(r) {}
};

double dot(Vector a,Vector b) {
    return  a.x*b.x+a.y*b.y;
}

double cross (Vector a,Vector b) {
    return a.x*b.y-a.y*b.x;
}

double getDistance(Point a,Point b) {
    return (a-b).abs();
}

double getDistanceLP(Line l,Point p) {
    return abs(cross(l.p2-l.p1,p-l.p1)/(l.p2-l.p1).abs());
}

double getDistanceSP(Segment s,Point p) {
    if(dot(s.p2-s.p1,p-s.p1)<0.0) return (p-s.p1).abs();
    if(dot(s.p1-s.p2,p-s.p2)<0.0) return (p-s.p2).abs();
    return getDistanceLP(s,p);
}

int ccw(Point p0,Point p1,Point p2) {
    Vector a=p1-p0;
    Vector b=p2-p0;
    if(cross(a,b)>EPS) return COUNTER_CLOCKWISE;
    if(cross(a,b)<EPS) return CLOCKWISE;
    if(dot(a,b)<-EPS) return ONLINE_BACK;
    if(a.norm()<b.norm()) return ONLINE_FRONT;
    return ON_SEGMENT;
}

bool intersect(Point p1,Point p2,Point p3,Point p4) {
    return (ccw(p1,p2,p3)*ccw(p1,p2,p4)<=0 && ccw(p3,p4,p1)*ccw(p3,p4,p2)<=0);
}

bool intersect(Segment s1,Segment s2) {
    return intersect(s1.p1,s1.p2,s2.p1,s2.p2);
}

double getDistance(Segment s1,Segment s2) {
    if(intersect(s1,s2)) return 0.0;
    return min(min(getDistanceSP(s1,s2.p1),getDistanceSP(s1,s2.p2)),min(getDistanceSP(s2,s1.p1),getDistanceSP(s2,s1.p2)));
}

int main(void) {
    int q;cin>>q;
    while(q) {
        Segment s1,s2;
        cin>>s1.p1.x>>s1.p1.y>>s1.p2.x>>s1.p2.y>>s2.p1.x>>s2.p1.y>>s2.p2.x>>s2.p2.y;
        printf("%.10f\n",getDistance(s1,s2));
        q--;
    }
    return 0;
}

Measured memory_bytes: 3256
open Batteries

module IntSet = Set.Make (struct
  let compare = Pervasives.compare

  type t = int
end)

let read_two () = Scanf.sscanf (read_line ()) "%d %d" (fun a b -> (a, b))

let read_three () =
  Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c -> (a, b, c))

let read_four () =
  Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c d -> (a, b, c, d))

let read_list () =
  read_line () |> String.split_on_char ' '
  |> List.map (fun s -> int_of_string s)

let rec read_list_nl n =
  if n = 0 then [] else (read_line () |> int_of_string) :: read_list_nl (n - 1)

(* a**x *)
let pow a x =
  let rec aux acc = function 0 -> acc | n -> aux (acc * a) (n - 1) in
  aux 1 x

let rec pow2 n = if n mod 2 = 0 then 1 + pow2 (n / 2) else 0

let rec total acc = function [] -> acc | x :: rest -> total (acc + x) rest

let make_num s i = (s.(i) * 100) + (s.(i + 1) * 10) + s.(i + 2)

let () =
  let s =
    read_line () |> String.explode
    |> List.map (fun x -> int_of_char x - int_of_char '0')
    |> Array.of_list
  in
  let n = Array.length s in
  let ans = ref 1000 in
  for i = 0 to n - 3 do
    let x = make_num s i in
    ans := min (abs (753 - x)) !ans
  done;
  print_int !ans;
  print_newline ()


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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, bit = 1; cin >> n;
    stack<ll> ans;
    if(n == 0) {
        cout << 0 << endl;
    }
    else {
        while(n != 0) {
            if((n%2) == 0) {
                ans.push(0);
                n /= -2;
            }
            else {
                ans.push(1);
                n = (n-1)/(-2);
            }
        }
        while(!ans.empty()) {
            ll t = ans.top();
            ans.pop();
            cout << t;
        }
        cout << endl;
    }

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3584
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	string w;
	cin >> w;
	map<char, int> m;
	int n = w.size();
	rep(i, n) m[w[i]]++;
	bool ans = true;
	for(auto i = m.begin(); i != m.end(); i++) {
		if(i->second % 2 != 0) ans = false;
	}
	cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner stdIn = new Scanner(System.in);
		
		int numAry[] = new int[3];
		
		numAry[0] = stdIn.nextInt();
		numAry[1] = stdIn.nextInt();
		numAry[2] = stdIn.nextInt();
		
		int tmp = 0;
		
		if (numAry[0] > numAry[1]) {
			tmp = numAry[1];
			numAry[1] = numAry[0];
			numAry[0] = tmp;
		}
		if (numAry[1] > numAry[2]) {
			tmp = numAry[2];
			numAry[2] = numAry[1];
			numAry[1] = tmp;	
		}
		if (numAry[0] > numAry[1]) {
			tmp = numAry[1];
			numAry[1] = numAry[0];
			numAry[0] = tmp;
		}
		
		System.out.print(numAry[0] + " ");
		System.out.print(numAry[1] + " ");
		System.out.print(numAry[2]);
		System.out.println();
		
	}
}


Measured memory_bytes: 26292
#include<iostream>
using namespace std;
int main(){
    
    int n, q, count=0;
    cin >> n;
    int S[n];
    for(int i=0;i<n;i++){
        cin >> S[i];
    }
    cin >> q;
    int T[q];
    for(int j=0;j<q;j++){
        cin >> T[j];
    }
    
    for(int j=0;j<q;j++){
        for(int i=0;i<n;i++){
            if(T[j] == S[i]){
                count++;
                break;
            }
        }
    }
    
    cout << count << endl;
    
    return 0;
}


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

int main () {
  int A,B,C;
  cin>>A>>B;
  C=A+B;
  if(A%3==0 || B%3==0 || C%3==0){
    cout<<"Possible"<<endl;
  }
  else{
    cout<<"Impossible"<<endl;
  }
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int L, R;

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

    std::cin >> L >> R;

    ll mn = 2019;

    for(int i=L;i<std::min(L + 2019, R + 1);++i){
        for(int j=i+1;j<std::min(i + 1 + 2019, R + 1);++j){
            // std::cout << i << ", " << j << ", " << (1ll * i * j % 2019) << std::endl;
            mn = std::min<ll>(mn, 1ll * i * j % 2019);
        }
    }

    std::cout << mn << std::endl;
}


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

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

  if(b >= a){
    int ans = b/a;

    if(ans > c) ans = c;

    cout << ans << endl;
  }

  else cout << '0' << endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

const double pi=3.1415;
ll absc(ll a,ll b){return (a-b>0?a-b:b-a);
}
ll mini(ll a,ll b){return (a>b?b:a);}
ll gcd(ll a,ll b){
	if(a<b)swap(a,b);
	return (a%b?gcd(a%b,b):b);
}
int main()
{
    ll a,b,c,N,K,aa=1000000007;
    string s,t;
    cin>>N>>K;
    vector<ll>ans(N+1);
    ll j=0,k=N,tmp=N*(N-1)/2%aa;
    ll maxi=tmp,mini=tmp;
    for(int i=N;i>=0;i--)
    {
    	ans[i]=maxi-mini+1;
    	maxi-=j;
    	mini-=k;
    	j++;k--;
    }
    ll anss=0;
    for(int i=K-1;i<=N;i++)anss=(ans[i]+anss)%aa;
    cout<<anss;
}


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

typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll X, Y, ans = 0;
    cin >> X >> Y;
    while (X <= Y) {
        X *= 2;
        ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
a,b = map(int, input().split())


a_s = ""
b_s = ""

for _ in range(b):
    a_s = a_s + str(a)

for _ in range(a):
    b_s = b_s + str(b)

if a_s <= b_s:
    print(a_s)
else:
    print(b_s)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
using namespace std;
int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll aux = n/(a+b);
    ll aux2 = min(a, n%(a+b));
    cout<<a*aux + aux2<<endl;
}

Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int n, m;
  cin >> n;
  string s[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  cin >> m;
  string t[m];
  for (int i = 0; i < m; i++) cin >> t[i];
  int ans = -100;
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if (s[i] == s[j]) cnt++;
    }
    for (int j = 0; j < m; j++) {
      if (s[i] == t[j]) cnt--;
    }
    if (cnt > ans) ans = cnt;
  }
  cout << max(0, ans) << endl;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        s: String,
    }

    solve(s);
}

fn solve(s: String) {
    if !is_palindrome(&s) {
        println!("No");
        return;
    }
    let mut begin = 0;
    let mut end = (s.len() - 1) / 2;
    if !is_palindrome(&s[begin..end].to_string()) {
        println!("No");
        return;
    }
    begin = (s.len() + 3) / 2 - 1;
    end = s.len();
    if !is_palindrome(&s[begin..end].to_string()) {
        println!("No");
        return;
    }

    println!("Yes");
}

fn is_palindrome(s: &String) -> bool {
    s.eq(&s.chars().rev().collect::<String>())
}


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

int main() {
   long long int n,k;
   cin>>n;
   cin>>k;
   long long int h[n],sum=0;
   for(int i=0;i<n;i++)
   {
       cin>>h[i];
   }
   sort(h,h+n);
   for(int i=0;i<n-k;i++)
   {
       sum=sum+h[i];
   }
   cout<<sum;
}

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

int main() {
  int n,a,b,c;
  cin >> n >> a >> b >> c;
  string s[n];
  char ans[n];
  rep(i,n) cin >> s[i];
  rep(i,n){
    if(s[i] == "AB"){
      if(a==b){
        if(a==0){cout << "No" << endl; return 0;}
        else if(i==n-1){a--;b++;ans[i]='B';}
        else{
          if(s[i+1]=="AB"){a--;b++;ans[i]='B';}
          if(s[i+1]=="AC"){a++;b--;ans[i]='A';}
          if(s[i+1]=="BC"){a--;b++;ans[i]='B';}
        }
      }
      else if(a>b){a--;b++;ans[i]='B';}
      else{a++;b--;ans[i]='A';}
    }
    if(s[i] == "AC"){
      if(a==c){
        if(a==0){cout << "No" << endl; return 0;}
        else if(i==n-1){a--;c++;ans[i]='C';}
        else{
          if(s[i+1]=="AB"){a++;c--;ans[i]='A';}
          if(s[i+1]=="AC"){a--;c++;ans[i]='C';}
          if(s[i+1]=="BC"){a--;c++;ans[i]='C';}
        }
      }
      else if(a>c){a--;c++;ans[i]='C';}
      else{a++;c--;ans[i]='A';}
    }
    if(s[i] == "BC"){
      if(b==c){
        if(b==0){cout << "No" << endl; return 0;}
        else if(i==n-1){b--;c++;ans[i]='C';}
        else{
          if(s[i+1]=="AB"){b++;c--;ans[i]='B';}
          if(s[i+1]=="AC"){b--;c++;ans[i]='C';}
          if(s[i+1]=="BC"){b--;c++;ans[i]='C';}
        }
      }
      else if(b>c){b--;c++;ans[i]='C';}
      else{b++;c--;ans[i]='B';}
    }
  }
  cout << "Yes" << endl;
  rep(i,n){ cout << ans[i] << endl;}
}


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

signed main(){
  int n;
  cin>>n;
  vector<int> a(n), b(n);
  for(int i=0;i<n;i++){
   	cin>>a[i]>>b[i]; 
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  int min,max;
  if(n%2){
   min=a[n/2];
   max=b[n/2];
  }
  else{
   min=(a[n/2]+a[(n-1)/2]);
   max=(b[n/2]+b[(n-1)/2]);
  }
  cout<<max-min+1<<endl;
}

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

int main() {
  int N;
  cin >> N;
  map<string, int> v;
  for(int i = 0;i < N;i++) {
    string s;
    cin >> s;
    v[s]++;
  }
  cout << "AC x " << v["AC"] << endl;
  cout << "WA x " << v["WA"] << endl;
  cout << "TLE x " << v["TLE"] << endl;
  cout << "RE x " << v["RE"] << endl;
}


Measured memory_bytes: 3632
L, R = gets.split(' ').map(&:to_i)

if R - L >= 2019
  puts 0
  exit
end

min = { n1: -1, n2: -1, mod: 2019 }

(L..R).to_a.combination(2) do |(n1, n2)|
  mod = n1 * n2 % 2019
  min = { n1: n1, n2: n2, mod: mod } if min[:mod] > mod
  break if mod == 0
end

puts min[:mod]


Measured memory_bytes: 1788
import Control.Monad
import Data.Array.Unboxed
import Data.Array.IO
import Data.IORef

main = do
    [n,m] <- map read . words <$> getLine :: IO [Int]
    ans <- newArray (1, n) (False, 0) :: IO (IOArray Int (Bool, Int))
    cs <- newIORef (0 :: Int)
    fs <- newIORef (0 :: Int)

    let
        solve :: IO () 
        solve =
            replicateM_ m $ do
                [p, s] <- words <$> getLine
                let pi = read p :: Int
                (a,f) <- readArray ans pi
                if (not a) && (s == "WA") 
                    then writeArray ans pi (False, f+1)
                else if (not a) && (s == "AC")
                    then writeArray ans pi (True, f)
                else return ()

        res :: IO ()
        res = 
            forM_ [1..n] $ \i -> do
                (a,f) <- readArray ans i
                when a $ do
                    modifyIORef cs (+1) 
                    modifyIORef fs (+f) 

    solve
    res
    readIORef cs >>= \c -> putStr $ show c
    putStr " "
    readIORef fs >>= \f -> putStrLn $ show f


Measured memory_bytes: 17916
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==1)a+=100;
  if(b==1)b+=100;
  if(a<b)cout<<"Bob"<<endl;
  else if(a>b)cout<<"Alice"<<endl;
  else cout<<"Draw"<<endl;
}

Measured memory_bytes: 256
import heapq

N, M, S, T = map(int, input().split())

class Dijkstra:
    def dijkstra(self, adj, start, goal=None):

        num = N  # グラフのノード数
        dist = [float('inf') for i in range(num)]  # 始点から各頂点までの最短距離を格納する
        prev = [float('inf') for i in range(num)]  # 最短経路における，その頂点の前の頂点のIDを格納する

        dist[start] = 0
        q = []  # プライオリティキュー．各要素は，(startからある頂点vまでの仮の距離, 頂点vのID)からなるタプル
        heapq.heappush(q, (0, start))  # 始点をpush

        for i in range(num-1):
            prov_cost, src = heapq.heappop(q)  # pop

            # プライオリティキューに格納されている最短距離が，現在計算できている最短距離より大きければ，distの更新をする必要はない
            if dist[src] < prov_cost:
                continue

            # 他の頂点の探索
            for dest, cost in adj[src].items():
                if dist[dest] > dist[src] + cost:
                    dist[dest] = dist[src] + cost  # distの更新
                    heapq.heappush(q, (dist[dest], dest))  # キューに新たな仮の距離の情報をpush
                    prev[dest] = src  # 前の頂点を記録

        if goal is not None:
            return self.get_path(goal, prev)
        else:
            return dist

    def get_path(self, goal, prev):
        '''
        始点startから終点goalまでの最短経路を求める
        '''
        path = [goal]  # 最短経路
        dest = goal

        # 終点から最短経路を逆順に辿る
        while prev[dest] != float('inf'):
            path.append(prev[dest])
            dest = prev[dest]

        # 経路をreverseして出力
        return list(reversed(path))

from collections import defaultdict
Ey = defaultdict(lambda: defaultdict(lambda: float("inf")))
Es = defaultdict(lambda: defaultdict(lambda: float("inf")))


E = [list(map(int, input().split())) for i in range(M)]

for e in E:
    u, v, a, b = e
    Ey[u-1][v-1] = Ey[v-1][u-1] = a
    Es[u-1][v-1] = Es[v-1][u-1] = b

dj = Dijkstra()
Dy = dj.dijkstra(Ey, S-1)
Ds = dj.dijkstra(Es, T-1)
mi = float("inf")
Ans = [0] * N
for i in range(N-1, -1, -1):
    mi = min(mi, Dy[i]+Ds[i])
    Ans[i] = mi
for a in Ans:
    print(10**15-a)




Measured memory_bytes: 186744
l = [int(i) for i in input().split(" ")]
n = l[0]
m = l[1]
foods = set(range(1,m+1))

for i in range(n):
    i_like_list = [int(i) for i in input().split(" ")[1:]]
    i_like_set = set(i_like_list)
    foods = foods & i_like_set
print(len(foods))


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <queue>
using namespace std;

struct Process{
	string name;
	int time;
};

int main(void)
{	queue<Process> que;
	
	int n, q;
	cin >> n >> q;
	
	for(int i = 0; i < n; i++){
		Process P;
		cin >> P.name >> P.time;
		que.push(P);
	}
	
	int count_time = 0;
	
	while(que.empty() == false){
		Process P = que.front();
		que.pop();
		
		if(P.time < q){
			count_time += P.time;
		}
		else{
			count_time += q;
		}

		P.time = P.time - q;
		
		if(P.time <= 0){
			cout << P.name << " " << count_time << endl;
		} 
		else{
			que.push(P);
		}
	}

	return 0;
}

Measured memory_bytes: 6180
from collections import defaultdict

def diverta192_b():
    N = int(input())
    P = [tuple(map(int, input().split())) for _ in range(N)]
    if len(P) == 1:
        print(1)
        return
    dcnt = defaultdict(int)
    for i in range(N):
        xi, yi = P[i]
        for j in range(i):
            xj, yj = P[j]
            dx1, dy1 = xi-xj, yi-yj
            dx2, dy2 = xj-xi, yj-yi
            dcnt[(dx1,dy1)] += 1
            dcnt[(dx2,dy2)] += 1
    most = sorted(dcnt.values(), reverse=True)[0]
    ans = N - most
    print(ans)

diverta192_b()

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  int n,a,ans,user;
  int u[10000],ut[10000];
  string day,time,on;
  string nowd,nowt;
  while(1){
    cin>>n;
    ans=0;
    if(n==0) break;
    for(int i=0;i<1000;i++){
      u[i]=ut[i]=0;
    }
    for(int i=0;i<n;i++){
      cin>>day>>time>>on>>user;
      if(i==0){
	nowd=day;
	nowt=time;
      }
      if(nowd!=day){
	nowd=day;
	nowt=time;
      }
      if(nowt!=time){
	a=(((time[0]-'0')-(nowt[0]-'0'))*10+((time[1]-'0')-(nowt[1]-'0')))*60+(((time[3]-'0')-(nowt[3]-'0'))*10+((time[4]-'0')-(nowt[4]-'0')));
	//	cout<<a<<endl;
	nowt=time;
	if(u[0]==1){
	  for(int j=1;j<1000;j++){
	    if(u[j]==1){
	      ut[j]+=a;
	      ans=max(ans,ut[j]);
	    }
	  }
	}
      }
      if(on=="O") u[user]=0;
      if(on=="I") u[user]=1;
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3232