akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};

const int MAXH = 2000;

int r[MAXH][MAXH];
int l[MAXH][MAXH];
int u[MAXH][MAXH];
int d[MAXH][MAXH];

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int h, w; cin >> h >> w;
    string S[h];
    for(int i=0;i<h;i++){
        cin >> S[i];
    }
    
    // right
    for(int i=0;i<h;i++){
        int cnt = 0;
        for(int j=0;j<w;j++){
            if(S[i][j] == '.'){
                r[i][j] = cnt;
                cnt++;
            }else{
                cnt = 0;
            }
        }
    }

    // left
    for(int i=0;i<h;i++){
        int cnt = 0;
        for(int j=w-1;j>=0;j--){
            if(S[i][j] == '.'){
                l[i][j] = cnt;
                cnt++;
            }else{
                cnt = 0;
            }
        }
    }

    // up
    for(int j=0;j<w;j++){
        int cnt = 0;
        for(int i=0;i<h;i++){
            if(S[i][j] == '.'){
                u[i][j] = cnt;
                cnt++;
            }else{
                cnt = 0;
            }
        }
    }

    // down
    for(int j=0;j<w;j++){
        int cnt = 0;
        for(int i=h-1;i>=0;i--){
            if(S[i][j] == '.'){
                d[i][j] = cnt;
                cnt++;
            }else{
                cnt = 0;
            }
        }
    }

    int ans = 0;

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(S[i][j] == '.'){
                ans = max(l[i][j] + r[i][j] + u[i][j] + d[i][j] + 1, ans);
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	long double H;
	cin >> H;
	long long cnt = 1;	
	long double height = log2(H);
	for (int i = 1; i <= height; ++i) {
		cnt = cnt + (long long) pow(2, i);
	}
	cout << cnt << '\n';
	return 0;
}

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

int main(int argc, char const *argv[])
{
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  if(a[0] + a[1] + a[2] >= 22){
    cout << "bust" << endl;
  }
  else{
    cout << "win" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int> P(N);
  for (int i=0;i<N;i++)cin>>P[i];
  int cnt=0;
  for (int i=0;i<N;i++){
    if (i+1!=P[i]) cnt++;
  }
  if (cnt<=2) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>

using namespace std;

using ll = long long int;

int main(){
    
    ll N;
    array<ll, 100> A;
    
    cin >> N;
    for(ll i = 0; i < N; ++i){
        cin >> A[i];
    }
    
    ll map[9] = {0};
    for(ll i = 0; i < N; ++i){
        if(A[i] < 400){
            map[0] += 1;
        }else if(A[i] < 800){
            map[1] += 1;
        }else if(A[i] < 1200){
            map[2] += 1;
        }else if(A[i] < 1600){
            map[3] += 1;
        }else if(A[i] < 2000){
            map[4] += 1;
        }else if(A[i] < 2400){
            map[5] += 1;
        }else if(A[i] < 2800){
            map[6] += 1;
        }else if(A[i] < 3200){
            map[7] += 1;
        }else{
            map[8] += 1;
        }
    }
    ll cnt = 0;
    for(ll j = 0; j < 8; ++j){
        if(map[j] > 0){
            cnt += 1;
        }
    }
    ll maxcnt = cnt + map[8];
    ll mincnt = max(cnt, (map[8] > 0 ? 1LL : 0LL));
    
    cout << mincnt << " " << maxcnt << endl;
    
    return 0;
}

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

int cmp(const void* a, const void* b)
{
  uint64_t x, y;

  x = *(uint64_t*)a >> 20;
  y = *(uint64_t*)b >> 20;

  return x-y;;
}

int main()
{
  int n, m;
  cin >> n >> m;
  uint64_t dat[n];

  for (int i = 0; i < n; i++){
    uint64_t a, b;
    cin >> a >> b;
    dat[i] = (a << 20) + b;
  }

  qsort(dat, n, sizeof (uint64_t), cmp);

  uint64_t ans = 0;

  for (int i = 0; m > 0; i++){
    uint64_t price = dat[i] >> 20;
    int num = dat[i] & 0xFFFFF;

    if (m >= num){
      ans += price * num;
      m -= num;
    } else {
      ans += price * m;
      m = 0;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1788
N = int(input())
S = input()

result = 0
for i in range(1, N+1):
    S_forward = S[:i]
    S_backward = S[i:]
    is_same = []
    for j in S_forward:
        if j in S_backward:
            if j not in is_same:
                is_same.append(j)
    result = max(result, len(is_same))

print(result)

Measured memory_bytes: 9136
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
int a[100010];
signed main() {
	int n,s,d;
	cin >> n >> s >> d;
	rep(i, n)cin >> a[i];
	int ans = 0;
	rep(i, n - 1) {
		if ((a[i + 1] - a[i])*s > d)ans += d;
		else ans += (a[i + 1] - a[i])*s;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
  long int n,d,x,y;
  long int ans=0;
  scanf("%ld %ld",&n,&d);
  for(int i=0;i<n;i++){
    scanf("%ld %ld",&x,&y);
    
    if(((x*x)+(y*y))<=(d*d)){
      ans++;
    }
  }
  printf("%ld",ans);
  return 0;
}

Measured memory_bytes: 1684
#include <iostream>
using namespace std;
int main(){
    int a,b,k; cin >> a >> b >> k;
    int i=k,j=k;
    while (i--){
        if (a<=b) cout << a++ << endl;
    }
    while (j--){
        if (b-j>=a && a<=b-j)cout << b-j << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;
  if(s[2]==s[3] && s[4]== s[5])
  {
    cout << "Yes";
  }
  else
  {
  	cout << "No";
  }
  return 0;
}

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


int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long int h,w;
  cin>>h>>w;
  long long int d=h*w;
  if(h==1 ||w==1){
    cout<<1;
  }else if(d%2==0){
    cout<<(h*w)/2;
  }else{
    cout<<d/2+1;
  }
}



Measured memory_bytes: 256
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int, input().split()))
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
s=[]
solution=[]
last=[0]*26
sco=0
for i in range(d):
  s.append(list(map(int, input().split())))
for day in range(1,d+1):
  man=[]
  for i in range(26):
    man.append(s[day-1][i]+last[i]*c[i])
  con=man.index(max(man))
  sco+=s[day-1][con]
  last[con]=day
  for (i,j) in zip(last,range(26)):
    sco-=cli[i][j]
  solution.append(con)

stemp=1000000
etemp=10000
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(3)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[i][j]
  prob = math.exp((sc-sco)/tem())
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    sco=sc
for i in solution:
  print(i+1)


Measured memory_bytes: 10212
#include<bits/stdc++.h>
using namespace std;
int n,ans;
struct node
{
	int v,p;
}a[100010];
int cmp(node x,node y)
{
	return x.v<y.v;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i].v);
		a[i].p=i;
	}
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++)
		if((a[i].p&1)!=(i&1))
			++ans;
	ans>>=1;
	printf("%d",ans);
}

Measured memory_bytes: 1024
N, M, X = list(map(int, input().strip().split()))
A, C = [], []
max_price = N * 10**5 + 1
ans = max_price

for i in range(N):
  tmp = list(map(int, input().strip().split()))
  C.append(tmp[0])
  A.append(tmp[1:])

def dfs(current, choice):
  global ans
  #print(f'{current=}, {choice=}')
  if current == N:
    b, c = judge(choice)
    if b:
      ans = min(ans, c)
  else:
    choice[current] = False
    dfs(current+1, choice)
    choice[current] = True
    dfs(current+1, choice)
    
def judge(choice):
  c = 0
  score_list = [0] * M
  for k, v in enumerate(choice):
    if v:
      c += C[k]
      for k2, v2 in enumerate(score_list):
        score_list[k2] = v2 + A[k][k2]  
  b = True
  for s in score_list:
    if s < X:
      b = False
      break
  return b, c

dfs(0, [False] * N)
if ans == max_price:
  ans = -1
print(ans)

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

typedef long long               ll;
typedef long double             ld;


#define racecar          ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLOCK			 cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
#define si(a)            scanf("%d", &a)
#define si2(a,b)         scanf("%d %d", &a,&b)
#define sll(a)           scanf("%I64d",&a)
#define sll2(a,b)        scanf("%I64d %I64d",&a,&b)
#define pb               push_back
#define pi(a)            printf("%d",int(a))
#define pll(a)           printf("%I64d",ll(a))
#define all(x)           (x).begin(),(x).end()
#define rall(x)          (x).rbegin(),(x).rend()
#define ps               printf(" ")
#define nln              printf("\n")
#define ff               first
#define ss               second
#define vi               vector<int>
#define vll              vector<ll>
#define vstr             vector<string>
#define vc               vector<char>
#define PII              pair<int,int>
#define PLL              pair<ll,ll>
#define PI               acos(-1)
#define sq(x)            x*x
#define forr(i,a,b)      for(ll i=ll(a);i<ll(b);i++)
#define forn(i,a,b)      for(ll i=ll(a);i>ll(b);i--)
#define max3(a,b,c)      max(a,max(b,c))
#define max4(a,b,c,d)    max(max3(a,b,c),d)
#define min3(a,b,c)      min(a,min(b,c))
#define mod              1000000007
#define inf              9223372036854775807

///knight moves:
///int dx[] = {-2, -1, 1, 2, -2, -1, 1, 2};
///int dy[] = {-1, -2, -2, -1, 1, 2, 2, 1};


ll power(ll b,ll n)
{
    if(n==0) return 1;
    else if(n%2) return b*power(b,n/2)*power(b,n/2);
    else return power(b,n/2)*power(b,n/2);
}

ld root(ll n,ll r)
{
    ld dif=0.0001;
    ld guess=n/2.0;
    while(abs(pow(guess,r)-n)>=dif)
    {
        ld temp=pow(guess,r)-n;
        ld tmp=r*pow(guess,r-1);
        guess-=temp/tmp;
    }
    return guess;
}

void fileio()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}


int solve()
{

	priority_queue<int>q;

	forr(i,0,3)
	{
		int x;
		si(x);
		q.push(x);
	}
	
	int mv=0;
	
	while(1)
	{
		int a=q.top();
		q.pop();
		int b=q.top();
		q.pop();
		int c=q.top();
		q.pop();
		
		if(a==b && b==c) return pi(mv),0;
		
		if(a==b) c+=2;
		else { b++; c++; }
		mv++;
		q.push(a);
		q.push(b);
		q.push(c);
	}
	
	
			
    return 0;
}


int main()
{
//    racecar;
//    cout<<fixed<<setprecision(6);
//    fileio();
    solve();
//	CLOCK;   
    return 0;
}



///    Before submission=>
///    ***check for integer overflow,array bounds
///    ***check for n


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <functional>
#include <list>
#include <iomanip>
#include <cctype>
#include <math.h>

#define rep(i,a,n) for(int i = a; i < (int)(n); i++)

using namespace std;


int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    long long  n,a,b,c,d,e,minimum;
    cin >> n>>a>>b>>c>>d>>e;
    
    minimum = min({a,b,c,d,e});
    
    if(n%minimum == 0){
        cout << n / minimum +4 << endl;
    }
    else if (n%minimum != 0){
        cout << n / minimum +5 << endl;
    }
    
    
}
    



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>

#define ll long long
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug(Head head,Tail... tail){
    cerr<<" "<<to_string(head);
    debug(tail...);
}

int main(){
    int N;
    cin>>N;
    string S;
    cin>>S;
    int list[26]={};
    FOR(i,S.size()){
        list[S[i]-'a']++;
    }
    ll sm=0;
    FOR(i,26){
        if(list[i]>0)sm=(sm+list[i]*sm+list[i])%1000000007;
    }
    cout<<sm<<endl;
    return 0;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N;
  cin>>N;
  int c=0;
  for(int i=0;i<N;i++){
    int d1,d2;
    cin>>d1>>d2;
    if(d1==d2){
      c++;
      if(c==3){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
    else{
      c=0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3644
#include "bits/stdc++.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <random>
#include <stdio.h>
#include <bitset>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl



void func() {
  LL N;
  cin >> N;
  LL WWW;
  cin >> WWW;

  LL INF = 1e2 * 1e9 * 10;
  vector<LL> W(N);
  vector<LL> V(N);
  LL v_sum = 0;
  REP(i, N) {
    cin >> W[i];
    cin >> V[i];  
    v_sum += V[i];
  }

  vector<LL> DP(v_sum + 1, INF);
  DP[0] = 0;
  REP(i, N) {
    vector<LL> DP_new(v_sum + 1, INF);
    REP(j, v_sum + 1) {
      LL idx = j - V[i];
      if (idx >= 0 && DP[idx]+W[i] < DP[j]) {
        DP_new[j] = DP[idx] + W[i];
      }
      else {
        DP_new[j] = DP[j];
      }
    }
    //PRINTSP(DP_new);
    DP = DP_new;
  }

  //PRINTSP(DP);

  LL val_max = 0;
  REP(j, v_sum + 1) {
    if (DP[j] <= WWW) {
      val_max = j;
    }
  }
  cout << val_max;
}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(v) (v).begin(),(v).end()
#define pb push_back

typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;

int n,A,B,C;
vint bar(100);
int counter=0;

int gcd(ll a,ll b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

int main(){

    int i;
    ll a[100000];
    cin>>n;
    rep(i,n)cin>>a[i];
    ll ans=a[0];
    rep(i,n){
        ans=gcd(ans,a[i]);

    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(b > c)swap(b,c);
if(a > b)swap(a,b);
if(b > c)swap(b,c);
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}

Measured memory_bytes: 3076
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
class DirectedGraph {
    struct edge {
        int from;
        int to;
        int cost;
    };

    int edge_num = 0;

public:
    int V;
    int E;
    vector<edge> edges;

    DirectedGraph(int v, int e) : V(v), edges(e), E(e) {};

    void add_edge(int from, int to, int cost) {
        edges[edge_num++] = {from, to, cost};
    }

    // O(E * V)
    vector<int> bellman_ford(int s) {
        vector<int> d(V, INF);
        d[s] = 0;

        for (int j = 0; j < V; j++) {
            bool update = false;
            for (int i = 0; i < E; i++) {
                edge e = edges[i];
                if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
                    d[e.to] = d[e.from] + e.cost;
                    update = true;

                    if (j == V - 1) {
                        vector<int> dd(0);
                        return dd;
                    }
                }
            }

            if (!update) break;
        }

        return move(d);
    }
};

signed main() {
    int V, E, start;
    cin >> V >> E >> start;

    DirectedGraph dg = DirectedGraph(V, E);

    for (int i = 0; i < E; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        dg.add_edge(s, t, d);
    }

    vector<int> dis = dg.bellman_ford(start);

    if (dis.size() == 0) {
        cout << "NEGATIVE CYCLE" << endl;
        return 0;
    }

    for (int i = 0; i < V; i++) {
        if (dis[i] == INF) {
            cout << "INF" << endl;
            continue;
        }

        cout << dis[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using pii = pair<int, int>;

vector<int> g[100100];
int u[100100];

void dfs(int v) {
    if (!u[v]++) {
        for (int to : g[v])
            dfs(to);
    }
}

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

    int n, m;
    cin >> n >> m;
    while (m--) {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

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


Measured memory_bytes: 10004
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
#define F first
#define S second
using namespace std;

int main(){
	int T,P,R;
	while(cin>>T>>P>>R&&T&&P&&R){
		int tID,pID,time;
		string mes;
		bool flag[51][11]={false};
		pair<int,pair<int,int>> ans[51];//ans,time,tID
		REP(i,1,T+1){
			ans[i].F=0;
			ans[i].S.F=0;
			ans[i].S.S=i;
		}
		int pena[51][11]={0};
		REP(i,0,R){
			cin>>tID>>pID>>time>>mes;
			if(flag[tID][pID]) continue;
			if(mes=="CORRECT"){
				ans[tID].F--;
				flag[tID][pID]=true;
				ans[tID].S.F+=time+pena[tID][pID]*1200;
			}else{
				pena[tID][pID]++;
			}
		}
		sort(ans+1,ans+T+1);
		REP(i,1,T+1){
			cout<<ans[i].S.S<<" "<<-ans[i].F<<" "<<ans[i].S.F<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3132
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;


int main(void){
    int n;
    cin>>n;
    if(n%2==0)cout<<n/2<<endl;
    else cout<<n/2+1<<endl;
    return 0;
}

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

int main() {
    int N, num = 1, cnt = 0; cin >> N;
    for (int i = 0; i < N; i++) {
        int x; cin >> x;
        if (x == num) num++;
        else cnt++;
    }
    if (num == 1 && cnt != 0) cout << -1 << endl;
    else cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


const ll MOD = 1e9+7;

signed main(){
    ll h, w, k,ans = 0;
    cin >> h >> w >> k;
    char grid[h][w] = {};
    rep(i,0,h){
        rep(j,0,w){
            cin >> grid[i][j];
        }
    }

    rep(h_bit,0,pow(2,h)){
        rep(w_bit,0,pow(2,w)){
            ll cnt = 0;
            rep(i,0,h){
                rep(j,0,w){
                    if((h_bit >> i) & 1 || (w_bit >> j) & 1){
                    }
                    else if(grid[i][j] == '#'){
                        cnt++;
                    }
                }
            }

            if(cnt == k){
                ans++;
            }
        }
    }
    cout << ans << endl;
}


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

int main() 
{
  string s,p;
  cin >> s >> p;

  s = s + s.substr(0,p.size()-1);

  if( s.find(p) == string::npos ) 
    cout << "No" << endl;
  else 
    cout << "Yes" << endl;

  return 0;
}



Measured memory_bytes: 3220
package main

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

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,1000000)}
  n := input.NextInt()
  s := input.NextIntArray()
  u := make([]bool,n)
  var m,f int64
  for c:=1;c<n-1;c++ {
    f = 0
    for k:=0;c<n-1-k*c;k++ {
      u[k*c] = true
      if u[n-1-k*c] { break }
      f += s[n-1-k*c]+s[k*c]
      if m < f { m = f }
    }
    for k:=0;k*c<n-1;k++ { u[k*c] = false }
  }
  fmt.Println(m)
}

type Input struct {
  reader *bufio.Reader
}
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  n,_ := strconv.Atoi(i.NextLine())
  return n
}
func(i *Input) NextIntArray() []int64 {
  s := strings.Split(i.NextLine()," ")
  a := make([]int64,len(s))
  for i:=0;i<len(s);i++ { a[i],_ = strconv.ParseInt(s[i],10,64) }
  return a
}

Measured memory_bytes: 6656
import java.util.*;
import java.lang.Math;

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

  		
      	String sta = sc.next();
      	String str = "Yes";
      	
      	if(sta.equals("AAA") || sta.equals("BBB")) str = "No";
      	
      	
      	System.out.println(str);
        
	}
}


Measured memory_bytes: 35540
from collections import Counter

n = int(input())
s = input()

ans = 0

for i in range(1, n-1):
    count = 0
    x = s[0:i+1]
    y = s[i+1:]
    cx = Counter(x)
    cy = Counter(y)
    for key, value in cx.items():
        if cy[key] > 0:
            count += 1
    ans = max(ans, count)

print(ans)

Measured memory_bytes: 3316
#include <stdio.h>

#define MAXN 100001
char Slime[MAXN];

int main()
{
	int N;
	scanf("%d", &N);
	scanf("%s", Slime);

	int Result = 0;
	for (int n = 0; n < N-1; n++)
		if(Slime[n] != Slime[n+1])
			Result++;

	printf("%d", Result+1);
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#define first x
#define second y
#include <bits/stdc++.h>

using namespace std;

enum {MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009};
typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
#ifndef CrafterKolyan
#define endl '\n'
#endif

int a[200000];
ll sum[200001];

signed main() {
#ifndef CrafterKolyan
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }
    ll l = 1, r = 3;
    ll ans = LLONG_MAX;
    for (ll m = 2; m < n; ++m) {
        r = max(r, m + 1);

        while (l + 1 < m && abs(sum[m] - 2 * sum[l]) >= abs(sum[m] - 2 * sum[l + 1])) ++l;
        while (r + 1 < n && abs(sum[n] - 2 * sum[r] + sum[m]) >= abs(sum[n] - 2 * sum[r + 1] + sum[m])) ++r;
        ll a[4] = {
            sum[l],
            sum[m] - sum[l],
            sum[r] - sum[m],
            sum[n] - sum[r]
        };
        sort(a, a + 4);
        ans = min(ans, a[3] - a[0]);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    string s;
    cin >> s;
    cout << -4 + 2 * count(s.begin(), s.end(), '+') << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    int N, M;
    string S;
    cin >> N >> M >> S;

    reverse(S.begin(), S.end());

    vector<int> ans;
    int cur = 0;
    while(true){
        if(cur == N) break;
        for(int i=M; i>=0; i--){
            if(cur+i > N) continue;
            if(i == 0){
                cout << -1 << endl;
                return 0;
            }
            if(S[cur+i] == '0'){
                ans.push_back(i);
                cur = cur+i;
                break;
            }
        }
    }

    reverse(ans.begin(), ans.end());
    for(auto x : ans)
        cout << x << " ";
    cout << endl;

    return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

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

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;


ll t, n, d;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> t;
	while(t--){
		cin >> n >> d;
		if(n%2){
			cout<<(n-1)*127+d<<endl;
		}
		else{
			cout<<n*127-d<<endl;
		}
	}
	return 0;
}


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

typedef long long ll;
using namespace std;

int main() {
 	int n;
 	cin>>n;
 	int ar[100001];
 	
 	for(int i=0; i<n; i++) {
 		cin>>ar[i];
 	}
 	
 	int dp[100001];
 	dp[0] = 0;
 	dp[1] = abs(ar[0]-ar[1]);
 	
 	for (int i=2; i<n; i++) {
 		dp[i] = min(dp[i-1] + abs(ar[i]-ar[i-1]), dp[i-2] + abs(ar[i]-ar[i-2]));
 	}
 	
 	cout << dp[n-1];
 	
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
c, s, f = [], [], []
for i in range(n-1):
    ci, si, fi = map(int, input().split())
    c.append(ci)
    s.append(si)
    f.append(fi)

for i in range(n-1):
    t = 0
    for j in range(i, n-1):
        if t < s[j]:
            t += s[j] - t

        if t%f[j] == 0:
            t += c[j]
        else:
            t += f[j] - t % f[j] + c[j]

    print(t)

print(0)


Measured memory_bytes: 3064
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [0, 1, 2]
for i in range(6):
    order = [0, 0, 0]
    for j in range(3):
        if {x[j], x[-j-1]} != {y[z[j]], y[-z[j]-1]}:
            break
        if x[j] == y[z[j]]:
            order[j] = 1 
            if x[j] == x[-j-1]:
                order[j] = 2 
    else:
        if 2 in order or (i < 3) == sum(order) % 2:
            print('Yes')
            break
    z = [z[2], z[0], z[1]]
    if i == 2:
        z = [z[0], z[2], z[1]]
else:
    print('No')

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;

typedef long long LL;
typedef long double ldouble;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

vector<LL> v;

void dfs(LL n, int dig) {
    if(dig == 10) {
        v.pb(n);
        return;

    }
    v.pb(n);

    dfs(n * 10 + 3, dig + 1);
    dfs(n * 10 + 5, dig + 1);
    dfs(n * 10 + 7, dig + 1);

    return;
}

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

    LL n;
    cin >> n;
    dfs(0, 0);

    int c = 0;
    for(int i = 0; i < v.size(); ++i) {
        bool s, g, sa;
        s = g = sa = false;
        LL t = v[i];
        while(t > 0) {
            int gg = t % 10;
            if(gg == 7) s = true;
            if(gg == 5) g = true;
            if(gg == 3) sa = true;
            t /= 10;

        }
        if(v[i] <= n && s && g && sa) ++c;

    }
    cout << c << endl;

    return 0;
}



Measured memory_bytes: 1400
n=int(input())
alis=list(map(int,input().split()))
aalis=[]
for i in range(1,n+1):
	aalis.append([i,alis[i-1]])
aalis.sort(key=lambda aalis:(aalis[1],aalis[0]))
list=[]
for i in range(n):
	list.append(aalis[i][0])
print(*list)

Measured memory_bytes: 29880
<?php
fscanf(STDIN, "%d", $n);
$a = explode(" ", trim(fgets(STDIN)));
$b = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
$ans = 0;
for($i = 0; $i < count($a) - 1; $i++){
    if($a[$i + 1] - $a[$i] == 1){
        $ans += $c[$a[$i] - 1];
    }
}
foreach($b as $v){
    $ans += $v;
}
echo $ans;

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

ll nxt()
{
    ll x;
    cin >> x;
    return x;
}

const ll L = 1e5+5;

void solve()
{
    ll x = nxt();

    ll ans = (x/500)*1000;
    x %= 500;

    ans += (x/5)*5;

    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll T = 1;
    // T = nxt();

    while(T--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    human = [tuple(map(int, input().split())) for _ in range(N)]

    human.sort(key = lambda x: (x[1]+x[0]))
    inf = 2000000001
    #iからj人乗せた中で最小座布団
    dp = [[inf]*(N+1) for j in range(N+1)]

    for i in range(N+1):
        dp[i][0] = 0

    for i in range(N):
        for j in range(N):
            if dp[i][j] <= human[i][0]:
                dp[i+1][j+1] = min(dp[i][j+1], dp[i][j] + human[i][1])
            dp[i+1][j] = min(dp[i+1][j], dp[i][j])

    ans = 0
    for i in range(N+1):
        if dp[N][i] != inf:
            ans = i

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 231176
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int count = 0;
		for (int i = a; i <= b; i++) {
			int sum = c % i;
			if (sum == 0) {
				count++;
			}
		}
		System.out.println(count);
    }
}


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

int main() {
	// your code goes here
	long long a;
	cin>>a;
	long long mon[a+1]={0};
	long long he[a]={0};
	for(int x=0;x<=a;x++)
	{
		cin>>mon[x];
	}
	
	for(int x=0;x<a;x++)
	cin>>he[x];
	long long tot=0;
	for(int x=0;x<a;x++)
	{
		long long kill=min(he[x],mon[x]+mon[x+1]);
		//cout<<he[x]<<" "<<mon[x]+mon[x+1]<<"   "<<endl;
		//cout<<x<<" ";
		//cout<<kill<<" "<<endl;
		//cout<<he[x];
		tot=tot+kill;
		if(kill>mon[x])
		{
			kill=kill-mon[x];
		}
		else
		kill=0;
		mon[x+1]-=kill;
	}
	cout<<tot;
	return 0;
}

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

const int N = (int)1e6+7;
const int INF = (int)1e9+17;

typedef long long ll;

const int M = (1 << 14) + 1;

int n, x, a, o;
int comp[M+M];
bool used[M+M];


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    
    int n;
    cin >> n;
    cout << n / 2 - (n % 2 == 0) << endl;

    return 0;
}


Measured memory_bytes: 256
import sys

from typing import List


def _10_to_26(number: int) -> List[str]:
    if number // 26:
        division = number // 26
        remain = number % 26

        if remain is 0:
            if division == 1:
                return ['z']

            return _10_to_26(number // 26 - 1) + ['z']

        _ = _10_to_26(number // 26)
        _.append(
            to_char(remain)
        )
        return _
    return [
        to_char(number % 26)
    ]


def to_char(num: int) -> str:
    return chr(ord('a') - 1 + num)


def main() -> None:
    N = int(input())
    print(''.join(_10_to_26(N)))


if __name__ == '__main__':
    sys.setrecursionlimit(100000)
    main()


Measured memory_bytes: 70256
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n(ichar('0'):ichar('9'))=0,i
    character(4):: s
 
    read*, s
 
    if (s(2:2)==s(3:3)) then
        if (s(1:1)==s(2:2) .or. s(3:3)==s(4:4)) then
            print'(a)', 'Yes'
        else
            print'(a)', 'No'
        end if
    else
        print'(a)', 'No'
    end if
    
    
 
end program main

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MAX_V = 51;
const int MAX_S = MAX_V * 50 + 5;
const ll INF = 1e18;
 
struct Edge {
    int to, a, b;
    Edge(int to, int a, int b) : to(to), a(a), b(b) {}
};

struct Data {
    int v, si;
    ll lap;
    Data(int v, int si, ll lap) : v(v), si(si), lap(lap) {}
    bool operator<(const Data& a) const {
        return lap > a.lap;
    }
};

vector<Edge> graph[MAX_V];
ll dist[MAX_V][MAX_S + 5];   // 0-indexed

int main() {
    int N, M, S;
    cin >> N >> M >> S;
    S = min(S, MAX_S);
    rep(i, M) {
        int U, V, A, B;
        cin >> U >> V >> A >> B;
        --U; --V;
        graph[U].emplace_back(V, A, B);
        graph[V].emplace_back(U, A, B);
    }
    vector<int> C(N), D(N);
    for (int i = 0; i < N; i++) {
        cin >> C[i] >> D[i];
    }
    rep(i, N+1) rep(j, MAX_S+5) dist[i][j] = INF;
    priority_queue<Data> que;
    auto push = [&] (int v, int si, ll lap) {
        if (si < 0) return;
        if (dist[v][si] <= lap) return;
        dist[v][si] = lap;
        que.emplace(v, si, lap);
    };
    push(0, S, 0);
    while (!que.empty()) {
        Data cur = que.top(); que.pop();
        int v = cur.v, si = cur.si;
        ll lap = cur.lap;
        if (dist[v][si] != lap) continue;
        {
            int nsi = min(si + C[v], MAX_S);
            push(v, nsi, lap + D[v]);
        }
        for (Edge e : graph[v]) {
            push(e.to, si - e.a, lap + e.b);
        }
    }
    for (int i = 1; i < N; i++) {
        ll ans = INF;
        for (int j = 0; j <= MAX_S; j++) {
            ans = min(ans, dist[i][j]);
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 6392
from collections import deque

S = list(input())
Q = int(input())

d = deque(S)
head = "l"

for _ in range(Q):
    q = input()
    if len(q) == 1:
        if head == "l":
            head = "r"
        else:
            head = "l"
    else:
        T, F, C = q.split()
        if int(F) == 1:
            if head == "l":
                d.appendleft(C)
            else:
                d.append(C)
        else:
            if head == "l":
                d.append(C)
            else:
                d.appendleft(C)
if head == "l":
    print("".join(list(d)))
else:
    print("".join(list(d)[::-1]))


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

int main(){
  int N;
  cin >> N;
  vector<int> v(N+1);
  v.at(0)=0;
  int sum=0;
  for(int i=1;i<=N;i++){
    int W;
    cin >> W;
    sum+=W;
    v.at(i)=v.at(i-1)+W;
  }
  int mi=1e9;
  for(int i=2;i<N;i++){
    int diff=abs(v.at(i)-(sum-v.at(i)));
    if(mi>diff){
      mi=diff;
    }
  }
  cout << mi << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  static char[] str;

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

    str = sc.next().toCharArray();

    int s = -1;
    for(int i = 0; i < str.length; i++){
      if(str[i] == 'A'){
        s = i;
        break;
      }
    }

    int t = -1;
    for(int i = str.length - 1; i >= 0; i--){
      if(str[i] == 'Z'){
        t = i;
        break;
      }
    }

    System.out.println((t - s) + 1);
  }
}


Measured memory_bytes: 26500
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define queint queue<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>//大きい順
#define pqg priority_queue<int,vec,greater<int>>//小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
int main(){
    int l=in(),r=in();
    int mod=2019;
    ll ans=2019;
    for(int i=l;i<=min(r,l+2019);i++){
        for(int j=i+1;j<=min(r,l+2019);j++){
            ans=min(ans,(ll)i*j%mod);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

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

    string s;
    cin>>s;
    int n=s.length();
    int test=0;
    int i=0;
    while(i<n)
    {
        int x=i;
        while(i<n&&s[i]==s[x])
            i++;
        test++;
    }
    cout<<test-1<<endl;
    

    
    return 0;   
}




 
 


Measured memory_bytes: 512
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int p[] = new int[n];
		int mp=0;
		int g = 0;
		for(int i=0;i<p.length;i++){
			p[i] = sc.nextInt();
			g += p[i];
			if(mp<p[i]){
				mp = p[i];
			}
		}
		g -= (int)mp/2;
		System.out.println(g);
	}
}


Measured memory_bytes: 23764
s[50],j,p,q;main(i){for(;p=atoi(gets(s)),p;printf("%d\n",i)){for(i=0;i<p;s[i++]=strlen(gets(s+i)));for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);}}

Measured memory_bytes: 532
## coding: UTF-8
N = int(input())
L = list(map(int,input().split()))

count = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            #print(i,j,k)
            #count+=1
            l = [L[i], L[j], L[k]]
            l = sorted(l)
            if(l[0] != l[1] and l[1] != l[2] and l[0] + l[1] > l[2]):
                count += 1

print(count)





Measured memory_bytes: 68512
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

#define N 100000

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

	ans = a + b + c;

	if (ans <= 21) {
		cout << "win";
	}
	else {
		cout << "bust";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  int i,result=0;
  string s,t;
  cin >> s;
  cin >> t;
  for(i=0;i<3;i++){
    if(s[i]==t[i]) result++;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int a,b,c;
    while(~scanf("%d%d%d",&a,&b,&c))
    {
        if(c>=a&&c<=(a+b))
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 128
import numpy as np

def many_fomulas(digits):
    mat = np.zeros((len(digits), len(digits)), 'i')

    for i, _ in enumerate(digits):
        if i >= 0:
            mat[i, :i] = 2 ** (i - 1)
        mat[i, i] = 2 ** i

    total = 0
    for i, _ in enumerate(digits):
        for j, v in enumerate(digits):
            total += 10 ** (len(digits) - i - 1) * int(mat[i, j]) * v

    print(total)

#many_fomulas([1, 2, 5])
#many_fomulas([9, 9, 9, 9, 9, 9, 9, 9, 9, 9])
many_fomulas([int(d) for d in input()])


Measured memory_bytes: 12448
h,w=gets.chomp.split(" ").map(&:to_i)
maths = []
h.times do
  tempArray = []
  tempArray = gets.chomp.split("")
  maths << tempArray if tempArray.uniq != ["."]
end

maths = maths.transpose
(0..(maths.length-1)).sort.reverse.each do |index|
  maths.slice!(index) if maths[index].uniq == ["."]
end

maths = maths.transpose
maths.each do |val|
  puts val.join.to_s
end

Measured memory_bytes: 2428
A = []
3.times do
  A.concat(gets.chomp.split(" ").map(&:to_i))
end
N = gets.chomp.to_i
B = Array.new(9, nil)
N.times do |i|
  b = gets.chomp.to_i
  idx = A.index(b)
  B[idx] = 1 if idx
end

if (B[0] == 1 && B[1] == 1 && B[2] == 1) ||
  (B[3] == 1 && B[4] == 1 && B[5] == 1) ||
  (B[6] == 1 && B[7] == 1 && B[8] == 1) ||
  (B[0] == 1 && B[3] == 1 && B[6] == 1) ||
  (B[1] == 1 && B[4] == 1 && B[7] == 1) ||
  (B[2] == 1 && B[5] == 1 && B[8] == 1) ||
  (B[0] == 1 && B[4] == 1 && B[8] == 1) ||
  (B[2] == 1 && B[4] == 1 && B[6] == 1)
  puts "Yes"
else
  puts "No"
end


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

int main()
{
    int N, Q;
    cin >> N >> Q;

    string S;
    cin >> S;

    vector<int> l(Q), r(Q);
    for(int i = 0; i < Q; i++)
    {
        cin >> l[i] >> r[i];
    }

    vector<int> left(N, 0);
    for(int i = 0; i < N - 1; i++)
    {
        if(S[i] == 'A' && S[i + 1] == 'C')
        {
            left[i] = 1;
        }
    }

    vector<int> right(N, 0);
    for(int i = N - 1; i > 0; i--)
    {
        if(S[i] == 'C' && S[i - 1] == 'A')
        {
            right[i] = 1;
        }
    }

    vector<int> X(N + 1, 0);
    for(int i = 0; i < N; i++)
    {
        X[i + 1] = X[i] + left[i] + right[i];
    }

    for(int i = 0; i < X.size(); i++)
    {
        X[i] /= 2;
    }

    for(int i = 0; i < Q; i++)
    {
        int ans = X[r[i]] - X[l[i]];
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3072
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long m = long.Parse(input[1]);
		string s = Console.ReadLine();
    string t = Console.ReadLine();
    bool answer = true;
    long memo = 0;

    long gcdNM = Gcd(n,m);
    long lcmNM = n * m / gcdNM;//最小公倍数

    if(s[0] != t[0]) answer = false;
    if(n < m)
    {
      long swapMemo = n;
      n = m;
      m = swapMemo;
      string stringMemo = s;
      s = t;
      t = stringMemo;
    }

    if(n % m == 0)
    {
      memo = n/m;
      for(long i = 1; i < m; i++)
      {
        if(s[(int)(memo*i)] != t[(int)i]) answer = false;
      }
    }

    else if(gcdNM > 1)
    {
      long a = lcmNM/n;
      long b = lcmNM/m;
      long gcdAB = Gcd(a,b);
      long lcmAB = a*b/gcdAB;
      for(long i = 1; i < lcmNM/lcmAB; i++)
      {
        long c = lcmAB / a;
        long d = lcmAB / b;
        if(s[(int)(c*i)] != t[(int)(d*i)]) answer = false;
      }
    }
    
		Console.WriteLine((answer) ? lcmNM : -1);
	}

  static long Gcd(long a, long b) 
    {//引数a,bの最大公約数を返す
         if (a < b)
             return Gcd(b, a);//入れ替え
         while (b != 0) 
         {
             long changeTo = a % b;
             a = b;
             b = changeTo;
         }
         return a;
     }
  
}

Measured memory_bytes: 13216
#include <iostream>
#include <string>

int main(){
	std::string s;
	int n, c=0;
	std::cin >> n >> s;
	for(int i=0; i<n-2; i++){
		if(s[i]=='A' and s[i+1]=='B' and s[i+2]=='C'){
			c++;
		}
	}
	std::cout << c << std::endl;
}


Measured memory_bytes: 256