akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int h, n;
	cin >> h >> n;
	if (h > n)print("No");
	else print("Yes");
	
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
L = [str(input()) for i in range(N)]
Lc = Counter(L).most_common()
Llist = []             
L_max = Lc[0][1]       
i = 0
while True:
  Llist.append(Lc[i][0])
  if i<len(Lc)-1 and Lc[i+1][1]==L_max:
    i+=1
  else:
    break
print("\n".join(sorted(Llist)))

Measured memory_bytes: 120400
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Li = new int[N];
   for(int i =0;i<N;i++) Li[i] = sc.nextInt();
   
   Arrays.sort(Li);
   int sum =0;
   for(int i =0;i<N-1;i++) sum += Li[i]; 
   
   if(Li[N-1] < sum) System.out.println("Yes");
   else System.out.println("No");
 }
}

Measured memory_bytes: 23764
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<algorithm>
#define int long long
#define ll long long
#define vel vector<ll>
#define vvel vector<vel>
#define veb vector<bool>
#define pin pair<int,int>
#define mp make_pair 
#define int long long
using namespace std;
void mmin(int &a, int b) { a = min(a, b);}
int find(vvel &cost,vel &sum, int st, int to) {
	if (cost[st][to] != -1) { return cost[st][to]; }
	if (to - st == 1) { return 0; }
	int inf = 1000;
	inf *= inf * inf*inf*inf;
	cost[st][to] = inf;
	for (int i = st + 1; i < to; i++) {
		mmin(cost[st][to], find(cost,sum,st,i) + find(cost, sum, i, to) + sum[to] - sum[st]);
	}
	return cost[st][to];
}
signed main() {
	int n; cin >> n;
	vel a(n);
	for (int i = 0; i < n; i++) { cin >> a[i]; }
	vel s(n + 1,0);
	for (int i = 0; i < n; i++) { s[i + 1] = s[i] + a[i]; }
	vvel cost(n, vel(n+1,-1));
	cout << find(cost,s, 0, n) << endl;
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	int A, B;
	char C;
	cin >> A >> C >> B;

	if (C == '+') co(A + B);
	else co(A - B);

	Would you please return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define N 199
#define MAX 100

void initialize();
int isFull();
void push(int);
int pop();

int S[MAX];
int top;

int main()
{
  char Y[MAX];
  int i=0,a,b;

  while(1){
    if(scanf(" %s",&Y) == EOF) break;
    
    if(Y[0] >= '0' && Y[0] <='9') push(atoi(Y));
    
    if(Y[0] == '+') {
      a = pop();
      b = pop();
      push(a + b);
    }
    else if(Y[0] == '-'){
      a = pop();
      b = pop();
      push(b - a);
    }
    else if(Y[0] == '*'){
      a = pop();
      b = pop();
      push(a * b);
    }
  }
  
  printf("%d\n",pop());     
  
  return 0;
}

void initialize()
{
  top = 0;
}

int isEmpty()
{
  if(top == 0) return -1;
  else return 1;
}
int isFull()
{
  if(top > MAX-1) return -1;
  else  return 1;
}

void push(int x)
{
  if(isFull() == 1){
  top++;
  S[top] = x;
  }
}

int pop()
{
  int *x;
  if(isEmpty() == 1){
  top--;
  return S[top+1];
  }
}

Measured memory_bytes: 548
from collections import deque, namedtuple


class Process(object):
    def __init__(self, name, time):
        self.name = name
        self.time = time


def main():
    n, quantum = [int(i) for i in input().split()]
    queue = deque([Process(i, int(j)) for _ in range(n) for (i, j) in [input().split()]])
    completed = []
    time = 0
    while queue:
        processing = queue.popleft()
        delta_time = min(processing.time, quantum)
        processing.time -= delta_time
        time += delta_time
        if processing.time == 0:
            completed.append(Process(processing.name, time))
        else:
            queue.append(processing)
    for process in completed:
        print(process.name, process.time)

if __name__ == "__main__":
    main()


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>p(n);
  for(i=0;i<n;i++)cin>>p[i];
  for(i=1;i<n-1;i++){
    if(min({p[i-1],p[i],p[i+1]})<p[i]&&
      max({p[i-1],p[i],p[i+1]})>p[i])
      buf++;
  }
  cout<<buf++<<endl;

  return 0;
}

Measured memory_bytes: 256
a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = 0
for i in range(a-1, -1, -1):
    e = min(b[i+1], c[i])
    d += e
    b[i+1] -= e
    c[i] -= e
    e = min(b[i], c[i])
    d += e
    b[i] -= e
    c[i] -= e
print(d)


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

int main(){
  int n;
  string s;
  cin>>n>>s;
  int ans=0,x=0;
  for(int i=0;i<n;i++){
    if(s[i]=='I'){
      x++;
      ans=max(ans,x);
    }
    else{
      x--;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
using System.Collections.Generic;
using static System.Console;

class Program {
	static void Main() {
		var H = NextLong();
		var W = NextLong();
		var ans = new string[H * 2];
		for (var i = 0; i < H; i++) {
			var C = ReadLine();
			for (var j = 0; j < 2; j++) {
				ans[2 * i + j] = C;
			}
		}
		WriteLine(string.Join("\n", ans));
	}

	static long NextLong() {
		return long.Parse(NextString());
	}

	static string NextString() {
		var result = new List<char>();
		while (true) {
			int next = Read();
			if (next < 0)
				break;
			var nextChar = (char)next;
			if (!char.IsWhiteSpace(nextChar))
				result.Add(nextChar);
			else if (nextChar != '\r')
				break;
		}
		return string.Join("", result);
	}
}


Measured memory_bytes: 13316
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define vs vector<string>
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
using namespace std;

int main(void){
  int n;
  cin>>n;
  vi a(n);
  rep(i,n)cin>>a[i];

  sort(a.begin(),a.end());
  int r = 1;
  rep(i,n-1)if(a[i] != a[i+1])r ++;
  cout<<r<<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ConsoleApp3
{
    public class Data
    {
        public char Char { get; set; }
        public long Count { get; set; }
        public bool Occupied { get; set; }
    }

    internal class Program
    {
        private static void Main(string[] args)
        {
            var s = Console.ReadLine().GroupBy(x => x)
                .Select(x => new Data { Char = x.Key, Count = x.Count(), Occupied = false })
                .ToLookup(x => x.Count);

            var sDic = s.SelectMany(x => x).ToDictionary(x => x.Char);

            var t = Console.ReadLine().GroupBy(x => x).OrderBy(x => x.Key).ToArray();

            foreach (var tElement in t)
            {
                var data = s[tElement.Count()].FirstOrDefault(x => !x.Occupied);
                if (data is Data)
                {
                    data.Occupied = true;
                }
                else
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 30872
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    ll n,MOD=1e9+7,ans=1;
    cin>>n;
    string s;
    cin>>s;
    ll x=1;
    ll A[200001];
    string t={"BW"};
    rep(i,2*n){
        if(s[i]==t[i%2]) A[i]=1;
        else A[i]=0;
    }
    ll a=0;
    rep(i,2*n){
        ll b=i+1;
        if(A[i]==0) a++;
        if(a>b-a) x=0;
    }
    if(x==0){
        cout<<0;
        return 0;
    }
    a=0;
    for(int i=2*n-1;i>=0;i--){
        if(A[i]) ans=ans*a%MOD,a--;
        else a++;
    }
    ll B[200001];
    B[0]=1;
    rep(i,n) B[i+1]=B[i]*(i+1)%MOD;
    cout<<ans*B[n]%MOD;
}

Measured memory_bytes: 3460
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  if (1 <= A && A <= 9 && 1 <= B && B <= 9) {
    cout << A * B << endl;
  } else {
    cout << "-1" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll x,a,b;
  cin >> x >> a >> b;
  cout << (x-a)%b << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int points[10009];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    mem(points,0);
    points[0]=1;
    
    rep(i,N){
        int x;cin>>x;
        for(int j=10000;j-x>=0;j--){
            if(points[j-x]==1) points[j]=1;
        }
    }
    
    int mx=0;
    rrep(i,10000){
        if(points[i]&&(i%10)){
            mx=i;
            break;
        }
    }
    cout1(mx)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
priority_queue <int> qua;
vector <int> vec;
ll n, ans;
ll a[9];
int pos;

int main() {
	scanf("%lld", &n);
	ll minT = INF;
	for(int i = 1; i <= 5; i++) {
		scanf("%lld", &a[i]);
		minT = min(minT, a[i]);
	}
	ans += 5ll;
	if(n > minT) {
		ans += (n - minT) / minT;
		if(n % minT) ans += 1ll;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();
		int ans = 0;
		for(int i = 0; i < n; i++){
			ans += check(a.charAt(i), b.charAt(i), c.charAt(i));
		}
		System.out.println(ans);
	}
	
	int check(char a, char b , char c){
		if(a == b && a == c){
			return 0;
		}
		
		if(a == b || a == c || b == c){
			return 1;
		}
		
		return 2;		
	}
}


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

int main() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> S(H);
    for(auto &e : S) cin >> e;
    auto f = [&](auto &&f, int pos, vector<vector<int>> A, int cut) -> int {
        if(pos == H) {
            int N = A.size();
            vector<int> cnt(N);
            rep(j, W) {
                bool over = false;
                rep(i, A.size()) {
                    if(A[i][j] > K) return H * W;
                    cnt[i] += A[i][j];
                    if(cnt[i] > K) over = true;
                }
                if(over) {
                    cut++, j--;
                    cnt.assign(W, 0);
                }
            }
            return cut;
        }
        rep(i, W) A.back()[i] += S[pos][i] == '1';
        int res = f(f, pos + 1, A, cut);
        rep(i, W) A.back()[i] -= S[pos][i] == '1';
        vector<int> tmp(W);
        rep(i, W) tmp[i] = S[pos][i] == '1';
        A.push_back(tmp);
        int res2 = f(f, pos + 1, A, cut + 1);
        return min(res, res2);
    };
    vector<vector<int>> A(1, vector<int>(W));
    rep(i, W) A[0][i] = S[0][i] == '1';
    cout << f(f, 1, A, 0) << '\n';
    return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
cin >> N;
vector<int> d(N);
for (int i=0 ;i<N;i++){
cin >> d[i];
}
int S=0;
for(int i=0;i<N-1;i++){
for(int j=i+1;j<N;j++){
S = S + d[i]*d[j];
}
}
cout << S <<endl;
}

Measured memory_bytes: 256
S = input()
letter = list(S)

if len(S) % 2 != 0:
    CentChara = len(S) // 2
    del letter[CentChara]

num = int(len(letter) / 2)
count = 0
bakcount = -1
fail = 0

for dif in range(num):
    PreChara = letter[count]
    BakChara = letter[bakcount]
    if PreChara != BakChara:
        fail += 1

    count += 1
    bakcount += -1

print(fail)

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

using namespace std;
using ll = long long;

const int nax = 10123;
char k[nax];
const int mod = 1e9 + 7;

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

signed main() {
    scanf("%s", k);
    int D;
    scanf("%d", &D);
    int len = strlen(k);
    vector<vector<int>> dp(D, vector<int>(2));
    // dp[sum][smaller_already] - the number of ways to choose digits so far
    // such that the sum of digits modulo D is 'sum' and 'smaller_already'
    // says whether we already chosen some digit smaller than in K
    dp[0][0] = 1;
    for (int where = 0; where < len; where++) {
        vector<vector<int>> new_dp(D, vector<int>(2));
        for (int sum = 0; sum < D; sum++) {
            for (bool sm_already : {false, true}) {
                for (int digit = 0; digit < 10; digit++) {
                    if (digit > k[where] - '0' && !sm_already) {
                        break;
                    }
                    add_self(new_dp[(sum + digit) % D][sm_already || (digit < k[where] - '0')],
                        dp[sum][sm_already]);
                }
            }
        }
        dp = new_dp;
    }
    int answer = (dp[0][false] + dp[0][true]) % mod;
    --answer;
    if (answer == -1) {
        answer = mod - 1;
    }
    printf("%d\n", answer);
    return false;
}

Measured memory_bytes: 256
fn main() {
    let mut s: String = read_line();
    let t: String = read_line();

    let mut ans = s == t;
    for _ in 0..s.len() {
        if ans {break;}
        let c = s.pop().unwrap();
        s.insert(0, c);
        if t == s {
            ans = true;
        }
    }

    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn read_line<T: std::str::FromStr>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
    
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, n) for (int i = 0; i < n; i++)
#define repn(i, a, b) for (int i = a;i<=b;i++)
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mem(x) memset(x, 0, sizeof(x))
#define ritr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define pai pair < int, int> 
#define pal pair < ll, ll> 
#define vi vector <int> 
#define vl vector < ll > 
#define vpai vector < pii > 

const int mod = 1e9+7;
const int INF = INT_MAX;
const int sze = 3005;

void solve() {
    int n,k;
    cin>>n>>k;
    ll arr[n];
    rep(i,n) cin>>arr[i];

    int dp[n+1][k+6];
    // mem(dp);

    rep(i,n+1) dp[i][0]=1;
    rep(i,k+1) dp[0][i]=0;
    dp[0][0]=1;

    for(int i=1;i<=n;i++){
        vl pre(k+1);
        pre[0]=dp[i-1][0];
        repn(j,1,k) pre[j]=(pre[j-1]+dp[i-1][j])%mod;

        for(int j=1;j<=k;j++){
            if(arr[i-1]>=j){
                dp[i][j]=pre[j]%mod;
                
            }else dp[i][j]=(pre[j]-pre[j-arr[i-1]-1]+mod)%mod;
        }
    }

    // rep(i,n+1){
    //     rep(j,k+1) cout<<dp[i][j]<<" ";
    //     cout<<endl;
    // }
    cout<<dp[n][k]<<endl;
}

int main() {
    IOS;

    int t = 1;
    //cin >> t;
    while (t--) {
       solve();
    }

  return 0;
}

Measured memory_bytes: 43768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i = 0; i < n; i++) {
			x[i]=sc.nextInt();
			y[i]=sc.nextInt();
		}
		int[] cx = new int[m];
		int[] cy = new int[m];
		for(int i = 0; i < m; i++) {
			cx[i]=sc.nextInt();
			cy[i]=sc.nextInt();
		}//入力終わり
		//一人ずつ取り出し
		for(int i = 0; i < n; i++) {
			int minM = Integer.MAX_VALUE;
			int p = 1;
			for(int j = 0; j < m; j++) {
				if(Math.abs(x[i]-cx[j])+Math.abs(y[i]-cy[j]) < minM) {
					minM = Math.abs(x[i]-cx[j])+Math.abs(y[i]-cy[j]);
					p = j+1;
				}
			}
			System.out.println(p);
		}
	}
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int D = nextInt();
  string ans = "";
  if (D == 25) ans = "Christmas";
  if (D == 24) ans = "Christmas Eve";
  if (D == 23) ans = "Christmas Eve Eve";
  if (D == 22) ans = "Christmas Eve Eve Eve";
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

#define int long long

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

#define len(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const int INF = 2e18 + 7;

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, x;
    cin >> n >> m >> x;
    vector<vi> a(n);
    vi c(n);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        a[i].resize(m);
        for (int j = 0; j < m; j++) cin >> a[i][j];
    }
    int ans = INF;
    for (int mask = 0; mask < (1 << n); mask++) {
        vector<int> have(m, 0);
        int cost = 0;
        for (int i = 0; i < n; i++) {
            if ((mask >> i) & 1) {
                cost += c[i];
                for (int j = 0; j < m; j++) have[j] += a[i][j];
            }
        }
        bool good = 1;
        for (int i = 0; i < m; i++) {
            if (have[i] < x) good = 0;
        }
        if (good) ans = min(ans, cost);
    }
    cout << (ans == INF ? -1 : ans);
    return 0;
}


Measured memory_bytes: 3664
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        int maxValue = 1;
        int secondMaxValue = 0;
        int currentValue;
        List<int> indMaxList = new List<int>();

        for(int i = 0; i < N; i++) {
            currentValue = int.Parse(Console.ReadLine());

            if(maxValue == currentValue) { 
                indMaxList.Add(i);
            
            } else if(maxValue < currentValue) {
                secondMaxValue = maxValue;
                maxValue = currentValue;

                indMaxList = new List<int>(){i};
            
            } else if(secondMaxValue < currentValue) {
                secondMaxValue = currentValue;
            
            }
        }

        int cntMaxInd = indMaxList.Count();

        for(int i = 0; i < N; i++) {
        
            if(cntMaxInd > 1) {
                Console.WriteLine(maxValue);
                continue;
            
            }

            if (indMaxList.IndexOf(i) >= 0) {
                Console.WriteLine(secondMaxValue);
            
            }
            else {
                Console.WriteLine(maxValue);
            
            }

        }
    }
}

Measured memory_bytes: 18260
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

int main() {
    ll N;
    cin >> N;
    rep(i,0,N) {
        ll A;
        cin >> A;
        if (A%2 == 0) {
            if (A%3 != 0 && A%5 != 0) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
}


Measured memory_bytes: 888
#include<iostream>
#include<string>
using namespace std;
int main() {

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

	int array[100000];
	for (int i = 0; i < a; i++) {
		cin >> array[i];
	}

	int num = 1;

	int aa = a - 1;

	a = a - b;
	int k = 1;
	if (a == 0) {
		cout << 1;
	}
	else {
		for (int j = 1; k > 0; j++) {
			k = a - (b - 1)* j;
			num++;
		}
		cout << num;
	}
	cin >> a;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 7;
const int mod = 998244353;
ll ksm(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans *= x;
        x *= x;
        x %= mod;
        ans %= mod;
        y >>= 1;
    }
    return ans;
}
int main()
{
    ll n, m, k;
    cin >> n >> m >> k;
    ll res = n - k - 1;
    ll ans = 0;
    ll tmp = 1;
    for (ll i = n - res; i <= n - 1; i++)
    {
        tmp *= i;
        tmp %= mod;
    }
    //printf("%lld\n", tmp);
    for (ll i = 2; i <= res; i++)
    {
        tmp *= ksm(i, mod - 2);
        tmp %= mod;
    }
    //printf("%lld\n", tmp);
    for (ll p = res; p <= n - 1; p++)
    {
        ans += ((tmp * m) % mod * ksm(m - 1, p)) % mod;
        ans %= mod;
        tmp *= (n - p - 1) % mod;
        tmp %= mod;
        //printf("%lld:%lld\n", p, tmp);
        tmp *= ksm(p + 1, mod - 2) % mod;
        tmp %= mod;
    }
    //printf("%lld\n", ans);
    //ans -= m * ksm(m - 1, n - 1);
    ans %= mod;
    ans += mod;
    ans %= mod;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3772
// use std::cmp;
// use std::collections::HashMap;
// use std::collections::HashSet;


// const INF: i64 = 1_000_000_000;


fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n = sc.read();
    let mut a = Vec::new();
    for _ in 0..n {
        a.push(sc.read());
    }
    let a = a;
    let mut ans: i64 = 0;
    let mut pass = 0;
    for i in (0..n).rev() {
        if pass > 0 {
            pass -= 1;
        }
        if a[i] == pass {
            continue;
        } else if a[i] < pass {
            ans = -1;
            break;
        }
        ans += a[i];
        pass = a[i];
    }
    if pass > 0 {
        ans = -1;
    }
    println!("{}", ans);
}

// thanks, ir5
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


Measured memory_bytes: 6396
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
using namespace std;
#define clr(a) memset(a,0,sizeof(a))
//--Container
#include<set>
//
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;
  
struct eg{int u,v,nx;}gp[50010];int cnt,hd[210],mth[210];bool bd[210];
void psh(int u,int v){++cnt;gp[cnt].u=u,gp[cnt].v=v,gp[cnt].nx=hd[u],hd[u]=cnt;};
  
bool fdp(int v){
    int i;for(i=hd[v];i;i=gp[i].nx)if(!bd[gp[i].v]){
        bd[gp[i].v]=1;
        if(!mth[gp[i].v]||fdp(mth[gp[i].v])){
            mth[gp[i].v]=v;
            return 1;
        }
    }
    return 0;
};
int hgy(int n){
    int rs=0,i;for(clr(mth),i=1;i<=n;++i){
        clr(bd);if(fdp(i))++rs;
    }
    return rs;
};
  
int ar[110],dr[210],cr[2][210],dn,n;
  
bool _ck(int n){
    if(n==1)return 0;int d=sqrt(n),i=2;for(;i<=d;++i)if(!(n%i))return 0;
    return 1;
};
  
bool cl(){
    if(scanf("%d",&n)==-1)return 0;
    int i,j,t,a,b,k;for(i=1;i<=n;scanf("%d",&ar[i++]));sort(ar+1,ar+n+1);n=unique(ar+1,ar+n+1)-ar-1;
    for(dn=1,dr[1]=ar[1],i=2;i<=n;++i){
        if(ar[i]==ar[i-1]+1)continue;
        dr[++dn]=ar[i-1]+1,dr[++dn]=ar[i];
    }
    dr[++dn]=ar[n]+1;
    for(a=b=0,i=1;i<=dn;++i){
        if(dr[i]&1)cr[1][++a]=dr[i];
        else
            cr[0][++b]=dr[i];
    }
    for(cnt=0,clr(hd),i=1;i<=a;++i)for(j=1;j<=b;++j)if(_ck(abs(cr[1][i]-cr[0][j])))
        psh(i,j);
    t=hgy(a);
    printf("%d\n",t+((a-t)/2*2)+((b-t)/2*2)+((a-t)%2*3));
    return 1;
};
  
int main() {
    while(cl());
    return 0;
};

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
#include<ext/pb_ds/priority_queue.hpp>
using namespace std;

const int maxn = 1E6 + 10;
typedef long long LL;
const LL mo = 1000000007;

int n,sum,f[maxn];

inline int Mul(const LL &x,const LL &y) {return x * y % mo;}
inline int Add(const int &x,const int &y) {return x + y < mo ? x + y : x + y - mo;}

int main()
{
	#ifdef DMC
		freopen("DMC.txt","r",stdin);
	#endif
	
	cin >> n; f[1] = n; f[2] = Mul(n,n);
	for (int i = 3; i <= n; i++)
	{
		f[i] = Add(f[i - 1],sum);
		f[i] = Add(f[i],Mul(n - 1,n - 1));
		f[i] = Add(f[i],n - i + 2);
		sum = Add(sum,f[i - 2]);
	}
	cout << f[n] << endl;
	return 0;
}

Measured memory_bytes: 4096
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  As = list(map(int, input().strip().split()))
  nminus = 0
  for i in range(n):
    if As[i] < 0:
      As[i] = abs(As[i])
      nminus += 1
  if As.count(0) >= 1 or nminus%2==0:
    print(sum(As))
  else:
    print(sum(As)-2*min(As))

if __name__=='__main__':
  main()



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

int main()
{
	int r, c;
	int i, j;
	
	cin >> r >> c;
	int matrix[r+1][c+1];
	
	for(i=0;i<r+1;i++){
		for(j=0;j<c+1;j++){
			matrix[i][j]=0;
		}
	}
	
	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			cin >> matrix[i][j];
		}
	}
	
	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			matrix[i][c]+=matrix[i][j];
		}
	}
	
	for(j=0;j<=c;j++){
		for(i=0;i<r;i++){
			matrix[r][j]+=matrix[i][j];
		}
	}
	
	for(i=0;i<r+1;i++){
		for(j=0;j<c+1;j++){
			cout << matrix[i][j];
			if(j!=c)
				cout << ' ';
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>

int main(){
	int n, i, j;
	
	while( scanf("%d", &n) != EOF){
		int  number[n], sum = 0;
		number[0] = 0;
		for( i = 1; i < n; i++){
			number[i] = 1;
		}
		for( i = 1; i < n; i++){
			if( number[i-1] == 1){
				for( j = 2; j < i; j += i){
					if( i % j == 0){
						number[i-1] = 0;
						break;
					}
				}
				for( j = i*2; j <= n; j += i){
					number[j-1] = 0;
				}
			}
			if( number[i] ){
				sum++;
			}
		}
		printf("%d\n", sum);
	}
	
	return 0;
}

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

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

    double ans = 2*r*M_PI;
    printf("%.10f\n",ans);
    return 0;
}

Measured memory_bytes: 3760
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N;
		Number num;
		int count;
		
		for(;;) {
			N = sc.next();
			if(N.equals("0000")) {
				break;
			}
			num = new Number(N);
			count = num.getCount();
			if(count == -1) {
				System.out.println("NA");
			} else {
				System.out.println(count);
			}
		}
	}
}

class Number {
	private int L,S,count;
	private String N;
	private String[] nums;
	
	public Number(String n) {
		N = n;
		switch(N.length()) {
		case 1:
			N = "000" + N;
			break;
		case 2:
			N = "00" + N;
			break;
		case 3:
			N = "0" + N;
			break;
		}
		count = 0;
		nums = new String[4];
	}
	
	private void setMin() {
		String tmp = "";
		for(int i=0; i<4; i++){
			tmp += nums[i];
		}
		S = Integer.valueOf(tmp);
	}
	
	private void setMax() {
		String tmp = "";
		for(int i=3; i>=0; i--){
			tmp += nums[i];
		}
		L = Integer.valueOf(tmp);
	}
	
	private void splitNumber() {
		for(int i=0; i<4; i++) {
			nums[i] = N.charAt(i)+"";
		}
		Arrays.sort(nums);
	}
	
	public int getCount() {
		if(N.equals("6174")) {
			return 0;
		} else if(!checkNumber()) {
			return -1;
		}
		changeNumber();
		return count;
	}
	
	private boolean checkNumber() {
		splitNumber();
		if(nums[0].equals(nums[1])){
			if(nums[0].equals(nums[2])){
				if(nums[0].equals(nums[3])){
					return false;
				}
			}
		}
		
		return true;
	}
	
	private void changeNumber() {
		int num,len;
		for(;;){
			count++;
			splitNumber();
			setMax();
			setMin();
			num = L - S;
			N = Integer.toString(num);
			if(N.equals("6174")) {
				break;
			}
			switch(N.length()) {
			case 1:
				N = "000" + N;
				break;
			case 2:
				N = "00" + N;
				break;
			case 3:
				N = "0" + N;
				break;
			}
		}
	}
}

Measured memory_bytes: 58848
n, m = map(int, input().split())

B = [1] * n
R = [0] * n
R[0] = 1
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1; y -= 1

    if B[x] == 1 and R[x] == 1:
        R[x] =  0; R[y] =  1
    elif B[x] > 1 and R[x] == 1:
        R[y] =  1
    B[x] -= 1; B[y] += 1

print(len([i for i in R if i==1]))

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

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

    char c;
    cin >> c;

    if(c >= 65 && c <= 90)
        cout << "A";
    else if(c >= 97 && c <= 122)
        cout << "a";
	return 0;
}

Measured memory_bytes: 3556
s=str(input())
n=len(s)
matome=[]
i=0
while i<n:
    now=s[i:i+1]
    j=1
    i+=1

    while s[i:i+1]==now:
        i+=1
        j+=1
    matome.append(j)
#print(matome)
s=list(s)
count=0
ans=[]
i=0
while i<n:
    if s[i]=="R" and s[i+1]=="L":
        sum_m = matome[count]+matome[count+1]
        if sum_m%2==0:
            ans.append(sum_m//2)
            ans.append(sum_m//2)
        else:
            if matome[count]%2==1:
                ans.append(sum_m//2+1)
                ans.append(sum_m//2)
            else:
                
                ans.append(sum_m//2)
                ans.append(sum_m//2+1)
        count+=2
        i+=2
    else:
        ans.append(0)
        i+=1
    
for i in range(n):
    print(ans[i],end=" ")




Measured memory_bytes: 6292
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> T gcd(T a, T b){return !b?a:gcd(b,a%b);}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
mt19937 R(chrono::system_clock().now().time_since_epoch().count());

const int N = 666666,mo=998244353;
int n;
inline void add(int &x, int y){x=x+y<mo?x+y:x+y-mo;}
inline void sub(int &x, int y){x=x-y>=0?x-y:x-y+mo;}
inline int power(int a, int n) {
	int res=1;
	while (n) {
		if (n&1) res=1LL*res*a%mo;
		a=1LL*a*a%mo; n>>=1;
	}
	return res;
}
struct Y{
	Vi e[N];int sg[N],f[N],mx;bool vis[N];
	void solve(){
		int m;read(m);
		while(m--){
			int u,v;read(u);read(v);if(u>v)swap(u,v);
			e[u].pb(v);
		}
		per(i,n,1){
			for(int j:e[i])vis[sg[j]]++;
			for(;vis[sg[i]];sg[i]++);
			for(int j:e[i])vis[sg[j]]=0;
		}
		rep(i,1,n)add(f[sg[i]],power(10,18*i)),umax(mx,sg[i]);
	}
}a,b,c;
int main() {
	read(n);
	a.solve();
	b.solve();
	c.solve();
	int res=0;
	rep(i,0,a.mx)rep(j,0,b.mx)res=(res+1ll*a.f[i]*b.f[j]%mo*c.f[i^j])%mo;
	cout<<res;
	return 0;
}


Measured memory_bytes: 65024
x=list(input())
stack=[]
for i in range(len(x)):
    if x[i]=="S":
        stack.append(x[i])
    elif x[i]=="T":
        if len(stack)==0:
            stack.append(x[i])
        elif stack[-1]=="T":
            stack.append(x[i])
        elif stack[-1]=="S":
            stack.pop()
print(len(stack))


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

int main(){
    int n;
    scanf("%d", &n);
    int odd = 0;
    while(n--){
        int x;
        scanf("%d", &x);
        if(x % 2) odd++;
    }
    cout << (odd % 2 ? "NO" : "YES") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
#define vcin(a) for(int i=0;i<(a).size();i++) cin>>(a)[i];

int main()
{
    int N, M;
    cin >> N >> M;
    vint p(M),wa(N+1);
    vector<string> S(M);
    int wasum=0,ac=0;
    map<int,bool> m;
    rep(i, M)
    {
        cin >> p[i] >> S[i];
        if(m.count(p[i]) == 0 or m[p[i]]==false)
        {
            if(S[i]=="AC")
            {
                m[p[i]] = true;
                wasum += wa[p[i]];
                ac++;
            }
            else
            {
                m[p[i]] == false;
                wa[p[i]]++;
            }
        }
    }
    cout << ac << endl
         << wasum;
    return 0;
}

Measured memory_bytes: 11264
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		for(int i=1;;i++){
			int x = sc.nextInt();
			if(x>0){
				System.out.printf("Case %d: %d\n",i,x);
			}else{
				break;
			}
		}
	}
}


Measured memory_bytes: 63232
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

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

	int N = S.size();

	int ret = 0;
	int cnt = 0;
	rep(i, N) {
		if (S[i] == 'S') {
			cnt++;
		} else {
			if (cnt == 0) ret++;
			else cnt--;
		}
	}

	ret += cnt;

	cout << ret << endl;
}


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

int n, m;
vector<double> l, a, b;
double ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> m;
	for(int i=0; i<n; ++i){
		double x, y, z;
		cin >> x >> y >> z;
		l.push_back(x);
		a.push_back(y);
		b.push_back(z);
	}
	for(int i=0; i<(1<<n); ++i){
		int t = i;
		int cnt = 0;
		while(t > 0){
			if((t&1)==1) ++cnt;
			t >>= 1;
		}
//		cout << i << " " << cnt << "\n";
		if(cnt != m) continue;
		double tmp = 0.0;
		for(int j=0; j<n; ++j)
			for(int k=j+1; k<n; ++k)
				if((((i>>j)&1)==1)&&(((i>>k)&1)==1))
					tmp += (l[j]-l[k])*(l[j]-l[k])+(a[j]-a[k])*(a[j]-a[k])+(b[j]-b[k])*(b[j]-b[k]);
		ans = max(ans, tmp);
	}
	printf("%.6lf\n", ans);
}


Measured memory_bytes: 3344
#include <stdio.h>
int main(void){
  int m,f,r,s;
  while(scanf(" %d%d%d",&m,&f,&r)) {
    if(m==-1&&f==-1&&r==-1)break;
    s=0;
    s+=m>=0?m:-100;
    s+=f>=0?f:-100;
    if(s>=80)printf("A\n");
    else if(s>=65)printf("B\n");
    else if(s>=50)printf("C\n");
    else if(s>=30)printf("%c\n",r>=50?'C':'D');
    else printf("F\n");
  }
  return 0;
}

Measured memory_bytes: 612
#include <iostream>
using namespace std;
int main(){
 int m, f, r;
 while(1){
  cin >> m >> f >> r;
  if(m == -1 && f == -1 && r == -1)
   break;
  else if(m+f >= 80 && m >=0 && f >= 0)
   cout << 'A' << endl;
  else if(m+f >= 65 && m+f < 80 && m >=0 && f >= 0)
   cout << 'B' << endl;
  else if(m+f >= 50 && m+f < 65 && m >=0 && f >= 0)
   cout << 'C' << endl;
  else if(m+f >= 30 && m+f < 50 && r < 50 && m >=0 && f >= 0)
   cout << 'D' << endl;
  else if(m+f >= 30 && m+f < 50 && r >= 50 && m >=0 && f >= 0)
   cout << 'C' << endl;
  else if(m+f < 30 || m == -1 || f == -1)
   cout << 'F' << endl;
 }
 return 0;
}

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

#define MAXINF 1000000005
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define repc(it, x) for(auto it = (x).begin(); it != (x).end(); ++it)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rrepc(it, x) for(auto it = (x).rbegin(); it != (x).rend(); ++it)
#define all(x) (x).begin(), (x).end()
#define P pair<int, int>

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

    ll n;
    cin >> n;
    map<ll, ll> mp;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }
    ll ans = 0;
    repc(it, mp) {
        ans += mp[it->first]*(mp[it->first]-1)/2;
    }
    for(ll k = 0; k < n; k++) {
        cout << ans - mp[a[k]] + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 12032
#include<algorithm>//everybody dies in their nightmares
#include<iostream>
#include<cstring>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
//#include<unordered_set>
//#include<unordered_map>
#include<bitset>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1e9 + 7;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;

const int N = 6e5 + 5;
int t;

int main()
{
	
	ll x;
	//cout << (ll)pow(6000, 5) << endl;
	while (cin >> x)
	{
		pair<int, int> ans;
		f(i, -500, 500)
		{
			f(j, -500, 500) 
			{
				if ((ll)pow(i, 5) - (ll)pow(j, 5) == x)
				{
					ans.first = i, ans.second = j;goto hh;
				}
			}
		}
	hh:cout << ans.first << " " << ans.second << endl;
	}
	return 0;
}



Measured memory_bytes: 4104
n = int(input())
A = list(int(x) for x in input().split())

text = 'APPROVED'
for count in A:
    if(count % 2 == 0):
        if(not(count % 3 == 0 or count % 5 == 0)):
            text = 'DENIED'
            break

print(text)

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

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

void solve(const char c, const int n, const string& s, vector<int>& ans){
	int count = 0;
	for(int i = 0; i < n; ++i){
		if(s[i] == c){
			count++;
		}
		else{
			if(i == 0) continue;
			ans[i - 1] += (count + 1) / 2;
			ans[i] += count / 2;
			count = 0;
		}
	}
}

int main(){
	string s;
	cin >> s;
	int n = s.size();
	
	vector<int> ans(n, 0);
	
	solve('R', n, s, ans);
	
	reverse(s.begin(), s.end());
	reverse(ans.begin(), ans.end());
	
	solve('L', n, s, ans);
	
	reverse(ans.begin(), ans.end());
	
	for(int i = 0; i < n; ++i){
		cout << ans[i] << " ";
	}
	cout << endl;
	
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PDD pair<double, double>
#define MOD ((int)2e9 + 7)
#define INF ((int)2e9)
#define INFLL ((LL)2e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (2 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 2, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 1) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL res = 2;
    LL sum = a;
    while(b){
        if(b&2)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

double exp(double a, LL b){
    double res = 1;
    double sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

signed  main(){
    int N, K;
    cin >> N >> K;
    if((N-1)*(N-2)/2 < K){
        cout << -1 << endl;
        return 0;
    }
    cout << N - 1 + (N - 1) * (N - 2) / 2 - K << endl;
    for(int i=2;i<=N;++i)cout << 1 << " " << i << endl;
    int rp=2;
    int lp = 3;
    REP(i, (N-1)*(N-2)/2 - K){
        cout << rp << " " << lp << endl;
        if(++lp == N+1){
            ++rp;
            lp = rp + 1;
        }
    }
    return 0;
}



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

using namespace std;

int n;
vector<int> ve[100005], vi[100005];
int ans[100005];
int mx;
bool v[100005];

void dfs(int p, int q)
{
    int j = 1;
    for(int i = 0; i < ve[p].size(); i++)
    {
        if(v[ve[p][i]]) continue;
        v[ve[p][i]] = true;
        if(j == q) j++;
        ans[vi[p][i]] = j;
        dfs(ve[p][i], j);
        j++;
    }
}

int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n - 1; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        ve[u].push_back(v);
        vi[u].push_back(i);
        ve[v].push_back(u);
        vi[v].push_back(i);
        mx = max(mx, (int)ve[u].size());
        mx = max(mx, (int)ve[v].size());
    }
    v[1] = true;
    dfs(1, 0);
    printf("%d\n", mx);
    for(int i = 0; i < n - 1; i++)
    {
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}

int main(void) {

	lli n;
	cin >> n;

	cout << n * (n - 1) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

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

typedef vector<int> vi;

int main()
{
	int d;
	while(scanf("%d", &d) != EOF){
		int ans = 0;
		for(int i=0; i<600; i+=d)
			ans += i*i;
		printf("%d\n", ans*d);
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <ctype.h>

int main(void){
	char ch[1200];	
	int i=0;

	fgets(ch, 1200, stdin);

	while (ch[i] != '\0'){
		if (islower(ch[i])){
			ch[i] = toupper(ch[i]);
		}
		else if (isupper(ch[i])){
			ch[i] = tolower(ch[i]);
		}
		i++;
	}
	fputs(ch, stdout);
	
	return 0;
}

Measured memory_bytes: 524