akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n, k; cin >> n >> k;
    vi h(n);
    rep(i, n) cin >> h[i];
    sort(all(h));
    ll ans = INFLL;
    for(ll i=0; i<n-k+1; i++){
        chmin(ans, h[i+k-1]-h[i]);
    }
    cout << ans << endl;
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll s,ans,i=0;
    cin >> s;
    if(s == 2 || s == 1 || s == 4){
        cout << "4" << endl;
        return 0;
    }
    while(1){
        if(s % 2 == 0)s /= 2;
        else s = s*3 +1;
        if(s == 4){
            ans = i+5;
            break;
        }
        i++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
while True:
    y = input()
    list = y.split()
    [n, x] = list
    n = int(n)
    x = int(x)
    nx = n + x
    
    #終了条件を記載
    if nx ==  0:
        break
    
    #比較する数字3つはa,b,cとする
    #最終的にa,b,cの合計がxになった場合にansカウントを1増やす
    
    ans = 0
    N = n + 1
    
    #最初の数aを抽出
    for a in range(1,N):
        #次の数値bを抽出
        for b in range(a + 1,N):
            #aとbが一緒であればスキップする処理
            if a == b:
                continue
            #最後の数値cを抽出
            for c in range(b + 1,N):
                #a=cまたはb=cならforを抜ける処理
                if a == b or b == c:
                    continue
                
                #計算をする
                abc = a + b + c
                if abc == x:
                    ans = ans + 1
                
    print(ans)


Measured memory_bytes: 5596
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    A, B, C = map(int, input().split())    
    if A + B < C:
        print(No)
    else:
        print(Yes)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3960
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n = int(input())

tmp = 0
res = 0

if n % 10 in [2, 4, 5, 7, 9]:
    res = "hon"
elif n % 10 in [0, 1, 6, 8]:
    res = "pon"
else:
    res = "bon"

print(res)


Measured memory_bytes: 30888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll N,X;
	cin>>N>>X;
	vector<ll> L(N+1);
	L[0]=0;
	for(ll i=1;i<=N;i++) cin>>L[i];
	ll cnt=0,position=0;
	for(ll i=0;i<=N;i++){
		position+=L[i];
		if(position<=X) cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define max 100
#define MAX 1000000

int min(int,int);

int main(){
  int i,j,l,k,n,p[max+1],m[max+1][max+1];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&p[i-1]);
    scanf("%d",&p[i]);
  }
  for(i=1;i<=n;i++)m[i][i]=0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=MAX;
      for(k=i;k<=j-1;k++){
	m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }
  printf("%d\n",m[1][n]);
  return 0;
}
int min(int a,int b){
  if(a<b)return a;
  else return b;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int inf = 0x3f3f3f3f;
int n;
char str[N];
int suffix[N], prefix[N];
int main(){
	scanf ("%d", &n);
	scanf ("%s", str + 1);
	
	for (int i = 1; i <= n; i++) prefix[i] = prefix[i - 1] + (str[i] == 'W');
	for (int i = n; i >= 1; i--) suffix[i] = suffix[i + 1] + (str[i] == 'R');
	
	int ans = inf;
	for (int i = 0; i < n; i++) ans = min(ans, max(prefix[i], suffix[i + 1]));
	
	if (prefix[n] == n || suffix[1] == n) ans = 0;
	
	printf ("%d\n", ans);
  return 0;
}

Measured memory_bytes: 5512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
using namespace std;
int main()
{ 
    int a,b;
    cin>>a>>b;
    if(a>2*b){
        cout<<(a-2*b)<<endl;
    }
    else{
        cout<<0<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

struct Mo {
  Mo(const vector<int> &left, const vector<int> &right) : left(left), right(right) {
    n = left.size();
    int width = sqrt(n);
    order.resize(n);
    iota(ALL(order), 0);
    sort(ALL(order), [&](int a, int b) {
      return left[a] / width != left[b] / width ? left[a] < left[b] : ((left[a] / width) & 1 ? right[a] < right[b] : right[a] > right[b]);
    });
  }

  int process() {
    if (ptr == n) return -1;
    int idx = order[ptr++];
    while (left[idx] < nl) add(--nl);
    while (nr < right[idx]) add(nr++);
    while (nl < left[idx]) del(nl++);
    while (right[idx] < nr) del(--nr);
    return idx;
  }

  void add(int idx) const;

  void del(int idx) const;

private:
  vector<int> left, right, order;
  int n, ptr = 0, nl = 0, nr = 0;
};

const int N = 500000;
int cnt[N] = {}, ans = 0;
vector<int> c;

void Mo::add(int idx) const {
  if (cnt[c[idx]] == 0) ++ans;
  ++cnt[c[idx]];
}

void Mo::del(int idx) const {
  --cnt[c[idx]];
  if (cnt[c[idx]] == 0) --ans;
}

int main() {
  int n, q; cin >> n >> q;
  c.resize(n);
  REP(i, n) cin >> c[i], --c[i];
  vector<int> l(q), r(q);
  REP(i, q) cin >> l[i] >> r[i], --l[i];
  Mo mo(l, r);
  vector<int> kind(q);
  REP(_, q) {
    int idx = mo.process();
    kind[idx] = ans;
  }
  REP(i, q) cout << kind[i] << '\n';
  return 0;
}


Measured memory_bytes: 19448
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
#include <numeric>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}
//桁数のカウント
//pow(x,n) == x^n
//sum = accumulate(v.begin(),v.end(),0);
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}



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

vc s(4);
rep(i,4) cin >> s[i];

Sort(s);

if(s[1] != s[2] && s[0] == s[1] && s[2] == s[3]) cout << "Yes" << endl;
else cout << "No" << endl;


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <limits>
#include <numeric>
#include <queue>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
bool compare_by_b(pair<int, long long> a, pair<int, long long> b) {
    if(a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}
vector<vector<long long>> kiroku;

void solve(int a, long long zan) {}

int main() {
    int N;
    string S;
    cin >> N >> S;
    int max = 0;
    rep(i, 1, N) {
        string kouho = S.substr(i - max, max + 1);
        rep(r, 0, i - 2 * max) {
            string tmp = S.substr(r, max + 1);
            if(tmp == kouho) {
                max++;
                break;
            }
        }
    }
    cout<<max<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <stdint.h>
#include <vector>

using namespace std;

int MOD = 1000000007;

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

  vector<uint32_t> A(60,0);

  for (int n=0; n<N; ++n) {
    uint64_t a;
    cin >> a;
    for (int idx = 0; a; ++idx, a/=2) {
      if (a&1)
	++A[idx];
    }
  }

  uint64_t sum = 0;
  for (int idx=0; idx<60; ++idx) {
    if (A[idx] == 0 || A[idx] == N)
      continue;
    uint64_t num1 = A[idx], num0 = N - num1;
    uint64_t fraction = num1*num0;
    if (fraction >= MOD)
      fraction %= MOD;
    uint64_t exponent = uint64_t(1) << idx;
    if (exponent >= MOD)
      exponent %= MOD;
    uint64_t combination = fraction * exponent;
    // if (combination >= MOD)
    //   combination %= MOD;
    sum += combination;
    if (sum >= MOD)
      sum %= MOD;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int dp[100001][2];
int a[100],n,min_val=INT_MAX;
int dfs(int k,int level)
{
    if(k<min_val)
      return level;
    if(dp[k][level]!=-1)
      return dp[k][level];
    if(level==0)
    {
        int mx=0;
        for(int i=0;i<n;i++)
        {
            if(k>=a[i])
            mx=max(mx,dfs(k-a[i],!(level&1)));
        }
        dp[k][level]=mx;
        return mx;
    }
    if(level==1)
    {
        int mn=1;
        for(int i=0;i<n;i++)
        {
            if(k>=a[i])
            mn=min(mn,dfs(k-a[i],!(level&1)));
        }
        dp[k][level]=mn;
        return mn;
    }
}
int main()
{
    int k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        min_val=min(min_val,a[i]);
    }
    int level=0;
    memset(dp,-1,sizeof(dp));
    int ans=dfs(k,level);
    if(ans)
        cout<<"First\n";
    else
        cout<<"Second\n";
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  int n;
  while(cin >> n && n) {
    string s;
    cin >> s;
    int a[n],b[n];
    rep(i,n) cin >> a[i] >> b[i];
    for(int i=n-1; i>=0; i--) {
      int d=abs(a[i]-b[i]);
      s[a[i]-1]+=d;
      while(!isalpha(s[a[i]-1])) s[a[i]-1]-=26;
      s[b[i]-1]+=d;
      while(!isalpha(s[b[i]-1])) s[b[i]-1]-=26;
      swap(s[a[i]-1],s[b[i]-1]);
    }
    pr(s);
  }
  return 0;
}


Measured memory_bytes: 1208
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;

using namespace std;

int main()
{
  ull N;
  cin >> N;
  vector<ll> as(N);
  for(auto i = 0; i < N; i++) {
    cin >> as[i];
  }

  ll count = 0;

  for (auto i = 0; i < N; i++) {
    while (as[i] % 2 == 0) {
      count++;
      as[i] /= 2;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<stdio.h>
#include<cmath>
using namespace std;

int main(void){
    int i,N,retu[1010],warareru,waru;
    long long int ans=1;
    cin >> N;
    for(i=0;i<1010;i++) retu[i]=1;
    for(i=2;i<=N;i++){
        warareru=i;
        waru=2;
        while(warareru!=1){
            if(warareru%waru==0) {
                retu[waru]++;
                warareru/=waru;
            }
            else waru++;
        }
    }
    for(i=0;i<1010;i++){
        ans*=retu[i];
        ans=ans%1000000007;
    }
    printf("%.0lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int k=sc.nextInt();
        int a[]=sc.nextIntArray(n);
        sort(a);
        long r=0;
        for (int i = 0; i < a.length-k; i++) {
			r+=a[i];
		}
     
        out.println(r);
     	out.flush();
    }

    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,y; double d;
//	P(int  x, int y, double d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}


class P implements Comparable<P>{
    int x,y;
    P(int x,int y) {
    	this.x=x;
    	this.y=y;
    }

    public int compareTo(P p){
        return y-p.y;
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 55892
a,b,c = (int(num) for num in input().split())

def gcd(a,b):
    a = a%b
    if a==0:
        return b
    else:
        a,b = b,a
        return gcd(a,b)
            
            
g = gcd(a,b)
if c%g == 0:
    print("YES")
else:
    print("NO")



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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
void chmax(T1 &a, const T2 &b) {
  if(a < b) a = b;
}

template <typename T1, typename T2>
void chmin(T1 &a, const T2 &b) {
  if(a > b) a = b;
}

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i != (int)(s.size())-1) cout << " ";
  }
  cout << "\n";
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

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

  ll a, b; cin >> a >> b;
  if(a > b) swap(a, b);
  if((b - a) % 2) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << (b + a) / 2 << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <vector>
#include <cmath>
#include <unordered_map>
#define ll long long
using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n==2)
        cout<<2;
    else if(n%2==1)
        cout<<n*2;
    else
        cout<<n;
    
}


Measured memory_bytes: 256
a, b, c = map(int,input().split())

if a == 5 and b == 5 and c == 7:
  print('YES')

elif a == 5 and b == 7 and c == 5:
  print('YES')

elif a == 7 and b == 5 and c == 5:
  print('YES')

else:
  print('NO')


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



int64_t departure(int64_t arrival,int64_t f,int64_t s){
  if (arrival<=s){
    return s;
  }
  
  if (arrival>s){
    return ((arrival+f-1)/f)*f;
  }
}





int main(){
  


  int n,y;
  cin>>n>>y;
  
  y/=1000;
  
  bool flag=false;
  
  for (int i=0;i<=2000;i++){
    for (int j=0;j<=4000;j++){
      int k=n-i-j;
      if (k>=0 and 10*i+5*j+k==y){
        cout<<i<<" "<<j<<" "<<k<<endl;
        flag=true;
        break;
      }
    }
    if (flag){
      break;
    }
  }
  
  if (flag==false){
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
  }
  
  
      
  

      
  
    

  
  
    
  
  
  
}

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

using namespace std;

typedef long long ll;

template <class T>
void dfs(int n, int N, int M, T &A, T &a, T &b, T &c, T &d, int &ans)
{
    if (n == N)
    {
        int sum = 0;
        for (int i = 0; i < a.size(); i++)
        {
            if (A[b[i] - 1] - A[a[i] - 1] == c[i])
            {
                sum += d[i];
            }
        }
        ans = max(ans, sum);
        return;
    }
    for (int i = A[n]; i <= M; i++)
    {
        A[n + 1] = i;
        dfs(n + 1, N, M, A, a, b, c, d, ans);
    }
}

int main()
{
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<int> a(Q);
    vector<int> b(Q);
    vector<int> c(Q);
    vector<int> d(Q);
    for (int i = 0; i < Q; i++)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    int ans = 0;
    vector<int> A(N);
    A[0] = 1;
    dfs(0, N - 1, M, A, a, b, c, d, ans);
    cout << ans << endl;
}

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

Measured memory_bytes: 256
#include <stdio.h>

int main (void) {
    int h, w;

    for (;;) {
        scanf ("%d %d", &h, &w);

        if (h==0 && w==0) break;

        for (int i=0; i<h; i++) {
            for (int j=0; j<w; j++) {
                if (i==0 || i==h-1 ||
                    j==0 || j==w-1) printf ("#");
                else printf (".");
            }
             printf ("\n");
        }
        printf ("\n");
    }

    return 0;
}


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

int main(){
    int n, x, m[n];
    int min1 = 1001;
    int sum = 0;
    cin >> n >> x;
    for(int i = 0; i < n; i++){
        cin >> m[i];
        sum += m[i];
        min1 = min(min1, m[i]);
    }
    int y = (x - sum) / min1;
    cout << n + y << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repr(i, n) for (ll i = (n); i >= 0; --i)
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define FORR(i, m, n) for (ll i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  if (n % 2 == 0) {
    bool f = true;
    rep(i, n / 2) {
      if (a[2 * i] != a[2 * i + 1]) {
        f = false;
      }
    }
    if (f) return 0;
  }
  map<ll, ll> mp;
  rep(i, n) mp[a[i]] = -1;
  vector<vector<ll>> dp;
  vector<ll> res(n);
  rep(i, 2 * n) {
    if (mp[a[i % n]] != -1 && mp[a[i % n]] < n) res[mp[a[i % n]]] = i - mp[a[i % n]] + 1;
    mp[a[i % n]] = i;
  }
  dp.push_back(res);
  while (res[0] < n * k) {
    vector<ll> nxt(n, 0);
    rep(i, n) nxt[i] = res[i] + res[(res[i] + i) % n];
    res = nxt;
    dp.push_back(res);
  }
  ll m = dp.size();
  ll pos = 0;
  repr(i, m - 1) {
    if (pos + dp[i][pos % n] < n * k) pos += dp[i][pos % n];
  }
  pos %= n;
  stack<ll> st;
  rep(i, n) mp[a[i]] = 0;
  FOR(i, pos, n) {
    //cout << i << ' ' << mp[a[i]] << '\n';
    if (mp[a[i]] == 1) {
      while (!st.empty() && st.top() != a[i]) {
        mp[st.top()] = 0;
        st.pop();
      }
      mp[a[i]] = 0;
      st.pop();
    }
    else {
      st.push(a[i]);
      mp[a[i]] = 1;
    }
  }
  if (st.empty()) {
    return 0;
  }
  vector<ll> ans;
  while (!st.empty()) {
    ans.push_back(st.top());
    st.pop();
  }
  reverse(ans.begin(), ans.end());
  rep(i, ans.size()) cout << ans[i] << ' ';
  cout << '\n';






  
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
// const ll MOD = 1000000007;
const ll MOD = 998244353;

const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, S; cin >> N >> S;
    vector<ll> A(N);
    rep(i, N){cin >> A.at(i);}

    // UはTの部分集合
    // U に関してはax1 + ax2 + ... = S
    // この時，iに関して
    // (i) UにもTにも入れる (ii) Tだけに入れる (iii) どちらにも入れない
    // dp[i][j]: i番目までの選択をして，1つめの選択肢を選んだkに対するa_{k}の和がjとなる場合の数
    ll dp[N + 1][S + 1];
    rep(i, N + 1){rep(j, S + 1){dp[i][j] = 0;}}
    dp[0][0] = 1; // 開始状態
    rep(i, N){
        rep(j, S + 1){
            dp[i + 1][j] += 2 * dp[i][j]; // (ii)と(iii)ではスコアは変わらないのでこっち
            dp[i + 1][j] %= MOD;
            if (j + A.at(i) <= S){
                dp[i + 1][j + A.at(i)] += dp[i][j];
                dp[i + 1][j + A.at(i)] %= MOD;
            }
        }
    }
    cout << dp[N][S] << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 73992
(n,q),*t=[map(int,t.split())for t in open(0)]
s=[0]
d=s*n
f=s*n
e=[[]for _ in d]
for a,b in t:
 if~-n:n-=1;e[a-1]+=b-1,;e[b-1]+=a-1,
 else:d[a-1]+=b
while s:
 v=s.pop();f[v]=-1
 for w in e[v]:
  if~f[w]:d[w]+=d[v];s+=w,
print(*d)

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

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

int main()
{
	REP(j, 1, 10)
		REP(i, 1, 10)
			printf("%dx%d=%d\n", j, i, j*i);
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n,y;
    cin >> n >> y;
    REP(i,0,n+1) REP(j,0,n+1-i) {
        int sum = i * 10000 + j * 5000 + (n - i - j) * 1000;
        if (sum == y) {
            cout << i << " " << j << " " << n - i - j << endl;
            return;
        }
    }
    cout << "-1 -1 -1" << endl;
}

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

Measured memory_bytes: 256
X,N=map(int,input().split())
p=sorted(list(map(int,input().split())))

sa_min=100

"""
sa=[]
for i in range(N):
    sa.append(p[i]-X)
"""

for i in range(102):
    if sa_min>abs(i-X) and (not i in p):
        sa_min=abs(i-X)
        ans=i

if N==0:ans=X

print(ans)

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

int main(void){
    int S, s, m, h;
    
    cin >> S;  
    h = S / 3600;
    m = (S%3600) / 60;
    s = S % 60;

    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


Measured memory_bytes: 3116
fn main() {
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };

    let k = read_int(s);

    let list = [
        1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4,
        1, 51,
    ];
    let k = k as usize;
    println!("{}", list[k - 1]);
}

fn read_int(s: String) -> i32 {
    let mut ws = s.split_whitespace();
    let i: i32 = ws.next().unwrap().parse().unwrap();
    i
}


Measured memory_bytes: 4352
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	//これpythonでとけなくない?
	int R,G,B,n,ans=0;cin>>R>>G>>B>>n;
	int i,j;
	for(i=0;i*R<=n;i++){
		for(j=0;i*R+j*G<=n;j++){
			if((n-i*R-j*G)%B==0){ans++;}
		}
	}
	cout<<ans<<endl;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

struct RollingHash {
  const int h = 1000000007;
  const int b = 10007;
  vector<int> ha;
  vector<int> po;
  RollingHash(const string &s) {
    int n = (int) s.size();
    ha.assign(n + 1, 0);
    po.assign(n + 1, 1);
    for (int i = 0; i < n; i++) {
      ha[i + 1] = ((long long) ha[i] * b + s[i]) % h;
      po[i + 1] = ((long long) po[i] * b) % h;
    }
  }
  int get(int l, int r) {
    return (ha[r] + h - ((long long) ha[l] * po[r - l]) % h) % h;
  }
};

void solve() {
  int n;
  cin >> n;
  vstr S(n);
  cin >> S;
  vstr T;
  rep(i, n) {
    string s;
    rep(j, n) s.push_back(S[j][i]);
    T.push_back(s);
  }
  rep(i, n) {
    S[i] += S[i];
    T[i] += T[i];
  }
  vector<RollingHash> srh, trh;
  rep(i, n * 2) {
    srh.push_back(RollingHash(S[i % n]));
    trh.push_back(RollingHash(T[i % n]));
  }
  int ans = 0;
  rep(i, n) rep(j, n) {
    bool ok = true;
    rep(k, n) {
      if (srh[i + k].get(j + k + 1, j + n) != trh[j + k].get(i + k + 1, i + n)) {
        ok = false;
        break;
      }
    }
    if (ok) ans++;
  }
  cout << ans << endl;
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long

VI a;
int n;

LL max_score()
{
	priority_queue<int, VI, greater<int>> pq;
	priority_queue<int> pq2;

	VL l, r;
	l = r = VL(3 * n + 1, 0);

	LL sum = 0;
	for(int i = 1; i <= 3 * n; ++i)
	{
		sum += a[i];
		pq.push(a[i]);
		while(sz(pq) > n){ // 가장 작은것을 빼면서 n까지의 sum을 크게 유지
			sum -= pq.top();
			pq.pop();
		}
		l[i] = sum;
	}

	sum = 0;
	for(int i = 3 * n; i > 0; --i)
	{
		sum += a[i];
		pq2.push(a[i]);
		while(sz(pq2) > n){
			sum -= pq2.top();
			pq2.pop();
		}
		r[i] = sum;
	}

	LL ret = LLONG_MIN;
	for(int i = n; i <= 2 * n; ++i)
		ret = max(ret, l[i] - r[i + 1]);
	return ret;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> n;

	a.assign(3 * n + 1, 0);
	for(int i = 1; i <= 3 * n; ++i) cin >> a[i];

	cout << max_score() << endl;

	return 0;
}

Measured memory_bytes: 7288
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a,b,c,ma;
	cin>>a>>b>>c;
	ma=max({a,b,c});
	if(a+b+c==17 && ma==7){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}


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

#define int long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"

void sortArr(int arr[], int n) 
{ 
  
    // Vector to store element 
    // with respective present index 
    vector<pair<int, int> > vp; 
  
    // Inserting element in pair vector 
    // to keep track of previous indexes 
    for (int i = 0; i < n; ++i) { 
        vp.push_back(make_pair(arr[i], i)); 
    } 
  
    // Sorting pair vector 
    sort(vp.begin(), vp.end()); 
 
    for (int i = 0; i < vp.size(); i++) { 
        cout<< vp[i].second+1 << " " ; 

    } 
     cout<<endl;
} 
 
int32_t main()
{ 

	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	sortArr(a,n);


	return 0;
}

Measured memory_bytes: 3312
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;
typedef unsigned long long ull;

int n;

int main(){
  cin >> n;
  int a=n/2+n%2;
  cout << (double)a/n << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

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


int main() {
	vector<string>sts;
	string st;
	while (cin >> st) {
		sts.emplace_back(st);
	}
	int asize = sts.size() / 2 + 4;
	vector<vector<vector<int>>>walls(asize, vector<vector<int>>(asize, vector<int>(4)));
	for (int i = 0; i < sts.size() / 2+1; ++i) {
		for (int j = 0; j < sts[2*i].size(); ++j) {
			int num = sts[2*i][j] == '1';
			walls[i+1][j+2][1] = num;
			walls[i + 2][j + 2][3] = num;
		}
	}
	for (int i = 0; i < sts.size() / 2; ++i) {
		for (int j = 0; j < sts[2 * i+1].size(); ++j) {
			int num = sts[2 * i+1][j] == '1';
			walls[i +2][j+1][2] = num;
			walls[i + 2][j + 2][0] = num;
		}
	}
	vector<int>ways;
	int nway = 2;
	int nx = 2;
	int ny = 1;
	while (1) {
		assert(walls[ny][nx][(nway +3) % 4]);
		if (walls[ny][nx][nway]) {
			ways.emplace_back(nway);
			nway = (nway + 1) % 4;
		}
		else if (walls[ny + dy[nway]][nx + dx[nway]][(nway + 3) % 4]) {
			ways.emplace_back(nway);
			ny += dy[nway];
			nx += dx[nway];

			if (ny == 1 && nx == 2)break;
		}
		else if (walls[ny + dy[nway] + dy[(nway + 3) % 4]][nx + dx[nway] + dx[(nway + 3) % 4]][(nway + 2) % 4]) {
			ways.emplace_back(nway);
			//ways.emplace_back((nway + 3) % 4);
			ny += dy[nway] + dy[(nway + 3) % 4];
			nx += dx[nway] + dx[(nway + 3) % 4];
			nway = (nway + 3) % 4;
			if (ny == 1 && nx == 2)break;
		}
		else {
			ways.emplace_back(nway);
			//ways.emplace_back((nway + 3) % 4);
			//ways.emplace_back((nway + 2) % 4);
			ny += dy[(nway + 3) % 4];
			nx += dx[(nway + 3) % 4];
			nway = (nway + 2) % 4;
			if (ny == 1 && nx == 2)break;
		}
		if (nx == 2 && ny == 1)break;
	}
	string mp;
	mp = "LDRU";
	for (auto w : ways) {
		cout << mp[w];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3148
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	string s;
	int n, i, j, k;
	bool valid = true;
	cin >> s;
	n = s.length();
	for (i = 0; i < n; i++) {
		if ((i % 2 == 0) && (s[i] == 'L')) valid = false;
		if ((i % 2 == 1) && (s[i] == 'R')) valid = false;
	}
	if (valid) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
ans=set()
h=list(map(int,input().split()))
for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]>h[b-1]:
        ans.add(b-1)
    elif h[a-1]<h[b-1]:
        ans.add(a-1)
    else:
        ans.add(a-1)
        ans.add(b-1)
ans2=len(ans)
print(n-ans2)


Measured memory_bytes: 20108
l, r = map(int, input().split())
if r //2019 > l //2019:
    print(0)
else:
    res = 2018
    for i in range(l%2019, (r%2019)+1):
        for j in range(i+1, (r%2019)+1):
            res = min(res, (i*j)%2019)
    print(res)


Measured memory_bytes: 2940
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int N, T;
	int c[1000], t[1000];
	int min = 1001;
	cin >> N >> T;
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &c[i], &t[i]);
		if (t[i] <= T && min > c[i])min = c[i];
	}
	if (min == 1001)puts("TLE");
	else cout << min << endl;


	return(0);
}

Measured memory_bytes: 256
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const char s[4]={'R','G','B','Y'};

int main() {
	int n=read(),m=read(),k=read();
	for (int i=0;i<n;++i) {
		for (int j=0;j<m;++j) {
			int x=(m+i+j)/k&1,y=(m+i-j)/k&1;
			putchar(s[x<<1|y]);
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 3628
n = int(input())
a = list(map(int, input().strip().split()))
q = int(input())
MAX = 1000000 + 1
p = [0] * MAX
si = 0
for i in range(n):
    p[a[i]] += 1
    si += a[i]

ans = []
for i in range(q):
    b, c = map(int, input().split())

    if p[b] > 0:
        si = si - b * p[b] + c * p[b]
        p[c] += p[b]
        p[b] = 0

    ans.append(si)

for i in range(q):
    print(ans[i])


Measured memory_bytes: 24056
/***************************************************
 * Problem Name : C.cpp
 * Problem Link :
 * Contest Name :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2019-07-22
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<cstring>
#include<string>
#include<sstream>
#include<cmath>
#include<vector>
#include<queue>
#include<cstdlib>
#include<deque>
#include<stack>
#include<map>
#include<set>
#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin);
#define __FileWrite freopen ("output.txt", "w", stdout);
#define SET(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define pll pair <ll, ll>
#define debug cout <<"#########\n";
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define Pow2(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define Max3(a, b, c) max(a, max(b, c))
#define Min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
std::string NumberToString ( T Number ) {
    std::ostringstream ss;
    ss << Number;
    return ss.str();
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    int A, B, C;
    cin >> A >> B >> C;
    int tc = 1000000;
    int i = 0;
    bool f = false;

    while (i < tc) {
		if (A & 1 || B & 1 || C & 1) {
            //~ cout << i << "\n";
            //~ exit (0);
            //~ return 0;
            f = true;
            break;
        }
        int AA = (B / 2) + (C / 2);
        int BB = (A / 2) + (C / 2);
        int CC = (A / 2) + (B / 2);
        A = AA, B = BB, C = CC;
        i++;

        
    }

    if (!f) cout << -1 << "\n";
    else cout << i << "\n";

    //~ cout << -1 << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
long long N,ans;
vector<string> V;
int main(){
  cin >> N;
  ans=0;
  long long i=1;
  while(i*(i+2)<=N){
    if (N%i==0){
      ans+=(N/i-1);
//      cout << N/i-1 << endl;
    }
    i++;
  }
  cout << ans << endl;
}


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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  preprocess();
  int a, b; cin>>a>>b;
  int ans = -1;
  rep(i,1,100000) {
    if((i*8)/100 == a && (i*10)/100 == b) {
      ans = i;
      break;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef pair<ll,pi> pii;
typedef vector<pi> vpi;
typedef set<ll> si;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define f first
#define s second
ll INF = 1e9;
ll MOD = 1e9;
#define lb lower_bound
#define ub upper_bound
#define SZ(x) (ll)x.size()
#define ALL(x) x.begin(),x.end()

ll N,S,D;

vi fact;

int main(){
  // freopen("in.txt","r",stdin);
  cin >> N >> S;
  D = N-S;
  if (N < S){
    cout<<-1;
    return 0;
  }

  if (N == S){
    cout<<N+1;
    return 0;
  }

  for (ll i = 2;i*i<=N;++i){
    ll t = N;
    ll d = 0;
    while(t){
      d += t%i;
      t /= i;
    }
    if (d == S){
      cout<<i;
      return 0;
    }
  }


  for (ll i = 1; i*i<N && i<=S;++i){
    if (D%i == 0){
      fact.pb(D/i);
    }
  }
  
  reverse(ALL(fact));

  for (auto v : fact){
    ll b = v+1;
    ll a = D/v;
    ll c = N - a*b;
    if (c > b)continue;
    if ((a+1) * b <= N)continue;
    if (a * b > N)continue;
    if (a + c != S)continue;
    cout<<b;
    return 0;
  }
  cout<<-1;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int f;

  cin >> f;

  cout << (f-30) / 2 << endl;
  
  return 0;
}



Measured memory_bytes: 3080