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

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		while (true) {
			int cnt = in.nextInt();
			if (cnt == 0)
				break;
			int i = 0;
			int[] str = new int[cnt * 2];
			while (i < cnt * 2) {
				str[i] = in.nextInt();
				i++;
			}

			int p1 = 0, p2 = 0;
			for (int j = 0; j < cnt * 2; j += 2) {
				if (str[j] > str[j + 1])
					p1 += (str[j] + str[j + 1]);
				else if (str[j] < str[j + 1])
					p2 += (str[j] + str[j + 1]);
				else {
					p1 += str[j];
					p2 += str[j + 1];
				}
			}
			System.out.println(p1 + " " + p2);
		}
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  queue<long> ans;
  for(long i=1; i<10; i++){
    ans.push(i);
  }
  long k,x;
  cin>>k;
  for(long i=1; i<k; i++){
    x=ans.front();
    ans.pop();
    if(x%10!=0){
      ans.push(x*10+(x%10)-1);
    }
    ans.push(x*10+(x%10));
    if(x%10!=9){
      ans.push(x*10+(x%10)+1);
    }
  }
  x=ans.front();
  cout<<x;
}

Measured memory_bytes: 1792
#include <iostream>


using namespace std;


#define ll long long


ll max_min(const ll s[], const ll size)
{
  ll maxv=-1LL, minv=100000000000LL;

  for (ll i=0; i<size; i++){
    maxv = s[i] > maxv ? s[i] : maxv;
    minv = s[i] < minv ? s[i] : minv;
  }

  return maxv-minv;
}


ll chocolatebar(const ll x, const ll y)
{
  ll minv=100000000000LL, s[3], j;

  for (ll i=1; i<x; i++){
    s[0] = i*y;
    j = (x-i)/2;
    s[1] = j*y;
    s[2] = (x-i-j)*y;
    minv = max_min(s, 3) < minv ? max_min(s, 3) : minv;

    j = y/2;
    s[1] = (x-i)*j;
    s[2] = (x-i)*(y-j);
    minv = max_min(s, 3) < minv ? max_min(s, 3) : minv;
  }

  return minv;
}


int main()
{
  ll h, w, minv;

  cin >> h >> w;
  minv = chocolatebar(h, w);
  minv = chocolatebar(w, h) < minv ? chocolatebar(w, h) : minv;
  cout << minv << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << 3 << endl;

    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'S') cout << 2 << endl;
    if(s[0] == 'S' && s[1] == 'R' && s[2] == 'R') cout << 2 << endl;

    if(s[0] == 'R' && s[1] == 'S' && s[2] == 'S') cout << 1 << endl;
    if(s[0] == 'S' && s[1] == 'R' && s[2] == 'S') cout << 1 << endl;
    if(s[0] == 'S' && s[1] == 'S' && s[2] == 'R') cout << 1 << endl;
    if(s[0] == 'R' && s[1] == 'S' && s[2] == 'R') cout << 1 << endl;

    if(s[0] == 'S' && s[1] == 'S' && s[2] == 'S') cout << 0 << endl;
    
    return 0;
}

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

using namespace std;

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

  int card[4][13] = {};
  for(int i=0;i<n;i++){
    string suit;
    int num;
    cin>>suit>>num;

    if(suit == "S") card[0][num-1] = 1;
    if(suit == "H") card[1][num-1] = 1;
    if(suit == "C") card[2][num-1] = 1;
    if(suit == "D") card[3][num-1] = 1;
}

  string str[4] = {"S", "H", "C", "D"};
  for(int i=0;i<4;i++){
   for(int j=0;j<13;j++){
    if(card[i][j] == 1) continue;
    cout<<str[i]<<" "<<j+1<<endl;
}
}

}


Measured memory_bytes: 3132
#include <iostream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
typedef vector<vector<int>> matrix;

int main()
{
    // 入力
    int N;
    cin >> N;
    matrix G(N + 1, vector<int>(N + 1, 0));

    for (int i = 0; i < N; i++)
    {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            int v;
            cin >> v;
            G[u][v] = 1;
        }
    }

    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j <= N; j++)
        {
            cout << G[i][j];
            if (j != N)
            {
                cout << " ";
            }
        }
        cout << endl;
    }
}



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

namespace ABC161
{
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_B();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            var i = Ex.ReadIntArray();
            Ex.Cw($"{i[2]} {i[0]} {i[1]}");
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
            var l1 = Ex.ReadIntArray();
            var arr = Ex.ReadIntArray();
            // N 種類の商品
            var n = l1[0];
            // M個を選べる
            var m = l1[1];
            // 総投票数の1/4M未満である
            var d = arr.Sum() / 4.0 / m;
            var c = arr.Count(v => d <= v);
            Ex.Cw(m <= c);
        }
        public void Cw(bool b)
        {
            if (b) Ex.Cw("Yes");
            else Ex.Cw("No");
        }
    }
    public class ABC_C
    {
        public ABC_C()
        {
        }
    }
    public class ABC_D
    {
        public ABC_D()
        {
        }
    }
    public class ABC_E
    {
        public ABC_E()
        {
        }
    }
    public class ABC_F
    {
        public ABC_F()
        {

        }
    }
    public static class Ex
    {
        public static void Cw(object s)
        {
            Console.WriteLine(s);
        }
        public static void Cw(bool b)
        {
            if (b) Cw("Yes");
            else Cw("No");
        }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(s => int.Parse(s)).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(s => long.Parse(s)).ToArray(); }
        public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public static long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 13396
a[3][1<<18],b[2],x,y,N[2][1<<18],i,j;main(n){scanf("%d",&n);for(;i<3;++i)for(j=0;j<n;++j){scanf("%d",&a[i][j]);--a[i][j];}for(j=0;j<n;++j){if(a[0][j]/3-a[1][j]/3||a[1][j]/3-a[2][j]/3||a[2][j]/3-a[0][j]/3||a[1][j]%3-1||a[1][j]/3-j&1){b[0]=1;break;}x=y=a[1][j]/3+1;while(x){b[j&1]-=N[j&1][x]%2;x-=x&-x;}b[j&1]+=j/2;while(y<2e5){++N[j&1][y];y+=y&-y;}if(a[0][j]%3)++b[1-j%2];}puts(b[0]&1|b[1]&1?"No":"Yes");}

Measured memory_bytes: 3664
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node
{
  int key;
  Node *next, *prev;
};

Node *nil;

Node* listSearch(int key){
  Node *cur=nil->next;
  while(cur != nil && cur->key != key)
  {
    cur=cur->next;
  }
  return cur;
}

void init(){
  nil=(Node *)malloc(sizeof(Node));
  nil->next=nil;
  nil->prev=nil;
}

void printList(){
  Node *cur = nil->next;
  int isf=0;

  while(1)
  {
    if(cur == nil) break;
    if(isf++ > 0) printf(" ");
    printf("%d", cur->key);
    cur=cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t){
  if(t == nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void deleteKey(int key){
  deleteNode(listSearch(key));
}

void insert(int key){
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size=0;
  char com[20];
  int np=0, nd=0;

  scanf("%d", &n);

  init();

  for(i=0; i<n; i++)
  {
    scanf("%s %d", com, &key);
    if(com[0] == 'i')
    {
      insert(key);
      np++;
      size++;
    }
    else if(com[0] == 'd')
    {
      if(strlen(com) > 6)
      {
        if(com[6] == 'F') deleteFirst();
        else if(com[6] == 'L') deleteLast();
      }
      else
      {
        deleteKey(key);
        nd++;
      }
      size--;
    }
  }

  printList();

  return 0;
}



Measured memory_bytes: 33816
#include <cstdio>
using namespace std;
int N, C[500], S[500], F[500];
int ans, dx;
int main() {
  scanf("%d", &N);
  for(int i = 1; i < N; i++) {
    scanf("%d %d %d", &C[i], &S[i], &F[i]);
  }
  for(int i = 1; i < N; i++) {
    ans = 0;
    for(int j = i; j < N; j++) {
      dx = ans-S[j];
      if(dx <= 0) ans += -dx+C[j];
      else if(dx%F[j]) ans += F[j]-dx%F[j]+C[j];
      else ans += C[j];
    }
    printf("%d\n", ans);
  }
  printf("%d\n", 0);
}

Measured memory_bytes: 128
module Main where

import Numeric
import Data.Functor

main :: IO ()
main =  do
  { [n] <- getDoubles
  ; if n == 0 then done
    else do
      { si  <- getDoubles
      ; let m = sum si / n
      ; let s2 = (sum $ map ((^2) . (subtract m)) si) / n
      ; let s  = sqrt s2
      ; putStrLn (showFFloat Nothing s "")
      ; main
      }
  }

done :: IO ()
done = return ()

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

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

ll powll(ll a,ll n){
  if(n==0)
  {
    return 1;
  }
  return powll(a,n-1)*a;
}

ll a[500000];
int main() {
   ll i,j,k;
    ll h,n,sum=0;
    cin >> h>>n;
    for(i=0; i<n; i++)
    {
      cin>>a[i];
      sum+=a[i];
    }

if(h>sum)
{
  cout << "No" << endl;
}else
{
  cout << "Yes" << endl;
}
    
  
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _KTy, typename _Ty> istream& operator >> (istream& istr, pair<_KTy, _Ty>& m) { cin >> m.first >> m.second; return istr; }
template <typename _Ty> istream& operator >> (istream& istr, vector<_Ty>& v) { for (size_t i = 0; i < v.size(); i++) cin >> v[i]; return istr; }
ll modpow(ll n, ll p, ll m) { ll result = 1; while (p > 0) { if (p & 1) result = (result * n) % m; p >>= 1; n = (n * n) % m; } return result; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define fake false



int main() {
	string O, E;
	cin >> O >> E;
	for (int i = 0; i < O.size(); i++) {
		cout << O[i];
		if (i != E.size()) cout << E[i];
	}
	cout << endl;

	return 0;
}

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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  
  string ans = "No";
  if (a + b == c
     || b + c == a
     || c + a == b) ans = "Yes";
  
  cout << ans << endl;
}

Measured memory_bytes: 256
/*#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
# define ll unsigned long long
# define int long long  //comment it out when MLE
//# define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define mo 1000000007
//# define MOD 163577857
# define pi acos(-1)
# define fi first
# define se second
#define REP(i,n) for (int i = 1; i <= n; i++)
const ll mod = 1000000007;
const int K = 2;
//typedef vector<vector<int> > matrix;
/*
int add(int a, int b,int mod) {
    a%=mod;
    b%=mod;
	a += b;
	if (a >= mod) a -= mod;
	if(a<0)
    {
        a += mod;
        a %= mod;
    }
	return a;
}

int mul(ll a, int b,int mod) {
    a%=mod;
    b%=mod;
	a *= b;
	a += mod;
	return a % mod;
}
int po(int a,int b,int mod)
{
    if(b==0)
        return 1;
    if(b%2==0)
        return po(mul(a,a,mod),b/2,mod);
    return mul(a,po(mul(a,a,mod),(b-1)/2,mod),mod);
}


ll fact[1000003];
ll inv[1000003];

void fact0()
{
	int i,j;
	fact[0]=1;
	for(i=1;i<=200000;i++)
	{
		fact[i]=i*fact[i-1]%mod;
	}
	inv[0]=1;
	inv[1]=1;
	ll p=mod;
	for (i=2; i<=200000; i++)
		inv[i] = (p - (p/i) * inv[p%i] % p) % p;

	for(i=2;i<=200000;i++)
	{
		inv[i]*=inv[i-1];
		inv[i]%=mod;
	}
}
*/

signed main() {
	gok

  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];

  sort(a,a+n);
  int su=0;
  for(int i=0;i<k;i++)
    su+=a[i];

  cout<<su;














  return 0;
}


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

int main() {
	string s;
	string t;
	int count = 0;

	cin >> s;

	std::size_t si = s.size();
	t = s;
	reverse(s.begin(), s.end());

	for (int i = 0; i < si/2; i++) {
		if (s[i]!=t[i]) {
			count++;
		}
	}
	

	cout<<count;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;

using namespace std;

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define MAX                 10000007
#define MIN                 -10000007



              
int main()
{
  ios::sync_with_stdio(0);
    cin.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
      
    int t;
    t=1;
     //  cin>>t;
    while(t--){
            ll n,d,c=0;
            cin>>n>>d;
            REP(i,0,n-1){
                long double x,y;
                cin>>x>>y;
                long double sum=sqrt(x*x+y*y);
                if(sum<=d) c++;
            }
            cout<<c;
       


             }
             cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}


Measured memory_bytes: 3864
import sys
import math
from collections import defaultdict, deque
from copy import deepcopy
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    H, W = MI()
    d = Init(H, W, -1)
    mylist = [input().rstrip() for i in range(H)]
    move = [[1,0],[0,1],[-1,0],[0,-1]]
    dq = deque()
    dq.append([0,0])
    goal = [H-1,W-1]
    d[0][0] = 0
    while dq:
        ht, wt = dq.popleft()
        for h, w in move:
            h += ht
            w += wt
            if h >= 0 and h < H and w >= 0 and w < W and d[h][w] == -1 and mylist[h][w] != "#":
                d[h][w] = d[ht][wt]+1
                dq.append([h,w])
                
    goal_dist = d[goal[0]][goal[1]]
    if goal_dist == -1:
        print(-1)
    else:
        white = 0
        for i in mylist:
            white += i.count('.')
        print(white-goal_dist-1)


        
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 74908
import math
n,d =  map(int,input().split()) 	
x=[]
cnt =0
for _ in range(n):
    tmp = list(map(int,input().split()))
    x.append(tmp)
for i in range(n-1):
    for j in range(i+1,n):
        r = 0
        for k in range(d):
            r += (x[i][k]-x[j][k])**2
        r = math.sqrt(r)
        if r % 1 == 0:
            cnt += 1
print(cnt)

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

int main(){
 char alpha; cin >> alpha;
  char ans;
  if(alpha >= 'a' && alpha <= 'z') ans = 'a';
  if(alpha >= 'A' && alpha <= 'Z') ans = 'A';
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

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

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  int N;    cin>>N;
  vector<ll> x(N), l(N);
  vector<P> v(N), v2(N);
  rep(i,0,N){
      ll X,L;   cin>>X>>L;
      v[i] = make_pair(X+L, X-L);
  }
  sort(all(v));
  ll crt = -INF;
  int cnt = 0;
  rep(i,0,N){
    ll rx = v[i].fi, lx = v[i].se;
    if(crt <= lx){
        crt = rx;
        cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}   

Measured memory_bytes: 7988
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    ll N,A;cin>>N>>A;
    ll info[N];
    rep(i,N){
        cin>>info[i];
        info[i]-=A;
    }
    vvl ans(N+1,vl(2500));
    ans[0][1250]=1;
    rep(i,N){
        rep(j,2500){
            if(ans[i][j]){
                ans[i+1][j]+=ans[i][j];
                ans[i+1][j+info[i]]+=ans[i][j];
            }
        }
    }
    cout<<ans[N][1250]-1<<endl;
    return 0;
}

Measured memory_bytes: 1280
##C
A,B,H,M = map(int,input().split())

##角度の計算
C=(H*30+M*0.5-M*6)
if C < 0:
    C = -C

import math
ans = A**2 + B**2 -2*A*B*math.cos(math.radians(C))
print(math.sqrt(ans))

Measured memory_bytes: 9372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try(Scanner scanner = new Scanner(System.in)) {
			String data = scanner.nextLine();

			if (data.matches("[A-Z]")) {
				System.out.println("A");
			} else {
				System.out.println("a");
			}
		}
	}
}

Measured memory_bytes: 35848
#include<stdio.h>
 
int n,cont,flag=0;
int A[1000000];
int G[1000000];

void insertionSort(int *, int, int);
void shellSort(int *, int);


int main(){

  int i;

  scanf("%d",&n);

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

  shellSort(A,n);

  printf("%d\n",flag);

  for(i=flag-1;i>=0;i--){
    printf("%d",G[i]);
    if(i) printf(" ");
  }

  printf("\n");

  printf("%d\n",cont);

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

void insertionSort(int *A,int n,int g){

  int v,j,i;

  for(i=g;i<n;i++){
    v=A[i];
    j=i-g;
    while(j>=0 && A[j]>v){
      A[j+g]=A[j];
      j-=g;
      cont++;
    }
    A[j+g]=v;
  }
}
 
void shellSort(int *A,int n){

  int h,i;

  for(h=1; ; ){
    if(h>n) break;
    G[flag++]=h;
    h=3*h+1;
  }
  for(i=flag-1;i>=0;i--){
    insertionSort(A,n,G[i]);
  }
}

Measured memory_bytes: 6372
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
int main(){
	ll n,m;
	cin>>n>>m;
	if(n==1){
		if(m==1){
			cout<<1<<endl;
			return 0;
		}
		else{
			cout<<m-2<<endl;
			return 0;
		}
	}
	else{
		if(m==1){
			cout<<n-2<<endl;
			return 0;
		}
		else{
			cout<<(n-2)*(m-2)<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <locale>

typedef long long ll;

using namespace std;

int main()
{
    ll n, k;
    string s;
    locale loc;

    cin >> n >> k;
    cin >> s;

    for (ll i=0; i<n; ++i)
    {
        if (i == k-1)
            cout << tolower(s[i], loc);
        else
            cout << s[i];
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int k = sc.nextInt();
			int x = sc.nextInt();
			boolean first = true;

			for(int i = x - k + 1; i < x + k; i++) {
				if (!first) {
					System.out.print(" ");
				}
				System.out.print(i);
				first = false;
			}
			System.out.println("");
		}
	}
}


Measured memory_bytes: 21844
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
arrT = [0] + list(map(int,input().split()))
M = int(input())
PandX = [list(map(int,input().split())) for i in range(M)]

total = sum(arrT)
for pm in PandX:
    pnum ,x = pm[0],pm[1]
    print(total - arrT[pnum] + x)

# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
    int z;
    cin>>z;
    double c=0;
    int q=1;
    double sum;
    while(q<=z)
    {
        if(q%2==1)
        {
             c=c+1;
        }
 
      q++;
    }
 
    sum=c/z;
    cout<<sum;
 
 
 
 
 
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        int a = Read.Int();
        int b = Read.Int();
        int c = Read.Int();
        int n = Read.Int();
        int asn = 0;
        for (int i = 0; i <= a; i++)
        {
            for (int j = 0; j <= b; j++)
            {
                for (int k = 0; k <= c; k++)
                {
                    if (500 * i + 100 * j + 50 * k == n)
                    {
                        asn++;
                    }
                }
            }
        }
            Console.WriteLine(asn);
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 13140
def gcd(a, b):
    return gcd(b, a % b) if b > 0 else a


n, k = map(int, input().split())
a = list(map(int, input().split()))

m = max(a)

g = a[0]

for i in range(n):
    g = gcd(g, a[i])

if k > m:
    print("IMPOSSIBLE")
elif k % g == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	int m = 10001;
	bool arr[10001];
	REP(i, 0, m) arr[i] = false;
	arr[0] = true;
	int n;
	cin >> n;
	int s, ma=0;
	REP(i, 0, n){
		cin >> s;
		for(int j = m-1; j>= 0; j--){
			if(arr[j]==true && j+s < m){
				arr[j+s] = true;
				if(ma < j+s && (j+s)%10!=0) ma = j+s; 
			}
		}
	}
	cout << ma;

}


Measured memory_bytes: 256
n = int(input())
ls = list(map(int,input().split(" ")))
ans = 0

for i in range(n-2):
    if (ls[i] < ls[i+1] and ls[i+1] < ls[i+2]) or (ls[i] > ls[i+1] and ls[i+1] > ls[i+2]):
        ans += 1

print(ans)


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

int main(){
  int m[1000001]={},j,a,h,t,cou;
  m[2]=1;
  for(int i=3;i<=1000000;i+=2){
    for(j=3;j*j<=i;j++){
      if(i%j==0)break;
    }
    if(j*j>i)m[i]=1;
  }
  while(1){
    cin >> a;
    if(a==0)break;
    h=0;
    cou=0;
    while(1){
      for(h++;m[h]!=1&&h<=a;h++);
      if(h>a/2)break;
      if(m[a-h]==1)cou++;
    }
    cout << cou << endl;
  }
  return 0;
}

Measured memory_bytes: 5072
#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
    long long n, c, ans;
    cin >> n >> c;
    long long  x[n], v[n], avr[n+1], avl[n+1], maxr[n+1], maxl[n+1];
    for(int i =0; i<n; i++){
        cin >> x[i] >> v[i];
        avr[i] = i==0? v[i]
                     : avr[i-1] + v[i];
    }
    for(int i =0; i<n; i++){
        auto current = avr[i] - x[i];
        maxr[i] = i==0? current
                      : max(maxr[i-1], current);
    }
    maxr[n] = 0;
    
    for(int i = n-1; i>=0; i--){
        avl[i] = i==n-1? v[i]
                       : avl[i+1] + v[i]; 
    }
    for(int i = n-1; i>=0; i--){
        auto current = avl[i] - (c-x[i]);
        maxl[i] = i==n-1? current
                        : max(maxl[i+1], current);
    }
    maxl[n] = 0;
    
    ans = 0;
    for(int i=0; i<n; i++){
        auto r1 = avr[i]-x[i];
        auto r2 = avr[i]-2*x[i] + maxl[i+1];
        auto first_right = max(r1, r2);
        ans = max(ans, first_right);
        auto l1 = avl[i] - (c-x[i]);
        auto l2 = i==0? avl[i]-2*(c-x[i]) : avl[i]-2*(c-x[i]) + maxr[i-1];
        auto first_left = max(l1, l2);
        ans = max(ans, first_left);
    }
    cout << ans << endl;
    return 0;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    string s; cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    printf("%d %d %d\n", a, b, 3*c-a-b);
    printf("%d %d %d\n", -2*a-b+4*c, c, 2*a+b-2*c);
    printf("%d %d %d\n", a+b-c, 2*c-b, 2*c-a);
    return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	void solve() {
		int K;
		string S;
		cin >> K >> S;

		if( S.size() <= K ) {
			cout << S << endl;
		}
		else {
			cout << S.substr( 0, K ) << "..." << endl;
		}
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){

    int num;
    cin >> num;
    int count = 0;
    bool yes = true;
    int currentX = 0;
    int currentY = 0;
    int previousSteps = 0;

    while(count < num) {
        int steps;
        int temp;
        cin >> steps;
        temp = previousSteps;
        previousSteps = steps;
        steps = steps - temp;

        int x, y;
        cin >> x >> y;

        int xDif = abs(currentX - x);
        int yDif = abs(currentY - y);

        bool Check = false;
        if (((((xDif + yDif) % 2) == 0) && (steps % 2) == 0) || ((((xDif + yDif) % 2) == 1) && (steps % 2) == 1)) {
            Check = true;
        }


        if (steps < (xDif + yDif) || !Check) {
            yes = false;
        } else {
            currentX = x;
            currentY = y;
        }




        count++;
    }

        if (yes) {
            cout << "Yes";
        } else {
            cout << "No";
        }


    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{       
    static void MakeDepth(int[] depth, int index, int dtemp, List<int>[] children, int maxDepth)
    {
        // depth[index] = dtemp;
        // foreach(int i in children[index])
        // {
        //     MakeDepth(depth, i, dtemp + 1, children);
        // }
        var que = new Queue<int>();
        que.Enqueue(index);
        int count = dtemp;
        while(que.Any() && maxDepth >= count)
        {
            int queCount = que.Count;
            foreach(int i in Enumerable.Range(0, queCount))
            {
                int p = que.Dequeue();
                depth[p] = count;
                foreach(int child in children[p])
                    que.Enqueue(child);
            }
            count++;
        }
    }
    static int GetParent(int[] parents, int index, int depth)
    {
        // if(depth == 0)
        //     return index;
        // return GetParent(parents, parents[index], depth - 1);
        while(depth > 0)
        {
            index = parents[index];
            depth--;
        }
        return index;
    }
    public void Slove()
    {
        var inputs = Console.ReadLine().Split();
        int n = int.Parse(inputs[0]);
        int k = int.Parse(inputs[1]);
        var children =
            Enumerable.Range(0, n)
            .Select(x => new List<int>())
            .ToArray();
        var parents = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
        int result = 0;
        if(parents[0] != 0)
        {
            parents[0] = 0;
            result++;
        }
        foreach(var item in parents.Select((x, i) => new {Parent = x, Child = i}).Skip(1))
        {
            children[item.Parent].Add(item.Child); 
        }
        int[] depth = new int[n];
        MakeDepth(depth, 0, 0, children, n);
        foreach(int i in Enumerable.Range(0, n).OrderByDescending(x => depth[x]))
        {
            if(depth[i] > k)
            {
                int parent = GetParent(parents, i, k - 1);
                MakeDepth(depth, parent, 1, children, k);
                result++;
            }
        }
        System.Console.WriteLine(result);
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


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

int main()
{
  int n;
  int A, B;
  A = B = 0;
  cin >> n;
  vector<int> Cards(n);

  for (int i = 0; i < n; i++)
  {
    cin >> Cards.at(i);
  }

  for (int i = 0; i < n; i++)
  {
    int maxElementIndex = max_element(Cards.begin(), Cards.end()) - Cards.begin();
    int maxElement = *max_element(Cards.begin(), Cards.end());
    Cards.at(maxElementIndex) = 0;

    if (i % 2 == 0)
    {
      A += maxElement;
    }
    else
    {
      B += maxElement;
    }
  }
  cout << A - B << endl;
}


Measured memory_bytes: 3608
def main():
    n,m = map(int,input().split())
    x = [list(map(int,input().split())) for _ in range(n)]
    ans = [0]*8
    ans[0] = sum(sorted([i+j+k for i,j,k in x],reverse=True)[:m])
    ans[1] = sum(sorted([i+j-k for i,j,k in x],reverse=True)[:m])
    ans[2] = sum(sorted([i-j+k for i,j,k in x],reverse=True)[:m])
    ans[3] = sum(sorted([i-j-k for i,j,k in x],reverse=True)[:m])
    ans[4] = sum(sorted([-i+j+k for i,j,k in x],reverse=True)[:m])
    ans[5] = sum(sorted([-i+j-k for i,j,k in x],reverse=True)[:m])
    ans[6] = sum(sorted([-i-j+k for i,j,k in x],reverse=True)[:m])
    ans[7] = sum(sorted([-i-j-k for i,j,k in x],reverse=True)[:m])
    print(max(ans))
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 39664
if __name__ == '__main__':
    a, b, c = map(int, input().split())
    k = int(input())

    answer = -1
    for i in range(k):
        if a == max(a,b,c):
            a = 2*a
        elif b == max(a,b,c):
            b = 2*b
        elif c == max(a,b,c):
            c = 2*c

    answer = a + b + c
    print(answer)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int3(a, b, c);
    puts((c || (a & b)) ? "Open" : "Close");


/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N);
    REP(i, N) cin >> a[i];
    ll s = a[0];
    REP(i, N - 1) s ^= a[i+1];
    REP(i, N) cout << (s ^ a[i]) << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 4316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int X; 
    cin >> X;
    int a[50][50] = {0};
    for(int i = 1; i < 32; ++i){
     a[i][2] = i * i; 
     for(int j = 2; j <= 10; ++j){
     if(a[i][j] * i <= 1000)
    a[i][j+1] = a[i][j] * i;
     else a[i][j+1] = 0; 
     }
    }
    int b[1234]; 
    for(int i = 1; i < 50; ++i){
     for(int j = 2; j <= 10; ++j){
      b[a[i][j]] ++; 
     }
    }
  int ans = X; 
 for(int i = X; i >= 1; i--) 
 if(b[i] > 0){
    ans = i; 
   break;
    }
 cout << ans << endl; 
}

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b,c;

main() {
    cin >> a >> b >> c;
    if (a-b == b-c) ct("YES")
    else ct("NO")
}



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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumlate(all(a),0)
#define pb push_back
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int n; cin >> n;
  vector<bitset<10>> f(n);
  rep(i,n) rep(j,10){
    int a; cin >> a;
    if(a) f[i].set(9-j);
    else f[i].reset(9-j);
  }
  vii p(n,vi(11));
  rep(i,n) rep(j,11) cin >> p[i][j];

  int ans = -1 * (1<<30);
  FOR(b,1,1024){
    bitset<10> bs(b);
    int c = 0;
    rep(i,n){
      int ci = (bs & f[i]).count();
      c += p[i][ci];
    }
    ans = max(ans,c);
    //cout << bs << endl << c << endl;
  }
  /*
  rep(i,n){
    rep(j,10) cout << f[i][j];
    cout << endl;
  }
  */
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>



int main(){
    int n,k,i,j,sum=0,temp;

    scanf("%d %d",&n,&k);

    int a[n];

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

    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if(a[j]>a[i]){
                temp=a[j];
                a[j]=a[i];
                a[i]=temp;
            }
        }
    }

    for(i=0;i<k;i++){
        sum+=a[i];
    }

    printf("%d\n",sum);

    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

vector<string> s;
string buf = "";
int ci = 0, cj = 0;

void input() {
  string l;
  while (1) {
    getline(cin, l);
    if (l == "END_OF_TEXT") {
      break;
    }
    s.push_back(l);
  }
}

// カーソルを現在の行の先頭文字に移動する
void op_a() { cj = 0; }

// カーソルを現在の行の行末に移動する
void op_e() { cj = s[ci].size(); }

// 上に行があれば、カーソルを上の行の先頭文字に移動する。
// 上に行がなければ、カーソルを先頭文字に移動する。
void op_p() {
  if (ci != 0) 
    --ci;
  op_a();
}

// 下に行があれば、カーソルを下の行の先頭文字に移動する。
// 下に行がなければ、カーソルを先頭文字に移動する。
void op_n() {
  if (ci != s.size() - 1) 
    ++ci;
  op_a();
}

// カーソルが行末にない場合、カーソルを１つ右に移動する 
// カーソルが行末にありかつ下に行がある場合は、
// カーソルを下の行の先頭文字へ移動する 
// それ以外の場合は何もしない
void op_f() {
  if (cj != s[ci].size()) {
    ++cj;
  } else if (cj == s[ci].size() && ci != s.size() - 1) {
    op_n();
  }
}

// カーソルが先頭文字でないならば、カーソルを１つ左に移動する。
// カーソルが先頭文字でありかつ上に行がある場合は、
// カーソルを上の行の行末へ移動する。
// それ以外の場合は何もしない。
void op_b() {
  if (cj != 0) {
    --cj;
  } else if (cj == 0 && ci != 0) {
    --ci;
    op_e();
  }
}

// カーソルが文字を指す場合はその文字を削除する。
// 削除された文字の右側の文字列は左にシフトされる。
// カーソルが行末を指し下に行がある場合は、
// 下の行をそのままカーソルの位置に繋げる。以下の行は上にシフトされる。
// それ以外の場合は何もしない。
void op_d() {
  if (cj != s[ci].size()) {
    s[ci].erase(cj, 1);
  } else if (cj == s[ci].size() && ci != s.size() - 1) {
    s[ci] += s[ci+1];
    s.erase(s.begin() + ci + 1);
  }
}

// カーソルが行末にある場合、下に行があれば、
// d と同じ操作をしバッファに１つの改行を記録する。
// カーソルが行末にない場合、カーソルが指す文字を含めた
// 右側すべての文字を切り取りそれをバッファに記録する。
// カーソルは元の行の行末を指すようになる。全ての記録においてバッファは上書きされる。
// それ以外の場合は何もしない。(clarification at 14:20)
void op_k() {
  if (cj == s[ci].size() && ci != s.size() - 1) {
    s[ci] += s[ci+1];
    s.erase(s.begin() + ci + 1);
    buf = "\n";
  } else  {
    buf = s[ci].substr(cj);
    s[ci].erase(cj);
  }
}

// バッファが空の場合はなにもしない。
// バッファの内容が改行の場合、カーソルが指す文字の直前で改行を行う。
// カーソルは新しい行の先頭文字へ移動する。
// バッファの内容が文字列の場合、カーソルの位置にバッファの内容を挿入する。
// カーソルの位置はもともと指していた文字または行末の場所へ移動する。 
void op_y() {
  if (buf == "") return;
  if (buf == "\n") {
    inserter(s, s.begin() + ci + 1) = s[ci].substr(cj);
    s[ci].erase(cj);
    ++ci; cj = 0;
  } else {
    s[ci].insert(cj, buf.c_str());
    cj += buf.size();
  }
}

void interpret() {
  string op;
  while (1) {
    getline(cin, op);
    if (op == "-") break;
    if (op == "a") {
      op_a();
    } else if (op == "e") {
      op_e();
    } else if (op == "p") {
      op_p();
    } else if (op == "n") {
      op_n();
    } else if (op == "f") {
      op_f();
    } else if (op == "b") {
      op_b();
    } else if (op == "d") {
      op_d();
    } else if (op == "k") {
      op_k();
    } else if (op == "y") {
      op_y();
    }
  }
  rep(i,s.size()) {
    cout << s[i] << endl;
  }
}

int main() {
  input();
  interpret();
  return 0;
}

Measured memory_bytes: 1212
N, K = map(int, input().split())
ans_list = [0 for x in range(N)]
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(d):
        ans_list[A[j] - 1] += 1
ans = ans_list.count(0)
print(ans)


Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
int main(){
    int array[16][11];
    for (int i=1;i<16;i++) {
        for (int j=1;j<11;j++) {
            array[i][j] = 0;
        }
    }
    int n;
    cin >> n;
    for (int k=0;k<n;k++) {
        int b,f,r,v;
        cin >> b >> f >> r >> v;
        if ( b==1 && f==1 ) {
            array[f][r] = array[f][r] + v;
        } else if ( b==1 && f==2 ) {
            array[f][r] = array[f][r] + v;
        } else if ( b==1 && f==3 ) {
            array[f][r] = array[f][r] + v;
        } else if ( b==2 && f==1 ) {
            array[f+4][r] = array[f+4][r] + v;
        } else if ( b==2 && f==2 ) {
            array[f+4][r] = array[f+4][r] + v;
        } else if ( b==2 && f==3 ) {
            array[f+4][r] = array[f+4][r] + v;
        } else if ( b==3 && f==1 ) {
            array[f+8][r] = array[f+8][r] + v;
        } else if ( b==3 && f==2 ) {
            array[f+8][r] = array[f+8][r] + v;
        } else if ( b==3 && f==3 ) {
            array[f+8][r] = array[f+8][r] + v;
        } else if ( b==4 && f==1 ) {
            array[f+12][r] = array[f+12][r] + v;
        } else if ( b==4 && f==2 ) {
            array[f+12][r] = array[f+12][r] + v;
        } else if ( b==4 && f==3 ) {
            array[f+12][r] = array[f+12][r] + v;
        } 
    }
    for (int l=1;l<16;l++) {
        for (int m=1;m<11;m++) {
            if ( l==4 || l==8 || l==12 ) {
                cout << "####################" << endl;
                break;
            }
            if ( m==10 ) {
                cout << " " <<array[l][m] << endl;
            } else {
                cout << " " << array[l][m];
            }
        }
        
    }
}



Measured memory_bytes: 3096
#include <bits/stdc++.h> 
#define ll long long
#define F first
#define FF first.first
#define FS first.second
#define S second
#define pb push_back
using namespace std;
const ll N=1000006, INF=1e16;
 
ll n, q=1, m, e, a[N], f[N], c[N], o, k, t, x, y, z, u, h, mx, mn, ans, Ans;
pair<ll,ll> p[N];
string s[N];
vector<int> v[N];
 
main(){ios_base::sync_with_stdio(false), cin.tie(0);
   	
	cin>>x>>y;
	if(x>y){
		cout<<"safe";
	}else{
		cout<<"unsafe";
	}
}

Measured memory_bytes: 58324
k,a,b = map(int,input().split())
pp = b - a
if pp <= 1:
    print(k + 1)
    exit()
if a - 1 >= k:
    print(k + 1, 2)
    exit()
k -= a - 1
bc = a
if k % 2 == 1:
    bc += 1
bc += (k // 2) * pp
print(bc)


Measured memory_bytes: 3060