akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.HashSet
import kotlin.math.*
fun main(){
    var fs = CodeForces.FastReader()
    var s = fs.next()
    var t = fs.next()
    var ans = 0
    for (i in 0 until s.length) {
        if(s[i] != t[i]) ans++
    }
    println(ans)
}

class CodeForces {
    internal class FastReader {
        private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))
        private var st: StringTokenizer? = null

        operator fun next(): String {
            while (st == null || !st!!.hasMoreElements()) {
                try {
                    st = StringTokenizer(br.readLine())
                } catch (e: IOException) {
                    e.printStackTrace()
                }

            }
            return st!!.nextToken()
        }

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return java.lang.Long.parseLong(next())
        }

        fun nextDouble(): Double {
            return java.lang.Double.parseDouble(next())
        }

        fun nextLine(): String {
            var str = ""
            try {
                str = br.readLine()
            } catch (e: IOException) {
                e.printStackTrace()
            }
            return str
        }

        fun readIntArray(n: Int): IntArray {
            val a = IntArray(n)
            for (i in 0 until n) a[i] = nextInt()
            return a
        }
        fun readLongArray(n: Int): LongArray {
            val a = LongArray(n)
            for (i in 0 until n) a[i] = nextLong()
            return a
        }

        fun readDoubleArray(n: Int): DoubleArray {
            val a = DoubleArray(n)
            for (i in 0 until n) a[i] = nextDouble()
            return a
        }
    }
}


Measured memory_bytes: 38640
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1
#define PI 3.14159265359
#define mod 1000000007

const long long INF = 1000000000;

int main(){
    string s,t;
    int a,b;
    string u;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(s == u){
        --a;
    }
    if(t == u){
        --b;
    }
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
import math

a,b,c=map(int,input().split())
num=[a,b,c]
num.sort()
if (num[1]+num[0])%2==0:
	ans=((num[2]*3)-(num[0]+num[1]+num[2]))/2
else :
	ans=(((num[2]+1)*3)-(num[0]+num[1]+num[2]))/2
ans=math.floor(ans)
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;
 
class Main{
    	public static void main(String[] args){
        	Scanner sc = new Scanner(System.in);
        	String str = sc.nextLine().toLowerCase();
        	int x = 0;
        	while (sc.hasNextLine()) {
            		String str2 = sc.nextLine();
            		if ("END_OF_TEXT".equals(str2)) {
                		break;
            		}
            		String[] str3 = str2.split(" ");
            		for (int i = 0, l = str3.length; i < l; i++) {
                		String s = str3[i];
                		if (s.toLowerCase().equals(str)) {
                    			x++;
                		}
            		}
        	}
        	System.out.println(x);
    	}
}

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

int main(){
int N;
  cin>>N;
  long long L[N+1];
  L[0]=2;
  L[1]=1;
  for(int i=2; i<=N; i++){
   L[i]=L[i-1]+L[i-2];
  }
cout<<L[N]<<endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std ;
        int main ()
        {
            int a[10004];
            int i =0;
        cin >>a[i];
        while(a[i]!=0)
        {i++;
            cin>>a[i];
        }
         for (int j = 0 ; j<i;j++){
         cout<<"Case"<<" "<<j+1<<":"<<" "<<a[j]<<endl;
         }





         return 0 ;
        }




Measured memory_bytes: 3108
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N =int(sys.stdin.buffer.readline())
P = [int(sys.stdin.buffer.readline()) for _ in range(N)]


P = np.array(P, dtype=int)
ans = P.sum() - P.max() // 2
print(int(ans))


Measured memory_bytes: 13668
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int N,R;
  cin>>N>>R;

  int ans=R;
  if(N<10) ans+=(10-N)*100;
  cout<<ans<<endl;

  return 0;
}


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

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

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  x--;
  y--;

  vector<vector<int>> mp(n, vector<int>());
  for(int i = 0; i < n; ++i){
    if(i+1 < n) mp[i].push_back(i+1);
    if(0 <= i-1) mp[i].push_back(i-1);
  }
  mp[x].push_back(y);
  mp[y].push_back(x);

  vector<int> ans(n, 0);
  for(int i = 0; i < n; ++i){
    vector<int> dist(n, -1);
    dist[i] = 0;
    queue<int> q;
    q.push(i);
    while(!q.empty()){
      int now = q.front();
      q.pop();
      for(auto next : mp[now]){
        if(dist[next] != -1) continue;
        dist[next] = dist[now] + 1;
        q.push(next);
      }
    }

    for(int j = i; j < n; ++j){
      ans[dist[j]]++;
    }
  }

  for(int i = 1; i < n; ++i){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 384
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//229
	int n,m,c,cnt=0;
	cin>>n>>m>>c;
	c=-c;
	vi arr(m);
	for(int &i:arr)cin>>i;
	REP(i,0,n-1) {
		int sum=0;
		REP(j,0,m-1) {
			int val;
			cin>>val;
			sum+=val*arr[j];
		}
		if(sum>c)cnt++;
	}
	cout<<cnt;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3564
a, b, m, n = list(input())
ab = int(a+b)
mn = int(m+n)
if 1<=ab<=12 and 1<=mn<=12:
    print("AMBIGUOUS")
elif 1<=ab<= 12 and not 1<=mn<=12:
    print("MMYY")
elif not 1<=ab<=12 and 1<=mn<=12:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    if N%2==1:
        print(0)
        exit()
    
    ans=0
    
    for i in range(1,100):
        a=2*pow(5,i)
        ans+=N//a
        
    print(ans)
        
    
    

main()


Measured memory_bytes: 62124
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,m,i,j,k,ans,f[3005][3005][2];
int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
   	n=read();m=read();
   	f[0][0][1]=1;
   	for(i=1;i<=n;i++)
   		f[0][i][0]=1;
   	for(i=1;i<=m;i++)
   		for(j=0;j<=n;j++)
   			for(k=0;k<=1;k++){
				if(j!=0){
					f[i][j][k|(j==1)]=(f[i][j][k|(j==1)]+f[i-1][j][k])%mo;
					f[i][j-1][k|(j==1)]=(f[i][j-1][k|(j==1)]+f[i-1][j][k])%mo;	
				}
				if(n-j!=0){
					f[i][j+1][k]=(f[i][j+1][k]+f[i-1][j][k])%mo;
					f[i][j][k]=(f[i][j][k]+f[i-1][j][k])%mo;
				}
			}
	for(i=0;i<=n;i++)
		ans=(ans+f[m][i][1])%mo;
	pus(ans,2);
    return 0;
}

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

int main() {
    map<int, int> mp;
    for (int i = 0; i < 3; i++)
    {
        int a, b;
        cin >> a >> b;
        mp[a]++;
        mp[b]++;
    }
    bool flag = true;
    for (auto x: mp) {
        if (x.second > 2) flag = false;
    }
    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

int n, m, z[100005], par[100005], tb, tc;
long long x[100005], y[100005], sum[100005], dp[100005], ta;
vector< int > v[100005], vv[100005];

int find(int a) {
	return par[a] == a ? a : par[a] = find(par[a]);
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) {
		scanf("%lld%lld", &ta, x + i);
		y[i] = max(ta - x[i], 0LL);
		z[i] = i;
	}
	sort(z + 1, z + n + 1, [](const int &a, const int &b) {return y[a] < y[b];});
	while (m--) {
		scanf("%d%d", &tb, &tc);
		v[tb].push_back(tc);
		v[tc].push_back(tb);
	}
	for (int i = 1; i <= n; i++) {
		tb = z[i];
		par[tb] = tb;
		sum[tb] = x[tb];
		dp[tb] = y[tb];
		for (int j: v[tb])
			if (par[j] && (j = find(j)) != tb) {
				vv[tb].push_back(j);
				par[j] = tb;
				sum[tb] += sum[j];
				dp[tb] = min(dp[tb], max(dp[j], y[tb]) - sum[j]);
			}
		dp[tb] += sum[tb];
	}
	printf("%lld\n", dp[z[n]]);
	return 0;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M;
vector <Pli> Graph[int(1e5+5)];
int edge[int(1e5+5)];

ll dist[int(1e5+5)];
bool visited[int(1e5+5)];

int Solve(){
  fill(dist, dist + N + 1, -1);

  priority_queue <Pli, vector<Pli>, greater<Pli>> que;
  que.push({0, 1});

  while (!que.empty()){
    Pli Q = que.top(); que.pop();
    if (visited[Q.se]) continue;

    visited[Q.se] = true;
    dist[Q.se] = Q.fi;

    for (int i = 0; i < Graph[Q.se].size(); i++){
      Pli P = Graph[Q.se][i];
      if (visited[P.se]) continue;
      que.push({Q.fi + P.fi, P.se});
    }
  }

  cout << dist[N] << endl;

  return 0;
}

int main(){
  cin >> N >> M;
  for (int i = 0; i < M; i++){
    int L, R; ll C;
    cin >> L >> R >> C;
    Graph[L].push_back({C, R});
    edge[L+1]++; edge[R+1]--;
  }
  for (int i = 1; i < N; i++){
    edge[i] += edge[i-1];
    if (edge[i] > 0){
      Graph[i+1].push_back({0, i});
    }
  }
  Solve();

  return 0;
}


Measured memory_bytes: 13412
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M=map(int,input().split())
     
UF=UnionFind(N)

for i in range(M):
  a,b=map(int,input().split())
  UF.union(a-1,b-1)

print(max([-i for i in UF.parents]))

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

int main() {
    int n, m;
    cin >> n >> m;

    priority_queue<int> pq;
    rep(i, n) {
        int a;
        cin >> a;
        pq.push(a);
    }

    while (m > 0) {
        int p = pq.top();
        pq.pop();
        pq.push(p / 2);
        m--;
    }

    ll ans = 0;
    while (!pq.empty()) {
        ans += pq.top();
        pq.pop();
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3840
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input1 = Console.ReadLine();
            string input2 = Console.ReadLine();
            string[] setting = input1.Split(' ');
            string[] input_ai = input2.Split(' ');
            int N = int.Parse(setting[0]);
            long x = long.Parse(setting[1]);
            long[,] ai= new long[2,N+1];
            long[] counter = new long[2];
            //飴玉の個数を配列化
            for (long i = 0 ; i<N;i++)
            {
                ai[0,i] = long.Parse(input_ai[i]);
                ai[1,i] = long.Parse(input_ai[i]);
            }
            //計算
            for (long i = 1;i<N;i++)
            {
                if (ai[0, i - 1] + ai[0, i] > x)
                {
                    counter[0] = counter[0] + Math.Min(ai[0, i], ai[0, i - 1] + ai[0, i] - x);
                    ai[0, i] = ai[0, i] - Math.Min(ai[0, i], ai[0, i - 1] + ai[0, i] - x);
                    if (ai[0, i - 1] + ai[0, i] > x)
                    {
                        counter[0] = counter[0] + Math.Min(ai[0, i - 1], ai[0, i - 1] + ai[0, i] - x);
                        ai[0, i - 1] = ai[0, i - 1] - Math.Min(ai[0, i - 1], ai[0, i - 1] + ai[0, i] - x);
                    }
                }
            }
            for (long i = 1; i < N; i++)
            {
                if (ai[1, i - 1] + ai[1, i] > x)
                {
                    counter[1] = counter[1] + Math.Min(ai[1, i - 1], ai[1, i - 1] + ai[1, i] - x);
                    ai[1, i - 1] = ai[1, i - 1] - Math.Min(ai[1, i - 1], ai[1, i - 1] + ai[1, i] - x);
                    if (ai[1, i - 1] + ai[1, i] > x)
                    {
                        counter[1] = counter[1] + Math.Min(ai[1, i], ai[1, i - 1] + ai[1, i] - x);
                        ai[1, i] = ai[1, i] - Math.Min(ai[1, i], ai[1, i - 1] + ai[1, i] - x);
                    }
                }
            }
            //Output
            Console.WriteLine(Math.Min(counter[0], counter[1]));
            //Console.ReadKey();
        }
    }
}


Measured memory_bytes: 26204
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC40(void);
void ABC41(void);
void ABC42(void);
void ABC43(void);
void ABC44(void);
void ABC45(void);
void ABC46(void);
void ABC47(void);
void ABC48(void);
void ABC49(void);

int main(void){
    ABC49();
}

void ABC49(){
    int n,i,p,x,sum=0;
    cin>>n;
    vector<int> t(n);
    for(i=0;i<n;i++){
        cin>>t[i];
        sum+=t[i];
    }
    int m;
    cin>>m;
    for(i=0;i<m;i++){
        cin>>p>>x;
        cout<<sum+x-t[p-1]<<endl;
    }
}

Measured memory_bytes: 256
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N-1+M)]
A,B=zip(*AB)
r=(set(range(1,N+1))-set(B)).pop()
def tsort():
    c=[[] for i in range(N)]
    t=[0]*N
    for i,j in AB:
        c[i-1].append(j-1)
        t[j-1]+=1
    s=[r-1]
    l=[]
    while len(s)>0:
        n=s.pop()
        l.append(n)
        for i in c[n]:
            t[i]-=1
            if t[i]==0:
                s.append(i)
    return l
cr=[[] for i in range(N)]
for i,j in AB:
    cr[j-1].append(i-1)
S=tsort()
o=[0]*N
for i,s in enumerate(S):
    o[s]=i
for i in range(N):
    x=-1
    for e in cr[i]:
        x=max(x,o[e])
    print(0 if x==-1 else S[x]+1)

Measured memory_bytes: 55848
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    int n=0,ans=0;
    rep(i,0,X.size()){
        char c=X.at(i);
        if(c=='S') n++;
        else{
            if(n>0){
                ans++;
                n--;
            }
        }
    }

    ans=X.size()-2*ans;
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

map<int64_t, int> prime_factor(int64_t n) {
  map<int64_t, int> ret;
  for (int64_t i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

int main() {
  ll N, P;
  cin >> N >> P;

  ll result = 1;
  for (auto p : prime_factor(P)) {
    // cout << p.first << " " << p.second << endl;
    result *= pow(p.first, floor(p.second / N));
    // cout << result << endl;
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

a = Is()
if sum(a) > 21 :
    print("bust")
else:
    print("win")


Measured memory_bytes: 4584
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <class T>
using vv = vector<vector<T>>;

#define in(v) \
  v;          \
  cin >> v;
// #define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f, c, ...)                                 \
  (([&](decltype((c)) cccc) {                          \
    return (f)(begin(cccc), end(cccc), ##__VA_ARGS__); \
  })(c))
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) for (int i = 0, _i = (n); i < _i; ++i)
#define repi(i, a, b) for (int i = (a), _i = (b); i < _i; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)

#define rrep(i, n) for (int i = (n); i >= 0; --i)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
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;
}

// debug
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  os << "{";
  for (size_t i = 0; i < vec.size(); ++i) os << (i ? ", " : "") << vec[i];
  os << "}";
  return os;
}
ostream& operator<<(ostream& os, const vector<char>& v) {
  for (size_t i = 0; i < v.size(); ++i) os << v[i];
  return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& rhs) {
  os << "(" << rhs.first << ", " << rhs.second << ")";
  return os;
}

#ifdef LOCAL
void debug() { cerr << "\n"; }
template <class First>
void debug(const First& first) {
  cerr << first << "\n";
}
template <class First, class... Rest>
void debug(const First& first, const Rest&... rest) {
  cerr << first << ",";
  debug(rest...);
}
#else
#define debug(...) 42
#endif

int main() {
  int in(N);
  int in(M);
  int sum = 0;
  rep(i, M) {
    int in(a);
    sum += a;
  }
  if (sum > N) cout << "-1\n";
  else
    cout << N - sum << endl;

  return 0;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
  int n , k , x ,y ;
  cin >> n >> k >> x >> y ;
  
  if( n >  k ) 
    cout << k*x + y*(n-k);
  else 
    cout << n*x ;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class  Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int can= 0;
        for(int i = 1; i <= n; i++) {
           can += i;
        }
    System.out.println(can);
    }
}

Measured memory_bytes: 21332
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    print((A + B) % 24)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()


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

typedef long long LL;

const int N=1000005;
const int MOD=998244353;

int n,s[N],t[N],prime[N],tot,mu[N],mx,ny[N];
bool not_prime[N];

void get_prime(int n)
{
	mu[1]=1;
	for (int i=2;i<=n;i++)
	{
		if (!not_prime[i]) prime[++tot]=i,mu[i]=-1;
		for (int j=1;j<=tot&&i*prime[j]<=n;j++)
		{
			not_prime[i*prime[j]]=1;
			if (i%prime[j]==0) break;
			mu[i*prime[j]]=-mu[i];
		}
	}
}

int main()
{
	scanf("%d",&n);
	for (int i=1,x;i<=n;i++) scanf("%d",&x),mx=std::max(mx,x),s[x]++;
	get_prime(mx);
	ny[0]=ny[1]=1;
	for (int i=2;i<=mx;i++) ny[i]=(LL)(MOD-MOD/i)*ny[MOD%i]%MOD;
	for (int i=1;i<=mx;i++)
	{
		int sum=0;
		for (int j=i;j<=mx;j+=i)
		{
			(t[i]+=(LL)sum*j%MOD*s[j]%MOD)%=MOD;
			(t[i]+=(LL)s[j]*(s[j]-1)/2%MOD*j%MOD*j%MOD)%=MOD;
			(sum+=(LL)j*s[j]%MOD)%=MOD;
		}
	}
	int ans=0;
	for (int i=1;i<=mx;i++)
		for (int j=i;j<=mx;j+=i)
			(ans+=(LL)mu[j/i]*t[j]*ny[i]%MOD)%=MOD;
	printf("%d\n",(ans+MOD)%MOD);
	return 0;
}

Measured memory_bytes: 18688
#include <iostream>
#include <algorithm>
#include <cmath>
#include <functional>
#include <string>
using namespace std;

#define int long long
#define rep(n, i) for (int i = 0; i < n; i++)
#define rep2(n, m, i) for (int i = m; i < n; i++)
#define rep_r(n, i) for (int i = n - 1; i >= 0; i--)

signed main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << a[2] * 10 + a[1] + a[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr(i, n) for (int i = 0; i < n; i++)
#define frab(i, a, b) for (ll i = a; i < b; i++)
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef long double ld;

const ll MOD = 1e9 + 7;
const ll INF = 2e9 + 10;
const int N = 2e6 + 10;


int main() {
    //freopen("a.in", "r", stdin);
    ll n, m;
    cin >> n >> m;
    if (abs(n - m) > 1) {
        cout << 0;
        return 0;
    }

    ll n1 = 1, m1 = 1;
    frab(i, 1, n + 1)
        n1 = (n1 * i) % MOD;
    frab(i, 1, m + 1)
        m1 = (m1 * i) % MOD;
    if (n != m)
        cout << (n1 * m1) % MOD;
    else
        cout << (2 * n1 * m1) % MOD;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;

const int MAXN = 22;
const long long MOD = 1000000007;

long long dp[MAXN][1<<MAXN];

vector<vector<int>> adj(MAXN, vector<int>(MAXN));

int n;

long long solve (int i, int msk)
{
    if (i == n)
        return 1;
    long long &cur = dp[i][msk];
    if (~cur)
        return cur;
    cur = 0;
    for (int x = 0; x < n; x++)
        if (adj[i][x] && (msk>>x&1))
            cur = (cur + solve(i+1, msk ^ (1<<x))) % MOD;
    return cur;
}

int main()
{
    memset(dp, -1, sizeof dp);
    scanf("%i", &n);
    for (int x = 0; x < n; x++)
        for (int y = 0; y < n; y++)
            scanf("%i", &adj[x][y]);
    printf("%lli\n", solve(0, (1<<n)-1));
}


Measured memory_bytes: 721280
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, m;
  cin >> n >> m;
  vector<vector<ll>> a(n, vector<ll>(3));
  rep(i, 0, n) { cin >> a[i][0] >> a[i][1] >> a[i][2]; }

  ll ans = 0;
  rep(i, 0, 8) {
    vector<ll> v;
    rep(j, 0, n) {
      ll s = 0;
      rep(k, 0, 3) {
        if ((i / (1 << k)) % 2 == 0) {
          s += a[j][k];
        } else {
          s -= a[j][k];
        }
      }
      v.push_back(s);
    }
    sort(v.rbegin(), v.rend());
    ll t = 0;
    rep(j, 0, m) t += v[j];
    chmax(ans, t);
  }
  cout << ans << endl;
}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(const T x,const T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD=1e9+7;
const int MAX=1e5+100;

vector<int> primes(int n) {
  bool is_prime[n+1];
  REP(i,n+1) is_prime[i] = true;
  is_prime[0] = false;
  is_prime[1] = false;
  vector<int> res;
  FOR(i,2,n+2) {
    if (!is_prime[i]) continue;
    res.push_back(i);
    for (int j=i*2;j<n+1;j+=i) {
      is_prime[j] = false;
    }
  }
  return res;
}

int main() {
  int X;cin>>X;
  vector<int> ps = primes(200000);
  OUT(*lower_bound(ALL(ps),X));

  return 0;
}

Measured memory_bytes: 640
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}

module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust, fromMaybe )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.IntMap.Lazy            as IML
import qualified Data.Map.Strict               as M
import           Data.Char
import qualified Data.Array.IArray as A
import qualified Data.Array.Unboxed as UA
import Data.Bits
import Control.Monad.State.Strict
import qualified Data.Array.ST as STA
import qualified Data.Array.IO as IOA
import qualified Data.Array.MArray as MA
import Control.Monad.ST
import System.IO (stdin)
import Control.Arrow
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as UV
import qualified Data.Vector.Generic as GV
import qualified Data.Vector.Mutable as MV
import Data.Ix
import Data.Ord (Down(Down))
import qualified Data.Sequence as Seq
import Data.Foldable (toList)
import Data.Fixed

debug = False

ts :: Show a => a -> a
ts a = if debug then traceShowId a else a


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- readInts
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- readInts
    return (a, b, c)


readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

readIntV :: Int -> IO (UV.Vector Int)
readIntV n = GV.unfoldrN n (fmap (fmap BC.tail) . BC.readInt) <$> BC.getLine

readIntegersV :: Int -> IO (V.Vector Integer)
readIntegersV n = GV.unfoldrN n (fmap (fmap BC.tail) . BC.readInteger) <$> BC.getLine

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . BC.readInteger) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las

solve :: Int -> Int -> Bool
solve x y = any isOk [0..x] where
  isOk tsuru = (2 * tsuru + 4 * (x - tsuru)) == y

main :: IO ()
main = do
  (x, y) <- readTuple2
  putStrLn $ if solve x y then "Yes" else "No"


Measured memory_bytes: 4196
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x;
    set<int>s;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        s.insert(x);
    }
    cout<<s.size()<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];

		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		String answer = "Yes";

		for (int i = 0; i < n - 1; i++) {

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		}
		System.out.println(answer);
	}

}


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

int x, y, gx, gy;

int main () {
	cin >> x >> y;
	
	if (x==2) {
		gx = 1;
	} else if ((x == 4) || (x == 6) || (x == 9) || (x == 11)) {
		gx = 2;
	} else {
		gx = 3;
	}
	
	if (y==2) {
		gy = 1;
	} else if ((y == 4) || (y == 6) || (y == 9) || (y == 11)) {
		gy = 2;
	} else {
		gy = 3;
	}
	
	if (gx == gy) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
a4 = set()
a5 = set()
a6 = set()
a7 = set()
a8 = set()
a4.update({a1[0],a2[1],a3[2]})
a5.update({a1[2],a2[1],a3[0]})
a6.update({a1[0],a2[0],a3[0]})
a7.update({a1[1],a2[1],a3[1]})
a8.update({a1[2],a2[2],a3[2]})
n = int(input())
B =set()
for i in range(n):
    b = int(input())
    B.add(b)
if set(a1) <= B or set(a2) <= B or set(a3) <= B or a4 <= B or a5 <= B or a6 <= B or a7 <= B or a8 <= B:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();

		long diff = Math.abs(a+b);

		if (diff % 2 == 1) {
			System.out.println("IMPOSSIBLE");
		} else {
			System.out.println(diff / 2);
		}

	}

}

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

int main() {
  int n, d, nc = 0, ans = 0;
  cin >> n >> d;
  vector<double> dis(n * (n - 1) / 2, 0);
  vector<vector<int>> x(n, vector<int>(d, 0));
  for(int i = 0; i < n; i++) for(int j = 0; j < d; j++) cin >> x.at(i).at(j);
  
  for(int i = 0; i < n - 1; i++){
    for(int j = i + 1; j < n; j++){
      for(int k = 0; k < d; k++) dis.at(nc) += (x.at(i).at(k) - x.at(j).at(k)) * (x.at(i).at(k) - x.at(j).at(k));
      nc++;
    }
  }
  for(int k = 0; k < dis.size(); k++){
    dis.at(k) = sqrt(dis.at(k));
    if(dis.at(k) == ceil(dis.at(k))) ans++;
  }
  cout << ans << endl;
}

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

int main (){
    ll N, Q;
    cin>>N>>Q;
    string S;
    cin>>S;
    vector<ll> L(Q), R(Q);
    for(int i=0; i < Q; i ++){
        cin>>L.at(i)>>R.at(i);
    }
    vector<ll> Cou(N);
    Cou.at(0)=0;
    for(int i=1; i<N; i++){
        if(S.at(i)=='C'&&S.at(i-1)=='A'){
            Cou.at(i)=Cou.at(i-1)+1;
        }
        else{
            Cou.at(i)=Cou.at(i-1);
        }
    }
    for(int i=0; i<Q; i++){
        cout<<Cou.at(R.at(i)-1)-Cou.at(L.at(i)-1)<<endl;
    }
}



Measured memory_bytes: 3456
#include<iostream>
#include<algorithm>
using namespace std;
int n,sum;
int a[10];
main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    a[n-1]/=2;
    for(int i=0;i<n;i++)
    {
        sum+=a[i];
    }
    cout<<sum<<endl;

}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); 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)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long 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;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vi a(3);
    rep(i,3) cin>>a[i];
    sort(all(a));
    cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
    return 0;
}



Measured memory_bytes: 3164
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

m = sum(B)-sum(A)
cnt1 = 0
cnt2 = 0
for a, b in zip(A, B):
    if a > b:
        cnt1 += (a-b)
    elif a < b:
        cnt2 += (b-a+1)//2
    else:
        pass

if cnt1 <= m and cnt2 <= m:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 10596
N = int(input())
A = list(map(int, input().split()))
step = 0

for i in range(0, N-1):
    if A[i+1] < A[i]:
        step_temp = A[i] - A[i+1]
        A[i+1] += step_temp
        step += step_temp
        step_temp = 0

print(str(step))

Measured memory_bytes: 32228
import numpy as np

N = int(input())
X = np.array(list(map(int, input().split())))

A = np.sort(X)
m1 = A[ N // 2 - 1]
m2 = A[ N // 2]
ans = []
for i in range(N):
    if X[i] < m2:
        print(m2)
    else:
        print(m1)


Measured memory_bytes: 34148
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define SIZE(x) ((int)((x).size()))
#define PB push_back
#define ST first
#define ND second
#define mp(x,y) make_pair(x,y)
#define DEBUG 1
#define debug(x) {if (DEBUG)cerr <<#x <<" = " <<x <<endl; }
#define debugv(x) {if (DEBUG) {cerr <<#x <<" = "; FOREACH(it, (x)) cerr <<*it <<", "; cout <<endl; }}
typedef short int sint;

int main() {
	ios_base::sync_with_stdio(false);
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	while (a > 0 && c > 0) {
		c -= b;
		if (c <= 0) {
			break;
		}
		a -= d;
	}
	if (a > 0) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
}

Measured memory_bytes: 3668
s = list(input())
t = list(s[::-1])
for i in range(len(s)):
    if t[i] == 'b':
        t[i] = 'd'
    elif t[i] == 'd':
        t[i] = 'b'
    elif t[i] == 'p':
        t[i] = 'q'
    else:
        t[i] = 'p'
if s == t:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 11084
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

int N;
vector<ll> A;
vector<ll> B;
vector<ll> modA;
vector<ll> modB;

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

    // input
    cin >> N;

    A.resize(N);
    B.resize(N);
    modA.resize(N);
    modB.resize(N);

    FOR(i, 0, N){
        cin >> A.at(i);
    }
    FOR(i, 0, N){
        cin >> B.at(i);
    }

    ll answer = 0;

    FOR(bit, 0, 29){
        ll T = pow(2L, bit);

        FOR(i, 0, N){
            modA.at(i) = A[i] % (T*2);
        }
        FOR(i, 0, N){
            modB.at(i) = B[i] % (T*2);
        }
        sort(ALL(modA));
        sort(ALL(modB));
        
        ll count = 0;
        FOR(i, 0, N){
            ll ai = modA[i];

            ll a_begin = 1 * T - ai;
            ll a_end   = 2 * T - ai;
            ll b_begin = 3 * T - ai;
            ll b_end   = 4 * T - ai;

            // [T-ai, 2T-ai), [3T-ai, 4T-ai)
            auto it0 = lower_bound(ALL(modB), a_begin);
            auto it1 = lower_bound(ALL(modB), a_end);
            ll num0 = it1 - it0;

            auto it2 = lower_bound(ALL(modB), b_begin);
            auto it3 = lower_bound(ALL(modB), b_end);
            ll num1 = it3 - it2;

            count += num0 + num1;
        }
        if(count % 2 == 1){
            answer += (1 << bit);
        }
    }

    p(answer);
    
    return 0;
}

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

using namespace std;
int main(){
int n=0,w=0,ans=0;
string str="";
cin>>n>>str;
for(auto i:str)w+=(i=='W');
reverse(str.begin(),str.end());
for(int i=0;i<w;i++)if(str[i]!='W')ans++;
cout<<ans;



    return 0;
}


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

signed main(){

  int n; cin >> n;
  int k = -1;
  for(int i = 1; i < 10000; i++){
    if(i*(i-1)/2 == n) k = i;
  }
  if(k == -1){
    cout << "No" << endl;
    return 0;
  }

  int r = 1;
  vector< vector<int> > v(2*n);
  for(int i = 0; i < k; i++){
    for(int j = i+1; j < k; j++){
      v[i].push_back(r);
      v[j].push_back(r);
      r++;
    }
  }

  cout << "Yes" << '\n' << k << endl;
  for(int i = 0; i < k; i++){
    cout << k-1 << " ";
    for(int j = 0; j < k-1; j++){
      cout << v[i][j] << " ";
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 7040
/*****************************************************************\
    |     IN THE NAME OF ALLAH, MOST GRACIOUS AND MOST MERCIFUL       |
    |                                                                 |
    |     Author     : Mahabub Rahman                                 |
    |     Email      : mahabubrahman618@gmail.com                     |
    |     University : Comilla University, Bangladesh		          |
    |                  Department of Computer Science & Engineering   |
    \*****************************************************************/


    /*...................................Data_Types............................................*/
    #include<bits/stdc++.h>

    using namespace std;
    #define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
    #define       ll                  long long int
    #define       ull                  unsigned long long int
    #define       veci                 vector<int>
    #define       vecc                 vector<char>
    #define       vecs                 vector<string>
    #define       vecl                 vector<long long int>
    #define       vecp                 vector<  pair<int,int> >
    #define       mapstrint            map< string , int >
    #define       mapstrstr            map< string , string >
    #define       mapint               map< int, int >
    #define       pb                   push_back
    #define       pob                  pop_back
    #define       mp                   make_pair
    ////============ CONSTANT ===============////
    #define mx9   1000000007
    #define mx7   10000007
    #define mx6   1000006
    #define mx5   200005
    #define inf   1<<30                                           //infinity value
    #define eps   1e-9

    #define mod   1000000007
    ////=====================================////

    long double PI = acosl(-1);
    bool compare_int(int a, int b) //This function is use for descending order.
    {
        return (a>b);
    }
    bool compare_string (string a, string b)
    {
        return a.size() < b.size();
    }
    bool compare_pair(const pair<int,int> &a,
                  const pair<int,int> &b)
    {
        if(a.second==b.second) return a.first>b.first;
        else return (a.second > b.second);
    }
    /*ll fact(ll n)
    {
        if(n==0 || n==1) return 1;
        else return n*fact(n-1);
    }*/

    ////======================================////
    /*bool check(int n)
    {
        for(int i=2; i<=sqrt(n); i++)
        {
            if(n%i==0)
            {
                return false;
            }
        }
        return true;
    }*/
    int32_t main()
    {
        //Don't see test case until get 7/8 times wrong submission..!!
        //Try to make Corner, Even, Odd or Prime case..!!
        FastIO;

        ll n, sum=0;
        cin >> n;
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=n; j++)
            {
                for(int k=1; k<=n; k++)
                {
                    sum += __gcd(i, __gcd(j, k));
                }
            }
        }
        cout << sum << endl;

    }


Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-8;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define REP(i, s, e) for ( int i = s; i <= e; i++ )

int main(){
	int d;
	while(cin >> d , d){
		int n,m; cin >> n >> m;
		vector<int> data(1,0);
		
		rep(i,n-1){
			int a; cin >> a;
			data.push_back(a);
		}
		data.push_back(d);
		sort(data.begin(),data.end());
		int ret = 0;
		rep(i,m){
			int t; cin >> t;
			if(t==0)continue;
			int w = abs(t-*(lower_bound(all(data),t)-1));
			w = min(w,abs(t-*lower_bound(all(data),t)) );
			ret += w;
		}
		cout << ret << endl;	
	}
}

Measured memory_bytes: 1432
#include <stdio.h>
#include <stdlib.h>
#define swap(a, b) {int t; t=a; a=b; b=t;}

int main()
{
  int *a;
  int n, i, flg=1, ans=0;
  scanf("%d", &n);
  a = (int *)malloc(sizeof(int)*n);

  for(i=0; i<n; i++){
    scanf("%d", a+i);
  }

  while(flg){
    flg=0;
    for(i=n-1; i>=1; i--){
      if(a[i-1] > a[i]){
        swap(a[i-1], a[i]);
        flg=1;
        ans++;
      }
    }
  }
  printf("%d", a[0]);
  for(i=1; i<n; i++){
    printf(" %d", a[i]);
  }
  printf("\n%d\n", ans);
  return 0;
}
  

        

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int main(){
    int x,y;
    cin >> x >> y;
    if (x==y){
        cout <<"a == b"<<endl;
    }
    if (x<y){
        cout <<"a < b"<<endl;
    }
    if (x>y){
        cout <<"a > b"<<endl;
    }
    
}


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

int main(){
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	if(A+B > C+D){
		cout << "Left" << endl;
	}
	else if(A+B == C+D){
		cout << "Balanced" << endl;
	}
	else{
		cout << "Right" << endl;
	}
	}


Measured memory_bytes: 384
n = int(input())
ps = [int(s) for s in input().split() if s]

cnt = 0

for i in range(n-2):
    if ps[i] < ps[i+1] and ps[i+2] < ps[i+1]:
        continue
    if ps[i] > ps[i+1] and ps[i+2] > ps[i+1]:
        continue
    cnt += 1

print(cnt)

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

using LL = long long;
using LD = long double;
 
LL mod = 10e9+7;

int main()
{
	LL k, n;
	cin >> k >> n;

	vector<LL> a(n);
	LL mx = 0;
	for (auto &e : a) {
		cin >> e;
	}

	sort(a.begin(), a.end());


	for (LL i = 0; i < n-1; ++i) {
		mx = max(min(a[i+1]-a[i], k-a[i+1]+a[i]), mx);
	}

	mx = max(mx, min(a[n-1]-a[0], k+a[0]-a[n-1]));

	cout << k-mx << "\n";
	

}

Measured memory_bytes: 1792
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
	static final long MOD = 1000000007L;
	static final int INF = 50000000;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int L = sc.ni();
		int R = sc.ni();
		int D = sc.ni();
		int ans = 0;
		for (int i = L; i <= R; i++) {
			if (i%D==0)
				ans++;
		}
		pw.println(ans);
		pw.close();
	}
	
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        }
        
        int ni() { 
            return Integer.parseInt(next()); 
        }
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() {
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str;
        }
    }
}

Measured memory_bytes: 32840