akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	string s;
	cin >> s;
	bool fl = false;
	if (s[0] == s[1]&&s[2] == s[3]&&s[0] != s[2])fl = true;
	else if (s[0] == s[2]&&s[1] == s[3]&&s[0]!=s[3])fl = true;
	else if (s[0] == s[3]&&s[1] == s[2]&&s[0] != s[1])fl = true;
	if (fl)cout << "Yes";
	else { cout << "No"; }
	ed;
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
abc = [[int(x) for x in input().split()] for _ in range(n)]

dp = [[0] * 3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]

for i in range(1, n):
    a, b, c = abc[i]
    dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a)
    dp[i][1] = max(dp[i - 1][0] + b, dp[i - 1][2] + b)
    dp[i][2] = max(dp[i - 1][0] + c, dp[i - 1][1] + c)

print(max(dp[-1]))

Measured memory_bytes: 70236
import numpy as np

n = int(input())
a_lst = [int(elem) for elem in input().split()]
ans = [0] * n

s = sum(a_lst)
s2 = sum([a_lst[i] for i in range(1, n) if i % 2])
ans[0] = str(s - 2 * s2)

for i in range(1, n):
    ans[i] = str((a_lst[i-1] - int(ans[i-1]) // 2) * 2)
    
print(' '.join(ans))

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;
const ll 	N 		= 	2*1e6;

// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m;
string s,t;
//vll a;
// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> x >> y >> n >> m;
	ll xx = n-x;
	ll yy = m-y;

	for(ll i=0;i<yy;i++) cout<<'U';
	for(ll i=0;i<xx;i++) cout<<'R';
	for(ll i=0;i<yy;i++) cout<<'D';
	for(ll i=0;i<xx;i++) cout<<'L';

	cout<<'L';
	for(ll i=0;i<=yy;i++)cout<<'U';
	for(ll i=0;i<=xx;i++)cout<<'R';
	cout<<'D';
	cout<<'R';
	for(ll i=0;i<=yy;i++)cout<<'D';
	for(ll i=0;i<=xx;i++)cout<<'L';
	cout<<'U';
}

int main() {
	fastio;randomINT;
	//cin>>T;
	while(T--) {
		MAIN();
	}
	return 0;
}



Measured memory_bytes: 3604
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

n = int(input())
mod = 10**9 + 7

primes = []
for i in range(2,n+1): primes += prime(i)

cnt = col.Counter(primes)
ans = 1
for key,val in cnt.items(): ans *= (val + 1) ; ans %= mod
print(ans)


Measured memory_bytes: 3316
use std::env;
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let _ = read::<String>();
    let s: Vec<char> = read::<String>().chars().collect();
    let _ = read::<String>();

    println!("A{}C", s[0]);
}


Measured memory_bytes: 4352
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def ceil(n, m):
    return -(-n//m)


n, k = LI()


print('YES' if ceil(n, 2) >= k else 'NO')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
    // Your code here!
    int N,K;
    cin >> N >> K;
    int i;
    vector<int> p(N);
    for(i=0;i<N;i++){
        cin >> p.at(i);
    }
    
    for(i=0;i<N-1;i++){
        for(int j=0;j<N-1-i;j++){
            if(p.at(j)>p.at(j+1)){
                int tmp=p.at(j);
                p.at(j)=p.at(j+1);
                p.at(j+1)=tmp;
            }
        }
    }
    
    int sum=0;
    // for(i=0;i<N;i++){
    //     cout << p.at(i)<<endl;
    // }
    for(i=0;i<K;i++){
        sum += p.at(i);
    }
        cout << sum<<endl;
}


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

int main ()
{
	int n;
  	cin >> n;
  	int c = 0;
  	vector<int> a(n);
  	for (int i = 0; i < n; i++)
    {
      	cin >> a.at(i);
    }
  	sort(a.begin(), a.end());
  	for (int i = 0; i < n - 1; i++)
    {
    	if (a.at(i) == a.at(i + 1))
        {
        	c++;
          	break;
        }
    }
  	if (c > 0)
    {
    	cout << "NO" << endl;
    }
  	else
    {
    	cout << "YES" << endl;
    }
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(void){


    int a, b;

    scanf("%d %d",&a,&b);


    if(a<b){


        printf("a < b\n");


    }else if(a>b){


        printf("a > b\n");


    }else if(a==b){


        printf("a == b\n");


    }


    return 0;
}

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

long long gcd(long long a, long long b){
	return b?gcd(b,(a%b)):a;
}

long long lcm(long long a, long long b){
	return a / gcd(a, b) * b;
}

int main(){
	int a, m;
	long long count[3];
	while(1){
		bool f = true;
		for(int i = 0;i < 3;i++){
			count[i] = 0;
			cin >> a >> m;
			if(!a && !m){f = false;break;}
			int x = 1;
			while(1){
				x = (a * x) % m;
				count[i]++;
				if(x == 1)break;
			}
		}
		if(f)cout << lcm(lcm(count[0], count[1]), count[2]) << endl;
		if(!f)break;
	}
	return 0;
}

Measured memory_bytes: 3056
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n;
  cin >> n;

  vi t(n);
  int sum = 0;

  rep(i,n)
  {
     cin >> t[i];
     sum += t[i];
  }

  int m;
  cin >> m;
  vi ans(m);

  rep(i,m)
  {
    int p,x;
    cin >> p >> x;
    ans[i] = sum - (t[p - 1] - x);
  }

  rep(i,m)
  {
    cout << ans[i] << endl;
  }




  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	int cost1, cost2;
	cost1 = 800 * N;
	int op=N/15;
	cost2 = 200 * op;
	cout << cost1 - cost2 << endl;
	return 0;

}

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

struct P
{
    int x,y;
    bool operator<(const P &a)const{
              return x>a.x;
    }
};

vector<int> v;
//bitset<4001000> b;
int a,c,i,b,k,n,d,e,m;//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
int l[333350];
int o[333351];
int j[333355];
int dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};


long long x,y,mod=1000000007;
long long z;

P u[10];
stack<int> s,s1;

//set<int> s;
queue<int> q;


//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p[10100];
//list<int> l;

//string r;
char r[335333];
//deque<int> de;
bool as(P a,P b)
{
    return a.x>b.x;
}



int main()
{
    scanf("%d",&a);
    scanf("%s",r+1);
    for(int t=1;t<=a;o[t]+=o[t-1],t++)
    {
        j[t]+=t-1-o[t-1];
        if(r[t]=='E') o[t]++;
    }
    k=a;
    for(int t=a;t>=1;l[t]+=l[t+1],t--)
    {
        j[t]+=a-t-l[t+1];
        if(r[t]=='W') l[t]++;
        k=min(k,j[t]);
    }
    printf("%d",k);
}




Measured memory_bytes: 4224
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    REP(i, 1, 10000) {
        if(A * i % B == C) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;

    return 0;
}


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

int main(){
    int n; cin>>n;
    if(n<=104) cout << 0 << endl;
    else if(n<=134) cout << 1 << endl;
    else if(n<=164) cout << 2 << endl;
    else if(n<=188) cout << 3 << endl;
    else if(n<=194) cout << 4 << endl;
    else cout << 5 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define max(X) *max_element(all(X))
#define min(X) *min_element(all(X))
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  ll N;
  cin >> N;
  if(N == 2){
    ll A,B;
    cin >> A >> B;
    print(A+B);
  }
  else print("Hello World");

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long;
int main(){
  int a,b;
  cin>>a>>b;
  int ans=0;
  for(int i=a;i<=b;i++){
    if(i/10000==i%10&&(i/1000)%10==(i/10)%10)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


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

a.sort(reverse=True)
con_sum = a[0]
j = 0

for i in range(1,n-1):
    if i % 2 == 1:
        j += 1        
        con_sum += a[j]
    else:
        con_sum += a[j]

print(con_sum)


Measured memory_bytes: 31420
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

template <int mod>
struct ModInt {
    int x;

    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if ((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if ((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while (n > 0) {
            if (n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }

    static int get_mod() { return mod; }
};

const int mod = 1e9 + 7;
using mint = ModInt<mod>;

const int N = 200020;

int n;
vector<int> G[N];
int sz[N];

mint ans = 0;

void dfs(int v, int p) {
    sz[v] = 1;
    mint add = mint(2).pow(n - 1) - 1;

    for (int c : G[v])
        if (c != p) {
            dfs(c, v);
            sz[v] += sz[c];

            add -= mint(2).pow(sz[c]) - 1;
        }

    add -= mint(2).pow(n - sz[v]) - 1;

    ans += add;
}

int main() {
    cin >> n;
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        G[a].pb(b);
        G[b].pb(a);
    }
    dfs(0, -1);
    cout << ans / mint(2).pow(n) << "\n";
    return 0;
}


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

p = [0] * (n + 1)
m = [0] * (n + 1)
for i in range(n):
    if a[i] > 0:
        p[i + 1] = p[i] + a[i]
        m[i + 1] = m[i]
    else:
        p[i + 1] = p[i]
        m[i + 1] = m[i] + a[i]

pmin = p[k] - p[0]
mmax = m[k] - m[0]

for i in range(1, n - k + 1):
    pmin = min(pmin, p[i + k] - p[i])
    mmax = max(mmax, m[i + k] - m[i])

ans = p[n] - min(pmin, -mmax)

print(ans)



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

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define ll long long

const int INF = 2e9 + 1;
const ll INFLL = 1e18 + 1;
const int MAXN = 1e5 + 10;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    map<string, int> ma;
    int mx = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        ma[s]++;
        mx = max(mx, ma[s]);
    }
    for (auto &c : ma) {
        if (c.se == mx) cout << c.fi << "\n";
    }
    return 0;
}


Measured memory_bytes: 19244
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){
    int N,pre,current,second_pre;
    bool NO_FLG;

    scanf("%d",&N);
    for(int i=0;i<N;i++){
        pre = -1;
        second_pre = -1;
        NO_FLG = false;
        for(int k = 0; k < 10; k++){
            scanf("%d",&current);
            if(pre > current){
				if(second_pre == -1){
					second_pre = current;
				}else{
					if(second_pre > current){
						NO_FLG = true;
						//break;
					}else{
						second_pre = current;
					}
				}
			}else{
				pre = current;
			}
        }
        if(NO_FLG==false){
        	printf("YES\n");
        }else{
        	printf("NO\n");
        }
    }
    return 0;
}

Measured memory_bytes: 2496
N,M=gets.split.map(&:to_i)
a = Hash.new
M.times do
  a[gets.to_i] = true
end
MOD = 10**9 + 7
dp = Array.new(N+10, 0)
dp[0] = 1
N.times do |i|
  if a[i]
    dp[i] = 0
  else
    dp[i+1] += dp[i] if !a[i+1]
    dp[i+2] += dp[i] if !a[i+2]
  end
end

p dp[N]%MOD



Measured memory_bytes: 856316
import math
def get_theta(H,M):
    M_angle = 6 * M
    H_angle = 30 * H + 0.5 * M
    return (M_angle - H_angle) * math.pi / 180 
def calculate_vector_distance(a,b,theta):
    return math.sqrt(a**2 + b ** 2 - 2*a*b*math.cos(theta))
if __name__ == "__main__":
    A,B,H,M = map(int,input().split())
    print(calculate_vector_distance(A,B,get_theta(H,M)))

Measured memory_bytes: 9372
#include <bits/stdc++.h>
#define MAX_INT 2100000000
#define ex5 (100000+10)
using namespace std;
typedef long long int ll;
#ifdef COMPILE_IN_VCPP
#include <windows.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
	HWND hwndFound;         // This is what is returned to the caller.
	char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated// WindowTitle.
	char pszOldWindowTitle[MY_BUFSIZE]; // Contains original// WindowTitle.
	ULARGE_INTEGER nt;
	nt.QuadPart = GetTickCount64();
	GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
	wsprintf(pszNewWindowTitle, "%d%d/%d", nt.HighPart, nt.LowPart, GetCurrentProcessId());
	SetConsoleTitle(pszNewWindowTitle);
	Sleep(40);
	hwndFound = FindWindow(NULL, pszNewWindowTitle);
	SetConsoleTitle(pszOldWindowTitle);
	return(hwndFound);
}
#endif
int main()
{
#ifdef COMPILE_IN_VCPP
	SetWindowPos(GetConsoleHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
		(SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW));
#endif
	int n, x, l[110], i, j, k, rui[110], ans = 0;
	cin >> n >> x;
	rui[0] = 0, l[0] = 0;
	for (i = 1; i <= n; i++)
	{
		cin >> l[i];
		rui[i] = rui[i - 1] + l[i - 1];
		if (rui[i] <= x) ans++;
	}
	if (rui[n] + l[n] <= x) ans++;
	cout << ans << endl;
}

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

int main() {
  int n; cin >> n;
  map<int, int> a;
  int tmp;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    a.insert(make_pair(tmp, i+1));
  }

  for( auto i = a.begin(); i != a.end() ; ++i ) {
      cout << i->second << " ";
  }
  cout << endl;
}

Measured memory_bytes: 5504
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);
    
    string S;
    cin >> S;
    for(int i=0; i<S.size(); i+=2) cout << S[i];
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 576
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long n,m,k;
    cin >> n >> m >> k;
    vector<int> a(n);
    vector<int> b(m);
    vector<long long> suma(n+1,0);
    vector<long long> sumb(m+1,0);
    
    for(int i=0;i<n;i++){
        cin >> a.at(i);
        suma.at(i+1)=suma.at(i)+a.at(i);
    }
    for(int i=0;i<m;i++){
        cin >> b.at(i);
        sumb.at(i+1)=sumb.at(i)+b.at(i);
    }
    
    int j=m,ans=0;
    for(int i=0;i<=n;i++){
        if(suma.at(i)>k){
            break;
        }
        while(sumb.at(j)>k-suma.at(i)){
            j--;
        }
        ans=max(ans,i+j);
        
        
    }
    
    
    cout << ans <<endl;
    
}


Measured memory_bytes: 7952
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task1 solver = new Task1();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task1 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int[][] A = new int[2][N];
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < N; j++) {
                    A[i][j] = in.nextInt();
                }
            }

            int[][] dp = new int[2][N];

            dp[0][0] = A[0][0];
            dp[1][0] = A[0][0] + A[1][0];

            for (int j = 1; j < N; j++) {
                dp[0][j] = A[0][j] + dp[0][j - 1];
                dp[1][j] = A[1][j] + Math.max(dp[0][j], dp[1][j - 1]);
            }

            out.println(dp[1][N - 1]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
N, M = map(int, input().split())
X = list(map(int, input().split()))


if M <= N:
    print(0)
    exit()

X.sort()

Y = [X[i + 1] - X[i] for i in range(M - 1)]

Y.sort()

ans = 0

for i in range(M - N):
    ans += Y[i]

print(ans)

Measured memory_bytes: 13968
package main

import "fmt"

func main() {
	var a [3]int

	fmt.Scan(&a[0], &a[1], &a[2])

	five := 0
	seven := 0

	for i := 0; i < 3; i++ {
		if a[i] == 5 {
			five++
		}
		if a[i] == 7 {
			seven++
		}

	}

	if five == 2 && seven == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


Measured memory_bytes: 512
L, R  = map(int, input().split())

X = [x % 2019 for x in range(L, min(L+2019+1, R+1))]

ans = 2019
for i, x_i in enumerate(X):
    for j, x_j in enumerate(X[i+1:]):
        ans = min(ans, x_i*x_j % 2019)
print(ans)

Measured memory_bytes: 40684
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A =0;
		int nextA =0;
		for(int i=0; i<M ;i++) {
			nextA=sc.nextInt();
			A += nextA;
		}
        int r = N-A;
        if(r<0) {
        	System.out.println(-1);
        }
        else {
        	System.out.println(r);
        }

	}

}


Measured memory_bytes: 46592
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs(a - b) < EPS)

class Point{
public:
  double x, y;

  Point(double x = 0, double y = 0) : x(x), y(y) {}

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

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

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

};

typedef Point Vector;

class Segment{
public:
  Point p1, p2;
  Segment(Point p1, Point p2): p1(p1), p2(p2){}
};

typedef Segment Line;

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

typedef vector<Point> Polygon;

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

Point reflect(Point p0, Point p1, Point p2){
  Vector v01 = Vector(p0.x - p1.x, p0.y - p1.y);
  Vector v21 = Vector(p2.x - p1.x, p2.y - p1.y);
  double t = -1 * ((p2.x - p1.x) * (p1.x - p0.x) + (p2.y - p1.y) * (p1.y - p0.y)) / (pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2));
  return (v21 * t - v01) * 2 + p0;
}

void solve(){
  double x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
  Point p1 = Point(x1, y1), p2 = Point(x2, y2);
  int q; cin >> q;
  vector<Point> ans(q);
  for(int i = 0; i < q; i++){
    double x0, y0; cin >> x0 >> y0;
    Point p0 = Point(x0, y0);
    ans[i] = reflect(p0, p1, p2);
  }
  for(int i = 0; i < q; i++){
    cout << fixed << setprecision(10) << ans[i].x << " " << ans[i].y << endl;
  }
  return;
}

int main(){
  solve();
  return 0;
}



Measured memory_bytes: 3272
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	n := len(s)

	s1 := string(([]rune(s))[0 : (n-1)/2])
	s2 := string(([]rune(s))[(n+1)/2 : n])

	var msg string
	if isPalindrome(s) && isPalindrome(s1) && isPalindrome(s2) {
		msg = "Yes"
	} else {
		msg = "No"
	}

	fmt.Print(msg)
}

func isPalindrome(s string) bool {
	i := 0
	j := len(s) - 1
	for i < j {
		if s[i] != s[j] {
			return false
		}
		i++
		j--
	}
	return true
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))  # モンスター
B = list(map(int, input().split()))  # 勇者

ans = 0

for i in range(N):
    if A[i] < B[i]:
        if B[i] - A[i] > A[i + 1]:
            ans += A[i] + A[i + 1]
            A[i + 1] = 0
        else:
            ans += B[i]
            A[i + 1] -= B[i] - A[i]
    else:
        ans += B[i]

print(ans)


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

int main()
{
  string S;
  cin>>S;
  string ans="";
  for (int i=0;i<S.length();i++){
    if (S[i]=='0')
      ans+='0';
    else if (S[i]=='1')
      ans+='1';
    else if (ans.size()>0)
      ans.pop_back();
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
N, W = map(int,input().split())
l = []
dp = [0]*(W+1)
for _ in range(N):
    v,w = map(int,input().split())
    for i in range(W,w-1,-1):
        dp[i] = max(dp[i],dp[i-w]+v)
print(dp[W])



Measured memory_bytes: 5920
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, X;
    cin >> N >> X;
    int a = 0, b, ans = 0;
    for(int i = 0; i < N; i++){
        cin >> b;
        a += b;
        if(a <= X){
            ans++;
        }
    }
    ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
INPUT = sys.stdin.readline

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

N = SINGLE_INT()

print(180 * (N-2))

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>//////////////////////////////////////////
#define deb(...)/////////////////////////////////////////////////
#define DBP(...)/////////////////////////////////////////////////
#ifdef LOC///////////////////////////////////////////////////////
#include"debuglib.h"/////////////////////////////////////////////
#endif///////////////////////////////////////////////////////////
#define x first//////////////////////////////////////////////////
#define y second/////////////////////////////////////////////////
#define pb push_back/////////////////////////////////////////////
#define sz(x)int((x).size())/////////////////////////////////////
#define each(a,x)for(auto&a:(x))/////////////////////////////////
#define all(x)(x).begin(),(x).end()//////////////////////////////
#define rep(i,b,e)for(int i=(b);i<(e);i++)///////////////////////
using namespace std;using ll=long long;using Pii=pair<int,int>;//
using Vi=vector<int>;void run();int main(){cin.sync_with_stdio///
(0);cin.tie(0);cout<<fixed<<setprecision(18);run();return 0;}////
//-------------------------------------------------------------//

vector<Vi> G;
Vi seen, out;
vector<Pii> ans;

void dfs(int v, int p) {
	seen[v] = 1;

	each(e, G[v]) if (e != p) {
		if (seen[e] == 1) {
			ans.pb({v, e});
			out[v]++;
		} else if (seen[e] == 0) {
			dfs(e, v);
		}
	}

	if (out[v] % 2) {
		if (p == -1) {
			cout << -1 << endl;
			exit(0);
		}

		ans.pb({v, p});
		out[v]++;
	} else if (p != -1) {
		ans.pb({p, v});
		out[p]++;
	}

	seen[v] = 2;
}

void run() {
	int n, m; cin >> n >> m;
	G.resize(n);

	rep(i, 0, m) {
		int a, b; cin >> a >> b;
		G[a-1].pb(b-1);
		G[b-1].pb(a-1);
	}

	seen.resize(n);
	out.resize(n);
	dfs(0, -1);

	each(e, ans) cout << e.x+1 << ' ' << e.y+1 << '\n';
}


Measured memory_bytes: 16372
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        long n=sc.nextLong();
       
  		long ans=0;
  
  		long[] a=new long[5];
		for(int c=0;c<5;c++){
    		a[c]=sc.nextLong();
    	}
  		Arrays.sort(a);
  if(n>a[0]){
    if(n%a[0]==0){
    	ans=n/a[0]+4;
    }else{
    ans=n/a[0]+5;
    }
  }else{
  ans=5;
  }

    	System.out.println(ans);
    }
}


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

using namespace std;

int A, B, C, X, ans;
bool chk[55][55][55];

void f(int a, int b, int c) {
	if (chk[a][b][c]) return;
	if (a > A || b > B || c > C) return;

	if (500 * a + 100 * b + 50 * c > X) {
		chk[a][b][c] = true;
		return;
	}

	chk[a][b][c] = true;
	if (500 * a + 100 * b + 50 * c == X)
		ans++;

	f(a + 1, b, c);
	f(a, b + 1, c);
	f(a, b, c + 1);
}

int main() {
	cin >> A >> B >> C >> X;

	f(0, 0, 0);

	cout << ans << endl;
}

Measured memory_bytes: 384
/*
01背包变形
dp[v]表示获得价值为v的物品所需要的最小容量
dp[v] = min(dp[v - val[i]] + weg[i])
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
const int inf = 0x3f3f3f3f;
int n, Weg, sum = 0;
ll weg[MAXN], dp[MAXN];
int val[MAXN];
int main()
{
    cin >> n >> Weg;
    memset(dp, inf, sizeof(dp));
    for (int i = 1; i <= n; i++)
    {
        cin >> weg[i] >> val[i];
        sum += val[i];
    }
    dp[0] = 0;
    for (int j = 1; j <= n; j++)
    {
        for (int i = sum; i >= 0; i--)
        {
            dp[i] = min(dp[i], dp[i - val[j]] + weg[j]);
        }
    }
    for (int i = sum; i >= 0; i--)
        if (Weg >= dp[i])
        {
            cout << i;
            break;
        }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sc(x) scanf("%lld",&(x));
#define pb push_back
#define fi first
#define se second
#define P pair<int,int>
#define endl '\n'
int n;
vector<int>G[200005];

int a=0,b=0;
int d[200005];
void dfs(int x,int y,int fa)
{
    if(y==1)
    {
        d[x]=0,a++;
    }
    else d[x]=1,b++;
    for(int i=0; i<G[x].size(); i++)
    {
        if(G[x][i]!=fa)
            dfs(G[x][i],y^1,x);
    }
}
int ans[200005];
signed main()
{
    sc(n)
    int x,y;
    for(int i=0; i<n-1; i++)
    {
        sc(x)sc(y)
        G[x].pb(y);
        G[y].pb(x);
        //2*n-2
    }

    dfs(1,1,-1);
    if(b <= n/3){
        a = b;
        for(int i=1;i<=n;i++)d[i]^=1;
    }
    if(a <= n/3)
    {
        int o = 0, p = 0, q = 0;
        for(int i=1; i<=n; i++)
        {
            if(d[i]==0)
            {
                ans[i]=o*3+3;
                o++;
            }
            else
            {
                if(p*3+1<=n)
                {
                    ans[i]=p*3+1;
                    p++;
                }
                else if(q*3+2<=n)
                {
                    ans[i]=q*3+2;
                    q++;
                }
                else if(o*3+3<=n)
                {
                    ans[i]=o*3+3;
                    o++;
                }
            }
        }
        for(int i=1;i<=n;i++){
            cout<<ans[i]<<' ';
        }
        return 0;
    }

    int k=0,o=0,q=0;
    for(int i=1; i<=n; i++)
    {
        if(d[i]==1)
        {
            if(k*3+1>n)
            {
                if(q*3+3>n)
                {
                    continue;

                }
                ans[i]=q*3+3;
                q++;
                continue;
            }
            ans[i]=k*3+1;

            k++;
        }
        else
        {
            if(o*3+2>n)
            {
                if(q*3+3>n)
                {
                    continue;
                }
                ans[i]=q*3+3;
                q++;
                continue;
            }
            ans[i]=o*3+2;
            o++;
        }
    }
    for(int i=1; i<=n; i++)
    {
        if(ans[i]==0&&k*3+1<=n)
        {
            ans[i]=k*3+1;
            k++;
        }
        if(ans[i]==0&&o*3+2<=n)
        {
            ans[i]=o*3+2;
            o++;
        }
    }
    for(int i=1; i<=n; i++)cout<<ans[i]<<' ';

}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  VVI a(h, VI(w)), b(h, VI(w));
  rep(i, h) rep(j, w) cin >> a[i][j];
  rep(i, h) rep(j, w) cin >> b[i][j];
  int n = (h + w + 1) * 81;
  vector<vector<vector<bool>>> dp(h, vector<vector<bool>>(w, vector<bool>(n, false)));
  dp[0][0][abs(a[0][0] - b[0][0])] = true;
  rep(i, h) rep(j, w) rep(k, n) {
    if(i + 1 < h && dp[i][j][k]) {
      dp[i + 1][j][k + abs(a[i + 1][j] - b[i + 1][j])] = true;
      dp[i + 1][j][abs(k - abs(a[i + 1][j] - b[i + 1][j]))] = true;
    }
    if(j + 1 < w && dp[i][j][k]) {
      dp[i][j + 1][k + abs(a[i][j + 1] - b[i][j + 1])] = true;
      dp[i][j + 1][abs(k - abs(a[i][j + 1] - b[i][j + 1]))] = true;
    }
  }
  rep(k, n) {
    if(dp[h-1][w-1][k]) {
      out(k);
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <assert.h>
#include <queue>
#include <string.h>
#include <string>
#include <set>
#include <memory.h>
#include <functional>
#include <bitset>
using namespace std;
#define ll long long

const int N = 3e5+15;

int ret[N];
void solve() {
    int n,inc,dec;
    cin>>n>>inc>>dec;
    if(inc+dec-1>n || (ll)inc*dec<n) {
        printf("-1\n");
        return;
    }
    bool isSwaped = false;
    if(inc<=dec) {
        isSwaped = true;
        swap(inc,dec);
    }
    
    bool canMake = false;
    if(dec==1) {
        if(inc!=n) {
            printf("-1\n");
            return;
        }
        canMake = true;
        for(int i=0;i<n;++i) {
            ret[i] = i+1;
        }
    } else {
        int pos = 0;
        for(int i=0;i<dec;++i) {
            ret[i] = dec - i;
        }
        int rem = inc-1 + dec;
        rem = n - rem;
        pos = dec;
        if(rem==0) {
            canMake = true;
            for(int i = dec;i<n;++i) {
                ret[i] = i+1;
            }
        } else {
            rem += inc-1;
            pos = dec;
            int r = n;
            while(true) {
                int l = r - (inc-1) + 1;
                bool isEnd = false;
                if(l<=dec) {
                    isEnd = true;
                }
                l = max(l,dec+1);
                
                for(int i=l;i<=r;++i) {
                    ret[pos++] = i;
                }
                r = l-1;
                if(isEnd) {
                    break;
                }
            }
            canMake = true;
        }
    }
    if(isSwaped) {
        for(int i=0;i<n;++i) {
            ret[i] = n - ret[i] + 1;
        }
    }
    for(int i=0;i<n;++i) {
        printf("%d ",ret[i]);
    }
    cout<<endl;
}

int main() {
    //freopen("/Users/gotop/Documents/ps_practice/ps_practice/input.txt", "r", stdin);
    solve();
}


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

int main() {
    long int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    s[k-1]=(int)s[k-1]+('a'-'A');
    cout<<s<<endl;
    
	return 0;
}

Measured memory_bytes: 256
N,M = gets.split.map(&:to_i)
H = gets.split.map(&:to_i)
neigh = Array.new(N,0)
AB = []
M.times {
  a,b = gets.split.map(&:to_i)
  a -= 1
  b -= 1
  if neigh[a] < H[b]
    neigh[a] = H[b]
  end
  if neigh[b] < H[a]
    neigh[b] = H[a]
  end  
}

#p neigh
cnt = 0
N.times { |i|
  if H[i] > neigh[i]
    cnt += 1
  end
}

puts cnt


Measured memory_bytes: 22368
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int L, R;
	cin >> L >> R;

	int ans = INF;
	VI A;
	eFOR(i, L, min(L + 5000,R)) {
		A.push_back(i % 2019);
	}
	int AS = A.size();
	eREP(i, min(AS, 2030LL)) {
		FOR(j, i + 1, min(AS, 2030LL)) {
			ans = min(ans, (A[i] * A[j]) % 2019);
		}
	}

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



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
int a,b;
inline ll digit(ll nu)
{
    ll res=0,num=nu;
    while(num!=0)
    {
        res++;
        num/=10;
    }
    return res;
}
int main()
{
    cin>>a>>b;
    (int)(sqrt((int)(a*pow(10.0,digit(b))+b)))==sqrt((int)(a*pow(10.0,digit(b))+b))?cout<<"Yes"<<endl:cout<<"No"<<endl;
}

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

int main()
{
   long long int n, i, ans, mx=0, a, b;

   cin>>n;

   for(i=0; i<n; i++){
    cin>>a>>b;
    if(a>mx) { ans=a+b; mx = a; }
   }

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








Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define rrep(i,l,r) for(int i=(r-1);i>=(l);i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define range(i) i.begin(),i.end()
#define Yes(i) out(i?"Yes":"No");return 0
struct aaa{aaa(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(10);};}aaaaaaa;
inline void in() {}
template <class Head, class... Tail>
inline void in(Head&& head,Tail&&... tail){
    cin>>head;
    in(move(tail)...);
}
template <class T>
inline void out(T t) {
    cout<<t<<'\n';
}
template <class Head, class... Tail>
inline void out(Head head,Tail... tail){
    cout<<head<<' ';
    out(move(tail)...);
}

int main(){
    int a;
    in(a);
    int cnt=1;
    vector<bool> ans;
    while(a){
        ans.push_back(a&1);
        if(a&1)a-=cnt;
        cnt=-cnt;
        a/=2;
    }
    if(ans.empty()){
        out(0);
        return 0;
    }
    rrep(i,0,ans.size())cout<<ans[i];
}








Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        int[][] matrix = new int[h][w];
        for(int i = 0; i < n; i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            int a = sc.nextInt();
            switch (a){
                case 1:
                    for (int j = 0; j <= x - 1; j++) {
                        for (int k = 0; k < h; k++) {
                            matrix[k][j] = 1;
                        }
                    }
                    break;
                case 2:
                    for(int j = x; j < w; j++){
                        for (int k = 0; k < h; k++) {
                            matrix[k][j] = 1;
                        }
                    }
                    break;
                case 3:
                    for (int j = 0; j < w; j++) {
                        for (int k = 0; k <= y - 1; k++) {
                            matrix[k][j] = 1;
                        }
                    }
                    break;
                case 4:
                    for (int j = 0; j < w; j++) {
                        for (int k = y; k < h; k++) {
                            matrix[k][j] = 1;
                        }
                    }
                    break;
                default:
                    break;
            }
        }
        int area = 0;
        for (int j = 0; j < h; j++) {
            for (int k = 0; k < w; k++) {
                if(matrix[j][k] == 0)
                    area += 1;
            }
        }
        System.out.println(area);
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#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 rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,k,ans = 0,tmp;
    cin>>n>>m>>k;
    vector<ll>a(n + 1,0),b(m + 1,0);
    rep(i,n){
        cin>>tmp;
        a[i + 1] = a[i] + tmp; 
    }
    rep(i,m){
        cin>>tmp;
        b[i + 1] = b[i] + tmp;
    }
    rep(i,n + 1){
        if(k < a[i])continue;
        ll key = k - a[i];
        auto itr = upper_bound(all(b),key);
        ll place = itr - b.begin() - 1;
        ans = max(ans,place + i);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6372
N=int(input())
A=[int(input()) for i in range(N)]


MAX=[-1]

for n in A:
    MAX.append(max(n,MAX[-1]))

MAXINV=[-1]

for n in A[::-1]:
    MAXINV.append(max(n,MAXINV[-1]))

MAXINV=[-1]+MAXINV[::-1]


for i in range(1,N+1):
    print(max(MAX[i-1],MAXINV[i+1]))


Measured memory_bytes: 17168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll Q,a,b;
bool check(ll c)
{
	//f[x]=-x^2+(a+c+1)*x 
	ll A=-1,B=(a+c+1);
	ll po=-B/(2ll*A);
	//cout<<po<<'\n';
	for(ll i=max(1ll,po-500);i<=min(c,po+500);i++)
	{
		if(i*(a+c-i+1)>=a*b)
			return false;
	}
	return true;
}

int main()
{	
	cin>>Q;
	while(Q--)
	{
		cin>>a>>b;
		if(a>b)
			swap(a,b);
		ll l=1,r=b,p;
		while(l<=r)
		{
			ll mid=l+r>>1;
			if(check(mid))
				l=mid+1,p=mid;
			else
				r=mid-1;
		}
		ll res=a-1+p;	
		cout<<res<<'\n';
	}	
	return 0;
}

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

int main() {
	int n, r[200010],max = -2e9,rmin = 2e9;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> r[i];
	}


	for (int i = 0; i < n; i++) {
		if (r[i] < rmin) {
			rmin = r[i];
			for (int j = i + 1; j < n; j++) {
				if (r[j] - r[i] > max) max = r[j] - r[i];
			}
		}
	}

	cout << max << endl;
	return 0;
}

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

int main(){

    int a,b;

    cin >> a >> b;

    if(a < b){
        cout << "a < b" << endl;
    }

    if(a > b){
        cout << "a > b" << endl;
    }
    if(a == b){
        cout << "a == b" << endl;
    }

    return 0;
}



Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
using namespace std;

int main(void){
	string s;
	cin >> s;
	if (s.size() == 3) {
		cout << s[2] << s[1] << s[0];
	}
	else {
		cout << s;
	}
	return 0;
}

Measured memory_bytes: 256