akhauriyash/Code-Regression huggingface dataset:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

import itertools as it

N, M = two_int()

AC_dicts={}
WA_dicts={}

for i in range(M):
    p, s = input().split()
    
    if p in AC_dicts:
        continue
    
    if s =="AC":
        AC_dicts[p] = 1
        continue
    
    if p not in WA_dicts:
        WA_dicts[p] = 1
    else:
        WA_dicts[p] += 1

wa_sums = 0
for k in AC_dicts.keys():
    if k in WA_dicts:
        wa_sums += WA_dicts[k]



ac_sums = 0
for k,v in AC_dicts.items():
    ac_sums += v


print(str(ac_sums) +" " + str(wa_sums) )

Measured memory_bytes: 17236
#include<iostream>
int main()
{
	bool exist[4][13];
	for(int i = 0; i < 4; i++)
	{
		for(int j = 0; j < 13; j++)
		{
			exist[i][j] = false;
		}
	}
	int number;
	std::cin >> number;
	for(int i = 0; i < number; i++)
	{
		char suit;
		int num;
		std::cin >> suit >> num;
		int index;
		switch(suit)
		{
			case 'S':
				index = 0;
				break;
			case 'H':
				index = 1;
				break;
			case 'C':
				index = 2;
				break;
			case 'D':
				index = 3;
				break;
		}
		exist[index][num - 1] = true;
	}
	for(int i = 0; i < 4; i++)
	{
		for(int j = 0; j < 13; j++)
		{
			if(!exist[i][j])
			{
				std::cout << "SHCD"[i] << ' ' << j + 1 << std::endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3100
import math

n = int(input())
aL = list(map(int, input().split(" ")))

d1 = {}
d2 = {}
for i in range(n):
    d1i = i - aL[i]
    d2i = i + aL[i]

    if d1i in d1:
        d1[d1i] += 1
    else:
        d1[d1i] = 1

    if d2i in d2:
        d2[d2i] += 1
    else:
        d2[d2i] = 1

ans = 0
for k, v in d2.items():
    if k in d1:
        ans += v * d1[k]

print(ans)

Measured memory_bytes: 57596
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = 2 * pow(10, 9) + 1;//+1しないとREになるかも(out of rangeになるんかな?? )

vector<int> dx = { -1, 0, 1, 0, -1, -1, 1, 1 };
vector<int> dy = { 0, -1, 0, 1, -1, 1, -1, 1 };

ll max_num(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a < b) ? a : b; }


int main(void) {
	int N;
	cin >> N;
	vector<string> S(N);
	for (int i = 0; i < N; i++) {
		cin >> S[i];

	}

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

	/*
	for (int i = 0; i < N; i++) cout << S[i] << endl;
	cout << "^-----------------------" << endl;
	*/

	//string tmp = S[0];
	int max_num = 1;
	int count = 1;
	for (int i = 1; i < N; i++) {
		if (S[i - 1] == S[i] && S[i - 1].size() == S[i].size())count++;
		else count = 1;
		max_num = max(max_num, count);
	}

	vector<string> ans(N);
	count = 1;
	int num_ans = 0;
	if (max_num == 1) {
		ans[0] = S[num_ans];
		num_ans++;
	}
	for (int i = 1; i < N; i++) {
		if (S[i - 1] == S[i] && S[i-1].size() == S[i].size()) count++;
		else count = 1;

		if (count == max_num) {
			ans[num_ans] = S[i];
			num_ans++;
		}
	}

	/*
	cout << " max_num: " << max_num << endl;
	for (int i = 0; i < N; i++) cout << S[i] << endl;
	cout << "^-----------------------" << endl;
	for (int i = 0; i < N; i++) cout << ans[i] << endl;
	cout << "^---ans--------------------num_ans: "<< num_ans << endl;
	for (int i = 0; i < N; i++) {
		cout << " i: " << i << " S[i]: " << S[i] << " size: " << S[i].size() << endl;
	}*/

	sort(ans.begin(), ans.end());
	
	/*
	for (int i = 0; i < num_ans; i++) {
		cout << ans[i] << endl;
	}
	*/

	for (int i = 0; i < N; i++) {
		if (ans[i] == "")continue;
		cout << ans[i] << endl;
	}

}


Measured memory_bytes: 15872
#include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
#include <math.h>
#include <iterator>
#include <iomanip>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <deque>
#include <vector>
#include <cstring>
#include <string>
#include <string.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <functional>
#include <stack>
#define fore(i,a,b) for(ll i = (a),_b = (b);i < (_b); i++)
#define fort(i,a,b) for(ll i = (a),_b = (b);i <= (_b); i++)
#define ford(i,a,b) for(ll i = (a),_b = (b);i >= (_b); i--)
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define sz(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//#define LOCAL
using namespace std;

typedef long long ll;

const ll maxN = 1e5 + 5;

ll n;
ll h[maxN],dp[maxN];

int main(){
    #ifdef LOCAL
        freopen("a.INP","r",stdin);
    #endif // LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    fort(i,1,n)
        cin >> h[i];
    dp[n] = 0;
    dp[n - 1] = abs(h[n] - h[n - 1]);
    ford(i,n - 2,1)
        dp[i] = min(dp[i + 1] + abs(h[i] - h[i + 1]),
                    dp[i + 2] + abs(h[i] - h[i + 2]));
    cout << dp[1] << '\n';
    return 0;
}


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

using namespace std;

const int MAX = 1e6;
const int INF = 2e9;
typedef long long ll;


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

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

    swap(x, y);
    swap(x, z);

    cout << x << " " << y << " " << z;

    return 0;
}


Measured memory_bytes: 256
import math
n, d = map(int, input().split())
l = []
for i in range(n):
    l.append(list(map(int, input().split())))
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        sum  = 0
        if i != j:
            for k in range(d):
                sum += (l[i][k] -l[j][k]) ** 2
            dis = math.sqrt(sum)
            if dis % 1 == 0:
                ans += 1
print(ans)

Measured memory_bytes: 9140
import sys
input = sys.stdin.readline

N, Ma, Mb = map(int, input().split())
dp = [[[10**18]*(10*N+1) for _ in range(10*N+1)] for _ in range(N+1)]
dp[0][0][0] = 0

for i in range(N):
    a, b, c = map(int, input().split())
    
    for j in range(10*N+1):
        for k in range(10*N+1):
            dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
            
            if j+a<=10*N and k+b<=10*N:
                dp[i+1][j+a][k+b] = min(dp[i+1][j+a][k+b], dp[i][j][k]+c)
            
ans = 10**18

for i in range(10*N+1):
    for j in range(10*N+1):
        if i!=0 and j!=0 and i*Mb==j*Ma:
            ans = min(ans, dp[N][i][j])

if ans==10**18:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 127220
#include<bits/stdc++.h>
using namespace std;
#include<string>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
const ll mod=1e9+7;

bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}


void solve(){

    string s;
    cin>>s;
    ll n= s.length();

    ll subn= ((n-1)/2) -1;
    ll i=0;
    while(i<subn){
        if(s[i++]!=s[subn--]){
            cout<<"No";
            return;
        }
    }
     subn= ((n-1)/2) -1;
    string a= s.substr(0,subn+1);
    string b= s.substr(subn+1, n-1);
   // cout<<a<<" "<<b;
    if(subsequence_checker(a,b,a.length(),b.length())){
        cout<<"Yes";
    }   
    else
        cout<<"No";
    
    return;
}
int main()
{
    IOS;
    ll t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
 
    return 0;
}       

Measured memory_bytes: 256
using System;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            string b = Console.ReadLine();
            string a;
            if (b == "A") { a = "T"; }
            else if (b == "T") { a = "A"; }
            else if (b == "C") { a = "G"; }
            else { a = "C"; }
            Console.Write(a);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
    std::ios::sync_with_stdio(false);
    ll n;
    while (cin>>n) {
        int sum=0;
        ll x=n;
        while (n>0) {
            sum+=n%10;
            n/=10;
        }
        if (x%sum==0) {
            cout<<"Yes"<<endl;
        }
        else
            cout<<"No"<<endl;
    }
    
    
   
    
    return 0;
}

Measured memory_bytes: 256
class Program
{
    static void Main(string[] args)
    {
        string[] temp = System.Console.ReadLine().Split(' ');
        int A = int.Parse(temp[0]);
        int B = int.Parse(temp[1]);
        int C = int.Parse(temp[2]);
        if (B / A > C) { System.Console.WriteLine(C); }
        else { System.Console.WriteLine(B/A); }
    }
}


Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Read();
            if (int.Parse(n) % 10 != 0)
            {
                var a = n.ToString().Count();
                var ans = 0;
                for (int i = 0; i < a; i++)
                {
                    ans += int.Parse(n[i].ToString());
                }
                WriteLine(ans);
            }
            else
            {
                WriteLine(10);
            }
        }
        

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数
        
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}


Measured memory_bytes: 11220
N=int(input())
csf=[list(map(int,input().split()))for _ in range(N-1)]
i=0
while i<N:
    ans=0
    j=i
    while j<N-1:
        c,s,f=list(csf[j])
        ans=max(ans,s)
        if ans%f:
            ans+=f-ans%f
        ans+=c
        j+=1
    print(ans)
    i+=1

Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  int cnt = 0;
  double lim = total / (4.0 * m);
  
  for (auto itr : a) {
    if (itr >= lim) {
      cnt ++;
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<ll> bit(50,0);
    vector<ll> bitk(50,0);
    vector<ll> delta0(50,0);
    vector<ll> delta1(50,0);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 50; j++){
            if((a[i]>>j)&1){bit[j]++;}
        }
    }
    for(int j = 0; j < 50; j++){
        if((k>>j)&1){bitk[j]++;}
    }
    for(int i = 0; i < 50; i++){
        delta0[i] = (bit[i])*(1LL<<i);
        delta1[i] = (n-bit[i])*(1LL<<i);
        bit[i] = (bit[i] < n-bit[i]) ? 1 : 0;
    }
    reverse(all(bit));
    reverse(all(bitk));
    reverse(all(delta0));
    reverse(all(delta1));
    vector<vector<ll>> dp(51,vector<ll>(2,-1));
    dp[0][0] = 0;
    for(int i = 0; i < 50; i++){
        if(dp[i][1] != -1){
            dp[i+1][1] = max(dp[i+1][1], dp[i][1] + max(delta0[i], delta1[i]));
        }
        if(dp[i][0] != -1){
            if(bitk[i]){
                dp[i+1][1] = max(dp[i+1][1],dp[i][0] + delta0[i]);
            }
        }
        if(dp[i][0] != -1){
            if(bitk[i]){
                dp[i+1][0] = max(dp[i+1][0], dp[i][0]+delta1[i]);
            }else{
                dp[i+1][0] = max(dp[i+1][0], dp[i][0]+delta0[i]);
            }
        }

    }

    cout << max(dp[50][0], dp[50][1]) << endl;

    return 0;
}


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

int f(int x,int y){
	if(x<y)return false;
	return true;
}

int main(){
	int n,a,b,c,d,ans[102]={0},max_ans=n;
	vector<int> vi;
	scanf("%d%d%d%d",&n,&a,&b,&c);
	for(int i=0;i<n;i++){
		scanf("%d",&d);
		vi.push_back(d);
	}
	sort(vi.begin(),vi.end(),f);
	ans[0]=c/a;
	for(int i=0;i<n;i++){
		c+=vi[i];
		a+=b;
		ans[i+1]=c/a;
		if(ans[i+1]<ans[i]){max_ans=i; break;}
	}
	printf("%d\n",ans[max_ans]);
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int memo[500000];
void solve(std::string S){
    S += '<';
    REP(i, S.size()) {
        if(S[i] == '<') {
            memo[i] = 0;
            int cnt = 1;
            RREP(j, i-1) {
                if(S[j] == '>') {
                    memo[j] = max(memo[j], cnt);
                    cnt++;
                } else {
                    break;
                }
            }
            cnt = 1;
            for(; i<S.size(); i++) {
                if(S[i] == '<') {
                    memo[i+1] = cnt;
                    cnt++;
                } else {
                    break;
                }
            }
        }
    }

    LL ans = 0;
    REP(i, S.size()) {
        ans += memo[i];
    }

    cout << ans << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;
#define int long long
#define pii pair <int , int>
#define F first
#define S second
#define X first
#define V second
const int N = 2e5 + 5, inf = 1e9 + 1, MOD = 1e9 + 7;
int dp[N], s[N], mx[N], mn[N], seg[N<<2], n;
pii P[N];

int sum(int a, int b) {return a + b - (a + b >= MOD ? MOD : 0);}
void Set(int p, int val, int L = 1, int R = n + 1, int id = 1) {
    if (R - L == 1) {seg[id] = val; return ;}
    int mid = (L+R)>>1;
    if (p < mid) Set(p, val, L, mid, id<<1);
    else Set(p, val, mid, R, id<<1|1);
    seg[id] = max(seg[id<<1], seg[id<<1|1]);
    return ;
}
int Get(int l, int r, int L = 1, int R = n + 1, int id = 1) {
    if (r <= L || R <= l) return 0;
    if (l <= L && R <= r) return seg[id];
    int mid = (L+R)>>1;
    return max(Get(l, r, L, mid, id<<1), Get(l, r, mid, R, id<<1|1));
}

int32_t main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> P[i].X >> P[i].V;
    sort(P + 1, P + n + 1);
    for (int i = 1; i <= n; i++) mx[i] = max(mx[i - 1], P[i].V);
    mn[n + 1] = inf;
    for (int i = n; i >= 1; i--) mn[i] = min(mn[i + 1], P[i].V);
    int* ps = s + 1;
    ps[-1] = 0, ps[0] = dp[0] = 1;
    priority_queue <pii, vector<pii>, greater<pii>> pq;
    for (int i = 1; i <= n; i++) {
        while (!pq.empty() && pq.top().F <= mn[i]) Set(pq.top().S, pq.top().F), pq.pop();
        int dw = -1, up = i - 1;
        if (Get(1, i) == 0) up = 0;
        while (up - dw > 1) {
            int md = (up+dw)>>1;
            if (mx[md] > Get(md + 1, i)) up = md;
            else dw = md;
        }
        dp[i] = sum(ps[i - 1], MOD - ps[up - 1]);
        ps[i] = sum(ps[i - 1], dp[i]);
        pq.push({P[i].V, i});
    }
    int ans = 0, Max = 0;
    for (int i = n; i >= 1; i--) {
        if (mx[i] > Max) ans = sum(ans, dp[i]);
        Max = max(Max, P[i].V);
    }
    cout << ans << "\n";

    return 0;
}


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

int main() {
   ios_base::sync_with_stdio(false);
   int n, m; cin >> n >> m;
   string s; cin >> s;
   vector<int> a(n);
   for (int i = 0; i < n; ++i) a[i] = s[i] - 'A';
   vector<vector<int>> g(n);
   vector<vector<int>> deg(n, vector<int>(2, 0));
   for (int i = 0; i < m; ++i) {
      int u, v; cin >> u >> v; u--, v--;
      deg[u][a[v]]++;
      deg[v][a[u]]++;
      g[u].push_back(v);
      g[v].push_back(u);
   }
   vector<int> was(n, 0);
   vector<int> q;
   for (int i = 0; i < n; ++i) {
      if (deg[i][0] == 0 || deg[i][1] == 0) {
         was[i] = 1;
         q.push_back(i);
      }
   }
   for (int i = 0; i < q.size(); ++i) {
      int u = q[i];
      for (int v : g[u]) {
         deg[v][a[u]]--;
         if (deg[v][0] == 0 || deg[v][1] == 0) {
            if (was[v] == 0) {
               was[v] = 1;
               q.push_back(v);
            }
         }
      }
   }
   cout << (q.size() == n ? "No" : "Yes") << '\n';
}


Measured memory_bytes: 23244
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    int h, w;
    cin >> h >> w;
    vector<string> A;
    vector<vector<int>> B(h, vector<int>(w, 0));
    REP(i, h){
        string s;
        cin >> s;
        A.pb(s);
    }

    REP(i, h){
        REP(j, w){
            if(A[i][j] == '#'){
                REP(k, 9){
                    int nx = i + dx[k];
                    int ny = j + dy[k];
                    if(nx<0 || h<=nx){
                        continue;
                    }
                    if(ny<0 || w<=ny){
                        continue;
                    }
                    B[nx][ny]++;
                }
            }
        }
    }

    REP(i, h){
        REP(j, w){
            if(A[i][j] == '#') cout << '#';
            else cout << B[i][j];
        }
        cout << endl;
    }

}

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

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

#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

void Main()
{
   u_int N;
   cin >> N;

   vector<int> F(N);
   int a;
   bitset<10> f;
   f.set();

   REP(i, 0, N - 1)
   {
      f.set();
      REP(j, 0, 9)
      {
         cin >> a;
         if (a == 0)
            f.flip(j);
      }
      F[i] = f.to_ulong();
   }

   int P[N][11];
   REP(i, 0, N - 1)
   {
      REP(j, 0, 10)
      {
         cin >> P[i][j];
      }
   }

   ll ans = LONG_MIN;
   ll money = 0;
   bitset<10> same;
   REP(date, 1, (1LL << 10) - 1)
   {
      money = 0;
      REP(i, 0, N - 1)
      {
         same = (bitset<10>)(F[i] & date);
         money += P[i][same.count()];
      }
      ans = max(money, ans);
   }

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

int main()
{
   std::cin.tie(nullptr);
   std::ios_base::sync_with_stdio(false);
   std::cout << std::fixed << std::setprecision(15);
   Main();
   return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#define NMAX 100005

using namespace std;

int dp[NMAX];
int h[NMAX];
int n, k;

int main()
{
    scanf("%d %d",&n, &k);
    for (int i=1;i<=n;++i)
    {
        scanf("%d",&h[i]);
    }
    for (int i=2;i<=n;++i)
    {
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        for (int j=i-1, pas =1;j>=1 && pas<=k;++pas,--j)
        {
            int v = dp[j] + abs(h[i] - h[j]);
            dp[i] = min(dp[i], v);
        }
    }
    printf("%d\n", dp[n]);
    return 0;
}


Measured memory_bytes: 896
inputEnzan=input().split()

def keisan(inputEnzan):
    while True:
        stockFornumber=[]
        index=0
        length=len(inputEnzan)
        if length==1:
            break
        while index<length:
            if inputEnzan[index]=="+" or inputEnzan[index]=="-" or inputEnzan[index]=="*":
                if len(stockFornumber)==2:
                    if inputEnzan[index]=="+":
                        inputEnzan[index]=stockFornumber[0]+stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    elif inputEnzan[index]=="-":
                        inputEnzan[index]=stockFornumber[0]-stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"

                    else:
                        inputEnzan[index]=stockFornumber[0]*stockFornumber[1]
                        stockFornumber=[]
                        inputEnzan[index-1]="null"
                        inputEnzan[index-2]="null"
                else:
                    stockFornumber=[]
                    pass

            else:
                if len(stockFornumber)==2:
                    del stockFornumber[0]
                stockFornumber.append(int(inputEnzan[index]))
                    
            index+=1

        while "null" in inputEnzan:
            inputEnzan.remove("null")

    print(inputEnzan[0])

keisan(inputEnzan)  


Measured memory_bytes: 5612
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    ll n, k; cin >> n >> k;

    ll h[n];
    rep(i, n){
        cin >> h[i];
    }

    if(k >= n){
        cout << 0 << endl;
        return 0;
    }

    sort(h, h+n, greater<ll>());

    ll ans = accumulate(h+k, h+n, 0LL);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m]<=x;l=m;else;r=m;end;end;l;end

function main()
	x = ["hi","hihi","hihihi","hihihihi","hihihihihi"]
	s = readline() |> chomp
	println(s in x?"Yes":"No")
end

main()

Measured memory_bytes: 166944
#include <bits/stdc++.h>
#define ll long long
/*#define INF 2147483647
#define mem_INF 2139062143
#define ll_INF 9223372036854775807
#define eps 1e-8
#define fuckrand() ( ( rand() << 15 ) ^ rand() )*/
using namespace std;
inline int read() {
	int x = 0,tmp = 1;char ch = getchar();
	while( ch < '0' || ch > '9' ) {if ( ch == '-' ) tmp = -1; ch = getchar();}
	while( ch >= '0' && ch <= '9'){x = x * 10 + ch - '0'; ch = getchar(); }
	return x * tmp;
}
inline ll readll() {
	ll x = 0,tmp = 1;char ch = getchar();
	while( ch < '0' || ch > '9' ) {if ( ch == '-' ) tmp = -1; ch = getchar();}
	while( ch >= '0' && ch <= '9'){x = x * 10 + ch - '0'; ch = getchar(); }
	return x * tmp;
}
int main() {
	int T = read(), N;
	for( int i = 1 ; ; ++ i )
		if( ( i * ( i + 1 ) >> 1 ) >= T ) {
			N = i; break;
		}
	int tot = N * ( N + 1 ) >> 1; 
	for( int i = 1 ; i <= N - tot + T ; ++ i ) putchar( ')' );
	putchar( '(' );
	for( int i = 1 ; i <= tot - T ; ++ i ) putchar( ')' );
	for( int i = 1 ; i < N ; ++ i ) putchar( '(' );
	putchar( '\n' );
	return 0; 
}

Measured memory_bytes: 3092
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String topping = sc.next();
    String[] li = topping.split("");
    int extra = 0;
    for(int i=0;i<li.length;i++){
      if(li[i].equals("o")){
        extra += 100;
      }
    }
    System.out.println(700+extra);
  }
}

Measured memory_bytes: 21332
import bisect
import heapq
import numpy as np
N, M = map(int,input().split())
a = list(map(int,input().split()))
a = list((np.array(a))*(-1))
heapq.heapify(a)
for m in range(M):
    tgt = -heapq.heappop(a)
    heapq.heappush(a,-(tgt//2))
res = 0
for n in range(N):
    res += int(heapq.heappop(a))
print(-res)


Measured memory_bytes: 23128
# import math
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np


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

if a < k and b > k-a:
    print(0,a+b-k)
elif a >= k:
    print(a-k,b)
else: print(0,0)

Measured memory_bytes: 3060
N = int(input())
U = sorted(map(int, input().split()))


def saiki(n):
    m = ((n[0] + n[1]) / 2)
    n.pop(0)
    n.pop(0)
    n.insert(0, m)
    if (len(n) == 1):
        print(n[0])
        exit()
    saiki(n)


print(saiki(U))


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

vector<vector<long long>> comb(int n, int r) { // nCr = comb(n,r).at(n).at(r)
  vector<vector<long long>> v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main(){
    int N, M;
    cin >> N >> M;
    if(N > 1){
        if(M > 1){
            cout << comb(N,2).at(N).at(2) + comb(M,2).at(M).at(2) << endl;
        }
        else{
            cout << comb(N,2).at(N).at(2) << endl;
        }
    }
    else{
        if(M > 1){
            cout << comb(M,2).at(M).at(2) << endl;
        }
        else{
            cout << 0 << endl;
        }
    }
}

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

using namespace std;

double x[9], y[9], t;
int f[9] = {1,1,2,6,24,120,720,5040,40320};

void go(int v, int msk, int n, double d) {
    msk |= (1<<v);
    if(msk == (1<<n)-1) t += d;
    for(int i=0;i<n;i++) {
        if(!((1<<i)&msk)) go(i,msk,n,d+hypot(x[v]-x[i],y[v]-y[i]));
    }
}

int main() {
    int n;
    cin >> n;
    for(int i=0;i<n;i++) cin >> x[i] >> y[i];
    for(int i=0;i<n;i++) go(i, 0, n,0);
    printf("%.10lf\n", t/f[n]);
    return 0;
}


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

using namespace std;

int n;
string s;

#define INF (1<<30)

int dp[200001][3];

int dfs(int d, int before){
	// cout << d << " " << before << endl;
	if(d == n)return 0;
	int ans = INF;
	if(before == 0){//白
		if(s[d] == '#'){//今が黒
			ans = min(ans, dfs(d+1, 0)+1);//白に変更
		}
		ans = min(ans, dfs(d+1, s[d]=='#'?1:0));//そのまま
	}
	if(before == 1){//黒
		if(s[d] == '.'){//今が白
			ans = min(ans, dfs(d+1, 1)+1);//黒に変更
		}else{//今が黒
			ans = min(ans, dfs(d+1, 1));//そのままで黒にする
		}
	}
	if(before == 2){//最初不明
		if(s[d] == '#'){//今が黒
			ans = min(ans, dfs(d+1, 1));//黒のまま
			ans = min(ans, dfs(d+1, 0)+1);//白に変更
		}else{//今が白
			ans = min(ans, dfs(d+1, 0));//白のまま
			ans = min(ans, dfs(d+1, 1)+1);//黒に変更
		}
	}
	return ans;
}

int main(){
	cin >> n >> s;
	// s = "";
	// for(int i = 0;i < 10;i++){
	// 	if(i%2 == 0){
	// 		s.push_back('#');
	// 	}else{
	// 		s.push_back('.');
	// 	}
		
	// }
	// n = s.length();
	// cout << s << endl;

	
	fill_n(*dp,200001*3,INF);
	for(int d = n; d != -1; d--){
		for(int before = 0;before < 3;before++){
			if(d == n){
				dp[d][before] = 0;
			}else{
				if(before == 0){//白
					if(s[d] == '#'){//今が黒
						dp[d][before] = min(dp[d][before], dp[d+1][0]+1);//白に変更
						dp[d][before] = min(dp[d][before], dp[d+1][1]);//黒でいく
					}else{//今が白
						dp[d][before] = min(dp[d][before], dp[d+1][0]);//白のまま
						dp[d][before] = min(dp[d][before], dp[d+1][1]+1);//黒に変更
					}
				}
				if(before == 1){//黒
					if(s[d] == '.'){//今が白
						dp[d][before] = min(dp[d][before], dp[d+1][1]+1);//黒に変更
					}else{//今が黒
						dp[d][before] = min(dp[d][before], dp[d+1][1]);//そのままで黒にする
					}
				}
				if(before == 2){//最初不明
					if(s[d] == '#'){//今が黒
						dp[d][before] = min(dp[d][before], dp[d+1][1]);//黒のまま
						dp[d][before] = min(dp[d][before], dp[d+1][0]+1);//白に変更
					}else{//今が白
						dp[d][before] = min(dp[d][before], dp[d+1][0]);//白のまま
						dp[d][before] = min(dp[d][before], dp[d+1][1]+1);//黒に変更
					}
				}
			}
			// cout << d << " " << before << " " << dp[d][before] << endl;
		}
	}
	cout << dp[0][2] << endl;
	// cout << dfs(0,2) << endl;
}

Measured memory_bytes: 2948
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int N=15;

int n, m, k, u, v, x, y, t, a, b, ans;
int dp[1<<N];
int adj[N];
int tav[150];

inline void fix(int &x){
	if (x>=mod) x-=mod;
	if (x<0) x+=mod;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	tav[0]=1;
	for (int i=1; i<150; ++i) fix(tav[i]=2*tav[i-1]);
	cin>>n>>m;
	for (int i=0; i<m; i++){
		cin>>u>>v;
		u--;
		v--;
		adj[u]|=(1<<v);
	}
	dp[0]=1;
	for (int mask=2; mask<(1<<n); mask+=2){
		for (int sub=mask; sub; sub=(sub-1)&mask){
			int X=mask|(mask>>1&1), Y=sub|(sub>>1&1);
			X^=Y;
			ll z=1, t=0;
			for (int v=0; v<n; v++) if (X&(1<<v)){
				int ted=__builtin_popcount(adj[v]&Y);
				z=z*(tav[ted]-1)%mod;
			}
			for (int v=0; v<n; v++) if (Y&(1<<v))
				t+=__builtin_popcount(adj[v]&X);
		
			z=z*tav[t]%mod;
//			cerr<<X<<" "<<Y<<"  "<<z<<"\n";
			dp[mask]=(dp[mask] + z*dp[mask^sub])%mod;
		}
//		cerr<<"dp["<<(mask|(mask>>1&1))<<"]="<<dp[mask]<<"\n";
	}
	fix(ans=tav[m]-dp[(1<<n)-2]);
	cout<<ans<<"\n";
	
	return 0;
}
/*
4 6
1 2
1 3
1 4
2 3
2 4
3 4

*/

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);(i)++)
using namespace std;

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

  string res;
  if (A[A.length() - 1] == B[0] &&
      B[B.length() - 1] == C[0])
    res = "YES";
  else res = "NO";

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque


def enqueue(vtx: int, prev_vtx: int, search_queue: deque, vertices: dict, depth):
    #print(vtx,prev_vtx,search_queue,vertices,depth)
    search_queue.append(vtx)
    [val.remove(vtx) for val in vertices.values() if vtx in val]
    depth[vtx] = depth[prev_vtx] + 1

def main():
    n = int(input())
    lines = sys.stdin.readlines()
    vertices = {}
    for i in range(n):
        idx, idx_n, *idx_vertices = lines[i].rstrip().split()
        vertices[int(idx)] = [int(x) for x in idx_vertices]

    search_queue = deque()
    depth = {'start': -1}
    enqueue(1, 'start', search_queue, vertices, depth)
    del depth['start']

    while len(search_queue) != 0:
        vtx = search_queue.popleft()
        for n_vtx in vertices[vtx][:]:
            depth[n_vtx] = 0
            enqueue(n_vtx, vtx, search_queue, vertices, depth)
        del vertices[vtx]

    for key in vertices.keys():
        depth[key] = -1

    for key, val in sorted(depth.items(), key=lambda x: x[0]):
        print(key, val)

main()


Measured memory_bytes: 6036
#include <stdio.h>
int main(void){
char a[6],b[6],c;
int a1,b1,a2,b2,aa,ba;
scanf("%s%c%s",a,&c,b);
a1=((int)a[3]-48)*10+(int)a[4]-48;
a2=((int)a[1]-48)*10+(int)a[0]-48;
b1=((int)b[3]-48)*10+(int)b[4]-48;
b2=((int)b[1]-48)*10+(int)b[0]-48;
aa=((int)a[0]-48)*100+((int)a[1]-48)*10+(int)a[2]-48;
aa+=(a1>a2)? 1:0;
ba=((int)b[0]-48)*100+((int)b[1]-48)*10+(int)b[2]-48;
ba+=(b1>=b2)? 0:-1;
printf("%d",ba-aa+1);
return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
const ll mod=1e9+7;
const int maxn=2e5+50;
using namespace std;
int binaryExponentiation(int x,int n)
{
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
    }
    return result;
}
int main()
//int found; found=chaine.find(cara); if (found!=std::string::npos) how to verify if a caracter exists in a chaine
// toupper(caractere) ==> return the majuscule of a caractere
//floor(x) Returns the largest integer smaller than x
//ceil(x) returns  Returns the smallest integer greater
{

  
    int n,m;
    cin>>n>>m;
    cout<<(n*(n-1))/2+(m*(m-1)/2);
    
}



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


vector<int> insertionSort(vector<int> A, int N){
    for(int i=1; i<N;i++){
        int j= i-1;
        int v = A.at(i);
        while (j>=0 && A.at(j)>v){
            A.at(j+1) = A.at(j);
            j--;
        }
        A[j+1] = v;
        for (int k=0; k<N; k++) {
            cout << A.at(k);
            if (k==N-1) break;
            cout << ' ';
        }
        cout << endl;
    }
    return A;
}

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0; i<N; i++) cin >> A.at(i);
    for (int k=0; k<N; k++) {
            cout << A.at(k);
            if (k==N-1) break;
            cout << ' ';
        }
    cout << endl;
    vector<int> A_sorted = insertionSort(A, N);
    return 0;
}


Measured memory_bytes: 3152
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s, t;
    int a[200005][26] = {}, n, m;
    ll z = 0;
    cin >> s >> t;
    n = (int)s.length(), m = (int)t.length();
    s += s;
    for (int i = 0; i <= n + n; i++) for (int j = 0; j < 26; j++) a[i][j] = mod;
    for (int i = 0; i < n + n; i++) a[i][s[i] - 'a'] = 1;
    for (int i = n + n - 1; i >= 0; i--) for (int j = 0; j < 26; j++) a[i][j] = min(a[i][j], a[i + 1][j] + 1);
    //for (int i = 0; i <= n; i++) for (int j = 0; j < 3; j++) cout << a[i][j] << " \n"[j == 2];
    for (int i = 0; i < m; i++) {
        if (a[z % n][t[i] - 'a'] == mod) {
            cout << -1;
            return 0;
        }
        z += a[z % n][t[i] - 'a'];
    }
    cout << z;
}


Measured memory_bytes: 24096
#![allow(unused_macros, unused_imports, dead_code)]
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty), +) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

fn main() {
    from_line!(r: f64);
    let pi = 3.1415926535890426;
    println!("{:.6} {:.6}", r*r*pi, 2.0*r*pi);
}



Measured memory_bytes: 5060
using System;
using System.Linq;
public class Solve{
 
	static void Main(string[] args){
    	
      	var probrem = int.Parse(Console.ReadLine().Split(' ')[1]);
        var items = Console.ReadLine().Split(' ').Select(x => int.Parse(x));

        Console.WriteLine(items.OrderBy(x => x).Take(probrem).Sum());
    
    }
}

Measured memory_bytes: 28564
#include <iostream>
#include <vector>
#include <queue>


struct Node {
    int idx;
    std::vector<std::pair<int, int>> links;
};


int dfs(int current, int prev, int cost, const std::vector<Node> nodes) {
    if (nodes[current].links.size() == 1 && nodes[current].links[0].first == prev) {
        return cost;
    }
    int max_cost = cost;
    for (auto && link : nodes[current].links) {
        if (link.first == prev) {
            continue;
        }
        max_cost = std::max(max_cost, dfs(link.first, current, cost + link.second, nodes));
    }
    return max_cost;
}


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

    std::vector<Node> nodes(n);
    for (int i = 0; i < n; i++) {
        nodes[i].idx = i;
    }
    for (int i = 0; i < n - 1; i++) {
        int s, t, w;
        std::cin >> s >> t >> w;
        nodes[s].links.emplace_back(std::make_pair(t, w));
        nodes[t].links.emplace_back(std::make_pair(s, w));
    }

    std::queue<Node> que;
    std::vector<int> costs(n, 0), color(n, 0);
    que.push(nodes[0]);
    while (!que.empty()) {
        auto node = que.front();
        color[node.idx] = 1;
        que.pop();

        for (auto link : node.links) {
            if (color[link.first] == 0) {
                que.push(nodes[link.first]);
                costs[link.first] = costs[node.idx] + link.second;
            }
        }
    }

    int max_idx = 0;
    int max = costs[max_idx];
    for (int i = 1; i < n; i++) {
        if (costs[i] > max) {
            max = costs[i];
            max_idx = i;
        }
    }

    que.push(nodes[max_idx]);
    costs = std::vector<int>(n, 0);
    color = std::vector<int>(n, 0);

    while (!que.empty()) {
        auto node = que.front();
        color[node.idx] = 1;
        que.pop();

        for (auto link : node.links) {
            if (color[link.first] == 0) {
                que.push(nodes[link.first]);
                costs[link.first] = costs[node.idx] + link.second;
            }
        }
    }

    max = 0;
    for (int i = 0; i < n; i++) {
        if (costs[i] > max) {
            max = costs[i];
        }
    }

    std::cout << max << std::endl;
}



Measured memory_bytes: 13832
T=int(input())

X=[]
for i in range(T):
    N,A,B,C,D=map(int,input().split())

    M={0:0,1:D}
    S={2:A,3:B,5:C}
    
    def f(N):
        if N in M:
            return M[N]
        
        R=D*N
        for k in S:
            p,q=N//k*k,(N+k-1)//k*k
            R=min(R,
                  D*abs(N-p)+S[k]+f(p//k),
                  D*abs(N-q)+S[k]+f(q//k)
                  )

        M[N]=R
        return R

    X.append(f(N))
print("\n".join(map(str,X)))


Measured memory_bytes: 94980
#include<stdio.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a, &b, &c);
if(a==5&&b==5&&c==7)printf("YES\n");
else if(a==5&&c==5&&b==7)printf("YES\n");
else if(b==5&&c==5&&a==7)printf("YES\n");
else printf("NO\n");
return 0 ;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#include <algorithm>
using namespace std;

bool in_range(int a, int b){
  return a >= 0 && a < b;
}

int main(){
  int H, W;
  cin >> H >> W;
  int ch, cw;
  cin >> ch >> cw;
  --ch,--cw;
  int dh, dw;
  cin >> dh >> dw;
  --dh,--dw;
  vector<string> S(H);
  for(int i = 0; i < H; ++i){
    cin >> S[i];
  }
  const int INF = 1e9;
  vector<vector<int>> C(H,vector<int>(W,INF));
  C[ch][cw] = 0;
  priority_queue<tuple<int,int,int>, vector<tuple<int,int,int>>, greater<>> Q;
  Q.emplace(0,ch,cw);
  const int dx[] = {0,1,0,-1}, dy[] = {1,0,-1,0};
  while(Q.size()){
    auto [c, x, y] = Q.top();
    Q.pop();
    if(C[x][y] < c) continue;
    {
      for(int i = 0; i < 4; ++i){
        int x_ = x + dx[i], y_ = y + dy[i];
        if(not in_range(x_,H)) continue;
        if(not in_range(y_,W)) continue;
        if(S[x_][y_] == '#') continue;
        int c_ = c;
        if(C[x_][y_] <= c_) continue;
        C[x_][y_] = c_;
        Q.emplace(c_, x_, y_);
      }
    }
    {//warp
      for(int x_ = x-2; x_ <= x+2; ++x_){
        for(int y_ = y-2; y_ <= y+2; ++y_){
          if(not in_range(x_,H)) continue;
          if(not in_range(y_,W)) continue;
          if(S[x_][y_] == '#') continue;
          int c_ = c + 1;
          if(C[x_][y_] <= c_) continue;
          C[x_][y_] = c_;
          Q.emplace(c_, x_, y_);
        }
      }
    }
  }
  int ans = C[dh][dw];
  if(ans >= INF) ans = -1;
  cout << ans << endl;
}


Measured memory_bytes: 9512
#include <iostream>
#include <vector>

using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

int GCD(int a, int b) {return b ? GCD(b, a%b) : a; }

int main() {
    int N; cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<int> left(N+1, 0), right(N+1, 0);

    for (int i = 0; i < N; ++i) left[i+1] = GCD(left[i], a[i]);
    for (int i = N - 1; i >= 0; --i) right[i] = GCD(right[i+1], a[i]);

    int res = 0;
    for (int i = 0; i < N; i++) {
          int l = left[i];
          int r = right[i+1];
          chmax(res, GCD(l, r));
    }
    cout << res << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = (int)(n)-1; 0 <= i; i--)
#define rrep1(i, n) for (int i = (int)(n); 1 <= i; i--)

#define each(it, c) \
    for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define all(obj) (obj).begin(), (obj).end()

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x) cerr << #x << " = " << (x) << endl;

#define endl "\n"

template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

typedef long long lint;

using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    cout << (s[LEN(s) - 1] == 's' ? s + "es" : s + "s") << endl;
}

Measured memory_bytes: 3640
fun main(arg: Array<String>) {
    val fact = Array(100001) { ModInt(1) }
    for (n in 1 until 100001) fact[n] = fact[n - 1] * n

    val (N, M) = listOfInt()
    val p1 = fact[N]
    val p2 = fact[M]
    val ans = when (Math.abs(N - M)) {
        0 -> p1 * p2 * 2
        1 -> p1 * p2
        else -> ModInt(0)
    }
    println(ans.toString())
}

data class ModInt(private var v: Long) {
    companion object { private const val MOD = 1000000007L }
    init { this.v %= MOD }
    constructor(k: Int): this(k.toLong())
    operator fun plus(other: Int) = ModInt((this.v + other) % MOD)
    operator fun minus(other: Int) = ModInt((this.v + MOD - other) % MOD)
    operator fun minus(other: ModInt) = ModInt((this.v + MOD - other.v) % MOD)
    operator fun times(other: Int) = ModInt(this.v * other % MOD)
    operator fun times(other: ModInt) = ModInt(this.v * other.v % MOD)
    operator fun div(other: ModInt) = ModInt(this.v * pow(other.v, MOD - 2) % MOD)
    private fun pow(a: Long, b: Long): Long {
        if (b == 0L) return 1L
        if (b % 2 == 0L) {
            val d = pow(a, b / 2)
            return (d * d) % MOD
        }
        return a * pow(a, b - 1) % MOD
    }
    override fun toString() = this.v.toString()
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }
fun listOfLong() = listOfString().map(String::toLong)


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		
		Arrays.setAll(d, i -> sc.nextInt());
		Arrays.sort(d);
		
		int k = d[n / 2] - d[n / 2 - 1];
		
		System.out.println(k);
		
		sc.close();
	}

}


Measured memory_bytes: 61460
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n);
#define DEBUG printf("%s\n","debug")
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////

int main(){
	int price = 0;
	int A,B,C,X,Y;
	scanf("%d%d%d%d%d",&A,&B,&C,&X,&Y);
	
	int minab = min(X,Y);

	int mina = min(A,2*C);
	int minb = min(B,2*C);
	int abset = min(2*C,A+B);
	
	X = X - minab;
	Y = Y - minab;
	
	price = price + (minab * abset);
	

	
	price += (X * mina) + (Y*minb);
	
	PRINTD(price);
	
	
}










Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
	int i, j;
	
	for (i = 1; i < 10; i++) {
		for (j = 1; j < 10; j++) {
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	
	return 0;
}

Measured memory_bytes: 0