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

int main()
{
    long long n;
    cin >> n;

    long long tmp = n;
    map<long long, long long> num;

    for (long long i = 2; i * i <= n; i++)
    {
        while (tmp % i == 0)
        {
            num[i]++;
            tmp /= i;
        }
    }
    if (tmp != 1)
        num[tmp] = 1;

    /*
    for (auto i = num.begin(); i != num.end(); i++)
        cout << i->first << ":" << i->second << endl;
    */

    int ans = 0;
    if (n == 1)
        ans = 0;
    else
    {
        for (auto i = num.begin(); i != num.end(); i++)
        {
            int c = 1;
            while (i->second - c >= 0)
            {
                i->second -= c;
                ans++;
                c++;
            }
        }
    }

    cout << ans << endl;
}

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

bool con(int x,int y,int z){
  int ch=x%2+y%2+z%2;
  bool dec;
  if(ch==0){
    dec=true;
  }else{
    dec=false;
  }
  return dec;
}

int main(){
  int a,b,c;cin>>a>>b>>c;
  int ans=0;
  bool ok=con(a,b,c);
  while(ok){
    int A=b/2+c/2;
    int B=a/2+c/2;
    int C=a/2+b/2;
    a=A;b=B;c=C;
    if(a==b&&b==c){
      ans=-1;
      break;
    }
    ok=con(a,b,c);
    ans++;
  }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n, m;
	vector<pair<ll,ll>> v;
	
	cin >> n >> m;
	ll x, y;
	for(int i = 0; i < n; i++){
		cin >> x >> y;
		v.push_back({x,y});
	}

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

	ll ans = 0;
	for(int i = 0; i < n; i++){
		if(m > 0){
			x = min(m,int(v[i].second));
			ans +=  x* v[i].first;
			m -= v[i].second;
		}
	}
	cout << ans;
}	

Measured memory_bytes: 2420
def divisor(n):
  ret=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      a,b=i,n//i
      if a!=b:
        ret+=a,
        ret+=b,
      else:
        ret+=a,
  return sorted(ret)

def f(n):
  return divisor(n)[1:]

def solve(n):
  ans=f(n-1)
  for k in f(n):
    N=n
    while N>=k:
      if N%k==0:N=N//k
      else:N=N%k
    if N==1:ans+=k,
  print(len(ans))
  return 0

solve(int(input()))

Measured memory_bytes: 3316
A,B,C,D = [int(i) for i in str(input())]
if A+B+C+D==7:
    print("{0}+{1}+{2}+{3}=7".format(A,B,C,D))
elif A+B+C-D==7:
    print("{0}+{1}+{2}-{3}=7".format(A,B,C,D))
elif A+B-C+D==7:
    print("{0}+{1}-{2}+{3}=7".format(A,B,C,D))
elif A+B-C-D==7:
    print("{0}+{1}-{2}-{3}=7".format(A,B,C,D))
elif A-B+C+D==7:
    print("{0}-{1}+{2}+{3}=7".format(A,B,C,D))
elif A-B+C-D==7:
    print("{0}-{1}+{2}-{3}=7".format(A,B,C,D))
elif A-B-C+D==7:
    print("{0}-{1}-{2}+{3}=7".format(A,B,C,D))
elif A-B-C-D==7:
    print("{0}-{1}-{2}-{3}=7".format(A,B,C,D))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m,n;
	cin>>m>>n;
	 char a[m][m];
	 char b[n][n];
	 int c=0;
		for(int x=0;x<m;x++)
		{
		    cin>>a[x];
	    }
		for(int x=0;x<n;x++)
		{
		    cin>>b[x];
	    }
	    for(int x=0;x<m;x++)
	    {
	        for(int z=0;z<m;z++)
            {
              c=0;
                for(int i=0;i<n;i++)
                {
                    for(int j=0;j<n;j++)
                    {
                        if(b[i][j]==a[x+i][j+z])
                            c++;
                    }
                }
                if(c==(n*n))
                {
                     printf("Yes");
                     return 0;
                }

            }
	    }
	    printf("No");
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int a, b;
    std::cin >> a >> b;

    int sum = a + b, diff = a - b, mul = a * b;

    int max = sum;
    if (diff > max) {
        max = diff;
    }
    if (mul > max) {
        max = mul;
    }

    std::cout << max << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const lol MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;


//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  return ((x * y) / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  /*  double a, b, c, d;
  cin >> a >> b >> c >> d;
  double memo = 0;
  c = c * 60 + d;
  c = (c * 0.5);
  d = 360 / 60 * d;
  if(d == 0){
    d = 360;
  }
  if(c == 0){
    c = 360;
  }
  double nasu = abs(c, d);
  cout << nasu << " " << c << " " << d << '\n'; */
  int n;
  cin >> n;
  n %= 10;
  if(n == 3){
    cout << "bon\n";
  } else if(n <= 1 || n == 6 || n == 8){
    cout << "pon\n";
  } else {
    cout << "hon\n";
  }
  return 0;
}


Measured memory_bytes: 3652
n = int(input())

li = [3,5,7,11,13]
ans = 0
for i in range(1,n+1):
    cnt = 0
    for j in range(5):
        if i%li[j]==0:
            cnt += 1
    if cnt ==3:
        ans +=1

if n>=135:
    ans += 1
if n>=189:
    ans += 1

print(ans)

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=801,INF=1<<30;
int dis[MAX][MAX];
vector<string> S(MAX);
int H,W,K;
vector<int> dx={0,0,1,-1},dy={1,-1,0,0};

void BFS(int i,int j){
    queue<pair<int,int>> Q;
    Q.push(make_pair(i,j));
    dis[i][j]=0;
    while(!Q.empty()){
        int a=Q.front().first;
        int b=Q.front().second;
        Q.pop();
        for(int i=0;i<4;i++){
            if(0<=a+dx[i]&&a+dx[i]<H&&0<=b+dy[i]&&b+dy[i]<W){
                if(dis[a+dx[i]][b+dy[i]]!=-1) continue;
                if(S[a+dx[i]][b+dy[i]]=='.'){
                    dis[a+dx[i]][b+dy[i]]=dis[a][b]+1;
                    if(dis[a+dx[i]][b+dy[i]]<K) Q.push(make_pair(a+dx[i],b+dy[i]));
                }
            }
        }
    }
}

int main(){
    
    cin>>H>>W>>K;
    for(int i=0;i<H;i++){
        cin>>S[i];
    }
    
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            dis[i][j]=-1;
        }
    }
    
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(S[i][j]=='S') BFS(i,j);
        }
    }
    
    int ans=INF;
    
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(dis[i][j]!=-1){
                int d=min({i,H-1-i,j,W-1-j});
                ans=min(ans,(d+(K-1))/K);
            }
        }
    }
    
    cout<<ans+1<<endl;
}







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

int main(){
		
	ll n,w;
	cin>>n>>w;
	ll dp[n+1][w+1]={0},wt[n+1],val[n+1];
	memset(dp,0,sizeof dp);
	for(int i=1;i<=n;++i)
		cin>>wt[i]>>val[i];
	
	for(int i=1;i<=n;++i){
		for(int j=1;j<=w;++j){
			dp[i][j]=dp[i-1][j];
			if(wt[i]>j)
				continue;
			dp[i][j] = max(dp[i][j],dp[i-1][j-wt[i]]+val[i]);
		}
	}
	
	cout<<dp[n][w];
	
	return 0;
}


Measured memory_bytes: 82356
using System;
class Program
{
        static void Main(string[] args)
        {
           
                // スペース区切りの整数の入力
                string[] input = Console.ReadLine().Split(' ');
          Array.Sort(input);
         
          if (input[0]=="5" && input[1]=="5" && input[2]=="7"){
            Console.WriteLine("YES");
          }else{
            Console.WriteLine("NO");
          }
        }
}

Measured memory_bytes: 11360
import numpy as np


# 約数の列挙
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.add(i)
            divisors.add(n // i)
    return sorted(list(divisors))


N, K, *A = map(int, open(0).read().split())

A = np.array(A, np.int64)
d = make_divisors(A.sum())

for i in d[::-1]:
    r = A % i
    r = r[r != 0]
    l = r.size
    if l == 0:
        print(i)
        exit()
    else:
        n = np.arange(l - 1, 0, -1)
    r.sort()
    np.cumsum(r, out=r)
    equal = np.where(r[:-1] == i * n - (r[-1] - r[:-1]))[0]
    if np.any(r[equal] <= K):
        print(i)
        exit()

Measured memory_bytes: 20520
#include<iostream>

using namespace std;

int prime[1000000];
bool is_prime[1000000];


int sieve(int n){

  int p=0;
  for(int i =0;i<=n;i++)is_prime[i] = true;
  is_prime[0] = is_prime[1] =false;

  for(int i = 2;i<=n;i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j = 2*i;j<=n;j+=i)is_prime[j] = false;
    }

  }
  return p;

}


main(){
  
  int n;

  while(cin >> n){
    
    cout << sieve(n) << endl;
    

  }


  return 0;
}

Measured memory_bytes: 2148
import std.algorithm;
import std.bigint;
import std.bitmanip;
import std.concurrency : generator = Generator, yield;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(long A, long B) {
    return (A * B) / gcd(A, B);
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long A;
    A = input.front.to!long;
    input.popFront;

    long B;
    B = input.front.to!long;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(A, B);
    else {
        auto ans = solve(A, B);

        static if (isFloatingPoint!(ReturnType!solve))
            writeln(format("%.9f", ans));
        else static if (is(ReturnType!solve == bool))
            writeln(ans ? YES : NO);
        else
            writeln(ans);
    }
}


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

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

  int n;
  cin >> n;

  set<int> mul;
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      mul.insert(i * j);
    }
  }

  string ans = "No";
  if (mul.find(n) != mul.end()) {
    ans = "Yes";
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

void enter(int n, string s, char ch) {
    if (s.length() == n) {
        cout << s << endl;
    } else {
        for (char c = 'a'; c <= ch; c++) {
            char nxt = max((int)ch, c+1);
            enter(n, s + c, nxt);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    enter(n, "", 'a');
}



Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  string s;
  cin>>s;
  int w=0,l=0,p=0,g=0;
  rep(i,s.size())
    if(s[i]=='p'){
      if(p==g)l++,g++;
      else p++;
    }else{
      if(p==g)g++;
      else p++,w++;
    }
  cout<<w-l<<endl;
}


Measured memory_bytes: 512
import java.util.*

fun main(args: Array<String>) = shojin06d()

fun shojin06d() {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val aList = readLine()!!.split(' ').map { it.toLong() }

    val queue =
        PriorityQueue(aList.size, Comparator { o1: Long, o2: Long -> if (o2 > o1) 1 else if (o2 == o1) 0 else -1 })
    queue.addAll(aList)

    repeat(m) {
        val poll = queue.poll()
        queue.add(poll / 2)
    }

    val answer = queue.sum()

    println(answer)
}


Measured memory_bytes: 72136
#include<iostream>
using namespace std;
int main()
{
	unsigned long x;
	unsigned long i, now;
	now = 100;
	cin >> x;
	for (i = 1;; i++) {
		now = now * 1.01;
		if (now >= x) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <map> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main(){
    string s;
    cin >> s;

    string sei = "CODEFESTIVAL2016";
    ll res = 0;
    REP(i,16)
    {
        if(s[i] != sei[i])++res;
    }

    cout << res << endl;
    return 0;    
}



Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextString(scanner)
	n := len(s)
	w := getNextInt(scanner)
	for i := 0; i < n; i += w {
		fmt.Fprintf(writer, "%c", s[i])
	}
	fmt.Fprintln(writer, "")
}


Measured memory_bytes: 640
//#pragma GCC optimize("trapv")
#include <iostream>
#include <vector>
#include <tuple>
#include <deque>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cassert>
#include <iomanip>
#include <algorithm>
#include <unordered_set>
#define int long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()

using namespace std;

const int MOD = 1e9 + 7;
const int INF = 1e9 * 1e9 + 10;

void fast()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

signed main()
{
	fast();
	int n, k;
	cin >> n >> k;
	vector <int> a(n);
	for (int & e : a)
		cin >> e;
	vector <int> suf(n);
	suf[n - 1] = max(0ll, a[n - 1]);
	for (int i = n - 2; i >= 0; --i)
	{
		suf[i] = suf[i + 1] + max(a[i], 0ll);
	}

	int pref = 0, sum = 0;
	for (int i = 0; i < k; ++i)
	{
		sum += a[i];
	}
	int sufk = 0;
	if (k < n)
		sufk = suf[k];
	int ans = max(sum + sufk, 0ll);
	for (int i = k; i < n; ++i)
	{
		int sufi = 0;
		if (i + 1 < n)
			sufi = suf[i + 1];
		pref += max(a[i - k], 0ll);
		sum -= a[i - k];
		sum += a[i];
		ans = max(ans, pref + max(sum, 0ll) + sufi);
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 4764
import java.util.Scanner;
class Main {
	public static void main(String[]args){
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		if(a==1){
			if(b!=1){
				System.out.println("Alice");
			}
		}
		if(b==1){
			if(a!=1){
				System.out.println("Bob");
			}
		}
		 	
		if((a>b)&&(a!=1)&&(b!=1)) System.out.println("Alice");
		if((a<b)&&(a!=1)&&(b!=1)) System.out.println("Bob");
		if(a==b) System.out.println("Draw");
	}
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

ll ans = LLINF;

ll dp[2][11111];

void init(){
	REP(i, 2)REP(j, 11111)dp[i][j] = -LLINF;
	REP(i, 2)dp[i][0] = LLINF;
}

void check(ll c_max, int a, int b, int w){
	deque<P> deq;
	ll r = 1;
	for(ll i = 1;i <= w;i++){
		while(r < i)r++;
		while(r <= w && (c_max - dp[b][r] > r - i)){
			while(!deq.empty() && deq.back().FI < dp[b][r]){
				deq.pop_back();
			}
			if(dp[b][r] != -LLINF)deq.push_back(MP(dp[b][r], r));
			r++;
		}
		while(!deq.empty() && deq.front().SE < i)deq.pop_front();

		if(dp[a][i] == -LLINF)continue;
		if(!deq.empty()) {
			ans = min(ans, c_max - min(dp[a][i], deq.front().FI));
		}
		if(r <= w && dp[b][r] != -INF){
			ans = min(ans, max(r - i, c_max - dp[a][i]));
		}
	}
}

void query(P cat, ll type, ll w){
	REV(i, 11111){
		if(i + cat.SE >= 11111)continue;
		if(dp[type][i] == -LLINF)continue;

		dp[type][i + cat.SE] = max(dp[type][i + cat.SE], min(dp[type][i], cat.FI));
	}

	check(cat.FI, 0, 1, w);
	check(cat.FI, 1, 0, w);
}

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

	init();

	ll na, nb, w;cin >> na >> nb >> w;
	vector<pair<P, ll>> v;

	REP(i, na){
		ll m, c;cin >> m >> c;
		v.EB(MP(c, m), 0);
	}
	REP(i, nb){
		ll m, c;cin >> m >> c;
		v.EB(MP(c, m), 1);
	}

	sort(ALL(v));
	REP(i, v.size()){
		query(v[i].FI, v[i].SE, w);
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3400
n = int(input())

ab    = []
st_ab = []
a_l   = []
b_l   = []

wt_sum = 0
for i in range(n):
  a,b = map(int,input().split())
  ab.append([a,b])
  a_l.append(a)
  b_l.append(b)
  wt_sum += a

if wt_sum > max(b_l):
  print("No")
  exit()

st_ab = sorted(ab,key=lambda x: x[1])

wt_sum = 0

a,b = st_ab[0]

for i in range(n):
  a,b = st_ab[i]
  wt_sum += a

  if wt_sum > b:
    print("No")
    exit()

  
print("Yes") 

  

  


Measured memory_bytes: 42824
import java.util.*;

public class Main{

    Scanner sc = new Scanner(System.in);

    List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();
    int m = sc.nextInt();
    int q = sc.nextInt();
    int[][] arr = new int[q][4];

    long ans = 0;

    public static void main(String[] args){
        new Main().run();
    }

    void run() {


        for (int i=0; i<q; i++) {
            arr[i][0] = sc.nextInt()-1;
            arr[i][1] = sc.nextInt()-1;
            arr[i][2] = sc.nextInt();
            arr[i][3] = sc.nextInt();
        }

        list.add(1);
        dfs(list);

//        bfs("1");

//        for (String s: list) {
//            long tmpA = 0;
//            for (int i=0; i<q; i++) {
//                int a = arr[i][0];
//                int b = arr[i][1];
//                int c = arr[i][2];
//                int d = arr[i][3];
//                if ((s.charAt(b-1)-'0')-(s.charAt(a-1)-'0') == c) {
//                    tmpA += d;
//                }
//            }
//            ans = Math.max(ans, tmpA);
//        }

//        System.out.println(list);
        System.out.println(ans);

    }

    void dfs(List<Integer> list) {
        if (list.size() == n) {
            ans = Math.max(ans, calc(list));
        } else {
            int tmp = list.get(list.size()-1);
            for (int i=tmp; i<=m; i++) {
                list.add(i);
//                System.out.println(list);
                dfs(list);
                list.remove(list.size()-1);
            }
        }
    }

    long calc(List<Integer> list) {
        long sum = 0;
        for (int i=0; i<q; i++) {
            if (list.get(arr[i][1])-list.get(arr[i][0]) == arr[i][2]) {
                sum += arr[i][3];
            }
        }
        return sum;
    }

//    void bfs(String s) {
//        Queue<String> queue = new ArrayDeque<>();
//        queue.add(s);
//        while (!queue.isEmpty()) {
//            String st = ((ArrayDeque<String>) queue).peekFirst();
//            System.out.println(st);
//            if (st.length() > n && m != 10) queue.poll();
//            int l = st.charAt(st.length()-1) - '0';
//            for (int i=l; i<=m; i++) {
//                st += String.valueOf(i);
//                if (st.length() < n) queue.add(st);
//                if (st.length() == n) list.add(st);
//                st = st.substring(0, st.length()-1);
//            }
//            queue.poll();
//        }
//    }
}


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

bool countdiv8(int i) {
  int j,count=0;
  
  for(j=1; j<=i; j++) {
    if(i%j==0) {
      count++;
    }
  }
  
  if(count == 8) return true;
  else return false;
}

int main() {
  int i,N,count=0;
  
  cin >> N;
  
  for(i=1;i<=N;i+=2) {
    if(countdiv8(i)) count++;
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 3544
fun main(args: Array<String>) {
  val S = readLine()!!.toString()
  var max = 0
  var c = 0
  S.forEach{s ->
    if(!(s == 'A'||
      s == 'T'||
      s == 'C'||
      s == 'G'
    )) {
      c = 0
    } else {
      c += 1
    }
      if(c >= max) {
        max = c
      }
  }
  println(max)
}

Measured memory_bytes: 33708
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
 int main() {
	 string a, b;
	 cin >> a >> b;
	 int n = atoi((a + b).c_str());
	 int i;
	 for (i = 1; i*i < n; i++);
	 if (i*i == n) cout << "Yes" << endl;
	 else cout << "No" << endl;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> sw(m);
    rep(i, m) {
        int k;
        cin >> k;
        rep(j, k) {
            int tmp_num;
            cin >> tmp_num;
            --tmp_num;
            sw[i].push_back(tmp_num);
        }
    }
    vector<int> p(m);
    int ans = 0;
    rep(i, m) cin >> p[i];
    rep(i, 1<<n){
        vector<int> sw_on(n);
        rep(j, n) {
            if ( (i>>j) & 1 ) {
                sw_on[j] = 1;
            }
        }
        bool ok = true;
//        cout << i << " ";
//        for ( auto tmp_num : sw_on ) {
//            cout << tmp_num << " ";
//        }
//        cout << endl;
        rep(j, m) {
            int sum = 0;
            for ( auto tmp_num : sw[j] ) {
                sum += sw_on[tmp_num];
            }
            if ( sum % 2 == p[j] ) {
                continue;
            }
            else {
                ok = false;
                break;
            }
        }
        if ( ok ) ++ans;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long int;
using lc = complex<double>;

int main(void) {
    constexpr ll MOD = 998244353;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(32);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n, x, m;
    cin >> n >> x >> m;
    vector<vector<tuple<ll,ll>>> tbl(m, vector<tuple<ll,ll>>(55));
    for(ll i=0; i<m; i++) {
        ll t = (i*i)%m;
        tbl[i][0] = {t, i%m};
    }

    for(ll k=1; k<50; k++) {
        for(ll i=0; i<m; i++) {
            auto [x, y] = tbl[i][k-1];
            auto [z, w] = tbl[x][k-1];
            tbl[i][k] = {z, w+y};
        }
    }

    ll res = 0, u = x;
    for(ll k=50; ; k--) {
        if(!((n>>k)&1)) {
            if(k==0) break;
            continue;
        }
        auto [x, y] = tbl[u][k];
        res += y;
        u = x;
        if(!k) break;
    }
    cout << res << endl;
}

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(long long N, long long A, long long B) {
  if(A==0) { cout << 0 << endl; return; }
  if(B==0) { 
    cout << N << endl; 
    return;
  }

  ll ret = (N / (A+B)) * A;

  ret += min(A, N - (N / (A+B)) * (A+B));
  cout << ret << endl;

}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long N;
  std::cin >> N;
  long long A;
  std::cin >> A;
  long long B;
  std::cin >> B;
  solve(N, A, B);
  return 0;
}


Measured memory_bytes: 3672
#include<iostream>
using namespace std;
int main(){
	char a,b,c,d;
	long long n=0;
	cin>>a>>b>>c>>d;
	if(a=='+')n++;
	if(b=='+')n++;
	if(c=='+')n++;
	if(d=='+')n++;
	if(a=='-')n--;
	if(b=='-')n--;
	if(c=='-')n--;
	if(d=='-')n--;
	cout<<n<<endl;
	return 0;
}	

Measured memory_bytes: 256
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <functional>
#include <queue>
using namespace std;
const int INT_INF = 500000000;
const long long LONG_LONG_INF = (long long)pow(10, 18);
const int MOD = pow(10, 9) + 7;
/* contest template */
int N, K;
long long ans;

int main()
{
    cin >> N >> K;
    for (int b = K + 1; b <= N; b++)
    {
        ans += (b - K) * (N / b);
        if (N % b >= K)
        {
            if (K != 0)
            {
                ans += (N % b) - (K - 1);
            }
            else
            {
                ans += N % b;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=dict()
ans=0
for i in map(int,input().split()):
    ans+=i
    if i in a:
        a[i]+=1
    else:
        a[i]=1
q=int(input())
for i in range(q):
    b,c=map(int,input().split())
    if c not in a:
        a[c]=0
    if b not in a:
        a[b]=0
    ans=ans-b*a[b]+c*a[b]
    a[c]+=a[b]
    a[b]=0
    print(ans)

Measured memory_bytes: 21692
n, x = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
a.sort()
ans = 0
for item in a[:-1]:
    if x >= item:
        ans += 1
        x -= item
    else:
        break
if a[-1] == x:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int n, y;
int main() {
	int i, j;
	cin>>n>>y;
	for(i=0; i<=n; i++) for(j=0; i+j<=n; j++)
		if(i*10000 + j*5000 + (n-i-j)*1000==y) {cout<<i<<' '<<j<<' '<<n-i-j; return 0;}
	cout<<"-1 -1 -1";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a,b,c,d;
    
    scanf("%d",&a);
    scanf(" %d",&b);
    scanf(" %d",&c);
    scanf(" %d",&d);
    if(a+b==c+d)printf("Balanced");
    if(a+b>c+d)printf("Left");
    if(a+b<c+d)printf("Right");
    return(0);
}

Measured memory_bytes: 128
N,M,K=gets.split.map(&:to_i)
A=gets.split.map(&:to_i)
B=gets.split.map(&:to_i)

a=*b=[0]
A.each do |i| a<<a[-1]+i end
B.each do |i| b<<b[-1]+i end

ans=0
0.upto(N) do |n|
  k=K-a[n]
  break if k<0
  m=b.bsearch_index{|i|k<i}
  m=m ? m-1 : M
  ans=[ans,n+m].max
end
p ans

Measured memory_bytes: 45108
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

int main()
{
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	c *= 2;
	
	int res = 0;
	
	res = a * x + b * y;
	
	res = min(res, c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y)));
	
	res = min(res, c * max(x, y));
	
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        if (a == 1 && b == 2) { Console.WriteLine("3"); }
        else if (a == 1 && b == 3) { Console.WriteLine("2"); }
        else if (a == 2 && b == 1) { Console.WriteLine("3"); }
        else if (a == 2 && b == 3) { Console.WriteLine("1"); }
        else if (a == 3 && b == 1) { Console.WriteLine("2"); }
        else if (a == 3 && b == 2) { Console.WriteLine("1"); }
    }
}


Measured memory_bytes: 13140
package main

import (
	"fmt"
	"sort"
)

type entry struct {
	a, b int
}

type entries []entry

func (es entries) Len() int {
	return len(es)
}
func (es entries) Swap(i, j int) {
	es[i], es[j] = es[j], es[i]
}
func (es entries) Less(i, j int) bool {
	return es[i].a < es[j].a
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	es := make([]entry, n)
	for i := range es {
		fmt.Scan(&es[i].a, &es[i].b)
	}

	sort.Sort(entries(es))

	ans := 0
	num := 0
	for _, e := range es {
		if num+e.b <= m {
			ans += e.a * e.b
			num += e.b
		} else {
			ans += (m - num) * e.a
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5376
def main():
    N = int(input())
    Tt = [int(i) for i in input().split(" ")]
    M = int(input())
    for i in range(M):
        T = Tt[:]
        P , X = map(int,input().split(" "))
        sum = 0
        T[P-1] = X
        for j in range(N):
            sum += T[j]
        print(sum)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a>0&&b>0)
		cout<<"Positive"<<endl;
	if(a==0||b==0)
	    cout<<"Zero"<<endl;
	if(a<0&&b>0)
		cout<<"Zero"<<endl;
	if(a<0&&b<0)
	{
		if((b-a+1)%2==0)
			cout<<"Positive"<<endl;
		else
			cout<<"Negative"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n, c, sum = 0, p, ans;
    cin >> n >> c;
    for (int i = 0; i < c; i++) {
        cin >> p;
        sum += p;
    }
    ans = sum/(n+1);
    if (sum%(n+1)) ans++;
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3100
S = input()
N = len(S)
mid = N//2
left = ""
for i in range(mid):
    left += S[i]
right = ""
right_mid = mid
if N % 2 == 1:
    right_mid += 1
for i in range(N-1,mid-1,-1):
    right += S[i]
ret = 0
for i in range(mid):
    if left[i] != right[i]:
        ret += 1
print(ret)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define LIM 1000007
#define ll long long
using namespace std;
int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  if (a % c != 0) {
    a += c - a % c;
  }
  b -= b % c;
  cout << (b - a) / c + 1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cfloat>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <iomanip>

using namespace std;

#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
// #define req(j, n) for (ll j = 1; j < (n+1); j++)
// #define rer(k, n) for (ll k = 1; k < (n+1); k++)


int main()
{
    int N;
    cin >> N;
    vector<int> A(100);
    rep(i,N) {
        cin >> A[i];
    }
    bool flag = 1;
    int count = 0;
    for (int i = 0; flag; i++) {
        flag = 0;
        for (int j = N - 1; j >= i+1; j--) {
            if (A[j] < A[j-1]) {
                swap(A[j], A[j-1]);
                flag = 1;
                count += 1;
            }
        }
    }
    rep(i,N) {
        if (i<N-1) {
            cout << A[i] << " ";
        } else {
            cout << A[i] << endl;
        }
    }
    cout << count << endl;
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    int x = 0;
    rep(i, N) {
        if (S[i] == 'I') x += 1;
        else x -= 1;
        ans = max(ans, x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
    int a,b;
    
    cin >> a >> b;
    
    if(a < b)
    {
        cout << "a < b" <<endl;
    }else if(a > b)
    {
        cout << "a > b" <<endl;
    }else if(a == b)
    {
        cout << "a == b" <<endl;
    }
}



Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <set>
#include <cstdio>
#include <memory>
#include <cmath>
#include <chrono>
#include <random>
#include <map>
#include <sstream>
#include <queue>
#include <cassert>
#include <cstdio>
#define x first
#define y second
#define int long long
#define pii pair<int, int>

using namespace std;

const int N = 1e6 + 10;
const int inf = 1e18;
const int mod = 998244353;

//mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

string n;

int32_t main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	cin >> n;

	for(int i = 0; i < n.size(); ++i)
		if (n[i] == '7')
		{
			cout << "Yes" << endl;
			return 0;
		}

	cout << "No" << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>

using namespace std;
int N;
int a;
int ans=0;
vector<int> P(100005);

int main() {
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> a;
    P.at(a)++;
  }
  for (int i=1; i<=100000; i++) {
    ans = max(ans, P.at(i-1)+P.at(i)+P.at(i+1));
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack> 
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
//const int MAX_V=105;
const long double pi = 3.14159265;
const long long mod =1e9+7;


int main(){
    
    int a,b;
    cin >> a >> b;
    if(a%2==0 || b%2==0){
        cout << "Even" << endl;
    }else{
        cout << "Odd" << endl;
    }
    

    return 0;
}
 

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

vector<int> v(1000001,0);

ll next(int x)
{
  if(x%2==0){
    return x/2;
  } else {
    return 3*x+1;
  }
}

int main()
{
  ll a,b,c;
  cin >> a >> b >> c;
  cout << a*b/2 << endl;
  return 0;
}

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

using namespace std;

char s[200007];

int main()
{
    int n, i, a=0;
    cin >> s;
    for(i=0; i<strlen(s); i++){
        a+=s[i]-'0';
    }
    if(a%9){
        cout << "No\n";
    }
    else{
        cout << "Yes\n";
    }
    return 0;
}


Measured memory_bytes: 3820
#include <stdio.h>
int main(){
  char c1[4]={0}, c2[4]={0};
  scanf("%s", c1);
  scanf("%s", c2);
  if( c1[0]==c2[2] && c1[1]==c2[1] && c1[2]==c2[0] ){ printf("YES\n"); }
  else												{ printf("NO\n");  }
  return 0;
}

Measured memory_bytes: 1628
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
const long long MAX = 10000000;
const long long MOD = 1000000007;


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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        //そのまま計算すると負の値になるのでMODを足す
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(long long n, long long k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    COMinit();
    long long int n, k;
    cin >> n >> k;

    for(int i=1;i<=k;i++) {
        cout << COM(k-1, k-i) * COM(i + n-k - (i-1), n-k - (i-1)) % MOD << endl;
    }
}

Measured memory_bytes: 234624
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);

  ll sum = 1000;
  bool up = true;
  rep(i, n) cin >> a[i];

  rep(i, n - 1) {
    if (a[i + 1] > a[i]) {
      sum += (a[i + 1] - a[i]) * (sum / a[i]);
    }
  }
  cout << sum;
  return 0;
}


Measured memory_bytes: 3592
def is_palindrome(S):
    for i in range(len(S) // 2):
        if S[i] != S[len(S) - 1 - i]:
            return False
    return True

S = input()
if is_palindrome(S) and is_palindrome(S[0:(len(S)//2 )]) and is_palindrome(S[len(S) //2 + 1:]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
n = int(input())
p = list(map(int, input().split()))


count = 0
for num in range(1, len(p)-1):

    if (p[num - 1] < p[num] < p[num + 1]) or (p[num - 1] > p[num] > p[num + 1]) :
        count+=1
print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define f(var,start,end) for(ll var = start; var <end ; ++var)
#define rf(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define nl cout<<"\n"
int main()
{
	ll a,b,c,k,cnt;
	cin>>a>>b>>c>>k;
	if(k>a)
	{
		cnt=a;
		k=k-a;
		if(k>b)
		{
			k=k-b;
			if(k>0)
				cnt-=k;
		}
	}
	else
	{
		cnt=k;
	}
	cout<<cnt<<endl;
}

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

int main() {
    int n;
    cin >> n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep(i, n) {
        string s;
        cin >> s;
        if (s == "AC") ac++;
        else if (s == "WA") wa++;
        else if (s == "TLE") tle++;
        else if (s == "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: 3632
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>

using namespace std;
string s;
int main(){
	cin >> s;
	int ans = 0;
	if (s.length() == 1) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 0; i <= s.length() / 2 - 1; i++) {
		if (s[i] != s[s.length() - i - 1]) ans++;
	}
	//cout << s.length() << endl;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  string d, m;
	cin >> d;
  cout << "A";
  cin >> m;
  cout << m[0];
  cin >> d;
  cout << "C" << endl; 
	return 0;
}


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

int main(){
	int n, lw, le, rw, re, p, min_p;
	string s;
	lw = 0;
	le = 0;
	rw = 0;
	re = 0;
	min_p = 200000;
	cin >> n >> s;
	for(int i=0; i<n; i++){
		if(s[i]=='W'){
			rw++;
		}else{
			re++;
		}
	}
	for(int i=0; i<n; i++){
		if(s[i]=='W'){
			rw--;
			p = re + lw;
			min_p = min(min_p, p);
			lw++;
		}else{
			re--;
			p = re + lw;
			min_p = min(min_p, p);
			le++;
		}
	}
	cout << min_p << endl;
	return 0;
}


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

using namespace std;

typedef unsigned long long int ULL;
typedef long long LL;
typedef long double LD;

int main()
{
	LL n;
	cin >> n;
	vector<LL> a(n);

	for (auto &e : a) {
		cin >> e;
	}

	vector<LL> b(n);

	for (int i = 0; i < n; ++i) {
		b[a[i]-1] = i+1;
	}

	for (auto &e : b) {
		cout << e << " ";
	}cout << endl;
}

Measured memory_bytes: 2432
#include <iostream>
using namespace std;
 
#define MAX_W 100
#define MAX_H 100
char farm[MAX_W][MAX_H];
int W, H;
const int direction[4][2] = {
	{ -1, 0 },
	{ 1, 0 },
	{ 0, -1 },
	{ 0, 1 },
};
 
void dfs(const int& x, const int& y, const char tree)
{
	farm[x][y] = 'x';
	for (int i = 0; i < 4; ++i)
	{
		int nx = x + direction[i][0];
		int ny = y + direction[i][1];
		if (nx >= 0 && nx < W && ny >= 0 && ny < H && farm[nx][ny] == tree)
		{
			dfs(nx, ny, tree);
		}
	}
}
 
///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
 
	while (cin >> H >> W, W > 0)
	{
		int res = 0;
		int x, y;
		for (y = 0; y < H; ++y)
		{
			for (x = 0; x < W; ++x)
			{
				cin >> farm[x][y];
			}
		}
 
		for (y = 0; y < H; ++y)
		{
			for (x = 0; x < W; ++x)
			{
				if (farm[x][y] != 'x')
				{
					dfs(x, y, farm[x][y]);
					++res;
				}
			}
		}
		cout << res << endl;
	}
 
	return 0;
}
//////

Measured memory_bytes: 3776
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll long long int
#define endl "\n"
#define db(x) cout<<#x<<" ->"<<x<<endl
#define db2(x,y) cout<<#x<<"->"<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define db4(w,x,y,z) cout<<#w <<" -> " << w << " , " << #x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it = x.begin(); it!=x.end(); it++) { cout<<*it<<" "; } cout<< endl
#define IN freopen("input.txt","r",stdin)
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = (int)1e5+5;

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//    IN;
    int n,m;
    cin >> n >> m;
    ll ans = max(0,n*(n-1) / 2) + max(0,m*(m-1)/2);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
li_2 = 2
li_1 = 1
luca = 0
if n == 0:
    luca = 2
elif n == 1:
    luca = 1
else:
    for i in range(2, n+1):
        luca = li_1 + li_2
        temp = li_2
        li_2 = li_1
        li_1 = luca
print(luca)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();
//ll t;cin>>t;while(t--)
{
    ll n;
    cin>>n;
    ll temp=ceil(double(n/double(1000)));
    temp=temp*1000;
    cout<<temp-n<<endl;
}
return 0;
}

Measured memory_bytes: 3704