akhauriyash/Code-Regression huggingface dataset:
# pragma GCC optimize("O3")
# include <bits/stdc++.h>
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define all(s) s.begin(),s.end()
# define sz(x) (int)((x).size())
//# define int ll
using namespace std;

int n,a[105];
int ans;

int32_t main(){_
    //freopen("input","r",stdin);
	cin >> n;
	for(int i = 1;i <= n;i++) cin >> a[i];
	int i = 1;
	while(i <= n)
	{
		int j = i;
		while(j <= n && a[j] == a[i]) j++;
		j--;
		ans += (j - i + 1) / 2;
		j++;
		i = j;
	}
	rc(ans);
}

Measured memory_bytes: 256
// Problem : B - Between a and b ...
// Contest : AtCoder - AtCoder Beginner Contest 048
// URL : https://atcoder.jp/contests/abc048/tasks/abc048_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	// && has higher precedence than ||
	ios_base::sync_with_stdio(0); cin.tie(0);    
	ll a,b,x;
	cin>>a>>b>>x;
	ll ans=b/x-a/x+(a%x==0?1:0);
	cout<<ans<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3544
from math import ceil
f=0
    # n=int(input())
    # a=list(map(int,input().split()))
    # c,d=map(int,input().split())
    
a,b,c,d=map(int,input().split())
x=ceil(c/b)
y=ceil(a/d)
if(x<=y):
    f=1


print("Yes" if f==1 else "No")

Measured memory_bytes: 9176
a, b, c, x, y = map(int, input().split())

result = 0
if (a + b) > c * 2:
    m = min(x, y)
    result += (m * c * 2)
    if (a if x > y else b) > c * 2:
        result += (max(x, y) - m) * c * 2
    else:
        result += ((x - m) * a if x > y else (y - m) * b)
else:
    result += a * x + b * y

print(result)


Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	long a, b, lcm, gcd;
	String[] input;
	while (scan.hasNext()){
	    input = scan.nextLine().split(" ");
	    a = Integer.parseInt(input[0]);
	    b = Integer.parseInt(input[1]);
	    gcd = solveGCD(a, b);
	    lcm = a * b / gcd;
	    System.out.println(gcd + " " + lcm);
	}
    }
    static long solveGCD (long a, long b) {
	long gcd = a % b;
	if (gcd == 0) {
	    return b;
	}
	return solveGCD(b, gcd);
    }
}

Measured memory_bytes: 25936
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 = sc.nextInt();
		int[] x = new int[n];
		for(int i = 0 ; i < n ; i++) x[i] = sc.nextInt();
		long[][][] dp = new long[51][51][2501];
		dp[0][0][0] = 1;
		for(int i = 0 ; i <= n ; i++) {
			for(int j = 0 ; j <= n ; j++) {
				for(int k = 0 ; k <= 2500 ; k++) {
					if(i >= 1) dp[i][j][k] = dp[i - 1][j][k];
					if(i >= 1 && j >= 1 && k - x[i - 1] >= 0) dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]];
				}
			}
		}
		long ans = 0;
		for(int i = 1 ; i <= n ; i++) ans += dp[n][i][i * a];
		System.out.println(ans);
	}
}


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

int main(){
	int ringCount = 0;
	int findCount = 0;
	char targetStr[11];
	char tempRing[11];
	int targetStringLength;
	int tempStringLength;
	bool isSame = true;
	cin >> targetStr >> ringCount;
	targetStringLength = strlen(targetStr);
	for(int i=0;i<ringCount;i++){
		cin >> tempRing;
		tempStringLength = strlen(tempRing);
		isSame = true;
		for(int j=0;j<tempStringLength;j++){
		isSame = true;
			for(int k=0;k<targetStringLength;k++){
				if(targetStr[k] != tempRing[(j+k)%tempStringLength]){
					isSame = false;
					break;
				}
			}
			if(isSame){
				findCount++;
				break;
			}
		}
	}
	cout << findCount << '\n';
	return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>

int main(void){
   int n, m, l;           // input; 1<=n,m,l<=100
   int A[100][100]={0};   // input; A matrix, 0<=A[i][j]<=10000
   int B[100][100]={0};   // input; B matrix, 0<=B[i][j]<=10000
   int i, j, k;           // loop index;
   long int ans;

   scanf("%d %d %d", &n, &m, &l);

   for(i=0;i<n;i++){
	   for(j=0;j<m;j++){
		   scanf("%d", &A[i][j]);
	   }
   }
   for(j=0;j<m;j++){
	   for(k=0;k<l;k++){
		   scanf("%d", &B[j][k]);
	   }
   }

   for(i=0;i<n;i++){
	   for(k=0;k<l;k++){
		   ans = 0;
		   for(j=0;j<m;j++){
			   ans += A[i][j]*B[j][k];
		   }
		   printf("%ld", ans);
		   if(k==l-1) printf("\n");
		   else printf(" ");
	   }
   }

   return 0;
}

Measured memory_bytes: 692
import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

N,X,T = mips()
done = N
time = 0
while done > 0:
    time += T
    done -= X
print(time)

Measured memory_bytes: 9132
N = int(input())
A = list(map(int, input().split()))

minus_cnt = 0
for a in A:
    if a < 0:
        minus_cnt += 1

abs_A = list(map(abs, A))
sum_ = sum(abs_A)

if minus_cnt % 2 == 0:
    ans = sum_
else:
    ans = sum_ - 2*min(abs_A)

print(ans)


Measured memory_bytes: 20000
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,p=0,a=0;cin>>n;
  vector<int>s(n),c(1);for(int i=0;i<n;i++)cin>>s.at(i);c.at(0)=1;
  for(int i=1;i<n;i++){
    if(s.at(i)==s.at(i-1))c.at(p)++;
    else{c.push_back(1);p++;}
  }
  for(int i=0;i<=p;i++)a+=c.at(i)/2;
  cout<<a<<endl;
}

  


Measured memory_bytes: 256
def main():
	N, M = map(int,input().split())
	ans = 0
	if N == 1 and M == 1:
		ans = 1
	elif N == 1 or M == 1:
		ans = max(N, M) - 2
	elif N == 2 or M == 2:
		ans = 0
	else:
		ans = (N-2)*(M-2)
	print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	a := scanInts(n)
	b := append([]int{}, a...)
	sort.Ints(b)

	for i := 0; i < n; i++ {
		if a[i] == b[len(b)-1] {
			fmt.Println(b[len(b)-2])
		} else {
			fmt.Println(b[len(b)-1])
		}
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}


Measured memory_bytes: 6912
#include <stdio.h>

#define N 10000
#define Nil -1

typedef struct{
  int p,l,r;
    }Node;

Node T[N];
int n,D[N],H[N];

void setDepth(int, int);
int setHeight(int);
int getSibling(int);
void print(int);

int main(){
  int i,v,l,r,root=0;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    T[i].p = Nil;

  for(i=0;i<n;i++){
    scanf("%d%d%d",&v,&l,&r);

    T[v].l = l;
    T[v].r = r;

    if(l!=Nil) T[l].p = v;
    if(r!=Nil) T[r].p = v;
  }

  for(i=0;i<n;i++)
    if(T[i].p == Nil) root = i;

  setDepth(root,0);
  setHeight(root);

  for(i=0;i<n;i++)
    print(i);

  return 0;
}

void setDepth(int u, int d){

  if(u==Nil) return;

  D[u] = d;

  setDepth(T[u].l, d+1);
  setDepth(T[u].r, d+1);

}

int setHeight(int u){
  int h1,h2;

  h1 = h2 = 0;

  if(T[u].l != Nil) h1 = setHeight(T[u].l) + 1;
  if(T[u].r != Nil) h2 = setHeight(T[u].r) + 1;

  return H[u] = (h1 > h2 ? h1 : h2); 
}

int getSibling(int u){

  if(T[u].p ==Nil) return Nil;

  if(T[T[u].p].l != u && T[T[u].p].l != Nil)
    return T[T[u].p].l;  
  if(T[T[u].p].r != u && T[T[u].p].r != Nil)
    return T[T[u].p].r;

  return Nil;
}

void print(int u){
  int deg;
 
  printf("node %d: parent = %d, sibling = %d, ",u,T[u].p,getSibling(u));
 
  deg = 0;
 
  if(T[u].l != Nil)deg++;
  if(T[u].r != Nil)deg++;
 
  printf("degree = %d, depth = %d, height = %d, ",deg,D[u],H[u]);
 
  if(T[u].p == Nil)printf("root\n");
  else if(T[u].l == Nil && T[u].r == Nil)printf("leaf\n");
  else printf("internal node\n");
}

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

#pragma GCC optimize("02")
#pragma GCC target("tune=native")

using namespace std;

#define ll long long int
#define lu unsigned long long int
#define fi first
#define se second
#define edge pair<long long int,long long int>
#define weighted_edge pair<long long int,pair<long long int,long long int>>

ll dp[(int)1e5 + 1];
ll values[100];
ll weight[100];

ll min(ll a, ll b) {

	return a < b ? a : b;
}

ll knapsack(ll n, ll w) {

	dp[0] = 0;
	
	ll limit = 0;

	for(int i = 0; i < n; i++) limit += values[i];
	for(int i = 1; i <= limit; i++) dp[i] = 10000000000;

	for(int i = 0; i < n; i++) {
		for(int j = limit; j >= values[i]; j--) {
			dp[j] = min(dp[j], dp[j-values[i]] + weight[i]);

		}
	}

	for(int i = limit; i >= 0; i--) {
		if(dp[i] <= w) return i;
	}
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n,w; cin >> n >> w;
	
	for(int i = 0; i < n; i++) {
		cin >> weight[i] >> values[i];
	}

	cout << knapsack(n,w) << '\n';

	return 0;
}

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

ll gcd(ll a, ll b) {
  if (a<b) swap(a,b);
  while(1) {
    if (b == 0) return a;
    int t = a;
    a = b;
    b = t%b;
  }
}

ll ct(ll a, ll b, ll c) {
  return b/c-a/c;
}

int main() {
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  A--;
  ll L = C * D / gcd(C,D);
  cout << B-A - ct(A,B,C) - ct(A,B,D) + ct(A,B,L) << endl;
}

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

int main() {
	ll h, w;
	cin >> h >> w;
	ll ans = 0;
	vector<vector<ll>> c(10, vector<ll>(10));
	for (ll i = 0; i < 10; ++i) {
		for (ll j = 0; j < 10; ++j) {
			cin >> c[i][j];
		}
	}
	for (ll k = 0; k < 10; ++k) {
		for (ll i = 0; i < 10; ++i) {
			for (ll j = 0; j < 10; ++j) {
				c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
			}
		}
	}
	for (ll i = 0; i < h * w; ++i) {
		int a;
		cin >> a;
		if (a != -1)ans += c[a][1];
	}
	cout << ans << endl;
}

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

using namespace std;

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

    vector<int> p(101);
    int a;
    for(int i=0; i<101; i++){
        p[i] = 0;
    }
    for(int i=0; i<n;i++){
        cin >> a;
        p[a] = 1;
    }

    int s = x;
    int t = x;
    while(1){
        if(p[t] == 0){
            cout << t << endl;
            return 0;
        }
        else if(p[s] == 0){
            cout << s << endl;
            return 0;
        }
        s++;
        t--;
    }
    //sort(p.begin(),p.end());
    //int min =1000;
   // int result;
    /*
    //for(int j=0; j<n; j++){
        for(int i=1; i<=100; i++){
            if(p[j] == i){
                break;
            }
            else if(i==x){
                break;
            }
            //else{
                int dif = abs(i-x);
                //for(int k=j+1; k<n; k++){
                    //if(p[k] == i){
                        if(min > dif){
                            min = dif;
                            result = i;
                    //    }
            //    }
            
        
        //}
    }
    }*/
    //}
   //cout << result << endl;
    //return 0;
}

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

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}

void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > g(n + 1);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; ++i) {
    cout << g[i].size() << endl;
  }
}

int main() {
  solve();
  return 0;
}


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define sz(c) (static_cast<int>(c.size()))
#define endl "\n"

using ld = long double;
using ll = long long;

inline ll addm(ll __a, ll __b, ll __m);
inline ll subm(ll __a, ll __b, ll __m);
inline ll mulm(ll __a, ll __b, ll __m);
ll powm(ll __a, ll __b, ll __m);
ll inv(ll __x, ll __m);
// }}}

const ll INFL = numeric_limits<ll>::max() / 2;
const ll INF = numeric_limits<int>::max() / 2;
const ll MOD = 1e9+7;

const int N = 1050;

int a[N][N];
ll d[N][N];
void solve()
{
    int h, w; cin >> h >> w;
    for (int i = 0; i < h; i++) {
        string s; cin >> s;
        for (int j = 0; j < w; j++) {
            a[i][j] = (s[j] == '#');
        }
    }
    d[0][0] = 1;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j]) continue;
            if (i) d[i][j] += d[i-1][j];
            if (j) d[i][j] += d[i][j-1];
            d[i][j] %= MOD;
        }
    }
    cout << d[h-1][w-1] << endl;
}

// main {{{
int main()
{
    cin.sync_with_stdio(0); cin.tie(NULL);
    solve();
    return 0;
}

inline ll addm(ll __a, ll __b, ll __m = MOD) {
    return ((__a+__b)%__m);
}
inline ll subm(ll __a, ll __b, ll __m = MOD) {
    return (((__a-__b)%__m+__m)%__m);
}
inline ll mulm(ll __a, ll __b, ll __m = MOD) {
    return ((__a*__b)%__m);
}
ll powm(ll __a, ll __b, ll __m = MOD) {
    ll ret = (!__b) ? 1 : powm(__a, __b/2, __m);
    return (!__b) ? 1 : mulm(mulm(ret, ret, __m), (__b%2) ? __a : 1, __m);
}
ll inv(ll __x, ll __m = MOD) {
    return powm(__x, __m-2, __m);
}
// }}}


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

import numpy as np

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

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

N = int(sys.stdin.readline())
a = 0
for i in range(1, N +1):
    if i & 1:
        a += 1

print(a / N)


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

int main() {
	int H, N;
	int i;
	cin>>H>>N;
	vector<int> A(N);
 for (i = 0; i < N; ++i) {
	cin>>A[i];
}
 for ( i= 0;  i< N;i++) {
	 H-=A[i];
}
	if(H<=0){
		cout<<"Yes"<<endl;
		}
	else{	cout<<"No"<<endl;
	}





	return 0;
}


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll x, ans; cin >> x;
    if(x <= 599) ans = 8;
    else if(x <= 799) ans = 7;
    else if(x <= 999) ans = 6;
    else if(x <= 1199) ans = 5;
    else if(x <= 1399) ans = 4;
    else if(x <= 1599) ans = 3;
    else if(x <= 1799) ans = 2;
    else if(x <= 1999) ans = 1;

    cout << ans << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3636
using System;
using System.Linq;

namespace question2
{
    class Program
    {
        static void Main(string[] args)
        {
            var p = new Program();
            p.Run();
        }

        void Run(){
            var n = int.Parse(Console.ReadLine());
            var p = Console.ReadLine().Split(' ').Select(c=>int.Parse(c)).ToArray();

            var count = 0;
            for(int i=1;i<p.Length-1;i++){
                if( (p[i-1] > p[i] && p[i+1] < p[i]) || (p[i-1] < p[i] && p[i+1] > p[i])){
                    count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13396
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << std::setprecision(10) << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<std::pair<int,int> > p;
	rep(i,n) {
		int a,b;
		std::cin >> a >> b;
		p.emplace_back(a,b);
	}
	long double min = 1000000;
	for(int i=0;i<n;i++) {
		for(int j=i+1;j<n;j++) {
			auto a=p[i]; auto b=p[j];
			long double b1,b2,c1,c2,ax,ay,bx,by,cx,cy;
			ax=a.first;ay=a.second;
			bx=b.first;by=b.second;
			long double x,y,bb,cc;
			x=bx;y=by;
			long double rad = std::sqrt((ax-x)*(ax-x)+(ay-y)*(ay-y))/(long double)2;
			for(int ch=0;ch<n;ch++) {
				if(ch==i||ch==j) continue;
				long double dx,dy;
				dx=p[ch].first; dy=p[ch].second;
				if((dx-ax)*(x-dx)+(dy-ay)*(y-dy)<(long double)0) goto next1;
			}
			min = std::min(min,rad);
next1:;
		}
	}
	for(int i=0;i<n;i++) {
		for(int j=i+1;j<n;j++) {
			for(int k=j+1;k<n;k++) {
				auto a=p[i]; auto b=p[j]; auto c=p[k];
				long double b1,b2,c1,c2,ax,ay,bx,by,cx,cy;
				ax=a.first;ay=a.second;
				bx=b.first;by=b.second;
				cx=c.first;cy=c.second;
				b1=bx-ax;b2=by-ay;
				c1=cx-ax;c2=cy-ay;
				long double x,y,bb,cc;
				bb=b1*bx+b2*by;
				cc=c1*cx+c2*cy;
				x=(c2*bb-b2*cc)/(b1*c2-b2*c1);
				y=(c1*bb-b1*cc)/(b2*c1-b1*c2);
				long double rad = std::sqrt((ax-x)*(ax-x)+(ay-y)*(ay-y))/(long double)2;
				for(int ch=0;ch<n;ch++) {
					if(ch==i||ch==j||ch==k) continue;
					long double dx,dy;
					dx=p[ch].first; dy=p[ch].second;
					if((dx-ax)*(x-dx)+(dy-ay)*(y-dy)<(long double)0) goto next;
				}
				min = std::min(min,rad);
next:;
			}
		}
	}
	print(min);
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = map(int, input().split())
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]

    for w in range(N - M + 1):
        for h in range(N - M + 1):
            count = 0
            for i in range(M):
                if B[i] == A[i + h][w: w + M]:
                    count += 1
            if count == M:
                print('Yes')
                exit()
    print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 80340
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const double PI = 3.14159265358979323846;

int main(void) {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int cnt = 0;
  rep(i, n) {
    if (s[i] != t[i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3920
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <random>
#include <tuple>
#include <iomanip>
#include <cstring>

using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1e9 + 7;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

//最大公約数
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

ll dp[4010][4010];

int main(void){
  COMinit();
  ll N;
  cin >> N;
  vector<ll> A(N), B(N);
  rep(i, N) cin >> A[i] >> B[i];

  rep(i, N){
    dp[2000-A[i]][2000-B[i]]++;
  }
  rep(i, 4005)rep(j, 4005){
    dp[i+1][j] += dp[i][j];
    dp[i][j+1] += dp[i][j];
    dp[i+1][j] %= MOD;
    dp[i][j+1] %= MOD;
  }
  ll ans = 0;
  rep(i, N){
    ans += dp[2000+A[i]][2000+B[i]];
    ans %= MOD;
  }
  rep(i, N){
    ans -= comb(2*A[i]+2*B[i], 2*A[i]);
    ans %= MOD;
  }
  ans += MOD;
  ans %= MOD;
  ans *= inverse(2);
  ans %= MOD;
  cout << ans << endl;
}


Measured memory_bytes: 133632
import math
a,b,h,m = map(int,input().split())
hdeg = 30*h+m*0.5
mdeg = 6*m
if hdeg >=mdeg:
    deg = hdeg-mdeg
else:
    deg = mdeg-hdeg
bb = b*math.sin(math.radians(deg))
aa = a-b*math.cos(math.radians(deg))
print(math.sqrt((aa**2)+(bb**2)))

Measured memory_bytes: 9512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

ll power(ll x, ll n)
{
    ll result = 1;
    while (n)
    {
        if (n % 2 == 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}

ll gcd(ll a, ll b)
{
    if (!b)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/

int main()
{
    start();
    string s;
    cin>>s;
    string k=s;
    int n=s.length();
    int a=0;
    if (s[0]!='1')
    {
        s[0]='1';
        a=1;
    }
    for (int i=1;i<n;i++)
    {
        if (s[i-1]==s[i])
        {
            if (s[i]=='0')
            {
                s[i]='1';
            }
            else
            {
                s[i]='0';
            }
            a++;
        }
    }
    s=k;
    int b=0;
    if (s[0]!='0')
    {
        s[0]='0';
        b=1;
    }

    for (int i=1;i<n;i++)
    {
        if (s[i-1]==s[i])
        {
            if (s[i]=='0')
            {
                s[i]='1';
            }
            else
            {
                s[i]='0';
            }
            b++;
        }
    }

    cout<<min(a, b);

    return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <algorithm>
#include <vector>

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

using namespace std;

int main(void)
{
	int n, m;
	long long ans=0;
	cin >> n >> m;
	vector<int> x(m), l;
	rep(i, m){
		cin >> x[i];
	}
	if (n < m){
		sort(x.begin(), x.end());
		rep(i, m-1){
			l.push_back(x[i+1]-x[i]);
		}
		sort(l.rbegin(), l.rend());
		rep(i, n-1){
			l.erase(l.begin());
		}

		rep(i, l.size()){
			ans += l[i];
		}
		cout << ans << endl;
	}else{
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 1276
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n-1):
 for j in range(n-i-1):
  if a[j]>a[j+1]:a[j:j+2]=a[j+1],a[j];c+=1
print(*a)
print(c)


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  int count = 1;
  rep2(i, 1, 4) {
    if(s[i-1] != s[i]) count++; 
  }
  cout << (count == 2 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
D,X = input().split()
D,X = [int(D),int(X)]
A = []
for i in range(N):
	tmp = int(input())
	A.append(tmp)

for i in range(N):
	k = 0
	while True:
		day = 1 + k*A[i]
		if day <= D:
			X += 1
			k += 1
		else:
			break
print(X)


Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;


int main(){
  int n;
  cin >> n;
  vector<int> t(n);
  rep(i, n) cin >> t[i];
  int m;
  cin >> m;
  vector<int> p(m), x(m);
  rep(i, m) cin >> p[i] >> x[i];

  vector<int> l(n+2), r(n+2);
  l[0] = 0; r[n+1] = 0;
  for (int i = 1; i <= n; i++) l[i] = l[i-1] + t[i-1];
  for (int i = n; i > 0; i--) r[i] = r[i+1] + t[i-1];

  rep(i, m){
    int ans = x[i] + l[p[i] - 1] + r[p[i] + 1];
    cout << ans << endl;
  }
}

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

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

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

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

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



int main() {
	lint A, B, C, D;
	cin >> A >> B >> C >> D;
	
	--A;
	lint CD = C * D / __gcd(C, D);
	
	lint a = (A / C) + (A / D) - (A / CD),  b = (B / C) + (B / D) - (B / CD);
	cout << (B - A) - (b - a) << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 256
def counting_sort(arr):
    max_num = max(arr)
    min_num = min(arr)
    count = [0] * (max_num - min_num + 1)
    for ele in arr:
        count[ele - min_num] += 1
    return [ele for ele, cnt in enumerate(count, start=min_num) for _ in range(cnt)]


n = input()
arr = list(map(int, input().split()))
print(*counting_sort(arr))



Measured memory_bytes: 224608
#include <bits/stdc++.h>
#define repeat(i, n) for(int (i) = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const double EPS = numeric_limits<double>::epsilon();

int main() {
	vector<string> week{"SUN","MON","TUE","WED","THU","FRI","SAT"};
	string S;
	cin >> S;
	auto itr = find(week.begin(), week.end(), S);
	int idx = distance(week.begin(), itr);
	cout << 7 - idx << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,n,ans=0;
cin>>n;
int a[n+1],a1[n+5]={0},a2[n+5]={0};
for(i=1;i<=n;i++){cin>>a[i],a1[i]=a1[i-1]+a[i];}
for(i=1;i<=n;i++)cin>>a[i];
for(i=n;i>=1;i--){
    a2[i]=a2[i+1]+a[i];}
for(i=1;i<=n;i++){ans=max(ans,a1[i]+a2[i]);
}
cout<<ans;
    return 0;
}


Measured memory_bytes: 3588
#include <sstream>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<ctime>
#include<cmath>
#include<map>
#include<unordered_map>
#include<stack>
#include<random>
#include<queue>
#include<list>
#include<math.h>
#include<bitset>
#include<fstream>
using namespace std;
#define ll long long int
#define ld long double
#define key pair<ld,ld>
#define ii pair<int,int>
#define si set<int>
#define vii vector<pair<int,int> >
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vvi vector<vector<int> >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define nu 100001
#define mul(x,y) ((ll)(x)*(y))%mod
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forn(i, n) for (int i = 0; i < int(n); i++)
const ll INF=9223372036854775807;
const ll mod=998244353;
int  MOD(int  a, int  b)
{
    if(a>b)
        return a-b;
    else
        return b-a;
}
ll  max3(ll  a,ll  b, ll  c)
{
    return max(c,max(a,b));
}
ll min3(ll  a,ll  b,ll  c)
{
    return min(a,min(b,c));
}
ll  power(ll  x,ll  y,ll mod1)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x)%mod1;
        y = y>>1;
        x = (x*x)%mod1;
    }
    return res;
}
ll logg(ll  a)
{
    ll  x=0;
    while(a>1)
    {
        x++;
        a/=2;
    }
    return x;
}
ll  gcd(ll  a,ll   b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll abso(ll x)
{
    if(x<0)
    {
        return -x;
    }
    return x;
}
ll ceiling (ll  a,ll  b)
{
    if(a%b==0)
    {
        return a/b;
    }
    else
    {
        return a/b+1;
    }
}
ll modinv(ll x,ll p)
{
    return power(x,p-2,p);
}
int main()
{
    fastio;
    int n;string s;
    cin>>s;n=s.size();
    int j=n-1;int i=0;int ans=0;
    while(i<j)
    {
        if(s[i]!=s[j])
        {
            ans++;
        }
        i++;
        j--;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N, M = gets.chomp.split(" ").map{|i| i.to_i};

a = []
while c = gets
  a << c.chomp.split(" ").map{|i| i.to_i};
end

n = a.slice(0, N)
m = a.slice(N, M)

def checkpoint(n, checkpoints)
  v = nil
  rtn = 0
  checkpoints.each_with_index do |c, i|

    r = (n[0] - c[0]).abs + (n[1] - c[1]).abs
    if v.nil?
      v = r
      rtn = i + 1
    end
    if r < v
      v = r
      rtn = i + 1
    end
  end
  return rtn
end

n.each do |_n|
  puts checkpoint(_n, m)
end


Measured memory_bytes: 1788
// CODE by Kazhybay Askar

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC    optimize("Ofast")
//#pragma GCC    target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define iter   set<int>::iterator
#define f      first
#define s      second
#define pb     push_back
#define pf     push_front
#define ppb    pop_back
#define ppf    pop_front
#define mp     make_pair
#define cont   continue
#define Speed  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz     size()
#define all(x) x.begin(),x.end()
#define cont   continue
#define r0     return 0
#define endl   '\n'

typedef long long ll;
typedef long double   ld;
typedef pair<ll,ll>   pll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;

const int MAXN  = 5e5  + 7;
const int MOD   = 1e9  + 7;
const int INF   = 1e9  + 7;
const ll  MINF  = 1e18 + 7;
const int EPS   = 1e-6;
const int dx[]  = {0, 0, 1, -1, -1, -1, 1, 1};
const int dy[]  = {1, -1, 0, 0, -1, 1, -1, 1};
const double pi = acos(-1.0);

void freopen(){
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}
pll a[MAXN];
ll n,m,cnt;


void solve(){
    cin>>m;
    cin>>n;
    for(int i=1;i<=m;i++){
        cin>>a[i].f>>a[i].s;
    }
    sort(a+1,a+1+m);
    for(int i=1;i<=m;i++){
        ll  mn=min(a[i].s,n);
        cnt+=mn*a[i].f;
        n-=mn;
        if(n==0){
            cout<<cnt;
            return;
        }
    }
}

int main(){
    Speed;
    ll T=1;
    //cin>>T;
    while(T--){
        solve();
    }
    r0;
}




Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; }
    public static void Main()
    {
        //input
        int N = NextInt();
        int K = NextInt();
        int[] h = LineInt();
        int[] dp = new int[N];
        for (int i = 1; i < N; i++) dp[i] = INF;
        for (int i = 1; i < N; i++)
        {
            for (int j = 1; (i - j) >= 0 && j <= K; j++)
            {
                dp[i] = Math.Min(dp[i], dp[i - j] + Math.Abs(h[i] - h[i - j]));
            }
        }
        Console.WriteLine(dp[N - 1]);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


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

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

}

Measured memory_bytes: 256
//
// Created by 李青坪 on 2018/10/8.
//

#include "cstdio"

using namespace std;

#define INFINITY 2000000000;

int a[500000];
int cnt = 0;

void merge(int a[], int low, int mid, int high){
    int l1 = mid - low;
    int l2 = high - mid;
    int s1[l1+1];
    int s2[l2+1];
    for (int i = 0; i < l1; ++i) {
        s1[i] = a[i+low];
    }
    for (int j =0; j < l2; ++j) {
        s2[j] = a[j+mid];
    }
    s1[l1] = s2[l2] = INFINITY;
    int i=0, j=0;
    for (int k = low; k < high; ++k) {
        ++cnt;
        if (s2[j] >= s1[i]) {
            a[k] = s1[i];
            ++i;
        }
        else{
            a[k] = s2[j];
            ++j;
        }
    }
}

void mergeSort(int a[], int low, int high){
    if (low+1 < high){
        int mid = (low + high)/2;
        mergeSort(a, low, mid);
        mergeSort(a, mid, high);
        merge(a, low, mid, high);
    }
}

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    mergeSort(a, 0, n);
    printf("%d", a[0]);
    for (int j = 1; j < n; ++j) {
        printf(" %d", a[j]);
    }
    printf("\n%d\n", cnt);
}
/*
10
8 5 9 2 6 3 7 1 10 4
 */


Measured memory_bytes: 6584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ll n, k; cin >> n >> k;
    ll ans = 0;
    eFOR(i, k + 1, n) {
        ans += n / i * (i - k);
        ans += max(n % i - k + 1, 0LL);
    }
    if (k == 0)ans -= n;
    cout << ans << "\n";
}

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

int main() {
	int A,B,C,i,j=0;
	scanf("%d%d%d",&A,&B,&C);
	if((A==5)&&(B==5)&&(C==7)){
		printf("YES");
	}
	else if((A==5)&&(B==7)&&(C==5)){
			printf("YES");
		}
	else if((A==7)&&(B==5)&&(C==5)){
			printf("YES");
		}
	else{
		printf("NO");
	}
}


Measured memory_bytes: 128
import scala.io.StdIn._
import scala.math.max

object Main extends App {
  val n = readInt()
  val s = (0 until n).map(_ => readLine())
  val m = readInt()
  val t = (0 until m).map(_ => readLine())

  val nmap = s.groupBy(e => e)
  val mmap = t.groupBy(e => e)

  println(max(0, nmap.map(e => e._2.length - mmap.get(e._1).map(a => a.length).getOrElse(0)).max))
}


Measured memory_bytes: 55032
N=int(input())

ans=[0]*N

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            n=x**2+y**2+z**2+x*y+y*z+z*x
            if n>N:
                continue
            ans[n-1]+=1
for i in ans:
    print(i)

Measured memory_bytes: 9296
#include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define numa(x,a) for(auto x: a)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define pf push_front
#define sec second
#define sz(x) ((int)(x).size())
#define ALL( c ) (c).begin(), (c).end()
#define gcd(a,b) __gcd(a,b)
#define mem(x,n) memset(x,n,sizeof(x))
#define endl "\n"
using namespace std;
template <int POS, class TUPLE> void deploy(std::ostream &os, const TUPLE &tuple){}
template <int POS, class TUPLE, class H, class ...Ts> void deploy(std::ostream &os, const TUPLE &t){ os << (POS == 0 ? "" : ", ") << get<POS>(t); deploy<POS + 1, TUPLE, Ts...>(os, t); }
template <class T,class U> std::ostream& operator<<(std::ostream &os, std::pair<T,U> &p){ os << "(" << p.first <<", " << p.second <<")";return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> &mp){ int remain = mp.size(); os << "{"; for(auto e: mp) os << "(" << e.first << " -> " << e.second << ")" << (--remain == 0 ? "}" : ", "); return os; }
#define DEBUG1(var0) { std::cerr << (#var0) << "=" << (var0) << endl; }
#define DEBUG2(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG1(var1); }
#define DEBUG3(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG2(var1,var2); }
#define DEBUG4(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG3(var1,var2,var3); }
using ll = long long;



int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int N;string S;
  cin >> N >> S;
  int x = 0;
  int ans = 0;
  numa(c,S){
    if (c == 'I') {
      x += 1;
    } else {
      x -= 1;
    }
    ans = max(ans, x);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0]*(n+1)
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    def check(self, x, y):
        return self.find(x) == self.find(y)

# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,M = map(int,input().split())
P = list(map(int,input().split()))
XY = [tuple(map(int,input().split())) for _ in range(M)]

# 交換可能な頂点でグルーピング
A = UnionFind(N)
for x,y in XY:
    A.unite(x,y)

# 頂点の数字(P[i]) と頂点番号(i+1) が同じグループなら, 操作を行うことで p_i == i とできる
ans = 0
for i in range(N):
    if A.check(P[i],i+1):
        ans += 1
 
print(ans)

Measured memory_bytes: 25188
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

int main() {
	long long int A, B, C, K, ans = 0;

	cin >> A >> B >> C >> K;


	if (K >= 0) {
		if(A >= K){
			ans = K;
		}
		else {
			ans = A;
		}
		K -= A;
	}

	if (K >= 0) {
		K -= B;
	}

	if (K >= 0) {
		if (C >= K) {
			ans -= K;
		}
		else {
			ans -= C;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3192
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){
    int point[4][2];
    for( int ni = 0 ; ni < 2 ; ni++ ){
        for( int ti = 0 ; ti < 2 ; ti++ ){
            cin >> point[ni][ti];
        }
    }
    int hen = 0;
    int x=0;
    int y=1;

    for( int id  = 2 ;id < 4 ; id++ ){
        point[id][x] = point[id-1][x] + (point[id-2][y] - point[id-1][y]);
        point[id][y] = point[id-1][y] + (point[id-1][x] - point[id-2][x]);
    }
    for( int ni = 2 ; ni < 4 ; ni++ ){
        for( int ti = 0 ; ti < 2 ; ti++ ){
            cout << point[ni][ti];
            cout << " ";
        }
    }
    



}

Measured memory_bytes: 256