akhauriyash/Code-Regression huggingface dataset:
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
ll gcd(ll x, ll y){
  if(x > y)return gcd(y, x);
  if(x == 0)return y;
  return gcd(y % x, x);
}

int main(int argc, char const* argv[])
{
  int t;
  cin >> t;
  rep(i, t){
    ll a[4];
    rep(j, 4)cin >> a[j];
    if(a[0] < a[1]){
      cout << "No" << endl;
    }else if(a[1] > a[3]){
      cout << "No" << endl;
    }else if(a[2] >= a[1]){
      cout << "Yes" << endl;
    }else{
      ll g = gcd(a[1], a[3]);
      if(a[2] < a[1] - g + (a[0] % g))cout << "No" << endl;
      else cout << "Yes" << endl;
    }
  }
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
vector<int> divisor(int a){
  vector<int> res;
  for(int i=1;i*i<=a;i++){
    if(a%i==0){
      res.push_back(i);
      if(i!=a/i) res.push_back(a/i);
    }
  }
  return res;
}

int main()
{
  int n;cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> b;
  vector<int> c(n+1,0);
  for(int i=n;i>=1;--i){
    if(a[i-1]!=c[i]){
      b.push_back(i);
      vector<int> div = divisor(i);
      rep(j,div.size()){
	c[div[j]] = (c[div[j]]+1)%2;
      }
    }
  }
  cout << (int)b.size() << "\n";
  rep(i,b.size()) cout << b[i] << " ";
  if(b.size()!=0) cout  << "\n";
  return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N; cin >> N; 
	int R = N % 10; 
	if(R == 2 || R == 4 || R == 5 || R == 7 || R == 9) cout << "hon" << "\n"; 
	else if(R == 0 || R == 1 || R == 6 || R == 8) cout << "pon" << "\n"; 
	else cout << "bon" << "\n";  
}

Measured memory_bytes: 3652
#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>;

// main
int main(){
    int N; cin >> N;
    float T, A; cin >> T >> A;
    vector<float> H(N); rep(i, N) cin >> H[i];

    int idx = 0;
    float diff_temp = abs(A - (T - H[0] * 0.006));

    rep(i, N){
        float diff_temp_i = abs(A - (T - H[i] * 0.006));
        if(diff_temp > diff_temp_i){
            idx = i;
            diff_temp = diff_temp_i;
        }
    }

    cout << idx+1 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
typedef long long lint;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
  int N;
  double X[20];
  string U[20];
  cin >> N;
  rep(i,N){
    cin >> X[i] >> U[i];
  }

  double sum = 0;
  
  rep(i,N){
    if(U[i]=="JPY") sum += X[i];
    else sum += X[i] * 380000.0;
  }

  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
a = [i for i in map(int,input().split())]
b = [i for i in map(int,input().split())]
#print(alist)
#print(blist)
ene = 0
for i in range(N):
  if a[i]+a[i+1] >= b[i]:
    ene += b[i]
    if a[i] - b[i] <0:
	    a[i+1] = a[i]+a[i+1]-b[i]
  else:
    ene += a[i]+a[i+1]
    a[i+1] = 0
  #print(ene)
print(ene)
 

Measured memory_bytes: 19648
#include<bits/stdc++.h>
using namespace std ; 
# define pb push_back
# define ll long long 
# define endl "\n"
const int MOD = 998244353; 

ll power(ll a , ll n)
{
	ll res = 1;
	
	while(n)
	{
		if(n & 1)
			res = (res * a) % MOD;
		
		n >>= 1;
		a = (a * a) % MOD;
	}
	
	return res;
}



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

	int n ; 
	cin >> n ; 
	vector<int> f(n+1) ; 
	for(int i = 1 ; i < n  ; ++i) {
		bool ok = true ; 
		for(int j = 1 ; j < n ; ++j) {
			for(int k = 1 ; k < n ; ++k) {
				if(i*i + j*j + k*k + i*j + j*k + k*i <= n )
					f[i*i + j*j + k*k + i*j + j*k + k*i]++;
				else {
					ok = false ; 
					break ; 
				}
			}
			if(i*i + j*j + 1*1 + i*j + j*1 + 1*i > n )
				break ; 

		}
	}
	for(int i = 1 ; i <= n ; ++i) {
		cout << f[i] << endl ;
	}
   	return 0 ; 
}



Measured memory_bytes: 3604
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use proconio::input;
use proconio::marker::*;
use itertools::Itertools;
use num::integer::Integer;

fn main() {
    input! {
        x: usize,
    }
    println!("{}", 360 / x.gcd(&360));
}


Measured memory_bytes: 2128
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    if((abs(a-b))%2 == 1) printf("Borys\n");
    else printf("Alice\n");
}


Measured memory_bytes: 256
//AtCoder ABC088 C - Takahashi's Information
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    ll ctbl[3][3];
    ll ttl=0;
    for(ll y=0;y<3;++y){
        for(ll x=0;x<3;++x){
            ll c;
            cin>>c;
            ctbl[y][x]=c;
            ttl+=c;
        }
    }
    ll xt[3]={};
    ll yt[3]={};
    for(int i=0;i<3;++i){
        for(int j=0;j<3;++j){
            yt[i]+=ctbl[i][j];
            xt[i]+=ctbl[j][i];
        }
    }
    bool ans=(ttl%3==0);
    ans &= ((yt[0]-yt[1])%3==0);
    ans &= ((yt[0]-yt[2])%3==0);
    ans &= ((yt[1]-yt[2])%3==0);
    ans &= ((xt[0]-xt[1])%3==0);
    ans &= ((xt[0]-xt[2])%3==0);
    ans &= ((xt[1]-xt[2])%3==0);
    cout<<(ans?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<setprecision(10)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	io_init;
	int H, N;
	cin >> H >> N;
	vector<pair<int, int>> m(N);
	for (int i = 0; i < N; i++)cin >> m[i].first >> m[i].second;
	vector<ll> dp(H + 1, INF);
	dp[H] = 0;
	for (int i = H; i >= 0; i--) {
		for (int j = 0; j < N; j++) {
			dp[max(0, i - m[j].first)] = min(dp[max(0, i - m[j].first)], dp[i] + m[j].second);
		}
	}
	cout << dp[0] << endl;
}


Measured memory_bytes: 384
N=int(input())

a = list(map(int,input().split()))
b = list(map(int,input().split()))

s=sum(b)-sum(a)

if s<0:
    print("No")
else:
    A = 2*s
    B = s
    for i in range(N):
        if a[i]-b[i]<0:
            if (a[i]-b[i])%2==0:
                A+=a[i]-b[i]
            else:
                A+=a[i]-b[i]-1
                B-=1
        else:
            B-=a[i]-b[i]
        #print(A,B)
    if A<0 or B<0:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 4596
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
S = list(input().rstrip())

S.sort()
print("Yes" if S[0]==S[1] and S[2]==S[3] and S[0]!=S[-1] else "No")

Measured memory_bytes: 2940
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

signed main(){
	for(int i:{1,2,3}) putchar(getchar());
}

Measured memory_bytes: 3620
void main()
{
    long n, m;
    rdVals(n, m);

    bool[][] path = new bool[][](n, n);
    foreach (i; 0 .. m)
    {
        long a, b;
        rdVals(a, b);
        --a, --b;
        path[a][b] = path[b][a] = true;
    }

    long[] root = 1.iota(n).array;
    long cnt;
    foreach (x; root.permutations)
    {
        long from, to;
        bool ok = true;
        foreach (i; 0 .. n-1)
        {
            to = x[i];
            ok &= path[from][to];
            from = to;
        }
        if (ok) ++cnt;
    }

    cnt.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

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

    let s = s.replace("BC", "D");
    let s: Vec<char> = s.chars().collect();

    let mut a_cnt = 0u64;
    let mut ans = 0u64;
    for i in 0..s.len() {
        if s[i] == 'A' {
            a_cnt += 1;
        } else if s[i] == 'D' {
            ans += a_cnt;
        } else {
            a_cnt = 0;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    if(a<=8&&b<=8){
    	cout << "Yay!" << endl;
    }
    else{
    	cout << ":(" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
bool wat[100005], sug[100005]; 
int main()
{
	// freopen("ARC083-C.in", "r", stdin); 
	int a, b, c, d, e, f; 
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f); 
	wat[0] = sug[0] = true; 
	for (int i = 0; i <= f; i++)
	{
		if (wat[i])
			wat[i + 100 * a] = wat[i + 100 * b] = true; 
		if (sug[i])
			sug[i + c] = sug[i + d] = true; 
	}
	int m_wat = 100 * a, m_sug = 0; 
	for (int i = 100; i <= f; i++)
	{
		if (!wat[i])
			continue; 
		for (int j = 0; j <= std::min(i / 100 * e, f - i); j++)
		{
			if (sug[j] && m_sug * i < m_wat * j)
			{
				m_wat = i; 
				m_sug = j; 
			}
		}
	}
	printf("%d %d\n", m_wat + m_sug, m_sug);
	return 0; 
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int n,q;
    cin >> n >> q;
    long long a[n];
    long long tem = 0;
    rep(i,n){
        cin >> a[i];
    }
    sort(a,a+n,greater<long long>());
    vector<long long> border;
    map<long long,long long> mp,mp2;
    border.push_back(a[0]);
    for(int i = 0;i<n;i+=2){
        tem+=a[i];
    }
    mp[a[0]]=tem;
    mp2[a[0]]=0;
    for(int i = 2;i<n;i+=2){
        border.push_back((a[i]+a[i-(i/2)])/2);
        mp[(a[i]+a[i-(i/2)])/2]=mp[border[(i/2)-1]]-a[i-2];
        mp2[(a[i]+a[i-(i/2)])/2]=i/2;
    }
    /*rep(i,border.size()){
        cout << "border: " <<  border[i] << " mp: " << mp[border[i]]  << " mp2: " << mp2[border[i]] << endl;
    }*/
    mp[0]=0;
    mp2[0]=(n+1)/2;
    border.push_back(0);
    long long tsum[n+1];
    tsum[0]=0;
    rep(i,n){
        tsum[i+1]=tsum[i]+a[i];
    }
    vector<long long> ans;
    long long x;
    sort(border.begin(),border.end());
    rep(i,q){
        cin >> x;
        auto itr = lower_bound(border.begin(),border.end(),x);
        itr--;
        ans.push_back(mp[*itr]+tsum[mp2[*itr]]);
    }
    rep(i,q){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 12148
#include<bits/stdc++.h>
using namespace std;
int main()
{
	 // #ifndef ONLINE_JUDGE
  //   freopen("input.txt", "r", stdin);
  //   freopen("output.txt", "w", stdout);
  //   #endif 
  long long int n,ww;
  cin>>n>>ww;
  long long int v[n],w[n];
  long long int i,j;
  for(i=0;i<n;i++)
    cin>>w[i]>>v[i];
  long long int dp[n+1][ww+1];
  for(i=0;i<=n;i++)
  {
	for(j=0;j<=ww;j++)
    {	
      if(i==0 || j==0)
        dp[i][j]=0;
      else if(w[i-1]<=j)
        dp[i][j]=max(dp[i-1][j],v[i-1]+dp[i-1][j-w[i-1]]);
      else
       	dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[n][ww];
}

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

const int maxN = 100015;
int f[maxN];//f[i]表示跳到第只石头上需要的最小能量
int n;
int arr[maxN];

int main(){
	cin >> n;
	for(int i = 1;i<=n;i++){	
		cin >> arr[i];
	} 
	
	f[0] = 0, f[1] = 0;//起初在第一只石头上 
	f[2] = abs(arr[1]-arr[2]);//	
	for(int i = 3;i <=n;i++){
		f[i] = min(f[i-1]+abs(arr[i-1] - arr[i]), f[i-2]+abs( arr[i-2]- arr[i]));
	}
	cout << f[n]<<"\n";
} 
/*

*/
 

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

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

  for (int i = 1; i <= N; i++) {
    int x = i;
    if (x % 3 == 0) {
      cout << " " << i;
    }

    else do {
      if (x % 10 == 3) {
         cout << " " << i;
         break;
      }
    } while (x /= 10);
  }
  cout << endl;
}



Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
 long long sum=0;
  		char s;
 while(cin >> s){ 
 sum += (int)(s- '0');
	}
if(sum%9==0)
{
  cout << "Yes" << endl;
}
else
{
   cout << "No" << endl;
}
}

Measured memory_bytes: 3048
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/priority_queue.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
// template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
// template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
// template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
// template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define MOD 1000000007LL
//#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[&](auto f,auto... args){return f(f,args...);};

int main(){
    lint n;
    cin>>n;
    if(n==7||n==5||n==3){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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; }


int main(){

    int K; cin >> K;
    vel A(K); rep(i,K) cin >> A[i];
    if(A[K-1] != 2) { cout << -1 << endl; return 0; }

    vel mi(K+1), ma(K+1);
    mi[K] = ma[K] = 2;

    for(int i = K; i >= 1; i--) {
        mi[i - 1] = ceil( (double) mi[i] / A[i-1] ) * A[i-1];
        ma[i - 1] = ma[i] / A[i-1] * A[i-1] + A[i-1] - 1;
        if(mi[i-1] > ma[i-1]) { cout << -1 << endl; return 0; }
    }
    cout << mi[0] << endl;
    cout << ma[0] << endl;

}

Measured memory_bytes: 2688
#include<iostream>
#include <bits/stdc++.h>
#include<cmath>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int array[n];
    for(int x=0; x<n; x++)
    cin>>array[x];
  sort (array, array+n);
   int sum=0;
   for(int y=0; y<k; y++)
   sum+=array[y];
   cout<<sum;
}

Measured memory_bytes: 3640
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import heapq as hp

# import heapq
# import sys
#
# h = []
#
# for com in sys.stdin.readlines():
#     if com[0] == "i":
#         heapq.heappush(h, -int(com[7:]))
#     elif com[1] == "x":
#         print(-heapq.heappop(h))

if __name__ == '__main__':
    _input = sys.stdin.readlines()
    # command_list = list(map(lambda x: x.split(), _input))

    allowed_commands = ('insert', 'extract', 'end')
    heap_array = []
    for each in _input:
        # command, content = each[0], each[-1]
        # if command not in allowed_commands:
        #     raise SystemExit('Illegal command!')
        if each.startswith('in'):
            hp.heappush(heap_array, -1 * int(each[7:]))
        elif each.startswith('ex'):
            print(-1 * hp.heappop(heap_array))

Measured memory_bytes: 190204
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  vector<string> s(N);
  map<string, int> m;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> s[i];
    sort(s[i].begin(), s[i].end());
    if (m[s[i]] != 0) {
      ans += m[s[i]];
    }
    m[s[i]]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 14084
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        
        var sc = new Scanner(System.in);
    
        int n = Integer.parseInt(sc.next());
        
        int a = 0;
        int w = 0;
        int t = 0;
        int r = 0;
        for(int i = 0; i < n; i++){
            String s = sc.next();
            switch(s){
                case "AC":
                    a++;
                    break;
                case "WA":
                    w++;
                    break;
                case "TLE":
                    t++;
                    break;
                case "RE":
                    r++;
                    break;
            }
        }
        System.out.println("AC x " + a);
        System.out.println("WA x " + w);
        System.out.println("TLE x " + t);
        System.out.println("RE x " + r);
    }
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a) {if(a){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
void YESNO(int a) {if(a){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}}
void AorB(int a,string b,string c) {if(a){cout<<b<<endl;}else{cout<<c<<endl;}}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n,k;
    cin>>n>>k;
    int m=pow(2,n)-1;
    if(k>m || (n==1 && k==1)){cout<<-1<<endl; return 0;}
    if(k==0){
        REP(i,0,m+1) cout<<i<<" "<<i<<" ";
        cout<<endl;
        return 0;
    }
    cout<<0<<" "<<k<<" "<<0<<" ";
    REP(i,1,m+1) if(i!=k) cout<<i<<" ";
    cout<<k<<" ";
    for(int i=m; i>0; i--) if(i!=k) cout<<i<<" ";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,ssse3,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
//using arr = array;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using vpi = vector<pi>;
using ld = long double;
#include<bits/extc++.h>
using namespace __gnu_pbds;
using oset = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
const int maxn = 404, mod = (119<<23)+1, lg = 19;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n;
	cin >> n;vi a(n);
	ll ans = n*(n-1)*(n-2)/6;
	for(auto &i : a) cin >> i;
	sort(all(a));
	for(int i = 0; i < n; i++)
		for(int j = 0; j < i; j++) {
			ans -= max(0, int(a.end() - lower_bound(all(a), a[i]+a[j])));
		}
	
	cout << ans;
	return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
	template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
	template<class T> inline std::istream& operator >> (std::istream& is, std::vector<T>& v) { for (T& x : v) { is >> x; }return is; }
	template<class T> inline std::ostream& operator << (std::ostream& os, const std::vector<T>& v) {
		for (auto itr = v.begin(); itr != v.end();) { os << (*itr) << ((++itr != v.end()) ? " " : ""); }
		return os;
	}
	template<class V, typename T>inline void fill(V& v, const T& val) { v = val; }
	template<class V, typename T>inline void fill(std::vector<V>& v, const T& val) { for (V& x : v) { fill(x, val); } }
	template<class V, typename H>inline void resize(std::vector<V>& v, const H h) { v.resize(h); }
	template<class V, typename H, typename... T>inline void resize(std::vector<V>& v, const H& h, const T& ... t) { v.resize(h); for (auto& x : v) { resize(x, t...); } }
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }

	vector<int> demical(ll n, int k, int l = -1) {
		vector<int> rtn;
		if (l < 0) {
			while (n > 0) {
				rtn.push_back(n % k);
				n /= k;
			}
		} else {
			rtn.resize(l);
			REP(i, l) {
				rtn[i] = n % k;
				n /= k;
			}
		}
		return rtn;
	}

	void solve() {
		IOS;
		ll n, m, q;
		cin >> n >> m >> q;
		vector<ll> a(q), b(q), c(q), d(q);
		REP(i, q) {
			cin >> a[i] >> b[i] >> c[i] >> d[i];
			a[i]--, b[i]--;
		}
		ll t = 1 << (m+n);
		ll res = 0;
		REP(i, t) {
			auto dem = demical(i, 2, m+n);
			vector<int> tmp;
			ll cnt = 0;
			REP(j, m + n) {
				if (dem[j]) {
					tmp.push_back(j + 1 - cnt++);
				}
			}
			bool flag = true;
			REP(j, tmp.size()) {
				if (tmp[j] > m) {
					flag = false;
				}
			}
			if (tmp.size() != n) {
				continue;
			}
			if (!flag) {
				continue;
			}
			ll t1 = 0;
			ll sz = tmp.size();
			REP(j, q) {
				if ( b[j] < sz && a[j] < sz && tmp[b[j]] - tmp[a[j]] == c[j]) {
					t1 += d[j];
				}
			}
			chmax(res, t1);
		}
		put(res);
	}
} // namespace idaten

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


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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

vector<vector<pair<int, int> > > edge;//edge[i][j] firstがiからj番目のノード、secondがその重み
vector<int> d(100005,INF);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
	cin >> s;
	int n = s.size();
	int ans = 0;
	rep(i,n){
		if(i%2==0){
			if(s[i] == '0') ans++;
		}else{
			if(s[i] == '1') ans++;
		}
	}
	int ret = 0;
	rep(i,n){
		if(i%2==1){
			if(s[i] == '0') ret++;
		}else{
			if(s[i] == '1') ret++;
		}
	}
	cout << min(ans,ret) << endl;
}

Measured memory_bytes: 896
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		char[] S = sc.next().toCharArray();
		int w = sc.nextInt();
		StringBuilder ans = new StringBuilder();
		for(int i = 0; i < S.length; i += w) ans.append(S[i]);
		System.out.println(ans);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

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

r = sum(a)
l = 0
r -= a[0]
l += a[0]
ans = abs(r-l)
for i in range(1,n-1):
    r -= a[i]
    l += a[i]
    s = abs(r-l)
    ans = min(ans,s)
print(ans)

Measured memory_bytes: 89424
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
 
#define vl vector<ll>
#define vi vector<int>
 
#define ff first
#define ss second
 
#define pb push_back
#define MOD 1000000007
//const int nax = 1e6+5;
#define inf 4e18
 
#define display(v) for(int i =0;i<v.size();++i)cout << v[i] << " "
#define all(v) v.begin(),v.end()
ll sqr(ll x){return x*x;}
inline ll add(ll a, ll b){ ll c = a + b; if(c >= MOD) c -= MOD; return c; }
inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
const int nax = 1000*1000 + 10;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    int h,w,k; cin>>h>>w>>k;
    vector<string> v(h);
    for(int i =0;i<h;++i){
        cin>>v[i];
    }
    int uph = pow(2,h);
    int upw = pow(2,w);
    int ans =0 ;
    for(int b1 = 0;b1<uph;b1++){
        vector<string> copy = v;
        for(int  x = 0;x<h;++x){
            if((b1>>x)&1){
                for(int g = 0;g<w;++g){
                    copy[x][g] = '?';
                }
            }
        }
        for(int b2 = 0;b2 < upw;b2++){
            vector<string> copy2 = copy;
            for(int x = 0;x<w;++x){
                if((b2>>x)&1){
                    for(int g  =0;g<h;++g){
                        copy2[g][x] = '?';
                    }
                }
            }
            int cnt = 0;
            for(int i =0;i<h;++i){
                for(int j =0;j<w;++j){
                     if(copy2[i][j] == '#')++cnt;
                }
            }
            if(cnt == k){ans++;}
        }
       
    }
       
    
    cout << ans;
   
   
    return 0;
}
    

// Химаншу


Measured memory_bytes: 4088
# include"stdio.h"
int main(){
    int x,y;
    scanf("%d %d",&x,&y);
     if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11))
         printf("Yes\n");
    else if((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12))
         printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 1648
#include <iostream>
#include <string>
#include<math.h>
#include <cstdio>
#include <iomanip>
using namespace std;
int main()
{
    int N,K;
    cin >> N >> K;
    double onechan = 0.000000000000;
    if(N >= K){
      onechan = double(N-K+1)/N;
    }
    double prob = onechan;
    int lim = min(N, K-1);
    for(int i=1; i <=lim; i++){
      double point = double(i);
      int cnt = 0;
      while(point < K){
        point = point * 2.0;
        cnt++;
      }
      prob = prob + double(1)/N * pow(double(0.5), double(cnt));
      //cout<<double(1)/N * pow(double(0.5), double(cnt))<<endl;
    }
    cout << fixed << setprecision(12) << prob << endl;
    //cout<<prob<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define deb(x) cout << #x << "=" << x << endl;
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

int main() {
    fastio
    string s, t;
    cin>>s>>t;
    int n = s.length(), m = t.length();

    ll ans = m;
    for(int i = 0; i<n-m+1; ++i) {
        ll cur = 0;
        for(int j = i; j<i+m; ++j) {
            if(s[j] != t[j-i])
                cur++;
        }
        ans = min(ans, cur);
    }

    cout<<ans<<endl;
}

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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c>> d;
  cout << (abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d) ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define FOR(i, r, n) for (int i=(int)(r); i<=(int)(n); i++)
#define all(v) v.begin(), v.end()
#define INF 2147483647
#define INF64 9223372036854775807
#define MOD 1000000007

int main(){

    int n;
    cin>>n;
    int c0=0, c1=0, c2=0, c3=0;
    rep(i, n){
        string s;
        cin>>s;
        if(s=="AC") c0++;
        if(s=="WA") c1++;
        if(s=="TLE") c2++;
        if(s=="RE") c3++;

    }

    cout<<"AC x "<<c0<<endl;
    cout<<"WA x "<<c1<<endl;
    cout<<"TLE x "<<c2<<endl;
    cout<<"RE x "<<c3<<endl;
    
}

Measured memory_bytes: 3628
package main

import (
	"fmt"
	"sort"
)

func main() {
	// Code for B - Traveling AtCoDeer Problem
	var N int
	fmt.Scanf("%d", &N)

	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
	}

	sort.Sort(sort.IntSlice(A))

	var ans int
	for i := 1; i < N; i++ {
		ans += A[i] - A[i-1]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1832
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();

        final List<Robot> robots = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            final int point = scanner.nextInt();
            final int length = scanner.nextInt();
            robots.add(new Robot(point - length, point + length));
        }

        robots.sort(Comparator.comparing(robot -> robot.right));

        int count = 0;
        long rightest = -1000000000;
        for (int i = 0; i < n; i++) {
            if (rightest <= robots.get(i).left) {
                count++;
                rightest = robots.get(i).right;
            }
        }

        System.out.println(count);
    }

    static class Robot {
        long left;
        long right;

        Robot(final long left, final long right) {
            this.left = left;
            this.right = right;
        }
    }
}


Measured memory_bytes: 94364
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

#define for1(n) for (int i = 0 ; i < n ; i++)
#define for2(n) for (int j = 0 ; j < n ; j++)
#define for1l(n) for (ll i = 0 ; i < n ; i++)
#define for2l(n) for (ll j = 0 ; j < n ; j++)

int main() {
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int a[26] = {}, b[26] = {};
    bool y = 1;
    for1(s.length()) {
    	a[s[i] - 'a']++;
		b[t[i] - 'a']++;
        if (a[s[i] - 'a'] != b[t[i] - 'a']) {
    		cout << "No";
    		return 0;
        }
	}
    cout << "Yes";
}

Measured memory_bytes: 3808
local l,r=io.read("*n","*n")

if l%2019+r-l>=2019 then
    print(0)
else
    local minmod=2019
    for i=l,r-1 do
        for j=i+1,r do
            minmod=math.min(minmod,i*j%2019)
        end
    end
    print(minmod)
end

Measured memory_bytes: 376
#include <iostream>
#include <cstring>
using namespace std;
char s[3005],t[3005];
int dp[3005][3005],dir[3005][3005];
int lcs(int i,int j)
{
    if (dp[i][j]==-1)
    {
        if (s[i-1]==t[j-1])
        {
            dp[i][j]=1+lcs(i-1,j-1);
            dir[i][j]=0;
        }
        else dp[i][j]=max(lcs(i-1,j),lcs(i,j-1));
    }
    return dp[i][j];
}
void afisare(int x,int y)
{
    if (x>0 && y>0)
    {
        if (s[x-1]==t[y-1])
        {
            afisare(x-1,y-1);
            cout << s[x-1];
        }
        else if (dp[x][y-1]<dp[x-1][y]) afisare(x-1,y);
        else afisare(x,y-1);
    }
}
int main()
{
    cin >> s >> t;
    int n=strlen(s),m=strlen(t);
    for (int i=0;i<=n;i++)
    {
        for (int j=0;j<=m;j++)
        {
            dp[i][j]=-1;
        }
    }
    for (int i=0;i<=m;i++)
    {
        dp[0][i]=0;
    }
    for (int i=0;i<=n;i++)
    {
        dp[i][0]=0;
    }
    lcs(n,m);
    afisare(n,m);
}

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

bool road[16][16];
int memo[16][16], h, w;

int solve(int x, int y) {
  if( y < 0 || y >= h || x < 0 || x >= w || road[y][x] ) return 0;
  if( memo[y][x] ) return memo[y][x];
  if( x == w-1 && y == h-1 ) return 1;
  return memo[y][x] = solve(x+1, y) + solve(x, y+1);
}

int main() {
  int a, b, c;
  while( cin >> w >> h, w ) {
    fill_n(road[0], 16*16, 0);
    fill_n(memo[0], 16*16, 0);
    cin >> c;
    while( c-- ) {
      cin >> a >> b;
      a--; b--;
      road[b][a] = true;
    }

    cout << solve(0, 0) << endl;
  }
}

Measured memory_bytes: 1160
x1, y1, x2, y2 = list(map(int, input().split()))

vx = x2 - x1
vy = y2 - y1

x3 = x2 - vy
y3 = y2 + vx
x4 = x3 - vx
y4 = y3 - vy

print(x3, y3, x4, y4)


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

using namespace std ;

int n , m ;
vector <int > adjList[100005] ;
int dp[100005] ;
int ans[100005] ;

void dfs1(int u = 0 , int p = -1)
{
    dp[u] = 1 ;
    for(int v : adjList[u])
        if(v != p)
        {
            dfs1(v , u) ;
            dp[u] = int(1LL * dp[u] * (1 + dp[v]) % m) ;
        }
}
void dfs2(int u = 0 , int p = -1, int up = 0)
{
    ans[u] = int(1LL * dp[u] * (up + 1) % m) ;
    vector<int > _prefix ;
    vector<int > _suffix (adjList[u].size());
    int prev = 1 ;
    for(int v : adjList[u])
        if(v != p)
        {
            _prefix.push_back(prev) ;
            prev = int(1LL * prev * (1 + dp[v]) % m) ;
        }
        else
            _prefix.push_back(1);
    prev = 1 ;
    for(int i = adjList[u].size() - 1 ; i >= 0 ; i--)
    {
        int v = adjList[u][i] ;
        if(v != p)
        {
            _suffix[i] = prev ;
            prev = int(1LL * prev * (1 + dp[v]) % m) ;
        }
        else
            _suffix[i] = 1 ;
    }
    for(int i = 0 ; i < adjList[u].size() ; i++)
    {
        int v = adjList[u][i];
        if(v != p)
            dfs2(v , u, int(1LL * (1LL * (up + 1) * _prefix[i] % m) * _suffix[i] % m) ) ;
    }
}

int main()
{

    ios_base :: sync_with_stdio(false) ;
    cin.tie(nullptr) ;
    cin >> n >> m ;
    for(int i = 0 ; i < n - 1 ;i++)
    {
        int x , y ; cin >> x >> y ;
        --x , --y ;
        adjList[x].push_back(y) ;
        adjList[y].push_back(x) ;
    }
    memset(dp , 0 , sizeof dp) ;
    dfs1() ;
    dfs2() ;
    for(int i = 0 ; i < n ;i++)
        cout << ans[i] << '\n' ;
    return 0;
}

Measured memory_bytes: 24556
n, x = map(int, input().split())
a = list(map(int, input().split()))
 
b = a[::]
ans = sum(a)
 
for k in range(1, n):
    b = [min(b[i], a[i - k]) for i in range(n)]
    ans = min(ans, sum(b) + k * x)
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    const int ARRAYS = 3;
    string a[ARRAYS];
    
    char buf[ARRAYS + 1];
    
    for(int i=0; i<ARRAYS; ++i){
        cin >> a[i];
        buf[i] = a[i].at(0);
    }
    
    buf[ARRAYS] = '\0';
    cout << buf << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define DEBUG(x)                   cout << '>' << #x << ':' << x << endl;
int arr[110000];
priority_queue<int> PQ;
int main()
{
    string s;
    int n,k,q,a,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        PQ.push(a);
    }
    while(m!=0)
    {
        a=PQ.top();
        PQ.pop();
        a=a/2;
        PQ.push(a);
        m--;
    }
    ll ans=0;
    while(!PQ.empty())
    {
        ans+=PQ.top();
        PQ.pop();
    }
    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 892
#include <stdio.h>
#include <math.h>
char CHK[1000000];
int main(){
	int DATA[31];
	int sn=0;
	int i,j;
	int max=0;
	int ans;
	while(scanf("%d",&DATA[sn])!=EOF)sn++;

	for(i=0;i<sn;i++)if(DATA[i]>=max)max=DATA[i];

	for(i=2;i<=max;i++)CHK[i]=1;
	
	for(i=2;i<=(int)sqrt(max);i++){
		if(CHK[i])for(j=2;i*j<=max;j++)CHK[i*j]=0;
	}

	for(i=0;i<sn;i++){
		ans=0;
		for(j=0;j<=DATA[i];j++){
			if(CHK[j])ans++;
		}
		printf("%d\n",ans);
	}

	return 0;
}

Measured memory_bytes: 1568
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    int N;
    cin >> N;
    cout << 180*((N-3)+1) << endl;

    
    
    
    

    return 0;
}


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

typedef long long ll;

int n, w[5005], m;
ll mod, ans, f[5005];

int main() {
	cin>>n>>mod;
	m = (n - 1)/2;
	if(n%2 == 1) {
		for(int i = 1; i <= 2*m; i++) 
		    w[i] = min(2*m - i + 1, m) - max(0, m - i + 1) + 1;
	}
	else {
		for(int i = 1; i <= 2*m + 1; i++)
		    w[i] = min(2*m + 1 - i + 1, m) - max(0, m - i + 1) + 1;
	}
	f[0] = 1;
	for(int i = 1; i < n; i++)
	    for(int j = 0; j < n; j++)
	        if(j >= w[i]) f[j] = (f[j] + f[j - w[i]])%mod;
	for(int i = 0; i < n; i++)
	     ans = (ans + f[i]*(n - i))%mod;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pb push_back
#define ll long long int
#define w(t) int t;cin>>t; while(t--)
#define mp make_pair
#define fi first
#define se second
#define fr(n) for(int i=0;i<n;i++)
#define um unordered_map
#define pqm priority_queue <int, vector<int>, greater<int> >
int GCD(int a,int b){
	if(b==0)
	return a;
	return GCD(b,a%b);
}
int arr[201][201][201]={0};
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k;
    cin>>k;
    ll sum=0;
    for(int i=1;i<=k;i++){
    	for(int j=1;j<=k;j++){
    		if(arr[i][j][0]==0)
    			arr[i][j][0]=GCD(i,j);
    		for(int h=1;h<=k;h++){
    			int G;
    			if(arr[i][j][h]==0){
    				
    			G=GCD(h,arr[i][j][0]);
				arr[i][j][h]=G;	
				}
    			else
    			G=arr[i][j][h];
    			sum+=G;
			}
		}
	}
    cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 35216