akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
	char b;
	scanf("%c", &b);
	if(b == 'a' || b == 'e' || b == 'i' || b == 'o' || b == 'u'){
		printf("vowel\n");
	}else {
		printf("consonant\n");
	}
	return 0;
}

Measured memory_bytes: 128
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 100000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	int a,b,c;
	cin>>a>>b>>c;
	bool ans1 = (a==b && b!=c);
	bool ans2 = (a==c && a!=b);
	bool ans3 = (b==c && a!=b);
	(ans1|ans2|ans3)?cout<<"Yes":cout<<"No";
	return 0;
}

Measured memory_bytes: 384
# kotae mita
def main():
    N, K, C = map(int, input().split())
    S = input()
    l = [0] * N
    r = [0] * N
    j = K+1
    d = {}
    t = None
    for ii, v in enumerate(reversed(S)):
        i = N - ii - 1
        if v == 'x':
            continue
        if t is None or t - C > i:
            j -= 1
            r[i] = j
            t = i
    if j <= 0:
        return
    t = None
    j = 0
    for i, v in enumerate(S):
        if v == 'x':
            continue
        if t is None or t + C < i:
            j += 1
            l[i] = j
            t = i
    if j > K:
        return
    rr = []
    for i in range(N):
        if r[i] > 0 and r[i] == l[i]:
            rr.append(i+1)
    for i in rr:
        print(i)
main()


Measured memory_bytes: 28544
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	
	private static Map<Character,String> first_map = new HashMap<Character,String>(32);
	private static Map<String,String> second_map = new HashMap<String,String>(32);
	
	private static void init(){
		first_map.put('A' , "00000");
		first_map.put('B' , "00001");
		first_map.put('C' , "00010");
		first_map.put('D' , "00011");
		first_map.put('E' , "00100");
		first_map.put('F' , "00101");
		first_map.put('G' , "00110");
		first_map.put('H' , "00111");
		first_map.put('I' , "01000");
		first_map.put('J' , "01001");
		first_map.put('K' , "01010");
		first_map.put('L' , "01011");
		first_map.put('M' , "01100");
		first_map.put('N' , "01101");
		first_map.put('O' , "01110");
		first_map.put('P' , "01111");
		first_map.put('Q' , "10000");
		first_map.put('R' , "10001");
		first_map.put('S' , "10010");
		first_map.put('T' , "10011");
		first_map.put('U' , "10100");
		first_map.put('V' , "10101");
		first_map.put('W' , "10110");
		first_map.put('X' , "10111");
		first_map.put('Y' , "11000");
		first_map.put('Z' , "11001");
		first_map.put(' ' , "11010");
		first_map.put('.' , "11011");
		first_map.put(',' , "11100");
		first_map.put('-' , "11101");
		first_map.put('\'' , "11110");
		first_map.put('?' , "11111");
		
		second_map.put("101" , " ");
		second_map.put("000000" , "'");
		second_map.put("000011" , ",");
		second_map.put("10010001" , "-");
		second_map.put("010001" , ".");
		second_map.put("000001" , "?");
		second_map.put("100101" , "A");
		second_map.put("10011010" , "B");
		second_map.put("0101" , "C");
		second_map.put("0001" , "D");
		second_map.put("110" , "E");
		second_map.put("01001" , "F");
		second_map.put("10011011" , "G");
		second_map.put("010000" , "H");
		second_map.put("0111" , "I");
		second_map.put("10011000" , "J");
		second_map.put("0110" , "K");
		second_map.put("00100" , "L");
		second_map.put("10011001" , "M");
		second_map.put("10011110" , "N");
		second_map.put("00101" , "O");
		second_map.put("111" , "P");
		second_map.put("10011111" , "Q");
		second_map.put("1000" , "R");
		second_map.put("00110" , "S");
		second_map.put("00111" , "T");
		second_map.put("10011100" , "U");
		second_map.put("10011101" , "V");
		second_map.put("000010" , "W");
		second_map.put("10010010" , "X");
		second_map.put("10010011" , "Y");
		second_map.put("10010000" , "Z");
	}
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		init();
		
		while(sc.hasNextLine()){
			String str = sc.nextLine();
			StringBuilder sb_f = new StringBuilder();
			StringBuilder sb_s = new StringBuilder();
			for(char c:str.toCharArray()){
				sb_f.append(first_map.get(c));
			}
			
			String fir = sb_f.toString();
			
			
			while(true){
				boolean hit = false;
				for(String s : second_map.keySet()){
					if(fir.startsWith(s)){
						sb_s.append(second_map.get(s));
						fir = fir.substring(s.length(),fir.length());
						hit = true;
						break;
					}
				}
				
				if(!hit){
					break;
				}
			}
			
			System.out.println(sb_s);
		}
	}
}

Measured memory_bytes: 12000
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int N, M;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;

  vector<int> food(M, 0);
  //  vector<vector<int> > A(N, vector<int>(N));

  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    for (int j = 0; j < tmp; j++) {
      int f;
      cin >> f;
      food[f - 1] += 1;
    }
  }

  int ans = 0;
  for (int i = 0; i < M; i++) {
    if (food[i] == N) ans++;
  }

  cout << ans << '\n';
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, D: int, X: "List[int]", Y: "List[int]"):
    ans = 0
    for i in range(N):
        if X[i]**2 + Y[i]**2 <= D*D:
            ans += 1

    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    X = [int()] * (N)  # type: "List[int]"
    Y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        X[i] = int(next(tokens))
        Y[i] = int(next(tokens))
    solve(N, D, X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 42532
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <queue>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

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

typedef int weight;
struct edge {
	int to;
	weight cost;
	edge(int t, weight c):to(t), cost(c){}
};
typedef pair<weight, int> P;
constexpr int INF = 0xfffffff;

vector<int> dijkstra(int s, int cap, const vector<vector<edge>>& es) {
	priority_queue<P, vector<P>, greater<P> > que;
	vector<int> dist(es.size(), INF);
	que.push(P(0, s));
	dist[s] = 0;

	while(!que.empty()) {
		const P p = que.top();
		que.pop();
		const int v = p.second;

		if(dist[v] < p.first)
			continue;

		for(int i = 0; i < (int)es[v].size(); ++i) {
			const edge& e = es[v][i];
			const weight next_dist = dist[v] + e.cost;
			if(next_dist > cap * 10) continue;

			if(dist[e.to] > next_dist) {
				dist[e.to] = next_dist;
				que.push(P(dist[e.to], e.to));
			}
		}
	}

	return dist;
}

unordered_map<string, int> en;
inline int encode(const string& s) {
	if(!en.count(s)) en.insert(make_pair(s, en.size()));
	return en[s];
}

inline int input_city() {
	string s;
	cin >> s;
	return encode(s);
}

inline int calc_nearest_city(const vector<int>& LPG, const vector<int>& dist) {
	int idx = LPG[0];
	for(int i = 1; i < (int)LPG.size(); ++i) {
		if(dist[idx] > dist[LPG[i]]) idx = LPG[i];
	}
	return idx;
}

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

	for(int n, m, cap; cin >> n >> m >> cap && n;) {
		en.clear();
		const int s = input_city();
		const int t = input_city();

		vector<tuple<int, int, int>> edges;
		edges.reserve(n);
		for(int i = 0; i < n; ++i) {
			const int a = input_city();
			const int b = input_city();
			int cost;
			cin >> cost;
			edges.emplace_back(a, b, cost);
		}

		vector<int> LPG(m);
		for(int i = 0; i < m; ++i) {
			LPG[i] = input_city();
		}

		const int number_of_city = static_cast<int>(en.size());
		vector<vector<edge>> es(number_of_city);
		for(int i = 0; i < n; ++i) {
			int a, b, cost;
			tie(a, b, cost) = edges[i];
			es[a].emplace_back(b, cost);
			es[b].emplace_back(a, cost);
		}

		vector<int> dist = dijkstra(s, cap, es);
		for(int i = 0; i < m; ++i) {
			const int next = calc_nearest_city(LPG, dist);
			LPG.erase(remove(LPG.begin(), LPG.end(), next), LPG.end());
			vector<int> tmp = dijkstra(next, cap, es);
			for(int i = 0; i < number_of_city; ++i) {
				chmin(dist[i], dist[next] + tmp[i]);
			}
		}

		cout << (dist[t] == INF ? -1 : dist[t]) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 2096
n = int(raw_input())
al = map(int, raw_input().split())
bl = map(int, raw_input().split())
cl = map(int, raw_input().split())
al.sort()
bl.sort()
cl.sort()
l = [(0,0) for _ in range(n)]
p = 0
for i, b in enumerate(bl):
    while p < n and cl[p] <= b:
        p += 1
    l[i] = (b, n-p)
p = n-1
s = 0
t = 0
for a in al[::-1]:
    while p >= 0 and l[p][0] > a:
        s += l[p][1]
        p -= 1
    t += s
print t


Measured memory_bytes: 24024
import kotlin.math.abs
import kotlin.math.min

fun main() = msolutions2020e()

@OptIn(ExperimentalStdlibApi::class)
fun msolutions2020e() {
    val n = readLine()!!.toInt()
    val xList = IntArray(n)
    val yList = IntArray(n)
    val pList = IntArray(n)
    repeat(n) { i ->
        val (x, y, p) = readLine()!!.split(" ").map { it.toInt() }
        xList[i] = x
        yList[i] = y
        pList[i] = p
    }

    val choosePatterns = 1 shl n
    // 何もしてないのときの移動距離
    val baseDistances = (0 until n).map { min(abs(yList[it]), abs(xList[it])) }.toIntArray()
    // [その集合の街を基準に『横』に線路を引いたとき][i番目の街の] = 移動距離の最小
    val costsVert = Array(choosePatterns) { baseDistances.copyOf() }
    // [その集合の街を基準に『縦』に線路を引いたとき][i番目の街の] = 移動距離の最小
    val costsHorz = Array(choosePatterns) { baseDistances.copyOf() }

    val diffVert = Array(n) { IntArray(n) { Int.MAX_VALUE } }
    val diffHorz = Array(n) { IntArray(n) { Int.MAX_VALUE } }

    for (from in 0 until n) for (to in 0 until n) {
        diffVert[from][to] = min(diffVert[from][to], abs(yList[from] - yList[to]))
        diffHorz[from][to] = min(diffHorz[from][to], abs(xList[from] - xList[to]))
    }

    for (choose in 0 until choosePatterns) {
        for (from in (0 until n)) {
            if ((choose shr from) and 1 == 0) continue
            for (to in 0 until n) {
                costsVert[choose][to] = min(costsVert[choose][to], diffVert[from][to])
                costsHorz[choose][to] = min(costsHorz[choose][to], diffHorz[from][to])
            }
        }
    }

    val answers = LongArray(n + 1) { Long.MAX_VALUE }

    for (i in 0 until (3).simplePowExact(n)) {
        var chooseVertBit = 0
        var chooseHorzBit = 0
        var bitOfChooseTypes = i
        var bitOfDigit2 = 1

        while (bitOfChooseTypes > 0) {
            when (bitOfChooseTypes % 3) {
                1 -> chooseVertBit = chooseVertBit or bitOfDigit2
                2 -> chooseHorzBit = chooseHorzBit or bitOfDigit2
            }
            bitOfDigit2 = bitOfDigit2 shl 1
            bitOfChooseTypes /= 3
        }

        var costSum = 0L
        for (i in 0 until n) {
            costSum += min(costsVert[chooseVertBit][i], costsHorz[chooseHorzBit][i]).toLong() * pList[i]
        }
        
        val chooseCount = Integer.bitCount(chooseVertBit or chooseHorzBit)
        answers[chooseCount] = min(answers[chooseCount], costSum)
    }

    val answer = answers.joinToString(System.lineSeparator())

    println(answer)
}

private fun Int.simplePowExact(p: Int): Int {
    var x = 1
    repeat(p) { x = Math.multiplyExact(x, this) }
    return x
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------
vector<long long> factor_array(long long n){
    vector<long long> res ;
    for(long long i=1;i*i<=n;i++){
        if(n%i==0){
            res.push_back(i) ;
            if(i*i!=n){
                res.push_back(n/i) ;
            }
        }
    }
    sort(res.begin(),res.end()) ;
    return res ;
}
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();
    int n ;
    cin >> n ;
    vint a(n+1) ;
    vint b(n+1,0) ;
    REP(i,n){
        cin >> a[i+1] ;
    }
    set<int> ans ;
    for(int i=n;i>0;i--){
        int cnt = 0 ;
        int j = 2*i ;
        while(j<=n){
            cnt += b[j] ;
            j += i ;
        }
        if(cnt%2!=a[i]){
            ans.insert(i) ;
            b[i] += 1 ;
        }
    }
    cout << SZ(ans) <<endl;
    IREP(i,ans){
        cout << (*i) <<" ";
    }
    cout <<endl;




    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



Measured memory_bytes: 10528
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int X,A;cin >> X >> A;
    if(X < A){
        cout<<0<<endl;
    }else{
        cout<<10<<endl;
    }
}

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

int main()
{
	int a;
	while (cin >> a, a) {
		int sum = 0;
		for (int b = 2; b < 1000; b += 2) {
			if (a%b == b/2) {
				if (a / b - b / 2 >= 0)sum++;
			}
		}
		for (int c = 3; c < 1000; c+=2) {
			if (a%c == 0) {
				if (a / c - c / 2 >= 1)sum++;
			}
		}
		cout << sum << endl;
	}
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

int n;
string s;

inline int get(char c) {
  if( c == 'R' ) return 0;
  if( c == 'G' ) return 1;
  if( c == 'B' ) return 2;
}

ll sum[3][4010];
set<int> S[3];

void solve() {

  rep(i,n) {
    int c = get(s[i]);
    ++sum[c][i];
    S[c].insert(i);
  }
  rep(j,3)
    for(int i=n-2;i>=0;--i) {
      sum[j][i] = sum[j][i] + sum[j][i+1];
    }
  ll ans = 0;
  rep(i,n) {
    REP(j,i+1,n) {
      if( s[i] == s[j] ) continue;
      int d = j - i;
      set<int> used;
      used.insert(get(s[i]));
      used.insert(get(s[j]));
      int c = -1;
      rep(i,3) if( !used.count(i) ) { c = i; break; }
      assert( c != -1 );
      ans += sum[c][j+1];
      if( S[c].count(j+d) ) --ans;
    }
  }
  cout << ans << endl;
}

int main() {
  cin >> n;
  cin >> s;
  solve();
  return 0;
}


Measured memory_bytes: 3888
n, k = map(int, input().split())
s = list(input())

n_flip = 0
s_last = s[0]
for i in range(1, len(s)):
    if s[i] != s_last:
        n_flip += 1
    s_last = s[i]
    if n_flip % 2 == 1 and n_flip // 2 < k:
        s[i] = s[0]

n_happy = 0
for i in range(len(s) - 1):
    if s[i] == s[i+1]:
        n_happy += 1

print(n_happy)


Measured memory_bytes: 49520
S = input()
if (S[0] == S[1] and S[2] == S[3] and S[0] != S[2]) or (S[0] == S[2] and S[1] == S[3] and S[0] != S[1]) or (S[0] == S[3] and S[1] == S[2] and S[0] != S[1]): print('Yes')
else: print('No')

Measured memory_bytes: 38256
N=int(input())
strings=sorted([sorted(list(input())) for i in range(N)])
strings.append("000")
cnt=0
i=0
same=1
while i<N:
    if strings[i]==strings[i+1]:
        same+=1
    else:
        cnt+=same*(same-1)/2
        same=1
    i+=1
print(int(cnt))

Measured memory_bytes: 25420
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--) 
#define Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<int>::iterator sit;
typedef pair<int, int> pii;
#define x first
#define y second
const int N = 1e5 + 10, inf = 5e6 + 10;
bool haveans = true;
int n, c[N], d[N]; pii a[N];
bool side[N];
priority_queue<pii> q;
vector<pii> nd[N];

void init() {
	rep(i,1,n) 
		a[i].x = lower_bound(c + 1, c + (n + 1) + 1, a[i].x) - c,
		a[i].y = lower_bound(c + 1, c + (n + 1) + 1, a[i].y) - c;
}

int C[N];
int main() {
	scanf("%d",&n);
	rep(i,1,n) scanf("%d%d",&a[i].x,&a[i].y);
	rep(i,1,n + 1) scanf("%d",c + i);
	sort(c + 1, c + (n + 1) + 1);
	init();
	
	memset(side, true, sizeof(side));
	rep(i,1,n + 1) d[i] = 0;
	rep(i,1,n) d[a[i].x - 1]--;
	rep(i,1,n) nd[a[i].x - 1].pb(mp(-a[i].y, i));

	int delta = 0; d[n + 2] = n;
	dep(i,n + 1,1) {
		int len = nd[i].size(); Rep(j,len) q.push(nd[i][j]);
		d[i] += d[i + 1]; C[i] = d[i] - i;
		while (C[i] < -1) {
			if (q.empty() || -q.top().x > i) { haveans = false; break; }
			else {
				pii t = q.top(); q.pop(); side[t.y] = false;
				delta++, d[i]++, C[i]++, d[-t.x - 1]--;
			}
		}
	}
	
	rep(i,0,n + 1) d[i] = 0;
	rep(i,1,n) d[side[i] ? a[i].x : a[i].y]++;
	rep(i,1,n + 1) d[i] += d[i - 1], C[i] = d[i] - i;
	
	while (!q.empty()) q.pop();
	rep(i,1,n + 1) nd[i].clear();
	rep(i,1,n) if (side[i]) nd[a[i].y].pb(mp(a[i].x - 1, i));
	int cur = 0; static int f[N];
	
	rep(i,1,n + 1) {
		int len = nd[i].size(); Rep(j,len) q.push(nd[i][j]);
		f[i] = f[i - 1];
		if (C[i] == -1) {
			if (cur < i) {
				if (q.empty() || q.top().x < i) f[i] = inf;
				else {
					pii t = q.top(); q.pop(); 
					cur = t.x;
					f[i]++;
				}
			}
		}
	}
	
	int q; scanf("%d",&q);
	rep(i,1,q) {
		int a, b; scanf("%d%d",&a,&b);
		a = lower_bound(c + 1, c + (n + 1) + 1, a) - c;
		b = lower_bound(c + 1, c + (n + 1) + 1, b) - c;
		if (!haveans) printf("-1\n");
		else {
			int x = f[a - 1] + delta;
			int y = f[b - 1] + delta;
			int ans = min(x, y + 1);
			if (ans > n + 1) printf("-1\n");
			else printf("%d\n",n + 1 - ans);
		}
	}
	return 0;
}

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

int main(){
  int D;
  cin >> D;
  if(D==25){
    cout << "Christmas" << endl;
  }
  if(D==24){
    cout << "Christmas Eve" << endl;
  }
  if(D==23){
    cout << "Christmas Eve Eve" << endl;
  }
  if(D==22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
}


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

using namespace std;

typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); ++i)

ll extGCD(ll a, ll b, ll &x, ll &y) {
  /*
   * ax + by = GCD(a, b) を計算
   * 戻り値はGCD(a, b)で、x, yはそれぞれ格納される
   */
  if (b==0) { // 最大公約数はa
    x = 1;
    y = 0;
    return a;
  } else {
    ll g = extGCD(b, a%b, y, x); 
    y -= a/b * x;
    return g; // gは共通
  }
}

int main() {

  ll a, b, x, y;
  cin >> a >> b;
  extGCD(a, b, x, y);
  cout << x << " " << y << endl;
  return 0;
}


Measured memory_bytes: 3136
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

s = int(input())

n = num2alpha(s)

print(n.lower())

Measured memory_bytes: 9172
def main():
    n = input()

    p1, p2 = set([0]), set()

    for i in range(n):
        y = input()
        p2 = set([0])
        for x in p1:
            p2.add(x + y)
            p2.add(x)

        p1, p2 = p2, set()

    ans = 0
    for x in p1:
        if x % 10 != 0 and x > ans:
            ans = x
    print ans


main()


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

typedef long long ll;

int main() {
    ll N, X, T;
    cin >> N >> X >> T;
    cout << (N + X - 1) / X * T << "\n";
}

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

const int maxn=300000;
int a[maxn];
int main(){
    int n;
    cin>>n;
    REP(i,n) cin>>a[i];
    int min = 1e6;
    int ans=0;
    REP(i,n){
        if(a[i]<=min){
            ans++;min=a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n, m;
    cin >> n;
    vector<int> t(n);
    for(int i = 0;i < n;i++)cin >> t.at(i);
    cin >> m;
    vector<int> p(m);
    vector<int> x(m);
    for(int i = 0;i < m;i++)cin >> p.at(i) >> x.at(i);
    for(int i = 0;i < m;i++){
        int ans = 0;
        for(int j = 0;j < n;j++){
            if(p.at(i) - 1 == j)ans += x.at(i);
            else ans += t.at(j);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define vi vector < ll  int >
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007
    using namespace std;

    #define MAXN 1000005
    int spf[MAXN];
    void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)
            spf[i] = i;
        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {
            if (spf[i] == i)
            {
                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }


    vector<int> gf(int x)
    {
        vector<int> ret;
        while (x != 1)
        {
            ret.push_back(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }
    int BIT[100050];
    void upd(int x) { ++x;  while(x<=MAXN)  {  BIT[x]++;  x+=(x&-x);  } }
    int cal(int x) {  ++x;  int res=0;  while(x>0)  {  res+=BIT[x];  x-=(x&-x);  } return res; }

    ll mod=hell;
    ll pr( ll x , ll y)
    {
        ll ans=1;
        if(y==0) return ans;
        while(y>1)
        {
            if(y&1) ans*=x;
            x*=x;
            y/=2;
            x%=mod;
            ans%=mod;
        }
        ans*=x;
        ans%=mod;
        return ans;
    }
    ll inv(ll n)
    {
        return pr(n,mod-2);
    }
    ll stoi(string s)
    {
        int n=s.size();
        ll k=0; int i;
        rep(i,0,n)
        {
            k+=s[i]-'0';
            k*=10;
        }
        return k/10;
    }
    string to_string(ll n)
    {  if(!n) return "0";
        string s=""; int a,b;
        while(n>0)
        {
            b=n%10;
            s+=(b+'0');
            n/=10;
        }
        reverse(all(s));
        return s;
    }
  ll invvf[1000500],fact[1000500];
  void pre()
  {
      ll i,j,n=1000050;
      fact[0]=1; fact[1]=1;
      rep(i,2,n) {fact[i]=fact[i-1]*i; fact[i]%=hell;}
      invvf[1]=1; invvf[0]=1;
      rep(i,2,n)
      {
          invvf[i]=inv(fact[i]);
      }

  }
 ll ncr(ll n , ll r)
 {
     ll y=fact[n];
     y*=invvf[r];
     y%=hell;
     y*=invvf[n-r];
     y%=hell;
     return y;
 }


int phi(int n) {
    int result = n;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            while (n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if (n > 1)
        result -= result / n;
    return result;
}

void solve()
{
    ll i,j,k,n,m,y=0,c=0,a,b,d;
    cin>>a>>b>>c>>d;
    while(a>0 and c>0)
    {   c-=b;
      if(c<=0) break;
        a-=d;

    }
    if(a>0) cout<<"Yes";
    else cout<<"No";
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 3652
from collections import deque

N = int(input())

S = []
for _ in range(N):
    S.append(int(input()))

SA = sum(S)

if SA % 10 == 0:
    SS = [s for s in S if s % 10 != 0]
    if len(SS) > 0:
        SA -= min(SS)
    else:
        SA = 0

print(SA)

Measured memory_bytes: 3316
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])
sum = 0
for x in A:
  sum += x
  sum %= (10**9+7)
sum = A.sum() % (10**9+7)

sum2 = 0
for x in A:
  sum2 += x*x
  sum2 %= (10**9+7)

ans = (sum**2 - sum2) % (10**9+7)
if ans < 0:
  ans += (10**9+7)
ans *= int((10**9+7+1)/2) 
ans %= (10**9+7)
print(int(ans))


Measured memory_bytes: 49840
#include "bits/stdc++.h"
using namespace std;
long long dp[52][2501] = {};
int main()
{
	int n, a;
	long long total = 0;
	scanf("%d%d", &n, &a);
	dp[0][0] = 1;
	for(int i = 0, j; i < n; ++i)
	{
		scanf("%d", &j);
		for(int k = n - 1; k >= 0; --k)
		{
			for(int l = 2500 - j; l >= 0; --l)
			{
				dp[k + 1][l + j] += dp[k][l];
			}
		}
	}
	for(int i = 1; i <= n; ++i)
	{
		for(int j = 1; j <= 2500; ++j)
		{
			total += dp[i][j] * (j == i * a);
		}
	}
	printf("%lld\n", total);
}


Measured memory_bytes: 1280
#include<stdio.h>
int main(void){
	int m,f,r;
	int sum=0;
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1){
			break;
		}
		if(m<=50&&f<=50&&r<=100){
			sum=m+f;
			
			if(m==-1||f==-1){
				printf("F\n");
			}else if(sum>=80){
				printf("A\n");
			}else if(sum<80&&sum>=65){
				printf("B\n");
			}else if(sum<65&&sum>=50){
				printf("C\n");
			}else if(sum<50&&sum>=30&&r>=50){
				printf("C\n");
			}else if(sum<50&&sum>=30){
				printf("D\n");
			}else if(r>=50){
				printf("C\n");
			}else if(sum<30){
				printf("F\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
vector<int> ve[N];
priority_queue<int> qe;
int main()
{
	int n,m,sum=0;
	cin>>n>>m;
	int a,b;
	for(int i=1;i<=n;i++)
	{
		cin>>a>>b;
		if(m-a+1>0)ve[m-a+1].push_back(b);
	}
	for(int i=m;i>0;i--)
	{
		for(int j=0;j<ve[i].size();j++)qe.push(ve[i][j]);
		if(qe.size())
		{
			sum+=qe.top();qe.pop();
		}//djgldgsldgjdl
	}cout<<sum;
}

Measured memory_bytes: 8972
#include<cstdio>
int n,a[110];
int main(){
	scanf("%d",&n);
	a[0]=233;
	int s=0;
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
		if(a[i]==a[i-1])s++,a[i]=233;
	}
	printf("%d\n",s);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 const int u=1e5;
int main(){
	int n,k;
	cin>>n>>k;
	vector<long long int>v(u+1,INT_MAX);
	v[0]=0;
	for(int i=0;i<n;i++){
		int w,V;
		cin>>w>>V;
		for(int j=u;j>=V;j--)
		if(v[j-V]!=INT_MAX)
		v[j]=min(v[j],v[j-V]+w);
		
	}
	for(int j=u;j>=0;j--)
	if(v[j]<=k)
	{
	
		cout<<j;
		break;
	}
 
}

Measured memory_bytes: 4040
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int N;
long long A[200000],sum=0,B[200000],P[200000];
int main(){
  cin>>N;
  FOR(i,0,N){
    cin>>A[i];
    sum+=A[i];
    B[i]=sum;
  }
  if(N==2){
    cout<<abs(A[0]-A[1])<<endl;
    return 0;
  }
  FOR(i,1,N-1){
    P[i]=abs((sum-B[i])-B[i]);
  }
  sort(P+1,P+N-1);
  cout<<P[1]<<endl;
  return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define int  long long
#define tc(t)  int t; cin>>t; while(t--)
#define f(n)    for(int i=0;i<n;i++)
#define endl   "\n"
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int a,b;
 cin>>a>>b;
 if(a>=0&&a<=9&&(b>=0&&b<=9))cout<<a*b<<endl;
 else cout<<"-1"<<endl;


}

Measured memory_bytes: 3640
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  int a,b; cin>>a>>b;
  if(a*b%2==0)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int ans[101][101];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    if (N == 2) {
        cout << -1 << endl;
        return 0;
    }

    rep(i, N)rep(j, N - 1) {
        ans[i][j] = (i + j + 1) % N + 1;
        if (N % 2 == 0 && i >= N / 2 && j == N / 2) {
            swap(ans[i][j], ans[i][j - 1]);
        }
    }
    rep(i, N) {
        rep(j, N - 1)cout << ans[i][j] << (j != N - 2 ? ' ' : '\n');
    }
}


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

using namespace std;

int main(void) {
    long n;
    cin >> n;
    vector<pair<long,long>> a(n);
    for(auto &x: a) {
        long a, b;
        cin >> a >> b;
        x.first = a+b;
        x.second= a-b;
    }
    sort(a.begin(), a.end());

    long r = n;
    long t = -1e15;
    for(auto &x: a) {
        if(x.second < t)
            r--;
        else
            t = max(t, x.first);
    }
    cout <<r << endl;

}


Measured memory_bytes: 1792
#include<cstdio>
int n,m,a,ans,c[11];
int main(){
    scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&a),c[(a/400<8)?a/400+1:0]++;
	for(int i=1;i<=8;i++)ans+=bool(c[i]);
	printf("%d %d\n",!ans?1:ans,ans+c[0]);
}

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

int Kiriage(double a)
{
	a /= 1000;

	int aI = a;

	if(a>aI)
	{
		aI += 1;
	}
	return aI*1000;
}

int main()
{
	int debt =100000;//ここ変更OK 最初の借入額

	int n;

	std::cin >> n;

	for( int i=0; i<n; ++i )
	{
		debt *= 1.05;

		debt = Kiriage(debt);
	}

	std::cout << debt << '\n';

}

Measured memory_bytes: 1160
/*
    This is the solution from syr.
    OJ:
    ProblemID:
    Date:
    Status:Unknown
*/
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cstring>
#include<cstdlib>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<sstream>
#include<string>
#include<time.h>
#include<utility>
#include<vector>

using namespace std;

const int debug=0;
const int INF=1e9+7;

int n,k;
long long ans;

int main(){
	scanf("%d%d",&n,&k);
	if(k==0){
		printf("%lld\n",(long long)n*n);
		return 0;
	}
	for(int i=k+1;i<=n;i++){
		int x=n-(n%i);
		ans+=(long long)x/i*(i-k);
//		printf("%lld %lld\n",(long long)x/i*(i-k),max((long long)0,(long long)(n%i)-k+1));
		ans+=max((long long)0,(long long)(n%i)-k+1);
	}
	printf("%lld\n",ans);
	return 0;
}

/*
Sample Input
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

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...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};


int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n-1);
    rep(i,n) {
      cin >> a[i];
      a[i]--;
    }
    rep(i,n) cin >> b[i];
    rep(i,n-1) cin >> c[i];
    int ans = 0;
    int prev = 1000;
    rep(i,n){
      ans += b[a[i]];
      if(prev + 1 == a[i]) ans += c[prev];
      prev = a[i];
    }
    print(ans);
}

Measured memory_bytes: 256
#include<stdio.h>
int sw_state[11],sw_ans[11],sig[11];
int sw[11][11];
int sw_n,vol_n,ans;
void check(int depth);
int main(void){
    int i,j,k,temp;
    scanf("%d %d",&sw_n,&vol_n);
    for(i=0;i<11;i++){
        for(j=0;j<11;j++){
            sw[i][j]=0;
        }
    }
    for(i=1;i<=vol_n;i++){
        scanf("%d",&k);
        for(j=0;j<k;j++){
            scanf("%d",&temp);
            sw[temp][i]=1;
        }
    }
    for(i=1;i<=vol_n;i++){
        scanf("%d",&sw_ans[i]);
    }
    ans=0;
    check(1);
    printf("%d\n",ans);
    return 0;
}
void check(int depth){
    int i,j,fg;
    if(depth>sw_n){
        for(i=0;i<11;i++){
            sig[i]=0;
        }
        for(i=1;i<=sw_n;i++){
            for(j=1;j<=vol_n;j++){
                sig[j]+=sw[i][j]*sw_state[i];
            }
        }
        fg=1;
        for(i=1;i<=vol_n;i++){
            if(sig[i]%2 != sw_ans[i]){
                fg=0;
                break;
            }
        }
        ans+=fg;
    }else{
        sw_state[depth]=0;
        check(depth+1);
        sw_state[depth]=1;
        check(depth+1);
    }
    return;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int f(int a){
  if(a%2){
    return 3*a+1;
  }else{
    return a/2;
  }
}
signed main(){
    set<int> as;
    int s;
    cin >> s;
    as.insert(s);
    int last = s;
    int tmp;
    int i = 1;
    while(true){
      ++i;
      tmp = f(last);
      auto itr = find(ALL(as),tmp);
      if(itr!=as.end()) break;
      as.insert(tmp);
      last = tmp;
    }
    cout << i << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int p[100], m[100][100], n, i, j, k, l, o;
  scanf("%d", &n);
  for(i = 1; i <= n; i++){
    scanf("%d%d", &p[i-1], &p[i]);
  }
  for(i = 1; i <= n; i++){
    m[i][i] = 0;
  }
  for(l = 2; l <= n; l++){
    for(i = 1; i <= n - l + 1; i++){
      j = i + l - 1;
      m[i][j] = 1000000;
      for(k = i; k <= j-1; k++){
	o = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j];
	if(o < m[i][j]){
	  m[i][j] = o;
	}
      }
    }
  }
  printf("%d\n", m[1][n]);
  return 0;
}



Measured memory_bytes: 2104
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#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()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;

typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

long long int MOD = 1000000007;
int N;
ll A[400][400];
ll dist[400][400];
bool use[400][400];

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			cin>>A[i][j]; 
			dist[i][j]=A[i][j];
			use[i][j]=true;
		}
	}
	bool able=true;
	for(int k=0;k<N;k++){
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(i==k||j==k)continue;
				if(dist[i][j]==dist[i][k]+dist[k][j]){
					use[i][j]=false;
				}else if(dist[i][j]>dist[i][k]+dist[k][j]){
					able=false;
				}
			}
		}
	}
	if(able){
		ll ans=0;
		for(int i=0;i<N;i++){
			for(int j=i;j<N;j++){
				if(use[i][j])ans+=A[i][j];
			}
		}
		cout<<ans<<endl;
	}else{
		cout<<-1<<endl;
	}
}

Measured memory_bytes: 2304
x = int(input())

ans = x
past = int(ans**0.5)
divisor = [i for i in range(1, past+1, 1) if x%i == 0]
while len(divisor) != 1:
    if ans%2 == 0:
        ans += 1
    else:
        ans += 2
    root = int(ans**0.5)
    divisor = [j for j in range(1, root+1, 1) if ans%j == 0]

print(ans)

Measured memory_bytes: 9344
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
typedef long long ll ;
typedef long double ld ;
typedef pair<ll, ll> pairs;
 
 
ll h[100009] ;
ll v[100009] ;
 
int main()
{
   //        freopen("milkorder.out", "w", stdout) ;
     //   freopen("milkorder.in", "r", stdin) ;
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
 
    ll n , k ; cin >> n >> k ;
    for ( ll i = 0 ; i < n ; i++ ) cin >> h[i] ;
    for ( ll i = 1 ; i < min( n , k ) ; i++ ) v[i] = abs( h[i] - h[0] ) ;
    for ( ll i = k ; i < n  ; i++ ){ v[i] = 1000000009 ;
        for ( ll j = i - k; j < i ; j++ ){
            v[i] = min( v[i] , ( v[j] + abs( h[i] - h[j] ) ) ) ;
            //cout << x << " " << y << " " << v[x] <<  "\n\n" ;
        }
    }  cout << v[n-1] ;
}

Measured memory_bytes: 1792
import sys
import itertools
import numpy as np
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M, Q = map(int, readline().split())
 
A = np.array(list(itertools.combinations_with_replacement(range(1, M + 1), N)))
 
n = len(A)
score = np.zeros(n, np.int32)
m = map(int, read().split())
for a, b, c, d in zip(m, m, m, m):
    cond = A[:, b - 1] - A[:, a - 1] == c
    score += d * cond
 
print(score.max())

Measured memory_bytes: 46740
package main

import (
	"fmt"
	"strings"
)

func main() {
	var S string
	fmt.Scan(&S)
	
	c1 := strings.Count(S,"a")
	c2 := strings.Count(S,"b")
	c3 := strings.Count(S,"c")
	
	ans := "No"
	if c1 == 1 && c2 == 1 && c3 == 1 {
		ans = "Yes"
	}
	fmt.Println(ans)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,q,k;
string s;

int main(){
	cin>>n>>s>>q;
	for(int i=0;i<q;i++){
		cin>>k;
		ll res=0,d=0,m=0,tmp=0;
		for(int j=0;j<n;j++){
			if(j>=k){
				if(s[j-k]=='D') d--,tmp-=m;
				if(s[j-k]=='M') m--;
			}
			if(s[j]=='D') d++;
			if(s[j]=='M') tmp+=d,m++;
			if(s[j]=='C') res+=tmp;
		}
		cout<<res<<endl;
	}
}

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

int main()
{
  long long int n;
  cin>>n;

  long long int h[n],dp[n],i;

  for(i=0;i<n;i++)
    cin>>h[i];

  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);

  for(i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));

  cout<<dp[n-1]<<endl;

return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


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

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n;
    cin >> n;
    vector<ll> z(n);
    for (int i = 0; i < n; i++) {
        cin >> z[i];
    }
    sort(z.begin(), z.end());
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (i != 0) {
            if (z[i] == z[i - 1])continue;
        }
        if (i != n-1) {
            if (z[i] == z[i + 1])continue;
        }
        vector<ll> x;
        for (int j = 1; j < sqrt(z[i])+1; j++) {
            if (z[i] % j == 0) {
                if(z[i] != j)x.push_back(j);
                if (j != 1)x.push_back(z[i] / j);
            }
        }
        ll flag = 1;
        for (int k = 0; k < x.size(); k++) {
            if (binary_search(z.begin(), z.end(), x[k]))flag = 0;
        }
        ans += flag;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
#define INF (int)1e9
int main(){
  int n,m,c[20];
  cin>>n>>m;
  for(int i=0;i<m;i++)cin>>c[i];
  int dp[21][50001];
  for(int i=0;i<21;i++)for(int j=0;j<50001;j++)dp[i][j]=INF;
  for(int i=0;i<m;i++){
    for(int j=0;j<=n;j++){
      if(j>c[i])
	dp[i+1][j]=min(dp[i+1][j-c[i]]+1,dp[i+1][j]);
      dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
      if(j==c[i])dp[i+1][j]=1;
    }
  }
  int ans=INF;
  for(int i=0;i<21;i++)ans=min(ans,dp[i][n]);
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 7192
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,M;
    cin >> N >> M;
    if(abs(N-M) >= 2) {
        cout << 0 << endl;
    }
    else {
        int cnt = 1;
        for(int i = 1; i <= N; i++) {
            cnt*=i;
            cnt%=INF;
        }
        for(int i = 1; i <= M; i++) {
            cnt*=i;
            cnt%=INF;
        }
        if(N == M) {
            cnt*=2;
            cnt%=INF;
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 3624