akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;

void make_lunlun(vector<ll>& res, int k){
    int count = 0;
    vector<ll> tmp;
    for(int i = 1; i < 10; i++){
        tmp.push_back(i);
        res.push_back(i);
        count++;
    }

    while(count < k + 10){
        vector<ll> new_tmp;
        for(auto x: tmp){
            if(x % 10 == 9){
                ll newX = x * 10 + 8;
                res.push_back(newX);
                new_tmp.push_back(newX);
                count++;

                newX = x * 10 + 9;
                res.push_back(newX);
                new_tmp.push_back(newX);
                count++;
            }
            else if(x % 10 == 0){
                ll newX = x * 10;
                res.push_back(newX);
                new_tmp.push_back(newX);
                count++;

                newX = x * 10 + 1;
                res.push_back(newX);
                new_tmp.push_back(newX);
                count++;
            }
            else{
                for(int i = -1; i <= 1; i++){
                    ll newX = x * 10 + x % 10 + i;
                    res.push_back(newX);
                    new_tmp.push_back(newX);
                    count++;
                }
            }
            if(count >= k + 10){
                break;
            }
        }
        tmp.clear();
        for(auto x: new_tmp){
            tmp.push_back(x);
        }
    }
}


int main(){
    int m, n;   cin >> n >> m;
    vector<int> a(n, 0);
    int s = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        s += a[i];
    }

    int count = 0;
    for(int i = 0; i < n; i++){
        int x = (s + 4 * m - 1) / (4 * m);
        if(a[i] < x){
            continue;
        }
        count++;
    }

    if(count >= m){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y
N,M=LI()
S=input()
ptr = N

res = []
while True:
    ok = 0
    for i in range(1,M+1):
        if ptr >= i and S[ptr - i] == '0':
            ok = i
    ptr -= ok
    res.append(ok)
    if ptr == 0:
        res.reverse()
        print(*res)
        exit()
    if ok == 0:
        print(-1)
        exit()


Measured memory_bytes: 6512
#include <bits/stdc++.h>
#include <set>
using namespace std;
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define fill(x, y)     memset(x, y, sizeof(y))
#define all(x)         (x).begin(), (x).end()
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;

const int INF = 1e9 + 5;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  vi h(N+1);
  h[0] = INF;
  for (int i = 1; i <= N; i++) {
    cin >> h[i];
  }
  vi dp(N+1, INF);
  dp[0] = 0;
  dp[1] = 0;
  for (int i = 2; i <= N; i++) {
    for (int j = 1; j <= min(i-1,K); j++) {
      dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    }
  }
  cout << dp[N] << "\n";
  return 0;
}

Measured memory_bytes: 3936
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,a,b,c=0,ans=0;
  cin>>a>>b>>c;
  if(b>=a)
  {
    cout<<c<<endl;
  }
  else
  {
    long t=max(0,(c-(a-b)));
    cout<<t<<endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

int main() {
    int n;
    cin >>n;
    vector<int> order(n);
    for (int i = 0; i < n; i++) {
        int a = 0;
        cin >> a;

        order[a - 1] = i + 1;
    }

    cout << order[0];
    for (int i = 1; i < n; i++) {
        cout << " " << order[i];
    }

    cout << endl;
}


Measured memory_bytes: 1152
n = int(input())
a = [int(input()) for _ in range(n)]

ans = 0
for i in range(n - 1):
    if a[i] & 1 and a[i + 1] > 0:
        a[i] -= 1
        a[i + 1] -= 1
        ans += 1
for i in range(n):
    ans += a[i] // 2


print(ans)


Measured memory_bytes: 13016
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N;
	scanf("%d",&N);
	printf("%d\n",N/3);
}


Measured memory_bytes: 256
#include <stdio.h>
#define MIN(a,b) ((a>b)? b:a)
#define INT_MAX (1<<22)

int dp[61];
int data[61];

int search(int remains){
  if(dp[remains]) return data[remains];

  if(remains == 0) return 0;
  if(remains == 1) return INT_MAX;

  int k=INT_MAX;

  if(remains >= 15) k = MIN(k, search(remains-15)+2244);
  if(remains >= 12) k = MIN(k, search(remains-12)+1870);
  if(remains >= 10) k = MIN(k, search(remains-10)+1520);
  if(remains >= 5) k = MIN(k, search(remains-5)+850);
  if(remains >= 3) k = MIN(k, search(remains-3)+550);
  if(remains >= 2) k = MIN(k, search(remains-2)+380);

  dp[remains] = 1;
  return data[remains] = k;
}


int main(){
  int i;
  for(i=0;i<=60;i++) dp[i] = 0, data[i] = 0;

  search(60);
  
  int m = INT_MAX;
  /*for(i=60;i>=0;i--) {
    if(dp[i]) {
      m = data[i] = MIN(data[i], m);
    }else {
      data[i] = m;
    }
  }*/

  int n;
  while(1){
    scanf("%d", &n);
    if(n==0) break;
    printf("%d\n", data[n/100]);
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define x first
#define y second

inline void check_min(int a,int &b){if(a<b)b=a;}
inline void check_max(int a,int &b){if(a>b)b=a;}

namespace TaoLuTi
{
	typedef std::pair<int,int> pii;
	const int N=2010;
	bool s[N],t[N];
	int n;

	inline int pre(int p){return p==1?n:p-1;}
	inline int suc(int p){return p==n?1:p+1;}

	bool initialize()
	{
		static char tmp[N];
		scanf("%s",tmp+1);
		n=strlen(tmp+1);
		bool flag=0;
		for(int i=1;i<=n;i++)flag|=(s[i]=tmp[i]-'0');
		scanf("%s",tmp+1);
		for(int i=1;i<=n;i++)t[i]=tmp[i]-'0';
		for(int i=1;i<=n;i++)if(t[i])return 1;
		return !flag;
	}

	int L[N],R[N];
	void precalc()
	{
		int p=0;
		for(int i=1;i<=n;i++)
			if(t[i]){p=i;break;}
		if(!p)return;
		L[p]=R[p]=0;
		for(int i=suc(p);i!=p;i=suc(i))
			L[i]=t[i]?0:(L[pre(i)]+1);
		for(int i=pre(p);i!=p;i=pre(i))
			R[i]=t[i]?0:(R[suc(i)]+1);
	}

	pii A[N];
	int sufmax[N];
	int tot;

	inline int abs(int x){return x<0?-x:x;}
	inline int calc(int dl,int dr,int tl,int tr)
	{
		int x=dl+dr*2,y=dl*2+dr,ret=23333;
		check_min(x+dl+tr,ret);
		check_min(x+abs(dl-tl),ret);

		check_min(y+dr+tl,ret);
		check_min(y+abs(dr-tr),ret);
		return ret;
	}
	int work(int pos)
	{
		int delta=pos-1;
		tot=0;
		for(int i=1,ti;i<=n;i++)
		{
			ti=i+delta,ti-=(ti>n)*n;
			if(s[i]!=t[ti])A[++tot]=pii(L[i],R[i]);
		}
		std::sort(A+1,A+tot+1);
		A[0]=pii(0,0),sufmax[tot+1]=0;
		for(int i=tot;i;i--)
			sufmax[i]=std::max(A[i].y,sufmax[i+1]);

		int ret=233333;
		for(int i=0,x,y;i<=tot;i++)
		{
			x=A[i].x,y=sufmax[i+1];
			check_min(calc(x,y,n-delta,delta),ret);
		}

		return ret+tot;
	}

	void solve()
	{
		if(!initialize()){printf("-1\n");return;}
		precalc();

		int ans=233333;
		for(int i=1;i<=n;i++)
			check_min(work(i),ans);
		printf("%d\n",ans);
	}
}

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


Measured memory_bytes: 256
<?php
// D
fscanf(STDIN, '%d', $n);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
sort($a);
$l = $a[$n - 1];
$r = -1;
$d = PHP_INT_MAX;
for ($i = 0; $i < $n - 1; $i++) {
    $td = abs($l / 2 - $a[$i]);
    if ($td < $d) {
        $d = $td;
        $r = $a[$i];
    }
}
echo implode(' ', [$l, $r]);

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

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    for (int i=0; i<N; i++) {
        cin >> S.at(i);
    }

    int AC = 0;
    int WA = 0;
    int TLE = 0;
    int RE = 0;
    for (int i=0; i<N; i++) {
        if (S.at(i) == "AC") {
            AC++;
        }
        else if (S.at(i) == "WA") {
            WA++;
        }
        else if (S.at(i) == "TLE") {
            TLE++;
        }
        else if (S.at(i) == "RE") {
            RE++;
        }
    }
    cout << "AC" << " " << "x" << " " << AC << endl;
    cout << "WA" << " " << "x" << " " << WA << endl;
    cout << "TLE" << " " << "x" << " " << TLE << endl;
    cout << "RE" << " " << "x" << " " << RE << endl;
}

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

vector<int> v;

int main() {
    int n; cin >> n;
    long long su = 0;
    while(n--) {
        int i; cin >> i;
        v.push_back(i);
        su += i;
    }
    long long csu = 0, ans = 0xFFFFFFFFFFFFFFull;
    for(int i:v) {
        csu += i;
        ans = min(ans, max(2*csu - su, su-2*csu));
    }
    cout << ans << endl;
} 

Measured memory_bytes: 1400
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        sc.close();
        System.out.println(s.substring(0,k-1) + s.substring(k-1,k).toLowerCase() + s.substring(k));
    }
}


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

int main() {
  string S;
  cin >> S;
  int N;
  N = S.size();
  int i = 0;
  bool f =true;
  while (i < N) {
    if (i % 2 == 0) {
      if (S.at(i) == 'L') {
        f = false;
        break;
      }
      i++;
    }
    else {
      if (S.at(i) == 'R') {
        f = false;
        break;
      }
      i++;
    }
  }
  if (f) {
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
}

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

int main(){
  int n,m;
  cin>>n>>m;
  int tmp=n+100;
  int ans=0;
  vector<pair<int,int>> island(m);
  for (int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    island.at(i)={a,b-1};
  }
  sort(island.begin(),island.end());
  for (int i=0;i<m;i++){
    int a=island.at(i).first,b=island.at(i).second;
    if (tmp<a) {ans++; tmp=b;}
    else if(tmp>b) tmp=b;
  }
  cout<<ans+1<<endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
  char ch;
  while(1){
    scanf("%c",&ch);
    if('a'<=ch&&ch<='z'){
      printf("%c",ch-32);
    }else if('A'<=ch&&ch<='Z'){
      printf("%c",ch+32);
    }else{
      printf("%c",ch);
    }
    if(ch=='\n')break;
  }
  return 0; 
}




Measured memory_bytes: 2032
#include <iostream>
#include<algorithm>

using namespace std;

void LCS(string s1,string s2)
{
    int n=s1.length(),m=s2.length();
    int LCS[n+1][m+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(i==0||j==0)
                LCS[i][j]=0;
            else if(s1[i-1]==s2[j-1])
                LCS[i][j]=1+LCS[i-1][j-1];
            else
                LCS[i][j]=max(LCS[i-1][j],LCS[i][j-1]);
        }
    }
    int i=n,j=m;
    string lcs;
    while(i>0&&j>0)
    {
        if(s1[i-1]==s2[j-1])
        {
            lcs.push_back(s1[i-1]);
            --i;
            --j;
        }


        else if (LCS[i-1][j] >= LCS[i][j-1])
         --i;
        else if(LCS[i-1][j] < LCS[i][j-1])
         --j;


    }
    reverse(lcs.begin(),lcs.end());
    cout<<lcs<<endl;
}

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    LCS(s1,s2);
}


Measured memory_bytes: 35456
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static string S;

    public static void Main(string[] args)
    {
        S = Input.NextString();
        int ans0 = 0;
        int ans1 = 0;
        for (int i = 0; i < S.Length; i++)
        {
            switch (i % 2)
            {
                case 0:
                    if (S[i] == '0')
                        ans0++;
                    else
                        ans1++;
                    break;
                case 1:
                    if (S[i] == '0')
                        ans1++;
                    else
                        ans0++;
                    break;
            }
        }

        Console.WriteLine(Math.Min(ans0, ans1));
    }
}

public static class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

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

int main() {
    int64_t ai, ao, at, aj, al, as, az;
    cin >> ai >> ao >> at >> aj >> al >> as >> az;
    int64_t answer = ai / 2 * 2 + ao + aj / 2 * 2 + al / 2 * 2;
    if (ai & aj & al & 1) {
        answer += 3;
    } else if ((ai & 1) + (aj & 1) + (al & 1) == 2 && ai && aj && al) {
        answer += 1;
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long>a(n+1);//0番目=2だから要素数はn+1
  a.at(0)=2;
  a.at(1)=1;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  for(int i=2;i<=n;i++){
    a.at(i)=a.at(i-2)+a.at(i-1);
  }
  cout<<a.at(n)<<endl;
}

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

using namespace std;

map<int, int> memo;

bool dfs(int n, int x) {
    if (memo[n] == -1) return false;
    if (n == x) return true;
    if (n > x) return false;

    if (dfs(n + 100, x)) return true;
    if (dfs(n + 101, x)) return true;
    if (dfs(n + 102, x)) return true;
    if (dfs(n + 103, x)) return true;
    if (dfs(n + 104, x)) return true;
    if (dfs(n + 105, x)) return true;

    memo[n] = -1;

    return false;
}

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

    vector<vector<int>> v(10);

    for (int i=0;i<S.size();i++) {
        int n = S[i] - '0';
        v[n].push_back(i);
    }

    int ans = 0;
    char s[4];
    for (int i=0;i<1000;i++) {
        snprintf(s, sizeof(s), "%03d", i);

        if (v[s[0]-'0'].size() > 0) {
            int idx = v[s[0]-'0'][0];

            auto iter = upper_bound(v[s[1]-'0'].begin(),v[s[1]-'0'].end(), idx);
            if (iter == v[s[1]-'0'].end()) continue;

            auto iter2 = upper_bound(v[s[2]-'0'].begin(),v[s[2]-'0'].end(), *iter);
            if (iter2 == v[s[2]-'0'].end()) continue;

            ans++;

        } else {
            continue;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = 0, y = 0, z = 0;
		String ans = "NO";

		x = a % b;
		z = a;
		
		if (x == c) {
			ans = "YES";
		} else {
			while (x != y) {
				z += a;
				y = z % b;
				if (y == c) {
					ans = "YES";
					break;
				}
			}
		}
		
		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 25044
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// using cd = complex<double>;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
typedef long long int ll;
typedef long double ld;
const ll N = 2*1e5+9;
// const ll m = 1e9 + 7;
const ll inf= 1e14;
const ll mod =1e9+7;
const double PI = acos(-1);
// #define x first
// #define y second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define pld pair<ld,ld>
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt","w",stderr); 
    #endif
    ll t = 1;
    // cin>>t;
    while(t--){
        ll n;cin>>n;
        string s;cin>>s;
        ll w = 0,r = 0;
        ll nr[n],nw[n];
        memset(nr,0,sizeof(nr));
        memset(nw,0,sizeof(nw));
        for(int i = 0;i<n;i++){
            if(s[i]=='W'){
                w++;
            }
            else{
                r++;
            }
            nr[i] = r;
            nw[i] = w;
        }
        ll ans = r;
        for(int i = 0;i<n;i++){
            if((r)>=(i+1)){
                ans = min(ans,r-nr[i]);
            }
            else{
                ans = min(ans,nw[i]);

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

    }

        
}

Measured memory_bytes: 6844
n=int(input())
lis=[[] for _ in range(n)]
for i in range(n):
  a,b,c=map(int,input().split())
  lis[i]=[a,b,c]  
dp=[[0]*(n+1) for _ in range(3)]
for i in range(1,n+1):
  dp[0][i]=max(dp[1][i-1]+lis[i-1][0],dp[2][i-1]+lis[i-1][0])
  dp[1][i]=max(dp[0][i-1]+lis[i-1][1],dp[2][i-1]+lis[i-1][1])  
  dp[2][i]=max(dp[0][i-1]+lis[i-1][2],dp[1][i-1]+lis[i-1][2])
d=dp[0][n]
for i in range(1,3):
  if dp[i][n]>d:
    d=dp[i][n]
print(d)


Measured memory_bytes: 34676
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    
    vector<long long> A(X), B(Y), C(Z);
    for(int i = 0; i < X; i++) cin >> A[i];
    for(int i = 0; i < Y; i++) cin >> B[i];
    for(int i = 0; i < Z; i++) cin >> C[i];
    
    vector<long long> AB, ABC;
    for(int i = 0; i < X; i++){
        for(int j = 0; j < Y; j++){
            AB.push_back(A[i] + B[j]);
        }
    }
    
    sort(AB.begin(), AB.end());
    reverse(AB.begin(), AB.end());
    
    for(int i = 0; i < min(K, (int)AB.size()); i++){
        for(int j = 0; j < Z; j++){
            ABC.push_back(AB[i] + C[j]);
        }
    }
    
    sort(ABC.begin(), ABC.end());
    reverse(ABC.begin(), ABC.end());
    
    for(int i = 0; i < K; i++){
        cout << ABC[i] << endl;
    }
}

Measured memory_bytes: 43176
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    int n,A[200001];
    cin>>n;
    rep(i,n) cin>>A[i];
    int ans=0;
    rep(i,n) ans+=A[i];
    int a=0,b=10000;
    rep(i,n) if(A[i]%10) a++,b=min(b,A[i]);
    if(ans%10) cout<<ans;
    else if(a==0) cout<<0;
    else cout<<ans-b;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#define MAX 100000
using namespace std;

struct Process {
  string name;
  int time;
};

Process processes[MAX];
int head, tail, n;

bool isEmpty() {
  return head == tail;
}

bool isFull() {
  if (isEmpty()) return false;
  if (head < tail) {
    return head - tail == 1;
  } else {
    return head == 0 && tail == MAX - 1;
  }
}

void enqueue(Process p) {
  if (isFull()) {
    cout << "queue is full!";
    return;
  }
  processes[tail] = p;
  tail++;
  if (tail >= MAX) tail = 0;
}

Process dequeue() {
  if (isEmpty()) {
    throw "queue is empty!";
  }
  Process p = processes[head];
  head++;
  if (head >= MAX) head = 0;
  return p;
}

int main() {
  int n, q;
  int total = 0;
  int index = 0;
  head = 0;
  tail = 0;
  Process p;

  cin >> n >> q;

  for (int i = 0; i < n; i++) {
    cin >> p.name >> p.time;
    enqueue(p);
  }

  while (true) {
    p = dequeue();
    if (p.time <= q) {
      total += p.time;
      cout << p.name << " " << total << endl;
    } else {
      p.time -= q;
      enqueue(p);
      total += q;
    }
    if (isEmpty()) {
      break;
    }
  }

  return 0;
}

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

void solve() {
  string s; cin >> s;
  int ans = 0;
  for(auto &c : s) ans += c == '2';
  cout << ans << endl;
}

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<stdio.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;

#define ll long long

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

inline void out (int x)
{
	if (x>9) out(x/10);
	putchar (x%10+'0');
}

void doing ()
{
	int a,b,c,d;
	int aa[1100];
	memset(aa,0,sizeof(aa));
	int ans=0;
	a=read(); b=read(); c=read(); d=read();
	for (int i=a;i<b;i++) aa[i]++;
	for (int i=c;i<d;i++) aa[i]++;
	for (int i=0;i<=100;i++) if (aa[i]==2) ans++;
	cout<<ans<<endl;
}

int main ()
{
	//freopen("xx.in","r",stdin);
	//freopen("xx.out","w",stdout);
	doing ();
	return 0;
}



Measured memory_bytes: 256
from itertools import permutations
from math import ceil, floor

h, w = map(int, input().split())

res = h * w
for l in permutations((h, w), 2):
    for i in range(1, l[0]):
        s1 = i * l[1]
        for m in permutations((l[0] - i, l[1]), 2):
            s2 = floor(m[0] / 2) * m[1]
            s3 = ceil(m[0] / 2) * m[1]
            val = max(s1, s2, s3) - min(s1, s2, s3)
            if val < res:
                res = val

print(res)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;

int main() {
    int n;
    cin>>n;
    char c;
    bool y=false;
    rep(i,n) {
        cin>>c;
        if (c=='Y') y=true;
    }
    if (y) cout<<"Four"<<endl;
    else cout<<"Three"<<endl;
} 


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
flag = True
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            continue
        else:
            flag = False
            break

if flag:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 38256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC122A
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();

            if (input == "A") Console.WriteLine('T');
            if (input == "C") Console.WriteLine('G');
            if (input == "G") Console.WriteLine('C');
            if (input == "T") Console.WriteLine('A');
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS; ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MX  100001
#define FF freopen("input.in","r",stdin); freopen("output.txt","w",stdout);
int dp[MX][2];
int n;
int a[MX];
int f(int k,bool turn)
{
    if(k==0)return 0;
    if(dp[k][turn]!=-1)return dp[k][turn];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(k-a[i]<0)break;
        else
            dp[k][turn]=ans |= !f(k-a[i],!turn);
    }
    return ans;
}
int main()
{
    //FF;
    IOS;
    int k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    memset(dp,-1,sizeof dp);
    if(f(k,0))cout<<"First";
    else
        cout<<"Second";
}



Measured memory_bytes: 7296
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        if ((A*B) % 2 == 0) {
            System.out.println("Even");
        } else {
            System.out.println("Odd");
        }
    }

    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () {
            s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 22612
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		
		int p[] = new int[n];
		for(int i=0; i<n;i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		
//		for(int i=0; i<n;i++) {
//			System.out.println(p[i]);
//		}

		boolean flg = true;
		for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		}
		if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		}

		int xx =0;
		for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
		}

	}
	
}


Measured memory_bytes: 36072
#pragma GCC optimize(3 , "Ofast" , "inline")

#include <bits/stdc++.h>

#define rep(i , a , b) for(register int i=(a);i<=(b);i++)
#define rop(i , a , b) for(register ll i=(a);i<(b);i++)
#define per(i , a , b) for(register ll i=(a);i>=(b);i--)
#define por(i , a , b) for(register ll i=(a);i>(b);i--)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<double , double > pi;
template<class T>
inline void read (T &x) {
    x = 0;
    int sign = 1;
    char c = getchar ();
    while (c < '0' || c > '9') {
        if ( c == '-' ) sign = - 1;
        c = getchar ();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar ();
    }
    x = x * sign;
}
const int maxn = 1e6+10;
const int inf = int (1e9);
const ll INF = ll(1e18);
const double PI = acos (-1);
const int mod = 1e9+7;
const double eps = 1e-8;
struct point {
    double x,y;
}e[maxn];

inline double dist(point a,point b){
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}


int main(){
    int n;
    read (n);
    point o;
    rep (i,1,n) {
        scanf ("%lf%lf",&e[i].x,&e[i].y);
        o.x+=e[i].x;
        o.y+=e[i].y;
    }
    o.x/=n;
    o.y/=n;
    double ans=0;
    double delta=1000000.0;
    int id;
    while(delta>eps){
        id=1;
        double maxDis=dist(o,e[id]);
        for(int i=2;i<=n;i++){
            double tempDis=dist(o,e[i]);
            if(tempDis>maxDis){
                maxDis=tempDis;
                id=i;
            }
        }
        ans=maxDis;
        o.x+=(e[id].x-o.x)/maxDis*delta;
        o.y+=(e[id].y-o.y)/maxDis*delta;
        delta*=0.998;
    }
    printf("%.10f\n",ans);
    return 0;
}

/*
 *
 */

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

//ll f(int x) {return x(x+1)/2;}

int main()
{
  int n; cin >> n;
  ll ans = 0;
  vector<ll> tot(n+1);
  rep2(i,n){
    for(int j=i; j<=n; j=j+i){
	    tot[j]++;
    }
  }
  rep2(i,n){
    ans += i * tot[i];
  }
  cout << ans << endl;
  return 0;
}

/*
g++ c.cpp
./a.out

oj d https://atcoder.jp/contests/abc172/tasks/abc172_c
g++ c.cpp
oj t
*/


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

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>


void solve(){
	ll s;
	cin >> s;
	
	const int v=1000000000;
	
	int y=ceil((long double)s/(long double)v);
	int x=v*y-s;
	
	cout<<"0 0 1000000000 1 " << x << " " << y <<endl;
}

int main(){

    solve();
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (b - a == c - b)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
} 

Measured memory_bytes: 3556
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e9

using namespace std;

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

int main() {
    int N, A;
    cin >> N >> A;
    if (N % 500 <= A) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

using Graph=vector<vector<int>>;

int main(){
  int N,M,S,T;
  cin>>N>>M;
  Graph G(N);
  for(int i=0;i<M;++i){
    int u,v;
    cin>>u>>v;
    --u,--v;
    G[u].push_back(v);
  }
  cin>>S>>T;
  --S,--T;

  queue<vector<int>> que;
  vector<vector<bool>> ch(N,vector<bool>(3,false));
  vector<int> v={S,0,0};
  que.push(v);
  ch[S][0]=true;
  int ans=-1;
  while(!que.empty()){

    auto w=que.front();
    que.pop();
    int x=w[0],y=w[1],z=w[2];
    //cout<<x<<y<<endl;

    if(x==T && y==0){
      ans=z;
      break;
    }
    else{
      if(y!=2){
        for(auto nv:G[x]){
          if(!ch[nv][y+1]){
            ch[nv][y+1]=true;
            vector<int> nw={nv,y+1,z};
            que.push(nw);
          }
        }
      }
      else if(y==2){
        for(auto nv:G[x]){
          if(!ch[nv][0]){
            ch[nv][y+1]=true;
            vector<int> nw={nv,0,z+1};
            que.push(nw);
          }
        }
      }
    }
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 12800
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[10];
	int m=0;
	for(int i=n;i<1000;i++){
		int sum=0;
		int m=0;
		int x=i;
		while(x!=0){
			a[m++]=x%10;
			x/=10;
		}
		int ex=a[0];
		for(int j=0;j<m;j++){
			if(ex==a[j]) sum++;
		}
		if(sum==3) break;
	}
	for(int i=0;i<3;i++)
		cout<<a[i];
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <math.h>
#include <set>
 
#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;
typedef pair<int,int> P;

int n;
int x[30],y[30],r[30],c[30];
int dp[1<<24];

bool over(int i,int j){
	return (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])<(r[i]+r[j])*(r[i]+r[j]);
}

int dfs(int bit){
	//cout<<bit<<endl;
	if(dp[bit]!=-1)return dp[bit];
	int res=0;
	REP(i,n){
		if(bit>>i&1)continue;
		bool f=false;
		REP(k,i)if(!(bit>>k&1)&&over(i,k))f=true;
		if(f)continue;
		for(int j=i+1;j<n;j++){
			if(bit>>j&1)continue;
			f=false;
			REP(k,j)if(!(bit>>k&1)&&over(k,j))f=true;
			if(f)continue;
			//cout<<i<<" "<<j<<endl;
			if(c[i]!=c[j])continue;
			//cout<<i<<" "<<j<<endl;
			int a=(bit|1<<i)|1<<j;
			res=max(res,dfs(a)+2);
		}
	}
	return dp[bit]=res;
}

int main(){
	while(1){
		cin>>n;
		if(n==0)break;
		REP(i,n)cin>>x[i]>>y[i]>>r[i]>>c[i];
		memset(dp,-1,sizeof(dp));
		cout<<dfs(0)<<endl;
	}
}



Measured memory_bytes: 68632
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define int long long int
#define vi vector<int>
#define vvi vector < vi >
#define pii pair<int,int>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define tr(k,st,en) for(int k = st; k <= en ; k++)
using namespace std;

int n;

void add_self(int& a, int b){
    a += b;
    if (a >= mod) {
        a-=mod;
    }
    if (a < 0) {
        a += mod;
    }
}

int mul(int a, int b){
    int c = a*b;
    return c%mod;
}

struct M {
    vector<vector<int>> t;
    M(){
        t.resize(n, vector<int>(n));
    }
    M operator * (M& b){
        M c;
        tr(i,0, n-1){
            tr(j,0,n-1){
                tr(k,0,n-1){
                    add_self(c.t[i][j] , mul(t[i][k] ,b.t[k][j]));
                }
            }
        }
        return c;
    }
};
M power(M x, int k){
    M ans;
    tr(i,0,n-1){
        ans.t[i][i] = 1;
    }
    while (k) {
        if (k%2) {
            ans = ans * x;
        }
        x = x*x;
        k/=2;
    }
    return ans;
}

int32_t main()
{
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<vector<int>> dp(n+1,vector<int>(n+1));
    vector<int> pr(n+2);
    string cmp;
    cin>>cmp;
    dp[1][1] = 1;
    pr[0] = 0;
    pr[1] = 1;
    pr[2] = 1;
    tr(i,2,n){
        int pref = 0;
        vector<int> new_pr(n+2);
        tr(j,1,i){
            int L,R;
            if (cmp[i-2] == '<') {
                L = 1;
                R = j-1;
            } else {
                L = j;
                R = i-1;
            }
            add_self(dp[i][j],pr[R] - pr[L-1]);
            add_self(pref, dp[i][j]);
            new_pr[j] = pref;
        }
        pr = new_pr;
    }
    int ans = 0;
    for (int i = 1 ; i <= n; i++) {
        add_self(ans, dp[n][i]);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 73644
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n, m, x, y;

	cin >> n >> m >> x >> y;

	vector<ll> v1(n);
	vector<ll> v2(m);

	REP(i, n) {
		cin >> v1[i];
	}

	REP(i, m) {
		cin >> v2[i];
	}

	sort(v1.begin(), v1.end(), greater<ll>());
	sort(v2.begin(), v2.end());

	ll a = max(x, v1[0]);
	ll b = min(y, v2[0]);

	if (a < b) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class AWannaGoBackHome {
public:
    void solve(std::istream &in, std::ostream &out) {
        string str;
        in >> str;
        bool res = (str.find('N') != -1) == (str.find('S') != -1) and (str.find('W') != -1) == (str.find('E') != -1);
        out << (res ? "Yes" : "No") << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    AWannaGoBackHome solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<cstdio> 
#include<cstring>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#define lson node<<1,st,mid
#define rson node<<1|1,mid+1,ed
#define mem(a,x) memset(a,x,sizeof(a))
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) x&(-x)
#define in freopen("in.txt","r",stdin)
#define out freopen("out.txt","w",stdout) 
typedef long long ll;
const ll mod=998244353;
const ll INF=0x3f3f3f3f;
const ll maxn=1e6+5;
const double pi = acos(-1.0);
using namespace std;
int main(){
	int n,x;
	cin>>n>>x;
	if(500*n>=x) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;
struct edge { ll from; ll to; ll cost; };



int main() {
	string s;
	cin >> s;
	int cnt1 = 0;
	int cnt2 = 0;

	rep(i, 0, s.size()) {
		if (s[i] == '0')cnt1++;
		else cnt2++;
	}

	cout << 2*min(cnt1, cnt2) << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;
typedef long long ll;
//typedef vector<pair<ll.ll>> pii;

int main()
{
    ll h,n;
    cin>>h>>n;
    ll cnt=0;
    ll arr[n];
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    ll sum=0;
for(ll i=0;i<n;i++)
{
    sum+=arr[i];
    if(sum>=h)
    {
    cout<<"Yes";
    exit(0);
    }
    else
    continue;
    
    
}
cout<<"No";

    return 0;
}


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

using namespace std;

int main()
{
    int N, Q;
    int a, b, p, x;

    cin >> N >> Q;
    
    vector<int> G[N];
    vector<int> cnt(N, 0);
    vector<bool> f(N, false);

    for(int i=0; i<N-1; ++i){
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    for(int i=0; i<Q; ++i){
        cin >> p >> x;
        cnt[p-1] += x;
    }

    deque<int> S{0};
    int v, k;
    while(!S.empty()){
        v = S.front();
        S.pop_front();
        f[v] = true;
        for(int i=0; i<G[v].size(); ++i){
            k = G[v][i];
            if(f[k]) continue;
            cnt[k] += cnt[v];
            S.push_back(k);
        }
    }

    for(int i=0; i<N; ++i) cout << cnt[i] << " ";
    cout << endl;

    return 0;
}

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

int main() {
  const int mod=2019;
  int ans=2018;
  int l,r; cin>>l>>r;
  int a,b,c,d;
  a=l/mod;
  b=l%mod;
  c=r/mod;
  d=r%mod;

  if(a!=c) ans=0;
  else {
    for(int i=b;i<d;i++) {
      for(int j=i+1;j<=d;j++) {
          ans=min(ans,i*j%mod);
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    string ans = "Yes";
    for (int i = a; i < c - 1; i++) {
        if (s.at(i) == '#' && s.at(i + 1) == '#')ans = "No";
    }
    for (int i = b; i < d - 1; i++) {
        if (s.at(i) == '#' && s.at(i + 1) == '#')ans = "No";
    }
    if (a<b && c>d) {
        ans = "No";
        for (int i = b-1; i < d; i++) {
            if (s.at(i-1) == '.' && s.at(i) == '.' && s.at(i + 1) == '.')ans = "Yes";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    int x,y;
    cin>>x>>y;
    if(x-y<=0)
        cout<<"0\n";
    else
        cout<<x-y<<endl;
    return 0;
}



Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  int N;
  cin >> N;
  ll ans = 0;
  vll A(N+1, 0);
  for(int i = 0; i < N; i++){
    ll a;
    cin >> a;
    if(a > N) ans++;
    else{
      A.at(a)++;
    }
  }
  for(int i = 1; i <= N; i++){
    if(i > A.at(i)) ans += A.at(i);
    else{
      ans += A.at(i) - i;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024