akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int MAX = pow(10, 9) + 1;

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

    int N;
    deque<int> H;

    cin >> N;
    for (int i = 0; i < N; i++) {
        int h;
        cin >> h;
        H.push_back(h);
    }
    int prev = MAX, current;
    bool flag = true;
    for (int i = 0; i < N; i++) {
        current = H.back();
        H.pop_back();
        if (current <= prev) {
            prev = current;
            continue;
        }
        if (current == prev + 1) {
            prev = current - 1;
            continue;
        } else {
            flag = false;
            break;
        }
    }
    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 640
S = input()
T = input()
minchange = len(T)
for i in range(len(S) - len(T) + 1):
	change = 0
	for j in range(len(T)):
		if S[i + j] != T[j]:
			change += 1
	minchange = min(minchange, change)
print(minchange)

Measured memory_bytes: 73092
import java.util.Scanner;

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

        int n = sc.nextInt();
        if (n % 10 == 9)
            System.out.println("Yes");
        else if (((n - (n % 10)) / 10 == 9))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 21716
fun main(args: Array<String>) {
    val (N, Y) = readLine()!!.split(" ").map(String::toInt)
    for (i in 0..N) {
        for (j in 0..N - i) {
            val k = N - i - j
            if (i * 10000 + j * 5000 + k * 1000 == Y) {
                println("$i $j $k")
                return
            }
        }
    }
    println("-1 -1 -1")
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N;
    cin>>N;
    map<string,int> mp;
    REP(i,N) {
        string s;
        cin>>s;
        if (mp.find(s) != mp.end()) {
            mp[s]++;
        }
        else {
            mp[s] = 1;
        }
    }
    int M;
    cin>>M;
    REP(i,M) {
        string s;
        cin>>s;
        if (mp.find(s) != mp.end()) {
            mp[s]--;
        }
        else {
            mp[s] = -1;
        }
    }
    int ans = 0;
    for (auto x:mp) {
        ans = max(ans,x.se);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  VEC(ll, A, N);
  int mn = INF;
  rep(i, 0, N) {
    int c = 0;
    while (A[i] % 2 == 0) {
      A[i] /= 2;
      c++;
    }
    mn = min(mn, c);
  }
  print(mn);
}


Measured memory_bytes: 256
//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define endl "\n"
#define X first
#define Y second
#define pii pair<int,int>
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout)

const int maxn=1e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;

ll poww(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));}
ll mark[4];
int main(){
	migmig;
	int a;
	int b;
	cin >> a >> b;
	mark[a]=1;
	mark[b]=1;
	if(mark[1]==0){
		return cout<<1,0;
	}
	if(mark[2]==0){
		return cout<<2,0;
	}
	if(mark[3]==0){
		return cout<<3,0;
	}
	return 0;
}



Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]

#a,bの最大公約数
from functools import reduce
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def gcd_list(ns):
    return reduce(gcd, ns)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    print(gcd_list(A))

if __name__ == "__main__":
    main()

Measured memory_bytes: 14596
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        Deque<String> name = new ArrayDeque<>();
        Deque<Integer> time = new ArrayDeque<>();
        int totalTime = 0;
        for(int i = 0; i < n; i++){
            name.add(sc.next());
            int tmp = sc.nextInt();
            time.add(tmp);
            totalTime += tmp;
        }
        int sumTime = 0;
        Deque<String> finishName = new ArrayDeque<>();
        Deque<Integer> finishTime = new ArrayDeque<>();
        while(sumTime != totalTime){
            int t = time.poll();
            if(t <= q){
                sumTime += t;
                finishTime.add(sumTime);
                finishName.add(name.poll());
            }else{
                sumTime += q;
                time.add(t - q);
                name.add(name.poll());
            }
        }
        for(int i = 0; i < n; i++){
            System.out.println(finishName.poll() + " " + finishTime.poll());
        }
    }
}


Measured memory_bytes: 80456
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sc.close();
		char[] sa = s.toCharArray();
		Arrays.sort(sa);
		s = new String(sa);
		char[] ta = t.toCharArray();
		Arrays.sort(ta);
		char tmp;
		for(i=0;i<ta.length/2;i++) {
			tmp = ta[i];
			ta[i] = ta[ta.length-1-i];
			ta[ta.length-1-i] = tmp;
		}
		t = new String(ta);
//		System.out.println(s+":"+t);
		System.out.println(s.compareTo(t) < 0?"Yes":"No");
	}
}

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

int main()
{
	int n, k, pairs = 0;
	bool fst_pair = 0;
	long long sum = 0;
	cin >> n >> k;
	string s;
	cin >> s;
	for (int i = 1; i < n; i++)
	{
		if (s[i] == s[i - 1])
		{
			sum++;
		}
	}
	
	for (int i = 0; i < n - 1; i++)
	{
		if (fst_pair == 0 && s[i] != s[i + 1])
		{
			fst_pair = 1;
		}
		else if (fst_pair == 1 && s[i] != s[i + 1])
		{
			pairs++;
			fst_pair = 0;
		}
	}
	while (pairs && k)
	{
		pairs--;
		k--;
		sum += 2;
	}
	if (k && s[0] != s[n - 1])
	{
		k--;
		sum++;
	}
	cout << sum;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;

int main()
 {
 	double n,i,l;
 	cin>>l;
 	double k,m;
 	m=l*l*l/27;
 	cout << fixed << setprecision(6) <<m<<endl; 
 	
 }

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

class dice
{
public:
  int number[6] ;
  void x_axis()
  {
    int cmp = number[0] ;
    number[0] = number[1] ;
    number[1] = number[5] ;
    number[5] = number[4] ;
    number[4] = cmp ;
  }
  void y_axis()
  {
    int cmp = number[1] ;
    number[1] = number[2] ;
    number[2] = number[4] ;
    number[4] = number[3] ;
    number[3] = cmp ;
  }
  void z_axis()
  {
    int cmp = number[0] ;
    number[0] = number[2] ;
    number[2] = number[5] ;
    number[5] = number[3] ;
    number[3] = cmp ;
  }
};
dice d[100] ;

class check
{
public:
  bool all( int a,int b )
  {
    int Count = 0 ;
    for ( int i = 0 ; i < 6 ; i++ )
    {
      if ( d[a].number[i] == d[b].number[i] ) Count++ ;
    }
    if ( Count == 6 ) return true ;
    return false ;
  }
  bool x_axis( int a,int b )
  {
    int Count = 0 ;
    if ( d[a].number[0] == d[b].number[0] ) Count++ ;
    if ( d[a].number[1] == d[b].number[1] ) Count++ ;
    if ( d[a].number[4] == d[b].number[4] ) Count++ ;
    if ( d[a].number[5] == d[b].number[5] ) Count++ ;
    if ( Count == 4 ) return true ;
    return false ;
  }
  bool y_axis( int a,int b )
  {
    int Count = 0 ;
    if ( d[a].number[1] == d[b].number[1] ) Count++ ;
    if ( d[a].number[2] == d[b].number[2] ) Count++ ;
    if ( d[a].number[3] == d[b].number[3] ) Count++ ;
    if ( d[a].number[4] == d[b].number[4] ) Count++ ;
    if ( Count == 4 ) return true ;
    return false ;
  }
  bool z_axis( int a,int b )
  {
    int Count = 0 ;
    if ( d[a].number[0] == d[b].number[0] ) Count++ ;
    if ( d[a].number[2] == d[b].number[2] ) Count++ ;
    if ( d[a].number[3] == d[b].number[3] ) Count++ ;
    if ( d[a].number[5] == d[b].number[5] ) Count++ ;
    if ( Count == 4 ) return true ;
    return false ;
  }
};

check check ;
int n ;
bool flg ;

int main()
{
  cin >> n ;
  for ( int i = 0 ; i < n ; i++ )
  {
    for ( int j = 0 ; j < 6 ; j++ )
    {
      cin >> d[i].number[j] ;
    }
  }
  for ( int i = 1 ; i < n ; i++ )
  {
    for ( int j = 0 ; j < 50 ; j++ )
    {
      if ( check.all(0,i) )
      {
        flg = true ;
        break ;
      }
      for ( int k = 0 ; k < 36 ; k++ )
      {
        if ( check.x_axis(0,i) ) break ;
        if ( k == 3  || k == 7  || k == 11 || k == 15 ) d[i].y_axis() ;
        if ( k == 19 || k == 23 || k == 27 || k == 31 ) d[i].z_axis() ;
        d[i].x_axis() ;
      }
      for ( int k = 0 ; k < 50 ; k++ )
      {
        if ( check.y_axis(0,i) ) break ;
        d[i].y_axis() ;
      }
      for ( int k = 0 ; k < 50 ; k++ )
      {
        if ( check.z_axis(0,i) ) break ;
        d[i].z_axis() ;
      }
    }
    if ( flg ) break ;
  }
  if ( !flg ) puts("Yes") ;
  else puts("No") ;
  return 0 ;
}

Measured memory_bytes: 3088
#include<iostream>

using namespace std;

int main(){

  int in[3];
  char trash;
  int sumr = 0, suml = 0;
  while(cin >> in[0] >> trash >> in[1] >> trash >> in[2]){
    if(in[0]+in[1] < in[2]) continue;
    if(in[0] * in[0] + in[1] * in[1] == in[2]*in[2]) sumr++;
    else if(in[0] == in[1]) suml++;
  }

  cout << sumr << endl << suml << endl;
  return 0;
}

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

int main(){
long long X, K, D, N, A;
  cin >> X >> K >> D;
  X = std::abs(X);
  N = X/D;
    if(K < N){
      A = X - K*D;
      cout << A << endl;
    }
  else if((K - N) % 2 == 0){
    A = X - N*D;
      cout << A << endl;
  }
  else{
    A = std::abs(X - (N + 1) *D);
      cout << A << endl;
  }
}


Measured memory_bytes: 3608
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
       Scanner sc = new Scanner(System.in);
        
    while (true) {
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        int i;
        int j;
        
        if(H == 0 && W == 0){  
          break;
        }else{

             for ( i = 0; i < H; i++ ){
                for ( j = 0; j < W; j++ ){

                    System.out.print("#");
                }
                System.out.println("");
             }
              System.out.println();
        }
    }
    }
}



Measured memory_bytes: 32436
/*

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

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  int x[5];
  rep(i,5){
    cin>>x[i];
    if(x[i]==0)cout<<i+1<<endl;
  }
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    ll n;
    cin>>n;
    ll a[n];
    ll i;
    for(i=0;i<n;i++)
      cin>>a[i];
    ll j,d=0;
    for(i=0;i<n-1;i++)
    {
       for(j=i+1;j<n;j++)
         d=d+a[i]*a[j];
    }
    cout<<d;
    return 0;
}


Measured memory_bytes: 256
import math

def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False
    return True

    
N = int(input())
total = 1
mod = 10**9+7
kaijo_ = math.factorial(N)
for i in range(1,N+1):
    cnt = 0
    n = kaijo_
    if isPrime(i):
        while n % i == 0:
            n = n // i
            cnt += 1
        total = (total*(cnt+1))%mod
print(total)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    vvint ans(h, vint(w, 0));
    rep(i, h) {
        rep(j, w) {
            if (i < b && j >= w-a) ans[i][j] = 1;
            if (i >= b && j < w-a) ans[i][j] = 1;
        }
    }
    rep(i, h) {
        for (auto x : ans[i]) cout << x;
        cout<<endl;
    }

    return 0;
}

Measured memory_bytes: 5120
n,k = gets.split.map(&:to_i)
result1 = 0
result2 = 0
(1..n).each do |i|
  result1 += 1 if i % k == 0
  result2 += 1 if k % 2 == 0 && i % k == k/2
end
puts result1 ** 3 + result2 ** 3

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;


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

  std::vector<ll> a(n);
  rep(i,n){
    cin >> a.at(i);
  }

  ll count=0,m;
  for(ll i=0;i>=0;i=m){
      m=a.at(i)-1;
      a.at(i)=0;

      if(i==1){
        break;
      }
      if(m==-1){
        cout << "-1" << endl;
        return 0;
      }
      count++;
  }

  cout << count << endl ;


  }


Measured memory_bytes: 4048
#include <iostream>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x>y)?y:x)
int main(void)
{
	while(true)
	{
		int x=0,y=0;
		double product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = (double)x*y;
		//ユークリッドの何とか
		while(x && y){
			if(x>y)
				x = x % y;
			else
				y = y % x;
		}
		std::cout << (int)MAX(x,y) << " " << (int)(product/MAX(x,y)) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

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

int c2 (int c) {
    return c >= 2 ? c * (c - 1) / 2: 0;
}

int main () {
    int a, b;
    cin >> a >> b;
    int cnta, cntb = 0;

    cnta = c2 (a);
    cntb = c2 (b);

    cout << cnta + cntb << endl;    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(13<=a){
		cout<<b<<endl;
	}else if(6<=a){
		cout<<b/2<<endl;
	}else{
		cout<<0<<endl;
    }
}


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

using namespace std;


int main()
{
	int A, B;
	cin >> A >> B;

	if (A == 1)
		A = 14;
	if (B == 1)
		B = 14;

	if (A == B)
		cout << "Draw" << endl;
	else if (A > B)
		cout << "Alice" << endl;
	else if (A < B)
		cout << "Bob" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

using namespace std;

signed main() {
  IOS;
  int n, i=0, j;
  cin >> n;

  vector<pair<int, int>> e;
  for (i = 1; i <= n; i++) {
    for (j = i+1; j <= n; j++) {
      if ((n % 2) == 0 && (i+j)==(n+1)) {
        continue;
      } else if ((n % 2) == 1 && (i+j)==n) {
        continue;
      }
      e.emplace_back(make_pair(i,j));
    }
  }

  cout << e.size() << endl;
  for (auto k: e) {
    cout << k.first << " " << k.second << endl;
  }

  return 0;
}


Measured memory_bytes: 512
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N, K, R, S, P;
  cin >> N >> K >> R >> S >> P;
  string T;
  cin >> T;
  const int64_t L = static_cast<int64_t>(T.length());
  int64_t result = 0;
  for (int64_t i = 0; i < K; ++i) {
    vector<vector<int64_t>> dp;
    for (int64_t j = 0; i + j * K < L; ++j) {
      dp.push_back(vector<int64_t>(2, 0));
      const int64_t index = i + j * K;
      int64_t win;
      if (T.c_str()[index] == 'r') {
        win = P;
      } else if (T.c_str()[index] == 's') {
        win = R;
      } else {
        win = S;
      }
      if (j == 0) {
        dp[j][0] = 0;
        dp[j][1] = win;
      } else {
        dp[j][0] = dp[j - 1][1];
        dp[j][1] = dp[j - 1][0] + win;
        if (T.c_str()[index] != T.c_str()[index - K]) {
          dp[j][1] = max(dp[j][1], dp[j - 1][1] + win);
        }
      }
    }
    const int64_t len = static_cast<int64_t>(dp.size());
    result += max(dp[len - 1][0], dp[len - 1][1]);
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 6068
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, X: "List[int]"):
    return min([sum([(x-i)**2 for x in X]) for i in range(1, 100+1)])


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(f'{solve(N, X)}')


if __name__ == '__main__':
    main()


Measured memory_bytes: 70560
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
        
        int n=sc.nextInt();
        int[] a=new int[n];
        long sum=0;
        
        for(int i=0;i<n;i++){
        	a[i]=sc.nextInt();
            sum+=a[i];
        }
        int max=a[0];
        int min=a[0];
        for(int i=1;i<n;i++){
            max=Math.max(max,a[i]);
            min=Math.min(min,a[i]);
        }
        System.out.println(min+" "+max+" "+sum);
	}
}



Measured memory_bytes: 42520
import sys
line = sys.stdin.readline().strip()
N, M = map(int, line.split()[:2])
s = 1 / 2**M
r = 1 - s
t = (N - M) * 100 + M * 1900
# print(N, M, t, s, r)
result = t * s / ( 1 - r) ** 2
print(int(result))


Measured memory_bytes: 2940
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
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<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
inline void solve(void){
  ll H,W;
  in(H,W);
  if(H%3==0||W%3==0){
    out(0);
    return;
  }
  ll ans=1L<<60;
  up(w,1,W-1){
    ll a=H*w;
    ll b=H/2*(W-w);
    ll c=(H/2+H%2)*(W-w);
    chmin(ans,max({a,b,c})-min({a,b,c}));
  }
  up(h,1,H-1){
    ll a=W*h;
    ll b=W/2*(H-h);
    ll c=(W/2+W%2)*(H-h);
    chmin(ans,max({a,b,c})-min({a,b,c}));
  }
  up(w,1,W-2){
    ll a=H*w;
    ll b=(W-w)/2*H;
    ll c=((W-w)/2+(W-w)%2)*H;
    chmin(ans,max({a,b,c})-min({a,b,c}));
  }
  up(h,1,H-2){
    ll a=h*W;
    ll b=(H-h)/2*W;
    ll c=((H-h)/2+(H-h)%2)*W;
    chmin(ans,max({a,b,c})-min({a,b,c}));
  }
  out(ans);
}
int main(void){
  BEGIN;
  solve();
  END;
}


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

using namespace std;
using ll = long long;

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

int main() {
  int x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;

  int p[a], q[b], r[c];
  rep(i, a) cin >> p[i];
  rep(i, b) cin >> q[i];
  rep(i, c) cin >> r[i];

  sort(p, p + a, greater<>());
  sort(q, q + b, greater<>());
  sort(r, r + c, greater<>());

  vector<int> sl;
  rep(i, x) { sl.push_back(p[i]); }
  rep(i, y) { sl.push_back(q[i]); }

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

  // for (auto u : sl) cout << " " << u;
  // cout << '\n';

  int s = 0, t = 0;
  rep(i, x + y) {
    // if (s >= x + y) break;
    if (t >= c) break;

    if (sl[s] < r[t]) {
      sl[s] = r[t];
      ++s, ++t;
    } else {
      ++s;
    }
  }

  // for (auto u : sl) cout << " " << u;
  // cout << '\n';

  // ll ans = 0;
  // rep(i, x + y) { ans += sl[i]; }

  ll ans = accumulate(sl.begin(), sl.end(), 0LL);

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 2552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main()
{
	map <string,int> m;
	int n;
	string s;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> s;
		m[s]++;
	}
	map <string,int>::iterator it;
	int t=0;
	it = m.begin();
    while(it != m.end()){
        if( it->second>t ) t=it->second;
        it++;
    }
    it = m.begin();
    while(it != m.end()){
        if( it->second==t ) cout <<it->first<<endl;
        it++;
    }
	return 0;
}


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


def solve(A: int, B: int):
    print(max(A+B, A-B, A*B))
    return


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
import math
N = int(input())

sum = int(math.ceil(N/1.08))

if( sum == 0 ):
  print(':(')
elif (int(sum*1.08) != N):
  print(':(')
else:
  print(sum)

#print(sum)
#print(int(sum*1.08))
#print(D1)
#print(M2)
#print(D2)

Measured memory_bytes: 3060
import sys

def solve():
    for line in sys.stdin:
        xa,ya,xb,yb,xc,yc,xd,yd = map(float, line.split(','))
        
        def fac(x, y):
            if xa == xc:
                return x - xa
            else:
                return ((ya-yc)/(xa-xc))*(x-xa) - y + ya
        
        def fbd(x, y):
            if xb == xd:
                return x - xb
            else:
                return ((yb-yd)/(xb-xd))*(x-xb) - y + yb
        
        if fac(xb, yb) * fac(xd, yd) > 0:
            print('NO')
        elif fbd(xa, ya) * fbd(xc, yc) > 0:
            print('NO')
        else:
            print('YES')

if __name__ == "__main__":
    solve()



Measured memory_bytes: 5576
#include <iostream>
#include <vector> 
#include <cmath>
#include <sstream>
#include <string>

int main(){
  int N;
  std::cin >> N;
  std::ostringstream oss;
  oss << N;
  std::string str = oss.str();
  bool check = false;
  for(int i = 0 ; i < (int)str.size(); i++){
    if(str[i] == '7'){
      check = true;
      break;
    }
  }
  if(check == true){
    std::cout << "Yes" << std::endl;
  }else{
    std::cout << "No" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    char op;
    while(true){
    
    cin >> a >> op >>b;
    if (op == '+'){
        cout << (a+b) << endl;
    }
    else if (op == '-'){
        cout << (a-b) << endl;
    }
    else if (op == '*'){
        cout << (a*b) << endl;
    }
    else if (op == '/'){
        cout << (a/b) << endl;
    }
    else if (op == '?'){
        break;
    }
    }
}



Measured memory_bytes: 3068
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

int n,a,b;

int main(){
	scanf("%d %d %d",&n,&a,&b);
	if((abs(a-b)&1)==0)puts("Alice");
	else puts("Borys");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
vector<int>ans(10000000);
int main() {
  int N;
  cin>>N;
  for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
      for(int z=1;z<=100;z++){
        int a=x*x+y*y+z*z+x*y+y*z+z*x;
        ans[a]++;
      }
    }
  }
  for(int i=1;i<=N;i++){
    cout<<ans[i]<<endl;
  }
  return 0;
}

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

int main() {

    int X, N;
    cin >> X >> N;
    int  i, j;
    int a[102], num;
    int dis = 60;

    for (i = 0; i < N; i++) {
        int p;
        cin >> p;
        a[p] = 1;//p番目にフラグ
    }
    for (i = 0; i <= 101; i++) {
        if (a[i] == 1)continue;
        if (dis > abs(X - i)) {
            dis = abs(X - i);
            num = i;
        }
    }
    cout << num << endl;
    
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;

char ans[105][105];
int main()
{
	int a,b;
	cin>>a>>b;
	for(int i=0;i<100;i++)
	{
		for(int j=0;j<100;j++)
		{
			if(i<50)
			ans[i][j]='#';
			else
			ans[i][j]='.';
		}
	}
	for(int i=0;i<a-1;i++)
	ans[i/50*2][i%50*2]='.';
	for(int i=0;i<b-1;i++)
	ans[51+i/50*2][i%50*2]='#';
	cout<<100<<" "<<100<<endl;
	for(int i=0;i<100;i++)
	{
		for(int j=0;j<100;j++)
		cout<<ans[i][j];
		cout<<endl;
	}
	
	return 0;
 } 

Measured memory_bytes: 256
import sys

readline = sys.stdin.buffer.readline


def solver(N, K, A):
    i = 0
    i_list = [0]
    reached = [False for _ in range(N)]

    while True:
        next_i = A[i]

        if reached[next_i]:
            break

        reached[next_i] = True

        i_list.append(next_i)
        i = next_i

    m = i_list.index(next_i)

    if m >= K:
        return i_list[K] + 1

    le = len(i_list) - m
    K -= m
    ind = K % le

    return i_list[m + ind] + 1


def run():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    A = [a - 1 for a in A]

    ans = solver(N, K, A)
    print(ans)


run()


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

using namespace std;

int main()
{
	string s;
	int x = 0, max = 0, count = 0;
	cin >> x >> s;

	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'I') {
			count++;
		}
		else if (s[i] == 'D') {
			count--;
		}
		if (count > max) {
			max = count;
		}
	}
	cout << max;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n,m;
    cin>>n>>m;
    vector< vector<int> > v(n+1);
    rep(i,0,m){
        int x;
        cin>>x;
        rep(j,0,x){
            int y;
            cin>>y;
            v[y].pb(i);
        }
    }
    vector<int> p(m);
    rep(i,0,p.size()){
        cin>>p[i];
    }
    int l = 0;
    int r = (1<<n)-1;
    int ans = 0;
    rep(i,l,r+1){
        vector<int> cnt(m,0);
        rep(j,0,n){
            if ( (1<<j) & i ){
                rep(k,0,v[j+1].size()){
                    cnt[v[j+1][k]]++;
                }
            }
        }
        bool ok = true;
        rep(j,0,m){
            if ( p[j] != (cnt[j])%2 ){
                ok = false;
                break;
            }
        }
        if(ok){
            ans++;
        }
    }
    cout<<ans<<endl;

}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
ll a[312345];

int main(){
    std::ios::sync_with_stdio(false);
	int n;
	ll sumi=0,tak=0,lef,mini=inf;
	mini*=inf;
	int i;
	cin>>n;
	rep(i,n){
		cin>>a[i];
		sumi+=a[i];
	}     
	rep(i,n-1){
		tak+=a[i];
		lef=sumi-tak;
		mini=min(mini,abs(lef-tak));
	}
	cout<<mini<<endl;
    
}



Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll c[2005][2005];
void solve(){
	ll n,k;
	cin>>n>>k;
	ll y=n-k;
	for(int i=0;i<=n;i++)c[i][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++)c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	}
	for(int i=1;i<=k;i++){
      	if(n==k&&i==1)cout<<1<<"\n";
      	else if(n==k)cout<<0<<"\n";
      	else{
            ll a=(2ll*c[n-k-1][i-1]+((i>1)?c[n-k-1][i-2]:0))%mod;
            if(n-k>=i+1)mad(a,c[n-k-1][i]);
            ll b=c[k-1][i-1];
            //cout<<a<<" "<<b<<" ";
            cout<<(a*b)%mod<<"\n";
        }
	}
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 30208
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Cryptography;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        checked {
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
        }
#endif
    }

    static object process(TextReader input) {
        var n = long.Parse(input.ReadLine());

        long sum = 0;

        for(long j=1; j<=Math.Sqrt(n); j++) {
            var i = n/j;
            if(i==1) break;
            if(n % i == 0) {
                var m = i-1;
                if(n / m == n % m) sum+=m;
            }
        }

        return sum;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}

Measured memory_bytes: 13140
use std::io;
use std::str::FromStr;
use std::collections::HashSet;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_char_vec() -> Vec<char> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.chars().collect()
}

fn main() {
    let n: usize = input();
    let s = input_char_vec();
    let mut r: HashSet<usize> = HashSet::new();
    let mut g: HashSet<usize> = HashSet::new();
    let mut b: HashSet<usize> = HashSet::new();

    for i in 0..n {
        if s[i] == 'R' {
            r.insert(i);
        } else if s[i] == 'G' {
            g.insert(i);
        } else {
            b.insert(i);
        }
    }

    let mut count = 0;
    for i in 0..n {
        for j in (i+1)..n {
            let k = 2 * j - i;
            if k >= n || k <= j {
                continue;
            }
            if s[i] != s[j] && s[j] != s[k] && s[k] != s[i] {
                // println!("{}, {}, {}", i, j, k);
                count += 1;
            }
        }
    }
    // println!("{}, {}, {}, {}", r.len(), g.len(), b.len(), count);
    println!("{}", r.len() * g.len() * b.len() - count);
}


Measured memory_bytes: 2216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    cin >> n;
    vector<int> a(n), l(n), r(n), m(n);
    rep(i,n) cin >> a[i];
    
    l[0] = a[0];
    for(int i = 1; i < n; i++){
        l[i] = gcd(l[i-1], a[i]);
    }
    r[n-1] = a[n-1];
    for(int i = n-2; i >= 0; i--){
        r[i] = gcd(r[i+1], a[i]);
    }

    m[0] = r[1];
    m[n-1] = l[n-2];
    for(int i = 1; i < n-1; i++){
        m[i] = gcd(l[i-1], r[i+1]);
    }
    int ans = 0;
    rep(i,n) ans = max(ans, m[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4844
N, Y = map(int, input().split())

for i in range(min(N, Y//10000),-1,-1):
	for j in range(N-i+1):
		if 10000*i+5000*j+1000*(N-i-j) == Y:
			print(i, j, N-i-j)
			exit()
else:
	print('-1 -1 -1')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>=0;(i)--)
typedef long long lint;

int main(){
 lint A,B,X;
 cin>>A>>B>>X;
 if(A<=X&&(A+B)>=X)cout<<"YES";
 else cout<<"NO";
 }



  


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int a,b,n,m,k,tag;
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<=n;i++)
	{
		a=i;
		b=n-i;
		if(b==a&&k!=a*m)
			continue;
		if(k==a*m&&b==a)
			return 0*puts("Yes");
		if((k-a*m)%(b-a)==0&&0<=(k-a*m)/(b-a)&&m>=(k-a*m)/(b-a))
			return 0*puts("Yes");
	}
	puts("No");
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  private static long pow5(long v) {
    return v * v * v * v * v;
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    long x = sc.nextInt();
    Map<Long, Integer> p5 = new HashMap<>();
    p5.put(0L, 0);
    int lastInt = 0;
    long lastPow = 0L;
    while (true) {
      long pow = pow5((long) lastInt + 1L);
      p5.put(pow, lastInt + 1);
      if (pow - lastPow >= 1000000000L) break;
      lastPow = pow;
      lastInt++;
    }
    for (int i = 0; i <= lastInt; i++) {
      long pow = pow5((long) i);
      if (p5.containsKey(x - pow)) {
        System.out.println(i + " " + (-1 * p5.get(x - pow)));
        return;
      }
    }
    for (int i = 0; i <= lastInt; i++) {
      long pow = pow5((long) i);
      if (p5.containsKey(x + pow)) {
        System.out.println(p5.get(x + pow) + " " + i);
        return;
      }
    }
  }
}

Measured memory_bytes: 25420
from sys import stdin
readline = stdin.readline

def main():
    x1, y1, x2, y2 = map(int, readline().split())
    p1, p2 = x1 + y1 * 1j, x2 + y2 * 1j
    q = int(readline())
    for i in range(q):
        xi, yi = map(int, readline().split())
        pi = xi + yi * 1j
        cross = p1 + (p2 - p1) * projecter(p2 - p1, pi - p1)
        cross = cross * 2 - pi
        print('{:.10f} {:.10f}'.format(cross.real, cross.imag))


def projecter(a, b):
    return dot(a, b) / dot(a, a)


def dot(a, b):
    return a.real * b.real + a.imag * b.imag
main()

Measured memory_bytes: 6760
#include <stdio.h>
  
int main(){
 int n,primes=0;
 scanf("%d", &n);
 for(int i=0;i<n;i++){
  int num;
  scanf("%d", &num);
  int w=2;
  for(;w*w<=num;w++){
   if(!(num%w)){
    primes--;
    break;
   }
  }
  primes++;
 }
 printf("%d\n",primes);
 return 0;
}

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

typedef long long ll;

int t = 1;

void solve() {
	int a, c = 1;
	while (cin >> a) {
		if (a == 0) {
			cout << c << endl;
			return;
		}
		c++;
	}
}

int main() 
{ 
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen("data.in", "r", stdin);
	
	//cin >> t;
	while (t--) solve();
	
    return 0; 
}

























Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

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

	int n, k;
	cin >> n >> k;
	int a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int l = 1, r = 1000000000, res;
	while(l <= r) {
		int mid = (l + r) / 2;
		int cnt = 0;
		for(int i = 0; i < n; i++) {
			if(a[i] % mid == 0) {
				cnt += (a[i] / mid) - 1;
			}
			else {
				cnt += (a[i] / mid);
			}
		}
		if(cnt <= k) {
			res = mid;
			r = mid - 1;
		}
		else {
			l = mid + 1;
		}
	}
	cout << res;

	return 0;
}

Measured memory_bytes: 5164
// clang-format off
	#include <bits/stdc++.h>
	using namespace std; using ll = long long; using uint = unsigned int;
	#define SFINAE(x, ...)	template <class, class = void> struct x : false_type {}; template <class T> struct x<T, void_t<__VA_ARGS__>> : true_type {};
	SFINAE(DefaultIO, decltype(cout << declval<T &>()))
	SFINAE(IsTuple, typename tuple_size<T>::type)
	SFINAE(Iterable, decltype(begin(declval<T>())))
	template <class T> constexpr char Space(const T &) { return (Iterable<T>::value or IsTuple<T>::value) ? '\n' : ' '; }
	template <auto &os> struct Writer {
		template <class T> void Impl(T const &t) const {
			if constexpr (DefaultIO<T>::value) os << t;
			else if constexpr (Iterable<T>::value) { int i = 0; for (auto &&x : t) ((i++) ? (os << Space(x), Impl(x)) : Impl(x)); }
			else if constexpr (IsTuple<T>::value) apply([this](auto const &... args) { int i = 0; (((i++) ? (os << ' ', Impl(args)) : Impl(args)), ...);}, t);
			else static_assert(IsTuple<T>::value, "No matching type for print");
		}
		template <class F, class... Ts> auto &operator()(F const &f, Ts const &... ts) const { return Impl(f), ((os << ' ', Impl(ts)), ...), os << '\n', *this; }
	};
	template <auto &is> struct Reader {
		template <class T> auto& operator()(T &t) const {
			if constexpr (DefaultIO<T>::value) is >> t;
			else if constexpr (Iterable<T>::value) for (auto &x : t) (*this)(x);
			else if constexpr (IsTuple<T>::value) apply([this](auto &... args) { ((*this)(args), ...); }, t);
			else static_assert(IsTuple<T>::value, "No matching type for read");
			return *this;
		}
	};
	#ifdef NARUT_LOCAL
	#define Debug(...) cerr << "\033[0;31m", Writer<cerr>{}(__VA_ARGS__), cerr << "\033[0m\n"
	#else
	#define Debug(...) 0
	#endif
	[[maybe_unused]] constexpr Reader<cin> Cin; [[maybe_unused]] constexpr Writer<cout> Cout;
	#define FOR(i, j, n) for (int i = int(j); i < int(n); ++i)
	#define ROF(i, j, n) for (int i = int(n) - 1; i >= int(j); --i)
// clang-format on





auto Main() {
	char c;
	cin>>c;
	if(c >= 'a' and c <= 'z') return 'a';
	return 'A';
	
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
#ifdef NARUT_LOCAL
	assert(freopen("io/test.in", "r", stdin));
	cin.exceptions(cin.badbit | cin.failbit);
	cerr << fixed << setprecision(10);
#endif

	cout<<Main();
}


Measured memory_bytes: 3636
from math import ceil
def combination(n,r,mod=10**9+7):
    if r > n:
        return 0

    n1 = n+1
    r = min(r,n-r)
    numer = denom = 1
    for i in range(1,r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom,mod-2,mod) % mod

N,K = map(int,input().split())

m = int(ceil(N/2))
mod = int(1e9+7)
for i in range(1,K+1):
    """
    if i > m:
        print(0)
        continue
    """

    print(combination(K-1,i-1)*combination(N-K+1,i)%mod)

Measured memory_bytes: 3316