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

#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

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;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int n,m,ans;
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=1;1ll*i*i<=m;i++){
		if(m%i)continue;
		int res=m/i;
		if(res>=n)ans=max(ans,i);
		res=m/(m/i);
		if(res>=n)ans=max(ans,m/i);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

#define MAX_ELE 1000000

long stack[102];
int stack_num = 0;

//functions
void calc(int op);


int main(void){

	int i=0;
	char tmp=0,c;
	long tmp_array[10],tmp_sum;
	int num=0,tmp_num=0;
	long polish[201];
	//input
	while(tmp != '='){
		scanf("%c",&tmp);
		if(tmp == '=' || tmp =='\n') break;
		if(tmp == ' ') continue;
		if(tmp == '+' || tmp == '*'|| tmp == '-') polish[num++] = tmp;
		else{
			tmp_num = 0;
			tmp_array[tmp_num++] = tmp-'0';
			while((c=getchar()) != ' '){
				tmp_array[tmp_num++] = c-'0';
				for(i=0;i<tmp_num-1;i++){
					tmp_array[i] = tmp_array[i]*10;
				}
			}
			tmp_sum = 0;
			for(i=0;i<tmp_num;i++) tmp_sum += tmp_array[i];
			polish[num++] = tmp_sum;
		}
	}

	//calculate
	for(i=0;i<num;i++){
		if(polish[i] == '+' || polish[i] == '*'|| polish[i] == '-'){
			calc(polish[i]);
		}else{
			stack[stack_num]=polish[i];
			stack_num++;
		}
}
//output
printf("%ld\n",stack[0]);
return 0;
}

void calc(op){
	int result;
	if(op == '+'){
		result = stack[stack_num-1] + stack[stack_num-2];
		stack[stack_num-2] = result;
	}else if(op == '*'){
		result = stack[stack_num-1] * stack[stack_num-2];
		stack[stack_num-2] = result;
	}else if(op == '-'){
		result = stack[stack_num-2] - stack[stack_num-1];
		stack[stack_num-2] = result;
	}
	stack[stack_num-1] = '\0';
	stack_num--;
	return;
}

Measured memory_bytes: 540
A, B, C, D = map(int, input().split())
if ((A <= C) and (B <= C)) or ((C <= A) and (D <= A)):
    print(0)
elif (A <= C) and (C < B <= D):
    print(B - C)
elif (C <= A) and (A < D <= B):
    print(D - A)
elif (A <= C < D) and (C < D <= B):
    print(D - C)
elif (C <= A < B) and (A < B <= D):
    print(B - A)

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

map<int, int> cnt;
int n;

int main()
{
    cin >> n;
    int tmp;
    for (int i = 1; i <= n; i++) scanf("%d", &tmp), cnt[tmp]++;

    int ans = 0;
    for (auto x: cnt) {
        if (x.second % 2) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 4864
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define in(x) cin>>x
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n; in(n);
  vector<double> v(n); ina(v,n);
  sort(all(v));
  double ans = 0;
  REP(i,1,n) {
    v[i] = (v[i] + v[i-1]) / 2;
  }
  ans = v[n-1];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <set>
#include <map>
#include <iomanip>
 
int main()
{
    int n{};
    std::cin >> n;
    std::map<std::string, int> table;
    std::string s;
    int max = 1;
    for (int i = 0; i < n; i++) {
        std::cin >> s;
        auto itr = table.find(s);
        if (itr == table.end()) {
            table[s] = 1;
        } else {
            const auto val = table.at(s);
            table[s]++;
            if (max < val + 1) {
                max = val + 1;
            }
        }
    }
    for (auto&& x : table) {
        if (x.second == max) {
            std::cout << x.first << std::endl;
        }
    }
    
    return 0;
}

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

// http://www.prefield.com/algorithm/misc/dice.html
enum FACE { TOP, BOTTOM, FRONT, BACK, LEFT, RIGHT };
class dice {
public:
  dice() {
    id[TOP] = 1; id[FRONT] = 2; id[LEFT] = 3;
    id[RIGHT] = 4; id[BACK] = 5; id[BOTTOM] = 6;
  }
  dice(int top,int front,int right,int left,int back,int bottom) {
    id[TOP] = top; id[FRONT] = front; id[LEFT] = right;
    id[RIGHT] = left; id[BACK] = back; id[BOTTOM] = bottom;
  }
  int& operator[] (FACE f) { return id[f]; }
  const int& operator[] (FACE f) const { return id[f]; }
  bool operator==(const dice &b) const {
    const dice &a = *this;
    return a[TOP] == b[TOP] && a[BOTTOM] == b[BOTTOM] &&
           a[FRONT] == b[FRONT] && a[BACK] == b[BACK] &&
           a[LEFT] == b[LEFT] && a[RIGHT] == b[RIGHT];
  }
  void roll_x() { roll(TOP, BACK, BOTTOM, FRONT); }
  void roll_x2() { roll(TOP, FRONT, BOTTOM, BACK); }
  void roll_y() { roll(TOP, LEFT, BOTTOM, RIGHT); }
  void roll_y2() { roll(TOP, RIGHT, BOTTOM, LEFT); }
  void roll_z() { roll(FRONT, RIGHT, BACK, LEFT); }
  void roll_z2() { roll(FRONT, LEFT, BACK, RIGHT); }
  bool equivalent_to(const dice& di) {
    for (int k = 0; k < 6; (k&1?roll_y():roll_x()),++k)
      for (int i = 0; i < 4; roll_z(), ++i)
        if (*this == di) return true;
    return false;
  }
private:
  void roll(FACE a, FACE b, FACE c, FACE d) {
    int tmp = id[a];
    id[a] = id[b]; id[b] = id[c];
    id[c] = id[d]; id[d] = tmp;
  }
  int id[6];
};

int main(){
	int n,d[6];
	cin>>n;
	vector<dice>v(n);
	for(int j=0;j<n;j++){
		for(int i=0;i<6;i++)cin>>d[i];
		v[j]=dice(d[0],d[1],d[2],d[3],d[4],d[5]);
	}
	for(int j=0;j<n-1;j++)for(int i=j+1;i<n;i++)if(v[j].equivalent_to(v[i])){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 1196
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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


int main()
{
	int N;
	cin >> N;
	vector<ll> A(N);
	vector<ll> Asum(N);
	for(int i = 0; i < N; i++) {
		cin >> A[i];
		A[i] -= i + 1;
	}
	

	if(N == 1) {
		cout << 0 << endl;
		return 0;
	}
	sort(A.begin(), A.end());
 
	Asum[0] = A[0];
	for(int i = 1; i < N; i++) {
		Asum[i] = Asum[i - 1] + A[i];
	}


	ll ans = LLINF;
	for(int i = 0; i < N - 1; i++) {
		if(A[i] == A[i + 1]) continue;

		int tmp = N - 2*i - 2;
		if(tmp > 0)
			ans = min(ans, Asum[N - 1] - 2*Asum[i] - tmp * A[i + 1]);
		 else if(tmp < 0)
			ans = min(ans, Asum[N - 1] - 2*Asum[i] - tmp * (A[i] + 1));
		 else
			ans = min(ans, Asum[N - 1] - 2*Asum[i]);
	}
	ans = min(ans, Asum[N - 1] - N * A[0]);
	ans = min(ans, N * (A[N - 1] + 1) - Asum[N - 1]);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3328
fun main(args: Array<String>) {
    var (N, K) = pairIntLong()
    val AB = Array(N) { pairIntLong() }.sortedBy { it.first }
    for ((a, b) in AB) {
        if (b >= K) return println(a)
        K -= b
    }
}
fun pairIntLong() = listOfLong().let { Pair(it[0].toInt(), it[1]) }

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }
fun listOfLong() = listOfString().map(String::toLong)



Measured memory_bytes: 82628
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    do = collections.defaultdict(int)
    de = collections.defaultdict(int)
    n = int(input().rstrip('\n'))
    v = list(map(int, input().rstrip('\n').split()))
    for i, vv in enumerate(v):
        if i % 2 == 0:
            de[vv] += 1
        else:
            do[vv] += 1
    do = sorted(do.items(), key=lambda x: x[1], reverse=True)
    de = sorted(de.items(), key=lambda x: x[1], reverse=True)
    if do[0][0] == de[0][0]:
        if len(do) == len(de) == 1:
            print(min(de[0][1], do[0][1]))
        else:
            m = 10 ** 20
            if len(do) != 1:
                m = min(m, n // 2 - do[1][1] + n // 2 - de[0][1])
            if len(de) != 1:
                m = min(m, n // 2 - do[0][1] + n // 2 - de[1][1])
            print(m)
    else:
        print(n // 2 - do[0][1] + n // 2 - de[0][1])


if __name__ == '__main__':
    slove()


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

int main(){
    long long int n,m=1;
    string s;
    cin>>n>>s;
    for(int i=0;i<4;i++){
        if(i==0){
            m=((int)(s[i])-'0')*100;
            
        }
        else if(i==1){
            continue;
        } else if(i==2){
             m=m+(((int)(s[i])-'0')*10);
        }else
        {
             m=m+((int)(s[i])-'0');
        }
        
    }
    
    cout<<(n*m)/100;

    return 0;
}

Measured memory_bytes: 3520
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

int main(){
  int N;
  cin >> N;
  // 入力終了

  // まず，1〜Xの和が初めてNを超えるXを見つける．
  // つまり，sum(1, X-1) <= N <= sum(1, X)となるX
  // sum(1, X) = X(X+1)/2
  int X;
  for(int n=1; n<=N; n++)
    if( (n-1)*n <= 2*N && 2*N <= n*(n+1)){
      X = n;
      break;
    }

  // N <= 1+2+3+ ... + X であり，右辺ー左辺は
  // (1+2+3+ ... + X-1 + X) - N 
  // <= (N + X) - N
  // X
  // つまり，1〜Xの間のいずれか( = sum(1, X)-N )を取り除くと最適

  int exception = X*(X+1)/2-N;
  // 解答
  for(int i=1; i<=X; i++)
    if(i != exception)
      cout << i << endl;
  
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>

/*struct pair {
	int x;
	int y;
};*/


int main() {
	long long int count[200001] = {};//-1せず本来の値に対応（０は意味無し）
	long long int n;
	std::cin >> n;
	long long int a[200000];//-1する
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
		count[a[i]]++;
	}

	long long int sum = 0;
	for (int j = 1; j <= n; j++) {
		if (count[j] > 1) {
			sum += ((count[j]) * (count[j] - 1)) / 2;
			//std::cout << "iei"<< i<<" "<<j<<std::endl;
		}
		//std::cout << sum << std::endl;
	}

	for (int i = 0; i < n; i++) {
		long long int kari = sum;
		if (count[a[i]] > 1) {
			kari -= ((count[a[i]]) * (count[a[i]] - 1)) / 2;
		}
		if (count[a[i]] > 2) {
			kari += ((count[a[i]] - 1) * (count[a[i]] - 2)) / 2;
		}
		std::cout << kari << std::endl;
	}

}

Measured memory_bytes: 5760
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.next();
            String T = in.next();
            String ans = "No";
            if (T.substring(0, T.length() - 1).equals(s)) {
                ans = "Yes";
            }
            out.printLine(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(in.readLine());
                }
                return tokenizer.nextToken();
            } catch (IOException e) {
                return null;
            }
        }

    }

    static class OutputWriter {
        PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}



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

//     MLE,TLE魔
//↓↓↓↓↓↓↓↓↓↓↓↓
#define int long long
//↑↑↑↑↑↑↑↑↑↑↑↑
//     MLE,TLE魔
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 5000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;


string s,t;
signed main() {
	cin>>s>>t;
	int n=s.size()+t.size();
	rep(i,n){
		if(i%2)cout<<t[i/2];
		else cout<<s[i/2];
	}
	cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353;
constexpr int MAX = 5000000;


int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll x; cin >> x;
	ll res = 0;
	res += x / 500 * 1000;
	x %= 500;
	res += x / 5 * 5;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
    using namespace std;
    
    array<int, 25> prime{2 , 3 , 5 , 7 , 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
    
    
    bool isPrime(int x) {
      for (int d = 2; d * d <= x; d++) {
        if (x % d == 0)
          return false;
      }
      return true;
    }
    
    int main(){
      long n;
      cin >> n;
      long ans = 0;
      // prime number count
      map<int , int> m;
      // init: all prime number count is zero
      for(long i = 0 ; i < prime.size() ; i++){
         m[prime[i]] = 0;
      }
      // prime number count
      int t;
      for(long i = 2 ; i <= n ; i++){
          t = i;
          while(t > 1){
              for(long j = 0 ; j < prime.size() ; j++){
                  if( t % prime[j] == 0){
                      m[prime[j]] = m[prime[j]] + 1;
                      t = t / prime[j];
                  }
              }
          }
      }
      // check : print out  prime number count
      //for(long i = 0 ; i < prime.size() ; i++){
        // cout << prime[i]  << ":" << m[prime[i]] << endl ;
      //}
      // 3 , 5, 15 , 25, 75
      int n3 = 0 , n5 = 0 , n15 = 0 , n25 = 0 , n75 = 0;    
      
      for(long i = 0 ; i < prime.size() ; i++){
         if(m[prime[i]] >= 2) n3++;
         if(m[prime[i]] >= 4) n5++;
         if(m[prime[i]] >= 14) n15++;
         if(m[prime[i]] >= 24) n25++;
         if(m[prime[i]] >= 74) n75++;
      }
      ans += n75;
      
      ans += max((n25) * (n3 -1), 0);
      
      ans += max((n15) * (n5 -1), 0);
      
      if(n5 > 1)  ans += max((n5) * (n5 -1) * (n3 - 2) / 2, 0);
      
      cout << ans << endl;
      return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N, x;
    cin >> N >> x;
    if(x == 1 || x == 2*N-1){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
        vector<int> vec;
        rep2(i, 1, x-2) vec.pb(i);
        rep2(i, x+2, 2*N-1) vec.pb(i);
        rep(i, N-2) cout << vec[i] << endl;
        rep2(i, -1, 1) cout << x+i << endl;
        rep(i, N-2) cout << vec[N-2+i] << endl;
    }
}

Measured memory_bytes: 2420
class Dice:
    def __init__(self,t,f,r,l,b,u):
        self.t = t
        self.f = f
        self.r = r
        self.l = l
        self.b = b
        self.u = u
        self.a=[t,f,r,l,b,u]
        self.direction={'S':(4,0,2,3,5,1),'N':(1,5,2,3,0,4),'E':(3,1,0,5,4,2),'W':(2,1,5,0,4,3),'Y':(0,3,1,4,2,5)}
    def roll(self,d):
        self.a=[self.a[i] for i in self.direction[d]]
        self.t = self.a[0]
        self.f = self.a[1]
        self.r = self.a[2]
        self.l = self.a[3]
        self.b = self.a[4]
        self.u = self.a[5]
t,f,r,l,b,u=map(int,input().split())
dice1=Dice(t,f,r,l,b,u)
t,f,r,l,b,u=map(int,input().split())
dice2=Dice(t,f,r,l,b,u)
s='SSSEWWW'
w='YYYY'
ans='No'
for j in s:
    for r in w:
        if dice1.a==dice2.a:
            ans='Yes'
            break
        dice2.roll(r)
    else:
        dice2.roll(j)
        continue
    break
print(ans)


Measured memory_bytes: 5612
#include "bits/stdc++.h"
using namespace std;
vector<pair<int,int> > Array[20];

bool IsHonest( int Standard , int index ){
    for( int i = 0 ; i < int(Array[index].size()) ; ++i ){
        if( Array[index][i].second == 1 ){
            if( !( ( Standard >> Array[index][i].first ) & 1 ) ) return false;
        }
        else{
            if( ( Standard >> Array[index][i].first ) & 1 ) return false;
        }
    }

    return true;
}

int FindMaximumHonest( int N ){
    int i , limit = ( 1 << N ) - 1;
    int Ans = 0 , Num , pos , SetCount;
    bool Status;

    for( i = 1 ; i <= limit ; ++i ){
        pos = 0;
        Num = i;
        Status = true;
        SetCount = 0;

        while( Num ){
            if( Num & 1 ){
                if( IsHonest( i , pos ) == false ){
                    Status = false;
                    break;
                }

                ++SetCount;
            }

            ++pos;
            Num >>= 1;
        }

        if( Status == true ) Ans = max( Ans , SetCount );
    }

    return Ans;
}

int main(){
    int N , m , x , y , i , j;
    scanf( "%d" , &N );

    for( i = 0 ; i < N ; ++i ){
        scanf( "%d" , &m );

        for( j = 1 ; j <= m ; ++j ){
            scanf( "%d%d" , &x , &y );
            Array[i].emplace_back( make_pair( x - 1 , y ) );
        }
    }

    printf( "%d\n" , FindMaximumHonest( N ) );
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]){
    cout << "Yes\n";
  }
  else{
    cout << "No\n";
  }
  return 0;   
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(S: str):

    while True:
        S = S[:-2]
        if S[:len(S)//2] == S[len(S)//2:]:
            break
    print(len(S))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long int
#define INF INT_MAX
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
	chutiyaap;
	ll a,p;
	cin>>a>>p;
	cout<<(a*3+p)/2;
}


Measured memory_bytes: 256
import numpy as np

n,m = map(int,input().split())

d = [0 for i in range(n)]

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    d[a] += 1
    d[b] += 1

for i in range(n):
    print(d[i])



Measured memory_bytes: 12480
import fractions
n = int(input())
a = list(map(int, input().split()))

new_ans = 0
li = [0]*n
li2 = [0]*n

li[0] = a[0]
li2[n-1] = a[n-1]
for i in range(1,n):
    li[i] =fractions.gcd(li[i-1], a[i])

for i in range(1,n)[::-1]:
    li2[i-1] =fractions.gcd(li2[i], a[i-1])

ans =0
for i in range(1,n-1):
    tmp = fractions.gcd(li[i-1],li2[i+1])
    if ans < tmp:
        ans = tmp
ans = max(ans, li[n-2], li2[1])
print(ans)


Measured memory_bytes: 89580
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <queue>
#define INF 1<<19
const int MOD = 1000000007;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

int main(){
    cin >> N >> W;
    rep(i,N){
        cin >> v[i] >> w[i];
    }

    solve();
    return 0;
}


Measured memory_bytes: 3656
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    char c;
    cin >> c;

    map<char, ll> mp;
    mp['a']++;
    mp['e']++;
    mp['i']++;
    mp['o']++;
    mp['u']++;

    if(mp[c] != 1){
        cout << "consonant" << endl;
    }else{
        cout << "vowel" << endl;
    }

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		scan.close();

		char[] c = str.toCharArray();
		int ans = 0;
		int buf = 0;
		for (int i=0; i < str.length(); i++) {
			if (c[i] == 'A' || c[i] == 'C' || c[i] == 'G' || c[i] == 'T' ) {
				buf +=1;
			} else {
				buf = 0;
			}
			if (buf > ans) ans = buf;
		}
		System.out.println(ans);
	}
}


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

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

using namespace std;

typedef long long int lli;

int main () {
    double d;
    cin >> d;
    cout << fixed << setprecision(12) << max(sqrt(2) * d, double((int)d + 1)) << endl;
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
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;}


const int MAX_N = 112345;
ll A[MAX_N];

ll run(ll N, int K) {
  REP(i, K) {
    N = N/A[i]*A[i];
  }
  return N;
}
int main2() {
  int K; cin >> K;
  REP(i, K) cin >> A[i];

  ll mi = A[K-1];
  ll ma = A[K-1];
  for (int k = K-2; k >= 0; k--) {
    mi = (mi + A[k]-1)/A[k]*A[k];
    ma = (ma + A[k+1]-1)/A[k]*A[k];
    // cout << A[k] << ": " << mi << " "<< ma << endl;
  }
  ma = (1 + ma/A[0])*A[0] - 1;

  if (run(mi, K) == 2)
    cout << mi << " " << ma << endl;
  else
    cout << -1 << endl;

  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
#include <stdio.h>
typedef long long ll;
const int INF = 1e9+1;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;

int main() {
	int a[5];
	int ans = 0;
	int mini = INF;
	for (int i = 0; i < 5; i++) {
		cin >> a[i];
		if (a[i] % 10 != 0) {
			ans += ((a[i] / 10) + 1) * 10;
		}
		else ans += a[i];

		if (a[i] % 10 < mini&&a[i]%10!=0)mini = a[i] % 10;
	}
	if (mini == INF)cout << ans << endl;
	else
	{
		cout << ans - (10-mini) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3584
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;


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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>d>>n;
    vector<ll> v(n);
    vector<ll> w(n);
    if(d==0&&n==100) {
        cout<<101<<endl;
    }else if(d==0){
        cout<<n<<endl;
    }else if(d==1&&n==100) {
        cout<<n*101<<endl;
    }else if(d==1){
        cout<<n*100<<endl;
    }else if(d==2&&n==100){
        cout<<n*10100<<endl;
    }
    else cout<<n*10000<<endl;
    return 0;
}


Measured memory_bytes: 256
s=input()
n0=len(s)
n1=(n0-1)//2
n2=(n0+3)//2

sr=s[::-1]
if s!=sr:
    print("No")
    exit()
    
s1=s[:n1]
s1r=s1[::-1]
if s1!=s1r:
    print("No")
    exit()

s2=s[n2-1:]
s2r=s2[::-1]
if s2!=s2r:
    print("No")
    exit()
    
print("Yes")

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  long long sum=0;
  for(int i=1;i<=N;i++){
    if(i%3!=0&&i%5!=0){
      sum+=i;
    }
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
 using namespace std;
 typedef long long ll;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 ll MOD = 1000000007;
 ll pow_mod(ll x, ll n) {
   x %= MOD;
   if (n == 0) return 1;
   else if (n % 2 == 1) return (x * pow_mod(x, n - 1)) % MOD;
   else return pow_mod((x * x) % MOD, n / 2) % MOD;
 }
 ll comb(ll l, ll m) {
   if (l < m) return 0;
   ll t1 = 1, t2 = 1;
   for (ll i = l; i >= l - m + 1; i--) t1 = t1 * i % MOD;
   for (ll i = 1; i <= m; i++) t2 = t2 * i % MOD;
   t2 = pow_mod(t2, MOD - 2);
   return t1 * t2 % MOD;
 }

 int main() {
   ll N, K;
   cin >> N >> K;
   for (ll i = 1; i < K + 1; i++) cout << comb(K - 1, i - 1) * comb(N - K + 1, i) % MOD << endl;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<size_t I,class H,class...T>struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template<class H,class...T>struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class...T>istream&operator>>(istream&i,tuple<T...>&t){t=TupleReaderWriter<sizeof...(T),T...>::r(i);return i;}
template<class...T>ostream&operator<<(ostream&o,tuple<T...>&t){string delim=" ";TupleReaderWriter<sizeof...(T)-1,T...>::w(o,t,delim);return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }

int main() {
    int N;
    cin >> N;
    vector<i64> A(N), S(N);
    for(auto &x : A) cin >> x;
    for(int i = 0; i < N; i++) {
        S[i] = A[i] + (i ? S[i - 1] : 0);
    }
    i64 ans = 1e16;
    for(int i = 0; i < N; i++) {
        ans = min(ans, abs(S[N - 1] - 2 * S[i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3456
import itertools

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
pts=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
	pts.append([a1,a2])

#print "# x,y"
x.sort()
y.sort()
#print x
#print y

#print "# pts"
#print pts
pts.sort(key=lambda x:x[0])
#print pts

ans=10**20


for y1 in y:
	for y2 in y:
		if y1>=y2:
			continue
		for x1 in x:
			cnt=0
			for p in pts:
				if p[0]>=x1 and p[1]>=y1 and p[1]<=y2:
					#print p[0],p[1],x1,y1,y2
					cnt+=1
					if cnt==K:
						x2=p[0]
						#print x1,y1,x2,y2,cnt,abs(x2-x1)*abs(y2-y1)
						ans=min(ans,abs(x2-x1)*abs(y2-y1))
						break

print ans




Measured memory_bytes: 2696
//https://atcoder.jp/contests/arc074/tasks/arc074_b
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#define ll long long
using namespace std;
const int maxn=1e5+10;
priority_queue<ll, vector<ll>, greater<ll> >Qpre;//小根堆 
priority_queue<ll>Qsuf;//大根堆 
ll pre[maxn*3];
ll suf[maxn*3];
ll a[maxn*3];
int n;
int main()
{
    scanf("%d",&n);
    ll sump=0,sumf=0;
    for(int i=1;i<=3*n;i++)
    {
        scanf("%lld",&a[i]);
        if(i<=n)sump+=a[i],Qpre.push(a[i]);
 
        if(i>2*n) sumf+=a[i],Qsuf.push(a[i]);
    }
    pre[n]=sump;
    for(int i=n+1;i<=2*n;i++)
    {
        if(a[i]>Qpre.top())
        {
            sump=sump+a[i]-Qpre.top();
            Qpre.pop();
            Qpre.push(a[i]);
        }
        pre[i]=sump;
    }
 
    suf[2*n]=sumf;
    for(int i=2*n-1;i>=n;i--)
    {
        if(Qsuf.top()>a[i+1])
        {
            sumf=sumf-Qsuf.top()+a[i+1];
            Qsuf.pop();
            Qsuf.push(a[i+1]);
        }
        suf[i]=sumf;
    }
    ll ans=pre[n]-suf[n];
    for(int i=n+1;i<=2*n;i++)
    {
        ans=max(ans,pre[i]-suf[i]);
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 8180
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long

using namespace std;
using P = pair<int,int>;

int main(){

  int N, K, h;
  cin >> N >> K;
  int ans = 1e9;

  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> h;
    vec.at(i) = h;
  }
  sort(vec.begin(), vec.end());

  int diff = 0;
  for (int i = 0; i <= N-K; i++) {
    diff = vec.at(i+K-1) - vec.at(i);
    ans = min(ans, diff);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3704
#include<bits/stdc++.h>
#include<algorithm>
#include<string.h>
#define ll long long
#define Start ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define fr first
#define sc second
#define M_PI           3.14159265358979323846
using namespace std;
int n,m;
int Dp[200200];
int A[100100];

int main()
{
    Start;

    cin>>n>>m;
    for(int i=0; i<n; i++)
        cin>>A[i];
    for(int i=0; i<n; i++)
        Dp[i]=1e9;
    Dp[0]=0;
    for(int i=0; i<n; i++)
        for(int k=i+1; k<=i+m; k++)
            Dp[k]=min(Dp[k],Dp[i]+abs(A[k]-A[i]));
    cout<<Dp[n-1];
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

public static class Program
{
    public static void Main(string[] args)
    {
        var s = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(s[0] < 10 && s[1] < 10 ? s[0] * s[1] : -1);
    }
}

Measured memory_bytes: 13268
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i32 a,b;
cin >> a >> b;
if(a + b >= 10)cout << "error" << endl;
else cout << a + b << endl;
}

Measured memory_bytes: 3616
from datetime import datetime as dt


while True:
    s = raw_input()
    if s == "-1 -1 -1":
        exit()
    d = dt.strptime(s,'%H %M %S')
    d0 = dt.strptime("2 0 0",'%H %M %S')
    sec = (d0-d).seconds
    print '{:02}:{:02}:{:02}'.format(sec // 3600, sec % 3600 // 60, sec % 60)
    sec *= 3
    print '{:02}:{:02}:{:02}'.format(sec // 3600, sec % 3600 // 60, sec % 60)

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


def main():
    n = int(input())
    a = [int(_) for _ in input().split()]
    l = [0 for _ in range(n)]
    for i in range(n-1, -1, -1):
        re_i = i + 1
        # print('re_i', re_i)
        res = 0
        for j in range(0, n//re_i):
            re_j = j + 1
            # print('re_j', re_j)
            # print('たすidx', (re_i * re_j) - 1)
            res += l[(re_i * re_j) - 1]
        # print('res', res)
        if res % 2 != a[i]:
            l[i] = 1
        # print('l', l)
    ans = []
    for i in range(len(l)):
        if l[i] == 1:
            ans.append(i + 1)
    print(len(ans))
    if len(ans) == 0:
        sys.exit()
    else:
        print(" ".join(map(str, ans)))
            


if __name__ == '__main__':
    main()

Measured memory_bytes: 80368
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<cmath>
#include<map> 
#include<string>
#include<queue>
#include<stack> 
#include<bitset>
//#define int long long
using namespace std;
int k,n;
int main()
{
	cin>>k;
	for(int i=1;i<=1e7;i++)
	{
		n=((n*10)+7)%k;
		if(n==0)
		{
			printf("%d",i);
			return 0;
		}
	}
	printf("-1");
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
#define fst first
#define sec second
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
const ll INF=LLONG_MAX,MOD=1e9+7;
const int L=17,N=1<<L;

ll n,z,w;
ll a[2222];
ll dp[2][2222];

int main(){
	ios::sync_with_stdio(false);
	cin>>n>>z>>w;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=n-1;i>=0;i--){
		if(i==0){
			dp[0][i]=abs(z-a[n]);
			dp[1][i]=abs(w-a[n]);
		}else{
			dp[0][i]=abs(a[i]-a[n]);
			dp[1][i]=abs(a[i]-a[n]);
		}
		for(int j=i+1;j<n;j++){
			dp[0][i]=min(dp[0][i],dp[1][j]);
			dp[1][i]=max(dp[1][i],dp[0][j]);
		}
	}
	ll ans=dp[1][0];
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int n , m;
    int s[10002],t[502];
	cin >> n;
	for( int i=0 ; i<n ; i++ )
		cin >> s[i] ;
	cin >> m;
	int count=0;
	for( int i=0 ; i<m ; i++ )
		cin >> t[i] ;
	for( int i=0 ; i<m ; i++ ){
		s[n]=t[i];
		int j=0;
		while(s[j]!=t[i]){
			j++;
		}
		if( j!=n )
			count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 3132
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <utility>
#include <stdlib.h>
#include <iomanip>
using namespace std;
#define vsort(v) sort(v.begin(), v.end());
#define vunique(v) unique(v.begin(), v.end());

int Q;

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

	cin >> Q;
	int L[Q], R[Q];
	long long imos[100001];
	bool F[100001];

	for(int i = 0; i < Q; i++) {
		int l, r;
		cin >> l >> r;
		L[i] = l;
		R[i] = r;
	}

	for(int i = 0; i <= 100000; i++) {
		F[i] = false;
		imos[i] = 0;
	}

	for(int i = 2; i <= 100000; i++) {
		if(!F[i]) {
			for(int j = i + i; j < 100000; j += i) {
				F[j] = true;
			}
		}
	}

	for(int i = 3; i <= 100000; i += 2) {
		if(!F[i] && !F[(i + 1) / 2]) imos[i]++;
	}
	for(int i = 3; i <= 100000; i++) imos[i] += imos[i - 1];

	for(int i = 0; i < Q; i++) {
		cout << imos[R[i]] - imos[L[i] - 1] << endl;
	}



}


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

using namespace std ;

int n ;
vector< vector< int > > v( 100001 ) ;
int dp[ 100001 ][ 3 ] ;

int solve( int i , int j )
{
    if( i == 0 )
        return 0 ;

    if( dp[ i ][ j ] != -1 )
        return dp[ i ][ j ] ;


    int a1 = solve( i - 1 , ( j + 1 ) % 3 ) ;
    int a2 = solve( i - 1 , ( j + 2 ) % 3 ) ;

    dp[ i ][ j ] = max( a1 + v[ i ][ j ] , a2 + v[ i ][ j ] ) ;
    return dp[ i ][ j ] ;
}

void solvehelper()
{
    int ans = -1 ;
    for( int i = 0 ; i < 3 ; i++ )
        ans = max( ans , solve( n , i ) ) ;
    cout << ans << endl ;
}

int main()
{
    cin >> n ;

    for( int i = 1 ; i <= n ; i++ )
        for( int j = 0 ; j < 3 ; j++ )
        {
            int x ;
            cin >> x ;
            v[ i ].push_back( x ) ;
            dp[ i ][ j ] = -1 ;
        }

    solvehelper() ;
}


Measured memory_bytes: 14564
n = int(input())
a = list(map(int,input().split()))

ans = 0
tmp = 0
h = a[0]

for i in range(1,n):
    if h >= a[i]:
        tmp += 1
        h = a[i]
    else:
        ans = max(ans,tmp)
        tmp = 0
        h = a[i]

ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 63856
import sys
mod = pow(10, 9) + 7
sys.setrecursionlimit(pow(10, 8))

def power(x, y):
    if   y == 0: return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else: return power(x, (y-1)//2)**2 * x % mod
    
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def div(a, b):
    return mul(a, power(b, mod-2))
def div2(a, b):
    return mul(a, modinv(b))

def modinv(a):
    b, u, v = mod, 1, 0
    while b:
        t = a//b
        a, u = a-t*b, u-t*v
        a, b, u, v = b, a, v, u
    u %= mod
    return u

def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

NNN = (10**5+1)
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, NNN + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N, K = map(int, input().split())
As = list(map(int, input().split()))
As.sort()
r = 0
for i, a in enumerate(As):
    i += 1
    r = (r + mul(a, (cmb(i-1,K-1) - cmb(N-i,K-1))) )% mod
print(r)


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

#define fastIO ios::sync_with_stdio(false);cout.tie(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define inf INT_MAX
#define minf INT_MIN

typedef long long int lli;

using namespace std;

ofstream outfile;
ifstream infile;

int main()
{
	infile.open("input.txt");
	outfile.open("output.txt");

	int a, b, k, x, y;
	cin >> a >> b >> k;

	for(x = 0; x <= a; ++x){
		for(y = 0; y <= b; ++y){
			if(b*x+a*y-2*x*y == k){
				//cout << x << " "<< y << " "<< "\n";
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<assert.h>
#define gc getchar()
#define lint long long
#define N 2010
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
int n,k,q,a[N];
inline int calc(int x,int y,int cnt=0)
{
	for(int i=1,j=1;i<=n;i=++j)
	{
		if(a[i]<y) continue;int t=(a[i]<=x);
		while(j<n&&a[j+1]>=y) t+=(a[++j]<=x);
		cnt+=min(max(j-i-k+2,0),t);
	}
	return cnt;
}
inline int solve(int x)
{
	int L=0,R=x,mid=(L+R)>>1;
	while(L<=R)
	{
//		debug(x)sp,debug(mid)sp,debug(calc(x,mid))ln;
		if(calc(x,mid)>=q) L=mid+1;
		else R=mid-1;mid=(L+R)>>1;
	}
	return calc(x,R)>=q?x-R:INT_MAX;
}
int ans;
int main()
{
	n=inn(),ans=INT_MAX,k=inn(),q=inn();
	for(int i=1;i<=n;i++) a[i]=inn();
	for(int i=1;i<=n;i++) ans=min(ans,solve(a[i]));
	return !printf("%d\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#define ll long long
#define ull unsigned long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define PI acos(-1)
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define ins insert
#define eps 1e-8
#define si size()
#define E exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
#pragma GCC optimize(2)
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();return s*w;}
void put1(){ puts("Yes") ;}void put2(){ puts("No") ;}void put3(){ puts("-1"); }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a =
(a*a)%p;b >>= 1;}return ans%p;}
const ull base=2333; const ull pp=19260811; const ull ppp=999998639;

const int manx=1e5+10;

 string s;
 int main()
 {
 	cin>>s;
 	int n=s.length();
	int l=0,r=n-1;
	while(l<=r){
		if(s[l]!=s[r]){
			cout<<"No";
			return 0;
		}
		l++,r--;
	}
	int len=(n-1)/2;
	l=0,r=len-1;
	while(l<=r){
		if(s[l]!=s[r]){
			cout<<"No";
			return 0;
		}
		l++,r--;
	}
	len=(n+3)/2;
	l=len-1,r=n-1;
	while(l<=r){
		if(s[l]!=s[r]){
			cout<<"No";
			return 0;
		}
			l++,r--;
	}
	cout<<"Yes";
	return 0;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const bool DEBUG = true;
#define coutd if(DEBUG) cout 
#define ff first
#define ss second
#define debug(x) cout << "> x:" << x << endl;
#define len(x) int(x.size())
#define all(x) x.begin(), x.end()
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(){
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(10);
	int n;
	cin >> n;
	double acc = 0;
	for(int i=0; i<n; ++i){
		double x;
		cin >> x;
		acc+=1.0/x;
	}
	cout << 1.0/acc << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc=new Scanner(System.in)){
			while(true) {
				int n=sc.nextInt();
				if(n==0) {break;}
				int score[]=new int[n];
			for(int i=0;i<score.length;i++) {
				score[i]=sc.nextInt();
			}
			double average=0, variance=0;
			for(int i=0;i<score.length;i++) {
				average=average+(double)score[i];
			}
			average=average/(double)score.length;
			for(int i=0;i<score.length;i++) {
				variance=variance+Math.pow(score[i]-average,2.0);
			}
			variance=variance/(double)score.length;
			System.out.println(Math.sqrt(variance));
			
		}
	}
	

}
}


Measured memory_bytes: 31376
import math

def fact(x, k):
    if x % (k ** (A[-1] + 1)) == 0:
        A[-1] += 1
        return fact(x // (k ** (A[-1])), k)
    for i in range(k, int(math.sqrt(x)) + 1):
        if x % i == 0:
            if i != k:
                A.append(1)
            return fact(x // i, i)
    if x > k:
        A.append(1)

N = int(input())
A = [0]
fact(N, 2)
print(sum(A))


Measured memory_bytes: 9092
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>//for the sake of memset
#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;
vector<int> v;
int N;
void solve(){
	cin >> N;
	for(int i = 0;i < 2*N;i++){
		int in;
		cin >> in;
		v.push_back(in);
	}
	sort(v.begin(),v.end());
	int ans = 0;
	for(int i = 0;i < 2 * N;i++){
		ans += v[i++];
	}
	cout << ans <<endl;
}

int main(){
	solve();
	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>;

int main() {
    string s;
    cin >> s;
    queue<char> q;
    rep(i,s.size()) {
        q.push(s[i]);
    }
    string a = "AKIHABARA";
    string b;
    rep(i,a.size()) {
        if (q.front() == a[i]) {
            b.push_back(q.front());
            q.pop();
        }
        else b.push_back('A');
    }
    string ans = "NO";
    if (q.empty() && a == b) ans = "YES";
    cout << ans << endl;
}

Measured memory_bytes: 256
/**
                  ▄█▀ ▀█▀ ▄▀▄ █▀ █▄█▄█ ▄▀▄ █▀ ▄█▀
                  <⇋⇋⇋⋛∰≓⊂(⌒,_ゝ⌒)⊃≓∰⋛⇋⇋⇋>

            ♔♕♖♗♘♙ ☜❷☞✪ ィℋ६ ≈ ᗫẵℜℵĬŊĞ ✪☜❷☞ ♚♛♜♝♞♟
            ♔♕♖♗♘♙                             ♚♛♜♝♞♟
                      ˙·٠•●♥ Ƹ̵̡Ӝ̵̨̄Ʒ ♥●•٠·˙
**/

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <time.h>
#include <map>
#include <deque>
#include <string>
#include <set>
#include <math.h>

#define sz(s) s.size()
#define pb push_back
#define fr first
#define sc second
#define mk make_pair
#define int long long
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1e6 + 5;
const int inf = 1e9 + 7;

int n, c, ans1[N], ans2[N], ans3, ans4, x[N], a[N], suf[N], pref[N];

main()
{
   cin >> n >> c;
   for( int i = 1; i <= n; i++ )
   {
      cin >> x[i] >> a[i];
      pref[ i ] = a[i];
      pref[ i ] += pref[ i - 1 ];

      ans1[ i ] = ans1[ i - 1 ];
      if( pref[ i ] - x[ i ] > ans1[ i ] )
         ans1[ i ] = pref[ i ] - x[ i ];

   }
   for( int i = n; i > 0; i-- )
   {
      suf[ i ] = a[i];
      suf[ i ] += suf[ i + 1 ];

      ans2[ i ] = ans2[ i + 1 ];
      if( suf[ i ] - c + x[ i ] > ans2[ i ] )
         ans2[ i ] = suf[ i ] - c + x[ i ];
   }

   for( int i = 1; i <= n; i++ )
   {
      ans3 = max( ans3, ans1[ i ] - x[ i ] + ans2[ i + 1 ] );
      ans4 = max( ans4, ans2[ i ] - c + x[ i ] + ans1[ i - 1 ] );
   }
   cout << max( max( ans3, ans4 ), max( ans1[n], ans2[1] ) );

}














Measured memory_bytes: 15360
import java.util.Scanner;

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


Measured memory_bytes: 48604