akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
 
using namespace std;
 
int main()
{
	char N[200001];
	cin >> N;
	//char N[] = "31415926535897932384626433832795028841971693993751058209749445923078164062862089986280";
	int sum = 0;
	int loop = 0;
	char n[2];
	n[1] = '\0';
 
	while(N[loop]!='\0')
	{
		n[0] = N[loop];
		sum += atoi((const char*)n);
		loop++;
	}
 
	if (sum % 9 == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3776
S = str(input())

for count in range(1,len(S)+1):
    if count % 2 == 1:
        if S[count-1] == "R" or S[count-1] == "U" or S[count-1] == "D":
            flag = False
        else:
            flag = True
            break
    else:
        if S[count-1] == "L" or S[count-1] == "U" or S[count-1] == "D":
            flag = False
        else:
            flag = True
            break

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

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

#define f first
#define s second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ll long long
#define ull unsigned long long
#define db double
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define px pair<db, db>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define input(a) for (auto& el : a) cin >> el;
#define output(a) cout << '!'; for (auto& el : a) cout << el << ' '; cout << '\n'; cout.flush();
#define sz(el) int(el.size())
#define sq(a) ((a) * (a))
#define xll bitset<128>
#define xmin(a,b) a = min(a, b)
#define xmax(a,b) a = max(a, b)
#define sun(a) sort(all(a)); a.resize(unique(all(a)) - a.begin());
/**/  /// extra
//#define forn(i,n) for (int i = 0; i < n; ++i)
//#define rforn(i,n) for (int i = n - 1; i >= 0; --i)
#define bn '\n'
#define vi vector<int>
#define vii vector<vi>
#define vl vector<ll>
#define vll vector<vl>
//#define G vector<vector<pii>>
#define GVE vector<vector<edge>>
#define usi unordered_set<int>
#define usp set<pii>
/**/

using namespace std;

const int INF = 1'000'000'017;
const ll LLINF = 1'000'000'000'000'000'017LL;
const ld inf = 1.0 / 0.0;
const ld eps = 1e-9;
const int MOD = 998244353;

//mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

//uniform_int_distribution<int> uid(l, r); [l, r]
//int x = uid(rng);

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

    int a, b;
    cin >> a >> b;
    cout << 1ll * a / __gcd(a, b) * b;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b;
	cin>>n>>a>>b;
	int ans=0;
	int cnt=0;
	int aa[12];
	int ii;
	int cc=0;
	for(int i=1;i<=n;i++){
		cnt=0;
		ii=i;
		cc=0;
		do{
			aa[cc]=ii%10;
			cnt+=aa[cc];
			ii/=10;
			cc++;
		}while(ii>=1);
		if(a<=cnt&&cnt<=b){
			ans+=i;
		}
	} 
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  int m;
  cin >> m;

  pr(24+24-m);

  return 0;
}


Measured memory_bytes: 256
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect

def main():
    N = int(input())
    A = list(map(int, input().split()))

    dp = [[0] * 2 for _ in range(N)]
    dp[0][0] = A[0]
    dp[0][1] = -A[0]

    for i in range(N - 2):
        dp[i+1][0] = max(dp[i][0] + A[i+1], dp[i][1] - A[i+1])
        dp[i+1][1] = max(dp[i][0] - A[i+1], dp[i][1] + A[i+1])

    dp[N - 1][0] = dp[N - 2][0] + A[N-1]
    dp[N - 1][1] = dp[N - 2][1] - A[N-1]

    # print(dp)
    print(max(dp[N-1][0], dp[N-1][1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 25908
#include<stdio.h>

int main(void)
{
	int i,j=0,a,b;

	while(scanf("%d",&a) && scanf("%d",&b) != EOF)
	{
		i = a+b;

		while(i != 0)
		{
			i = i / 10;
			j++;
		}
		printf("%d\n",j);
		j = 0;
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a,b) cout << (a) << " " << (b) << endl
#define rt0 return 0;
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) 
{
    string s;
    cin >>s;
    if (s == "SAT") mes(1);
    if (s == "FRI") mes(2);
    if (s == "THU") mes(3);
    if (s == "WED") mes(4);
    if (s == "TUE") mes(5);
    if (s == "MON") mes(6);
    if (s == "SUN") mes(7);
    
   
}


Measured memory_bytes: 3616
<?php
error_reporting(0);
//list($x,$t) = explode(" ",trim(fgets(STDIN)));
$S = trim(fgets(STDIN));
$len = strlen($S);
$ret = "";
for($i=0;$i<$len;$i=$i+2) {
  $ret .= $S[$i];
}
printf("%s\n",$ret);


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

using namespace std;

typedef long long Int;

int N, S;
char s[16], s2[16];

Int memo1[16][14 * 9];

Int func1(int N, int S)
{
	if (S < 0) return (0);
	if (N == 0) return (1);
	if (~memo1[N][S]) return (memo1[N][S]);
	
	Int ans = 0;
	for (int i = 0; i <= 9; i++){
		ans += func1(N - 1, S - i);
	}
	
	return (memo1[N][S] = ans);
}

Int pos;
Int fact[15], ten[15];

Int calcComb(int *a)
{
	Int den = 1, sum = 0;
	
	for (int i = 0; i <= 9; i++){
		sum += a[i]; den *= fact[a[i]];
	}
	
	return (fact[sum] / den);
}

Int X;

void func2(int n, int sum, int l, Int tmp = 0)
{
	if (sum < 0) return;
	if (n * l < sum) return;
	
	if (n == 0){
		Int p1 = 1, p2 = 1, tmp_ = tmp, X_ = X;
		for (int i = 0; i < N; i++){
			p1 *= (tmp_ % 10 + 1); p2 *= (X_ % 10 + 1);
			tmp_ /= 10; X_ /= 10;
		}
		if (sum == 0 && p1 < p2){
			int a[10] = {0};
			for (int i = 0; i < N; i++){
				a[tmp % 10]++; tmp /= 10;
			}
			pos += calcComb(a);
		}
		if (sum == 0 && p1 == p2){
			int a[10] = {0};
			for (int i = 0; i < N; i++){
				a[tmp % 10]++; tmp /= 10;
			}
			for (int i = 0; i < N; i++){
				for (int j = 0; j < s[i] - '0'; j++){
					if (a[j]){
						a[j]--;
						pos += calcComb(a);
						a[j]++;
					}
				}
				if (a[s[i] - '0']){
					a[s[i] - '0']--;
				}
				else break;
			}
		}
		return;
	}
	
	Int orig = tmp;
	for (int i = min(l, sum); i >= 0; i--){
		tmp = tmp + i * ten[N - n];
		func2(n - 1, sum - i, i, tmp);
		tmp = orig;
	}
}

int main()
{	
	fact[0] = ten[0] = 1;
	for (int i = 1; i <= 14; i++){
		fact[i] = i * fact[i - 1];
		ten[i] = 10 * ten[i - 1];
	}
	
	scanf("%s", s);
	
	int bucket[10] = {0};
	for (int i = 0; s[i]; i++){
		S += s[i] - '0';
		N++;
		bucket[s[i] - '0']++;
	}
	
	memset(memo1, -1, sizeof(memo1));
	pos = func1(N, S - 1);
	
	strcpy(s2, s);
	sort(s2, s2 + N);
	
	for (int i = 0; s2[i]; i++){
		X = X * 10 + s2[i] - '0';
	}
	
	func2(N, S, 9);
	
	printf("%lld\n", pos);
	
	return (0);
}

Measured memory_bytes: 1176
a, b, k = map(int, input().split())
ans = []
for i in range(k):
    if a + i <= b:
        ans.append(a + i)
        ans.append(b - i)
    else:
        break
a = sorted(list(set(ans)))
for i in range(len(a)):
    print(a[i])

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	
#include<functional>

using namespace std;

namespace MyLib {
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
}

using namespace MyLib;

int main() {
	int n;
	int m[101];
	int p[101][101];
	int buf;
	while (cin >> n, n) {
		REP(i, 101)
			fill(p[i], p[i] + 101, 0);
		REP(i, n) {
			cin >> m[i + 1];
			REP(j, m[i + 1]) {
				cin >> buf;
				p[i + 1][buf] = 1;
			}
		}
		int k;
		cin >> k;
		int x = -1;
		REP(i, k) {
			cin >> buf;
			p[0][buf] = 1;
		}
		REP(i, n)
			REP(j, n) {
			if (p[i + 1][j + 1] == 0 && p[0][j + 1] == 1)
				break;
			if (j == n - 1)
				if(x==-1)x = i + 1;
				else x = -2;
		}

		if (x == -2)
			x = -1;


		cout << x << endl;



	}
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,x;
	cin>>n>>x;
	int a[n+1]={0};
	for(int i=1;i<=n;i++)cin>>a[i];
	long long ans=0LL;
	for(int i=1;i<=n;i++)
	{
		if(a[i]+a[i-1]>x)
		{
			ans+=a[i]+a[i-1]-x;
			a[i]-=(a[i]+a[i-1]-x);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 640
import sys

def solve(a, b, s):
    for i in range(len(s)):
        if i == a:
            if s[i] != "-":
                return 0
        else:
            if "0" <= s[i] <= "9":
                pass
            else:
                return 0
    return 1

a, b = [int(x) for x in sys.stdin.readline().strip().split()]
s = sys.stdin.readline().strip()

if solve(a, b, s):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const decimal eps=(decimal)1e-14;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		if(Abs(Sqrt(s[2])-Sqrt(s[0])-Sqrt(s[1]))<eps){
			Console.WriteLine("No");
			return;
		}
		Console.WriteLine("{0}",Sqrt(s[0])+Sqrt(s[1])<Sqrt(s[2])?"Yes":"No");
	}
	static decimal Sqrt(decimal x,decimal? guess=null){
		var ourGuess=guess.GetValueOrDefault(x/2m);
		var result=x/ourGuess;
		var average=(ourGuess + result)/2m;
		if(average==ourGuess){return average;}
		else{return Sqrt(x,average);}
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

using namespace std;

int main()
{
	int ans = 0;
	string s;
	cin >> s;
	for (int i = 0; i < 5; i++)
	{
		if (s[i] == 'A' && s[i + 1] == 'C')
		{
			ans = 1;
		}
	}
	if (ans == 1)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int f=0;
	for(int i=0;i<=25;i++)
	{
		for(int j=0;j<=15;j++)
		{
			if(j*7+i*4==n)
			{
			  f=1;
			  break;
			}
		}
	}
	if(f==0)
	printf("No\n");
	else
	printf("Yes\n");
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
int main() {
    int n,r;
    cin >> n >> r;
    if(n >= 10) dunk(r);
    else dunk(r+100*(10-n));
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
using namespace std;
class process {
public:
	string name;
	int time;
};
class queue {
public:
	process A[100000];
	int head, tail;
	void enqueue(process x) {
		A[tail] = x;
		tail = (tail + 1) % 100000;
		return;
	}
	process dequeue() {
		process x = A[head];
		head = (head + 1) % 100000;
		return x;
	}
};
int main() {
	int elaps = 0, c, n, q;
	cin >> n >> q;
	queue z;
	for (int i = 0; i < n; i++) {
		cin >> z.A[i].name >> z.A[i].time;
	}
	z.head = 0; z.tail = n % 100000;
	while (z.head != z.tail) {
		process u = z.dequeue();
		c = min(q, u.time);
		u.time -= c;
		elaps += c;
		if (u.time > 0)z.enqueue(u);
		else cout << u.name << " " << elaps << endl;
	}
	return 0;
}

Measured memory_bytes: 5116
#include<stdio.h>
#include<string.h>
int main(void){
  char s[100];
  char k[100];
  int i;
  scanf("%s\n",s);
  scanf("%s",k);
  i = strlen(s);
  if(strncmp(s,k,i) == 0){
		printf("Yes");
  }else{
printf("No");
  }
return 0;
}
  

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

#define size_t int

using namespace std;
typedef long l;
typedef long long ll;

size_t mod(size_t a, size_t b) {
    return ((b + (a % b)) % b);
}

// sort(a.begin(), a.end(), [](auto& x, auto& y){return x[0] < y[0];});

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

  int N, M;
  cin >> N >> M;
  vector<int> point(N+1,0);
  vector<vector<int>> pairs(M, vector<int>(2,0));
  for (int i = 0; i < M; i++) {
    int a,b;
    cin >> a >> b;
    pairs[i][0] = a;
    pairs[i][1] = b;
  }
  sort(pairs.begin(), pairs.end(), [](auto& x, auto& y){return x[0] < y[0];});

  for (int i = 0; i < M; i++) {
    if(pairs[i][0] == 1){
      point[pairs[i][1]] = 1;
    }
    if(pairs[i][1] == N){
      if(point[pairs[i][0]] == 1){
        std::cout << "POSSIBLE" << '\n';
        return 0;
      }
    }
  }

  std::cout << "IMPOSSIBLE" << '\n';
  return 0;
}


Measured memory_bytes: 12032
#include <bits/stdc++.h>
#include <iostream>
#define ll long long

using namespace std;

int main()
{
	ll n,a=0,b,c,d;
    cin>>n;
   ll nums[n];
    
    for(ll i=0;i<n;i++)
    {
        cin>>nums[i];
    }
    
    sort(nums,nums+n);
    reverse(nums,nums+n);
    b=nums[0];
    c=(n/2);
    d=nums[c];
    for(ll i=1;i<c;i++)
    {
       a+=2*nums[i];
        
    }
    if(n%2==0)
    {cout<<a+b;}
    else 
    {cout<<a+b+d;}
    
	return 0;
}

Measured memory_bytes: 5132
import scala.io.StdIn.{readInt, readLine};
import scala.reflect.ClassTag;
object Main {
    def main(args: Array[String]): Unit = {
        val n = readInt;
        val g = new Graph(n);
        (0 until n).foreach { i => 
            readLine.split(" ").map(_.toInt).toList match {
                case src :: d :: dst => g.add(src, dst);
                case _ => ()
            }
        }
        g.breadthFirstSearch.foreach { e => println("%d %d".format(e._2, e._1))}
    }
}
class Graph(n: Int) {
    val size = n + 1;
    val matrix = Array.ofDim[Int](size, size);
    
    def add(src: Int, dsts: Seq[Int]): Unit = if (src > 0 && src < size) {
        dsts.foreach { d => if (d > 0 && d < size) matrix(src)(d) = 1};
    }
    
    def dump(): Unit = matrix.slice(1, size).foreach { a => println(a.slice(1, size).mkString(" "))}
    
    def breadthFirstSearch: Array[(Int, Int)] = {
        val distance = new Array[Int](size).map(a => -1);
        val que = new Queue[Int](size);
        def go(): Unit = que.deque() match {
            case None => ();
            case Some(target) => {
                (1 until size).foreach { i =>
                    if (matrix(target)(i) == 1 && distance(i) == -1) {
                        que.enque(i);
                        distance(i) = distance(target) + 1;
                    }
                }
                go();
            }
        }
        que.enque(1);
        distance(1) = 0;
        go();
        distance.zipWithIndex.slice(1, size);
    }
}
class Queue[A](size: Int)(implicit m: ClassTag[A]) {
    var inPtr = 0;
    var outPtr = 0;
    var cnt = 0;
    val q = m.newArray(size);
    
    def isEmpty: Boolean = cnt == 0;
    
    def isFull: Boolean = cnt == size;
    
    def enque(elem: A): Boolean = if (isFull) false else {
        q(inPtr) = elem;
        inPtr = if (inPtr == (size - 1)) 0 else inPtr + 1;
        cnt += 1;
        true;
    }
    
    def deque(): Option[A] = if (isEmpty) None else {
        val elem = q(outPtr);
        outPtr = if (outPtr == size - 1) 0 else outPtr + 1;
        cnt -= 1;
        Some(elem);
    }
}


Measured memory_bytes: 44732
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        if (a<b && b<c) System.out.println("Yes");
        else System.out.println("No");
        scan.close();
    }
}


Measured memory_bytes: 26328
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int X = sc.nextInt();

		int num = a + b;
		if (a <= X && X <= num) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 22484
#include <stdio.h>
 
int main(void) {

	int n, m, i, a[10001], s;
	
	scanf("%d %d", &n, &m);
	
	for(i = 0; i < m; i++){
		scanf("%d", &a[i]);
	}
	for(i = 0, s = 0; i < m; i++){
		s += a[i];
	}
	
	if(s > n)
		printf("-1");
	else
		printf("%d", n - s);

	return 0;
}

Measured memory_bytes: 1756
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] o = sc.next().toCharArray();
        char[] e = sc.next().toCharArray();
        if(o.length==e.length){
            for(int i = 0;i<o.length;i++){
                System.out.print(o[i]);
                System.out.print(e[i]);
            }
        } else {
          int j = 0;  
          for(int i = 0;i<e.length;i++){
                System.out.print(o[i]);
                System.out.print(e[i]);
           		j = i+1;
            }
            System.out.print(o[j]);
        }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define rep(i,s,e) for (int64_t i=s; i<e; i++)
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int X, ans=0;
  cin >> X;
  if (X>=2000) {
    ans=1;
  }
  else {
    rep(h,0,20) {
      rep(i,0,20) {
        rep(j,0,20) {
          rep(k,0,20) {
            rep(l,0,20) {
              rep(m,0,20) {
                if (100*h+101*i+102*j+103*k+104*l+105*m==X) {
                  ans=1;
                }
              }
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}

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

using ll=long long;
const long long  inf=(ll)1e18;
struct node
{
	int from, to;
	long long cap ,flow;
	node(int u, int v, long long  c, long long f) :from(u), to(v), cap(c), flow(f) {}
};
struct Dinic
{
	int n, m, s, t;//结点数，边数（包括反向弧），源点编号，汇点编号
	static const int N = 1230;
	vector<node>edges;//边表，dges[e]和dges[e^1]互为反向弧
	vector<int>G[N];//邻接表，G[i][j]表示结点i的第j条边在e数组中的编号
	bool vis[N]; //BFS的使用
	int d[N]; //从起点到i的距离
	int cur[N]; //当前弧下标
	void init()
	{
		edges.clear();
		for (int i = 0; i<N; i++)
		{
			G[i].clear();
			vis[N] = false;
			d[i] = 0;
			cur[i] = 0;
		}
	}
	void addedge(int from, int to, long long  cap)
	{
		edges.push_back(node(from, to, cap, 0));
		edges.push_back(node(to, from, 0, 0));
		int  m = edges.size();
		G[from].push_back(m - 2);
		G[to].push_back(m - 1);
	}
	bool bfs()
	{
		memset(vis, 0, sizeof(vis));
		queue<int>Q;
		Q.push(s);
		d[s] = 0;
		vis[s] = 1;
		while (!Q.empty())
		{
			int x = Q.front(); Q.pop();
			for (int i = 0; i<G[x].size(); i++)
			{
				node&e = edges[G[x][i]];
				if (!vis[e.to] && e.cap>e.flow)//只考虑残量网络中的弧
				{
					vis[e.to] = 1;
					d[e.to] = d[x] + 1;
					Q.push(e.to);
				}
			}
		}
		return vis[t];
	}
	long long  dfs(int x, long long  a)//x表示当前结点，a表示目前为止的最小残量
	{
		if (x == t || a == 0)return a;//a等于0时及时退出，此时相当于断路了
		long long  flow = 0, f;
		for (int&i = cur[x]; i<G[x].size(); i++)//从上次考虑的弧开始，注意要使用引用，同时修改cur[x]
		{
			node&e = edges[G[x][i]];//e是一条边
			if (d[x] + 1 == d[e.to] && (f = dfs(e.to, min(a, e.cap - e.flow)))>0)
			{
				e.flow += f;
				edges[G[x][i] ^ 1].flow -= f;
				flow += f;
				a -= f;
				if (!a)break;//a等于0及时退出，当a!=0,说明当前节点还存在另一个曾广路分支。

			}
		}
		return flow;
	}
	long long  Maxflow(int s, int t)//主过程
	{
		this->s = s, this->t = t;
		long long  flow = 0;
		while (bfs())//不停地用bfs构造分层网络，然后用dfs沿着阻塞流增广
		{
			memset(cur, 0, sizeof(cur));
			flow += dfs(s, inf);
		}
		return flow;
	}
}dc;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n + 1);
	for (int i = 1; i <= n; i++) cin >> a[i];


	dc.init();
	long long sum=0;
	for (int i = 1; i <= n; i++) {
		for (int j = 2 * i; j <= n; j += i) {
			dc.addedge(i, j, (ll)1e18);
		}
		if (a[i] > 0) dc.addedge(i, 170, a[i]), sum += a[i];
		else dc.addedge(180, i, -a[i]);
	}
	cout << sum - dc.Maxflow(180, 170) << "\n";
	return 0;
}

Measured memory_bytes: 384
#include<iostream>

using namespace std;

int main(){
  int a,b;
  while(cin >> a >> b&&a||b){
    int cnt=0;
    for(int i=1;i<=a;i++){
      for(int j=i+1;j<=a;j++){
        for(int k=j+1;k<=a;k++){
          if(i+j+k==b)cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}



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

int main()
{
    ll N, M, K; cin >> N >> M >> K;
    vector<ll> A(N, 0);
    vector<ll> B(M, 0);
    vector<ll> AS(N+1, 0);
    vector<ll> BS(M+1, 0);
    ll sum = 0;
    rep(i,N) {
        cin >> A[i];
        sum += A[i];
        AS[i+1] = sum;
    }
    sum = 0;
    rep(i,M) {
        cin >> B[i];
        sum += B[i];
        BS[i+1] = sum;
    }

    ll maxnum = 0;
    rep(i,N+1) {

        ll left = 0; ll right = M;
        while (1) {
            if (left > right) break;
            ll mid = left + (right - left) / 2;

            if (AS[i] + BS[mid] <= K) {
                if (maxnum < i + mid) {
                    maxnum = i + mid;
                }
                left = mid + 1;
            }
            else {
                right = mid - 1;
            }
        }

    }
    cout << maxnum << endl;
    

}


Measured memory_bytes: 9596
#include<stdio.h>

#define MAX 100

int main(){
  int i,j,minj,count,n,A[MAX+1];

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);

  count = 0;

  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(A[j] < A[minj])minj = j;
    }
    A[n] = A[i];
    A[i] = A[minj];
    A[minj] = A[n];
    if(i != minj)count++;
  }

  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1)printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}

Measured memory_bytes: 604
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


template<class T> class BIT   // 1-indexed (0 is not used)
{
private:
    int num;
    vector<T> bit;
public:
    BIT(int n):bit(vector<T>(n+1, 0)), num(n) {}

    T sum(int i) {   // sum of 1..i
        if (!i) return 0;
        return bit[i] + sum(i-(i&-i));
    }

    void add(int i, T x) {
        if (i > num) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }

    int lower_bound(T x) {
        T res=0;
        int N=1;
        while(N<num) N*=2;
        int i;
        for(i=N/2; i>0; i/=2) {
            if(res+i<num && bit[res+i]<x) {
                x = x - bit[res +i];
                res = res + i;
            }
        }
        return res + 1;
    }
};

ll calc( int n, ll* a )
{
    map<ll,int> mp;
    int i;
    for(i=0; i<n; i++) {
        mp[a[i]]=0;
    }
    int num=0;
    auto it=mp.begin();
    for(; it!=mp.end(); ++it) {
        num++;
        it->second=num;
    }

    ll ans=0;
    BIT<int> bit(num);
    for(i=0; i<n; i++) {
        ans += bit.sum(mp[a[i]]);
        bit.add(mp[a[i]], 1);
    }
    return ans;
}

int main(int argc, char* argv[])
{
    int n,K;
    scanf("%d%d", &n, &K);
    vector<ll> a(n),s(n+1);
    int i;
    for(i=0; i<n; i++) {
        scanf("%lld", &a[i]);
        a[i]-=K;
        s[i+1]=s[i]+a[i];
    }

    ll ans = calc( n+1, &s[0] );
    printf("%lld\n", ans);

    return 0;
}



Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  (B) <= (A) && (A) <= (C)
#define AIN(A, B, C) assert(IN(A, B, C))
string s;
void solve(){
    ll n;
    cin>>n;
     int i = 0; 
    while (n > 0) { 
        int rem = n % 26; 
      if (rem == 0) { 
           s+= 'z'; 
            n = (n / 26) - 1;
        } 
        else
        { 
            char f=((rem - 1) + 'a');
            s+=f; 
            n = n / 26; 
        }
        i++; 
    } 
    reverse(s.begin(), s.end()); 
    cout << s<<"\n"; 
  
}
int main() {
    ios;
	int t=1;
	//cin>>t;
	while(t--)solve();
 
    
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

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

    int two = 0;
    each (i, a) two += ((i % 2 == 0) && (i % 4 != 0));

    int four = 0;
    each (i, a) four += (i % 4 == 0);

    int other = (two != 0);
    each (i, a) other += (i % 2 != 0);

    cout << (other <= four + 1 ? "Yes" : "No") << endl;
  }

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    vector<int> w(n), v(n);
    rep(i, n) cin >> w[i] >> v[i];
    vector<vector<ll>> dp(n+1, vector<ll>(m+1));
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            dp[i][j] = dp[i-1][j];
            if (j-w[i-1] >= 0)
                dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }
    cout << dp[n][m] << endl;
    return 0;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

int N, M;
Graph<int> G;
vector<int> dp;

void dfs(int v, int p = -1) {
    dp[v] = 0;
    for (auto nv : G[v]) {
        if (nv == p)
            continue;
        if (!~dp[nv])
            dfs(nv, v);
        dp[v] = max(dp[v], dp[nv] + 1);
    }
}

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

    cin >> N >> M;
    G.resize(N);
    for (int i = 0; i < M; ++i) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        G[x].push_back(y);
    }

    int ans = 0;
    dp.resize(N, -1);
    for (int i = 0; i < N; ++i) {
        if (~dp[i])
            continue;
        dfs(i);
        ans = max(ans, dp[i]);
    }

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


Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
#define int long long 
signed main() {
  int n,wt ;cin >> n>> wt;
  vector<int>w(n),v(n) ;
  for(int i=0;i<n;i++)
    cin >> w[i] >> v[i] ;
  vector<vector<int>>dp(n,vector<int>(wt+1));
  // dp[i][j]->max value with j weight after processing 1st i wts.
  //dp[i][j]=max(dp[i-1][j-w[i]]+v[i],dp[i-1][j])
  for(int i=0;i<wt+1;i++)
    dp[0][i]=(i>=w[0]?v[0]:0) ;
  for(int i=1;i<n;i++)
    for(int j=0;j<wt+1;j++)
      dp[i][j] =max(dp[i-1][j],(j>=w[i]?dp[i-1][j-w[i]]+v[i]:-1)) ;
  cout << dp[n-1][wt] ;
}

Measured memory_bytes: 82200
from itertools import accumulate
from bisect import bisect_left
from math import ceil

N,H = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
# 最も強いaを探す
a_max = max(A)

# それ以上のbを探す
b_strong = []
for b in B:
    if b >= a_max:
        b_strong.append(b)
        
# bをソートしてcum作る
b_strong.sort(reverse=True)
b_cum = list(accumulate(b_strong))
b_cum = [0] + b_cum
    
# もしHPがb_cum[-1]なら投げてるうちに倒せる
if H <= b_cum[-1]:
    ans = bisect_left(b_cum, H)
    
else:
    ans = len(b_cum) - 1
    ans += ceil((H - b_cum[-1]) / a_max)
    
print(ans)

Measured memory_bytes: 17400
n, m = map(int, input().split())
s = []
k = []
for i in range(m):
    s.append(list(map(int, input().split())))
    k.append(s[i].pop(0))
p = list(map(int, input().split()))

# 全点灯パターンの個数
ans = 0

# 点灯している電球の数
cnt_s_on = 0

# 電球jに繋がるONのスイッチの数
cnt_switch = 0

for i in range(2**n):
    cnt_s_on = 0
    
    # すべての電球に対して調べる
    for j in range(m):
        cnt_switch = 0
        
        # 電球jに繋がるすべてのスイッチに対してON/OFFを調べる
        for K in range(k[j]):
            if ((i >> (s[j][K]-1)) & 1):
                # スイッチがONならONカウントに＋する
                cnt_switch += 1
        
        if cnt_switch%2 == p[j]:
            # 電球jは点灯している
            cnt_s_on += 1
    
    if cnt_s_on == m:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    string s;
    cin>>s;
    stack<char> t;


    rep(i,s.size()){
        if(!t.empty()){
            char a=t.top();
            if(a=='S'&&s[i]=='T'){
                t.pop();

            }else{
                t.push(s[i]);
            }
        }else{
            t.push(s[i]);
        }
    }
    cout<<t.size()<<endl;

    return 0;
}


Measured memory_bytes: 644
import math

def distance(x, y):
    return math.sqrt(x*x + y*y)

N, D = map(int, input().split())
XY = [list(input().split()) for _ in range(N)]

count = 0
for i,j in XY:
    if D >= distance(int(i),int(j)):
        count = count + 1
print(count)
    



Measured memory_bytes: 51780
#include <iostream>
#include <algorithm>
#include <cmath>
#include <functional>
#include <string>
#include <vector>
#include <set>
using namespace std;

#define int long long
#define rep(n, i) for (int i = 0; i < n; i++)
#define rep2(m, n, i) for (int i = m; i < n; i++)
#define rep_r(n, i) for (int i = n - 1; i >= 0; i--)

const int INF = 1LL << 60;
const int MOD = 1e9 + 7;

signed main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a = x2 - x1;
    int b = y2 - y1;
    cout << x2 - b << " " << y2 + a << " " << x1 - b << " " << y1 + a << endl;
    return 0;
}

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

int main(){
  string s;bool f=1;map<int,int> mp;cin>>s;
  for(int i=0;i<s.size();i++) mp[s.at(i)]++;
  for(auto p:mp) if(p.second%2) f=0;
  cout<<(f?"Yes":"No");
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int large = max(a, max(b, c));
  int all = a+b+c;
  if(large == all-large) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3588
#include <limits>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <unordered_map>
 
using namespace std;

int main(){
    size_t n;
    cin >> n;
    vector<int> spots;
    spots.reserve(n);
    for(size_t i = 0; i < n; ++i){
        int a;
        cin >> a;
        spots.push_back(a);
    }
    
    auto get_pos = [&](int i)
    {
        return (i < 0 || i >= (int)spots.size())? 0 : spots[i];
    };

    auto get_cost = [&](int i, int j)
    {
        return abs(get_pos(i) - get_pos(j));
    };
    
    const int total_cost = [&]() -> int {
        int cost = 0;
        for(size_t i = 0; i <= n; ++i)
        {
            cost += get_cost(i, i-1);
        }
        return cost;
    }();
    
    for(size_t non_visit = 0; non_visit < n; ++non_visit)
    {
        const int cost = total_cost
            - get_cost(non_visit-1, non_visit  )
            - get_cost(non_visit,   non_visit+1)
            + get_cost(non_visit-1, non_visit+1);
        
        cout << cost << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1664
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		String[] s = Integer.toString(n).split("");
		int num = 0;
		for(int i = 0;i < s.length;i++){
			num += Integer.parseInt(s[i]);
		}
		if(n%num == 0){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21332
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
typedef vector<int> vi;
const int MOD=1e9+7;
int adm(int a,int b){
	return (a+b)%MOD;
}

int main(){
	int H,W;
	cin>>H>>W;
	char a[1001][1001];
	rep(i,H)rep(j,W){
		cin>>a[i][j];
	}
	int dp[1001][1001];
	dp[0][0]=1;
	rep1(i,H-1){
		if(a[i][0]=='#')dp[i][0]=0;
		else dp[i][0]=dp[i-1][0];
	}
	rep1(j,W-1){
		if(a[0][j]=='#')dp[0][j]=0;
		else dp[0][j]=dp[0][j-1];
	}
	rep1(i,H-1)rep1(j,W-1){
		if(a[i][j]=='#')dp[i][j]=0;
		else dp[i][j]=adm(dp[i][j-1],dp[i-1][j]);
	}
	cout<<dp[H-1][W-1];
}


Measured memory_bytes: 5120
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int n;
    int k;
    cin >> n >> k;
    //cin >> k;

    //cout << n <<" "<< k << endl;

    vector<int> list;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        list.push_back(a);
    }

    int count =0;
    for(int i=0;i<n;i++){
        if(k<=list[i]){
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N, R;


signed main(){
    cin >> N >> R;

    if(N >= 10) cout << R << endl;
    else cout << R+100*(10-N) << endl;

    return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin >> n;
  if(n%2==0)
    cout << n/2-1 << endl;
  else
    cout << n/2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


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

    int ans = 1;
    if (x<600) ans = 8;
    else if (x<800) ans = 7;
    else if (x<1000) ans = 6;
    else if (x<1200) ans = 5;
    else if (x<1400) ans = 4;
    else if (x<1600) ans = 3;
    else if (x<1800) ans = 2;
    else if (x<2000) ans = 1;

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


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

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

int main(void)
{
	int a, b, c, x;
	cin >> a >> b >> c >> x;


	int count = 0;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (500*i+100*j+50*k == x)
					count++;
			}
		}
	}

	cout << count << endl;
	return 0;
}


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

#define int long long
#define ll long long
#define f1(i,a,b) for(i=a;i<b;i++)
#define f2(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
int i,j;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/in.txt","r",stdin);
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/out.txt","w",stdout);
    // #endif
    int n,k;
    cin>>n>>k;
    int a[n];
    f1(i,0,n)
    cin>>a[i];
    int dp[n];
    dp[0]=0;
    f1(i,1,n)
    {
    	dp[i]=mod;
    	f1(j,1,k+1)
    	{
    		if(i-j>=0)
    		{
    			dp[i]=min(dp[i-j]+abs(a[i]-a[i-j]),dp[i]);
    		}
    	}
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1792