akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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;}

string s;
ll cou[30];

int main(){
	cin>>s;
	ll ans=(s.size()+1)*s.size()/2-s.size()+1;
	for(int i=0;i<s.size();i++)
		cou[s[i]-'a']++;
	for(int i=0;i<26;i++)
		ans-=(cou[i])*(cou[i]-1)/2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string.h>
#include <queue>
#include <math.h>
#include <string>
#include <iostream>
#include <functional>
#include <set>
using namespace std;
typedef long long ll;

const int MN = 200000 + 5;
double arr[MN];

int main()
{
	int N, K;
	scanf("%d %d", &N, &K);


	for (int i = 1; i <= N; i++)
	{
		int k;
		scanf("%d", &k);
		arr[i] = (k + 1) / 2.0;
	}

	double sum = 0, mx = 0;
	for (int i = 1; i <= K; i++)
		sum += arr[i];
	mx = sum;
	for (int i = K + 1; i <= N; i++)
	{
		sum = sum - arr[i - K] + arr[i];
		mx = max(mx, sum);
	}
	printf("%lf", mx);

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  string s;
  cin >> s;
  if (s == "Sunny")
    cout << "Cloudy" << endl;
  else if (s == "Cloudy")
    cout << "Rainy" << endl;
  else if (s == "Rainy")
    cout << "Sunny" << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int N, M;

int main(){
    INIT;
    cin >> N >> M;
    int left = 0, right = N+1;
    REP(i,M) {
        int x,y; cin >> x >> y;
        left = std::max(left,x);
        right = std::min(right,y);
    }
    if(left > right) cout << 0 << "\n";
    else cout << right - left + 1 << "\n";
}

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

using namespace std;
typedef long long int ll;

int main()
{
    int h,w,a,b;
    scanf("%d %d %d %d", &h, &w, &a, &b);
    string zero_to_one = "";
    string one_to_zero = "";
    for (int i=0; i<w; i++)
    {
        if (i < a)
        {
            zero_to_one.push_back('0');
            one_to_zero.push_back('1');
        }
        else
        {
            zero_to_one.push_back('1');
            one_to_zero.push_back('0');
        }
    }

    for (int i=0; i<h; i++)
    {
        if (i < b) cout << zero_to_one << endl;
        else cout << one_to_zero << endl;
    }
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
  int a, b;
  int h[1000];
  int d;

  scanf("%d %d", &a, &b);
  d = b - a;
  h[1] = 1;
  for(int i = 2; i < 1000; i++){
    h[i] =  h[i-1] + i ;
  }

  for(int i = 0; i < 1000; i++){
    if(d == i + 1){
      printf("%d\n", h[i] - a);
    }
  }

}


Measured memory_bytes: 256
A, B, C, D = [int(i) for i in input()]
for i in "+-":
    for j in "+-":
        for k in "+-":
            ans = A + B if i == "+" else A - B
            ans = ans + C if j == "+" else ans - C
            ans = ans + D if k == "+" else ans - D
            if ans == 7:
                print(str(A) + i + str(B) + j + str(C) + k + str(D) + "=7")
                exit()


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

const ll MOD = 998244353;

int d[100009];

int main() {
  int n;
  cin >> n;
  rep(i, n) cin >> d[i];

  if (d[0] > 0) {
    cout << 0 << endl;
    return 0;
  }

  sort(d + 1, d + n);
  if (d[1] == 0) {
    cout << 0 << endl;
    return 0;
  }

  vector<int> cnt(n, 0);
  cnt[0] = 1;
  ll ans = 1;
  for (int i = 1; i < n; ++i) {
    ans = ans * cnt[d[i]-1] % MOD;
    ++cnt[d[i]];
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    int k;
    cin >> k;
    int sig[1000001];
    sig[0] = 0, sig[1] = 7 % k;
    int ans = -1;
    for (int i = 2; i <= k; i++)
    {
        sig[i] = (sig[i - 1] * 10 + 7) % k;
    }
    for (int i = 1; i <= k; i++)
    {
        if (sig[i] == 0)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 7512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n;
	ll a[105];
	while(cin >> n){
		ll sum=0;
		for(int i=0;i<n;i++){
			cin >> a[i];
		}
		for(int i=0;i<n-1;i++){
			for(int j=i+1;j<n;j++){
				sum+=a[i]*a[j];
			}
		}
		cout << sum << endl;
	}
}

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

int main(void) {
	int N[5];
	int ans = 0;
	for (int i = 0; i < 5; i++) {
		scanf("%d",&N[i]);
		if (N[i] == 0) {
			ans = i + 1;
		}
	}
	printf("%d", ans);

	return 0;
}


Measured memory_bytes: 3228
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.DecimalFormat;


public class Main {
	public static final double SQRT3 = Math.sqrt(3);
	public static final DecimalFormat df = new DecimalFormat("0.0000");

	double[] tmp = new double[8];
	
	public static void main(String[] args) throws IOException {
        new Main().exec();
    }
    
    public void exec() throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        
        int n = Integer.parseInt(br.readLine());
        
        double[] kc = kochCurve(n);
        
        for (int i=0; i<kc.length/2; i++) {
        	out.print(df.format(kc[i*2]));
        	out.print(' ');
        	out.println(df.format(kc[i*2+1]));
        }
        out.flush();
    }
    
    private double[] kochCurve(int n) {
    	double[] nextkc = new double[((int)Math.pow(2, 2*n)+1)*2];
    	double[] kc = null;
    	if(n==0) {
    		nextkc[2] = 100;
    	} else {
    		kc = kochCurve(n-1);
        	for(int i=0; i<kc.length-2; i+=2) {
        		kochCurveSub(kc[i],kc[i+1],kc[i+2],kc[i+3],nextkc,i*4);
        	}
        	nextkc[nextkc.length-1] = kc[kc.length-1];
        	nextkc[nextkc.length-2] = kc[kc.length-2];
    	}
    	return nextkc;
    }
    
    private void kochCurveSub(double sx, double sy, double ex, double ey, double[] nextkc, int ptr) {
    	nextkc[ptr+0] = sx;
    	nextkc[ptr+1] = sy;
    	if(sy==0 && ey==0){
        	double dx1 = (ex-sx)/3;
        	double dx2 = dx1/2;
        	double dy2 = dx1*SQRT3/2;
        	nextkc[ptr+2] = sx + dx1;
        	nextkc[ptr+4] = nextkc[ptr+2] + dx2;
        	nextkc[ptr+5] = dy2;
        	nextkc[ptr+6] = ex - dx1;
    	}else{
        	double dx1 = (ex-sx)/3;
        	double dy1 = (ey-sy)/3;
        	double dx2 = (dx1 - dy1*SQRT3)/2;
        	double dy2 = (dx1*SQRT3 + dy1)/2;
        	nextkc[ptr+2] = sx + dx1;
        	nextkc[ptr+3] = sy + dy1;
        	nextkc[ptr+4] = nextkc[ptr+2] + dx2;
        	nextkc[ptr+5] = nextkc[ptr+3] + dy2;
        	nextkc[ptr+6] = ex - dx1;
        	nextkc[ptr+7] = ey - dy1;
    	}
    }
    
}

Measured memory_bytes: 34992
#!/usr/bin/python

import sys

def solve(s):
    count = 0
    len_s = len(s)
    l = len_s // 2
    for i in range(l):
        if s[i] != s[len_s -1 -i]:
            count += 1

    print(count)

if __name__ == '__main__':
    s = sys.stdin.readline().strip()
    solve(s)

Measured memory_bytes: 38748
#include <stdio.h>

int main() {
	
	long k;
	scanf("%ld", &k);
	
	// R_n: repunit数
	// 7R_n は2, 5の倍数でない
	if (k % 2 == 0 || k % 5 == 0)
	{
		printf("-1");
		return 0;
	}
	
	long a = 0, n = 1; // a = a[0]
	
	while(1)
	{
		a = (10 * a + 7) % k; //a[n]
		if (a == 0)
		{
			printf("%ld", n);
			return 0;
		}
		n++;
	}
	
	return 0;
}



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

int main(){
  
  int n; cin>>n;
  vector<int> a(n);
  vector<int> c(1000001);
  for(auto &i:a) {
    cin>>i;
    c.at(i)++;
  }
  sort(a.begin(),a.end());
  if(a.at(0)==1){
    if(n>1&&a.at(1)==1){
      cout << 0 << endl;
      return 0;
    }
    else {
      cout << 1 << endl;
      return 0;
    }
  }
  vector<bool> b(n,1);
  for(int i=2; i<=1000; i++){
    for(int j=0; j<n; j++){
      if(a.at(j)==i) continue;
      if( (a.at(j)%i==0)&&( c.at(i)||c.at(a.at(j)/i) ) ){
        b.at(j) = 0;
      }
    }
  }
  int ans{};
  for(int i=0; i<n; i++){
    if(b.at(i)){
      if(i>0&&a.at(i)==a.at(i-1)) continue;
      if(i+1<n&&a.at(i)==a.at(i+1))continue;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 7956
//
// Created by Naman Bhalla on 2019-08-18.
//

#include <bits/stdc++.h>

using namespace std;

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


    int n;
    int now;
    priority_queue< long double > pq{};

    cin >> n;

    for(int i = 1; i <= n; ++i){
        cin >> now;
        pq.push(-now);
    }

    while(pq.size() > 1){
        long double now = pq.top();
        pq.pop();
        long double now2 = pq.top();
        pq.pop();

        pq.push((now + now2)/ 2);
    }

    cout << fixed << setprecision(12) << -pq.top() << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int n;
    static int m;
    static int[] a;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        System.out.println((int)((100 * (n - m)  + 1900 * m) * Math.pow(2, (double)m)));
    }
}



Measured memory_bytes: 21716
// Bismillahir Rahmanir Rahim  //
// Tanbir Ahmed  << RibNat >>  //
// University of Barisal       //



#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define     fast            ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     in1(X)          scanf("%lli",&(X))
#define     ins(S)          scanf("%s",(S))
#define     out(X)          printf("%lli",(X))
#define     outs(S)         printf("%s",(S))
#define     Pnl             printf("\n")
#define     End             return 0
#define     ll              long long int
#define     Pair            pair<ll,ll>
#define     F               first
#define     S               second
#define     all(v)          v.begin(),v.end()
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     Max             1000000000000000014
#define     Min             -1000000000000000014
#define     mod             1000000007
#define     range           100007

#define     pb              push_back
#define     Vector          vector<ll>
#define     mp              make_pair
#define     PI              3.1415926535897
#define     min_heap        priority_queue <ll, vector<ll>, greater<ll> >
#define     ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>  //*(x.find_by_order(k)),x.order_of_key(k)

/*************** #Template FUNCTIONS# **************/

// ll pc;void PrintCase(){printf("Case %lli: ",++pc);}
// ll GCD(ll a,ll b){if(a<0) a*=-1;if(b<0) b*=-1;if(a<b)swap(a,b);if(b==1) return 1;if(!b) return a;if(!(a%b)) return b;else return GCD(b,a%b);}
//  ll LCM(ll a,ll b){ll x=GCD(a,b);return (a/x)*b;}
// ll bigmod(ll n,ll p){if(p==0) return 1;if(p==1)return (n+mod)%mod;if(p%2)return (bigmod(n,p-1)*n+mod)%mod;else{ll x=bigmod(n,p/2);return (x*x+mod)%mod;}}
 ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
// ll modinverse(ll n){return bigmod(n,mod-2)%mod;}
// ll Check(ll n,ll i){return (n&(1LL<<i));}
// ll Set(ll n,ll i){return (n|(1LL<<i));}
// ll status[(ll)range/64+5];Vector primes;void sieve(){for(ll i=3;i<=sqrt(range);i+=2){if(Check(status[i/64],i%64)==0){for(ll j=i*i;j<range;j+=2*i){status[j/64]=Set(status[j/64],j%64);}}}primes.pb(2);for(ll i=3;i<range;i+=2)if(Check(status[i/64],i%64)==0)primes.pb(i);}

// ll dx[] = {-2, -1, 1, 2,  2,  1, -1, -2};
// ll dy[] = { 1,  2, 2, 1, -1, -2, -2, -1};

// ll X[]= {0,0,1,-1,1,1,-1,-1};
// ll Y[]= {1,-1,0,0,1,-1,1,-1};

/********************** START **********************/



int main(){
    ll n,k,i,j;
    cin>>n>>k;
    ll a[n+10];
    mem(a,0);
    while(k--){
        ll p;
        cin>>p;
        while(p--){
            ll x;
            cin>>x;
            a[x]++;
        }
    }

    ll ans=0;

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

    cout<<ans<<endl;

}



/*******      ALHAMDULILLAH     *********/  
/*******      Happy Coding      *********/


Measured memory_bytes: 3576
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(n => n.split(''));

  const a = s[0][0];
  const b = s[1][0];
  const c = s[2][0];

  const ans = String(a + b + c).toUpperCase();

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11468
main :: IO ()
main = getLine >>= putStrLn . ordToStr . myCompare . map read . words

myCompare :: [Int] -> Ordering
myCompare [a, b] = a `compare` b

ordToStr :: Ordering -> String
ordToStr LT = "a < b"
ordToStr EQ = "a == b"
ordToStr GT = "a > b"

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  vector<int> num(N);
  REP(i, N) cin >> num[i];

  set<string> num_set;
  REP(i, N) {
    string t;
    for (int j = i; j < N; j++) {
      if (j - i + 1 > 6) break;
      t.push_back(num[j] + '0');
      num_set.insert(t);
    }
  }

  REP(i, 1e6) {
    if (num_set.find(to_string(i)) == num_set.end()) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    vector<vector<ll>> a(3,vector<ll>(3));
    rep(i,3){
        rep(j,3){
            cin>>a[i][j];
        }
    }

    ll n,b,ans=0;
    cin>>n;
    rep(i,n){
        cin>>b;
        rep(j,3){
            rep(k,3){
                if(a[j][k]==b) a[j][k]=0;
            }
        }
    }
    rep(i,3){
        ll sum=0;
        rep(j,3){
            sum+=a[i][j];
        }
        if(sum==0) ans=1;
    }
    rep(j,3){
        ll sum=0;
        rep(i,3){
            sum+=a[i][j];
        }
        if(sum==0) ans=1;
    }
    if(a[0][0]+a[1][1]+a[2][2]==0||a[0][2]+a[1][1]+a[2][0]==0) ans=1;
    cout<<(ans==1?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
/**
   Stack
   <Reverse Polish Notation>
   e.g. 
   input:  1 2 + 3 4 - * 
   output: -3
   
   Shunji Lin
   17/12/2015
**/

#include <string>
#include <stack>
#include <iostream>
#include <cstdlib>

int main() {
  
  std::string word; //read expression one by one
  std::stack<int> S; 
  int current1;
  int current2;

  while (std::cin >> word) {
    if (word == "+") {
      current1 = S.top();
      S.pop();
      current2 = S.top();
      S.pop();
      S.push(current1 + current2);
    }
    else if (word == "-") {
      current1 = S.top();
      S.pop();
      current2 = S.top();
      S.pop();
      S.push(current2 - current1); // order matters!
    }
    else if (word == "*") {
      current1 = S.top();
      S.pop();
      current2 = S.top();
      S.pop();
      S.push(current1 * current2);
    } else {
      S.push(atoi(word.c_str()));
    }
  }
  std::cout << S.top() << std::endl;
  
}

Measured memory_bytes: 1200
N=int(input())
T=[]
A=[]
for i in range(N):
    t,a=map(int,input().split())
    T.append(t)
    A.append(a)

Tnow=T[0]
Anow=A[0]


for i in range(1,N):
    t=T[i]
    a=A[i]
    t1=(Tnow+t-1)//t*t
    a1=t1//t*a
    a2=(Anow+a-1)//a*a
    t2=a2//a*t
    if a1<Anow:
        Tnow=t2
        Anow=a2
    elif t2<Tnow:
        Tnow=t1
        Anow=a1
    elif t1+a1<=t2+a2:
        Tnow=t1
        Anow=a1
    else:
        Tnow=t2
        Anow=a2
print(Tnow+Anow)


Measured memory_bytes: 9104
import itertools
import math

n = int(input())
X = [[] for _ in range(n)]
Y = [[] for _ in range(n)]

for i in range(n):
    X[i], Y[i] = map(int, input().split())

Dist = [0 for _ in range(math.factorial(n))]
for i, S in enumerate(itertools.permutations(range(n))):
    for j in range(len(S) - 1):
        Dist[i] += ((X[S[j+1]] - X[S[j]])**2 + (Y[S[j+1]] - Y[S[j]])**2)**(1/2)
print(sum(Dist)/len(Dist))

Measured memory_bytes: 43884
n = int(input())

word = {}
x = set()
for i in range(n):
    s = str(input())
    x.add(s)
    if not s in word :
        word[s] = 1
    else:
        word[s] = int(word[s]) + 1

m = sorted(word.values(),reverse=True)
items_sorted = sorted(word.items())

for i in range(len(x)):
    if items_sorted[i][1] == m[0]:
        print(items_sorted[i][0])


Measured memory_bytes: 53924
import java.util.Scanner;

public class Main {

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

			int[] a = {1,3,5,7,8,10,12};
			int[] b = {4,6,9,11};

			int tmpX = 0;
			int tmpY = 0;
			for (int i : a) {
				if (i == x) {
					tmpX = 1;
				}
				if (i == y) {
					tmpY = 1;
				}
			}
			for (int i : b) {
				if (i == x) {
					tmpX = 2;
				}
				if (i == y) {
					tmpY = 2;
				}
			}
			if (tmpX == tmpY) {
				System.out.println("Yes");
				return;
			}
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23252
import sys
import math

lines = sys.stdin.readlines()
K = int(lines[0])
X = lines[1].split(' ')

A = int(X[0])
B = int(X[1])

n = math.ceil(A/K)-1
m = int(B/K)

if m-n >0:
    print('OK')
else:
    print('NG')

Measured memory_bytes: 9140
S = input()

MOD = 1000000007

# a_b_c, a_b_hc, a_hb_c, a_hb_hc, ha_b_c, ha_b_hc, ha_hb_c, ha_hb_hc
count = [[0, 0, 0] for _ in range(8)]
hatena_count = 0

for c in S:
    if c == 'A':
        nums = [0,1,2,3]
        for num in nums:
            count[num][0] += 1
    elif c == 'B':
        nums = [0,1,4,5]
        for num in nums:
            count[num][1] += count[num][0]
    elif c == 'C':
        nums = [0,2,4,6]
        for num in nums:
            count[num][2] += count[num][1]
    elif c == '?':
        # hc
        nums = [1,3,5,7]
        for num in nums:
            count[num][2] += count[num][1]
        
        # hb
        nums = [2,3,6,7]
        for num in nums:
            count[num][1] += count[num][0]

        # ha
        nums = [4,5,6,7]
        for num in nums:
            count[num][0] += 1
        
        hatena_count += 1

total = 0
coef = [0, 1, 1, 2, 1, 2, 2, 3]
for i in range(8):
    total += count[i][2] * 3**(hatena_count - coef[i])

print(int(total % MOD))

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

#define ll long long
#define ld long double
#define ull unsigned long long
#define pw(x) (1LL << (x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

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

    string s;
    cin >> s;

    int n = s.length();
    int a_index = 0, z_index = n - 1;
    // cout << n << " " << s[z_index] << '\n';
    while (s[a_index] != 'A')
        ++a_index;
    while (s[z_index] != 'Z')
        --z_index;

    // cout << a_index << " " << z_index << '\n';
    cout << z_index - a_index + 1 << '\n';

    return 0;
}

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

using namespace std;

int main(){
	string s;
	cin >> s;

	int count = 0;

	for(int i=0;i<3;i++){
		if(s[i] == '1'){
			count++;
		}
	}

	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a,b,ma,mi;
	cin>>a>>b;
	ma=max(a,b);
	mi=min(a,b);
	if(16-(a+b+((ma-mi)*2))>=0){
		cout<<"Yay!"<<endl;
	}else{
		cout<<":("<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  if (N % 1111 == 0){
    cout << "Yes" << endl;
  }
  else if (N /10 % 111 == 0){
    cout << "Yes" << endl;
  }
  else if ((N - (N / 1000 * 1000)) % 111 == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cmath>

#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int n;
int a,b,c,d;
int f(int w) {
    char ary[103][103]={};
    pair<int,int> P['Z'];

    rep(i,103) rep(j,w) {
        int t = i*w+j;
        if(t==a) P['A'] = pair<int,int>(i,j);
        if(t==b) P['B'] = pair<int,int>(i,j);
        if(t==c) P['C'] = pair<int,int>(i,j);
        if(t==d) P['D'] = pair<int,int>(i,j);
    }

    int res = 0;
    res += abs(P['A'].first - P['B'].first);
    res += abs(P['A'].second - P['B'].second);
    res += abs(P['C'].first - P['D'].first);
    res += abs(P['C'].second - P['D'].second);

    return res;
}
int main() {
    cin>>n;
    cin>>a>>b>>c>>d;
    a--;
    b--;
    c--;
    d--;

    int ans=1000000;

    for(int i=1;i<=n;i++) {
        ans=min(ans,f(i));
    }
    
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 1164
import math
def trial_division(n):
	factor = []
	while n%2 == 0:
		factor.append(2)
		n //= 2
	f = 3
	while f <= math.sqrt(n):
		if n%f == 0:
			factor.append(f)
			n //= f
		else :
			f += 2
	if n!= 1:
		factor.append(n)
	return factor

def main():
	cds = set()
	cds.add(1)
	a,b = map(int,input().split())
	primes_a = trial_division(a)
	primes_b = trial_division(b)
	if primes_a != None and primes_b != None :
		for prime in primes_a:
			if prime in primes_b:
				cds.add(prime)
	print(len(cds))
main()

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;



int main(void){
    string s;
    cin>>s;
    int ans = 0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='+')ans++;
        else ans--;
    }
    cout<<ans<<endl;
	return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>
#include <new>

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define MOD (ll)(1e9 + 7)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" ; "IMPOSSIBLE")

using ll = long long int;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

ll modPow(ll x, ll a) {
    if (a == 1) return x;
    if (a % 2) return (x * modPow(x, a - 1)) % MOD;
    ll t = modPow(x, a / 2);
    return ((t % MOD) * (t % MOD)) % MOD;
}

ll modInv(ll x) {
    return modPow(x, MOD - 2);
}

ll modComb(ll n, ll k) {
    ll tmp = 1;
    for (int i = 0; i < k; i++) {
        tmp *= n - i;
        tmp %= MOD;
    }
    for (int i = 1; i <= k; i++) {
        tmp *= modInv(i);
        tmp %= MOD;
    }
    return tmp;
}

ll S;
ll ans = 0;

int main() {
    cin >> S;
    ll three_num = S / 3;
    rep(i, three_num) {
        //i + 1が数列の長さ
        ll tmpS = S - 3 * (i + 1);

        //tmpSをどう分配するか
        //i本の仕切りがあるとする
        //この仕切りでくぎったi + 1の空間に重複を許して1をおく
        //(tmpS + i)! / tmpS! * i!

        ans += modComb(tmpS + i, i);
        ans %= MOD;

    }

    cout << ans << endl;
}

Measured memory_bytes: 3620
function Main(input){
    input = String(input);
    var first = input.substring(0,1);
    var third = input.substring(2,3);

    if(first === third){
        console.log('Yes');
    }else{
        console.log('No');
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
    ll a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    ll ans = 1000000001;
    ans = min(ans, a*x+b*y); //全部A B
    ans = min(ans, max(x, y)*c*2);//AB
    if(x>y){
        ans = min(ans, y*2*c+(x-y)*a);
    }
    else{
        ans = min(ans, x*2*c+(y-x)*b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int ri = 0;
    ll sum = 0, ans = 0;
    for (int le = 0; le < n; le++) {
        while (ri < n && (sum ^ a[ri]) == (sum + a[ri])) sum ^= a[ri++];
        ans += ri - le;
        if (le == ri) ri++;
        else sum ^= a[le];
    }
    cout << ans << endl;
}

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

int main()
{
    int N, Ai;
    cin >> N;
    vector<int> A;
    long long sum = 0;
    for(int i=0; i<N; i++){
        cin >> Ai;
        A.push_back(Ai-(i+1));
        sum += Ai - (i+1);
    }
    sort(A.begin(), A.end());
    int b = 0;
    if(N%2==0){
        auto b1 = A.at(A.size()/2);
        auto b2 = A.at((A.size()/2)-1);
        b = (b1+b2)/2;
    }else{
        b = A.at(A.size()/2);
    }
    size_t Min = 0;
    for(auto v : A){
        Min += abs((int)(v-b));
    }
    cout<<Min<<endl;
    return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
#define ll long long int
#define ld long double
#define vec vector<ll>
#define pb push_back
#define mp make_pair
#define sz size()
#define ff first
#define ss second
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"
#define inf LLONG_MAX
#define f(i,a,b) for(i=a;i<b;i++)
#define PI 3.141592653589793238
const ll mod=1000000007; 
// const ll high=1e5+5;
using namespace std;
ll lcm(ll n,ll m)
{
    return (n*m)/__gcd(n,m);
}
void solve()
{
    ll n,m,i,j,k;
    cin>>n;
    ll a[n][3]={0};
    f(i,0,n)cin>>a[i][0]>>a[i][1]>>a[i][2];
    vector<vector<ll>> dp(n+1,vector<ll>(3,0));
    for(i=0;i<n;i++)
    {
        for(j=0;j<3;j++)
        {
            for(k=0;k<3;k++)
            {
                if(j==k)continue;
                dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i][k]);
            }
        }
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
}
int32_t main()
{
    fast
    ll q=1;
    // cin>>q;
    while(q--)solve();
    return 0;
}

Measured memory_bytes: 8064
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}

void func(void)
{
//DEBUG_OUT("----\n");
    string s;
    cin >> s;

    uint32 len = s.length();

    cout << s[0] << (len-2) << s[len-1] << endl;
    
    return;
}



Measured memory_bytes: 256
x,y=input().split()
if x=='A':
  a=10
elif x=='B':
  a=11
elif x=='C':
  a=12
elif x=='D':
  a=13
elif x=='E':
  a=14
elif x=='F':
  a=15
else:
  a=int(x)
if y=='A':
  b=10
elif y=='B':
  b=11
elif y=='C':
  b=12
elif y=='D':
  b=13
elif y=='E':
  b=14
elif y=='F':
  b=15
else:
  b=int(y)
if a>b:
  print('>')
elif a<b:
  print('<')
else:
  print('=')

Measured memory_bytes: 62004
// Copyright 2019 yaito3014
#include "bits/stdc++.h"
using namespace std;
using namespace literals;

constexpr int64_t Mod = 998244353;

int64_t modpow(int64_t a, int64_t b, int64_t c = 1) {
    if (b == 0)return c;
    if (b % 2)c = a * c % Mod;
    return modpow(a * a % Mod, b / 2, c);
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> D(N);
  for (auto& v : D)cin >> v;
  int M = *max_element(begin(D), end(D));
  vector<int> t(M + 1, 0);
  for (auto& v : D)++t[v];
  if (D[0] != 0 || t[0] != 1) {
    cout << 0 << endl;
    return 0;
  }
  int64_t ans = 1;
  for (int i = 0; i < M; ++i)
    ans = ans * modpow(t[i], t[i + 1]) % Mod;
  cout << ans << endl;
}


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

int main() {
	int A , B ;
	cin >> A >> B ;
	if (A>B) {
		cout << 2*A-1 << endl;
	} else if (A<B) {
		cout << 2*B-1 << endl;
	} else if (A=B) {
		cout << 2*A << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int cost[1000][1000];
int mincost[1000];
char used[1000];
int V;

int min(int a, int b){
	if (a > b){
		return (b);
	}
	return (a);
}

int prim(void)
{
	int i;
	int res;
	int u, v;
	
	for (i = 0; i < V; i++){
		mincost[i] = 1000000000;
		used[i] = 0;
	}
	
	mincost[0] = 0;
	res = 0;
	
	while (1){
		v = -1;
		for (u = 0; u < V; u++){
			if (!used[u] && (v == -1 || mincost[u] < mincost[v])){
				v = u;
			}
		}
		
		if (v == -1){
			break;
		}
		used[v] = 1;
		res += mincost[v];
		
		for (u = 0; u < V; u++){
			mincost[u] = min(mincost[u], cost[v][u]);
		}
	}
	return (res);
}

int main(void)
{
	int num, from, to, dist;
	int ans;
	int i, j;
	
	while (1){
		scanf("%d", &V);
		if (V == 0){
			break;
		}
		scanf("%d", &num);
		
		for (i = 0; i < V; i++){
			for (j = 0; j < V; j++){
				cost[i][j] = 1000000000;
			}
		}
		
		for (i = 0; i < num; i++){
			scanf("%d,%d,%d", &from, &to, &dist);
			cost[from][to] = cost[to][from] = (dist / 100) - 1;
		}
		ans = prim();
		printf("%d\n", ans);
	}
	return (0);
}

Measured memory_bytes: 0
#include <stdio.h>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> pi;
typedef long long int ll;
#define F first
#define S second
#define MP make_pair
const int N=5e5+10;
const ll INF=1LL<<60;
ll dis(pi a,pi b){
    ll x=a.F-b.F,y=a.S-b.S;
    return x*x+y*y;
}
int main(){
    int n,lim;
    ll ans=INF;
    pi a[N];
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d%d",&a[i].F,&a[i].S);
    sort(a,a+n);
    lim=min(13,n);
    for(int i=0;i<lim;i++)for(int j=i+1;j<lim;j++)ans=min(ans,dis(a[i],a[j]));
    for(int i=lim;i<n;i++)for(int j=1;j<lim;j++)ans=min(ans,dis(a[i],a[i-j]));
    printf("%lld\n",ans);
}


Measured memory_bytes: 6612
n,u,v=map(int,input().split())
ki=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  ki[a].append(b)
  ki[b].append(a)
# 次数
dn=[len(ki[i]) for i in range(n)]
inf=float('inf')
dt=[inf]*n
da=[inf]*n
u,v=u-1,v-1
from collections import deque
todo=deque([u])
dt[u]=0
while todo:
  x=todo.popleft()
  for nx in ki[x]:
    if dt[nx]>dt[x]+1:
      dt[nx]=dt[x]+1
      todo.append(nx)
todo=deque([v])
da[v]=0
while todo:
  x=todo.popleft()
  for nx in ki[x]:
    if da[nx]>da[x]+1:
      da[nx]=da[x]+1
      todo.append(nx)
ans=0
for i in range(n):
  if dn[i]>1 and dt[i]<=da[i]:ans=max(ans,da[i])
print(ans)
exit()
print(dn)
print(dt)
print(da)

Measured memory_bytes: 95796
#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define X first
#define Y second
#define pb push_back
#define MAXN 21010
#define Scan(a) scanf("%I64d", &a)
#define CLR(a) memset(a,0,sizeof(a))
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORE(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)

using namespace std;

typedef pair<int, int> II;
typedef vector<II> vi;

int n, m;
bool a[10][10];
int permu[10];

int main()
{
    ios::sync_with_stdio(0);
    //freopen("inp.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> n >> m;
    FOR(i,1,m) {
        int u, v;
        cin >> u >> v;
        a[u][v] = a[v][u] = true;
    }
    FOR(i,1,n) permu[i] = i;
    int res = 0;
    do {
        if (permu[1] != 1) break;
        bool co = true;
        FOR(i,2,n)
            if (!a[permu[i]][permu[i-1]]) {
                co = false;
                break;
            }
        if (co) res++;
    } while (next_permutation(permu+1, permu+n+1));
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = std::vector<int>;
using VI2D = std::vector<vector<int>>;
using VLL = std::vector<long long>;
using VLL2D = std::vector<vector<long long>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

bool solve(int a, int b, int c, int k) {
	if(k == 0) {
		return a < b && b < c;
	}

	if(a < b && b < c) {
		return true;
	}

	return solve(a * 2, b, c, k - 1) || solve(a, b * 2, c, k - 1) ||
		   solve(a, b, c * 2, k - 1);
}

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

	if(solve(a, b, c, k)) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;
import java.io.PrintWriter;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int N = Integer.parseInt(sc.next());

        int[] A = new int[N]; //Aを配列で受け取る
        for (int i = 0; i < N; i++ ){
            A[i] = Integer.parseInt(sc.next()) - 1; //0-indexedにしたいのであらかじめ1引いておく
        }
        int B[] = new int[N]; //Bを配列で受け取る
        for (int i= 0; i < N; i++){
            B[i] = Integer.parseInt(sc.next());
        }
        int C[] = new int[N-1]; //Cを配列で受け取る
        for (int i=0; i<N-1; i++){
            C[i] = Integer.parseInt(sc.next());
        }

        int point = B[A[0]]; //最初の1食目はその料理の満足度のみ加算される
        for (int i = 1; i < N; i++){
            point += B[A[i]]; //料理を食べたときの満足度Biを足す
            if (A[i] == A[i-1] + 1){ //もし1個前の料理の番号が今回の料理の番号-1ならCiを足す
                point += C[A[i-1]];
            }
        }
        out.println(point);

        //テンプレ
        sc.close();
        out.flush();
    }
}

Measured memory_bytes: 35504
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

signed main()
{
  cin.tie(nullptr), ios::sync_with_stdio(false);

  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  if (a[0] + a[1] == a[2]) {
    cout << "Yes" << LF;
  } else {
    cout << "No" << LF;
  }

  return 0;
}



Measured memory_bytes: 256
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<algorithm>
#include <sstream>
#include<string>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include<string.h>
#include<memory.h>
using namespace std;
#define inf 1000000007
#define int long long
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
double pi = 3.141592653589793;
//ここから下
struct edge{int u,v,cost;};
bool comp(const edge&e1,const edge&e2){
    return e1.cost<e2.cost;
}
edge es[214514];
int v,e;

int par[100005];
int lank[100005];

void init(int n){
    for(int i=0; i<n; i++){
        par[i]=i;
        lank[i]=0;
    }
}
int find(int x){
    if(par[x]==x){
        return x;
    }else {
        return par[x]=find(par[x]);
    }
}
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(lank[x]<lank[y]){
        par[x]=y;
    }else {
        par[y]=x;
        if(lank[x]==lank[y])lank[x]++;
    }
}
bool same(int x,int y){
    return find(x)==find(y);
}
int kruskal(){
    sort(es,es+e,comp);
    init(v);
    int res=0;
    rep(i,0,e){
        edge e=es[i];
        if(!same(e.u,e.v)){
            unite(e.u,e.v);
            res+=e.cost;
        }
    }
    return res;
}

signed main(){
    cin>>v>>e;
    rep(i,0,e){
        int a,b,c;cin>>a>>b>>c;
        es[i]=edge{a,b,c};
        es[i+e]=edge{a,b,c};
    }
    e*=2;
    cout<<kruskal()<<endl;
    return 0;
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
 
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	VI fc(n);
	rep(i, n) rep(j, 10){
		int z; cin >>z;
		if(z==1) fc[i] |= 1<<j;
	}
	vector<VI> p(n, VI(11));
	rep(i, n) rep(j, 11) cin >>p[i][j];
	
	ll ans = -1LL<<60;
	rep2(i, 1, 1<<10){
		ll sm =0;
		rep(k, n){
			int jk = __builtin_popcount(i & fc[k]);
			sm += p[k][jk];
		}
		ans = max(ans, sm);
	}
	
	cout << ans <<"\n";
	return 0;
}


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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;

int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N, x; cin >> N >> x;
    vector<int> v(N);
    int res = 0;
    REP(i, N) {
        cin >> v[i];
    }
    sort(v.begin(),v.end());
    REP(i, N) {
        x -= v[i];
        if (x >= 0) {
            res++;
            if (i == N-1 && x > 0) res--;
        }
        else break;
    }
    cout << res << endl;
    return 0;
}


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

int CostCalc(vector<int> _X, int _P){
  
  int i, Cost = 0;
  for (i = 0; i < _X.size(); i++){
    Cost += pow((_P - _X.at(i)), 2);
  }
  return Cost; 
}

int main(){
  
  int N, i, Min = 1000000;
  cin >> N;
  vector<int> X(N);
  
  for (i = 0; i < N; i++) cin >> X.at(i);
  
  for (i = 1; i <= 100; i++){
    
    Min = min(CostCalc(X, i), Min); 
  }
  
  cout << Min << endl;
  return 0;
}

Measured memory_bytes: 256
#19:32
n = int(input())
raw = []
eo = []
h = 30
for _ in range(n):
  x,y = map(int,input().split())
  raw.append([x,y])
  eo.append((x+y)%2)
if sum(eo) == 0:
  print(h+2)
  d = [2**(h-i) for i in range(h+1)]
  d.append(1)
  print(' '.join(map(str,d)))
elif sum(eo) == n:
  print(h+1)
  d = [2**(h-i) for i in range(h+1)]
  print(' '.join(map(str,d)))
else:
  print(-1)
  exit()
for xy in raw:
  x,y = xy
  scale = 2 ** h
  ans = ''
  while scale != 0:
    tmp = [[0,0,'U'],[0,1,'D'],[0,2,'R'],[0,3,'L']]
    tmp[0][0] =   x   ** 2 + (y-1) ** 2
    tmp[1][0] =   x   ** 2 + (y+1) ** 2
    tmp[2][0] = (x-1) ** 2 +   y   ** 2
    tmp[3][0] = (x+1) ** 2 +   y   ** 2
    d,dr = min(tmp)[1],min(tmp)[2]
    ans += dr
    if d == 0:
      y -= scale
    elif d == 1:
      y += scale
    elif d == 2:
      x -= scale
    else:
      x += scale
    scale //= 2
  if x+y != 0:
    if y == 1:
      ans += 'U'
    elif y == -1:
      ans += 'D'
    elif x == 1:
      ans += 'R'
    else:
      ans += 'L'
  print(ans)

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		String[] S = sc.next().split("");
		if (S.length != A + B + 1) {
			System.out.println("No");
			return;
		}
		for (int i = 0; i < A; i++) {
			try {
				Integer.parseInt(S[i]);
			} catch (Exception e) {
				System.out.println("No");
				return;
			}
		}
		if (!(S[A].equals("-"))) {
			System.out.println("No");
			return;
		}
		for (int i = A + 1; i < A + B + 1; i++) {
			try {
				Integer.parseInt(S[i]);
			} catch (Exception e) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}

}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
vector<pair<ll,ll>>v1;

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 

int main()
{
  ll n,i,a,b,sum;
  cin>>n;
  for(i=1;i<=n;i++)
  {
    cin>>a>>b;
    v1.pb(mp(a,b));

  }

  sort(v1.begin(), v1.end(), sortbysec); 
  sum=0;

  for(i=0;i<v1.size();i++)
  {
     sum = sum + v1[i].fi;
     if(sum>v1[i].se)
     {
       cout<<"No\n";
       return 0;
     }
  }
  cout<<"Yes\n";

  return 0;
}

Measured memory_bytes: 6512