akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll n; cin >> n; vl num(200000); ll sum = 0;
  vl num2(200000);
  
  for(ll i=1; i <= n; i++){
    ll x; cin >> x;
    if( i + x >= 0 && i + x < 200000){
      num[i+x]++;
    }
    
    if( i - x >= 0 && i - x < 200000){
      num2[i-x]++;
    }
  }
  
  rep(i,200000){
    sum += num[i]*num2[i];
  }
  
  cout << sum << endl;
}

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



int main(){
    int N,C,K;
    cin>>N>>C>>K;
    vector<int> data(N);
    for(int i=0;i<N;i++)cin>>data[i];

    sort(data.begin(),data.end());

    int count=0;

    for(int i=0;i<N;){
        
        int saisyo=data[i];
        int c_count=1;
        count++;
        if(i==N-1)break;
        if(data[i+1]-saisyo<=K){
            for(;i<N;){
            if(data[i+1]-saisyo<=K&&c_count<C){
                i++;
                c_count++;
                if(i==N)break;}
            else break;    
            }

        }else{
            i++;
            continue;
        }
        i++;
        

    }
    cout<<count<<endl;

}
    



Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define f(i,a,b) for(ll i=a;i<=b;i++)
#define g(i,a,b) for(ll i=a;i>=b;i--)
#define F first
#define vv vector
#define S second
#define mp make_pair
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq priority_queue
using namespace std;

void CountTriangles(vector <int> A){

    int n=A.size();

    sort(A.begin(), A.end());

    int count = 0;

    for( int i = n-1; i >= 1; i--){
        int l = 0, r = i-1;
        while( l < r){
            if( A[l] + A[r] > A[i]){


                count += r - l ;
                r--;
            }
            else

                l++;
        }
    }
    cout<<count;
}

int main()
{

ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n;
cin>>n;
ll a[n];
f(i,0,n-1) cin>>a[i];

vector<int> b;
f(i,0,n-1) b.pb(a[i]);
CountTriangles(b);
}







Measured memory_bytes: 384
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑




int main() {
	int n, k[25], mon, ans = 1;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> k[i];
		if (i == 0) { mon = k[0]; }
		else {
			if (mon <= k[i]) { ++ans; }
			mon = max(mon, k[i]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<string>vec(n);
  for(int i=0;i<n;i++) cin >> vec.at(i);
  int ac=0;  int wa=0;  int tle=0;  int re=0;
  for(int i=0;i<n;i++){
    if(vec.at(i)=="AC") ac++;
    else if(vec.at(i)=="WA") wa++;
    else if(vec.at(i)=="TLE") tle++;
    else if(vec.at(i)=="RE") re++;
  }

  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}

Measured memory_bytes: 6336
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  char X; cin>>X;
  X=X+1;
  cout<<X<<endl;
  }


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans[] = { "Yes", "No" };
		int an = 0;
		sc.close();
		char tmp[] = s.toCharArray();
		Arrays.sort(tmp);
		int cnt = 1;
		if(tmp[0] != tmp[1] || tmp[2] != tmp[3])an = 1;
		if(tmp[0] == tmp[2])an = 1;
		System.out.println(ans[an]);
	}
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<bool> vb;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sq(x) ((x)*(x))
#define fo(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<"\n"
#define fi first
#define se second
const double pi = 3.14159265358979323846;
#define uni(c) (c).resize(unique(all(c))-(c).begin())
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//pair <int, int> w[4] = {mp(-1, 0), mp(0, -1), mp(1, 0), mp(0, 1)};   // for matrix movement:
void cp()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void solve()
{
	ll n, m; cin >> n >> m;
	ll temp = m;
	ll c = 0;
	if (n * 2 > m or n * 4 < m or m % 2)
	{
		cout << "No";
		return;
	}
	for (int i = 0; i <= n; i++)
	{
		if ((i * 2) + (4 * (n - i)) == m)
		{
			cout << "Yes";
			return;
		}
	}
	cout << "No";

}
int main()
{
	fast;
	//cp();
	ll t = 1;
	//cin >> t;
	while (t--)
		solve();


	return 0;
}

Measured memory_bytes: 3652
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	d = getlist()
	ans = 0
	for i in range(N):
		for j in range(i + 1, N):
			ans += d[i] * d[j]
	print(ans)
	


if __name__ == '__main__':
	main()

Measured memory_bytes: 3444
#include <stdio.h>
#include <iostream>
 
using namespace std;
 
int N;
int M;
int A;
 
int main(void){
	cin >> N;
	int A[N];
    for (int i = 0; i < N; i++) {
        A[i] = 0;
    }
    for (int i = 1; i < N; i++) {
        cin >> M;
        A[M]++;
    }
    for (int i = 1; i < N; i++) {
        cout << A[i] << "\n";
    }
    cout << "0";
}

Measured memory_bytes: 4424
#include <iostream>
using namespace std;
int main(void){
    int n,m,A[123][123],b[123];
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>A[i][j];
        }
    }
    for(int i=0;i<m;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        int s=0;
        for(int j=0;j<m;j++){
            s+=(A[i][j]*b[j]);
        }
        cout<<s<<endl;
    }
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int64_t mod=1000000007;
vector<int64_t> f(1000010),fi(1000010);
int64_t pw(int64_t a,int64_t b){
  int64_t z;
  if(b==0) return 1;
  else{
    z=pw(a,b/2)*pw(a,b/2)%mod;
    if(b%2==1) z=z*a%mod;
    return z;
  }
}
int64_t comb(int64_t a,int64_t b){
  return f.at(a)*fi.at(b)%mod*fi.at(a-b)%mod;
}
int main(){
  int64_t x,y,i;
  cin>>x>>y;
  f.at(0)=1; fi.at(0)=1;
  for(i=1;i<=max(x,y);i++){
    f.at(i)=f.at(i-1)*i%mod;
    fi.at(i)=fi.at(i-1)*pw(i,mod-2)%mod;
  }
  if(x==y){
    if(x%3>0) cout<<0<<endl;
    else cout<<comb(x/3*2,x/3)<<endl;
  }
  else{
    if(x>y) swap(x,y);
    if((x+y)%3>0) cout<<0<<endl;
    else if(2*x<y) cout<<0<<endl;
    else cout<<comb((x+y)/3,(2*x-y)/3)<<endl;
  }
}

Measured memory_bytes: 16000
s = raw_input()
p = raw_input()

slen = len(s)
plen = len(p)
flag = False

for i in xrange(len(s)):
    j = 0
    while(j < plen and s[(i+j)%slen] == p[j]):
        j += 1
    if (j == plen):
        flag = True

if(flag):
    print "Yes"
else:
    print "No"

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

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int x = Integer.parseInt(in.next());
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.next());
            }
            int ans = 0;
            int sum = 0;
            Arrays.sort(a);

            for (int i = 0; i < n; i++) {
                if (i < n - 1) {
                    if (x >= a[i]) {
                        ans++;
                        x -= a[i];

                    } else {
                        break;
                    }
                } else {
                    if (x == a[i]) ans++;
                }
            }

            // 出力
            out.println(ans);

        }

    }
}



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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int T, X;
    std::cin >> T >> X;
    std::cout << T / (double)X << std::endl;

    return 0;
}


Measured memory_bytes: 256
<?php
$a = trim(fgets(STDIN));
//$a = 46979;

$h = floor($a / 3600);
$m = floor(($a - $h * 3600) / 60);
$s = floor($a - $h * 3600 - $m * 60);
echo($h . ":" . $m . ":" . $s);
?>

Measured memory_bytes: 15204
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	k, a, b := io.NextInt(), io.NextInt(), io.NextInt()
	for i := a; i <= b; i++ {
		if i%k == 0 {
			io.Println("OK")
			return
		}
	}
	io.Println("NG")
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 1776
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 200001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

int main(){
  ll h,w; cin >> h >> w;
  vector<vector<char>> table(h,vector<char>(w));
  
  rep(i,h){
    rep(j,w){
      cin >> table[i][j];
    }
  }
  
  ll hnotwhite = h;
  for(ll i=0; i < hnotwhite; i++){
    bool flag = true;
    rep(j,w){
      if(table[i][j] == '#') flag = false;
    }
    
    if(flag){
      hnotwhite--;
      for(ll j=i; j < h-1; j++){
        rep(k,w){
          table[j][k] = table[j+1][k];
        }
      }
      rep(j,w){
        table[h-1][j] = '.';
      }
      i--;
    }
  }
  
  
  ll wnotwhite = w;
  for(ll i=0; i < wnotwhite; i++){
    bool flag = true;
    rep(j,h){
      if(table[j][i] == '#') flag = false;
    }
    
    if(flag){
      wnotwhite--;
      for(ll j=i; j < w-1; j++){
        rep(k,h){
          table[k][j] = table[k][j+1];
        }
      }
      rep(j,h){
        table[j][w-1] = '.';
      }
      i--;
    }
  }
  
  rep(i,hnotwhite){
    rep(j,wnotwhite){
      cout << table[i][j];
      if(j == wnotwhite - 1) cout << endl;
    }
  }
  
  
}

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



int desc( const void *a ,const void *b )
{
	return *( int* )b - *( int* )a ;
}



int main()
{
	int i ;


	int p ,d1 ,d2 ;

	int n ;
	while( scanf( "%d" ,&n ) )
	{
		long walk[ 10000 ] = { 0 } ;



		if( n == 0 )
		{
			return 0 ;
		}


		for( i = 0 ; i < n ; ++i )
		{
			scanf( "%d %d %d" ,&p ,&d1 ,&d2 ) ;


			walk[ i ] = ( d1 + d2 ) * 100000 + p ;
		}



		qsort( walk ,n ,sizeof( long ) ,desc ) ;


		printf( "%d %d\n" ,walk[ 0 ] % 100000 ,walk[ 0 ] /100000 ) ;
	}
}

Measured memory_bytes: 804
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define str string
#define ld long double
#define vec vector
#define vll vec<ll>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()
#define kai "\n"
#define yuque priority_queue
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mie min_element
#define mae max_element
#define tos to_string
#define sep setprecision
#define lob lower_bound
#define upb upper_bound
#define nep next_permutation
#define MOD 1000000007ll
#define MIN (1e-10)
#define equal(a,b) (abs((a)-(b))<MIN)
#define v2 ten
#define chokusen senbun
#define kakkei vec<ten>
using namespace std;
void solve();
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed;
	solve();
}
struct pea{
	ll f,s;
	bool operator<(const pea &p)const{
		return f!=p.f?f<p.f:s<p.s;
	};
};
struct tri{
	ll f,s,t;
	bool operator<(const tri &p)const{return f<p.f;};
};
class ten{
public:
	ld x,y;
	ten operator+(ten p){return{x+p.x,y+p.y};}
	ten operator-(ten p){return{x-p.x,y-p.y};}
	ten operator*(ld k){return{k*x,k*y};}
	ten operator/(ld k){return{x/k,y/k};}
	ld abs(){return sqrt(abs2());}
	ld abs2(){return x*x+y*y;};
	bool operator<(const ten &p)const{return x!=p.x?x<p.x:y<p.y;};
	bool operator==(const ten &p)const{
		return (-MIN<x-p.x)&&(x-p.x<MIN)&&(-MIN<y-p.y)&&(y-p.y<MIN);
	};
	ld naiseki(v2 b){return x*b.x+y*b.y;}
	ld gaiseki(v2 b){return x*b.y-y*b.x;}
};
struct senbun{ten p1,p2;};
struct en{ten o;ld r;};
void dijkstra(const vec<vec<pea>> &c,ll v,vll &d){
	d[v]=0;
	ll n=c.size();
	ll count=1;
	vec<bool> seen(n,false);
	seen[v]=true;
	yuque<pea> hen;
	rep(i,0,c[v].size())hen.push({-c[v][i].f,c[v][i].s});
	while(count!=n){
		if(hen.empty())break;
		pea k=hen.top();hen.pop();
		while(seen[k.s]){
			if(hen.empty()){
				count=-1;
				break;
			}
			k=hen.top();
			hen.pop();
		}
		if(count==-1)break;
		d[k.s]=-k.f;
		count++;
		seen[k.s]=true;
		rep(i,0,c[k.s].size())hen.push({k.f-c[k.s][i].f,c[k.s][i].s});
	}
}
void solve(){
	ll v,e,r;cin>>v>>e>>r;
	vec<vec<pea>> c(v);
	rep(i,0,e){
		ll s,t,d;cin>>s>>t>>d;
		c[s].pub({d,t});
	}
	vll ans(v,MOD);
	dijkstra(c,r,ans);
	rep(i,0,v){
		if(ans[i]==MOD)cout<<"INF"<<kai;
		else cout<<ans[i]<<kai;
	}
}


Measured memory_bytes: 21548
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <deque>
#include <valarray>
#include <unordered_map>
#include <unordered_set>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define PF first
#define PS second
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;}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
#define OUT(x) cout << x << endl;
#define OUTD(x) cout << fixed << x << endl;
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 1000000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  IN(ll,N);
  IN(ll,L);
  ll sum = (2*L + N - 1)*N/2;
  if(L >= 0){
    sum -= L;
  }else if(-L >= N){
    sum -= N + L - 1;
  }
  OUT(sum);
}

Measured memory_bytes: 256
n=int(input())
klist=[]
MOD=10**9+7
ans=1
kaijo=list(range(n+1))
for i in range(2,n+1):
    kaisu=0
    for j in range(1,n+1):
        while kaijo[j]%i==0:
            kaijo[j]=kaijo[j]//i
            kaisu+=1
    if kaisu!=0:
        klist.append(kaisu%MOD)
for i in range(len(klist)):
    ans*=((klist[i]+1)%MOD)
ans=ans%MOD
print(ans)

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

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

typedef long long int ll;

//const ll INF=(ll)1e18;
const int INF=(1<<30);

int main(){
  int N,W;
  cin >> N >> W;
  vector<int> w(N),v(N);
  REP(i,N){
    cin >> w[i] >> v[i];
  }

  vector<ll> dp(W+1,-1);
  dp[0]=0;

  REP(i,N){
    for(int j = W; j >=0; j--){
      if(dp[j]==-1)continue;
      if(j+w[i]>W)continue;

      dp[j+w[i]] = max(dp[j+w[i]], dp[j]+v[i]); 
    }
  }

  ll ans=0;
  REP(i,W+1){
    if(dp[i]==-1)continue;
    ans = max(ans,dp[i]);
  }
  cout << ans << endl;
}



Measured memory_bytes: 1024
/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.

*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;
typedef long long ll;

int mod = 1000000007;
ll dp[100005];;

ll gcd(long long a,long long b){

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

bool compare(pair<int,int>p1, pair<int,int>p2){

  return p1.second > p2.second;
 }
/*
 int main(){

  long long n,cnt=0;
  cin>>n;

  long long a[n];
  bool tells[n] = {false};

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

  for(int i=0;i<n-1;i++){
   for(int j=i+1;j<n;j++){

     long long sum = a[i]+a[j];
     if(sum %2 == 0){
        if(tells[i] == false && tells[j] == false){
          tells[i] = true; tells[j] = true;
        cnt++;
         break; }
     }
   }
  }

  cout<<cnt<<endl;

 return 0;
 }
*/

int main(){

 string a,b;
 string maxi,mini;
 int pos=-1;

 cin>>a>>b;

  if(a.length() > b.length()){
     maxi = a;
     mini = b; }
  else  if(b.length() > a.length()){
      maxi = b;
    mini = a; }
  else if(a.length() == b.length()){
      maxi = a;
      mini = b; }

 for(int i=0;i<mini.length();i++)
 {
    cout<<maxi[i];
    cout<<mini[i];
    pos = i;
 }

 for(int j=mini.length();j<maxi.length();j++)
    cout<<maxi[j];

 cout<<endl;

return 0;
}


Measured memory_bytes: 3564
#include <iostream>
#include <cstdlib>
#include <string>

int main(){
std::string line;
/*
std::getline(std::cin, line);
int space = line.find(" ");
unsigned long int N = atoi(line.substr(0, space).c_str());
unsigned long int M = atoi(line.substr(space+1).c_str());
*/
unsigned long int N, M;
std::cin >> N >> M;

// using S
unsigned long int s = N > M/2 ? M/2 : N;

// using c
M -= 2*s;
unsigned long int c = M/4;

std::cout << s+c << std::endl;

return 0;
}

Measured memory_bytes: 256
def include_3 (x):
#     print(" xは　%d" % x,end="")
    if x < 1:
        return False
    elif x % 10 == 3:
        return True
    else:
        return include_3(x // 10)

n = int(input())

for i in range (1,n+1):
    if i % 3 == 0:
        print(" %d" % i,end="")
    elif include_3(i) :
        print(" %d" % i,end="")
print()


Measured memory_bytes: 5876
A,B,C,X,Y = map(int,input().split())

if A+B<2*C:
    tmp=A+B
else:
    tmp=2*C

ans=tmp*min(X,Y)

#print(ans)

X2=X-min(X,Y)
Y2=Y-min(X,Y)

a1=X2*A+Y2*B
a2=X2*2*C+Y2*2*C

if a1<a2:
    print(ans+a1)
else:
    print(ans+a2)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

#include <map>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    vector<ll> A(n + 1, 0);
    REP(i, 0, n) {
        ll a;
        cin >> a;
        A[i + 1] = (A[i] + a) % k;
    }
    REP(i, 1, n + 1) {
        A[i] -= i;
    }
    ll ans = 0;
    map<ll, ll> m;
    REP(i, 0, n + 1) {
        dump(A[i], m[A[i]]);
        if (i >= k) {
            m[A[i - k]]--;
        }
        ans += m[A[i]];
        ans += m[A[i] + k];
        ans += m[A[i] - k];
        m[A[i]]++;
        dump(ans);
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	if (s < t) {
		cout << "Yes" << '\n';
	} else {
		cout << "No" << '\n';
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 105
using namespace std;
int n,m,L,R,M=2019;
signed main(){
	scanf("%d%d",&L,&R);
	if(R-L+1>=2019){
		puts("0");
		return 0;
	}
	L%=M,R%=M;
	if(R<=L){
		puts("0");
		return 0;
	}
	int ans=2019;
	for(int i=L;i<R;i++)
		for(int j=i+1;j<=R;j++)ans=min(ans,i*j%M);
	printf("%d\n",ans);
	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++)

int main(){
int n;
  cin >>n;
vector<double> a(n);
  rep(i,n) cin >>a.at(i);
  
double gyaku=0;
  double x;
  rep(i,n){
    x = 1/a.at(i);
    gyaku += x;
          }
  
double ans = 1/gyaku;
  cout << fixed << setprecision(10);
  cout <<ans<<endl;
}  

Measured memory_bytes: 256
n = int(input())
s = "abcdefghijklmnopqrstuvwxyz"
for i in range(n):
  sent = input().rstrip()
  l = [i for i in sent]
  c = 0
  for a in range(26):
    for b in range(26):
      l2 = []
      for i in range(len(l)):
        if l[i] in s:
          l2.append(s[(s.index(l[i])*a+b)%26])
        else:
          l2.append(l[i])
      sent2 = "".join(l2)
      if ("that" in sent2) or ("this" in sent2):
        print(sent2)

Measured memory_bytes: 7656
#include <bits/stdc++.h>
using namespace std;
int main()
{ long long int h,w;
  cin>>h>>w;
  if((h==1)||(w==1)) cout<<"1\n";
  else{
  if((h%2==1)&&(w%2==1))
  cout<<( (h*w)/2 )+1<<endl;
  else cout<<(h*w)/2<<endl;
  }
}

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

using namespace std;

typedef long long int ll;

int n;
vector < ll > a;

ll solve (ll val) {
  ll cnt = 0;
  for (int i = 0; i < n; i++) {
    int lo = i + 1, hi = n - 1;
    int idx = -1;

    while (lo <= hi) {
      int mid = (hi - lo) / 2 + lo;
      if (a[i] * a[mid] < val) {
        idx = mid;
        if (a[i] > 0) {
          lo = mid + 1;
        } else {
          hi = mid - 1;
        }
      } else {
        if (a[i] > 0) {
          hi = mid - 1;
        } else {
          lo = mid + 1;
        }
      }
    }

    if (idx == -1) continue;
    if (a[i] > 0) {
      cnt += idx - i;
    } else {
      cnt += n - idx;
    }
  }

  return cnt;
}

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

  ll k;
  cin >> n >> k;
  a.resize (n);
  for (auto &i : a) cin >> i;
  sort (a.begin(), a.end());

  ll lo = -1e18, hi = 1e18;
  ll ans;
  while (lo <= hi) {
    ll mid = (hi - lo) / 2 + lo;
    if (solve (mid) >= k) {
      ans = mid;
      hi = mid - 1;
    } else {
      lo = mid + 1;
    }
  }

  cout << ans - 1 << '\n';
}


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



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

	int N; cin >> N;
	int v; cin >> v;
	queue<string> q;
	string s1, s2;
	for (int i = 0; i < N; i++) {
		cin >> s1 >> s2;
		q.push(s1);
		q.push(s2);
	}
	int t = 0;
	string name;
	while (!q.empty()) {
		name = q.front();
		q.pop();
		int x = stoi(q.front());
		q.pop();
		if (x <= v) {
			t += x;
			cout << name << " " << t << endl;
		}
		else {
			x -= v;
			q.push(name);
			q.push(to_string(x));
			t += v;
		}
	}
}


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

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

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

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

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

ll T = 1;
ll n, k, l, q, x, y, m;
string s, t;

ll rem;
ll cnt[3];


// < ----------- func eh ---------------- ? //



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

void MAIN() {
	cin >> n >> k;
	ll cou = 0;
	for(ll i=0;i<n;i++) {
		cin>>x;
		cou += (x >= k);
	}
	cout << cou;
}

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

Measured memory_bytes: 3624
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int length;
    string S;
    cin >> length >> S;

    int balance = 0;
    string beginning, ending;

    for(int i = 0; i < S.size(); i++)
    {
        balance += (S[i] == '(' ? 1 : -1);

        if(balance < 0) //Extra
        {
            beginning += '(';
            balance++;
        }
    }

    for(int i = 1; i <= balance; i++)
        ending += ')';

    string answer = beginning + S + ending;
    cout << answer;

    return 0;
}


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

#define      pb    push_back
#define      ff    first
#define      ss    second
#define      ll    long long int
#define      endl  "\n"
#define      FASTIO        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


#define      TEST    int t ; cin >> t ; while( t -- )

const ll big = 10e7 + 11 ;
const double PI  =3.141592653589793238463;

int  main (  ) {

    FASTIO ;

    double n , m ;
    cin >> n >> m ;

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

        n -= x ;
    }

    if( n >= 0 ) cout << n ;
     else cout << -1 ;


    return  0 ;
}


Measured memory_bytes: 3804
#[allow(unused_macros)]
macro_rules! debug {
	($($a:expr),*) => {
		println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
	}
}

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();

    let ans = n * (n + 1) / 2 - n;
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr, U: std::str::FromStr>(
        &mut self,
        n: usize,
    ) -> Vec<(T, U)> {
        (0..n)
            .map(|_| (self.read::<T>(), self.read::<U>()))
            .collect::<Vec<(T, U)>>()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <ctime>
#include <random>
#include <bitset>
#include <cstring>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) 
#define ll long long
#define eps 1e-8
#define inf INT_MAX
using namespace std;

int main() {
	speed;
	int n;
	cin >> n;
	double a, ans = 0;
	string b;
	for (int i = 0; i < n; ++i) {
		cin >> a >> b;
		if (b == "JPY")
			ans += a;
		else
			ans += 380000.0 * a;
	}
	cout.precision(6);
	cout << fixed << ans;
}

Measured memory_bytes: 256
c={}
N=int(input())
for i in range(N):
  s=input()
  if s not in c:
    c[s]=1
  else:
    c[s]+=1
n=max(c.values())
L=list()
for i in c:
  if c[i]==n:
    L.append(i)
L=sorted(L)
for i in L:
  print(i)

Measured memory_bytes: 145464
type ABC(stream:System.IO.TextReader) =
  member this.Scan1 f = stream.ReadLine() |> f
  member this.ScanVecV n f = [| for i in 1..n -> stream.ReadLine() |> f |]

let util = ABC(stdin)

let N = util.Scan1 int
let xs = util.ScanVecV N (fun x -> x.Split() |> fun a -> a.[0], (int a.[1]))

xs
|> Array.indexed
|> Array.sortWith (fun (_,(a1,b1)) -> fun (_,(a2,b2)) ->
    match compare a1 a2 with
    | 0 -> compare b2 b1 // desc on score
    | n -> n
    )
|> Array.map (fst >> ((+) 1))
|> Array.iter (printfn "%d")

Measured memory_bytes: 14300
#include<cstdio>
char str[100];
int main()
{
    scanf("%s",str);
    for(int i=0;i<19;i++)
    {
        if(str[i]==',')
        {
            printf(" ");
            continue;
        }
        printf("%c",str[i]);
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  int ans = a * x + b * y;
  for(int i=2; i<=max(x,y)*2; i+=2) {
    int temp_ans = 0;
    if(x >= i / 2 && y >= i / 2) {
      temp_ans = (x - i/2) * a + (y - i/2) * b + i * c;
    }
    if(x >= i / 2 && y < i / 2) {
      temp_ans = (x - i/2) * a + i * c;
    }
    if(x < i / 2 && y >= i / 2) {
      temp_ans = (y - i/2) * b + i * c;
    }
    if(temp_ans != 0 && temp_ans <= ans) ans = temp_ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;
        Solver s = new Solver();
        for (int i = 1; i <= t; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }

}

class Solver {

    void solve(int test, InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int[] a = new int[n];
        long ans = 0;
        long A = in.nextLong();
        long B = in.nextLong();
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 1; i < n; i++) {
            long d1 = a[i] - a[i - 1];
            d1 *= A;
            ans += Math.min(d1, B);
        }
        out.println(ans);
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
        st = null;
    }

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

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

    public long nextLong() {
        return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
        return br.readLine();
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 35852
tt = 0
th = 0
n = int(input())
for i in range(n):
    t, h = map(str, input().split())
    if [t, h] != sorted([t, h]):
        tt += 3
    elif t == h:
        tt += 1
        th += 1
    else:
        th += 3
print(str(tt) + " " + str(th))


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

using namespace std;

int main(void) {
  int x, a, b; cin >> x >> a >> b;
  
  if (abs(a-x) < abs(b-x)) {
    cout << "A" << endl;
  } else {
    cout << "B" << endl;
  }

  return 0;
}

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

int cal(vector<int> k,int x){
  int sum=0;
  for(int i=0;i<k.size();i++)sum+=(k.at(i)-x)*(k.at(i)-x);
  return sum;
}

int main(){
  int n,min=90000000;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin >> a.at(i);
  for(int i=-100;i<=100;i++){
    if(cal(a,i)<min)min=cal(a,i);
  }
  cout << min << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	s := make([]int, 3) 
	for i := 0; i < 3; i++ {
		fmt.Scan(&s[i])
	}
	sort.Ints(s)
	fmt.Println(s[2] * 10 + s[1] + s[0])
	
}

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

#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define endl '\n'
#define eps  1e-9
const double pi=acos(-1);
const int mod=1e9+7;
//------------------------


int32_t main()
{ 
  io;
 
  
  map<char,char> m;
  char a;

  m['A']='T';
  m['T']='A';
  m['C']='G';
  m['G']='C';

  cin>>a;
  cout<<m[a];
 
 return 0;
}

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

using namespace std;

#define make_unique(a) (a.erase(unique(a.begin(),a.end()),a.end()))
#define allof(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define exists(s, e) (s.find(e)!=s.end())
#define INF 0x3f3f3f3f
#define endl '\n'
#define mp make_pair
#define readln(x) (getline(cin, x))
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))

typedef pair<int, int> pii;
typedef long long ll;

ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

void solve() {
    vector<int> v(4);
    for(int i=0; i<4; i++) cin >> v[i];
    sort(allof(v));
    if(v[0]==1 and v[1]==4 and v[2]==7 and v[3]==9) cout << "YES" << endl;
    else cout << "NO" << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    solve();
    return 0;
}



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

int main() {
    ll h;
    cin >> h;
    ll ans = 1;
    ll atk = 2;
    while (h > 1) {
        h /= 2;
        ans += atk;
        atk *= 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 3005
using namespace std;
const int p = 1000000007;
int sum[N],a[N],n,m;
char s[N];
int r[N],f[N][N];
int main()
{
    scanf("%d%d",&n,&m);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++)a[i]=s[i]-'0',sum[i]=sum[i-1]+a[i];
    int t1,t2;
    for(int i=1;i<=n;i++)r[i]=i;
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&t1,&t2);
        r[t1]=max(r[t1],t2);
    }
    f[0][0]=1;int now=0;
    for(int i=1;i<=n;i++)
    {
        now=max(now,r[i]);
        for(int j=0;j<=n;j++)
        {
            if(f[i-1][j])
            {
                if(sum[now]!=j+now-i+1)(f[i][j]+=f[i-1][j])%=p;
                if(sum[now]!=j)(f[i][j+1]+=f[i-1][j])%=p;
            }
        }
    }
    int ans=0;
    for(int i=0;i<=n;i++)ans+=f[n][i],ans%=p;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 33920
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    int H,W; cin >> H >> W;
    int h,w; cin >> h >> w;

    vector<vector<bool>> a(H,vector<bool>(W,false));
    for(int i=0;i<h;i++){
        for(int j=0;j<W;j++){
            a[i][j] = true;
        }
    }
    for(int i=0;i<w;i++){
        for(int j=0;j<H;j++){
            a[j][i] = true;
        }
    }

    int ans = 0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(!a[i][j]) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}



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

using namespace std;
using ll = long long;
using bs = pair<int, string>;
using lsl = pair<ll, bs>;

map<bs, ll> cost;
vector<bs> sts;

bool isPalindrome(const string& s, int ini, int fim){
    return ini > fim ? true : (s[ini] == s[fim] && isPalindrome(s, ini + 1, fim - 1));
}

ll dijkstra(){
    set<lsl> q;
    q.insert({0, {1, ""}});
    int i, j;

    while(!q.empty()){
        ll dist = q.begin()->first;
        string sFrom = q.begin()->second.second;
        bool side = q.begin()->second.first;
        q.erase(q.begin());
        if(side){
            for(bs p: sts){
                string sTo = p.second;
                bool good = true;
                for(i = 0, j = sTo.length() - 1; i < sFrom.size() && j >= 0; i++, j--)
                    good &= sTo[j] == sFrom[i];

                if(good){
                    string nxt;
                    if (i < sFrom.size())
                        nxt = sFrom.substr(i);
                    if (j >= 0)
                        nxt = sTo.substr(0, j + 1);

                    ll dist2 = dist + p.first;
                    bool side2 = i < sFrom.size() || nxt.empty();

                    bs pnxt = {side2, nxt};
                    if (!cost.count(pnxt)){
                        cost[pnxt] = dist2;
                        q.insert({dist2, pnxt});
                    }else if(dist2 < cost[pnxt]){
                        q.erase({cost[pnxt], pnxt});
                        cost[pnxt] = dist2;
                        q.insert({dist2, pnxt});
                    }
                }
            }
        }else{
            for(bs p: sts){
                string sTo = p.second;
                bool good = true;
                for(i = sFrom.length() - 1, j = 0; i >= 0 && j < sTo.length(); i--, j++)
                    good &= sTo[j] == sFrom[i];
                if(good){
                    string nxt;

                    if (i >= 0)
                        nxt = sFrom.substr(0, i + 1);
                    if (j < sTo.length())
                        nxt = sTo.substr(j);

                    ll dist2 = dist + p.first;
                    bool side2 = j < sTo.length() || nxt.empty();

                    bs pnxt = {side2, nxt};
                    if (!cost.count(pnxt)){
                        cost[pnxt] = dist2;
                        q.insert({dist2, pnxt});
                    }else if(dist2 < cost[pnxt]){
                        q.erase({cost[pnxt], pnxt});
                        cost[pnxt] = dist2;
                        q.insert({dist2, pnxt});
                    }
                }
            }
        }
    }

    ll ans = LONG_LONG_MAX;
    for(auto p: cost){
        string s = p.first.second;
        if (isPalindrome(s, 0, (int)s.length() - 1))
            ans = min(p.second, ans);
    }
    if(ans == LONG_LONG_MAX)
        ans = -1;
    return ans;
}

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    int i, j, n;
    cin >> n;
    sts.resize(n);

    for(i = 0; i < n; i++){
        string s;
        ll c;
        cin >> s >> c;
        sts[i] = {c, s};
    }

    cout << dijkstra() << endl;
    return 0;
}

Measured memory_bytes: 3772
from math import factorial

N, K = map(int, input().split())
M = 1000000007

ans = 0
j = 0
a = N + 2 - K
for i in range(0, N+1):
    n = min(N + 1 - i, a)
    ans -= i * n % M
for i in range(N, 0, -1):
    j = N - i
    n = min(N + 1 - j, a)
    ans += i * n % M
print((ans + N + 2 - K) % M)



Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a;
    std::deque<int> deq;
    for (int i=0;i<3;i++) {
        cin>>a;
        deq.emplace_back(a);
    }
    sort(deq.begin(),deq.end());
    cout<<deq[0]+deq[1]<<endl;
}


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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > Matrix;


int main() {
	lli a, b, c, d, i, j, k, l, u, m, x;

	cin >> a >> b >> c >> d;
	
	j = b / c - a / c;
	if (a%c == 0)j++;
	k = b / d - a / d;
	if (a%d == 0)k++;

	if (c > d) {
		l = d;
		u = c;
	}
	else {
		l = c;
		u = d;
	}
	while (u%l != 0) {
		m = u % l;
		u = l;
		l = m;
	}
	i = c * d / l;
	m = b / i - a / i;
	if (a%i == 0)m++;

	cout << b - a + 1 - (j + k) + m;

	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))

from collections import defaultdict
class UnionFind:
    def __init__(self, N=None):
        if N is None or N < 1:
            self.parent = defaultdict(lambda: -1)
        else:
            self.parent = [-1]*int(N)

    def root(self, n):
        if self.parent[n] < 0:
            return n
        else:
            m = self.root(self.parent[n])
            self.parent[n] = m
            return m

    def merge(self, m, n):
        rm = self.root(m)
        rn = self.root(n)
        if rm != rn:
            if -self.parent[rm] < -self.parent[rn]:
                rm, rn = rn, rm
            self.parent[rm] += self.parent[rn]
            self.parent[rn] = rm

    def size(self, n):
        return -self.parent[self.root(n)]
    
    def connected(self, m, n):
        return self.root(m) == self.root(n)

    def groups_num(self):
        if isinstance(self.parent,list):
            return len(list(filter(lambda x: x<0, self.parent)))
        else: # self.parent: defaultdict
            return len(list(filter(lambda x: x<0, self.parent.values())))

    def elements(self):
        if isinstance(self.parent,list):
            return range(len(self.parent))
        else:
            return self.parent.keys()

N, M = inpl()
p = inpl()
xy = [None]*M
for i in range(M):
    x, y = inpl()
    xy[i] = (x-1, y-1)

uf = UnionFind(2*N)
for i in range(N):
    uf.merge(i,(p[i]-1)+N)
for x, y in xy:
    uf.merge(x,y)
ans = 0
for i in range(N):
    if uf.connected(i,i+N):
        ans += 1
print(ans)

Measured memory_bytes: 26548