akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long int
#define dl double long

using namespace std;

const ll NN = 1e10 + 7;
const int N = 1e5 + 7;
const int M = 11;
const ll mod = 1e9 + 7;

void solve1()
{
	int n;
	cin >> n;
	if(n >= 30)
		cout << "Yes";
	else
		cout << "No";
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );
	//freopen( "moobuzz.in" , "r" , stdin );
    //freopen( "moobuzz.out" , "w" , stdout );
    
    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 3620
#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) {
	int64 N, K;
	cin >> N >> K;
	string s;
	cin >> s;
	vector<int64> a(N);
	REP(i, N) a[i] = s[i]-'0';
	vector<int64> len;
	int64 cnt = 0;
	REP(i, N) {
		if (i == 0 || a[i] == a[i-1]) {
			cnt++;
		} else {
			len.push_back(cnt);
			cnt = 1;
		}
	}
	len.push_back(cnt);

	vector<int64> sum(len.size()+1, 0);
	REP(i, len.size()) sum[i+1] += sum[i] + len[i];
	int64 res = 0;
	REP(i, len.size()) {
		if ((a[0]==0)^(i%2==0) == 0) {
			res = max(res, sum[min((int64)sum.size()-1, i+2*K)]-sum[i]);
		} else {
			res = max(res, sum[min((int64)sum.size()-1, i+2*K+1)]-sum[i]);
		}
	}
	cout << res << endl;
}


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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T> inline bool changeMinimum(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T> inline bool changeMaximum(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {
    string S;
    cin >> S;
    int M = S.length();
    int zan = 15- M;
    int c = 0;
    for (int i = 0; i < M; ++i) {
        char ch = S[i];
        if (ch == 'o'){
            c++;
        }
    }
    string ans;
    if(c + zan >=8){
        ans = "YES";
    }
    else{ans = "NO";}

    
    
    cout << ans << endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>


using namespace std;

int main(){
    int y, m, d;
    char a, b;
    cin >> y >> a >>  m >> b >> d;
    if (m<=4) cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}

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

int main(){
    int x, a, b, tmp = 0;

    cin >> x >> a >> b;

    tmp = b - a;

    if(tmp > 0 && tmp <= x){
        cout << "safe" << endl;
    }else if(tmp >= x + 1){
        cout << "dangerous" << endl;
    }else{
        cout << "delicious" << endl;
    }


  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iterator>
#include <fstream>
#include <math.h>

#include <random>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <list>
#include <bitset>
#include <unordered_set>
#include <unordered_map>

#include <random>
#include <ctime>

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define FOR(i, from, to) for (int i = from; i < to; i++)
#define ROF(i, from, to) for (int i = from; i > to; i--)

const long double PI = 3.141592653589793238463;
const int INF = 0x3f3f3f3f;
const int INFS = 1000000000;
const ll M = 1000000007;
const ll LLINF = 1000000000000000000;
const double EPS = 1e-8;

#define int long long

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

    int n, d = 0;
    cin >> n;
    vector<int> a(n), cnt(n, 0);
    FOR(i, 0, n) {
        cin >> a[i];
        d = max(d, a[i]);
        ++cnt[a[i]];
    }
    int hl;
    if (d % 2) {
        hl = (d + 1) / 2;
        FOR(i, hl, d + 1) {
            cnt[i] -= 2;
            if (cnt[i] < 0) {
                cout << "Impossible" << "\n";
                return 0;
            }
        }
    } else {
        hl = d / 2;
        cnt[hl] -= 1;
        if (cnt[hl] < 0) {
            cout << "Impossible" << "\n";
            return 0;
        }
        FOR(i, hl + 1, d + 1) {
            cnt[i] -= 2;
            if (cnt[i] < 0) {
                cout << "Impossible" << "\n";
                return 0;
            }
        }
    }
    FOR(i, 1, hl + 1) {
        if (cnt[i] > 0) {
            cout << "Impossible" << "\n";
            return 0;
        }
    }
    cout << "Possible" << "\n";

    return 0;
}


Measured memory_bytes: 3616
if __name__ == '__main__':
    N, C = map(int, input().split())
    values = [list(map(int, input().split())) for _ in range(N)]
    xs, vs = zip(*values)

    # clock = clockwise, aclock = anti-clockwise
    clock_cum = []
    clock_max = []
    aclock_cum = []
    aclock_max = []
    for i in range(N):
        if i == 0:
            cum_i = vs[i] - xs[i]
            max_i = max(0, cum_i)

            acum_i = vs[N - i - 1] - (C - xs[N - i - 1])
            amax_i = max(0, acum_i)
        else:
            cum_i = clock_cum[-1] + xs[i - 1] + vs[i] - xs[i]
            max_i = max(clock_max[-1], cum_i)

            acum_i = aclock_cum[-1] + (C - xs[N - i - 1 + 1]) + vs[N - i - 1] - (C - xs[N - i - 1])
            amax_i = max(aclock_max[-1], acum_i)

        clock_cum.append(cum_i)
        clock_max.append(max_i)
        aclock_cum.append(acum_i)
        aclock_max.append(amax_i)

    best = 0
    for i in range(N):
        if i != N - 1:
            # clock or clock -> return -> aclock
            best = max(best, clock_cum[i],
                       clock_cum[i] - xs[i] + aclock_max[N - i - 2])
            # aclock or aclock -> return -> clock
            best = max(best, aclock_cum[i],
                       aclock_cum[i] - (C - xs[N - i - 1]) + clock_max[N - i - 2])
        else:
            best = max(best, clock_cum[i])
            best = max(best, aclock_cum[i])

    print(best)


Measured memory_bytes: 40880
#include <iostream>

using namespace std;

#define MAX 100
#define INFTY 9999999 
#define WHITE 0
#define GRAY 1
#define BLACK 2

int M[MAX][MAX];
int color[MAX];
int d[MAX];
int p[MAX];
int n;

int prim()
{
	int mincost;
	int u;

	for (int i = 0; i < MAX; i++) {
		d[i] = INFTY;
		p[i] = -1;
	}

	d[0] = 0;
	p[0] = -1;

	while (true) {
		mincost = INFTY;

		for (int i = 0; i < n; i++) {
			if (color[i] != BLACK&&d[i] < mincost) {
				mincost = d[i];
				u = i;
			}
		}


		if (mincost == INFTY) {
			break;
		}

		color[u] = BLACK;

		for (int i = 0; i < n; i++) {
			if (color[i] != BLACK&&M[u][i] != -1) {
				if (M[u][i] < d[i]) {
					d[i] = M[u][i];
					p[i] = u;
					color[i] = GRAY;
				}
			}
		}
	}


	int sum = 0;

	for (int i = 0; i < n; i++) {
		if (p[i] != -1) {
			sum += M[i][p[i]];
		}
	}

	return sum;

}



int main(void)
{



	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> M[i][j];
		}
	}

	cout << prim() << endl;

	return 0;
}

Measured memory_bytes: 3116
#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 a, b, c;
  cin >> a >> b >> c;
  if(a>b) swap(a,b);
  if(a>c) swap(a,c);
  if(b>c) swap(b,c);
  int cnt = 0;
  if((c-a)%2!=0&&(c-b)%2!=0) {
      a++; b++; cnt++;
    }
    else if((c-a)%2!=0&&(c-b)%2==0) {
      c++; b++; cnt++;
    }
    else if((c-a)%2==0&&(c-b)%2!=0) {
      a++; c++; cnt++;
    }
  cnt += (c-a)/2+(c-b)/2;
  cout << cnt << endl;
}


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

struct Process {
    string name;
    int time;
};

#define LEN 100000
Process pa[LEN];
int head, tail;

void enqueue(Process p) {
    pa[tail] = p;
    tail = (tail+1) % LEN;
}

Process dequeue() {
    Process pr = pa[head];
    head = (head+1) % LEN;
    return pr;
}

int main() {
    int n, q;
    cin >> n >> q;
    for (int i=0; i<n; i++) cin >> pa[i].name >> pa[i].time;

    head = 0;
    tail = n;
    int restime = 0;
    while (head != tail) {
        Process pc = dequeue();
        int min_t = min(q, pc.time);
        pc.time -= min_t;
        restime += min_t;
        if (pc.time > 0) {
            enqueue(pc);
        } else {
            cout << pc.name << " " << restime << endl;
        }

    }

    return 0;
}



Measured memory_bytes: 6968
x,y=map(int,input().split())

ans=0

if abs(x)>abs(y):
    if x<0:
        if y>=0:
            tmp=-x+y
            tmp1=1+-x-y
            ans+=min(tmp,tmp1)
        else:
            ans+=abs(x)-abs(y)
    else:
        ans+=1
        if y>=0:
            tmp=x+y
            tmp1=x-abs(y)+1
            ans+=min(tmp,tmp1)
        else:
            ans+=abs(x)-abs(y)

elif abs(x)==abs(y):
    ans=1

else:
    if x<0:
        if y>=0:
            ans+=1
            ans+=y-abs(x)
        else:
            ans+=2
            ans+=abs(y)-abs(x)
    else:
        if y>=0:
            ans=y-x
        else:
            ans+=1
            ans+=abs(y)-x
print(ans)

Measured memory_bytes: 3064
S = input()

def ticket_sum(i, s, num):
    if i == len(S):
        if num == 7:
            print(s+"=7")
            exit()
        else:
            return False
    
    # 数字を分ける場所
    pos = i - len(S)

    # "+"を入れる場合
    s1 = s[:pos]+"+"+s[pos:]
    num1 = num+int(s[pos])
    # "-"を入れる場合
    s2 = s[:pos]+"-"+s[pos:]
    num2 = num-int(s[pos])
    
    if not(ticket_sum(i+1, s1, num1)):
        if not(ticket_sum(i+1, s2, num2)):
            return False

ticket_sum(1, S, int(S[0]))

Measured memory_bytes: 3064
//Created by Aminul on 9/19/2020.

import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        String s = in.next();
        if (s.charAt(s.length() - 1) == 's') pw.println(s + "es");
        else pw.println(s + "s");

        pw.close();
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}

Measured memory_bytes: 38588
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a; i <= b; ++ i) 
const ll inf = 1e18 ;
const int mo = 1e9 + 7 ;
using namespace std ;

ll f[105] ;
vector <pair <ll, ll> > P[105] ;

void pre() {
	f[0] = f[1] = 1 ;
	int n = 1 ;
	rep(i, 2, 100) {
		f[i] = f[i - 1] + f[i - 2] ;
		if (f[i] <= inf) n = i ; else break ;
	}
	P[0].push_back(make_pair(1, 1)) ;
	rep(i, 0, n - 3) {
		rep(j, 0, (int) P[i].size() - 1) {
			ll x = P[i][j].first, y = P[i][j].second ;
			for ( ; ; ) {
				x += y ;
				if (x > f[i] + f[i + 3]) break ;
				P[i + 1].push_back(make_pair(y, x)) ;
			}
		}
	}
}

int main() {
	pre() ;
	int m ;
	ll x, y ;
	scanf("%d", &m) ;
	rep(cas, 1, m) {
		scanf("%lld%lld", &x, &y) ;
		if (x > y) swap(x, y) ;
		int ans = 1 ;
		rep(i, 1, 100) if (f[i] <= x && f[i + 1] <= y) ans = i ; else break ;
		printf("%d ", ans) ;
		if (ans == 1) {
			printf("%lld\n", (ll) x * y % mo) ;
			continue ;
		}
		int k = ans ;
		ans = 0 ;
		rep(i, 0, (int) P[k - 1].size() - 1) {
			ll A = P[k - 1][i].first, B = P[k - 1][i].second ;
			if (B <= x) ans += ((y - A) / B) % mo, ans %= mo ;
			if (B <= y) ans += ((x - A) / B) % mo, ans %= mo ;
		}
		printf("%d\n", (ans + mo) % mo) ;
	}
	return 0 ;
}

Measured memory_bytes: 4224
#include<stdio.h>
#include<ctype.h>
#include<string.h>
int i,j;
char S[105],T[300],C;
void U()
{
	for(i=j=0;S[i];i++)
	{
		if(S[i]=='_'&&S[i+1]>'Z')S[i+1]-=0x20;
		else T[j++]=S[i];
	}
}
void D()
{
	for(i=j=0;S[i];i++)
	{
		if(i&&S[i]<'a'&&S[i]!='_'){T[j++]='_';T[j++]=tolower(S[i]);}
		else T[j++]=tolower(S[i]);
	}
}

int main()
{
	for(;scanf("%s %c\n",S,&C),C!='X';puts(T))
	{
		memset(T,0,sizeof(T));
		switch(C)
		{
		case'U':U();T[0]=toupper(T[0]);break;
		case'L':U();T[0]=tolower(T[0]);break;
		default:D();
		}
	}
	return 0;
}

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

int main() {
  int n;cin>>n;
  vector<int> x(n),y(n),vec(n);
  rep(i,n){
    cin>>x[i]>>y[i];
    vec[i]=i;
  }
  double ans=0;
  int cnt=0;
  do{
    rep(i,n-1){
      double dx=x[vec[i]]-x[vec[i+1]],dy=y[vec[i]]-y[vec[i+1]];
      ans+=sqrt(dx*dx+dy*dy);
    }
    cnt++;
  }while(next_permutation(all(vec)));
  ans/=cnt;
  cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 3852
#include<bits/stdc++.h>
using namespace std;
int i,n,k,j,u;
int a[10010];
int main(){
	cin>>n;
	for(i=1;i<sqrt(n);i++){
		for(j=1;j<sqrt(n);j++){
			for(k=1;k<sqrt(n);k++){
				u=pow(i,2)+pow(j,2)+pow(k,2)+i*j+i*k+j*k;
				if(u<=n)a[u]++;
			}
		}
	}
	for(i=1;i<=n;i++)cout<<a[i]<<endl;
	return 0;
}

Measured memory_bytes: 3664
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
 
class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        int[] pArr = ReadLineIntArray();
        int min = pArr[0];
        int rtn = 1;
        for (int i = 1; i < n; i++) {
            if (pArr[i] < min) {
                rtn++;
                min = pArr[i];
            }
        }
        System.Console.WriteLine(rtn);
    }
 
    static string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    static string[] strAry = new string[] {"L", "R", "U", "D"};
    static int[] intArray = new int[10];
    static List<int> intList = new List<int>();
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private double ReadLineDouble() {return double.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private List<int> ReadLineIntList() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToList();}
    static private List<long> ReadLineLongList() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToList();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}
 
    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
  
    static private string IntToNString(int x, int n) {
        var nstring = "";
        var numbers = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
        int r = 1;
        int q = x;
        while (q > 0) {
            r = q % n;
            nstring += numbers[r];
            q = q / n;
        }
        return string.Join("",nstring.Reverse());
     }
}

Measured memory_bytes: 33628
#include <iostream>
#include <string>
#include <sstream>
#include <queue>
using namespace std;
struct dot{
	long long int k,p,l,r;
};
int main(int argc, char** argv) {
	int n;
	while(cin>>n){
		dot p[n+100];
		for(int i=1;i<=n;i++){
			cin>>p[i].k;
			if(i/2)
				p[i].p=i/2;
			else
				p[i].p=0;
			if(i*2<=n)
				p[i].l=i*2;
			else
				p[i].l=0;
			if(i*2+1<=n)
				p[i].r=i*2+1;
			else
				p[i].r=0;
		}
		for(int i=1;i<=n;i++){
			cout<<"node "<<i<<": key = "<<p[i].k<<", ";
			if(p[i].p>0)
				cout<<"parent key = "<<p[p[i].p].k<<", ";
			if(p[i].l>0)
				cout<<"left key = "<<p[p[i].l].k<<", ";
			if(p[i].r>0)
				cout<<"right key = "<<p[p[i].r].k<<", ";
			cout<<endl;
		}
		
	}
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
const long long c=1e18;
long long X;
long long f(long long a, long long b){
	long long powa=pow(a,5);
	long long powb=pow(b,5);
	return powa-powb;
}
int main(){
	cin>>X;
	long long i=0;
	while(i<=178){
		long long j=-64;
		while(j<=178){
			long long tmp=f(i,j);
			if(tmp==X){
				cout<<i<<" "<<j<<'\n';
				return 0;
			}
			j++;
		}
		i++;
	}
}


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

using namespace std;


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

   long long int a[110],n,i,j,k,c=0;
   cin>>n;
   for(i=0;i<n;i++)
    cin>>a[i];
   for(i=0;i<n;i++)
   {
       for(j=i;j<n;j++)
       {
           for(k=j;k<n;k++)
           {
               if(i!=j&&j!=k&&k!=i&&a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i])
               {
                   if(a[i]+a[j]>a[k]&&a[i]+a[k]>a[j]&&a[j]+a[k]>a[i])
                    c++;
               }
           }
       }
   }
   cout<<c;

    return 0;
}





Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll int
#define MOD 1000000007
#define MOD2 998244353
#define vi vector<ll>
#define PB push_back
#define FOI(i, a, n) for( ll i = a; i <= n; i++)
#define FOD(i, a, n) for( ll i = a; i >= n; i--)
#define F0I(i, n) FOI(i,0,n)
#define F0D(i, n) FOD(i,n,0)
#define F1I(i, n) FOI(i,1,n)
#define F1D(i, n) FOD(i,n,1)
#define watch(x) cout << #x << ": " << x << endl;
#define cnl(d) cout<<d<<'\n'
#define cns(d) cout<<d<<' '
#define printcont(v) for (auto &i : v) cout << i << " "; cout << endl
#define printmat(mat,row,col) F0I(i,row-1)F0I(j,col-1)cout << mat[i][j] << " \n"[j == col-1];
#define PNS cout<<' '
#define PNL cout<<'\n'
#define inint(i) ll i;cin >> i
#define invec(n,v) vi v(n); F0I(i,n-1) cin >> v[i]
#define insvec(n,v) inint(n); vi v(n); F0I(i,n-1) cin >> v[i]
#define MK2DV(v,row,col,val) vector<vector<ll>> v(row, vector<ll>(col,val))
#define trvl(c,it) for(auto it=(c).begin();it!=(c).end();it++)
using namespace std;
ll findmin(ll a, ll b) { if(a < b) return a; return b; }
ll findmax(ll a, ll b) { if(a > b) return a; return b; }
ll fast_pow(ll base,ll exp){if (exp == 0) return 1;if (exp == 1) return base % MOD;ll t = fast_pow(base, exp / 2);t = ((t% MOD) * (t%MOD)) % MOD;if (exp % 2 == 0)return t;else return ((base %  MOD) * t) % MOD;}
ll abso(ll a){
	if(a < 0) return -a;
	return a;
}
//GLOBAL FUNCTIONS AND VARIABLES GO HERE //
int main()
{
	insvec(n,h);
	vi dp(n);
	dp[0] = 0;
	dp[1] = abso(h[1]-h[0]);
	for(ll i = 2; i < n; i++)
	{
		ll cost1 = dp[i-2] + abso(h[i-2]-h[i]);
		ll cost2 = dp[i-1] + abso(h[i-1]-h[i]);
		dp[i] = findmin(cost1,cost2);
	}
	cout << dp[n-1];

	return 0;
}

Measured memory_bytes: 1024
a = [int(_) for _ in input().split()]
plug = 1
tap = 0
if len(a) == 2 and 2 <= a[0] <= 20 and 1 <= a[1] <= 20:
    while a[1] > plug:
        plug += a[0] - 1
        tap += 1
    print(tap)
else:
    print('hoge!')

Measured memory_bytes: 3060
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#pragma GCC diagnostic error "-std=c++14"
#include "bits/stdc++.h"
//#include "ext/pb_ds/tree_policy.hpp"
//#include "ext/pb_ds/assoc_container.hpp"
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) (x&(-x))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9+7;
const ll inf = 1e9+7;
const ld eps = 1e-9;
const db PI = atan(1)*4;
template<typename T>
inline int sign(const T&a) {
    if(a<0)return -1;
    if(a>0)return 1;
    return 0;
}

template<typename T,typename S>inline bool upmin(T&a,const S&b){return a>b?a=b,1:0;}
template<typename T,typename S>inline bool upmax(T&a,const S&b){return a<b?a=b,1:0;}

template<typename T> inline void in(T &x) {
    x = 0;
    T f = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (isdigit(ch))  {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    x *= f;
}

ll twop(int x) {
    return 1LL<<x;
}

template<typename A,typename B > inline void in(A&x,B&y) {
    in(x);
    in(y);
}
template<typename A,typename B,typename C>inline void in(A&x,B&y,C&z) {
    in(x);
    in(y);
    in(z);
}
template<typename A,typename B,typename C,typename D> inline void in(A&x,B&y,C&z,D&d) {
    in(x);
    in(y);
    in(z);
    in(d);
}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
namespace SOLVE {
    void main(){
    }
}
string s;

int main() {

    
    
    
    
    
    cin>>s;
    map<int, int>cnt;
    ll ans = 1;
    int len = 1;
    for(auto i:s){
        cnt[i]++;
        ans += len-cnt[i];
        len++;
    }
    
    
    
    
    cout<<ans;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(){
    int l, r;
    scanf("%d %d", &l, &r);
    int l_quot = l/2019, l_remain = l%2019;
    int r_quot = r/2019, r_remain = r%2019;

    //l_quot <= r_quot
    //l_remain < r_remain??
    int min = (l_remain * r_remain) % 2019;
    if(l_quot == r_quot){
        for(int i = l_remain; i < r_remain; i++){
            for(int j = i + 1; j < r_remain + 1; j++){
                int cross = (i * j) % 2019;
                if(cross < min){
                    min = cross;
                }
            }
        }
    }else{
        min = 0;
    }

    printf("%d", min);

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define pi 3.141592653589793238
int main()
{
	int a,b,n,k;
	cin>>a>>b>>n>>k;
	double f=k*6;
	double h=n*30+k/2.0;
	double  m=1.0*(f-h)*pi/180;
	double ans=a*a+b*b-2*a*b*cos(m);
	printf("%.20f\n",sqrt(ans));
 } 


Measured memory_bytes: 4228
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define printll(a) printf("%lld\n", a)
#define printYes() printf("Yes\n")
#define printNo() printf("No\n")
#define scanll(a) scanf("%lld", &a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define scan4Int(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
typedef long long ll;
const int INF = 1001001001;
using namespace std;
 
int main() {
    ll a, b, k;
    scanf("%lld %lld %lld", &a, &b, &k);
    if (a > k) a -= k;
    else {
        k -= a;
        a = 0;
        if (b >= k) b -= k;
        else b = 0;
    }
    printf("%lld %lld\n", a, b);
    return 0;
}

Measured memory_bytes: 3824
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


int main() {
// 頂点数と辺数
    ll N, K; cin >> N >> K;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N+1);
    for (int i = 1; i <= N; ++i) {
        int A;
        cin >>A;
        G[i].push_back(A);
        
    }

    // BFS のためのデータ構造
    vector<int> dist(N+1, -1); // 全頂点を「未訪問」に初期化
    map<int,int> dist2;
    queue<int> que;
    int c,r=-1;
    dist2[0]=1;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[1] = 0;
    que.push(1); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) {
                c=dist[v]-dist[nv]+1;
                r=dist[nv];
                break;
            }; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            dist2[dist[nv]]=nv;
            que.push(nv);
        }
    }
    if(r<=K){
    cout<<dist2[(K-r)%c+r]<<endl;
    }
    else{
        cout<<dist2[K]<<endl;
    }
  return 0;
}

Measured memory_bytes: 24280
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1e5+5;
const int mod=1e9+7;
int n,k,f[maxn],inv[maxn],front[maxn],a[maxn];
int quick_pow(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)
			(res*=a)%=mod;
		(a*=a)%=mod;
		b>>=1;
	}
	return res;
}
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
signed main()
{
	ios::sync_with_stdio(0);
//    fl();
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	if(k==1)
	{
		cout<<0<<endl;
		return 0;
	}
	sort(a+1,a+n+1);
	f[1]=1;
	for(int i=2;i<=n;i++)
		f[i]=f[i-1]*i%mod;
	inv[n]=quick_pow(f[n],mod-2);
	for(int i=n-1;i>=1;i--)
		inv[i]=(inv[i+1]*(i+1)%mod);
//	for(int i=1;i<=n;i++)
//	{
//		cout<<inv[i]<<" ";
//		cout<<inv[i]*f[i]%mod<<endl;
//	}
//	cout<<endl;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		int large,small;
		if(n-i<k-1)
			small=0;
		else if(k-1==0||k-1==n-i)
			small=1;
		else
			small=f[n-i]*inv[n-i-k+1]%mod*inv[k-1]%mod;
		if(i-1<k-1)
			large=0;
		else if(k-1==0||k-1==i-1)
			large=1;
		else
			large=f[i-1]*inv[i-1-k+1]%mod*inv[k-1]%mod;
//		cout<<small<<" "<<large<<endl;
		(ans+=(large-small)*a[i]%mod)%=mod;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a;
  cin>>a;
  if(a<105)
    cout<<0<<endl;
  if(a>104&&a<135)
    cout<<1<<endl;
  if(a>134&&a<165)
    cout<<2<<endl;
  if(a>164&&a<189)
cout<<3<<endl;
  if(a>188&&a<195)
    cout<<4<<endl;
  if(a>194)
    cout<<5<<endl;
}


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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	int n, k;
	cin>>n>>k;
	vector < long long > v(n);
	for (int i = 0; i < n; i++)
		cin>>v[i];
	sort(v.rbegin(), v.rend());
	
	long long s = 0;
	for (int i = k; i < n; i++)
		s += v[i];
		
	cout<<s<<endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

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


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


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

  s[5] = s[13] = ' ';

  cout << s << endl;
  
  return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
  
int isRoudingBun(char *s, int length) {
  for (int i = 0; i < (length / 2); i++) {
    if (s[i] != s[length - 1 - i]) return 1;
  }
  return 0;
}
  
int main() {
  // your code here...
  char kai[100];
  
  scanf("%s", kai);
  
  int len = strlen(kai);
  if (isRoudingBun(kai, len) == 0 && isRoudingBun(kai, (len-1)/2) == 0 && isRoudingBun(&kai[(len+3)/2 - 1], len - (len+3)/2 + 1) == 0) {
    printf("Yes\n");
    return 0;
  }
  
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func stringLineScan() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(stringLineScan())
	a := make(map[int]int, n)
	for i := 0; i < n; i++ {
		x, _ := strconv.Atoi(stringLineScan())
		a[x]++
	}
	ans := len(a)
	m := 0
	for _, v := range a {
		m += v - 1
	}
	fmt.Println(ans - m%2)
}

Measured memory_bytes: 4096
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

#define MOD 998244353
#define M 1000000

long long bipow(long long n, long long k){
    if(k == 0) return 1;
    if(k % 2 == 0){
        long long tmp = bipow(n, k/2);
        return (tmp * tmp) % MOD;
    }else{
        return (bipow(n, k-1) * n) % MOD;
    }
}

long long inv[M+1];
long long w[M+1];

int main(){
    for(int i=1; i<=M; i++)
        inv[i] = bipow(i, MOD-2);

    
    for(int i=1; i<=M; i++){
        w[i] += inv[i];
        w[i] %= MOD;
        for(int j=i*2; j<=M; j+=i){
            w[j] += (MOD - w[i]);
            w[j] %= MOD;
        }
    }

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

    vector<long long> B(1000001);
    for(int i=0; i<N; i++)
        B[A[i]]+=A[i];

    long long ans = 0;
    for(int i=0; i<N; i++){
        ans += MOD - A[i];
        ans %= MOD;
    }

    for(int i=1; i<=M; i++){
        long long x = 0;
        for(int j=i; j<=M; j+=i){
            x += B[j] % MOD;
            x %= MOD;
        }
        x = (x * x) % MOD;
        ans += (w[i] * x) % MOD;
        ans %= MOD;
    }
    ans *= inv[2];
    ans %= MOD;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 24448
#include<iostream>
#include<cstdlib>
#include<string>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<array>
#include<vector>
#include<cctype>
#include <chrono>
#define long long ll

#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
int main()
{
    int i,j=0,c=2,k=0,n,m;
    int s=0,p=0;
    int a[1000];
    string s1,t;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>a[i];

    }
    sort(a,a+n);
    for(i=0;i<k;i++)
    {
        s+=a[i];
    }
cout<<s;



}



Measured memory_bytes: 3616
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Map<Integer, Long> map = new HashMap<>();
        int[] a = new int[200001];
        for(int i=0; i<n; i++) {
            a[i] = Integer.parseInt(sc.next());
            if(map.containsKey(a[i])) {
                map.put(a[i], map.get(a[i])+1);
            }else {
                map.put(a[i], 1L);
            }
        }
        long sum = 0;
        for(long value : map.values()) {
            if(value > 1) {
                sum += combi(value);
            }
        }
        
        StringBuilder sb = new StringBuilder();
        long ans = 0;
        for(int i=0; i<n; i++) {
            if(map.get(a[i]) == 1) {
                sb.append(sum+"\n");
            }else if(map.get(a[i]) == 2) {
                sb.append((sum-1)+"\n");
            }else {
                sb.append((sum - combi(map.get(a[i])) + combi(map.get(a[i])-1))+"\n");
            }
        }
        System.out.println(String.valueOf(sb));
    }
    //組み合わせ
    public static long combi(long a) {
        return a*(a-1) / 2;
    }

}

Measured memory_bytes: 73264
fn main() {
    proconio::input! {
        a: u32,
        mut b: u32,
        mut c: u32,
        k: u32,
    }

    for _ in 0..k {
        if b <= a {
            b *= 2;
        } else {
            c *= 2;
        }
    }
    println!("{}", if c > b && b > a {"Yes"} else {"No"})
}


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

int main(){

	int n;
	std::cin >> n;
	std::map<int, int>m;

	for (int i = 0; i < n; i++){
		int a;
		std::cin >> a;

		int k = std::sqrt(a);
		for (int j = 1; j <= k; j++){
			if (a%j == 0){
				if (m.find(j) != m.end())m[j]++;
				else m.insert(std::make_pair(j, 1));

				if (a / j != k){
					if (m.find(a / j) != m.end())m[a / j]++;
					else m.insert(std::make_pair(a / j, 1));
				}
			}
		}
	}

	std::map<int, int>::iterator it = m.begin();
	while (it != m.end()){
		if (it->second == n)std::cout << it->first << std::endl;
		it++;
	}

	return 0;
}

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


def make_divisor(n):
    divisors = []
    if n % 2 == 0:
        return 0
    for i in range(1, int(n ** 0.5) + 1, 2):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return len(divisors)


ans = 0
for i in range(1, n+1):
    if make_divisor(i) == 8:
        ans += 1
print(ans)


Measured memory_bytes: 3060
y,m,d = map(int, input().split('/'))
ans = ''
if y<2019:
  ans = 'Heisei'
elif y==2019:
  if m<4 or (m==4 and d<=30):
    ans = 'Heisei'
  else:
    ans = 'TBD'
else:
  ans = 'TBD'

print(ans)

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

using namespace std;

typedef long long int LL;

#define st first
#define nd second
#define PLL pair <LL, LL>
#define PII pair <int, int>

const int N = 5007;
const int MX = 1e9 + 7;
const LL INF = 1e18 + 9LL;

int n;
bool add[N];

bool vis[N];
vector <int> G[N];
vector <int> comps;

int sz;
bool has;
int dp[N][N];

void dfs(int u){
	vis[u] = true;
	++sz, has |= add[u];

	for(auto v: G[u])
		if(!vis[v])
			dfs(v);
}

int fast(int a, int b){
	int ret = 1;
	while(b){
		if(b & 1)
			ret = 1LL * ret * a % MX;
		
		b >>= 1;
		a = 1LL * a * a % MX;
	}
	
	return ret;
}

int main(){
	scanf("%d", &n); int m = 0;
	for(int i = 1; i <= n; ++i){
		int p;
		scanf("%d", &p);
		
		if(p == -1){
			add[i] = true;
			++m;
		}
		else{
			G[p].push_back(i);
			G[i].push_back(p);
		}
	}
	
	int bad_comps = 0, all_sz = 0;
	for(int i = 1; i <= n; ++i)
		if(!vis[i]){
			sz = 0;
			has = false;
			
			dfs(i);
			if(!has)	
				++bad_comps, all_sz += sz;
			else
				comps.push_back(sz);
		}
	
	int poss = fast(n - 1, m);
	int cyc = 1LL * bad_comps * poss % MX;
	int ans = 1LL * n * poss % MX;
	
	dp[0][0] = 1;
	for(int i = 1; i <= (int)comps.size(); ++i){
		int v = comps[i - 1];
		for(int j = 0; j < i; ++j)
			dp[i][j + 1] = (dp[i - 1][j + 1] + 1LL * dp[i - 1][j] * v) % MX;
		dp[i][0] = 1;
	}
	
	int exp = 0;
	int t = comps.size();

	for(auto v: comps)
		exp = (exp + 1LL * (v - 1) * fast(n - 1, MX - 2)) % MX;
	
	int cur = fast(n - 1, MX - 2);
	for(int i = 2; i <= t; ++i){
		cur = 1LL * cur * (i - 1) % MX * fast(n - 1, MX - 2) % MX;
		exp = (exp + 1LL * cur * dp[t][i]) % MX;
	}
	
	ans = (ans + MX - 1LL * exp * poss % MX + MX - cyc) % MX;
	printf("%d\n", ans);
	return 0;
}

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

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

    int a, b, c;
    cin >> a >> b >> c;

    if (a < b && b < c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3180
//
//  CPlibrary
//
//  Created by Tanmay Singh on 3/03/2020.
// INDIAN INSTITUTE OF TECHNOLOGY (BHU) , VARANASI
//  Copyright © 2020 Tanmay Singh. All rights reserved.
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
 
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <climits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
 
#define FAST(); ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define mod 1000000007
typedef long long int  bigint ;
typedef std::vector< int > vi;
typedef std::vector< long long int > vll;
typedef std::vector< vi > vvi;
 
using namespace std;

int main(){
    FAST() ;
    int N , M , C ; cin >> N >> M >> C ;
    int arr[M] ;
    for( int i = 0 ; i < M ; i++ )
        cin >> arr[i] ;
    int cnt = 0 ;
    for( int i = 0 ; i < N ; i++ ){
        int brr[M] ;
        for( int i = 0 ; i < M ; i++ )
            cin >> brr[i] ;
        int sum = C ;
        for( int i = 0 ; i < M ; i++ ){
            sum += arr[i] * brr[i] ;
        }
        if( sum > 0 )
            cnt++ ;
    }
    cout << cnt << endl ;
    return 0 ;
}


Measured memory_bytes: 256
N , M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
sub = []
for i in range(M - 1):
	sub.append(X[i + 1] - X[i])
sub.sort()
ans = 0
for i in range(M - N):
	ans += sub[i]
print(ans)

Measured memory_bytes: 13968
# -*- coding: utf-8 -*-

import sys

sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')

class Geometry:

    EPS = 10 ** -9

    def add(self, a, b):
        x1, y1 = a
        x2, y2 = b
        return (x1+x2, y1+y2)

    def sub(self, a, b):
        x1, y1 = a
        x2, y2 = b
        return (x1-x2, y1-y2)

    def mul(self, a, b):
        x1, y1 = a
        if not isinstance(b, tuple):
            return (x1*b, y1*b)
        x2, y2 = b 
        return (x1*x2, y1*y2)

    def abs(self, a):
        from math import hypot
        x1, y1 = a
        return hypot(x1, y1)

    def norm(self, a):
        x, y = a
        return x**2 + y**2

    def dot(self, a, b):
        x1, y1 = a
        x2, y2 = b
        return x1*x2 + y1*y2

    def cross(self, a, b):
        x1, y1 = a
        x2, y2 = b
        return x1*y2 - y1*x2

    def project(self, seg, p):
        """ 線分segに対する点pの射影 """
        p1, p2 = seg
        base = self.sub(p2, p1)
        r = self.dot(self.sub(p, p1), base) / self.norm(base)
        return self.add(p1, self.mul(base, r))

    def reflect(self, seg, p):
        """ 線分segを対称軸とした点pの線対称の点 """
        return self.add(p, self.mul(self.sub(self.project(seg, p), p), 2))

    def ccw(self, p0, p1, p2):
        """ 線分p0,p1から線分p0,p2への回転方向 """
        a = self.sub(p1, p0)
        b = self.sub(p2, p0)
        # 反時計回り
        if self.cross(a, b) > self.EPS: return 1
        # 時計回り
        if self.cross(a, b) < -self.EPS: return -1
        # 直線上(p2 => p0 => p1)
        if self.dot(a, b) < -self.EPS: return 2
        # 直線上(p0 => p1 => p2)
        if self.norm(a) < self.norm(b): return -2
        # 直線上(p0 => p2 => p1)
        return 0

    def intersect(self, seg1, seg2):
        """ 線分seg1と線分seg2の交差判定 """
        p1, p2 = seg1
        p3, p4 = seg2
        return (
            self.ccw(p1, p2, p3) * self.ccw(p1, p2, p4) <= 0
            and self.ccw(p3, p4, p1) * self.ccw(p3, p4, p2) <= 0
        )

    def get_distance_LP(self, line, p):
        """ 直線lineと点pの距離 """
        p1, p2 = line
        return abs(self.cross(self.sub(p2, p1), self.sub(p, p1)) / self.abs(self.sub(p2, p1)))

    def get_distance_SP(self, seg, p):
        """ 線分segと点pの距離 """
        p1, p2 = seg
        if self.dot(self.sub(p2, p1), self.sub(p, p1)) < 0: return self.abs(self.sub(p, p1))
        if self.dot(self.sub(p1, p2), self.sub(p, p2)) < 0: return self.abs(self.sub(p, p2))
        return self.get_distance_LP(seg, p)

    def get_distance_SS(self, seg1, seg2):
        """ 線分seg1と線分seg2の距離 """
        p1, p2 = seg1
        p3, p4 = seg2
        if self.intersect(seg1, seg2): return 0
        return min(
            self.get_distance_SP(seg1, p3), self.get_distance_SP(seg1, p4),
            self.get_distance_SP(seg2, p1), self.get_distance_SP(seg2, p2),
        )

gm = Geometry()
for _ in range(INT()):
    x1, y1, x2, y2, x3, y3, x4, y4 = MAP()
    seg1 = ((x1, y1), (x2, y2))
    seg2 = ((x3, y3), (x4, y4))
    print(gm.get_distance_SS(seg1, seg2))



Measured memory_bytes: 5884
#include <stdio.h>

int main( void ) {
	int n, y, m, d;

	for ( scanf( "%d", &n ); n--; scanf( "%d %d %d", &y, &m, &d ), y--, m--, printf( "%d\n", 196471 - y * 195 - y / 3 * 5 - m * 20 + ( ( y + 1 ) % 3 ? m / 2 : 0 ) - d ) ) ;

	return 0;
}

Measured memory_bytes: 596
n = int(input())
X = [[0] * 13 for i in range(4)]
table = {'S': 0, 'H': 1, 'C': 2, 'D': 3}
for i in range(n):
    pattern, num = input().split()
    num = int(num) - 1
    X[table[pattern]][num] = 1

table = {0: 'S', 1: 'H', 2: 'C', 3: 'D'}
for i in range(4):
    for j in range(13):
        if X[i][j] == 0:
            print('{} {}'.format(table[i], j + 1))



Measured memory_bytes: 5608
#include<bits/stdc++.h>
#define long long long
using namespace std;
long n,k,d,r,ans;
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  cin>>n>>k;
  if(k==0)
  {
    cout<<n*n<<endl;
    return 0;
  }
  for(long i=k+1;i<=n;i++)
  {
    d=n/i;
    r=n%i;
    ans+=((i-k)*d);
    if(r<k)continue;
    ans+=r-k+1;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  if(k==1) cout<<0<<endl;
  else cout<<(n-(k-1))-1<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <bitset>
#include <set>
#include <iomanip>
#include <functional>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'a' = 97

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    string ans;
    int dx = tx - sx;
    int dy = ty - sy;
    rep(i, 0, dy) ans += 'U';
    rep(i, 0, dx) ans += 'R';
    rep(i, 0, dy) ans += 'D';
    rep(i, 0, dx) ans += 'L';

    ans += 'L';
    rep(i, 0, dy + 1) ans += 'U';
    rep(i, 0, dx + 1) ans += 'R';
    ans += 'D';
    ans += 'R';
    rep(i, 0, dy + 1) ans += 'D';
    rep(i, 0, dx + 1) ans += 'L';
    ans += 'U';

    cout << ans << endl;
    
}


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

namespace ConsoleApp1
{
    static class BOrdinaryNumber
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var pList = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

            int count = 0;

            for (int i = 1; i < n - 1; i++)
            {
                if (pList[i - 1] < pList[i] && pList[i] < pList[i + 1])
                {
                    count++;
                    continue;
                }
                if (pList[i + 1] < pList[i] && pList[i] < pList[i - 1])
                {
                    count++;
                    continue;
                }
            }

            Console.WriteLine(count);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 11348
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    if (n % 2 == 0) cout << n / 2 - 1 << endl;
    else cout << n / 2 << endl;

}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
  var s string
  fmt.Scan(&s)
  var count int
  if s[0] == '1' {
    count++
  }
  if s[1] == '1' {
    count++
  }
  if s[2] == '1' {
    count++
  }
  fmt.Println(count)
}


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

int main() {
  int cnt = 0, len;
  string s;
  cin >> s;
  len = s.size();
  for (int i = 0; i < len - 1; i++) {
    if (s.size() == 1) break;
    if ((s[i] == '0' && s[i + 1] == '1') || (s[i] == '1' && s[i + 1] == '0')) {
      cnt += 2;
      s.erase(i, 2);
      len = s.size();
      i -= 2;
    }
  }
  cout << cnt << endl;
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if ((a == b && b != c) || (a == c && c != b) || (c == b && a != b))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256