akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

const int INF = INT_MAX / 3;

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()


double EPS = 1e-10;

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0;
	return a + b;
}

struct P {
	double x, y;
	P() {}
	P(double x, double y) : x(x), y(y) {
	}
	P operator +(P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator -(P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator *(double d) {
		return P(d*x, d*y);
	}
	double dot(P p) {
		return add(x*p.x, y*p.y);
	}
	double det(P p) {
		return add(x*p.y, -y*p.x);
	}
	void print() {
		printf("%.10lf %.10lf \n", x, y);
		return;
	}
};

double dist(P p1, P p2) {
	double dx = p1.x - p2.x;
	double dy = p1.y - p2.y;
	return sqrt(dx*dx + dy*dy);
}

bool x_asc(const P& left, const P& right) {
	return left.x < right.x;
}

bool y_asc(const P& left, const P& right) {
	return left.y < right.y;
}

void merger(vector<P> &pointList, int start, int m, int end) {
	vector<P> tmp(end - start + 1);
	int i = start;
	int j = m + 1;
	for (int k = 0; k<end - start + 1; k++) {

		if (i == m + 1) {
			tmp[k] = pointList[j];
			j++;
			continue;
		}
		if (j == end + 1) {
			tmp[k] = pointList[i];
			i++;
			continue;
		}
		if (pointList[i].y >= pointList[j].y) {
			tmp[k] = pointList[j];
			j++;
			continue;
		}
		if (pointList[i].y < pointList[j].y) {
			tmp[k] = pointList[i];
			i++;
			continue;
		}
	}

	for (int i = start; i<end + 1; i++) {
		pointList[i] = tmp[i-start];
	}
}

double closestPoint(vector<P> &pointList, int start, int end) {
	int n = end - start + 1;
	int m = (start+end) / 2;
	double center = pointList[m].x;
	double d;
	if (start == end) return INF;
	d = min(closestPoint(pointList, start, m), closestPoint(pointList, m + 1, end));
	merger(pointList, start, m, end);

	vector<P> rangeList;
	for (int i = start; i<end + 1; i++) {
		if (fabs(pointList[i].x - center) >= d) continue;

		for (int j = rangeList.size() - 1; j>-1; j--) {
			double dd = dist(rangeList[j], pointList[i]);
			if (pointList[i].y - rangeList[j].y > d) break;
			d = min(d, dd);
		}
		rangeList.push_back(pointList[i]);

	}
	return d;
}

int main() {
	std::ios::sync_with_stdio(false);
    	std::cin.tie(0);
	int n;
	cin >> n;
	vector<P> pointList(n);
	REP(i, n) {
		cin >> pointList[i].x >> pointList[i].y;
	}

	sort(ALL(pointList), x_asc);

	printf("%.10lf \n", closestPoint(pointList, 0, pointList.size() - 1));
	return 0;
}

Measured memory_bytes: 5892
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
// 公約数
long int gcd(long int a, long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long int lcm(long int a, long int b){
  return a * b / gcd(a, b);
}



// min
int main(void){

  int n;
  float ans = 0;

  scanf("%d", &n);

  if(n == 1){
    ans = 1;
  }else if(n % 2 == 0){
    ans = 0.5;
  }else{
    ans = (((n - 1.0)/ 2.0) + 1.0) /n;
  }

  fprintf(stderr, "n / 2 = %f\n", 3.0/5.0);
  printf("%f\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
int main()
{
    int a, b; cin >> a >> b;
    if (a < 10 && b < 10) cout << a * b << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3592
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
#define mp make_pair
#define what_is(x) cerr << #x << " is " << x << endl;

typedef tree<
        int,
        null_type,
        less<int>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;


const int p = 998244353;


int mul(int a, int b) {
    return (1LL * a%p * b%p) % p;
}

int add(int a, int b) {
    int s = (a+b);
    s = s%p;
    if (s<0) s+=p;
    return s;
}

int sub(int a, int b) {
    int s = (a-b);
    s = s%p;
    if (s<0) s+=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

vector<int> Z(vector<int> s)
{
    int n = s.size();
    vector<int> z(n);
    int L = 0, R = 0;
    for (int i = 1; i < n; i++) {
        if (i > R) {
            L = R = i;
            while (R < n && s[R-L] == s[R]) R++;
            z[i] = R-L; R--;
        } else {
            int k = i-L;
            if (z[k] < R-i+1) z[i] = z[k];
            else {
                L = i;
                while (R < n && s[R-L] == s[R]) R++;
                z[i] = R-L; R--;
            }
        }
    }
    return z;
}

mt19937 rnd(time(0));
/*
struct Line {
    mutable ll k, m, p;
    bool operator<(const Line& o) const { return k < o.k; }
    bool operator<(ll x) const { return p < x; }
};

struct CHT : multiset<Line, less<>> {
    // (for doubles, use inf = 1/.0, div(a,b) = a/b)
    const ll inf = LLONG_MAX;
    ll div(ll a, ll b) { // floored division
        return a / b - ((a ^ b) < 0 && a % b); }
    bool isect(iterator x, iterator y) {
        if (y == end()) { x->p = inf; return false; }
        if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
        else x->p = div(y->m - x->m, x->k - y->k);
        return x->p >= y->p;
    }
    void add(ll k, ll m) {
        auto z = insert({k, m, 0}), y = z++, x = y;
        while (isect(y, z)) z = erase(z);
        if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
        while ((y = x) != begin() && (--x)->p >= y->p)
            isect(x, erase(y));
    }
    ll query(ll x) {
        assert(!empty());
        auto l = *lower_bound(x);
        return l.k * x + l.m;
    }
};
*/

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

    ll s;
    cin>>s;
    cout<<0<<' '<<0<<' ';
    ll x2 = 1000000000;
    ll y1 = (s+x2-1)/x2;
    ll x1 = 1;
    ll y2 = x2*y1 - s;
    cout<<x1<<' '<<y1<<' '<<x2<<' '<<y2;




}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		if(one.contains(1) && one.contains(9) && one.contains(7) && one.contains(4)){
			myout("YES");
		}else{
			myout("NO");
		}
	}
	//Method addition frame start



	//Method addition frame end
}


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ll Mod = 1000000007LL;
const int N = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll A, B;
	cin >> A >> B;
	cout << "100 100\n";
	for(int i = 1; i <= 50; i++){
		for(int j = 1; j <= 100; j++){
			if((i & 1) && (j & 1) && B > 1) B--, cout << '#';
			else cout << '.';
		}
		cout << '\n';
	}

	for(int i = 1; i <= 50; i++){
		for(int j = 1; j <= 100; j++){
			if((i % 2 == 0) && (j & 1) && A > 1) A--, cout << '.';
			else cout << '#';
		}
		cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
G = {}
D = [-1] * n
for _ in range(n):
    A = list(map(int, input().split()))
    G[A[0] - 1] = [a - 1 for a in A[2:]]

# print(G)

q = [(0, 0)]
while len(q) > 0:
    v, d = q[0]
    del q[0]
    if D[v] >= 0:
        continue
    D[v] = d

    for nv in G[v]:
        q.append((nv, d+1))

for i in range(n):
    print(i+1, D[i])



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

int main(int argc, char const *argv[]) {
  int m, n, i, j, sum;
  cin >> m >> n;

  int matrix[m][n];
  int vec[n];

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

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

  for (i = 0; i < m; i++) {
    sum = 0;
    for (j = 0; j < n; j++) {
      sum += matrix[i][j] * vec[j];
    }
    cout << sum << endl;
  }

  return 0;
}



Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,v;
    scanf("%d %d",&a,&v);
    int b,w;
    scanf("%d %d",&b,&w);
    int t;
    scanf("%d",&t);
    if(v>=w)
    {
        if((long long)(v-w)*t>=(long long)abs(a-b))
            printf("YES\n");
        else
            printf("NO\n");
    }
    else
    {
        if(v==w)
            printf("YES\n");
        else
            printf("NO\n");
    }
	return 0;
}


Measured memory_bytes: 3660
#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 ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)
ll mat[51][51], mod = 1e9 + 7, ans[51][51];
void mul(ll a[51][51], ll b[51][51], ll n) {
	ll temp[n][n], i, j, k;
	for(i = 0; i < n; i++) {
		for(j = 0; j < n; j++) {
			temp[i][j] = 0;
			for(k = 0; k < n; k++) {
				temp[i][j] = (temp[i][j] + a[i][k] * b[k][j]) % mod;
			}
		}
	}
	for(i = 0; i < n; i++) {
		for(j = 0; j < n; j++) {
			a[i][j] = temp[i][j];
		}
	}
	return;
}
void power(ll y, ll n) {
	ll i, j;
	for(i = 0; i < n; i++) {
		for(j = 0; j < n; j++) {
			if(i == j) {
				ans[i][j] = 1;
			} else {
				ans[i][j] = 0;
			}
		}
	}
	while(y) {
		if(y & 1) {
			mul(ans, mat, n);
		}
		y /= 2;
		mul(mat, mat, n);
	}
	return;
}
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, k, i, j;
    cin>>n>>k;
    for(i = 0; i < n; i++) {
    	for(j = 0; j < n; j++) {
    		cin>>mat[i][j];
    	}
    }
    power(k, n);
    ll sum = 0;
    for(i = 0; i < n; i++) {
    	for(j = 0; j < n; j++) {
    		sum = (sum + ans[i][j]) % mod;
    	}
    }
    cout<<sum<<"\n";
}


Measured memory_bytes: 384
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def main():
    a,b,c = map(int,input().split())
    if a==b and b==c:
        print(1)
    elif a==b or b==c or a==c:
        print(2)
    else:
        print(3)
    return

if __name__=='__main__':
    main()

Measured memory_bytes: 38508
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

typedef long long LL;

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

int main(int argc, char* argv[]) {
	while (true) {
		LL a = -1, b = -1;
		cin >> a >> b;
		if (a < 0 || b < 0) break;
		LL g = gcd(a, b);
		LL ans = 1;
		for (LL i = 2; i * i <= g; ++i) {
			if ((g % i) == 0) {
				++ans;
				while ((g % i) == 0) {
					g /= i;
				}
			}
		}
		ans += g > 1;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
s1 = input()
s2 = input()

s = set(zip(s1, s2))
lst = list(s)
if len(set([x[0] for x in lst])) != len(set([x[1] for x in lst])):
    print("No")
    exit(0)

ret = ""
for x in s1:
    appended = False
    for y in s:
        if y[0] == x:
            ret += y[1]
            appended = True
            break
    if not appended:
        ret += x
if s2 == ret:
    print("Yes")
else:
    print("No")    

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
char s[1000005];
int main(){
    scanf("%s",s+1);
    int cnt=0,l=strlen(s+1);
    for(int i=l;i>=1;--i){
        if(s[i]<'5'||(s[i]=='5'&&s[i-1]<'5')){
        	cnt+=s[i]-'0';
		}else{
            cnt+=10-(s[i]-'0');
            ++s[i-1];
        }
    }
    if(s[0]){
    	++cnt;
	}
	cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 1280
from itertools import product

n = int(input())
A = list(map(int, input().split()))
q = int(input())
M = list(map(int, input().split()))
a_sum = set()


for a in product(*((x,0) for x in A)):
    a_sum.add(sum(a))

for m in M:
    if m in a_sum:
        print("yes")
    else:
        print("no")



Measured memory_bytes: 5716
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(),(a).end()
using lint = long long;
template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }
inline int bitCount(int x) { return __builtin_popcount(x); }
inline int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//

int N, M;
Vec< set< int > > edge;

using pii = pair< int, int >;
set< pii > used;
Vec< int > outdeg;

bool isUsed(int c, int d) {
	return used.count(pii(c,d)) || used.count(pii(d,c));
}

void useEdge(int c, int d) {
	cout << c+1 << " " << d+1 << endl;
	++outdeg[c];
	used.insert(pii(c,d));
	used.insert(pii(d,c));
}

int main() {
	cin >> N >> M;
		
	if (M & 1) {
		puts("-1");
		return 0;
	}
	
	edge.assign(N, set< int >());
	for_(i,0,M) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		edge[a].insert(b);
		edge[b].insert(a);
	}
	
	// construction
	outdeg.assign(N, 0);
	Vec< bool > vis(N, false);
	set< pii > order;
	for_(v,0,N) order.insert(pii(edge[v].size(), v));
	
	for_(i,0,N) {
		pii p = *order.begin();
		order.erase(p);
		
		int v = p.second;
		//cerr << "# " << v+1 << " " << outdeg[v] << endl;
		vis[v] = true;
		Vec< int > adj(allof(edge[v]));
		for (int u : adj) {
			if (outdeg[v] & 1) useEdge(v, u);
			else useEdge(u, v);
			order.erase(pii(edge[u].size(), u));
			edge[v].erase(u);
			edge[u].erase(v);
			if (!vis[u]) order.insert(pii(edge[u].size(), u));
		}
	}
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 20608
// AOJ 0526
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#define rep(i,a) for( int i = 0; i != (a); ++i )

const int INF = 1 << 30;
typedef std::pair<int, int> P;

int n, k;
std::vector<P> G[100];
int d[100];

void dijkstra( int s )
{
	std::fill( d, d+n, INF );
	std::priority_queue<P> pque;
	pque.push( P( 0, s ) );
	d[s] = 0;

	while( !pque.empty() )
	{
		P p = pque.top(); pque.pop();
		int dist = -p.first, v = p.second;

		if( d[v] < dist )
			continue;

		rep( i, G[v].size() )
		{
			P &e = G[v][i];

			if( d[e.first] > d[v]+e.second )
			{
				d[e.first] = d[v]+e.second;
				pque.push( P( -d[e.first], e.first ) );
			}
		}
	}

	return;
}

int main()
{
	while( scanf( "%d%d", &n, &k ), n|k )
	{
		rep( i, 100 )
			G[i].clear();

		rep( i, k )
		{
			int t;
			scanf( "%d", &t );

			if( t )
			{
				int c, d, e;
				scanf( "%d%d%d", &c, &d, &e );
				--c; --d;

				G[c].push_back( P( d, e ) );
				G[d].push_back( P( c, e ) );
			}
			else
			{
				int a, b;
				scanf( "%d%d", &a, &b );
				--a; --b;

				dijkstra( a );

				printf( "%d\n", d[b]==INF?-1:d[b] );
			}
		}
	}

	return 0;
}

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

int main() {
	int n, cnt = 0;
	cin >> n;
	int a[n];
	for (int i = 1; i <= n; i++) a[i] = 0;
	for (int i = 1; i <= n; i++) cin >> a[i];
	
	for (int i = 1; i <= n; i = a[i]) {
		cnt++;
		if (a[i] == 2) {
			cout << cnt << endl;
			return 0;
		}
		else if (cnt > n) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    string ans="No";
    for(int i=0;i<=25;i++){
        for(int j=0;j<=15;j++){
            if(n==(4*i)+(7*j)){
                ans="Yes";
                break;
            }
        }
        if(ans=="Yes") break;
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
  size_t N;
  cin >> N;

  vector<size_t> W;
  for (size_t i = 0; i < N; i++) {
    size_t w;
    cin >> w;
    W.emplace_back(w);
  }

  size_t max_abs = 1000000000000;
  for (size_t i = 1; i < N; i++) {
    size_t f = 0;
    size_t s = 0;
    for (size_t j = 0; j < i; j++) {
      f += W[j];
    }
    for (size_t j = i; j < N; j++) {
      s += W[j];
    }

    size_t abs = f > s ? f - s : s - f;
//    cout << i << " @@@ " << f << ", " << s << ",, " << abs << endl;
    if (abs <= max_abs) {
      max_abs = abs;
    }
  }

  cout << max_abs <<endl;

  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int a, b; cin>>a>>b;
    cout << max(max(a+b, a-b), a*b) << "\n";
	return 0;
}


Measured memory_bytes: 256
def pf(n):
  a = []
  N = n
  for i in range(2, int(pow(N,0.5)//1+2)):
    if n%i==0:
      count=0
      while n%i==0:
        count+=1
        n//=i
      a.append(count)
  if n!=1:
    a.append(1)
  if a==[]:
    a.append(1)
  return a
import fractions
A,B=map(int,input().split())
c=fractions.gcd(A,B)
ans=len(pf(c))
print(ans+(1 if c>1 else 0))

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(0);
#define ll long long
#define en "\n"
#define eps 1e-9
#define VECT(v)  vector<int>v
#define SCAN(v)  int temp; for(int i=0; i<n; i++) {cin>>temp; v.push_back(temp);}
#define PRINT(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout << en;
#define SORT(v)  sort(v.begin(), v.end());
#define CASEP(v) cout<<"Case "<<tc<<": "<<v<<"\n"
#define DEBUG(v) cout << v << " "; cout << en;

int main(void)
{
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif

	fast_io

	string s;
	cin >> s;

	for(int i = 0; i < s.size(); i++)
		cout << "x";
	cout << en;

	return 0;
}

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

using namespace std;

int main(void)
{
  string t;
  string n;
  string s;
  cin>>s>>t;

  for(int i=0;i<s.size();i++)
  {
    n+=t[i];
  }

  if(n==s)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  
}


Measured memory_bytes: 3624
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main () {
  ll N, A, B;
  cin >> N >> A >> B;
  if (A > B) {
    cout << 0 << endl;
    return 0;
  }
  if (N == 1) {
    if (A == B) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
    return 0;
  }
  ll mini = A * (N-1) + B;
  ll maxi = A + B * (N-1);
  cout << maxi - (mini - 1) << endl;
}


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

int main() {
    int n;
    scanf("%d", &n);
    n %= 10;
    if (n == 3) puts("bon");
    else if (n == 0 || n == 1 || n == 6 || n == 8) puts("pon");
    else puts("hon");
}


Measured memory_bytes: 3660
#include <stdio.h>

int main(void){
    int a[3][10]={0},b[3][10]={0},c[3][10]={0},d[3][10]={0};
    int n,i,o,t,f,r,v,j;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d %d %d",&t,&f,&r,&v);
        switch(t){
            case 1:a[f-1][r-1]+=v;break;
            case 2:b[f-1][r-1]+=v;break;
            case 3:c[f-1][r-1]+=v;break;
            case 4:d[f-1][r-1]+=v;break;
        }
    }
    for(o=0;o<3;puts(""),o++)
        for(j=0;j<10;j++)
            printf(" %d",a[o][j]);
    for(i=0;i<20;i++)
        printf("#%s",i==19?"\n":"");
    for(o=0;o<3;puts(""),o++)
        for(j=0;j<10;j++)
            printf(" %d",b[o][j]);
    for(i=0;i<20;i++)
        printf("#%s",i==19?"\n":"");
    for(o=0;o<3;puts(""),o++)
        for(j=0;j<10;j++)
            printf(" %d",c[o][j]);
    for(i=0;i<20;i++)
        printf("#%s",i==19?"\n":"");
    for(o=0;o<3;puts(""),o++)
        for(j=0;j<10;j++)
            printf(" %d",d[o][j]);
    return 0;
}

Measured memory_bytes: 608
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <bitset>
#include <tuple>
#include <stack>
#include <utility>

using namespace std;
typedef long long ll;

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll state = 0, ans = 0;
    while(1){
        if(state == 0){
            if(c > 0){
                ans += 1;
                c -= 1;
                state = 1;
            }
            else if(b > 0){
                b -= 1;
                ans += 1;
            }
            else break;
        }
        else{
            if(a > 0){
                a -= 1;
                state = 0;
            }
            else if(b > 0){
                b -= 1;
                ans += 1;
                state = 0;
            }
            else break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<fstream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<set>
#include<string>
#include<queue>
#include<map>
#include<iomanip>
#include<cassert>
#include<complex>
#include<functional>
#include<list>
#include<cmath>
#include<stack>
#include<assert.h>
#define LL long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define F first
#define S second
using namespace std;
int h,n;
int a;
LL sum;
int main(){
  cin>>h>>n;
  for(int i=0;i<n;i++){
  	cin>>a;
  	sum+=a;
  }
  if(sum>=h)
    puts("Yes");
  else
    puts("No");
  return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		FastScanner stdIn = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = stdIn.nextInt();
		Map<String,Integer> map = new TreeMap<>();
		int max = 0;
		for(int i = 0; i < n; i++) {
			String s = stdIn.next();
			int val = map.containsKey(s)?map.get(s)+1:1;
			map.put(s,val);
			max = Math.max(max, val);
			
		}
		for(String s:map.keySet()) {
			if(map.get(s)==max) {
				out.println(s);
			}
		}
		out.flush();
	
	}

}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 61268
// Problem : E - Roaming
// Contest : AtCoder - AtCoder Beginner Contest 156
// URL : https://atcoder.jp/contests/abc156/tasks/abc156_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#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;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 200005

//Solution

int binpow(int x,int y){
    x %= mod;
    int res = 1;
    while(y){
        if(y&1) res = (res*x)%mod;
        x = (x*x)%mod;
        y = y/2;
    }
    return res;
}
 
int inv(int a){
    return binpow(a,mod-2);
}
 
int fact[N], invfact[N];
 
void precompute(){
    fact[0] = 1;
    for(int i=1;i<N;i++) fact[i] = (fact[i-1]*i)%mod;
    invfact[N-1] = inv(fact[N-1])%mod;
    for(int i=N-2;i>=0;i--) invfact[i] = (invfact[i+1]*(i+1))%mod;
}
 
int ncr(int n, int r){
    if(n<r) return 0;
    return (((fact[n]*invfact[r])%mod)*invfact[n-r])%mod;
}    

void solve(){
    precompute();
    int n,k;
    cin>>n>>k;
    int m = min(n-1,k);
    int ans = 0;
    for(int i=0;i<=m;i++){
        int cur = ncr(n,i);
        cur *= ncr(n-1,n-i-1);
        cur %= mod;
        ans += cur;
        ans %= mod;
    }
    cout<<ans<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 6764
#include <bits/stdc++.h>
using namespace std;
#define pi 3.1415926535897932
//to set precision use fixed,setprecision(number_of_points_after_decimal
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define mod 1000000007
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
void solution(){
    long double a,b,h,m;cin>>a>>b>>h>>m;
    long double md=m*6.0;
    long double hd=30.0*h + md/12;
    long double deg=abs(hd-md);

    long double codeg=cos(deg*(pi/180));
    long double answer=a*a + b*b -2*a*b*codeg;
    answer=sqrt(answer);
    cout<<fixed<<setprecision(10)<<answer<<endl;

}



int main() {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);
   // int t;cin>>t;
   // while(t--){
    solution();
   // }
    return 0;
}

Measured memory_bytes: 4128
l,r=gets.split(' ').map(&:to_i)
if l/2019!=r/2019||l%2019==0
  p 0
else
  l%=2019
  r%=2019
  res=(l...r).map do |i|
    ((i+1)..r).map do |j|
      (i*j)%2019
    end.min
  end.min
  p res
end


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

int main()
{
    int t,n,m,sum=0;
    vector<int>v1,v2;
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        cin>>n;
        v1.push_back(n);
    }
    for(int i=1;i<=t;i++)
    {
        cin>>m;
        v2.push_back(m);
    }
    for(int i=0;i<t;i++)
    {
        if(v1[i]-v2[i]>0)
            sum+=(v1[i]-v2[i]);
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    string a,b,c;
    cin >> a >> b >> c ;
    transform(a.begin(),a.end(),a.begin(),::toupper);
    transform(b.begin(),b.end(),b.begin(),::toupper);
    transform(c.begin(),c.end(),c.begin(),::toupper);
    cout << a[0] << b[0] << c[0] << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b==c || c+b==a || a+c==b)
     cout<<"Yes";
    else 
     cout<<"No";
     return 0;
}
     
   

Measured memory_bytes: 3592
#include<stdio.h>

int main(void){
	int H,W;
	int i,j;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0&&W==0)	break;
		for(i=0;i<H;i++){
			for(j=0;j<W;j++){
				if((j+i)%2==0)	printf("#");
				else printf(".");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
N, M = map(int, input().split())

x = abs(N-M)
if x >= 2:
    print(0)
else:
    mod = 10**9+7
    a = 1
    for i in range(2, N+1):
        a *= i
        a %= mod
    b = 1
    for i in range(2, M+1):
        b *= i
        b %= mod
    
    if x == 0:
        print(a*b*2%mod)
    else:
        print(a*b%mod)

Measured memory_bytes: 9100
package main

import "fmt"


func scanInt64() int64{
	var v int64;
	fmt.Scan(&v)
	return v
}

func f(level int,layer int64,length,pattys *[]int64) (pattyCount,remains int64) {
	if(layer <= 0){
		return 0,0
	}
	if x := layer - (*length)[level];x>=0{
		return (*pattys)[level],x
	}
	if level==0{
		return 1,layer-1
	}
	tmpPattys := int64(0)

	// ban
	layer--
	if (layer==0){return pattyCount,0}

	// L-1
	tmpPattys,layer = f(level-1,layer,length,pattys)
	pattyCount += tmpPattys
	if (layer==0){return pattyCount,0}

	// patty
	pattyCount++
	layer--
	if (layer==0){return pattyCount,0}

	// L-1
	tmpPattys,layer = f(level-1,layer,length,pattys)
	pattyCount += tmpPattys
	if (layer==0){return pattyCount,0}

	// ban
	layer--
	if (layer==0){return pattyCount,0}

	panic("hoge")
	}

func main() {

	length := make([]int64,51)
	pattys := make([]int64,51)
	length[0] = 1
	pattys[0] = 1
	for i:=1;i<51 ;i++  {
		length[i] = 3 + 2*length[i-1]
		pattys[i] = 2* pattys[i-1] + 1
	}
	N := int(scanInt64())
	X := scanInt64()
	ans,_ :=  f(N,X,&length,&pattys)
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++)
    cin >> a[i];
  int ans = -1;
  int min = 100000;
  int sum = 0;
  for (int i = 0; i < N; i++)
    sum += a[i];
  for (int i = 0; i < N; i++)
  {
    if (abs(N * a[i] - sum) < min)
    {
      ans = i;
      min = abs(N * a[i] - sum);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000000000;
const int mod = 1000000007;
int test[12345678], res[12345678][20];
signed main() {
	vector<char> v; map<int, int> cost;
	int n, m, a, b, c, x, cnt = 0, ans = INF; string s, t;
	cin >> n >> m >> x;
	for (int h = 0; h < n; h++) {
		cin >> res[h][0];
		for (int i = 1; i <= m; i++) {
			cin >> res[h][i];
		}
	}
	for (int i = 0; i <= (1 << n); i++) {
		vector<int> sep = { }; int z = 0; cnt = 0;
		for (int h = 0; h < 100; h++) {
			test[h] = 0;
		}
		for (int j = 0; j <= n - 1; j++) {
			if ((i & (1 << j)) > 0) {
				sep.push_back(j);
			}
		}
		if (sep.size() == 0) { continue; }
		for (int h = 0; h < sep.size(); h++) {
			cnt += res[sep[h]][0];
			for (int j = 1; j <= m; j++) {
				test[j] += res[sep[h]][j];
			}
		}
		for (int h = 1; h <= m; h++) {
			if (test[h] < x) { z++; }
			//cout << i << ' ' << test[h] << endl;
		}
		if (z == 0) { ans = min(ans, cnt); }
	}
	if (ans == INF) { cout << -1 << endl; return 0; }
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3620
import math
N = int(input())
A=list(map(int, input().split())) 
B=list(map(int, input().split())) 

ans = 0
for idx, item in enumerate(B):
    a = min(item, A[idx])
    ans += a
    if (item > a):
        if ((item-a) < A[idx+1]):
            ans += (item-a)
            A[idx+1] -= (item-a)
        else :
            ans += A[idx+1]
            A[idx+1] = 0     

print(ans)


Measured memory_bytes: 19244
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);i++)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<ll,ll> P;
typedef pair<ll,ll> PL;
const ll mod = 998244353;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
   T res = 1;
   for(;n;n>>=1) {
      if (n & 1) res = res * a;
      a = a * a;
   }
   return res;
}

//cin.tie(0);ios::sync_with_stdio(false);
//cout<<fixed<<setprecision(20);

long long modpow(long long a, long long n, long long MOD) {//a^n(MOD)を求める
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;//次の準備
        n >>= 1;
    }
    return res;
}


signed main(){
    ll n,ans=1;cin>>n;
    vector<ll> d(n+5,0);
    rep(i,0,n){
        ll x;cin>>x;
        if(i==0 && x!=0){
            cout<<0<<endl;
            return 0;
        }
        d[x]++;
    }

    ll mx=-1;
    rep(i,0,n){
        if(d[i]>0)mx=max(mx,i);
    }

    if((d[0]!=1))ans=0;

    rep(i,1,mx+1){
        ans*=modpow(d[i-1],d[i],mod);
        ans%=mod;
    }
    cout<<ans%mod<<endl;
}


//( ・ __ ・ ) ぷえええええええん

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int n,i,aa,a,b,x,y,ama;
	scanf("%d",&n);
	scanf("%d",&aa);
	for(i=1;i<n;i++)	{
		scanf("%d",&b);
		if(b>aa)	swap(aa,b);
		x=aa;	y=b;
		while(1)	{
			ama=x%y;
			if(ama==0)	break;
			x=y;	y=ama;
		}
		aa=aa/y*b;
	}
	printf("%d\n",aa);
	return 0;
}


Measured memory_bytes: 2764
N = int(input())
p = list(map(int, input().split()))
count = 0

if p[-1] == N:
    p[-2] = p[-1]
    p[-1] = p[-2]
    count += 1

for i in range(N-1):
    if p[i] == i + 1:
        p[i+1] = p[i]
        p[i] == p[i+1]
        count += 1
    else:
        continue
print(count)

Measured memory_bytes: 14008
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int k;
    cin>>k;
    ll ans=0;
    for(int i=1;i<=k;i++)
    {
        for(int j=1;j<=k;j++)
        {
            for(int l=1;l<=k;l++)
            {
                ll gc=__gcd(i,__gcd(j,l));
                ans +=gc;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3652
while True:
  a,b,c = map(int,input().split())
  if a == 0 and b == 0 and c == 0:
    break
  lst = [2 for i in range(a + b + c)]
  ilst = []
  n = int(input())
  for i in range(n):
    i,j,k,r = map(int,input().split())
    if r == 0:
      ilst.append((i,j,k))
    else:
      lst[i - 1] = 1
      lst[j - 1] = 1
      lst[k - 1] = 1
  for (i,j,k) in ilst:
    if lst[i - 1] == 1 and lst[j - 1] == 1:
      lst[k - 1] = 0
    elif lst[i - 1] == 1 and lst[k - 1] == 1:
      lst[j - 1] = 0
    elif lst[j - 1] == 1 and lst[k - 1] == 1:
      lst[i - 1] = 0
  for i in lst:
    print(i)


Measured memory_bytes: 5656
#include<stdio.h>


int ans( int maxy ,int miny ,int N )
{
	if( maxy > N - miny )
	{
		return ( N - maxy + 1 ) % 3 ;
	}

	return miny % 3 ;
}


int main( void )
{
	int put[] = { 3 ,1 ,2 } ;

	int N ,M ;
	scanf( "%d %d" ,&N ,&M ) ;

	int i ;
	for( i = 0 ; i < M ; ++i )
	{
		int x ,y ;
		scanf( "%d %d" ,&x ,&y ) ;

		if( y > x )
		{
			x += y ;
			y = x - y ;
			x = x - y ;
		}

		printf( "%d\n" ,put[ ans( x ,y ,N ) ] ) ;
	}

	return 0 ;
}

Measured memory_bytes: 2696
local mma, mmi = math.max, math.min
local ior = io.input()
local n, m, x, y = ior:read("*n", "*n", "*n", "*n")
local xmax = -100
local ymin = 100
for i = 1, n do
  local a = ior:read("*n")
  xmax = mma(xmax, a)
end
for i = 1, m do
  local a = ior:read("*n")
  ymin = mmi(ymin, a)
end
if ymin <= xmax then
  print("War")
else
  local found = false
  for z = xmax + 1, ymin do
    if x < z and z <= y then
      found = true
      break
    end
  end
  print(found and "No War" or "War")
end


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

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

int main(){
    int n, m; cin >> n >> m;
    vector <vector <int>> G(n + 1);
    rep(i, m){
        int from, to; cin >> from >> to;
        G.at(from).push_back(to);
        G.at(to).push_back(from);
    }

    // rep(i, n + 1){
    //     rep(j, G.at(i).size())cout << G.at(i).at(j) << " ";
    //     cout << endl;
    // }

    vector <int> one_pattern;
    rep(i, n){
        if(i == 0) continue;
        one_pattern.push_back(i + 1);
    }

    int ans = 0;

    do{
        vector <int> now_pattern(1, 1);
        copy(one_pattern.begin(), one_pattern.end(), back_inserter(now_pattern));
        // rep(i, one_pattern.size()) cout << one_pattern.at(i) << " ";
        // cout << endl;
        bool ok = true;
        rep(i, n){
            if(i == 0) continue;
            int now, pre;
            now = now_pattern.at(i); pre = now_pattern.at(i - 1);
            if((find(G.at(pre).begin(), G.at(pre).end(), now)) != G.at(pre).end()) continue;

            // if(G.at(pre).size() == 0) ok = false;
            // rep(j, G.at(pre).size()){
            //     if(G.at(pre).at(j) == now){
            //         ok = true;
            //         break;
            //     }
            //     ok = false;
            // }
            ok = false;
            break;
        }

        if(ok) ans += 1;
        // if(ok){
        //         rep(i, one_pattern.size()) cout << one_pattern.at(i) << " ";
        //         cout << endl;
        //     }

    } while (next_permutation(one_pattern.begin(), one_pattern.end()));

    cout << ans << endl;
}

Measured memory_bytes: 3576
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int v[] = new int[n];
            int c[] = new int[n];
            for (int i = 0; i < n; i++) {
                v[i] = Integer.parseInt(in.next());
            }
            for (int i = 0; i < n; i++) {
                c[i] = Integer.parseInt(in.next());
            }
            int ans = 0;
            for (int i = 0; i < n; i++) {
                if (v[i] > c[i]) {
                    ans += v[i] - c[i];
                }
            }

            out.println(ans);
        }

    }
}



Measured memory_bytes: 23764
#include <stdio.h>


int max(int a, int b,int c){
  if(a>b && a > c){
    return a;
  }else if(b > c && b > a){
    return b;
  }else{
    return c;
  }
}

int main(){
  int i,j;
  int v[110],w[110],dp[110][10010];
  int N,W;
  scanf("%d %d",&N,&W);

  for(i = 1; i <= N ; i++){
    scanf("%d %d",&v[i],&w[i]);
  }
  for(i = 0; i <= W ; i++){
    dp[0][i] = 0;
  }

  for(i = 1; i <= N; i++){
    for(j = 0; j <= W ; j++){
      if(j >= w[i]){
	dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i]]+v[i],dp[i][j-w[i]]+v[i]);
      }else{
	dp[i][j] = dp[i-1][j];
      }
    }
   
  }
  printf("%d\n",dp[N][W]);


  return 0;
}



Measured memory_bytes: 5744
N=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))

# Bの値を決める
# Bより小さいAを二分探索、Bより大きいAを二分探索、その積を各Bごとに求めて足していく

import bisect
ans=0
for i in range(len(B)):
  apos=bisect.bisect_left(A,B[i])
  cpos=bisect.bisect_right(C,B[i])
  ans+=(apos)*(N-cpos)
print(ans)

Measured memory_bytes: 23200
//https://codeforces.com/contest/1335/problem/

#include <bits/stdc++.h>
#define ll long long int
#define pll pair<ll, ll>
#define pii pair<int, int>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    double tpi = 6.28318530717958623200;
    double x;
    cin >> x;
    double z = tpi * x;
    cout << setprecision(3) << fixed;
    cout << z << '\n';
    return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    string s;
    cin>>s;
    ll ans = 1, cnt[256]={};
    for(int i=0;i<s.size();i++){
        ans += i - cnt[s[i]];
        cnt[s[i]]++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640