akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

string f(int t) {
	string ret = "";
	ret += 'a' + t / 10;
	ret += 'a' + t % 10;
	return ret;
}

signed main() {
	cout << "?saae" << endl;
	int t = 1;
	string s;
	unordered_set<string> st;
	while (cin >> s) {
		if (st.count(s) || s.front() != 'e') {
			cout << "!OUT" << endl;
			return 0;
		}
		st.insert(s);
		cout << "?" << s.back() << f(t) << "e" << endl;
		t++;
	}
	return 0;
}

Measured memory_bytes: 3200
fun func( map : Map<Int,Int> , num : Int) : Int {
    var ret = map.get(num)
    if( ret != null ){
        return ret
    } else {
        return 0
    }
}

fun main(args : Array<String>){
    val map = mutableMapOf<Int, Int>(1 to 300000 , 2 to 200000 , 3 to 100000)
    val str = readLine()?.split(" ")?.map(String::toInt)

    var sum = 0
    if (str != null) {
        for( s in str ){
            sum += func(map, s)
        }

        if(str[0] == 1 && str[1] == 1 ){
            sum += 400000
        }
    }

    print(sum)
}

Measured memory_bytes: 37904
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rev(i,n,a) for(ll i=n-1;i>=a;i--)
#define f first
#define s second
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vpii vector<pair<int,int>>
#define vpll vector<pll>
#define pll pair<ll,ll>
#define secreterror() ios_base::sync_with_stdio(false);cin.tie(NULL);

void solve(){
    ll n,k;
    cin>>n>>k;

    vector<ll>arr(n);

    rep(i,0,n)cin>>arr[i];

    sort(arr.begin(),arr.end());

    ll ans=0;

    rep(i,0,k){
        ans+=arr[i];
    }
    cout<<ans<<endl;
    
}


int main()
{
    secreterror()
    // ll t;
    // cin>>t;
    //while(t--){
        solve();
        
    //}

}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, comp, score1{0}, score2{0};
  string s1, s2;
  cin >> n;
  cin.ignore(1, '\n');
  for (int i{0}; i < n; ++i) {
    getline(cin, s1, ' ');
    getline(cin, s2);
    comp = s1.compare(s2);
    if (comp > 0) {
      score1 += 3;
    } else if (comp < 0) {
      score2 += 3;
    } else {
      ++score1;
      ++score2;
    }
  }
  cout << score1 << ' ' << score2 << '\n';
}



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

int canbe(char s[]){
    int cnt=0,cur,cur2,len;
    char *sabc;
    int i;
    int ap,bp,cp;
    len = strlen(s);
    //printf("called:%s",s);
    //ABC?????????????´¢????????¨????????????????????§??????????????????
    ap = bp = cp = 1;
    for(i=0;i<len;i++){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')cnt++;
        if(s[i]=='A'&&(s[i+1]!='B'||s[i+2]!='C'))ap = 0;
        if(s[i]=='B'&&(s[i-1]!='A'||s[i+1]!='C'))bp = 0;
        if(s[i]=='C'&&(s[i-2]!='A'||s[i-1]!='B'))cp = 0;
    }
    //printf("ap=%d bp=%d cp=%d\n",ap,bp,cp);
    sabc = (char *)calloc(len-2*cnt+5,sizeof(char));
    //??°???????????§?????????
    if(len==4&&cnt==1){
        //printf("%s");
        return 1;
    }else{
        if(cnt){
            //ABC???A?????????
            if(ap){
                cur = 0;
                for(i=0;i<len;i++){
                    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
                        sabc[cur] = 'A';
                        i+=2;
                    }else{
                        sabc[cur] = s[i];
                    }
                    cur++;
                }
                sabc[cur] = '\0';
                if(canbe(sabc)){
                    //printf("A\n");
                    return 1;
                }
            }
            //ABC???B?????????
            if(bp){
                cur = 0;
                for(i=0;i<len;i++){
                    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
                        sabc[cur] = 'B';
                        i+=2;
                    }else{
                        sabc[cur] = s[i];
                    }
                    cur++;
                }
                sabc[cur] = '\0';
                if(canbe(sabc)){
                    //printf("B\n");
                    return 1;
                }
            }
            //ABC???C?????????
            if(cp){
                cur = 0;
                for(i=0;i<len;i++){
                    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
                        sabc[cur] = 'C';
                        i+=2;
                    }else{
                        sabc[cur] = s[i];
                    }
                    cur++;
                }
                sabc[cur] = '\0';
                if(canbe(sabc)){
                    //printf("C\n");
                    return 1;
                }else{
                    return 0;
                }
            }
            return 0;
        }else{
            return 0;
        }
    }
}

int main(){
    char s[5005];
    fgets(s,5005,stdin);
    printf(canbe(s)? "Yes\n":"No\n");
}

Measured memory_bytes: 7324
import math,sys
N = int(input())
A = list(map(int, input().split()))
ans = 1

if 0 in A:
    print(0)
    sys.exit()

for i in range(N):
    ans = ans*A[i]
    if ans > pow(10,18):
        print(-1)
        sys.exit()

print(ans)


Measured memory_bytes: 22160
//2019.8.17 by ljz
//email 573902690@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f
#define unl __int128
#define eps 5.6e-8
#define RG register
#define db double
#define pc(x) __builtin_popcount(x)
typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pb push_back
#define ull unsigned LL
#define gc getchar
//inline char gc() {
//    static char buf[100000],*p1,*p2;
//    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
inline int read() {
    res s=0,ch=gc();
    while(ch<'0'||ch>'9')ch=gc();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s;
}
//inline int read() {
//    res s=0,ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline void write(RG unl x){
//    if(x>10)write(x/10);
//    putchar(int(x%10)+'0');
//}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//clock_t start=clock();
//inline void ck(){
//    if(1.0*(clock()-start)/CLOCKS_PER_SEC>0.1)exit(0);
//}
const int N=5e5+10;
namespace MAIN{
    int a[N],b[N],las[N],nxt[N],n;
    inline bool ck(const res &x){
        return (b[x]-a[x])>=b[las[x]]+b[nxt[x]];
    }
    queue<int> Q;
    LL ans;
    inline void MAIN(){
        n=read();
        for(res i=1;i<=n;i++)las[i]=i-1,nxt[i]=i+1;
        las[1]=n,nxt[n]=1;
        for(res i=1;i<=n;i++)a[i]=read();
        for(res i=1;i<=n;i++)b[i]=read();
        for(res i=1;i<=n;i++)if(ck(i))Q.push(i);
        while(!Q.empty()){
            res u=Q.front();
            Q.pop();
            res k=(b[u]-a[u])/(b[las[u]]+b[nxt[u]]);
            ans+=k,b[u]-=k*(b[las[u]]+b[nxt[u]]);
            if(ck(las[u]))Q.push(las[u]);
            if(ck(nxt[u]))Q.push(nxt[u]);
            if(ck(u))Q.push(u);
        }
        for(res i=1;i<=n;i++)if(a[i]!=b[i]){puts("-1");return;}
        printf("%lld\n",ans);
    }
}
int main(){
//    srand(19260817);
//    freopen("signin.in","r",stdin);
//    freopen("signin.out","w",stdout);
    MAIN::MAIN();
    return 0;
}

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    char k;
    cin >> k;
    if(k >= 'A' && k <= 'Z'){
        cout << "A\n";
    } else {
        cout << "a\n";
    }
    return 0;
}

Measured memory_bytes: 3580
S = input()
S_len = len(S)

flag = 0
result = []

R_index = []
L_index = []

for i in range(S_len):
  
  if S[i] == 'R':
    if flag == 1:
      result.extend([0]*(len(R_index)-1))
      R_tmp = -(-len(R_index) // 2) + (len(L_index) // 2)
      L_tmp = (len(R_index) // 2) + -(-len(L_index) // 2)
      result.append(R_tmp)
      result.append(L_tmp)
      result.extend([0]*(len(L_index)-1))
      flag = 0
      R_index = []
      L_index = []
      
    R_index.append(i)
  
  if S[i] == 'L':
    flag = 1
    L_index.append(i)

result.extend([0]*(len(R_index)-1))
R_tmp = -(-len(R_index) // 2) + (len(L_index) // 2)
L_tmp = (len(R_index) // 2) + -(-len(L_index) // 2)
result.append(R_tmp)
result.append(L_tmp)
result.extend([0]*(len(L_index)-1))
flag = 0
R_index = []
L_index = []

print(' '.join(map(str, result)))

Measured memory_bytes: 10972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()

/* */
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
const int MAX_LEN = 1010;
#define GETLINE(x) fgets(x,MAX_LEN,stdin);
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<double, double> dd;
typedef tuple<int, int, int> iii;
typedef vector<ii> vii;
typedef vector<ll> vll;
#ifdef XVENOM
  #define errp(...) fprintf(stderr, __VA_ARGS__)
  #define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
  #define errp(...)
  #define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
  string s_ = "[ ";
  for (const auto& x_ : e_) s_ += to_string(x_) + " ";
  return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
  return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
   errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
char s[500100];
int main() {
  scanf("%s",s);
  int n=strlen(s);
  ll sum=0;
  ll x=1;
  int i=0;
  ll y;
  while(i<n && s[i+1]==s[i]){i++;x++;}
  i++;
  sum+=(x*(x+1))/2;
  y=x;
  while(i<n){
    x=1;
    while(i<n && s[i+1]==s[i]){i++;x++;}
    if(s[i]=='>'){
      if(x>=y)sum-=y;
      if(y>x)x--;
    }
    sum+=(x*(x+1))/2;
    y=x;
    i++;
  }
  printf("%lld\n",sum);
}



Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define endl			"\n"
#define ll				long long
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define vi				vector <int>
#define vl				vector <ll>
#define ii				pair <ll,ll>
#define vii				vector <ii>
#define ull				unsigned long long
const double PI = 2 * acos(0.0);
void run() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 1e6 + 5;

int main() {
	run();
	ll a, b;
	cin >> a >> b;
	if (b - a > 2019)
		return cout << 0, 0;
	ll ans = ((a % 2019) * (b % 2019)) % 2019;
	for (ll i = a; i < b; i++) {
		for (ll j = a + 1; j <= b; j++) {
			ans = min((j * i) % 2019, ans);
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
	char w[26][2]={"AD","BE","CF","DG","EH","FI","GJ","HK","IL","JM","KN",
		"LO","MP","NQ","OR","PS","QT","RU","SV","TW","UX","VY",
		"WZ","XA","YB","ZC"};
	char key[1000];
	int len;
	int i,j;

	while(scanf("%s",key)!=EOF){
		len=strlen(key);
		for(i=0;i<len;i++){
			for(j=0;j<26;j++){
				if(key[i]==w[j][1]){
					printf("%c",w[j][0]);
				}
			}
		}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<string>
using namespace std;

int main() {
  long n, m;
  scanf("%ld %ld", &n, &m);
  long res = 0;
  if (n == 1 && m == 1) {
    res = 1;
  } else if (n == 1) {
    res = m - 2;
  } else if (m == 1) {
    res = n - 2;
  } else {
    res = (n-2) * (m-2);
  }
  printf("%ld\n", res);
}

Measured memory_bytes: 128
import math
l=int(input())
n=int(math.log2(l)+1)
E=[]
for i in range(n-1):
    E.append([i+1,i+2,0])
    E.append([i+1,i+2,2**i])
i=n-2
while l>2**(n-1):
    t=l-2**i
    if t>2**(n-1)-1:
        E.append([i+1,n,t])
        l=t
    i-=1
print(n,len(E))
for i in range(len(E)):
    print(*E[i])

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  
  long rootN = sqrt(N);
  long r = 1;
  long m = 0;
  while (r != 0) {
    r = N % rootN;
    m = N / rootN;
    rootN--;
  }
  
  
  cout << rootN + m - 1 << endl;
}

Measured memory_bytes: 256
import numpy as np

a1, a2 = map(int, input().split())
mx = [[list(i) for i in input().split()] for i in range(a1)]
mx = np.reshape(mx,-1)
mx = [0 if i == '.' else 1 for i in mx]
mx = np.reshape(mx,[a1,a2])

w = min(np.append(sum(mx,1),sum(mx,0)))

while w == 0:
    mx = mx[np.sum(mx,1) > 0]
    mx = mx.T[np.sum(mx.T,1) > 0].T
    w = min(np.append(sum(mx,1),sum(mx,0)))

res = np.where(mx == 0 ,".","#")

for x in res:
    print(''.join(x))

Measured memory_bytes: 12692
N=int(input())
def proc(x):
  return int(x)-1
from collections import deque
A=[deque(list(map(proc,input().split()))+[-1]) for i in range(N)]

ans = 0
rest = N*(N-1)
cand = set(range(N))
while rest>0:
  cand_next=set()
  for n in cand:
    if A[A[n][0]][0]==n:
      cand_next.add(n)
  if len(cand_next)==0:
    ans=-1
    break
  rest-=len(cand_next)
  cand=set()
  for n in cand_next:
    A[n].popleft()
    cand.add(n)
    if A[n][0]!=-1:
      cand.add(A[n][0])
  ans+=1
    

print(ans)
      

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

class Program
{

	//Main
	static void Main(string[] args)
	{
		//読み込む
		string[] S = Console.ReadLine().Split(' ');
		int N = int.Parse(S[0]);
		int M = int.Parse(S[1]);
		int[] An = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

		//合計
		int cnt = 0;
		bool isOver = false;

		for(int i=0; i<M; i++){
				cnt += An[i];
				if(cnt > N){
						isOver = true;
						break;
				}
		}

		if(isOver){
				Console.WriteLine(-1);
		}else{
				Console.WriteLine(N-cnt);
		}
	}
}



Measured memory_bytes: 20208
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using ll = int64_t;

int main() {
  int n;
  cin>>n;
  map<ll, pair<int, int>> m;
  REP(i,n) {
    ll d;
    cin>>d;
    m[d] = make_pair(1, i+1);
  }
  bool ok = true;
  vector<pair<int, int>> edges;
  while (m.size() > 1) {
    const auto itr = m.rbegin();
    ll d = itr->first;
    int k, i;
    tie(k, i) = itr->second;
    m.erase(prev(m.end()));
    ll diff = n-2*k;
    if (diff <= 0 || m.count(d - diff) == 0) {
      ok = false;
      break;
    }
    int l, j;
    tie(l, j) = m[d-diff];
    edges.emplace_back(j, i);
    m[d-diff] = make_pair(l+k, j);
  }
  if (ok) {
    reverse(ALL(edges));
    vector<ll> dist(n+1);
    for (auto p : edges) {
      int u, v;
      tie(u, v) = p;
      dist[v] = dist[u]+1;
    }
    ll sum = 0;
    for (auto d : dist) sum += d;
    if (sum == m.begin()->first) {
      for (auto p : edges) {
        int u, v;
        tie(u, v) = p;
        cout << u << ' ' << v << endl;
      }
    } else {
      cout << -1 << endl;
    }
  } else {
    cout << -1 << endl;
  }
  return 0;
}


Measured memory_bytes: 9592
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    N,M=pin()
    ans=set(range(1,M+1))
    for i in range(N):
          k,*a=pin()
          A=set(a)
          ans=ans&A
    print(len(ans))
#%%submit!    
resolve()


Measured memory_bytes: 38384
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n) { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x) { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};
struct pos3 {
	double x;
	double y;
	double z;
};
struct jama {
	pos3 p;
	double r;
	ll cost;
};

int main() {
	int n, q;
	cin >> n >> q;
	vector<jama> jamas(n);
	REP(i, n)
		cin >> jamas[i].p.x >> jamas[i].p.y >> jamas[i].p.z >> jamas[i].r >> jamas[i].cost;
	vector<pair<pos3, pos3>> ray(q);
	REP(i, q)
		cin >> ray[i].first.x >> ray[i].first.y >> ray[i].first.z >> ray[i].second.x >> ray[i].second.y >> ray[i].second.z;
	REP(i, q) {
		ll cost = 0;
		double tx = -(ray[i].first.x - ray[i].second.x);
		double ty = -(ray[i].first.y - ray[i].second.y);
		double tz = -(ray[i].first.z - ray[i].second.z);
		double t = tx*tx +
			ty*ty +
			tz*tz;
		REP(j, n) {
			double sx = (ray[i].first.x - jamas[j].p.x);
			double sy = (ray[i].first.y - jamas[j].p.y);
			double sz = (ray[i].first.z - jamas[j].p.z);
			double ts = (tx*sx + ty*sy + tz*sz);
			double p = -ts / t;
			if (p<0.0 || p>1.0)
				continue;
			double Px = ray[i].first.x + p*tx;
			double Py = ray[i].first.y + p*ty;
			double Pz = ray[i].first.z + p*tz;
			if ((Px - jamas[j].p.x)*(Px - jamas[j].p.x) +
				(Py - jamas[j].p.y)*(Py - jamas[j].p.y) +
				(Pz - jamas[j].p.z)*(Pz - jamas[j].p.z) <=
				jamas[j].r*jamas[j].r+(1e-5))
				cost += jamas[j].cost;
		}
		cout << cost << endl;
	}

}

Measured memory_bytes: 3216
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<string, string> P;
const ll MOD = 1000000007LL;

int main() {
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	int Min = Y, Max = X;
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		Max = max(Max, x);
	}
	for (int i = 0; i < M; i++) {
		int y;
		cin >> y;
		Min = min(Min, y);
	}
	if (Max < Min) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N;
    cin >> N;
    vector<int> P(N), Q(N);
    rep(i, N) cin >> P[i];
    rep(i, N) cin >> Q[i];

    vector<int> a(N);
    rep(i, N) a[i] = i + 1;
    map<vector<int>, int> mp;
    do{
        mp[a] = mp.size();
    }while(next_permutation(a.begin(), a.end()));

    cout << abs(mp[P] - mp[Q]) << endl;

    return 0;
}

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

using namespace std;

int main()
{
    string a, b, c;

    cin >> a >> b >> c;

    if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

def bfs(xx,dd,r)
  que = [[xx,dd]]
  while que.size > 0
    x,d = que.shift
    return if d > r
    next if(@mem[x])
    @ans[d] += 1 if (xx < x)
    @mem[x] = true
    @list[x].each do |nx|
      que.push([nx,d+1])
    end
  end
end

n, x, y = inp
@ans = na(n)
@list = na2(n,0)
(0...(n-1)).each do |x|
  @list[x].push(x+1)
  @list[x+1].push(x)
end
@list[x-1].push(y-1)
@list[y-1].push(x-1)
(0...(n-1)).each do |x|
  @mem = na(n,false)
  bfs(x,0,n-x)
end
@ans.shift
puts @ans

Measured memory_bytes: 13568
// dfs
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <cstdio>

using namespace std;

int ans, n, s;

void dfs(int pos, int t, int sum)
{
    if(t == n) {
        if(sum == s)
            ans++;
        return;
    }
    if(pos > 9)
        return;

    dfs(pos+1, t, sum);
    dfs(pos+1, t+1, sum + pos);
}

int main(void)
{
    while(cin >> n >> s) {
        if(n==0 && s==0) break;
        ans = 0;
        dfs(0, 0, 0);
        cout << ans << endl;
    }

    return 0;
}

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


int main() {
	int N;
	cin >> N;
	vector<vector<int>> F(N, vector<int>(5*2));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 5*2; j += 2) {
			cin >> F.at(i).at(j) >> F.at(i).at(j+1);
		}
	}
	vector<vector<int>> P(N, vector<int>(11));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= 10; j++) {
			cin >> P.at(i).at(j);
		}
	}

	// 営業時間の候補について、すべてのパターンを調べる。
	// 10bit の割り当ては、(1,1), (2,1), (1,2), ...
	int max;
	for (unsigned int j = 1; j < (1 << 10); j++) {
		bitset<10> b(j);
		int m = 0;
		for (int i = 0; i < N; i++) {
			int c = 0;
			for (int k = 0; k < 10; k++) {
				if (b.test(k) && F.at(i).at(k) == 1) {
					c++;
				}
			}
			m += P.at(i).at(c);
		}
		if (m > max || j == 1) {
			max = m;
		}
	}
	cout << max << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N;
bitset<4000001> DP;
int main() {
	cin >> N;
	DP[0] = 1;
	REP(i, 0, N) {
		int a;
		cin >> a;
		DP |= DP << a;
	}
	
	int cnt = DP.count();
	int now = 0;
	REM(i, 0, 4000001) {
		if (DP[i]) now++;
		if (now == (cnt + 1) / 2) {
			cout << i << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
using namespace std;
int main()
{
	string str;
	int k;
	cin >> str >> k;
	set<string> st;
	st.insert(str);
	for(int i = 0; i < str.size(); i++)
	{
		for(int j = 0; j <= k; j++)
		{
			st.insert(str.substr(i, j));
			//cout << str.substr(i, j) << endl;
		}
	}
	/*for(auto x : st)
	{
		cout << x << endl;
		//vec.push_back(x);
	}*/
	auto ans = st.begin();
	for(int i = 0; i < k; i++)
	   ans++;	
	cout << *ans << endl;
	//sort(vec.begin(), vec.end());
	//for(int i = 0; i < vec.size(); i++)
	//{
	//	cout << vec[i] << endl;
	//}
	//cout << vec[k] << endl;
}



Measured memory_bytes: 1664
A, B = map(int, input().split())

count = 0
for i in range(A, B+1):
    num = list(str(i))
    num_r = []
    for i in range(len(num)):
        num_r.append(num[-(i+1)])
    if num == num_r:
        count += 1
    else:
        continue

print(count)
        

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

string str,ans;

bool check(string s){
  int sum = (int)(s[0]-'0');
  for(int i = 0; i < s.size()-1; i++){
    if(s[i] == '+') sum += (int)(s[i+1]-'0');
    if(s[i] == '-') sum -= (int)(s[i+1]-'0');
  }
  if(sum == 7) return true;
  else return false;
}

int dfs(int i,string s){
  if(i == 3){
    s += str[3];
    if( check(s) ) ans = s + "=7";
  }
  else {
    dfs(i+1,s + str[i] + "+");
    dfs(i+1,s + str[i] + "-");
  }
}

signed main(){

  cin >> str;
  dfs(0,"");
  cout << ans << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
const ld pi = 4.0 * atanl(1.0);
const int iinf = 1e9 + 10;
const int inf = 1e18 + iinf + 10;
const int mod = 1000000007;
const ld prec = .000001;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()

int n, m, t, a[mxN];
vi v;

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

int main() {
  fast();
  cin >> n;
  set<int> s;
  s.insert(n);
  int ans = 0;
  int i = 1;
  while (true) {
    ++i;
    if (n % 2 == 0)
      n /= 2;
    else
      n = 3 * n + 1;
    if (s.find(n) != s.end()) {
      ans = i;
      break;
    } else
      s.insert(n);
  }
  cout << ans;

  return 0;
}



Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n, a;
	cin >> n >> a;
	vector<ll> x(n);
	for (ll i = 0; i < n; i++) {
		cin >> x[i];
		x[i] -= a;
	}

	vector<vector<ll>> dp(n, vector<ll>(5001, 0));
	dp[0][x[0] + 2500] = 1;
	for (ll i = 1; i < n; i++) {
		for (ll j = 0; j < 5001; j++) {
			if (dp[i - 1][j]) {
				dp[i][j] += dp[i - 1][j];
				dp[i][j + x[i]] += dp[i - 1][j];
			}
		}
		dp[i][x[i] + 2500]++;
	}
	cout << dp[n - 1][2500] << endl;
}


Measured memory_bytes: 2304
using System;
using System.Linq;
using System.Collections.Generic;
class c
{
    static void Main()
    {
        var nm = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        long ans = 1;
        var list = new List<long>();
        for (int i = 1; i <= Math.Sqrt(nm[1]); i++)
        {
            if (nm[1] % i == 0) list.Add(i);
        }
        for (int i = 0; i < list.Count(); i++)
        {
            if (nm[1] % list[i] == 0 && list[i] * nm[0] <= nm[1]) ans = Math.Max(ans, list[i]);
            if (nm[1] % (nm[1] / list[i]) == 0 && (nm[1] / list[i]) * nm[0] <= nm[1]) ans = Math.Max(ans, nm[1] / list[i]);
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13268
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(void) {
	int x, y;
	scanf("%d %d", &x, &y);
	int g0[] = {1, 3, 5, 7, 8, 10, 12};
	int g1[] = {4, 6, 9, 11};
	if (x == 2 && y == 2) {
		printf("Yes\n");
		return 0;
	}
	bool xflag = false, yflag = false;
	for (int i = 0; i < 7; i++) {
		if (g0[i] == x) xflag = true;
		if (g0[i] == y) yflag = true;
	}
	if (xflag && yflag) {
		printf("Yes\n");
		return 0;
	}
	xflag = false;
	yflag = false;
	for (int i = 0; i < 4; i++) {
		if (g1[i] == x) xflag = true;
		if (g1[i] == y) yflag = true;
	}
	if (xflag && yflag) {
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}


Measured memory_bytes: 3668
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

std::string s_max(const std::string& l, const std::string& r) {
  if (l.size() > r.size()) return l;
  return r;
}
std::string s_max_triple(const std::string& l1, const std::string& l2, const std::string& l3) {
  return (s_max(l1, s_max(l2, l3)));
}

int main(int argc, char** argv) {
  std::string S, T;
  std::cin >> S >> T;
  int S_size = S.size();
  int T_size = T.size();
  std::vector<std::vector<int>> dp(S_size, std::vector<int>(T_size, 0));

  bool is_find = false;
  for (auto i = 0;i < S_size;++i) {
    if (is_find == true) {
      dp[i][0] = 1;
    } else if (is_find == false && S[i] == T[0]) {
      dp[i][0] = 1;
      is_find = true;
    }
  }
  is_find = false;
  for (auto i = 0;i < T_size;++i) {
    if (is_find == true) {
      dp[0][i] = 1;
    } else if (is_find == false && S[0] == T[i]) {
      dp[0][i] = 1;
      is_find = true;
    } else {
      dp[0][i] = 0;
    }
  }
  for (auto i = 1;i < S_size;++i) {
    for (auto j = 1;j < T_size;++j) {
      if (S[i] == T[j]) dp[i][j] = dp[i-1][j-1] + 1;
      else dp[i][j] = std::max(dp[i][j-1], dp[i-1][j]);
    }
  }
  std::string answer {""};
  for (int x = S_size-1, y=T_size-1;x>=0 && y>=0;) {
    if (S[x] == T[y]) { // diag
      answer += S[x];
      --x; --y;
    } else if (x!=0 && dp[x][y] == dp[x-1][y]) { //line
        --x;
    } else { //column
        --y;
    }
  }
//  std::cout << answer << '\n';
  std::reverse(answer.begin(), answer.end());
  std::cout << answer << '\n';
//  for (const auto& e : dp) {
//    for (const auto& f : e) {
//      std::cout << f.size() << ' ';
//    }
//    std::cout << '\n';
//  }
}


Measured memory_bytes: 35584
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 1000;

const int INF = 1 << 30;
const int DD = 10;
const int PD = 50;

/* typedef */

typedef vector<int> vi;

template <typename T>
struct Pt {
  T x, y;

  Pt() {}
  Pt(T _x, T _y) : x(_x), y(_y) {}
  Pt(const Pt& pt) : x(pt.x), y(pt.y) {}

  bool operator==(const Pt pt) const { return x == pt.x && y == pt.y; }
  Pt<T> operator+(const Pt pt) const { return Pt<T>(x + pt.x, y + pt.y); }
  Pt<T> operator-() const { return Pt<T>(-x, -y); }
  Pt<T> operator-(const Pt pt) const { return Pt<T>(x - pt.x, y - pt.y); }
  Pt<T> operator*(T t) const { return Pt<T>(x * t, y * t); }
  Pt<T> operator/(T t) const { return Pt<T>(x / t, y / t); }
  T dot(Pt v) const { return x * v.x + y * v.y; }
  T cross(Pt v) const { return x * v.y - y * v.x; }
  Pt<T> mid(const Pt pt) { return Pt<T>((x + pt.x) / 2, (y + pt.y) / 2); }
  T d2() { return x * x + y * y; }
  double d() { return sqrt(d2()); }

  Pt<T> rot(double th) {
    double c = cos(th), s = sin(th);
    return Pt<T>(c * x - s * y, s * x + c * y);
  }

  Pt<T> rot90() { return Pt<T>(-y, x); }

  bool operator<(const Pt& pt) const {
    return x < pt.x || (x == pt.x && y < pt.y);
  }

  void print(string format) {
    printf(("(" + format + ", " + format + ")\n").c_str(), x, y);
  }
  void print() { print("%.6lf"); }
};

typedef Pt<int> pt;

/* global variables */

int n, x, y;
pt dr, pts[MAX_N];
vi nbrs[MAX_N];
int dists[MAX_N];
bool used[MAX_N];

/* subroutines */

/* main */

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

  while (tn--) {
    cin >> n >> x >> y;
    cin >> dr.x >> dr.y;
    for (int i = 0; i < n; i++) cin >> pts[i].x >> pts[i].y;

    for (int i = 0; i < n; i++) {
      dists[i] = -INF;
      nbrs[i].clear();
    }
    
    for (int i = 0; i < n; i++)
      for (int j = i + 1; j < n; j++)
	if ((pts[j] - pts[i]).d2() <= PD * PD) {
	  nbrs[i].push_back(j);
	  nbrs[j].push_back(i);
	}

    memset(used, false, sizeof(used));
    
    queue<int> q;
    for (int i = 0; i < n; i++)
      if ((pts[i] - dr).d2() <= DD * DD)
	q.push(i), dists[i] = x, used[i] = true;

    int max_d = 0;
    bool always = false;
    
    while (! q.empty()) {
      int u = q.front(); q.pop();
      int ud = dists[u];
      if (max_d < ud) max_d = ud;

      int nvd = ud + x;
      vi& nbru = nbrs[u];

      for (vi::iterator vit = nbru.begin(); vit != nbru.end(); vit++) {
	int& v = *vit;

	if (dists[v] < ud - y) {
	  if (used[v]) {
	    always = true;
	    break;
	  }

	  q.push(v);
	  dists[v] = nvd;
	  used[v] = true;
	}
      }

      if (always) break;
    }
    //cout << always << ' ' << max_d << endl;

    if (always)
      cout << "You're always welcome!" << endl;
    else
      cout << max_d << endl;
  }

  return 0;
}

Measured memory_bytes: 5340
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end() 
using namespace std;

typedef long long ll;

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

ll lcm(ll a, ll b) {
    a = a/gcd(a, b);
    return a*b;
}

int main() {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   ll a, b;
   cin >> a >> b;
   cout << lcm(a, b) << "\n";
   return 0;
} 


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<lint> a(N);
	for (int i = 0; i < N; i++) cin >> a[i];
	int max_idx = max_element(a.begin(), a.end()) - a.begin();
	int min_idx = min_element(a.begin(), a.end()) - a.begin();

	vector<pair<int, int>> ans;
	ans.reserve(2 * N);

	auto add_max = [&]() {		
		for (int i = 0; i < N - 1; i++) {
			int twice = 2;
			while (twice) {
				if (a[i] > a[i + 1]) {
					a[i + 1] += a[max_idx];
					ans.emplace_back(max_idx + 1, i + 1 + 1);
					if (a[i + 1] > a[max_idx]) max_idx = i + 1;
				}
				twice--;
			}
		}
	};

	auto add_min = [&]() {
		for (int i = N - 2; i >= 0; i--) {
			int twice = 2;
			while (twice) {
				if (a[i] > a[i + 1]) {
					a[i] += a[min_idx];
					ans.emplace_back(min_idx + 1, i + 1);
					if (a[i] < a[min_idx]) min_idx = i;
				}
				twice--;
			}
		}
	};

	if (a[min_idx] > 0) add_max();
	else if (a[max_idx] <= 0) add_min();
	else if (abs(a[max_idx]) > abs(a[min_idx])) add_max();
	else add_min();

	DMP(a);
	cout << ans.size() << "\n";
	for (const auto &e : ans) cout << e.first << " " << e.second << "\n";

	return 0;
}

Measured memory_bytes: 256
using System;
//using System.Collections.Generic;

public class TestC
{
    public static void Main(){
        string line = Console.ReadLine();
        string[] numbers = line.Split(' ');
        int sheep = int.Parse(numbers[0]);
        int wolves = int.Parse(numbers[1]); 

        if(sheep <= wolves) Console.WriteLine("unsafe");
        else Console.WriteLine("safe");
    }
}

Measured memory_bytes: 27536
/*A - Round One*/
#include <bits/stdc++.h>

using namespace std;

int main(){

	int pos;
	vector <int> arr(4);

	cin >> pos;
	arr[pos] = 1;
	cin >> pos;
	arr[pos] = 1;

	for (int i = 1; i < 4; ++i)
	 	if(arr[i] == 0)
	 		cout << i ;
	
	return 0;
}

Measured memory_bytes: 256
//AOJ 0567: Best Pizza
#include<iostream>
#include<algorithm>
using namespace std;
const int MAX_N = 100;
int n, a, b, c, ans, cal = 0, cost = 0, tcal[MAX_N];
int main(){
	cin >> n >> a >> b >> c;
	for (int i = 0; i < n; i++){
		cin >> tcal[i];
	}
	ans = c / a;
	cost = a;
	cal = c;
	sort(tcal, tcal + n);
	for (int i = n - 1; i >= 0; i--){
		if (ans < tcal[i] / b){
			cal += tcal[i];
			cost += b;
			ans = cal / cost;
		}
		else break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1176
#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 K;
    cin >> K;
    vector<bool> done(K + 2, false);
    
    ll tmp = 7;
    ll i = 1;
    while(true){
        if (done[i]){
            cout << -1 << endl;
            return 0;
        }
        if (tmp % K == 0){
            cout << i << endl;
            return 0;
        }
        done[i] = true;
        tmp = (10 * tmp + 7) % K;
        i++;
    }

    return 0;
}



Measured memory_bytes: 3228
# coding: utf-8
import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def IAI(LINE): return [ILI() for __ in range(LINE)]
def IDI(): return {key: value for key, value in ILI()}


def read():
    H, W, h, w = ILI()
    return H, W, h, w


def solve(H, W, h, w):
    if H % h == 0 and W % w == 0:
        return False, None
    else:
        matrix = [[10 ** 3] * W for __ in range(H)]
        val = - (h * w * 1000) + 999
        for _h in range(h - 1, H, h):
            for _w in range(w - 1, W, w):
                matrix[_h][_w] = val

    return True, matrix


def main():
    params = read()
    ans_bool, matrix = solve(*params)
    if ans_bool:
        print("Yes")
        for row in matrix:
            print(" ".join(map(str, row)))
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 7536
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  int a[m],b[m];
  int cnt[n] = {0};
  for(int i=0; i<m; i++){
    cin >> a[i] >> b[i];
    cnt[a[i]-1]++;
    cnt[b[i]-1]++;
  }
  for(int i=0; i<n; i++){
    cout << cnt[i] << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>

using namespace std;

bool res() {
	int n;
	cin >> n;
	if (!cin) return false;

	cout << 3 * n * n << '\n';

	return true;
}

int main() {
	while (res()) {}
	return 0;
}

Measured memory_bytes: 256
fun main() {
    val n = readLine()!!.toInt()
    val s = mutableListOf<String>()
    for (i in 0 until n) {
        s.add(readLine()!!)
    }
    var maxNum: Int? = null
    s.groupingBy { it }.eachCount().toList().sortedBy { it.first }.sortedByDescending { it.second }.forEach {
        if (maxNum != null && maxNum != it.second) {
            return@forEach
        }
        println(it.first)
        maxNum = it.second
    }
}

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

int main() {
  long A, B, C, K;
  cin >> A >> B >> C >> K;

  if(K<A) cout << K << endl;
  else if(K <= A+B) cout << A << endl;
  else cout << A-(K-(A+B)) << endl;

}


Measured memory_bytes: 3620
#include <stdio.h>
#include <math.h>

int main(void) {
  int i = 0;
  int score[10001], student;
  int sum;
  double sum_2;
  double dispersion, ave;

  while (1) {
    sum = 0;
    sum_2 = 0;
    ave = 0;

    scanf("%d", &student);

    if (student == 0) {
      break;
    } else {
      for (i = 0; i < student; i++) {
        scanf("%d", &score[i]);
        sum += score[i];
      }
      ave = (double) sum / student;

      for (i = 0; i < student; i++) {
        sum_2 += (score[i] - ave) * (score[i] - ave);
      }

      dispersion = sqrt(sum_2 / student);

      printf("%lf\n", dispersion);
    }
  }
  return 0;
}



Measured memory_bytes: 2140
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
  a = list(map(int, input().split()))
  t = c
  for j in range(m):
    t += a[j]*b[j]
  if t>0:
    ans += 1
print(ans)

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

#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)

int main() {
  int D;
  cin >> D;
  if(D == 25) {
    cout << "Christmas" << endl;
  } else if(D == 24) {
    cout << "Christmas Eve" << endl;
  } else if(D == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else if(D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}



int main() {
	int a, b, c,d; cin >> a>>b>>c>>d;
	//string s,t,u; cin >> s>>t>>u;
	//vector<int> n(3);
	if (a >= b) {
		cout << b * c + (a - b) * d;
	}
	else {
		cout << a * c;
	}
	

	cout << endl;
	return 0;
}


Measured memory_bytes: 256