akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;


public class Main{
	public static void main(String[] args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		
		//a???????????????
		int a = sc.nextInt();
		//b???????????????
		int b = sc.nextInt();
		
		//a ?????? b ???????????§???????????°
		if(a < b){
			System.out.println("a < b");
		//a ?????? b ??????????°????????????°???
		}else if(a > b){
			System.out.println("a > b");
		//a ??¨ b ?????????????????°???
		}else if(a == b){
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26048
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    testcase = input()
    if testcase == "AC":
        AC += 1
    elif testcase == "WA":
        WA += 1
    elif testcase == "TLE":
        TLE += 1
    elif testcase == "RE":
        RE += 1

print("AC x ", AC)
print("WA x ", WA)
print("TLE x ", TLE)
print("RE x ", RE)


Measured memory_bytes: 9108
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	static boolean[] prime = new boolean[10001];

	public static void main(String[] args) {
		ersis();
		while(true){
			int n = si();
			if(n==0) break;
			n -= (n+1)%2;

			do {
				if(!prime[n] && !prime[n-2]) break;
				n-=2;
			} while (n>=5);
			out.println(n-2+" "+n);
		}
		out.flush();
	}

	static void ersis(){
		prime[0] = prime[1] = true;
		for (int i = 0; i*i<10000 ; i++) {
			if(!prime[i])
				for (int j = i*2; j <= 10000 ; j+=i) {
					prime[j]=true;
				}
		}
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
}

Measured memory_bytes: 29300
#include"bits/stdc++.h"
using namespace std;
typedef long long LL;
const int N=1e6;
int mp[2000][50];
int main()
{
	int n=42;
	int cnt=0;
	printf("%d %d\n",n*n-n+1,n);
	mp[0][0]=++cnt;
	for(int i=0;i<n;i++)
		for(int j=1;j<n;j++){
			mp[i][j]=++cnt;
		}

	for(int i=0;i<n;i++)mp[i][0]=1;
	
	for(int j=2;j<=n;j++){
		int d=j-2;
		for(int i=1;i<n;i++){
			int y=i,x=(j-1)*(n-1)+i;
			mp[x][0]=j;
			
			for(int k=1;k<n;k++){
				int z=y%(n-1);
				if(z==0)z=n-1;
				mp[x][k]=mp[k][z];
				y+=d;
			}	
		}
	}
	
	for(int i=0;i<n*n-n+1;i++){
		for(int j=0;j<n-1;j++){
			printf("%d ",mp[i][j]);
		}
		printf("%d\n",mp[i][n-1]);
	}
		
	
}

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

int main() {
	while (true) {
		string cards;
		cin >> cards;
		if (cards == "-") {
			break;
		}
		int n;
		cin >> n;
		for (int i = 0;i != n;++i) {
			int h;
			cin >> h;
			for (int j = 0;j != h;++j) {
				char buttom = cards[0];
				cards.erase(0,1);
				cards.push_back(buttom);
			}
		}
		cout << cards << endl;
	}
}

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

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

    if (S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}



Measured memory_bytes: 3624
n=int(input())
r=int(n**0.5+1)
ans=0
for i in range(2,r):
  e=0
  while n%i==0:
    n//=i
    e+=1
  k=1
  while e>=k:
    e-=k
    ans+=1
    k+=1
if n!=1:
  ans+=1
print(ans)



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

int main(){
    int n, H[200000], DP[200000];
    cin >> n;
    for(int i=0;i<n;i++) cin >> H[i];
    DP[0] = 0;
    DP[1] = abs(H[1]-H[0]);
    for(int i=0;i<n-2;i++) DP[i+2] = min(DP[i+1]+abs(H[i+2]-H[i+1]), DP[i]+abs(H[i+2]-H[i]));
    cout << DP[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            var AB = Sarray();
            var A = AB[0];
            var B = AB[1];
            var g = gcd(A, B);
            var div = divisors(g);
            var cnt = 1;//1の分
            foreach (var l in div)
                if (isPrime(l)) ++cnt;
            WriteLine(cnt);

        }
        static long gcd(long x, long y) => y == 0 ? x : gcd(y, x % y);
        static List<long> divisors(long n)
        {
            var div = new List<long>();
            var last = 0L;
            for (long i = 1; i*i <= n; ++i)
            {
                if (n % i == 0)
                {
                    div.Add(i);
                    if (i != n / i)
                    {
                        //div.Add(n / i);
                        last = n / i;
                    }
                }
            }
            div.Add(last);
            return div;
        }
        static bool isPrime(long x)
        {
            if (x <= 1) return false;
            if (x == 2) return true;
            if (x % 2 == 0) return false;
            for (long i = 3; i * i <= x; i += 2) 
                if (x % i == 0)
                    return false;
            return true;
        }
    }
}

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

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

#define mod 1000000007
#define inf 1000000000
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)

const long double PI = acos(-1);

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

int main(){
  while(1){
    ll n, x;
    cin >> n >> x;
    if(n == 0 && x == 0) break;
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
      for(ll j = i+1; j <= n; j++){
        for(ll k = j+1; k <= n; k++){
          if(i + j + k == x) ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3096
#include <stdio.h>

#define max 3

int main()
{
    int bingo[max][max], i, j, k, flagtate=0, flagyoko=0;
    int N, b[10], t;
    
    for(i=0; i<3; i++){
        for(j=0; j<3; j++){
            scanf("%d", &bingo[i][j]);
        }
    }
    
    scanf("%d", &N);
    for (i=0; i<N; i++) {
        scanf("%d", &b[i]);
    }
    
    for(i=0; i<3; i++){
        flagtate=flagyoko=0;
        for(j=0; j<3; j++){
            for(k=0; k<N; k++){
                if(bingo[i][j]==b[k])
                    flagtate++;
                if(bingo[j][i]==b[k])
                    flagyoko++;
            }
            if(flagtate==3||flagyoko==3){
                printf("Yes");
                return 0;
            }
        }
    }

    for(i=0; i<3; i=i+2){
        t=i;
        flagtate=0;
        for(j=0; j<3; j++){
            for(k=0; k<N; k++){
                if(bingo[j][t]==b[k])
                    flagtate++;
            }
            if(flagtate==3){
                printf("Yes");
                return 0;
            }
            if(i==0)
                t++;
            else
                t--;
        }
    }
    
    printf("No");
    
    return 0;
}


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

ll x, y, t, f[64];

int main(){
    cin >> x >> y;
    for (int i = 0; i < 65; i++) f[i] = pow(2, i);
    t = y/x;
    for (int i = 0; i < 65; i++){
        if (f[i] == t) {
            cout << i + 1;
            break;
        }
        else if (f[i] > t){
            cout << i;
            break;
        }
    }
}

Measured memory_bytes: 256
#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);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}



int main(){


    ll x;
    cin>>x;
    for(ll i=-1;i<=1000;i++){

        ll xi = pow(i,5);
      //  cout<<xi<<"xi"<<endl;
        ll k=xi-x;
        bool f = false;
        if(k<0){f=true;k*=-1;}
      //  cout<<k<<" k"<<endl;

        if(k==0){
            cout<<i<<" "<<0<<endl;
            return 0;
        }
        map<ll,ll> m;

        if(k==1){
            cout<<i<<" "<<(f?-1:1)<<endl;
            return 0;
        }

        for(int j=2;j<=sqrt(k);j++){
            while(k%j==0){
                //cout<<k<<endl;
                k/=j;
                m[j]++;
            }
        }

        ll ans = 1;

        bool ff = true;

        if(m.size()==0||k!=1)ff=false;
        for(auto &a:m){
           //cout<<a.first<<" "<<a.second<<"a";
            if(a.second%5==0){
                ll ji = a.second/5;
                ans*=pow(a.first,ji);
            }else{
                ff=false;
                break;
            }
        }


       // cout<<endl;


        if(ff==true) {
            cout << i << " " << (f ? -1 * ans : ans) << endl;
            return 0;
        }

    }





    
return 0;
}


Measured memory_bytes: 4112
//#include "stdafx.h"
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n)
using namespace std;
int main()
{
	MaRiaMa;
	set<char> c;
	int k = 0;
	string s;
	set<char> p;
	cin >> s;
	for (int i = 0; i < 26; i++)
	{
		c.emplace(char(97+i));
	}
	for (int i = 0; i < s.size(); i++)
	{
		p.emplace(s[i]);
	}
	auto l = c.begin();
	for (auto it = p.begin(); l != c.end(); it++)
	{
		if (it != p.end())
		{
			if (*l != *it)
			{
				cout << *l;
				return 0;
			}
			l++;
		}
		else
		{
			cout << *l;
			return 0;
		}
	}
	cout << "None";
}





Measured memory_bytes: 3744
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

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

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
        ans=ans%1000000007;
    }

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}


int main()
{
	ll n,k,count=1;
	cin>>n>>k;
	ll a[n+1];
	a[0]=0;
	for(ll i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	ll x=1;
	vis[x]=1;
	while(1)
	{
		x=a[x];
		count++;
		vis[x]=count;
		if(vis[a[x]]>0)
		{
			break;
		}
	}
	ll ans=1,aa=vis[a[x]]-1,ab=vis[x]-vis[a[x]]+1;
	if(k<=vis[a[x]]-1) for(ll i=0;i<k;i++) ans=a[ans];
	else
	{
		k-=vis[a[x]]-1;
		k=k%ab;
		for(ll i=0;i<aa;i++) ans=a[ans];
		for(ll i=0;i<k;i++)
		{
			ans=a[ans];
		}
	}
	cout<<ans;
}

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

using namespace std;

const int MOD=1e9+7;
const double PI=3.14159265359;


int main(){
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n,k;
    cin>>n>>k;
    vector<vector<int>> tree(n+1);
    for(int i=0; i<n-1; i++){
        int x,y;
        cin>>x>>y;
        tree[x].push_back(y);
        tree[y].push_back(x);
    }
    vector<int> dists(n+1);
    if(k%2){
        int val=k/2;
        int ans=n;
        for(int i=1; i<=n; i++){
            for(int j:tree[i]){
                queue<int> q;
                int anst=0;
                fill(dists.begin(), dists.end(),-1);
                dists[i]=0;
                dists[j]=0;
                q.push(i);
                q.push(j);
                while(q.size()){
                    int cur=q.front();
                    q.pop();
                    if(dists[cur]>val) anst++;
                    for(int k:tree[cur]){
                        if(dists[k]==-1){
                            dists[k]=dists[cur]+1;
                            q.push(k);
                        }
                    }
                }
                ans=min(ans,anst);
            }
        }
        cout<<ans;
        return 0;
        
        
    }
    
    
    int val=k/2;
    int ans=n;
    for(int i=1; i<=n; i++){
        queue<int> q;
        int anst=0;
        fill(dists.begin(), dists.end(),-1);
        q.push(i);
        dists[i]=0;
        while(q.size()){
            int cur=q.front();
            if(dists[cur]>val) anst++;
            q.pop();
            for(int j:tree[cur]){
                if(dists[j]==-1){
                    dists[j]=dists[cur]+1;
                    q.push(j);
                }
            }
        }
        ans=min(ans,anst);
    }
    cout<<ans;
    
    
    
    
    
    return 0;
    
    
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    int N, M, Q;
    cin >> N >> M >> Q;

    vector<vector<int>> dp(510, vector<int>(510, 0));
    for (int i = 0; i < M; i++) {
        int L, R;
        cin >> L >> R;

        for (int j = 1; j <= L; ++j) {
            dp[j][R]++;
        }
    }

    for (int i = 1; i <= 500; i++) {
        for (int j = i; j <= 500; j++) {
            dp[i][j] += dp[i][j-1];
        }
    }

    for (int i = 0; i < Q; i++) {
        int p, q;
        cin >> p >> q;
        cout << dp[p][q] << endl;
    }

    return 0;
}


Measured memory_bytes: 1920
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long long N, T;
long long A[100005];

map<long long, long long> list;

int main(){
	cin >> N >> T;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	long long mini = A[0];

	long long maxi = 0;
	for(int i = 1; i < N; i++){
		list[A[i] - mini]++;
		maxi = max(maxi, A[i] - mini);
		mini = min(mini, A[i]);
	}

	cout << list[maxi] << endl;

}


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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#ifdef MPS
#define D(x...) printf(x)
#else
#define D(x...)
#endif
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;

void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}

const int maxn = 4005;
const int P = 998244353;

int n, k, comb[maxn][maxn], pw[maxn];

void precomp()
{
	pw[0] = 1; fo(i,1,maxn-5) pw[i] = pw[i-1] * 2 % P;
	fo(i,0,maxn-5) 
	{
		comb[i][i] = comb[i][0] = 1;
		fo(j,1,i-1) comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % P;
	}
}
int main()
{
	// fp("1.in","r",stdin);
	// fp("1.out","w",stdout);
	sf("%d%d",&k,&n);
	precomp();
	fo(t,2,2*k)
	{
		int p = 0, ans = 0;
		fo(i,1,k) if(t-i <= k && t-i >= i) ++ p;
		fo(q,0,p)
		{
			ll w = (ll) comb[p][q] * pw[q]; w %= P;
			w = w * comb[n+k-2*p-1][q+k-2*p-1]; w %= P;
			ans = (ans + w) % P;
  		}
		pf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 61440
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
#define MAX_R 10
#define MAX_C 10000
int R,C;
int res;
int G[MAX_R + 1][MAX_C + 1];
int main(){
    while(cin >> R >> C){
        if(!(R || C)) break;
        for(int i = 0 ; i < R ; i++)
            for(int j = 0 ; j < C ; j++)
                cin >> G[i][j];
        int BIT_SIZE = 1 << R;
        res = 0;
        for(int j = 0 ; j < BIT_SIZE ; j++){
            int total = 0;
            for(int cc = 0 ; cc < C ; cc++){
                int k = j;
                int num0 = 0,num1 = 0;
                for(int rr = 0 ; rr < R ; rr++){
                    if(k & 1) G[rr][cc] ? num1++ : num0++;
                    else G[rr][cc] ? num0++ : num1++;
                    k >>= 1;
                }
                total += max(num0,num1);
            }
            res = max(res,total);
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3476
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <utility>
using namespace std;

int main() {
  int N; cin >> N;
  int a[110];
  for (int i = 0; i < N; i++)
    cin >> a[i];
  cout << *max_element(a, a+N) - *min_element(a,a+N) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
	int n, x;
	cin >> n >> x;
	vector<int> l(n+1);
	l[0] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> l[i];
	}
	int d = 0, c = 0;
	for (int i = 1; i < n + 2; i++) {
		d = d + l[i - 1];
		if (d < x + 1)c++;
		else break;
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define mp make_pair
#define ll long long
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug cout<<"Debugging.."<<endl
using namespace std;
int main()
{
	faster;

		ll int n;
		cin>>n;
		
		int a=pow(n,2);
		int b=pow(n,3);
		cout<<a+b+n;
	

	
}




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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N; cin >> N;
	vector<pll> v(N);
	vector<int> s, e;
	for (int i = 0; i < N; i++) {
		cin >> v[i].first >> v[i].second; 
		s.push_back(v[i].first);
		e.push_back(v[i].second);
	}
	sort(s.begin(), s.end());
	sort(e.begin(), e.end());

	if (N & 1) {
		cout << e[N / 2] - s[N / 2] + 1 << '\n';
	}
	else {
		cout << (e[N / 2] + e[N / 2 - 1]) - (s[N / 2] + s[N / 2 - 1]) + 1 << '\n';
	}
	return 0;
}

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

int main() {
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;

    if(x - r < 0 || w < x + r || h < y + r || y - r < 0) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
    return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N, M;
	cin >> N >> M;

	vector<int> A(N, 0);
	int all_vote = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
		all_vote += A[i];
	}

	int select_cnt = 0;
	for (int e : A)
	{
		if (4 * M * e >= all_vote)
		{
			select_cnt++;
		}
	}

	if (select_cnt >= M)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int n;
    int room[5][4][11] = {{{0}}};
    scanf("%d",&n);
    for(int i = 0;i < n;i++){
        int blocks,floors,rooms,numbers;
        scanf("%d %d %d %d",&blocks,&floors,&rooms,&numbers);
        room[blocks][floors][rooms] += numbers;
    }
    for(int i = 1;i <= 4;i++){
        for(int j = 1; j <= 3;j++){
            for(int m = 1;m <= 10;m++){
                printf(" %d",room[i][j][m]);
            }
            printf("\n");
        }
        if(i != 4) printf("####################\n");
    }
}


Measured memory_bytes: 2724
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		ArrayList<ArrayList> wholeGrid = new ArrayList<>();
		int rowNum = sc.nextInt();
		int columnNum = sc.nextInt();
		
		// 各行の文字列を1文字ずつ区切ったものを格納したArrayListをwholeGridに格納
		for(int i = 0; i < rowNum; i++) {
			String rowString = sc.next();
			ArrayList<String> row = new ArrayList<>();
			
			for(int n = 0; n < columnNum; n++) {
				row.add(rowString.substring(n,(n+1)));
			}
			
			wholeGrid.add(row);
		}
		
		// wholeGridから特定の文字を取り出して、その上下左右の文字との比較を繰り返す
		for(int i = 0; i < rowNum; i++) {
			for(int n = 0; n < columnNum; n++) {
				String paintInst = (String) wholeGrid.get(i).get(n);
				
				// 文字が"."ならそのままなのでcontinueでスキップ
				if(paintInst.equals(".")) {
					continue;
				}
				
				// 自分の右側と比べる
				if(n<(columnNum-1)) {
					if(paintInst.equals( (String) wholeGrid.get(i).get(n+1) ) ) {
						continue;
					}
				}
				
				// 自分の左側と比べる
				if(n>0) {
					if(paintInst.equals( (String) wholeGrid.get(i).get(n-1) ) ){
						continue;
					}
				}
				
				// 自分の上と比べる
				if(i>0) {
					if(paintInst.equals( (String) wholeGrid.get(i-1).get(n) ) ) {
						continue;
					}
				}
				
				// 自分の下と比べる
				if(i<(rowNum-1)) {
					if(paintInst.equals( (String) wholeGrid.get(i+1).get(n) ) ) {
						continue;
					}
				}
				
				// 上のどれにも引っかからない→上下左右に#が無いのでNoを表示して終了
				System.out.println("No");
				System.exit(0);
				
			}
		}
		
		// 終了することなくここまで来た→#の上下左右いずれかに#があるためYesを表示
		System.out.println("Yes");
	}
}

Measured memory_bytes: 23764
N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))
count=0
for i in range(len(A)):
    if A[i]<2:
        continue
    elif A[i]==2:
        count += 1
        continue
    if A[i]%2==0:
        continue
    elif A[i]>=3:
        j=3
        flag=0
        while j<=A[i]/j:
            if A[i]%j==0:
                flag=1
                break
            j += 2
        if flag==0:
            count += 1
print(count)


Measured memory_bytes: 5976
#include <iostream>
using namespace std;
int main(){
    int n,i,k,t;
    cin>>n;
    int x[100];
    for(k=0;k<n;k++){
        cin>>x[k];
    }
    for(i=0;i<n-1;i++){
       cout<<x[n-i-1]<<" ";
    }
    cout<<x[0]<<endl;

    return 0;
}



Measured memory_bytes: 3108
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }

    #[allow(dead_code)]
    pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
    where
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }
}

fn main() {
    let s = util::line();
    println!(
        "{}",
        s.chars().collect::<Vec<_>>()[..s.len() - 8]
            .into_iter()
            .cloned()
            .collect::<String>()
    );
}


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

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

  int a, b;
  cin >> a >> b;

  cout << max(a - (2 * b), 0) << endl;

  return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args)
	{
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			int[] ar = new int[n];
			for(int i=0 ; i < n ; i++)
			{
				ar[i] = Integer.parseInt(str[i]);
			}
			bubbleSort(ar,ar.length);
			
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	public static void bubbleSort(int[] a , int l)
	{
		boolean bool = true;
		int cou = 0;
		for(int i = l-1 ; bool ; i--  )
		{
			bool = false;
			for(int j = 0 ; j < i ; j++)
			{
				if(a[j] > a[j+1])
				{
					int temp = a[j+1];
					a[j+1] = a[j];
					a[j] = temp;
					bool = true;
					cou++;
				}
			}
		}
		show(a,cou);		
	}
	public static void show(int[] b,int co){
		StringBuilder sb = new StringBuilder();
		for(int i= 0;i<b.length-1;i++)
		{
			sb.append(b[i]).append(" ");	
		}
		sb.append(b[b.length-1]).append("\n").append(co).append("\n");	
		System.out.print(sb);
	}
}

Measured memory_bytes: 24244
#include<cstdio>
typedef long long ll;
ll pw[20];
ll dfs(int l,int r,ll d){/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	if(l>r)return!d;
	if(l==r)return d?0:10;
	ll k=pw[r]-pw[l],t=d/k,s=0;
	if(t<10)s+=dfs(l+1,r-1,d-k*t)*(10-t-!l);
	if(t+1<10)s+=dfs(l+1,r-1,k*t+k-d)*(9-t-!l);
	return s;
}
int main(){
	int D;scanf("%d",&D);
	ll ans=0;
	for(int i=*pw=1;i<=18;i++){
		pw[i]=pw[i-1]*10;
		ans+=dfs(0,i,D);
	}
	printf("%lld\n",ans);
} 


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

int main(){
    string s;
    string ans ="No";
  
    cin >> s;

    if(s.at(0)== '7') ans = "Yes";
    if(s.at(1)== '7') ans = "Yes";
    if(s.at(2)== '7') ans = "Yes";
    cout <<  ans  << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
const ll mod = 1e9+7;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
        // cin >> tt;
    while((tt)--){
        string s; cin >> s;
        if(s[2]==s[3] and s[4]==s[5]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 256
#include<iostream>

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    
    while (b) {
        long long t = a / b;
        
        a -= t * b; 
        std::swap(a, b);
        
        u -= t * v; 
        std::swap(u, v);
    }

    u %= m;

    if (u < 0) 
    	u += m;
    return u;
}

int main(){
	long long mod= 1000000007;
	long long ans= 1;

	long long x, y;
	std::cin>>x>>y;

	long long hor= ((2*x - y)%3 ==0)? (2*x - y)/3 : -1;
	long long ver= ((2*y - x)%3 ==0)? (2*y - x)/3 : -1;

	if(hor<0 || ver<0){
		ans=0;
	}else{
		for(long long i=hor+1; i<= hor+ver; i++)
			ans= (ans*i)%mod; 

		for(long long i=1; i<=ver; i++)
			ans= (ans * modinv(i, mod))%mod;
	}

	std::cout<<ans<<std::endl;

	return 0;
}

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

long long int lcm(long long int a,long long int b)
{
     return (a*b)/__gcd(a, b);
}

int main()
{
    //ios_base::sync_with_stdio(false);

    long long int a,b,c,d,i,j,k,n,m,cnt,e,f,g,h,p,q;
    cin>>a>>b>>c>>d;
    k=lcm(c,d);
    m=(b/c)+(b/d)-(b/k);
    k=((a-1)/c)+((a-1)/d)-((a-1)/k);
    k=abs(m-k);
    a=abs(a-b)+1;
    cout<<abs(a-k)<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    double r,v,l;
    double pai=3.141592653589793;
    scanf("%lf",&r);
    v=pai*r*r;
    l=2*pai*r;
    printf("%.6lf %.6lf\n",v,l);
    return 0;
}


Measured memory_bytes: 2040
import java.util.Scanner;

//A	Subscribers
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

		int ans1 = Integer.min(A, B);

		int ans2 = 0;
		if (N <= (A + B)) {
			ans2 = (A + B) - N;
		}

		System.out.println(ans1 + " " + ans2);

		sc.close();
	}

}


Measured memory_bytes: 21972
#include<stdio.h>
int main(void)
{
	int a,abc[100],ab[100],c,b;
	b=0;
	scanf("%d",&a);
	for(c=0;c<a;c++){
		scanf("%d",&abc[c]);
	}
	for(c=a-1;c>=0;c--){
		ab[c]=abc[b];
		b++;
	}
	for(c=0;c<a-1;c++){
		printf("%d ",ab[c]);
	}
	printf("%d\n",ab[a-1]);
	return 0;
}

Measured memory_bytes: 596
strings = gets.split(" ")
hash = Hash.new(0)
longest_size = strings.max_by{ |(elm1)| elm1.length}
strings.each {|e| hash[e] += 1}
freq_num = hash.max_by{|_,len_i| len_i }[0]

puts "#{freq_num} #{longest_size}"



Measured memory_bytes: 6860
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s[31][7],d[31],f[31],g,h,i,j,k,l,o,x;
	char z[31][7][10];
	while(1){
		scanf("%d",&a);
		if(a==0) break;
		for(i=0;i<a;i++){
			for(j=0;j<6;j++){
				scanf("%s",z[i][j]);
				if(z[i][j][0]=='R') s[i][j]=0;
				if(z[i][j][0]=='Y') s[i][j]=1;
				if(z[i][j][0]=='B') s[i][j]=2;
				if(z[i][j][0]=='M') s[i][j]=3;
				if(z[i][j][0]=='G') s[i][j]=4;
				if(z[i][j][0]=='C') s[i][j]=5;
			}
		}
		for(i=0;i<a;i++) f[i]=0;
		g=0;
		for(i=0;i<a-1;i++){
			if(f[i]==0){
				for(j=i+1;j<a;j++){
					x=0;
					for(o=0;o<6;o++){
						if(s[i][o]!=s[j][o]) break;
						else x++;
					}
					if(x==6){
						f[j]=1;
						g++;
					}
					if(f[j]==0){
						for(k=0;k<4;k++){
							x=0;
							h=s[j][1];
							s[j][1]=s[j][0];
							s[j][0]=s[j][4];
							s[j][4]=s[j][5];
							s[j][5]=h;
							for(l=0;l<4;l++){
								x=0;
								h=s[j][1];
								s[j][1]=s[j][3];
								s[j][3]=s[j][4];
								s[j][4]=s[j][2];
								s[j][2]=h;
								//if(s[i][0]==s[j][0]) for(o=0;o<6;o++) printf("%d %d\n",s[i][o],s[j][o]);
								for(o=0;o<6;o++){
									if(s[i][o]!=s[j][o]) break;
									else x++;
								}
								if(x==6){
									f[j]=1;
									g++;
									break;
								}
							}
							if(f[j]==1) break;
						}
						if(f[j]==0){
							h=s[j][2];
							s[j][2]=s[j][5];
							s[j][5]=s[j][3];
							s[j][3]=s[j][0];
							s[j][0]=h;
							for(l=0;l<4;l++){
								x=0;
								h=s[j][1];
								s[j][1]=s[j][3];
								s[j][3]=s[j][4];
								s[j][4]=s[j][2];
								s[j][2]=h;
								//if(s[i][0]==s[j][0])	for(o=0;o<6;o++) printf("%d %d\n",s[i][o],s[j][o]);
								for(o=0;o<6;o++){
									if(s[i][o]!=s[j][o]) break;
									else x++;
								}
								if(x==6){
									f[j]=1;
									g++;
								}
							}
							h=s[j][2];
							s[j][2]=s[j][0];
							s[j][0]=s[j][3];
							s[j][3]=s[j][5];
							s[j][5]=h;

							if(f[j]==0){
								h=s[j][3];
								s[j][3]=s[j][5];
								s[j][5]=s[j][2];
								s[j][2]=s[j][0];
								s[j][0]=h;
							//	if(s[i][0]==s[j][0])for(o=0;o<6;o++) printf("%d %d\n",s[i][o],s[j][o]);
								for(l=0;l<4;l++){
									x=0;
									h=s[j][1];
									s[j][1]=s[j][3];
									s[j][3]=s[j][4];
									s[j][4]=s[j][2];
									s[j][2]=h;
									for(o=0;o<6;o++){
										if(s[i][o]!=s[j][o]) break;
										else x++;
									}
									if(x==6){
										f[j]=1;
										g++;
									}
								}
								h=s[j][2];
								s[j][2]=s[j][5];
								s[j][5]=s[j][3];
								s[j][3]=s[j][0];
								s[j][0]=h;
							}
						}
					}
				}
			}
		}
		printf("%d\n",g);
	}
	return 0;
}

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

#define PS push
#define PB push_back
#define MP make_pair
#define fi first
#define se second
const int INF = 0x3f3f3f3f;
#define cer(x) cout<<#x<<'='<<endl
#define REP0(i,n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i <= n; i++)
#define DWN(i,n) for(int i = n; i > 0; i--)
#define DWN_(i,n) for(int i = n; i >= 0; i--)
#define REP(i,s,e) for(int i = s; i < e; i++)
#define REP_(i,s,e) for(int i = s; i <= e; i++)
#define CLR(a,v) memset(a,v,sizeof(a))
typedef long long ll;

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

inline int reads()
{
    int ret; char c; while(c = getchar(),c != '-' && (c<'0'||c>'9'));
    bool Sign = c == '-';
    ret = Sign?0:c-'0';
    while(c = getchar(),c>='0'&&c<='9') ret = ret*10 + c-'0';
    return Sign?-ret:ret;
}

const int SZ = 1e3+5;

char g[SZ][SZ];
int H,W,N;
int vis[SZ][SZ],clk;
struct Node
{
    int x,y,f,h;
    bool operator <(const Node&th) const {
        return f > th.f || ( f == th.f && h > th.h);
    }
}pos[10];

int tar;
inline int MHT(Node &o)
{
    return (abs(pos[tar].x-o.x) + abs(pos[tar].y-o.y))>>1;
}

void GetPos()
{
    REP0(i,H){
        REP0(j,W){
            char c = g[i][j];
            if(c == 'S'){
                pos[0] = {i,j};
            }else if('1'<= c && c <='9' ){
                pos[c-'0'] = {i,j};
            }
        }
    }
}

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

inline bool valid(int x,int y)
{
    return x>=0&&x<H&&y>=0&&y<W&&g[x][y]!='X'&&vis[x][y] != clk;
}

int astar_bfs(int st)
{
    priority_queue<Node> q;
    Node u;
    u.x = pos[st].x;
    u.y = pos[st].y;
    u.h = u.f = MHT(u);
    q.push(u);
    clk++;
    while(q.size()){
        u = q.top(); q.pop();
        if(u.x == pos[tar].x && u.y == pos[tar].y ) return u.f-u.h;
        REP0(k,4){
            Node v;
            v.x = u.x + dx[k];
            v.y = u.y + dy[k];
            if(!valid(v.x,v.y)) continue;
            vis[v.x][v.y] = clk;
            v.h = MHT(v);
            v.f = u.f-u.h+1+v.h;
            q.push(v);
        }
    }
    return -1;
}

int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    H = read(); W = read(); N = read();
    for(int i = 0; i < H; i++){
        scanf("%s",g[i]);
    }
    GetPos();
    int ans = 0;
    REP1(i,N){
        tar = i;
        ans += astar_bfs(i-1);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 6108
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var H = o.a();
  var W = o.a();
  var h = o.a();
  var w = o.a();
  return (H-h)*(W-w);
}

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

int main() {
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<int> P(A), Q(B), R(C);
  for (int i = 0; i < A; i++) cin >> P.at(i);
  for (int i = 0; i < B; i++) cin >> Q.at(i);
  for (int i = 0; i < C; i++) cin >> R.at(i);
  sort(P.begin(), P.end());
  sort(Q.begin(), Q.end());
  sort(R.begin(), R.end());
  reverse(R.begin(), R.end());
  priority_queue<int, vector<int>, greater<int>> S;
  for (int i = 0; i < X; i++) {
    S.push(P.at(P.size() - 1));
    P.pop_back();
  }
  for (int i = 0; i < Y; i++) {
    S.push(Q.at(Q.size() - 1));
    Q.pop_back();
  }
  for (int i = 0; i < C; i++) {
    if (R.at(i) > S.top()) {
      S.push(R.at(i));
      S.pop();
    }
    else break;
  }
  long long int ans = 0;
  while (!(S.empty())) {
    ans += S.top();
    S.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

ll n;
ll a[300010];
ll ans;

int main(){

  n = in();
  REP( i , 3*n ){
    a[i] = in();
  }
  sort( a , a + 3 * n );
  REP( i , n ){
    ans += a[n+2*i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>

int main(){
    int i,j,k;
    int p,q,r,ans;

    scanf("%d %d %d",&p,&q,&r);
    
    ans = p+q;
//    printf("%d\n",ans);
    if(ans>=q+r) {
        ans = q+r;
    }

    if(ans>=r+p){
        ans = r+p;
    }
    
    printf("%d\n",ans);
    
    return 0;
}

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

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int dead[N], c[N];
int main()
{
	int n, m;
	cin >> n >> m;
	int ans =0 , res = 0;
	for(int i = 1; i <= m; i ++)
	{
		int x;
		string y;
		cin >> x >> y;
		if(y == "AC")
		{
			dead[x] = 1;
		}
		else
		{
			if(dead[x]==0)
				c[x] ++;
		}
	}
	for(int i = 1; i <= n; i ++)
	{
		res += dead[i];
		if(dead[i])
		{
			ans += c[i];
		}
	}
		
	cout << res << ' ' << ans;
	




	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

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

template <typename T>
struct KdSegmentTree {
    using P = pair<int, int>;

    int n;
    vector<vector<T>> data;

    KdSegmentTree() {}
    KdSegmentTree(int _n, vector<T> v) {
        n = 1;
        while (n < _n) n *= 2;
        data.resize(2 * n - 1);
        build(v);
    }
    void build(vector<T> v) {
        for (int i = 0; i < v.size(); i++) data[i + n - 1].push_back(v[i]);
        for (int i = n - 2; i >= 0; i--) {
            int lch = i * 2 + 1;
            int rch = i * 2 + 2;
            data[i].resize(data[lch].size() + data[rch].size());
            merge(begin(data[lch]), end(data[lch]), begin(data[rch]),
                  end(data[rch]), begin(data[i]));
        }
    }
    void query(int a, int b, int y0, int y1, vector<int>& res, int k = 0,
               int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (b <= l || r <= a) return;
        if (a <= l && r <= b) {
            auto lb = lower_bound(begin(data[k]), end(data[k]), P{y0, -1});
            auto ub = upper_bound(begin(data[k]), end(data[k]), P{y1, n});
            for (auto itr = lb; itr != ub; ++itr) {
                res.push_back(itr->second);
            }
            return;
        }
        query(a, b, y0, y1, res, k * 2 + 1, l, (l + r) / 2);
        query(a, b, y0, y1, res, k * 2 + 2, (l + r) / 2, r);
    }
};

struct KdTree {
    using P = pair<int, int>;

    int n;
    vector<int> xs;
    vector<P> ys;
    vector<pair<int, P>> ps;
    KdSegmentTree<P> seg;

    KdTree(int _n) : n(_n), xs(_n), ys(_n), ps(_n) {}

    void build() {
        sort(begin(ps), end(ps));
        for (int i = 0; i < n; i++) tie(xs[i], ys[i]) = ps[i];
        seg = KdSegmentTree<P>(n, ys);
    }
    void add_point(int x, int y, int i) { ps[i] = {x, {y, i}}; }
    vector<int> query(int sx, int tx, int sy, int ty) {
        vector<int> res;
        int l = distance(begin(xs), lower_bound(begin(xs), end(xs), sx));
        int r = distance(begin(xs), upper_bound(begin(xs), end(xs), tx));
        seg.query(l, r, sy, ty, res);
        sort(begin(res), end(res));
        return res;
    }
};

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

    int n;
    cin >> n;
    KdTree kd(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        kd.add_point(x, y, i);
    }
    kd.build();
    
    int q;
    cin >> q;
    while (q--) {
        int sx, tx, sy, ty;
        cin >> sx >> tx >> sy >> ty;
        vector<int> ans = kd.query(sx, tx, sy, ty);
        for (auto&& x : ans) cout << x << endl;
        cout << endl;
    }
}


Measured memory_bytes: 141848
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e8;

signed main() {
	string S;
	int K;
	cin >> S >> K;
	char ch;
	rep(i, S.size()) {
		if (S[i] == '1')continue;
		else {
			ch = S[i];
			break;
		}
	}
	bool can = true;
	if (K <= S.size()) {
		rep(i, K) {
			if (S[i] != '1')can = false;
		}
		if (can) {
			cout << 1;
			return 0;
		}
	}
	cout << ch;
}

Measured memory_bytes: 256
while True:
    m,r,f = map(int,input().split())
    if m == -1 and r == -1 and f==-1:
        break
    elif m==-1 or r==-1:
        print("F")
    elif m + r >= 80:
        print("A")
    elif 65 <= m + r <80:
        print("B")
    elif 50 <= m + r <65:
        print("C")
    elif 30<=m + r<50:
        if f>=50:
            print("C")
        else:
            print("D")
    elif m+r<30:
        print("F")


Measured memory_bytes: 5596
#include <iostream>

using namespace std;
long long a[200010];
int main(){
    int i,n; cin >> n;
    for(i=0;i<n;i++) cin >> a[i];
    long long ans = 0,now = 0;
    for(i=0;i<n;i++){
        if(a[i]<now){
            ans += now - a[i];
        }
        now = max(now,a[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5192
program resistors_in_parallel
  implicit none
  integer :: n
  real(8) :: a(100) = 0.d0
  character(64) :: s
  read(*,*) n
  read(*,*) a(1:n)
  write(s,'(f32.16)') 1.d0/sum(1.d0/a(1:n))
  write(*,'(a)') trim(adjustl(s))
end program resistors_in_parallel

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <climits>
#include <vector>
#include <numeric>
#include <complex>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
using namespace std;

#define __int64 long long
#define long __int64
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
const int Vec = 4;
const int Vecy[Vec] = {0,-1,0,1};
const int Vecx[Vec] = {1,0,-1,0};
const int Modd = 1000000007;

int weight[100005];
int value[100005];
long dp[105][100005] = {0};
int main(){
    int N, W;
    cin >> N >> W;
    for(int i=1; i<=N; i++){
        cin >> weight[i] >> value[i];
    }

    for(int itemi=1; itemi<=N; itemi++){
        for(int w=1; w<=W; w++){
            // itemi番目のアイテムを入れない場合
            dp[itemi][w] = max(dp[itemi][w], dp[itemi-1][w]);

            // itemi番目のアイテムを入れる場合
            if(w - weight[itemi] >= 0){
                dp[itemi][w] = max(dp[itemi][w], dp[itemi-1][w-weight[itemi]] + value[itemi]);
            }
        }
    }

    cout << dp[N][W] << endl;

}

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); ++i)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100005
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
typedef long long ll;
typedef pair<int, int> P;

int n;
int a[25];
int M[2005];

bool solve(int i, int sum,int mm)
{
	if (i == n) return sum == mm;
	if (solve(i + 1, sum + a[i], mm))return true;
	if (solve(i + 1, sum , mm))return true;
	
	return false;
}

int main()
{
	int q;
	cin >> n;
	REP(i, n)cin>>a[i];
	cin >> q;
	REP(i, q)cin >> M[i];

	REP(i, q){
		if (solve(0, 0, M[i]))cout << "yes" << endl;
		else cout << "no" << endl;
		
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long n,i,j,k;
  cin>>n;
  long long a[n][3];
  for(i=0;i<n;i++)
  {
    cin>>a[i][0]>>a[i][1]>>a[i][2];
  }
  long long dp[n][3];
  dp[0][0]=a[0][0];
  dp[0][1]=a[0][1];
  dp[0][2]=a[0][2];
  for(i=1;i<n;i++)
  {
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
    dp[i][2]=max(dp[i-1][1],dp[i-1][0])+a[i][2];
  }
  long long ans=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
  cout<<ans;
 
}


Measured memory_bytes: 4992