akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
  public static void main(String[] main){
    Scanner sc = new Scanner(System.in);
    int a[] = new int[4];
    for(int i=0; i<6; i++){
      int temp=sc.nextInt();
      a[temp-1]++;
    }
    
    if(a[0]==3 || a[1]==3 || a[2]==3 || a[3]==3){
      System.out.println("NO");
    }else{
      System.out.println("YES");
    }
  }
}
      
    
    
    

Measured memory_bytes: 35628
#include <algorithm>
#include <numeric>
#include <map>
#include <vector>
#include <cmath>
#include <iostream>

using namespace std;

typedef pair<int, int> P;
const int MN = 1100;
vector<P> g[MN];
bool f[MN];
int dp[MN];
int solve(int i, int b) {
  int res = 0;
  for (P d: g[i]) {
	if (d.first == b) continue;
	int u = solve(d.first, i);
	if (f[d.first]) {
	  res += d.second;
	} else {
	  res += min(d.second, u);
	}
  }
  return res;
}

int main() {
  fill_n(dp, MN, -1);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
	int d;
	cin >> d;
	if (d) {
	  f[i] = true;
	} else {
	  f[i] = false;
	}
  }
  for (int i = 0; i < n-1; i++) {
	int a, b, d;
	cin >> a >> b >> d;
	g[a].push_back(P(b, d));
	g[b].push_back(P(a, d));
  }
  cout << solve(0, -1) << endl;
}

Measured memory_bytes: 1260
#include<cstdio>
typedef long long LL;
LL a[5], ans = ( 1e18 + 5 ) * (-1);
LL max(LL a, LL b)
{
	return a > b ? a : b;
}
int main()
{
	for(int i = 1; i <= 4; i ++)
		scanf("%lld", &a[i]);
	for(int i = 1; i <= 2; i ++)
		for(int j = 3; j <= 4; j ++)
			ans = max(a[i] * a[j], ans);
	printf("%lld", ans);
}

Measured memory_bytes: 1732
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

if A.count(0):
    print(0)
    exit()

ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)


Measured memory_bytes: 21824
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll,ll>
#define pint pair<int,int>
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mod 1000000007
#define MAX 100005
#define endl '\n'
#define mp make_pair
#define INF INT_MAX
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
#define ps(x,y) fixed<<setprecision(y)<<x
#define setbits(x) __builtin_popcountll(x)            //counts no of ones in binary representation
#define w(t)     int t; cin>>t; while(t--)
#define pi 3.141592653589793238
#define sortt(v)  sort(v.begin(),v.end())
#define lb(v,x) std::lower_bound(v.begin(),v.end(),x)
#define ub(v,x) std::upper_bound(v.begin(),v.end(),x)

using namespace std;

int main(){
	string s;
	cin>>s;
	ll cnt=0;
	forn(i,s.length())	cnt+=(s[i]-'0');
	if(cnt%9)	cout<<"No";
	else	cout<<"Yes";
}

Measured memory_bytes: 3752
//============================================================================
// Name        : lunch.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int pasta[3], drink[2];
	for (int i = 0; i < 3; i++) {
		cin >> pasta[i];
	}
	for (int i = 0; i < 2; i++) {
		cin >> drink[i];
	}
	int sum = pasta[0] + drink[0] - 50;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 2; j++) {
			if(pasta[i] + drink[j] - 50 < sum){
				sum = pasta[i] + drink[j] - 50 ;
			}
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#define MAX 100
int main(void) {
    char w[MAX], cnt[26]={0};
    int i;
    scanf("%s", w);
    
    for(i=0; i<strlen(w); i++)
        cnt[w[i]-'a']++;
    for(i=0; i<26; i++) {
        if(cnt[i]%2!=0) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


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

int main(){

    long int N,Y;
    cin >> N >> Y;

    bool flag = false;
    long int x,y,z;
    if(Y > 10000*N) flag = false;
    //3回for文回しておkならbreak ダメならfalseで返す
    /*
    else{
        x = Y/10000;
        Y = Y -10000*x;
        y = Y/5000;
        Y = Y - 5000*y;
        z = Y/1000;
        Y = Y - 1000*z;
        if(Y != 0 || x+y+z > N){
            flag = false;
        }
    }
    */
   else{
       for(int i = 0;i<=N;i++){
           for(int j = 0;j<= N -i;j++){
               if(Y == i*10000 + j*5000 + (N-i-j)*1000){
                   x = i;
                   y = j;
                   z = N-i-j;
                   flag = true;
                   break;
               }
           }
       }
   }
    if(flag) cout << x << " " << y << " " << z << endl;
    else cout << "-1 -1 -1" << endl;



    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  int n; cin>>n;
  string s; cin>>s;
  int ans = 1;
  for(int i = 1; i  < n ; i++)
    if(s[i]!=s[i-1])
      ans++;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double w = sc.nextDouble();
        double h = sc.nextDouble();
        int x = sc.nextInt();
        int y = sc.nextInt();

        double area = w / 2 * h;
        System.out.print(area + " ");

        int n = (w / 2 == x && h / 2 == y) ? 1 : 0;
        System.out.print(n);
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int n;
    cin >> n;
    if((n/100 == 0 || n/100 >= 13)&& n%100 >= 1 && n%100 <= 12){
      cout<<"YYMM"<<endl;
    }
    else if((n%100 == 0 || n%100 >= 13)&& n/100 >= 1 && n/100 <= 12){
      cout<<"MMYY"<<endl;
    }
    else if(1 <= n/100 && n/100 <= 12 && 1 <= n%100 && n%100 <= 12){
      cout<<"AMBIGUOUS"<<endl;
    }
    else{
      cout<<"NA"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

std::vector<int> bipartite(std::vector<std::pair<int,int>> edge){
    int E = edge.size();
    if(E==0)return {};
    int V = 0;
    for(int i=0;i<E;i++){
        V=std::max(V,edge[i].first+1);
        V=std::max(V,edge[i].second+1);
    }
    std::vector<int> R(V,-1);
    std::vector<int> S(0);
    std::vector<std::vector<int>> es(V,std::vector<int>(0));
    for(int i=0;i<E;i++){
        es[edge[i].first].push_back(edge[i].second);
        es[edge[i].second].push_back(edge[i].first);
    }
    std::queue<int> Q;
    std::vector<bool> visited(V,false);
    for(int j=0;j<V;j++){
        if(visited[j])continue;
        Q.push(j);
        R[j]=0;
        visited[j]=true;
        while(!Q.empty()){
            int q=Q.front();
            Q.pop();
            visited[q]=true;
            for(int i=0;i<es[q].size();i++){
                if(R[es[q][i]]==R[q]){
                    return S;
                }
                if(visited[es[q][i]])continue;
                Q.push(es[q][i]);
                R[es[q][i]]=1-R[q];
            }
            
        }
    }
    return R;
}

signed main(void){
    int N;
    int a,b;
    vector<int> A,B;
    vector<pair<int,int>> AB;
    cin >> N;
    REP(i,N-1){
        cin >> a >> b;
        a--;b--;
        AB.push_back({a,b});
    }
    vector<int> d = bipartite(AB);
    
    //REP(i,N){cout << d[i] << " ";}cout << endl;
    
    vector<int> V[3];
    REP(i,N){
        V[d[i]+1].push_back(i);
    }
    
    if(V[1].size()>V[2].size()){
        V[0]=V[1];
        V[1]=V[2];
        V[2]=V[0];
        V[0].clear();
    }
    
    if(V[1].size()<=N/3){
        V[0]=V[1];
        V[1].clear();
        while(V[0].size()<N/3){
            V[0].push_back(V[2][V[2].size()-1]);
            V[2].pop_back();
        }
        while(V[1].size()<(N+2)/3){
            V[1].push_back(V[2][V[2].size()-1]);
            V[2].pop_back();
        }
    }else{
        while(V[1].size()>(N+2)/3){
            V[0].push_back(V[1][V[1].size()-1]);
            V[1].pop_back();
        }
        while(V[2].size()>(N+1)/3){
            V[0].push_back(V[2][V[2].size()-1]);
            V[2].pop_back();
        }
        
    }
    
    /*REP(j,3){
        REP(i,V[j].size()){
            cout << V[j][i]+1 << " ";
        }cout << endl;
    }*/
    
    vector<int> Ans;
    REP(i,N){Ans.push_back(0);}
    REP(j,3){
        REP(i,V[j].size()){
            Ans[V[j][i]]=j;
        }
    }
    
    int x[3]={};x[0]=1;
    REP(i,N){
        int k=Ans[i];
        Ans[i]+=x[k]*3;
        x[k]++;
    }
    
    REP(i,N){
        cout << Ans[i];
        if(i!=N-1)cout << " ";
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 22380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using Pt = pair<int, int>;

int main()
{
	int N;
	cin >> N;
	ll ans = 0;
	for (int i = 1; i < N; ++i)
	{

		ans += N / i;
		if (N % i == 0)
			--ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

Pi A[200020];
int x[100010][2];

void solve(){
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d", x[i]);
	rep(i, n)scanf("%d", x[i]+1);
	rep(i, n)A[i+i] = Pi(x[i][0], 1), A[i+i+1] = Pi(x[i][1], -1);
	sort(A, A+n+n);
	ll ans = 1; int cnt = 0;
	rep(i, n+n){
		if(A[i].Se == -1 && cnt > 0)ans = ans * cnt % 1000000007;
		if(A[i].Se == 1 && cnt < 0)ans = ans * -cnt % 1000000007;
		cnt += A[i].Se;
	}
	printf("%lld", ans);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 2560
from operator import mul
from functools import reduce
N, M=map(int, input().split())


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

if N>=2 and M>=2:
    print(combinations_count(N, 2)+combinations_count(M, 2))
elif N>=2 or M>=2:
    print(combinations_count(N, 2)+combinations_count(M, 2)-1)
else:
    print(0)


Measured memory_bytes: 38256
#include <stdio.h>

int main()
{
  int a, b, c;
  int sum1, sum2, sum3;
  int min;

  scanf("%d %d %d", &a, &b, &c);
   
  sum1 = a + b;
  sum2 = a + c;
  sum3 = b + c;

  min = sum1;
  if(min > sum2) min = sum2;
  if(min > sum3) min = sum3;

  printf("%d\n", min);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 9999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> K >> S;
  T=S;
  Sort(T);
  rrep(i,N,0){
    if(S[i]==T[0])sum++;
    else break;
  }
  while(N>sum){
    if(sum>0)sum*=2;
    else sum++;
    num++;
  }
  if(K>=num){
    rep(i,0,N)NeOut(T[0]);
    Out("");
  }
  else{
    rep(i,0,K-1){
      Vec(G,string,0,"");
      T=S;
      Rev(T);
      S+=T;
      Rev(S);
      rep(j,0,N+1){
        T=S.substr(j,N);
        G.pb(T);
      }
      Sort(G);
      S=G[0];
      Rev(S);
      //Out(S);
    }
    Vec(G,string,0,"");
    T=S;
    Rev(T);
    S+=T;
    rep(i,0,N+1)G.pb(S.substr(i,N));
    Sort(G);
    Out(G[0]);
  }
}



Measured memory_bytes: 40192
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

bool is_valid(vector<pair<long long, int>> &D, vector<pair<int, int>> &edges){
    int N = D.size();
    vector<vector<int>> G(N);
    for(auto x : edges){
        G[x.first].push_back(x.second);
        G[x.second].push_back(x.first);
    }
    queue<pair<int, long long>> que;
    vector<bool> vis(N, false);
    que.push(make_pair(0, 0));
    long long cnt = 0;
    while(!que.empty()){
        auto q = que.front();
        que.pop();
        if(vis[q.first]) continue;
        vis[q.first] = true;
        cnt += q.second;
        for(auto x : G[q.first])
            que.push(make_pair(x, q.second+1));
    }
    return cnt == D[0].first;
}

int main(){
    long long N;
    cin >> N;
    vector<pair<long long, int>> D(N);
    for(int i=0; i<N; i++){
        long long tmp;
        cin >> tmp;
        D[i] = make_pair(tmp, i);
    }
    sort(D.begin(), D.end(), greater<pair<long long, int>>());

    vector<int> idx2idx(N);
    for(int i=0; i<N; i++)
        idx2idx[i] = D[i].second;

    map<long long, int> d2idx;
    for(int i=0; i<N; i++)
        d2idx[D[i].first] = i;

    vector<long long> E(N, 1);
    vector<pair<int, int>> edges;
    for(int i=0; i<N-1; i++){
        long long d0 = D[i].first;
        long long d1 = D[i].first + 2 * E[i] - N;
        auto itr = d2idx.find(d1);
        if(itr == d2idx.end() || i == d2idx[d1]){
            cout << -1 << endl;
            return 0;
        }
        edges.push_back(make_pair(i, d2idx[d1]));
        E[d2idx[d1]] += E[i];
    }

    if(!is_valid(D, edges)){
        cout << -1 << endl;
        return 0;
    }

    for(auto x : edges)
        cout << idx2idx[x.first]+1 << " " << idx2idx[x.second]+1 << endl;

    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,true):false;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,true):false;}

int nextInt() {
  int x; scanf("%d", &x); return x;
}

int s[101];
bool dp[100010];

int main2() {
  int N = nextInt();
  REP(i, N) s[i] = nextInt();
  int M = 10000;
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  REP(i, N) {
    for (int j = M; j >= 0; j--) {
      if (dp[j] && j + s[i] <= M) {
        dp[j + s[i]] = dp[j];
      }
    }
  }
  int ans = 0;
  for (int j = M; j >= 0; j--) {
    if (j % 10 != 0 && dp[j]) {
      ans = j;
      break;
    }
  }
  cout << ans << endl;


  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}


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

#define ll long long

using namespace std;

const int N = (int)3e3 + 7;
const int mod = (int)1e9 + 7;

int pref[N][N];
int n;
int dp[N][N];

int add(int a, int b) {
	return (a + b) % mod;
}

main() {
	string s;
	cin >> n;
	cin >> s;
	dp[1][1] = 1;
	for (int i = 1; i <= n; i++) {
		pref[1][i] = 1;
	}
	for (int i = 2; i <= n; i++) {
		if (s[i - 2] == '<') {
			for (int j = 1; j <= i; j++) {
				dp[i][j] = pref[i - 1][j - 1];
			}
		} else {
			for (int j = 1; j <= i; j++) {
				dp[i][j] = add(pref[i - 1][n], mod - pref[i - 1][j - 1]);
			}
		}
		for (int j = 1; j <= n; j++) {
			pref[i][j] = add(pref[i][j - 1], dp[i][j]);
		}
	}
	cout << pref[n][n];
}


Measured memory_bytes: 69504
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;

#define rep(i, a, b) for (int (i)=(a);(i)<=(b);(i)++)
#define Rep(i, a, b) for (int (i)=(a)-1;(i)<(b);(i)++)
#define REP(i, a, b) for (int (i)=(a);(i)>=(b);(i)--)
#define reg(i, x) for (int (i)=head[x];(i);i=e[i].next)
#define clr(a) memset(a,0,sizeof(a))
#define Sort(a, len) sort(a + 1, a + len + 1)
#define Sort2(a, len, cmp) sort(a + 1, a + len + 1, cmp)
#define ass(a, sum) memset(a, sum, sizeof(a))

#define ull unsigned long long
#define ll long long
#define ls ((rt) << 1)
#define rs ((rt) << 1 | 1)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
#define Pii pair<int, int>

const int N = 100010 ;
const int iinf = INT_MAX/2 ;
const ll linf = LLONG_MAX/2 ;
const int MOD = 1e9+7 ;

inline int read(){
    int X = 0,w = 0 ;
	char ch = 0;
    while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}
    while(isdigit(ch)) X = (X<<3) + (X<<1) + (ch ^ 48),ch = getchar();
    return w ? -X : X;
}

void write(int x){
     if(x < 0) putchar('-'),x = -x;
     if(x > 9) write(x / 10);
     putchar(x%10 + '0');
}

void print(int x) {
	cout << x << endl ;
	exit(0) ;
}

void douout(double x){
	 printf("%lf\n", x + 0.0000000001) ;
}

int n, m ;
int x[N], y[N], h[N] ;

int main(){
	scanf("%d", &n) ;
	
	for(int i = 0; i < n; i++){
		scanf("%d%d%d", &x[i], &y[i], &h[i]) ;
		if (h[i] > 0) m = i ;
	}
	for(int Cx=0; Cx<=100; Cx++ ){
		for(int Cy=0; Cy<=100; Cy++){
			int H=abs(Cx-x[m])+abs(Cy-y[m])+h[m];
			bool flag = true;
			for(int i=0; i<n; i++){
				if(max(0,H-abs(x[i]-Cx)-abs(y[i]-Cy))!=h[i]){
					flag =false;
					break;
				}
            }
		if(flag){
			cout<<Cx<<" "<<Cy<<" "<<H<<endl;
			return 0;
        }
        }
    }
}

/*
写代码时请注意：
	1.是否要开Long Long？数组边界处理好了么？
	2.特殊情况处理好了么？
	3.做一些总比不做好。
	4.最大值和最小值问题可不可以用二分答案？
	5.有没有贪心策略？否则能不能dp？
	6.实数精度有没有处理？
*/


Measured memory_bytes: 256
A,B,C = map(int,input().split())
print(min(abs(A-B)+abs(B-C),abs(A-C)+abs(C-B),abs(B-C)+abs(C-A),abs(B-A)+abs(A-C),abs(C-A)+abs(A-B),abs(C-B)+abs(B-A)))

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll l, r, mi = 2000000001,cnt=0;
	cin >> l >> r;
	for (ll i = l; i < r; i++) {
		for (ll j = i+1; j < r+1; j++) {
			mi = min(i * j % 2019, mi);
			if(mi==0) cnt++;
			if (cnt>=2200) {
				cout<<mi<<endl;
				return 0;
			}
		}
		cnt=0;
	}
	cout << mi<< endl;
	return 0;
}


Measured memory_bytes: 256
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)


K = ni()
A,B = nm()
if A % K == 0:
    print('OK')
    exit(0)
if B // K != A //K :
    print('OK')
    exit(0)
print('NG')


Measured memory_bytes: 9196
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;

#define NIL NULL

Node root = NIL;
Node treeMinimum(Node);
Node treeMaximum(Node);
Node treeSearch(Node , int);
Node treeSuccessor(Node);
void treeDelete(Node);
void insert(int);
void inorder(Node);
void preorder(Node);

int count1 = 1,count2 = 1,ak;

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
ak = n;

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Node treeMinimum(Node x){

  while(x->left != NIL) x = x->left;
  return x;
}

Node treeMaximum(Node x){

  while(x->left != NIL ) x = x->right;
  return x;
}

Node treeSearch(Node x , int k){

  while( x!= NIL){
    if(k < x->key) x = x->left;
    else x = x->right;
  }
  return x;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);

  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}


void treeDelete(Node z){
  Node y;
  Node x;

  if(y->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if(y != z) z->key =y->key;

}

void insert(int k){
  Node y  = NIL;
  Node x = root ; //current
  Node z; //temp

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

if(root == NIL) root = z;
else {
  x = root;
  y = NIL;
}
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
      if(x == NIL){
       y->left = z;
       return;
     }
   }else{
x = x->right;

    if(x == NIL) {
      y->right = z;
return;
}
  }
}
}

void inorder(Node u){

  if(u != NIL){

    inorder(u->left);

    printf(" %d",u->key);

    inorder(u->right);
  }

}

void preorder(Node u){

  if(u != NIL){
        printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}



Measured memory_bytes: 25176
#include <iostream>

using namespace std;

const int Z = 1e9+7;
const int X = 1e6;

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

    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    int inv[2*X+2];
    for (int i = 1; i <= 2 * X + 1; i++) {
        inv[i] = i == 1 ? 1 : 1ll * (Z - Z / i) * inv[Z%i] % Z;
    }

    int fac[2*X+2], ifac[2*X+2];
    for (int i = 0; i <= 2 * X + 1; i++) {
        fac[i] = i == 0 ? 1 : 1ll * fac[i-1] * i % Z;
        ifac[i] = i == 0 ? 1 : 1ll * ifac[i-1] * inv[i] % Z;
    }

    int ans = 0;
    for (int i = r1; i <= r2; i++) {
        int f0 = 1ll * fac[i+c1] * ifac[c1-1] % Z;
        int f1 = 1ll * fac[i+c2+1] * ifac[c2] % Z;
        ans = (ans + 1ll * (Z + f1 - f0) * ifac[i+1] % Z) % Z;
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

int mv[105][105];

int main(){
    int n,m,k,i,x,y,a,ind,j,answer=0;

    cin>>n>>m>>k;

    for(ind=1;ind<=k;ind++){
        cin>>x>>y>>a;

        if(a==1)
            for(i=x;i>0;i--)
                for(j=m;j>0;j--)
                    mv[i][j]=1;
        else if(a==2)
            for(i=x+1;i<=n;i++)
                for(j=1;j<=m;j++)
                    mv[i][j]=1;
        else if(a==3)
            for(i=1;i<=n;i++)
                for(j=y;j>0;j--)
                    mv[i][j]=1;
        else
            for(i=1;i<=n;i++)
                for(j=y+1;j<=m;j++)
                    mv[i][j]=1;
    }

    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            if(!mv[i][j])
                answer++;

    cout<<answer;

    return 0;
}


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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

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

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    string s;
    cin >> s;
    if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]) cout << "Bad" << endl;
    else cout << "Good" << endl;

}
    // Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3612
def num2alpha(num):
    if num <= 26:
        return chr(64+num)
    elif num % 26 == 0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num % 26)


n = int(input())
print(num2alpha(n).lower())

Measured memory_bytes: 9176
n = int(input())
a = list(map(int, input().split()))

c = set()
k = 0
min_c = 1
max_c = 1
for i in range(n):
  if 1 <= a[i] <= 399:
    c.add(1)
  elif 400 <= a[i] <= 799:
    c.add(2)
  elif 800 <= a[i] <= 1199:
    c.add(3)
  elif 1200 <= a[i] <= 1599:
    c.add(4)
  elif 1600 <= a[i] <= 1999:
    c.add(5)
  elif 2000 <= a[i] <= 2399:
    c.add(6)
  elif 2400 <= a[i] <= 2799:
    c.add(7)
  elif 2800 <= a[i] <= 3199:
    c.add(8)
  elif a[i] >= 3200:
    k += 1

if k != n:
  min_c = len(list(c))
  max_c = len(list(c)) + k
else:
  min_c = 1
  max_c = n
print(min_c, max_c)

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1000000007LL;
const int Maxn = 1e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

ll t[Maxn], x[Maxn], y[Maxn];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> t[i] >> x[i] >> y[i];
		ll dis = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
		if( (dis > t[i] - t[i - 1]) || ((t[i] - t[i - 1] + dis) % 2 == 1) ) return cout << "No", 0;
	}
	cout << "Yes";
	return 0;
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


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

#define FOR(k,m,n) for(int(k)=(m);(k)<(n);(k)++)
#define REP(k,n) FOR((k),0,(n))


int main() {
    int A, B;
    cin >> A >> B;
    printf("%d\n", std::max(A + B, std::max(A - B, A * B)));

    return 0;
}


/*
 * Local Variables:
 * compile-command: "CXXFLAGS='-std=c++14' make main"
 * End:
 */


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

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

#define max_n 100

int N;
vector<pair<int, int>> xy;
priority_queue<pair<int, int>> q;

int main() {

	cin >> N;

	cout << N * N * N << endl;
	
	

	return 0;	
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		String[] C = S.split("",0);
		int max=0;
		int counta=0;
		for(int i=0;i<S.length();i++){
			if(C[i].equals("A")||C[i].equals("C")||C[i].equals("G")||C[i].equals("T")){
				counta++;
				if(max<=counta){
					max=counta;
				}
			}
			else{
				counta=0;
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define EPS 1e-6
#define INF 1000000000

// MAXIMIZAR f(x) == MINIMIZAR -f(x)

#define _ ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0), cout.tie(0), cout.precision(15);
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define FORC(i, a, b) for(int i=int(a); i>=int(b); i--)
#define pb push_back
#define fi first
#define se second
#define debug(x) cout << (#x) << " = " << x << "\n";
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

clock_t t_;

using namespace std;


template<class T> void print(T s){cout << s << "\n";}
template<class T> void emax(T &a, T b){a = (a<b ? b : a);};
template<class T> void emin(T &a, T b){a = (a>b ? b : a);}
template<class T> void printC(T s){ for(auto &x : s){cout << x << " ";} cout << "\n";}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define maxn 100005
#define mod 1000000007

const int inf = 1e9+5;

int main(int argc, const char * argv[]) {
     
    #ifdef input
    freopen("input.txt", "r", stdin);
    #endif
    #ifdef output
    freopen("output.txt", "w", stdout);
    #endif
    t_ = clock();
        
    int n;
    cin >> n;
    vi info(n);
    for(auto &i : info){
    	cin >> i;
    }
    vi dp(n+1,inf);
    dp[1] = 0;
    for(int i = 1; i<=n; i++){
    	for(auto j : {i+1, i+2}){
    		dp[j] = min(dp[j], dp[i] + abs(info[i-1]-info[j-1]));
    	}
    }

    print(dp[n]);

    t_ = clock()-t_;
    cerr << setprecision(9) << fixed << ((float)t_ / CLOCKS_PER_SEC) << endl;

        
    return 0;
}





Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int getIndex(char _c) {
	return _c - 'a';
}

int main() {
	string s;
	int N;
	cin >> N;
	cin >> s;

	int right[26], left[26];
	// 初期化
	for (int i = 0; i < 26; ++i) {
		right[i] = 0;
		left[i] = 0;
	}
	for (int i = 0; i < s.size(); ++i) {
		right[getIndex(s[i])]++;
	}

	// 右にずらしてく
	int ans = 0;

	REP(i, s.size()){
		char c = s[i];
		right[getIndex(c)]--;
		left[getIndex(c)]++;

		int same_number = 0;
		REP(j, 26) {
			if (left[j] > 0 && right[j] > 0) same_number++;
		}
		ans = max(ans, same_number);
	}
	cout << ans;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll n, m;
    cin >> n >> m;
    vector<P> p(m);
    rep(i,m) cin >> p[i].first >> p[i].second;
    rep(i,1000){
        ll keta=1, nx=i/10;
        vector<ll> d(1,i%10);
        while(nx){
            keta++;
            d.push_back(nx%10);
            nx/=10;
        }
        if(keta != n) continue;
        bool ok=true;
        reverse(all(d));
        rep(i,m){
            if(d[p[i].first-1] != p[i].second) ok=false;
        }
        if(ok){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3592
package main

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

func prime(a int) bool {
	for i := 2; i < a/2+1; i++ {
		if a%i == 0 {
			return false
		}
	}
	return true

}

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var X int
	fmt.Scan(&X)
	var p int
	p = X
	for {
		if prime(p) {
			break
		}
		p++
	}
	fmt.Fprintln(wtr, p)
	_ = wtr.Flush()
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  string s;
  cin >> s;

  ll n = s.size();
  ll ans = n / 2;

  for (auto c : s) {
    if (c == 'p') {
      ans--;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
  public static void main(String[] args){
    Set<String> ans = new HashSet<>();
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    for (int i=0; i<num; i++) {
      ans.add(sc.next());
    }
    System.out.println(ans.size());
  }
}

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

int factorical(int n){
  int x=1;
  for( int i=1; i<n+1; i++){
    x*= i;
  }
  return x;
};

int main(){
  int N=0;
  cin >> N;

  int x[N], y[N], arr[N];
  for(int i=0; i<N; i++){
    cin >> x[i] >> y[i];
    arr[i] = i + 1;
  }

  int pArr[factorical(N)][N];
  int pCnt=0;
  do{
    for( int aCnt=0; aCnt<N; aCnt++){
      pArr[pCnt][aCnt] = arr[aCnt];
    }
    pCnt++;
  }while(next_permutation(arr, arr+N));

  double sum=0;
  int param = 0;
  int next = 0;
  for(int sumCnt=0; sumCnt<factorical(N); sumCnt++){
    for(int root=0; root<N-1; root++){
      param = pArr[sumCnt][root] - 1;
      next = pArr[sumCnt][root+1] - 1;
      sum += sqrt( pow(x[param]-x[next], 2.0) + pow(y[param]-y[next], 2.0) );
    }
  }
  double ans = sum / (double)factorical(N);
  cout << fixed << setprecision(10) << ans << endl;

  return 0;
};

Measured memory_bytes: 1536
n, m = map(int, input().split())
kl = []
for i in range(m):
	s = list(map(int, input().split()))
	kl.append(s[1:])

pl = list(map(int, input().split()))

sl = [0] * n

count = 0

for t in range(2**n):
		
	# print(sl)
	
	test = True
	for o in range(m):
		on = 0
		for q in kl[o]:
			on += sl[q-1]
		
		if pl[o] != on % 2:
			test = False
		
	if test:
		count += 1
	
	for i in range(n):
		if sl[i] == 0:
			sl[i] = 1
			for j in range(i):
				sl[j] = 0
			break
	

print(count)
		

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const double pi = (acos(-1));

long double a, b, x;

int main(){

    cin >> a >> b >> x;
    long double theta;
    long double S = x / a;
    if(S >= a*b/2) {
        double  h = 2*(a*b - S) / a;
        theta = atan2(h,a);
    }
    else {
        double w = 2 * S / b;
        theta = atan2(b,w);
    }
    cout << fixed << setprecision(12) << theta * 180 /pi <<endl;
}


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

double D;
int N;
int B;
double H[10];
double P[10];
double calc(double base, double len, int idx){
	double h = H[idx];
	double p = P[idx] - base;
	
	double vx = sqrt((len * p - p * p) / (2 * h));
	double vy = len / (2 * vx);
	if(vx > vy){
		return sqrt(len);
	}else{
		return sqrt(vx * vx + vy * vy);
	}

}
int main(){
	cin >> D >> N >> B;
	for(int i = 0; i < N; i++){
		cin >> P[i] >> H[i];
	}
	double ans = 1e9;
	for(int i = 0; i <= B; i++){
		double aa = 0;
		for(int j = 0; j < N; j++){
			for(int k = 0; k <= i; k++){
				if(P[j] < (D / (i + 1)) * (k + 1)){
					aa = max(aa, calc((D / (i + 1)) * k, D / (i + 1), j));
				}
			}
		}
		ans = min(ans, aa);
	}
	printf("%.6lf\n", ans);
}

Measured memory_bytes: 3340
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

ll binpow(ll a,ll x){
    ll res=1;
    while(x>0){
        if(x&1)
            res=(res*a)%MOD;
        a=(a*a)%MOD;
        x>>=1;
    }
    return res;
}

ll modInverse(ll a, ll m) 
{ 
    return(binpow(a, m-2)); 
} 
 
 
ll binomialCoeff(ll n, ll k)  
{  
    ll res = 1; 
    ll den=1; 
    ll inv;
    if ( k > n - k )  
        k = n - k;  
    for (ll i = 0; i < k; ++i)  
    {  
        res = (res*(n - i))%MOD; 
        inv=modInverse(i+1,MOD);
        res=(res*inv)%MOD;
    }  
    return res;  
}



int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    // input
    cout << fixed << setprecision(10);
    ll n, a, b; cin >> n >> a >> b;

    // variable
    ll ans = 1;
    // solve
    ans = binpow(2, n);
    ans -= binomialCoeff(n,a);
    ans -= binomialCoeff(n,b);
    ans -= 1;
    while(ans < 0)ans+=MOD;

    print(ans);
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

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

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct Hashing {
    ull seed, mod;
    vector <ull> hs, pw;

    Hashing(ull seed = 31, ull mod = 1000173169) :
        seed(seed),
        mod(mod) {}

    void build(int n, const string& s) {
        hs.assign(n + 1, 0);
        pw.assign(n + 1, 1);
        pw[0] = 1;

        for (int i = 1; i <= n; ++i)
            pw[i] = pw[i - 1] * seed % mod;
        for (int i = 1; i <= n; ++i)
            hs[i] = (hs[i - 1] * seed + s[i]) % mod;
    }

    ull hash(int l, int r) {
        return (hs[r] - hs[l - 1] * pw[r - l + 1] % mod + mod) % mod;
    }
};

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

    unordered_set<int> us;
    bool yes = true;

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

        if (us.find(v) != us.end())
            yes = false;
        else
            us.insert(v);
    }

    if (yes)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

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

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

template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
struct Unionfind {
    vector<int> par;
    vector<int> sizes;

    Unionfind(int n) : par(n), sizes(n, 1) {
        for(int i = 0; i < n; ++i) par[i] = i;
    }

    int root(int x) {
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        if(sizes[x] < sizes[y]) swap(x, y);
        par[ry] = rx;
        sizes[rx] += sizes[ry];
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) {
        return sizes[root(x)];
    }

};

int keta(ll x) {
    int ans = 0;

    while(x > 0) {
        x /= 10;
        ++ans;
    }

    return ans;
}

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

    ll n;
    cin >> n;

    int ans = keta(n);

    for(ll a = 1; a * a <= n; ++a) {
        if(n % a != 0) continue;
        ll b = n / a;

        int t = max(keta(a), keta(b));

        ans = min(ans, t);
    }

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



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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

long int M = 1e+9+7;
int main(void){
    string s,t;
    cin >> s >> t;
    rep(i,s.size()){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

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

  sort(d, d+N, greater<int>());

  int count = 1;
  int under_mochi = d[0];
  for (int i = 1; i < N; i++) {
    if(d[i] < under_mochi){
      ++count;
      under_mochi = d[i];
    }
  }

  cout << count << endl;

  return 0;
}


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

int main()
{
	int N,res=1;
	vector<pair<int, pair<int, int>>> points;
	cin >> N;
	points.resize(N+1);
	points[0].first = 0;
	points[0].second.first = 0;
	points[0].second.second = 0;

	for (int i = 1; i <=N; i++)
		cin >> points[i].first >> points[i].second.first >> points[i].second.second;

	for (int i = 1; i <= N; i++)
	{
		int dx, dy,dt;
		dx = points[i].second.first - points[i - 1].second.first;
		dy = points[i].second.second - points[i - 1].second.second;
		dt = points[i].first - points[i - 1].first;
		
		
		if (((abs(dx) + abs(dy))%2) != (dt%2)|| dt<(abs(dx) + abs(dy)))
		{
			res = 0;
			break;
		}
	}
	if (res)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
	
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            long count = 0;
            for(int i=1;i<n+1;i++){
              if(i%3==0||i%5==0){
                continue;
              }
              count+=i;
            }
            System.out.println(count);
          }
        }



Measured memory_bytes: 35844