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

#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second
#define sf scanf

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;

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

int main(int argc, char *argv[])
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;
	set<string> st;
	while (n--) {
		string s;
		cin >> s;
		st.insert(s);
	}
	cout << st.size();

	return 0;
}


Measured memory_bytes: 19120
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    set<int> S;
    int N, x;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> x;
        if (S.count(x)) S.erase(x);
        else S.insert(x);
    }
    cout << (int) S.size() << '\n';
}


Measured memory_bytes: 4864
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;
int main() {
  int A,B;
  cin >>A>>B;
  if(A%3==0 || B%3==0 ||(A+B)%3==0) cout <<"Possible";
  else cout <<"Impossible";
}


Measured memory_bytes: 764
import numpy as np

def search(A):
  B = list(set(A))
  B.sort(reverse=True)
  if len(A)-len(B) == 0: return 0 

  a1 = 0
  An = np.array(A)
  for n,(i, j) in enumerate(zip(An[0:-1], An[1:])):
    if i == j:
      a1 = i
      break
  del(A[:n+2])

  return a1

N = int(input())
A = map(int, input().split())
A = [a for a in A]
A.sort(reverse=True)
a1 = search(A)
a2 = search(A)
if a1 > 0 and a2 > 0: print(a1*a2)
else: print(0)


Measured memory_bytes: 32060
#define DEBUG 0

/**
 * File    : D.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-5-11 21:31:45
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

ll N;
ll ans = 0;
vector<ll> V;

int main()
{
  cin >> N;
  for (auto i = 1LL; i < 1000010; i++)
  {
    if (N % i == 0 && N / i >= i)
    {
      if (N / i == i)
      {
        V.push_back(i);
      }
      else
      {
        V.push_back(i);
        V.push_back(N / i);
      }
    }
  }
  for (auto x : V)
  {
    ll m = x - 1;
    if (m > 0)
    {
      ll q = N / m;
      ll r = N % m;
      if (q == r)
      {
        ans += m;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
H, W, A, B = map(int, input().split())
board1 = [[0] * A + [1] * (W - A) for _ in range(B)]
for l in board1:
    print(*l, sep='')
board2 = [[1] * A + [0] * (W - A) for _ in range(H - B)]
for l in board2:
    print(*l, sep='')


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

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

    int p;
    string s;
    vector<bool> answered(n, false);
    vector<int> was(n, 0);

    int account=0;
    int sumwacount=0;

    for (int i=0; i<m; i++) {
        cin >> p >> s;

        if (!(answered.at(p-1))) {
            if (s == "AC") {
                answered.at(p-1) = true;
                account++;
            }
            else {
                was.at(p-1)++;
            }
        }
    }

    for (int i=0; i<n; i++) {
        if (answered.at(i)) sumwacount += was.at(i);
    }

    cout << account << ' ' << sumwacount;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main{
    static tree[] wd;
	public static void main(String[] args) {
	    int x,i,j,n,root = 0,hz;
	// TODO Auto-generated method stub
     Scanner sca = new Scanner(System.in);
     n=sca.nextInt();
     wd=new tree[n];
     int[]checkmap=new int[n+1];
    for(j=0;j<n;j++){
    	x=sca.nextInt();
	if(j==0)root=x;
	wd[x]=new tree(x);
	for(i=0;i<2;i++){
	    hz=sca.nextInt();
	    if(i==0){
            wd[x].setleft(hz);
	    }else{
	    wd[x].setright(hz);
	    }
	    if(hz==-1)hz=n;
	checkmap[hz]=1;
	}
    }
    for(j=0;j<n;j++){
	if(checkmap[j]!=1)root=j;
    }
    chain(root,-1);
     for(i=0;i<n;i++){
    	 System.out.print("node "+wd[i].getnode()+": parent = "+ wd[i].getpar()+", sibling = "+sersib(i)+", degree = "+wd[i].getdeg()+", depth = "+serdepth(i,0)+", height = "+serheight(i,0)+", ");
	 if(wd[i].getpar()==-1){
    	System.out.println("root");
	 }else if(wd[i].getdeg()==0){
    	 System.out.println("leaf");
    	}else{
	   System.out.println("internal node");
    	}
     }
   
     
	}
    public static void chain(int chi,int p){
	int i;
	wd[chi].setpar(p);
	if(wd[chi].getdeg()==0)return;
	if(wd[chi].getleft()!=-1) chain(wd[chi].getleft(),chi);
	if(wd[chi].getright()!=-1)chain(wd[chi].getright(),chi);
	}
    public static int serdepth(int x,int cnt){
	    if(wd[x].getpar()==-1)return cnt;
		cnt++;
		return serdepth(wd[x].getpar(),cnt);
	}
    public static int sersib(int n){
	if(wd[n].getpar()==-1)return -1;
        if(wd[wd[n].getpar()].getright()==n){
	    return wd[wd[n].getpar()].getleft();
	}else{
		return wd[wd[n].getpar()].getright();
	}
    }
	    public static int serheight(int n,int cnt){
	int x=-1,y=-1;
	if(wd[n].getleft()==-1&&wd[n].getright()==-1) return cnt;
	if(wd[n].getleft()!=-1){
	    x=serheight(wd[n].getleft(),cnt+1);
	}
        if(wd[n].getright()!=-1){
	    y=serheight(wd[n].getright(),cnt+1);
	}
	if(x<y)return y;
        return x;
	}
    
}
class tree{
    int node,par,n,i,degree=0,sibling,depth,height;
    int left,right;
    tree(int node){
	this.node=node;
    }
    public int getnode(){
	return node;
    }
    public void setleft(int c){
	left=c;
	if(left!=-1) degree++;
    }
    public int getleft(){
	return left;
    }
    public void setright(int c){
	right=c;
	if(right!=-1) degree++;
    }
    public int getright(){
	return right;
    }
    public void setpar(int p){
	par=p;
    }
    public int getpar(){
	return par;
    }
    public int getdeg(){
	return degree;
    }
    
}



Measured memory_bytes: 26448
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String out ="";
    int[] a = new int[100];
    int maxValue = -1;
    int[]maxNum = new int[100];
    int maxCnt = 0;
    while (scanner.hasNext()) {
      int n = scanner.nextInt();
      a[n - 1]++;
    }
    for (int ii = 0; ii < 100; ii++) {
      if (a[ii] > maxValue) {
        maxValue = a[ii];
        maxNum[maxCnt] = ii + 1;
        continue;
      }
      if (a[ii] == maxValue) {
        maxCnt++;
        maxNum[maxCnt] = ii + 1;
        continue;
      }
    }
    for (int ii = 0; ii < 100; ii++) {
      if (maxNum[ii] == 0) {
          break;
      }
      out += maxNum[ii] + "\n";
    }
    System.out.print(out);
  }
}

Measured memory_bytes: 18152
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  switch(n % 10){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout << "hon";
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      cout << "pon";
      break;
    case 3:
      cout << "bon";
      break;
  } 
}

Measured memory_bytes: 3624
/*input
6
1 2
1 3
1 4
1 5
1 6
*/
#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;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=1e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b,ll MOD){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
vector<pii> v[maxn];
int deg[maxn];
int col[maxn];
void dfs(int u,int par,int co){
    int cur=1;
    for(auto x:v[u]){
        if(x.f!=par){
            while(cur==co) cur++;
            col[x.s]=cur;
            dfs(x.f,u,cur);
            cur++;
        }
    }
}
int32_t main(){
    int n;
    cin>>n;
    REP(i,n-1){
        int a,b;
        cin>>a>>b;
        --a;
        --b;
        v[a].pb({b,i});
        v[b].pb({a,i});
        deg[a]++;
        deg[b]++;
    }
    int mx=0;
    REP(i,n) mx=max(mx,deg[i]);
    cout<<mx<<'\n';
    dfs(0,-1,-1);
    REP(i,n-1) cout<<col[i]<<'\n';
}

Measured memory_bytes: 9856
#!/usr/bin/env python3
import sys


def solve(X: int, A: int):
    if X >= A:
        print(10)
    else:
        print(0)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    solve(X, A)

if __name__ == '__main__':
    main()


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
//const int mod = 1000000007;
const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  ll n;
  int x, m;
  cin >> n >> x >> m;
  vector<vector<llP>> table(50, vector<llP>(m)); // sum, next;
  for(ll i = 0; i < m; ++i) table[0][i] = llP(i, (i*i)%m);

  for(int k = 1; k < 50; ++k) {
    rep(j, m) {
      ll sum = table[k-1][j].first + table[k-1][table[k-1][j].second].first;
      int next = table[k-1][table[k-1][j].second].second;
      table[k][j] = llP(sum, next);
    }
  }

  ll ans = 0;
  for(int k = 49; k >= 0; --k) {
    if(1ll<<k <= n) {
      n -= 1ll<<k;
      ans += table[k][x].first;
      x = table[k][x].second;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 82868
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IO std::ios::sync_with_stdio(false); cin.tie(0)
#define int long long
#define ull unsigned long long
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define INF 0x3f3f3f3f

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

int a,b,c,d;
signed main() {
  IO;
  cin >> a >> b >> c >> d;
  int ans = max({a * c, b * d ,a * d,b * c});
  cout << ans << '\n';
  return 0;
}

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

int main()
{
	char s[100];
	char s1[100];
	
	while(~scanf("%s",s))
	{
		int n = 0;
		int len = strlen(s);
		for(int i = 0;i < len;i++)
		{
			switch(s[i])
			{
				case '0':
					s1[n++] = '0';
					break;
				case '1':
					s1[n++] = '1';
					break;
				case 'B':
					if(n)
					{
						n--;
					}
					else
					{
						
					}
					break;
					
			}
		}
		s1[n] = 0;
		//printf("%d\n",n);
		printf("%s\n",s1);
	}

/*

01B0

0BB1
*/


 return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define deb(a) cout << a << ": "
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sliczny() {
  string s, p;
  cin >> s >> p;
  int n = s.length();
  int ans = inf;
  for(int i = 0; i < n - p.length() + 1; i++) {
    string q = s.substr(i, p.length());
    int cnt = 0;
    for(int j = 0; j < p.length(); j++) {
      if(q[j] != p[j]) {
        cnt++;
      }
    }
    ans = min(ans, cnt);
  }
  cout << ans;
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; 
  for(int t = 1; t <= T; t++) {
    //cout << "Case #" << t << ": ";
    sliczny();
  }
  return 0;
}


Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		while (scanner.hasNext()) {

			int d = input();
			int sumArea = 0;

			for (int i = 0; i < 600; i += d) {

				sumArea += i * i* d;

			}

			System.out.println(sumArea);

		}

		close();

	}

	public static int input() {

		return scanner.nextInt();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}

Measured memory_bytes: 26200
def dfs(l, r):
    if len(r) == 11:
        return
    l.append(int(r))
    for i in range(-1, 2):
        tmp = int(r[-1]) + i
        if 0 <= tmp <= 9:
            dfs(l, r + str(tmp))


k = int(input())
l = []
for i in range(1, 10):
    dfs(l, str(i))
print(sorted(l)[k - 1])

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	ll N,x; cin>>N>>x;
	vector<ll> A(N);
	vector<ll> B(N,0);
	rep(i,N) cin>>A[i];
	sort(A.bg,A.ed);
	ll candy=x,cnt=0;
	rep(i,N){
		if(i==N-1) B[i]=candy;
		else{
			B[i]=min(A[i],candy);
			candy-=B[i];
		}
	}
	rep(i,N){
		if(A[i]==B[i]) cnt++;
	}
	cout<<cnt;
}

Measured memory_bytes: 256
from operator import itemgetter
n,m = map(int,input().split())
h = list(map(int,input().split()))
cnt = 0
graph = [[]*n for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)


for i in range(n):
    good = True
    
    for j in range(len(graph[i])):
        ind = graph[i][j]
        
        if h[i] <= h[ind]:
            good = False
    if good:
        cnt += 1
print(cnt)

        
        



Measured memory_bytes: 92720
/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

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

	return 0;
}





Measured memory_bytes: 256
MAX = 10**18
def main():
    N = map(int,input())
    A = list(map(int,input().split(' ')))
    ans = 1
    if 0 in A:
        print(0)
        exit(0)
    for a in A:
        ans *= a
        if ans > MAX:
            print(-1)
            exit(0)

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 21592
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

int main()
{
	int a;
	char c;
	string x;
	map<string, int>data;
	while (cin >> a >> c >> x)
	{
		data[x]++;
	}
	cout << data["A"] << endl;
	cout << data["B"] << endl;
	cout << data["AB"] << endl;
	cout << data["O"] << endl;

}

Measured memory_bytes: 1220
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdint>

int main() {
  constexpr std::int64_t kModulus = 1000000007;
  int N, K;
  std::cin >> N >> K;
  std::vector<std::int64_t> positive, negative;
  for (int i = 0; i < N; ++i) {
    std::int64_t A;
    std::cin >> A;
    if (A > 0) {
      positive.push_back(A);
    }
    if (A < 0) {
      negative.push_back(A);
    }
  }
  if (K > static_cast<int>(positive.size() + negative.size())) {
    std::cout << 0 << std::endl;
    return 0;
  }

  std::int64_t product = 1;
  std::sort(negative.begin(), negative.end());
  if (positive.empty()) {
    if (K & 1) {
      std::reverse(negative.begin(), negative.end());
    }
    for (int i = 0; i < K; ++i) {
      product = (product * negative[i] % kModulus + kModulus) % kModulus;
    }
    if ((K & 1) && N > static_cast<int>(positive.size() + negative.size())) {
      product = 0;
    }
  } else if (K == static_cast<int>(positive.size() + negative.size())) {
    for (const auto& values : {positive, negative}) {
      for (const auto value : values) {
        product = (product * value % kModulus + kModulus) % kModulus;
      }
    }
    if ((negative.size() & 1) && N > static_cast<int>(positive.size() + negative.size())) {
      product = 0;
    }
  } else {
    std::sort(positive.begin(), positive.end());
    std::reverse(negative.begin(), negative.end());
    if (K & 1) {
      product = positive.back();
      positive.pop_back();
      --K;
    }
    while (K > 0) {
      std::int64_t positive_product = 0, negative_product = 0;
      if (positive.size() >= 2) {
        positive_product = *positive.rbegin() * *(positive.rbegin() + 1);
      }
      if (negative.size() >= 2) {
        negative_product = *negative.rbegin() * *(negative.rbegin() + 1);
      }
      if (positive_product > negative_product) {
        product = product * (positive_product % kModulus) % kModulus;
        positive.pop_back();
        positive.pop_back();
      } else {
        product = product * (negative_product % kModulus) % kModulus;
        negative.pop_back();
        negative.pop_back();
      }
      K -= 2;
    }
  }
  std::cout << product << std::endl;
  return 0;
}


Measured memory_bytes: 6160
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	char s1,s2,s3;
	int sum=0;
	scanf("%c%c%c",&s1,&s2,&s3);
	if(s1=='1')
		sum++;
		if(s2=='1')
		sum++;
		if(s3=='1')
		sum++;
	printf("%d\n",sum);
	return 0;
 } 

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

#define INF 1000000000000


signed main(){
int a,b,c;
cin>>a>>b>>c;
int ans;
ans=max(a*10+b+c,a+b*10+c);
ans=max(ans,a+b+c*10);
cout<<ans;
}


Measured memory_bytes: 256
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
L = rl()

ans = 0
for i in range(N):
	for j in range(i+1, N):
		for k in range(j+1, N):
			if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]: 
				continue
			ls = [L[i], L[j], L[k]]
			if ls[0]+ls[1] > ls[2] and ls[1]+ls[2] > ls[0] and ls[2]+ls[0] > ls[1]:
				ans += 1
print(ans)


Measured memory_bytes: 69248
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    bool b[4];
    rep(i,4) b[i]=false;
    rep(i,len(s)){
      if(s[i]=='N') b[0]=true;
      if(s[i]=='S') b[1]=true;
      if(s[i]=='W') b[2]=true;
      if(s[i]=='E') b[3]=true;
    }
    if((b[0]&&!b[1])||(b[2]&&!b[3])||(!b[0]&&b[1])||(!b[2]&&b[3])) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
using namespace std;

void solve()
{
    int n;
    cin >> n;
    ll a[n];
    for(int i=0;i<n;i++)
        cin >> a[i];
    ll cnt=0;
    sort(a,a+n);
    for(int i=0;i<n-2;i++)
    {
        for(int j=i+1;j<n-1;j++)
            for(int k=j+1;k<n;k++)
            {
             if(a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k])
             {
                int p=a[i]+a[j];
                int q=a[i]+a[k];
                int r=a[j]+a[k];
                if(p>a[k] && q>a[j] && r>a[i])
                    cnt++;
            }
            }
    }
    cout << cnt << endl;
}

int main()
{
    int t=1;
    //cin >> t;
    while(t--)
    solve();

    return 0;
}




Measured memory_bytes: 3608
N = int(input())
A = list(map(int, input().split()))
A.sort()

while len(A) > 1:
    n = A.pop(0)
    A = list(map(lambda x: x % n, A))
    A.sort()
    A.append(n)

    while 0 in A:
        A.pop(0)
print(A[0])


Measured memory_bytes: 14252
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
void solve(){
    ll n;cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+n+1);
    ll ans=0;
    if(n<3)
    {
        cout<<0<<endl;
        return;
    }
    for(ll i=n;i>=3;i--)
    {
        for(ll j=i-1;j>=2;j--)
        {
            ll c=a[i]-a[j]+1;
            if(c<0)continue;
            ll pos=lower_bound(a+1,a+n+1,c)-a;
            if(pos>=1 and pos<j)
                ans+=(j-pos);
        }
    }
    cout<<ans<<endl;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    solve();
    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	
	cin >> n;
	
	for (int i = 0; i < n; i++){
		int a,b,c;
		cin >> a >> b >> c;

		if (a > c){
			swap (a, c);
		}
		if (b > c){
			swap (b, c);
		}
		if (a * a + b * b == c * c){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

int gcd(int a,int b)
{
  if(a>b)swap(a,b);
  if(a==0){return b;}
  else return gcd(b%a,a);
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  vector<int>lg(n+1),rg(n+1);
  lg[0]=a[0];
  rg[n]=a[n-1];
  rep(i,n)lg[i+1]=gcd(lg[i],a[i]);
  rep(i,n)rg[n-1-i]=gcd(rg[n-i],a[n-1-i]);
  int res=max(lg[n-1],rg[1]);
  rep(i,n-2)
  {
    chmax(res,gcd(lg[i+1],rg[i+2]));
  }
  cout<<res<<endl;


  return 0;

}


Measured memory_bytes: 1408
n,k=gets.split.map(&:to_i)
dp=[1]*n
dp[0]=1
k.times{dp[gets.to_i-1]=0}

1.upto(n-1) do |i|
    next if dp[i]==0
    b = dp[i-1]
    bb= dp[i-2]

    dp[i]=b+bb
end

p dp[n-1]%(10**9+7)

Measured memory_bytes: 433020
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int x = Integer.parseInt(in.next()) - 1;
            int y = Integer.parseInt(in.next()) - 1;

            int cnt[] = new int[n];
//        Arrays.fill(cnt, 0);

            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int dist = Math.min(j - i, Math.abs(x - i) + Math.abs(j - y) + 1);
//                int dist = j-i;
                    cnt[dist]++;
                }
            }
            for (int i = 1; i < n; i++) {
                out.println(cnt[i]);
            }

        }

    }
}



Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
    private static int gcd(int a, int b){
        if(b == 0) return a;
        else return gcd(b, a%b);
    }


    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int ans = gcd(a, b);
        System.out.println(ans);
    }
}


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

MOD = 10**9 + 7
ans = 0
if abs(N-M) < 2:
    A, B = max(N, M), min(N, M)
    res = 1
    if A == B:
        for i in range(1, A+1):
            res = (i**2 % MOD) * res % MOD
        ans = res * 2 % MOD
    else:
        for a in range(1, A+1):
            res = res * a % MOD
        for b in range(1, B+1):
            res = res * b % MOD
        ans = res % MOD

print(ans)


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

int main() {
  string input;
  cin >> input;
  vector<int> output(0);
  for (int i = 0; i < input.size(); i++) {
    if (input[i] == '0' || input[i] == '1')
      output.push_back(input[i] - '0');
    else if (output.size() > 0)
      output.pop_back();
  }

  for (int x : output) {
    cout << x;
  }
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

void pakuripair_sort(int N, int A[], int B[]) {
	const int b = 8;
	int tmp[100001], tmp2[100001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) {
			tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
			tmp2[kazu[A[i] >> k * b & ((1 << b) - 1)]] = B[i];
		}
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) {
			A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
			B[kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp2[i];
		}
	}
}

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


	int N = getint(), M = getint();
	int A[100001], AN[100001];
	A[0] = 0;
	rep1(i, N) {
		int a = getint();
		A[i] = (A[i - 1] + a) % M;
		AN[i] = i;
	}
	pakuripair_sort(N, A + 1, AN + 1);

	int B[100001];
	int mae = A[0];
	int k = 0;
	ll kotae = 0;
	rep(i, N + 1) {
		if (mae != A[i]) k++;
		B[AN[i]] = k;
		mae = A[i];
	}
	int C[100001] = {};
	rep(i, N + 1) {
		kotae += C[B[i]]++;
	}
	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
#define P(a,b) make_pair(a,b);
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
  string S;
  cin >> S;
  if(S.substr(0,4) == "YAKI") cout << "Yes" << endl;
  else cout  << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,n;
    cin>>k>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
   int ans = arr[0] + k-arr[n-1];
   for(int i=0;i<n-1;i++)
   {
       ans = max(ans,abs(arr[i]-arr[i+1]));
   }
   cout<<k-ans<<endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

ll k, q;

void solve(vector<ll> &d){
	ll n, x, m;
	cin >> n >> x >> m;
	x %= m;
	vector<ll> e(k);
	REP(i, k) e[i] = d[i]%m;

	ll q = (n-1)/k;
	ll r = (n-1)%k;

	ll z = 0;
	ll tmpz = 0;
	REP(i, k) if(e[i] == 0) tmpz++;
	z += q * tmpz;
	REP(i, r) if(e[i] == 0) z++;

	ll S = x;
	ll tmpS = 0;
	REP(i, k) tmpS += e[i];
	S += q * tmpS;
	REP(i, r) S += e[i];
	ll a = S/m;

	cout << (n-1) - z - a << endl;
	return;
}

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

    cin >> k >> q;
    vector<ll> d(k);
    REP(i, k) cin >> d[i];

    while(q--){
    	solve(d);
    }
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
  int n;  scanf("%d", &n);
  int time[104], sum = 0;
  for(int i=1; i<=n; i++){
    scanf("%d", time+i);
    sum += time[i];
  }
  int m;  scanf("%d", &m);
  for(int i=0; i<m; i++){
    int p, x;  scanf("%d %d", &p, &x);
    printf("%d\n", sum - time[p] + x);
  }

  return 0;
}


Measured memory_bytes: 128
#include <iostream>

 

using namespace std;

 

int main() 
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    
    if(x-r >= 0 && y-r >= 0 && x+r <=w && y+r<= h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3116
n = gets.to_i

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

x = Array.new(n){|i|i}.map do |i|
  a[0..i].inject{|r, i| r+i } + b[i..-1].inject{|r, i| r+i }
end.max

puts x

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int N,K;
  std::cin >> N >> K;
  vvi A(K);
  rep(i,K){
    int d; std::cin >> d;
    rep(j,d){
      int a; std::cin >> a;
      A[i].push_back(a);
    }
  }

  vt<bool> c(N);
  rep(i,K){
    for(int x : A[i]){
      c[x-1] = true;
    }
  }

  int ans = 0;
  rep(i,N){
    if(c[i] == false)
      ans++;
  }

  std::cout << ans << '\n';
  return 0;
}


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


void solve(long long N, long long M, std::vector<long long> A){
    priority_queue<ll> que(A.begin(), A.end());
    for(ll i=0; i< M; i++){
        ll tmp = que.top(); que.pop();
        que.push(tmp/2);
    }
    ll res = 0;
    while(!que.empty()){
        res += que.top();
        que.pop();
    }
    cout << res << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


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

int main() {
  int k;
  cin >> k;
  vector<long long> a = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  for (long long i = 0; a.size() < k; i++) {
    for (int j : vector<int>({-1, 0, 1})) {
      int d = a.at(i) % 10 + j;
      if (0 <= d && d <= 9) {
        a.push_back(a.at(i) * 10 + d);
      }
    }
  }
  cout << a.at(k-1) << endl;
}

Measured memory_bytes: 1464
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N / 100 == N % 10) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);i++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);i++)
#define MOD 1000000007
using namespace std;
int main(){
    ll h,ans=0,num=0;
    cin>>h;
    while(h>1){
        h/=2;
        ans+=pow(2,num);
        num++;
    }
    ans+=pow(2,num);
    cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin >> N;
  vector<int> B(N-1);
  for(int i=0; i<N-1; i++){
    cin >> B[i];
  }
  if(N == 2){
    cout << 2*B[0] << endl;
  }
  else{
    vector<int> A(N); A[0] = B[0]; A[N-1] = B[N-2];
    for(int i=1; i<N-1; i++){
      A[i] = min(B[i-1],B[i]);
    }
  int ans=0;
  for(int i=0; i<N; i++){
    ans = ans + A[i];
  }
  cout << ans <<endl;
  }
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if(a < 10 && b < 10)
        cout << a * b << endl;
    else
        cout << -1 << endl;
}


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

int main() {
  int N,M,X,Y;
  cin >> N >> M >> X >> Y;
  vector<int> x(N);
  vector<int> y(M);
  rep(i,N) cin >> x.at(i);
  rep(i,M) cin >> y.at(i);
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  int max_x = x.back();
  int min_y = y.front();
  if(X >= Y) cout << "War" << endl;
  else{
    for(int i = X+1; i <= Y; i++){
      if(max_x < i && min_y >= i){
       cout << "No War" << endl;
       return 0;
      }
    }
    cout << "War" << endl;
  }
  

 }


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//#include "atcoder/all"
//using namespace atcoder;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = s.size();
	s += "!?";
	rep(i,n){
		if(s[i] == s[i+1]){
			cout << i+1 << " " << i+2 << endl;
			return 0;
		}
		if(s[i] == s[i+2]){
			cout << i+1 << " " << i+3 << endl;
			return 0;
		}
	}
	cout << "-1 -1" << endl;
	return 0;
}

Measured memory_bytes: 3668
N = int(input())
s = [int(input()) for _ in range(N)]

tmp = sum(s)
if tmp%10 != 0:
    print(tmp)
else:
    m = [i for i in s if i % 10 != 0]
    if m == []:
        print(0)
    else:
        print(tmp-min(m))

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a[1123];
    cin >> n;
    int mi = MOD, ma = 0;
    rep(i,n){
        cin >> a[i];
        mi = min(mi, a[i]);
        ma = max(ma, a[i]);
    }
    cout << ma - mi << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
void vout(vl V) {
	for (ll i = 0; i < (ll)V.size(); i++) cout << V[i] << " ";
	cout << endl;
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D1, D2; vll path, path2; vl A; vl dp; vl Ans; ll cnt1 = 0, cnt2 = 0;
//***********//
int main() {
	cin >> N;
	vl A(N); for (i = 0; i < N; i++) cin >> A[i];
	sort(A.begin(), A.end());
	if (A[0] + 1 < A[N - 1]) cout << "No";
	else {
		if (A[0] == A[N - 1]) {
			if (A[0] <= N / 2 || A[0] == N - 1) cout << "Yes";
			else cout << "No";
		}
		else {
			ll pre= 0, pre2 = 0;
			for (i = 0; i < N; i++) {
				if (A[i] == A[0]) pre++;
				else pre2++;
			}
			if (A[N - 1] >= pre + 1 && A[N - 1] <= pre + pre2 / 2) cout << "Yes";
			else cout << "No";
		}
	}
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))
dp = [[0]*(2) for _ in range(n+1)]
dp[0][1] = -10**8
for i in range(1,n+1):
    dp[i][0] = max(dp[i-1][0]+a[i-1],dp[i-1][1]-a[i-1])
    dp[i][1] = max(dp[i-1][0]-a[i-1],dp[i-1][1]+a[i-1])
print(dp[-1][0])

Measured memory_bytes: 25644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>

#define sp ' '
#define endl '\n'
#define Endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define FOR(YY, yy) for(int yy = 0; yy < YY; ++yy)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef vector< pair<int, int> > vii;
typedef vector< pair< int, pair<int, int> > > vpip;
typedef pair<int, int> ii;

const int MOD = 1e9 + 7;
const int INF = 2e9;

#define PI 3.14159265358979

int main(int argc, char **argv)
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    double a, b, x;

    cin >> a >> b >> x;
    double v = (a*a*b)-x;
    double result;
    
    if(x < a*a*b/2)
    {
        double n = (2*x)/(a*b);
        double param = n / hypot(n, b);
        result = asin(param)*180.0 / PI;
        result = 90 - result;
    }
    
    else
    {
        double n = (2*v)/(a*a);

        double param = n / (hypot(n, a));

        result = asin(param) * 180.0 / PI;
    }
    
    printf("%.10lf", result);

    return 0;
}

//cikisir



Measured memory_bytes: 256