akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
 
class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int [][][] room = new int [4][3][10];
 
        int n = sc.nextInt();
 
        for(int i = 0 ; i < n ; i++){
            int b = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            int v = sc.nextInt();
                room [b-1][f-1][r-1] += v;
        }
 
        for(int i = 0 ; i < 4 ; i++){
            for(int j = 0 ; j < 3 ; j++){
                for(int k = 0 ; k < 10 ; k++){
                    System.out.print(" "+room[i][j][k]);
                }
                System.out.println();
            }
            if(i==3) break;
            System.out.println("####################");
        }
    }
}

Measured memory_bytes: 21264
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0188

"""
import sys
from sys import stdin
input = stdin.readline


def b_search(data, k):
    count = 0
    l = 0
    r = len(data) - 1

    while r >= l:
        count += 1
        mid = (l + r) // 2
        if data[mid] == k:
            break
        if data[mid] > k:
            r = mid - 1
        else:
            l = mid + 1
    return count



def main(args):
    while True:
        n = int(input())
        if n == 0:
            break
        data = [int(input()) for _ in range(n)]
        k = int(input())
        result = b_search(data, k)
        print(result)



if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7808
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var S = ReadText().Distinct().OrderBy(x => x);
            var a = "abcdefghijklmnopqrstuvwxyz";
            foreach (var item in a)
            {
                if (!S.Contains(item))
                {
                    return item;
                }
            }
            return "None";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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


int main(){
  int t ;
  cin >> t;
  double max;
  // サイコロの数
  for(int i = 0; i < t + 1; i++){
    int n,m;
    double p[200]={};
    double v[200]={};
    cin  >> n >> m;
    for(int j = 0; j < m; j++){
      cin >> v[j] >> p[j] ;
    }
    double exp=0,tmp=0;
    for(int j = 0; j < m; j++){
      tmp += p[j];
    }
    for(int j = 0; j < m; j++){
      exp += v[j] * p[j] /tmp;
    }
    if(i == 0) max = exp;
    else if(i == t) {
      if(max - exp >= 0.0000001) cout <<"YES"<<endl;
      else cout << "NO" << endl;
    }
    else{
      if(max < exp) max = exp;
    }
  }
  return 0;
}

Measured memory_bytes: 1232
my ($a, $b, $c) = split / /, <>;
my $k = <>;

while ($a >= $b) {
    if ($k == 0) { last; }

    $b *= 2;
    $k--;
}

while ($b >= $c) {
    if ($k == 0) { last; }

    $c *= 2;
    $k--;
}

print (($a < $b && $b < $c) ? 'Yes' : 'No');


Measured memory_bytes: 4744
n,k = map(int,input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(input())

l = [0]*n
for ai in a:
    buf = list(map(int,ai.split()))
    for b in buf:
        l[b-1]=1

total =0 
for ln in l:
    if ln == 0:
        total += 1
        
print(total)

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

int main(){
  int w,a,b;
  cin>>w>>a>>b;
  if(a<b){
    cout<<max(0,b-(a+w))<<endl;
  }
  else{
    cout<<max(0,a-(b+w))<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, h, ans, sum;
vector<pair<int, char>> v;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n >> h;
    rep(i, 0, n) {
        int p, q;
        cin >> p >> q;
        v.pb(mp(p, 'a'));
        v.pb(mp(q, 'b'));
    }
    sort(v.begin(), v.end(), greater<pair<int, char>>());
    for(int i = 0; i < n*2; i++) {
        if (h <= 0) break;
        if (v[i].second == 'b') {
            h -= v[i].first;
            ans++;
        } else {
            int w = h;
            h -= v[i].first * ceil((double)h / (double)(v[i].first));
            ans = ans + ceil((double)w / (double)(v[i].first));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2420
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    char op;
    while(true){
        cin >> a >> op >> b;
        if (op == '?'){
            break;
        }
        if ( op == '+'){
            cout << (a+b) << endl;
        }
        if ( op == '-'){
            cout << (a-b) << endl;
        }
        if ( op == '*'){
            cout << (a*b) << endl;
        }
        if ( op == '/'){
            cout << (a/b) << endl;
        }
         
         
         
         
         
         
         
    }
}


Measured memory_bytes: 3076
// Implementation practice (Have seen the editorial)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef set<int> si;
typedef priority_queue<int> pqi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define loop(i, a) for (int i = 0; i < (a); i++)
#define loop1(i, a) for (int i = 1; i <= (a); i++)
#define loopr(i, a, b) for (int i = (a); i <= (b); i++)
#define dloop(i, a) for (int i = (a) - 1; i >= 0; i--)
#define dloopr(i, b, a) for (int i = (b); i >= (a); i--)
#define show(a) cout << a << "\n"
#define showloop(a, len) for (int i = 0; i < len; i++) cout << a[i] << "\n"
#define itloop(a, len) for (int i = 0; i < len; i++) cout << a[i] << "\n"
#define debug(a) cout << #a << ": " << (a) << "\n"
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) ((int)x.size())
#define ran(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))
const int MOD = 1000000007;
const double PI = acos(-1);

const int N = 1e5 + 10;
int n;
map<int, int> nums;
int ans = 0;

int main() {
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	ios::sync_with_stdio(false);cin.tie(NULL);

	cin >> n;
	loop(i, n) {
		int x;
		cin >> x;
		nums[x] = nums[x] ^ 1;
	}
	for (mii::iterator it = nums.begin(); it != nums.end(); it++) ans += it->second;

	show(ans);

	return 0;
}

Measured memory_bytes: 4992
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	static int N;
	static long A,B;
	static Long[] h;

	public static void main(String[] args){
		Scanner io = new Scanner(System.in);
		N = io.nextInt();
		A = io.nextLong();
		B = io.nextLong();
		h = new Long[N];
		for (int i = 0; i < N; i++) {
			h[i] = io.nextLong();
		}
		
		Arrays.sort(h,Collections.reverseOrder());
		
		Long ansMin = h[0]/A + ((h[0]%A==0)?0:1)-1;
		Long ansMax = h[0]/B + ((h[0]%B==0)?0:1);
		
		System.out.println(ans(ansMin,ansMax));
		
	}
	
	public static long ans(long min,long max){
		if(max-min<=1) return max;
		long cand = (min+max)/2;
		if(possible(cand,cand,0))
			return ans(min,cand);
		else
			return ans(cand,max);
	}
	
	public static boolean possible(long count,long maxA, int i){
		if(i>=N) return true;
		long num = h[i]-B*(count-maxA);
		if(A*maxA<num) return false;
		if(B*maxA>=num) return true;
		long nextMaxA = (A*maxA-num)/(A-B);
		return possible(count,nextMaxA,i+1);
	}
}

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

int main() {
  int N, a;
  cin >> N;
  for(int i = N; i > 0;){
      a += i%10;
      i = i/10;
  }
  if(N%a == 0) cout << "Yes"<<endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n;
	int i, f = 0;
	int dou[10];
	int cou[10];
	
	dou[0] = 1;
	for (i = 1; i < 10; i++){
		dou[i] = dou[i - 1] * 2;
	}
	
	while (scanf("%d", &n) != EOF){
		for (i = 0; i < 10; i++){
			cou[i] = 0;
		}
		for (i = 9; i >= 0; i--){
			if (n >= dou[i]){
				cou[i]++;
				n = n - dou[i];
			}
		}
		for (i = 0; i < 10; i++){
			if (cou[i] != 0 && f == 1){
				printf(" %d", dou[i]);
			}
			else if(cou[i] != 0){
				printf("%d", dou[i]);
				f = 1;
			}
		}
		printf("\n");
		f = 0;
	}
	
	return (0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
// long long dp[101][100001];
// long long maxProfit(vector<int>&w,vector<int>&v,int n,int W){
//     if(n==0 || W==0) return 0;
//     if(dp[n][W]!=-1) return dp[n][W];
//     if(w[n-1]<=W)
//       return dp[n][W]=max(v[n-1]+maxProfit(w,v,n-1,W-w[n-1]),maxProfit(w,v,n-1,W));
//     return dp[n][W]=maxProfit(w,v,n-1,W);  

// }
int main()
{  ios::sync_with_stdio(false);
   cin.tie(0);  
   int n,W;
   cin>>n>>W;
   vector<int>w(n);
   vector<int>v(n);
   for(int i=0;i<n;i++)  cin>>w[i]>>v[i];
   long long dp[W+1]={0};
   
   for(int i=1;i<=n;i++){
     for(int j=W;j>=0;j--){
        if(w[i-1]<=j){
          dp[j]=max(v[i-1]+dp[j-w[i-1]],dp[j]);
        }
     }
   }
   cout<<dp[W];
     return 0;
}


Measured memory_bytes: 4364
N = int(input())
A = input()
B = input()
C = input()
num = 0
for i in range(N):
    if (A[i] == B[i] and A[i] != C[i]) or (A[i] == C[i] and A[i] != B[i]) or (C[i] == B[i] and A[i] != C[i]):
        num += 1
    elif A[i] != B[i] and A[i] != C[i]:
        num += 2

print(num)


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

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

	int64 X, Y, K;
    cin >> K >> X >> Y;
    bool swapped = 0;
    int64 sgnX = 1, sgnY = 1;
    if (X < 0) { sgnX = -1; X *= -1; }
    if (Y < 0) { sgnY = -1; Y *= -1; }
    if (X > Y) { swapped = 1; swap(X, Y); };
    if ((X+Y) %2 == 1 && K%2 == 0) {
        cout << -1 << endl;
        return 0;
    }
    vector<PLL> res;
    int64 n = ((X+Y+K-1)/K);
    if (n*K % 2 != (X+Y)%2) n++;
    int64 a = (n*K-X-Y)/2;
    if (X + Y >= K) {
        PLL now(0, 0);
        while (a+X >= now.fs+K) {
//            cout << "push1" << endl;
            now.fs += K; res.push_back(now);
        }
//        cout << "push2" << endl;
        now.sc += K-(a+X-now.fs); now.fs = a+X; res.push_back(now);
        while (now.sc+K <= Y) {
//            cout << "push3" << endl;
            now.sc += K; res.push_back(now);
        }
        if (now.sc != Y) {
//            cout << "push4" << endl;
            now.fs -= K - (Y - now.sc);
            now.sc = Y;
            res.push_back(now);
        }
        while (now.fs > X) {
            now.fs -= K; res.push_back(now);
//            cout << "push5" << endl;
        }
    } else if ((X+Y) % 2 == 0) {
        a = 2*K-X-Y; a/=2;
        res.push_back(PLL(a+X, K-a-X));
        res.push_back(PLL(X, Y));
    } else {
        res.push_back(PLL(X, -K+X));
        res.push_back(PLL(X+(K+X-Y)/2, (K-X+Y)/2-K+X));
        res.push_back(PLL(X, Y));
    }
    cout << res.size() << endl;
    REP(i, res.size()) {
        if (swapped) swap(res[i].fs, res[i].sc);
        cout << res[i].fs * sgnX << " " << res[i].sc * sgnY << endl;
    }
}


Measured memory_bytes: 6128
n=int(input())
a=list(map(int,input().split()))
M = max(a)+1
t=[True]*M
a.sort()
s=set(a)
pre = 0
for i in a:
    if t[i] == 0:
        continue
    if pre == i:
        t[i] = False
    for j in range(2*i,M,i):
        t[j] = False
    pre = i
ans = 0
for k in a:
    if t[k] == True:
        ans += 1

print(ans)


Measured memory_bytes: 39528
#include <bits/stdc++.h>
using namespace std;
int n,m,x[110],y[110];
int main(){
    cin>>n>>m>>x[0]>>y[0];
    for(int i=1;i<=n;i++)cin>>x[i];
    for(int i=1;i<=m;i++)cin>>y[i];
    sort(x,x+n+1);
    sort(y,y+m+1);
    if(x[n] < y[0])return cout<<"No War"<<endl, 0;
    cout<<"War"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 115;
typedef struct node{
	int x,y;
	int s;
} no;
bool cmp1(node a,node b){
    if(a.x == b.x){
        return a.y<b.y;
    }
	else{
        return a.x<b.x;
    }
}
int main(){
	int n,a,t;
	int ans=0;
	scanf("%d",&n);
	no red[N];
	no blue[N];
	for(int i=0;i<n;i++){
		scanf("%d %d",&red[i].x,&red[i].y);
	}
//	sort(red,red+n,cmp1);
	for(int i=0;i<n;i++){
		scanf("%d %d",&blue[i].x,&blue[i].y);
		blue[i].s=0;
	}
	sort(blue,blue+n,cmp1);
	for(int i=0;i<n;i++){
		int mark=-1,temp;
	    for(int j=0;j<n;j++){
	    		if(red[j].y>mark && red[j].x<blue[i].x && red[j].y<blue[i].y && !blue[j].s){
	    			mark=red[j].y;
	    			temp=j;
//	    			printf("%d %d %d %d\n",red[i].x,red[i].y,blue[j].x,blue[j].y);
				} 

		}
		if(mark!=-1){
			ans++;
			blue[temp].s=1;
		}		
	}
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

ll ans = 0;
bool finish = false;

void solve(ll a, ll b, ll c) {
    if (finish) return;
    if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
        finish = true;
        return;
    }
    ans++;
    solve((b+c)/2, (a+c)/2, (a+b)/2);
    return;
}

int main(int argc, char const *argv[]) {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
        cout << 0 << std::endl;
        return 0;
    }
    if (a == b && b == c && c == a) {
        cout << -1 << std::endl;
        return 0;
    }
    solve(a, b, c);
    cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def get_par(par, p):
    while par[p] != p:
        p = par[p]
    return par[p]

n,m = map(int, input().split())
lang = {}
for i in range(n):
    k,*l = map(int, input().split())
    for j in l:
        # print(i,j)
        if j not in lang:
            lang[j] = []
        lang[j].append(i)
# [print(k,v) for k,v in lang.items()]

par = [i for i in range(n)]
for k,v in lang.items():
    if len(v) == 1:
        continue
    a = v[0]
    for i in range(1,len(v)):
        aa = get_par(par, a)
        bb = get_par(par, v[i])
        if aa == bb:
            continue
        # unite
        if aa < bb:
            par[bb] = aa
        else:
            par[aa] = bb

ans = [get_par(par, i) for i in range(n)]
print('YES' if len(set(ans)) == 1 else 'NO')
# print(par)


Measured memory_bytes: 17296
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  string s;
  cin >> s;
  vector<pair<int, int>> l;
  stack<int> st;
  int sum = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (s[i] == '\\')
    {
      st.push(i);
    }
    else if (s[i] == '/')
    {
      if (!st.empty())
      {
        sum += i - st.top();
        pair<int, int> p(i - st.top(), st.top());
        while (!l.empty() && l.back().second >= p.second)
        {
          p.first += l.back().first;
          l.pop_back();
        }
        l.push_back(p);
        st.pop();
      }
    }
  }
  cout << sum << endl;
  cout << l.size();
  for (int i = 0; i < l.size(); ++i)
    cout << ' ' << l[i].first;
  cout << endl;

  return 0;
}



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

long long a, b, c;

long long solve();

int main() {
  cin >> a >> b >> c;

  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  ans = min(c, a + b);
  ans += b;
  if(c > a + b) ++ans;
  return ans;
}

Measured memory_bytes: 764
/*input
happy,newyear,enjoy
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	int n;
	cin>>n;
	if(n<1200){
		cout<<"ABC";
	}
	else cout<<"ARC";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int W;
    int H;
    int x;
    int y;
    int r;
    
    cin>>W>>H>>x>>y>>r;
    
     if(W<x+r||H<y+r){
        cout<<"No"<<endl;
    }
        else if(0>x-r||0>y-r){
        cout<<"No"<<endl;
    }
     else if(0<=x-r&&0<=y-r){
        cout<<"Yes"<<endl;
    }
     else if(W>=x+r&&H>=y+r){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
}



Measured memory_bytes: 3116
A, B, C = map(int, input().split())
cnt = 0
if A % 2 == B % 2 and B % 2 != C % 2:
  A += 1
  B += 1
  cnt += 1
elif A % 2 == C % 2  and C % 2 != B % 2 :
  A += 1
  C += 1
  cnt += 1
elif C % 2 == B % 2 and A % 2 != C %2 :
  C += 1
  B += 1
  cnt += 1
else :
  pass
L = [A, B, C]
L= sorted(L)
cnt += (L[2] - L [1])//2
cnt += (L[2] - L[0])//2
print(cnt)


Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        int[][] childs = new int[n][];
        for (int i = 0; i < n; i++)
        {
            var data = Console.ReadLine().Split().Select(int.Parse).ToArray();
            childs[data[0] - 1] = data.Skip(2).Select(x => x - 1).OrderBy(x => x).ToArray();
        }

        int[] dist = Enumerable.Repeat(-1, n).ToArray();
        Queue<int> queue = new Queue<int>();
        dist[0] = 0;
        queue.Enqueue(0);
        while (queue.Count > 0)
        {
            var elem = queue.Dequeue();
            foreach (var item in childs[elem])
            {
                if (dist[item] != -1) continue;
                dist[item] = dist[elem] + 1;
                queue.Enqueue(item);
            }
        }
        for (int i = 0; i < n; i++)
        {
            Console.WriteLine($"{i + 1} {dist[i]}");
        }
    }
}




Measured memory_bytes: 19000
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef vector<double> vec;

int N;
vec x(60),y(60);

bool b(double r){
    double p[2],q[2];
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            double d=sqrt((x[j]-x[i])*(x[j]-x[i])+(y[j]-y[i])*(y[j]-y[i]));
            if(d>2.0*r){continue;}
            double h=sqrt(r*r-d*d/4.0);
            double mx=(x[i]+x[j])/2.0;
            double my=(y[i]+y[j])/2.0;
            double a[2];
            a[0]=1.0,a[1]=-1.0;
            for(int l=0;l<2;l++){
                bool bo=true;
                p[l]=mx+a[l]*(y[j]-y[i])*h/d;
                q[l]=my-a[l]*(x[j]-x[i])*h/d;
                for(int k=0;k<N;k++){
                    if(k==i || k==j){continue;}
                    if((x[k]-p[l])*(x[k]-p[l])+(y[k]-q[l])*(y[k]-q[l])>r*r){bo=false;}
                }
                if(bo){return true;}
            }
        }
    }
    return false;
}

double binary_search(double l,double r){
    if(r-l<1.0e-10){
        return l;
    }
    double m=(l+r)/2;
    if(b(m)){return binary_search(l,m);}
    else {return binary_search(m,r);}
}

int main(){
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>x[i]>>y[i];
    }
    printf("%0.10lf\n",binary_search(0.0,1.0e4));
    return 0;
}

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

int T[100005] ;

int com ( const void* a, const void*b ) {
    return *(int*)a - *(int*)b ;
}

int main () {
    int N, C, K, result, i, c, t;
    scanf ( "%d %d %d", &N, &C, &K ) ;
    for ( i = 0 ; i < N ; i++ ) {
        scanf ( "%d", &T[i] ) ;
    }
    qsort ( T, N, sizeof (int), com ) ;
    t = 0 ;
    for ( i = 1 , result = 1, c = 1 ; i < N ; i++ ) {
        if ( T[i] - T[t] <= K && c < C ) {
            c++ ;
        }
        else {
            c = 1 ;
            t = i ;
            result++ ;
        }
    }
    printf ( "%d", result ) ;
}


Measured memory_bytes: 892
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readlines
from collections import deque
def main():
    lines = input()
    n, m = list(map(int, lines[0].split()))
    #隣接リスト
    edges=[[] for i in range(n)]
    for i in range(m):
        u,v=list(map(int,lines[i+1].split()))
        edges[u-1].append(v-1)

    s,t=list(map(int,lines[m+1].split()))
    inf=100000000000
    score=[[inf]*3 for i in range(n)]
    now=deque()
    now.append((s-1, 0))
    score[s-1][0]=0
    def bfs():
        if now:
            u, mod = now.popleft()
            time = score[u][mod]
            mod = (mod+1)%3
            for v in edges[u]:
                if score[v][mod] == inf:
                    score[v][mod] = time+1
                    now.append((v, mod))

            bfs()

    bfs()
    ans = score[t-1][0]
    if ans == inf:
        print(-1)
    else:
        print(score[t-1][0]//3)
main()

Measured memory_bytes: 377564
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int dp[4005][4005];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s,t;
	while(cin >> s){
		cin >> t;
		s='.'+s;
		t='.'+t;
		int n=s.size();
		int m=t.size();
		for(int i=0;i<=n;i++){
			for(int j=0;j<=m;j++){
				dp[i][j]=0;
			}
		}
		int res=0;
		for(int i=1;i<n;i++){
			for(int j=1;j<m;j++){
				if(s[i]==t[j]){
					dp[i][j]=dp[i-1][j-1]+1;
				}
				res=max(res,dp[i][j]);
			}
		}
		cout << res << endl;
	}
}


Measured memory_bytes: 65804
#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long

const int N = 2e5 + 5;

vector<int> g[N], vis(N, 0);
int cnt = 0;

void dfs(int u) {
	vis[u] = 1;
	++cnt;
	for (int &v : g[u]) {
		if (!vis[v]) {
			dfs(v);
		}
	}
}
				
int32_t main() {
	fast_cin();  
	int n, m;
	cin >> n >> m;
	int ans = 0;
	for (int i = 0; i < m; ++i) {
		int u, v; cin >> u >> v;
		g[u].push_back(v), g[v].push_back(u);
	}
	for (int i = 1; i <= n; ++i) {
		if (!vis[i]) {
			cnt = 0;
			dfs(i);
			ans = max(ans, cnt);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 21836
#include<iostream>
#include<cstdlib>
#include<cstring>;

using namespace std;

int main(){
	int t_num, h_num, sw_taro = 101, sw_hana = 101;
	int t_tot = 0, h_tot = 0, tmp, taro[100], hana[100];
	bool found = false;
	while (true){
		memset(taro, 0, sizeof(taro));
		memset(hana, 0, sizeof(hana));
		cin >> t_num >> h_num;
		if (t_num == 0)
			break;
		for (int i = 0; i < t_num; i++){
			cin >> taro[i];
			t_tot += taro[i];
		}
		for (int i = 0; i < h_num; i++){
			cin >> hana[i];
			h_tot += hana[i];
		}
		for (int i = 0; i < t_num; i++){
			tmp = taro[i];
			for (int j = 0; j < h_num; j++){
				if ((t_tot - tmp+hana[j]) == (h_tot - hana[j] + tmp))
				if ((taro[i] + hana[j]) < (sw_taro + sw_hana)){
					found = true;
					sw_taro = taro[i];
					sw_hana = hana[j];
				}
			}
		}
		if (found){
			cout << sw_taro << " " << sw_hana << endl;
		}
		else
			cout << "-1\n";
		found = false;
		sw_taro = 101;
		sw_hana = 101;
		h_tot = 0;
		t_tot = 0;
	}
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	vector<pair<int,int> > ans;
	if(n%2==0){
		int nex=n+1;
		for(int i=1;i<=n;i++){
			for(int j=i;j<=n;j++){
				if(i==j||j+i==nex) continue;
				ans.push_back({i,j});
			}
		}
	}
	else{
		int nex=n;
		for(int i=1;i<n;i++){
			for(int j=i;j<=n;j++){
				if(i==j||j+i==nex) continue;
				ans.push_back({i,j});
			}
		}
	}
	cout<<ans.size()<<endl;
	lp(i,ans.size()){
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
# coding: utf-8

N = int(input())
A = [int(a) for a in input().split()]

is_zero = len([a for a in A if a == 0]) > 0
if is_zero:
    print(sum([abs(a) for a in A]))
else:
    minus = len([a for a in A if a < 0])
    abs_list = [abs(a) for a in A]
    if minus % 2 == 0:
        print(sum(abs_list))
    else:
        min_value = min(abs_list)
        print(sum(abs_list) - min_value * 2)


Measured memory_bytes: 14224
s = input()

def calc(s):
    if s == "":
        return print("YES")
    if s.find("dreameraser") != -1:
        s = s.replace("dreameraser", "")
        return calc(s)
    elif s.find("dreamerase") != -1:
        s = s.replace("dreamerase", "")
        return calc(s)        
    elif s.find("dreamer") != -1:
        s = s.replace("dreamer", "")
        return calc(s)
    elif s.find("dream") != -1:
        s = s.replace("dream", "")
        return calc(s)
    elif s.find("eraser") != -1:
        s = s.replace("eraser", "")
        return calc(s)
    elif s.find("erase") != -1:
        s = s.replace("erase", "")
        return calc(s)
    return print("NO")

calc(s)

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    cout << accumulate(a, a + k, 0) << '\n';
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <unordered_map>
#include <queue>
#define MOD 1000000007
#define REP(i,st,num)for(int i=(st);i<(num);++i)
#define ll long long
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int N, t;
    vector<int> V;
    cin>>N;
    REP(i,0,N) {
        cin>>t;
        V.push_back(t);
    }
    sort(V.begin(), V.end());
    double ans = V[0];
    REP(i,1,N){
        ans = (ans + V[i]) / 2;
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort()

k = []
max_a = a[-1]
max_half = max_a / 2
for i in range(n):
    if a[i] >= max_half:
        if i == 0:
            k.append(a[i])
            break
        k.append(a[i])
        k.append(a[i-1])
        break
ans = 0
if len(k) == 1:
    ans = k[0]
else:
    if abs(max_half - k[0]) < abs(max_half - k[1]):
        ans = k[0]
    else:
        ans = k[1]

print(max_a, ans)

Measured memory_bytes: 85256
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        if (a >= 13) {
            System.out.println(b);
        } else if (a >= 6 && a <= 12) {
            System.out.println(b/2);
        } else {
            System.out.println(0);
        }
    }

}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

struct Edge { Edge(int to, int cost) : to(to), cost(cost) {} int to, cost; };
void dfs(int cur, ll cost, vector<ll> &costs, vector<vector<Edge>> &tree) {
  costs[cur] = cost;
  for (auto edge : tree[cur]) {
    if (costs[edge.to] != inf) continue;
    dfs(edge.to, cost+edge.cost, costs, tree);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  vector<ll> costs(n, inf);
  vector<vector<Edge>> tree(n);
  rep(i, n-1) {
    int a, b, c; std::cin >> a >> b >> c;
    a--, b--;
    tree[a].eb(b, c), tree[b].eb(a, c);
  }
  int q, k; std::cin >> q >> k; k--;
  dfs(k, 0, costs, tree);
  rep(i, q) {
    int x, y; std::cin >> x >> y;
    x--, y--;
    std::cout << costs[x]+costs[y] << "\n";
  }
}


Measured memory_bytes: 12800
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      String s = sc.nextLine();
      String r = "";
      switch (s) {
        case "A":
          r = "T";
          break;
        case "T":
          r = "A";
          break;
        case "C":
          r = "G";
          break;
        case "G":
          r = "C";
          break;
      }
      System.out.println(r);
    }
  }
}

Measured memory_bytes: 21844
use std::io::{self, BufRead};

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let xs: Vec<usize> = lines.next().unwrap().unwrap().split(' ').map(|x| x.parse().unwrap()).collect();
  let (w, h, x, y) = (xs[0], xs[1], xs[2], xs[3]);
  let s: f64 = (w * h) as f64 / 2.0;
  let ok = (w % 2 == 0 && h % 2 == 0 && 2 * x == w && 2 * y == h) as i32;
  println!("{} {}", s, ok);
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

intt n;

int main() {

	FAST;

	cin >> n;
	intt x = 1;
	while (x * 26 <= n) {
		x *= 26;
	}
	string ans = "";
	while (n) {
		if (n % 26 == 0) {
			ans.push_back('z');
			n -= 26;
			n /= 26;
		}
		else {
			ans.push_back(char(n % 26 + (int)'a' - 1));
			n /= 26;
		}
	}
	reverse(ans.begin(), ans.end());
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if(N<10){
        cout << N << "\n";
    }else if(N<100){
        cout << 9 << "\n";
    }else if(N<1000){
        cout << N-90 << "\n";
    }else if(N<10000){
        cout << 909 << "\n";
    }else if(N<100000){
        cout << N-90-9000 << "\n";
    }else if(N<1000000){
        cout << 90909 << "\n";
    }
}

Measured memory_bytes: 256
io = STDIN
str=io.gets.chomp
def check(str)
  str.split(//).each_with_index do |c,i|
    if (i+1).even?
      return 'No' if c=="R"
    else
      return 'No' if c=="L"
    end
  end
  return 'Yes'
end
puts check(str)


Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main(void){
    string s1,s2,s3;
    char c1,c2,c3;
    cin >> s1 >> s2 >> s3;
    c1=s1.front();
    c2=s2.front();
    c3=s3.front();
    c1 -= 0x20;
    c2 -= 0x20;
    c3 -= 0x20;
    cout << c1 << c2 << c3 << "\n";
    return 0;
}

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

using namespace std;

long long power(int x, int y){
  long long n = 1;
  for(int i = 0; i < y; i++)
    n *= x;
  return n;
}

int log(int x, int y){
  int cnt = 0;
  while(y > 1){
    y /= x;
    cnt++;
  }
  return cnt;
}

int main() {
  int n;
  cin >> n;
  cout << n*n*n << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define int long long
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(X) X[X.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	vector <int> A(3);
	rep(i,3)
	cin >> A[i];
	sort(ALL(A));
	cout << A[2]-A[0];
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N,i,x,res=0;
	cin >> N;
	int a[100001];
	for(i=0;i<100001;i++){
		a[i]=0;
	}
	for(i=0;i<N;i++){
		cin>>x;
		if(x==0){
			a[x]++;
			a[x+1]++;
		}else{
			a[x-1]++;
			a[x]++;
			a[x+1]++;
		}
	}
	for(i=0;i<100001;i++){
		//cout<<a[i]<<endl;
		res=max(res,a[i]);
	}
	cout<<res<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int maxn=1e5+5;
int a[105],b[105];
int main()
{
    int n,m,x,y;
    cin>>n>>m>>x>>y;
    int max1=0;
    int min1=0;
    for(int i=0;i<n;i++)
        {
        	cin>>a[i];
        	if(i==0) max1=a[i];
        	if(a[i]>max1) max1=a[i];
		}
	for(int i=0;i<m;i++)
	{
		cin>>b[i];
        if(i==0) min1=b[i];
        if(b[i]<min1) min1=b[i];
	}
	if(min1<=max1) cout<<"War"<<endl;
	else if(max1>=y||min1<=x) cout<<"War"<<endl;
	else cout<<"No War"<<endl;
}

Measured memory_bytes: 256
#Union-Find 拝借しました
#https://atc001.contest.atcoder.jp/submissions/2407833
$N, $M = gets.chomp.split(' ').map(&:to_i)

$con = (0..$N).to_a
$rank = Array.new($N+1, 0)

def find(i)
  return i if i == $con[i]

  $con[i] = find($con[i])
end

def union(i, j)
  x = find(i)
  y = find(j)

  return if x == y

  if $rank[x] < $rank[y]
    $con[y] = x
  else
    $con[x] = y
    $rank[x] += 1 if $rank[x] == $rank[y]
  end
end

P=gets.split.map(&:to_i)

$M.times do
  x, y = gets.split.map(&:to_i)
  union(x,y)
end

ans=0;
$N.times{|x|
  a=find(x+1) 
  b= find(P[x])
  ans+=1 if a == b
}
p ans

Measured memory_bytes: 12300
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n" 
#define dcml(n) fixed<<setprecision(n)

 
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } 
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; } 
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; } 
ll modPow(ll x,ll n,ll mod=MOD){ 
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod); 
} 
ll GetDigit(ll num){ 
    ll digit=0; 
    while(num!=0){num/=10;digit++;} 
    return digit; 
} 


using namespace std;
//-------------------------------------------
int main(){
  ll A,B;cin>>A>>B;
  cout<<(A-2*B<0?0:A-2*B)<<"\n";
}


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            string[] hon = { "p", "p", "h", "b", "h", "h", "p", "h", "p", "h" };
            Console.WriteLine(hon[Console.ReadLine() [ ^ 1] - '0'] + "on");
        }
    }
}

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

int main(){
    
    int n,s=0,r; cin >> n;
    int aa=n;
    while(n){
        r=n%10;
        s+=r;
        n=n/10;
    }
    //cout << s << "\n";
    if(aa%s==0)cout << "Yes";
    else cout << "No";
    
    return 0;
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int len = s.length();
    int count = 0;
    for(int i = 0; i < len; i++){
        if(s[i] != s[len-i-1]){
            count++;
            //cout << s[i] << " " << s[len-i-1] << endl;
        }
    }
    cout << count / 2 << endl;

    return 0;
}


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

int main() {
    int N,D;
    cin >> N >> D;
    int L = 2 * D + 1;
    int S = 0;
    int count = 0;

    while (true) {

        S = L + S;
        count++;

        if (S >= N) {
            break;
        }

    }

    cout << count << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long double l,ans;
	cin>> l;
	ans=l/3.0;
	ans=ans*ans*ans;
	printf("%Lf",ans);
	
	
}

Measured memory_bytes: 3744
n, k = map(int, input().split())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

P = 10**9 + 7
N = n-k+10
inv_t = [0]+[1]  # 逆元
for i in range(2, N):
    inv_t += [inv_t[P % i] * (P - int(P / i)) % P]

A.sort()
mini_count = 0
maxim_count = 0
pattern = 1
"""
minX, maxXとして選ばれるのはそれぞれ
minX:sortAの右からk番目(大きい数値からk個取った時の最小値)とそれより左の要素
maxX:sortAの左からk番目(小さい数値からk個取った時の最大値)とそれより右の要素
選ばれるパターンはminXの場合自分の要素より右にある要素からk-1個を選ぶパターン数
つまり最初は(k-1)C(k-1) = 1
選べる要素が一つ増えるごとに
tC(k-1) ⇒ (t+1)C(k-1)のように増えるので
t * t-1 * t-2 ... * t-k ⇒ t+1 * t * t-1 ... * t-k+1 であり
つまりパターン数は (t+1) / (t-k) 倍になる
"""
for idx in range(k, n + 1):
    mini = A[-idx]  #
    mini_count += mini * pattern % mod
    mini_count %= mod

    maxim = A[idx - 1]
    maxim_count += maxim * pattern % mod
    maxim_count %= mod

    pattern = pattern * (idx) * inv_t[idx + 1 - k] % mod # 割り算のmodは逆元をかける

ans = maxim_count - mini_count
ans %= mod

print(ans)


Measured memory_bytes: 14040
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
const ll MOD=1e9+7;
using namespace std;
const int nmax=8;
bool graph[nmax][nmax];

int dfs(int v,int N,bool visited[nmax]){
  bool all_visited=true;
  for(int i=0;i<N;i++){
    if(visited[i]==false){
      all_visited=false;
    }
  }
  if(all_visited){
    return 1;
  }
  int ret=0;
  for(int i=0;i<N;i++){
    if(graph[v][i]==false) continue;
    if(visited[i]) continue;

    visited[i]=true;
    ret+=dfs(i,N,visited);
    visited[i]=false;
  }
  return ret;
}

int main() {
  int N,M;
  cin >> N >> M;
  rep(i,M){
    int a,b;
    cin >> a >> b;
    graph[a-1][b-1]=graph[b-1][a-1]=true;
  }
  bool visited[nmax];
  rep(i,N){
    visited[i]=false;
  }
  visited[0]=true;
  cout << dfs(0,N,visited) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//main definations
#define UI unsigned int
#define LLI long long int
#define ULLI unsigned long long int
#define PI   3.14159258
void read_array(int *a, int n);
void write_array(int *a, int n);
void sort_array(int *a, int n);
//codechef only
#define TC for(UI defined_i=1;defined_i<=t;defined_i++)
using namespace std;
int main(){
	int n;
	cin>>n;
	int arr[n]={0};
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	
	int ans=n;
	for(int i=0;i<n-1;i++){
		if(arr[i]==arr[i+1]){
			ans=ans-2;
			i++;
		}
	}
	cout<<ans<<endl;
    return 0;
}
void read_array(int *a, int n){
	for(int i=0;i<n;i++){
		cin>>*(a+i);
	}
}
void write_array(int *a, int n){
	for(int i=0;i<n;i++){
		cout<<*(a+i)<<" ";
	}
}
void sort_array(int *a, int n){
	sort(a,a+n);
}

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

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int main(){
    int h, w;
    scanf("%d %d", &h, &w);
    int c[10][10];
    rep(i, 0, 10){
        rep(j, 0, 10){
            scanf("%d", &c[i][j]);
        }
    }
    rep(k, 0, 10){
        rep(i, 0, 10){
            rep(j, 0, 10){
                if(c[i][j] > c[i][k] + c[k][j]){
                    c[i][j] = c[i][k] + c[k][j];
                }
            }
        }
    }
    int ans = 0;
    rep(i, 0, h){
        rep(j, 0, w){
            int a;
            scanf("%d", &a);
            if(a != -1){
                ans += c[a][1];
            }
        }
    }
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int n, A[50];

int Solve(int i, int M){
    if(M==0) return 1;
    if(i>=n) return 0;
    int res = Solve(i+1,M) || Solve(i+1,M-A[i]);
    return res;
}


int main(void){
    int q,M;
    
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d", &A[i]);
    scanf("%d",&q);
    for(int i=0;i<q;i++){
        scanf("%d",&M);
        if(Solve(0,M)) printf("yes\n");
        else printf("no\n");
    }
    
    return 0;
}


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

int main() {
  int a, b, h, m;
    std::cin >> a >> b >> h >> m;
    double pi = 3.141592653589793;
    double rad_h = (30*h+0.5*m)*pi;
    double rad_m = (6*m)*pi;
    double x_h = a * sin(rad_h/180);
    double y_h = a * cos(rad_h/180);
    double x_m = b * sin(rad_m/180);
    double y_m = b * cos(rad_m/180);
    double length = sqrt((x_h - x_m) * (x_h - x_m) + (y_h - y_m) * (y_h - y_m));
    std::cout << setprecision(10) << length << '\n';
}

/*setprecision() 浮動小数点数を出力する精度を設定する。*/


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

int main()
{
  int P, Q, R;
  cin >> P >> Q >> R;
  cout << min((P+Q),min((Q+R),(P+R)))<< endl;
  return 0;
}


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

using namespace std;

int main()
{
    int n,w;

    cin>>n>>w;
    long dp[n+1][w+1];
    
    int W[n],V[n];
    
    for(int i=0;i<n;i++){
        
        cin>>W[i]>>V[i];
    }
    
    
    
    for(int i=0;i<=n;i++){
        for (int j=0;j<=w;j++){
            if(i==0 || j==0 ){
                dp[i][j]=0;
                
            }else if(W[i-1]<=j){
                
                dp[i][j] = max(V[i-1]+dp[i-1][j-W[i-1]],dp[i-1][j]);
                
            }else{
                dp[i][j]=dp[i-1][j];
            }
            
        }
    }
    
    cout<<dp[n][w];
    
    
}


Measured memory_bytes: 82468