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

void saiki(int r, int D, int x, int cnt) {
    if (cnt>10) return;
    int nx = r*x-D;
    cout << nx << "\n";
    saiki(r, D, nx, cnt+1);
}

int main() {
    int r, D, x;
    cin >> r >> D >> x;
    saiki(r, D, x, 1);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll d,n;
	cin>>d>>n;
	if(d==0){
		if(n==100){
			cout<<101;
		}
		else{
			cout<<n;
		}
	}
	else if(d==1){
		if(n==100){
			cout<<10100;
		}
		else{
			cout<<n*100;
		}
	}
	else{
		if(n==100){
			cout<<1010000;
		}
		else{
			n=n*1ll*10000;
			cout<<n;
		}
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i)
#define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i)
using ll = long long;
using namespace std;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    ll n;
    cin >> n;
    vector<ll> a(n), b(n), a_cnt(n + 1), b_cnt(n + 1);
    REP(i, 0, n)
    {
        cin >> a[i];
        a_cnt[a[i]]++;
    }
    REP(i, 0, n)
    {
        cin >> b[i];
        b_cnt[b[i]]++;
    }

    vector<int> idx(n + 1);
    iota(idx.begin(), idx.end(), 0);
    sort(idx.begin(), idx.end(), [&](int i, int j) { return a_cnt[i] > a_cnt[j]; });

    deque<pair<int, int>> dq;
    REP(i, 0, n + 1)
    {
        if (b_cnt[idx[i]] > 0)
            dq.emplace_back(idx[i], b_cnt[idx[i]]);
    }

    map<int, vector<int>> mp;
    REP(i, 0, n + 1)
    {
        if (a_cnt[idx[i]] == 0)
            break;
        int x = idx[i];
        if (!dq.empty() && dq.front().first == x)
        {
            dq.push_back(dq.front());
            dq.pop_front();
        }
        REP(_, 0, a_cnt[x])
        {
            if (dq.front().first == x)
            {
                cout << "No" << endl;
                return 0;
            }
            mp[x].emplace_back(dq.front().first);
            dq.front().second--;
            if (dq.front().second == 0)
                dq.pop_front();
        }
    }

    cout << "Yes\n";
    REP(i, 0, n)
    {
        cout << mp[a[i]].back() << " ";
        mp[a[i]].pop_back();
    }
    cout << endl;
}

Measured memory_bytes: 32240
/* 2A - MST (Prim's)
 * 1 ≤ |V| ≤ 10,000
 * 0 ≤ |E| ≤ 100,000
 * 0 ≤ wi ≤ 10,000
 * The graph is connected
 */

#include <algorithm>
#include <iostream>
#include <queue>
#include <tuple>
using namespace std;

struct edge {
  int to, wt, next;
} E[200000];

int LE[10000];

int main() {
  int n, m;
  cin >> n >> m;
  fill(LE, LE + 10000, -1);
  for (int i = 0, src, dst, cost; i < 2 * m; i += 2) {
    cin >> src >> dst >> cost;
    E[i] = {dst, cost, LE[src]};
    LE[src] = i;
    E[i + 1] = {src, cost, LE[dst]};
    LE[dst] = i + 1;
  }

  priority_queue<pair<int, int>> q;

  int tree_cost = 0;

  bool seen[n]{false};
  q.push({0, 0}); // start at node 0, chosen arbitrarily

  int cost, u;

  while (!q.empty()) {
    tie(cost, u) = q.top();
    q.pop();
    if (seen[u])
      continue;
    seen[u] = true;
    tree_cost += -cost;
    for (int i = LE[u]; i != -1; i = E[i].next) {
      if (!seen[E[i].to])
        q.push({-E[i].wt, E[i].to});
    }
  }
  cout << tree_cost << endl;
}


Measured memory_bytes: 6260
let () =
    let main () =
        let n, m = Scanf.scanf "%d %d" (fun n m -> n, m) in
        let penalty = Array.make n 0 in
        let ac = Array.make n false in
        for i = 1 to m do
            Scanf.scanf " %d %s" (fun p s ->
                let p = p - 1 in
                if s = "WA" then (if not ac.(p) then penalty.(p) <- penalty.(p) + 1) else ac.(p) <- true)
        done;
        let rec loop i cor pen =
            if i = n then cor, pen else
            let cor = if ac.(i) then cor + 1 else cor in
            let pen = if ac.(i) then (pen + penalty.(i)) else pen in
            loop (i + 1) cor pen
        in
        let cor, pen = loop 0 0 0 in
        Printf.printf "%d %d\n" cor pen
    in
    main ()

Measured memory_bytes: 6016
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int ans = 0;
    for (int i = 0; i < 4; i++) {
        if (s[i] == '+') {
            ans++;
        } else {
            ans--;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    cout << (in() - in()) % in() << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

int main(){

    int n;
    cin >> n;

    map<string, int> m;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        m[s] ++;
    }

    int maxi = -1;
    for(auto it = m.begin(); it != m.end(); it++){
        maxi = max( it->second, maxi );
    }

    vector<string> ans;
    for(auto it = m.begin(); it != m.end(); it++){
        if( it->second == maxi ) ans.push_back( it->first );
    }

    sort( all(ans) );

    for(int i = 0; i < ans.size(); i++){
        cout << ans[i] << endl;
    }





}

Measured memory_bytes: 26868
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

if c21-c11==c22-c12==c23-c13 and c31-c21==c32-c22==c33-c23 and c12-c11==c22-c21==c32-c31 and c13-c12==c23-c22==c33-c32:
    print("Yes")
else:
    print("No")

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

vi g[MAXN];

int used[MAXN];

vi pp[2];
int ind;

void go(int s){
	used[s] = 1;
	pp[ind].pb(s);
	REP(i, 0, SZ(g[s])){
		int to = g[s][i];
		if (!used[to]){
			go(to);
			return;
		}
	}
}

void solve(){
	int n, m, a, b;
	scanf("%d%d", &n, &m);
	REP(i, 0, m){
		scanf("%d%d", &a, &b);
		g[a].pb(b);
		g[b].pb(a);
	}
	go(1);
	ind = 1;
	used[1] = 0;
	go(1);
	printf("%d\n", SZ(pp[0]) + SZ(pp[1]) - 1);
	for(int i = SZ(pp[1]) - 1; i > 0; i--){
		printf("%d ", pp[1][i]);
	}
	REP(i, 0, SZ(pp[0])){
		printf("%d ", pp[0][i]);
	}
	putchar('\n');
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 9976
import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.sin
import kotlin.math.sqrt

fun main(args: Array<String>) {
    val (a, b, h, m) = readLine()!!.split(" ").map { it.toLong() }
    val rad1 = m.toDouble() / 60.0 * 2
    val bx = b * sin(rad1 * PI)
    val by = b * cos(rad1 * PI)
    var rad2 = (60 *h.toDouble() + m.toDouble()) / (12 * 60.0) * 2
    val ax = a * sin(rad2 * PI)
    val ay = a * cos(rad2 * PI)
    val ans = sqrt((ax - bx)*(ax - bx) + (ay - by)*(ay - by))
    println(ans)
}

Measured memory_bytes: 36628
#include<stdio.h>
#define MAX 100000

int n, A[MAX];

int partition(int p, int r){
  int j, t;
  int v = A[r];
  int i = p - 1;
  for (j=p; j<r; j++){
    if (A[j] <= v){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i+1];
  A[i+1] = A[r];
  A[r] = t;
  return i + 1;
}

int main(){
  int i, n, q;

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

  q = partition(0, n-1);

  for (i=0; i<n; i++){
    if (i) printf(" ");
    if (i == q) printf("[");
    printf("%d", A[i]);
    if (i == q) printf("]");
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 2128
fn main() {
    let (h, w, m): (usize, usize, usize) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    let mut v1: Vec<i32> = vec![0; h];
    let mut v2: Vec<i32> = vec![0; w];
    let mut bombs = Vec::with_capacity(m);
    for _ in 0..m {
        let (p, q): (usize, usize) = {
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            let mut iter = buf.split_whitespace();
            (
                iter.next().unwrap().parse::<usize>().unwrap() - 1,
                iter.next().unwrap().parse::<usize>().unwrap() - 1,
            )
        };

        v1[p] += 1;
        v2[q] += 1;
        bombs.push((p, q));
    }

    let max1 = *v1.iter().max().unwrap();
    let max2 = *v2.iter().max().unwrap();

    let count1 = v1.iter().filter(|&&val| val == max1).count();
    let count2 = v2.iter().filter(|&&val| val == max2).count();

    let mut sum = 0;
    for (p, q) in bombs {
        if v1[p] == max1 && v2[q] == max2 {
            sum += 1;
        }
    }

    if sum == count1 * count2 {
        println!("{}", max1 + max2 - 1);
    } else {
        println!("{}", max1 + max2);
    }
}

Measured memory_bytes: 9104
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl '\n'
int mod=1e9+7;

signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  vector<vector<int> > dp(n+1,vector<int>(5,1e18));
  dp[0][0]=0;
  dp[0][1]=0;
  dp[0][2]=0;
  dp[0][3]=0;
  dp[0][4]=0;

  for(int i=0;i<n;i++){
    int x=0;
    if(a[i]%2==1)x=1;
    if(a[i]==0)x=2;
    int y=0;
    if(a[i]%2==0)y=1;
    dp[i+1][0]=min(dp[i+1][0],dp[i][0]+a[i]);
    dp[i+1][1]=min(dp[i+1][1],min(dp[i][0],dp[i][1])+x);
    dp[i+1][2]=min(dp[i+1][2],min(dp[i][0],min(dp[i][1],dp[i][2]))+y);
    dp[i+1][3]=min(dp[i+1][3],min(dp[i][0],min(dp[i][1],min(dp[i][2],dp[i][3])))+x);
    dp[i+1][4]=min(dp[i+1][4],min(dp[i][0],min(dp[i][1],min(dp[i][2],min(dp[i][3],dp[i][4]))))+a[i]);
  }
  cout<<min(dp[n][0],min(dp[n][1],min(dp[n][2],min(dp[n][3],dp[n][4]))))<<endl;
}


Measured memory_bytes: 15872
import java.util.Scanner;

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

    long count = b / x;
    
    if(a == 0L) {
      count++;
    } else {
      count -= (a - 1L) / x;
    }
        
    System.out.println(count);
  }
}


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

#define pb push_back
typedef long long ll;

ll n;
int a[100005],check[100005],p1,p2,out;
const ll MOD = 1000000007;

ll nck[100005],outck[100005],inverse[100005],ans[100005];

ll extgcd(ll a, ll b, ll &x, ll&y){
    ll d = a;
    if(b != 0){
        d=extgcd(b,a%b,y,x);
        y -= (a/b)*x;
    }
    else{x=1;y=0;}
    return d;
}

ll inv(ll  a){
    ll m= MOD;
    long long x,y ;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

void pre(ll n){
    nck[0] = 1;
    nck[1] = n;
    for(ll i=2 ; i <= n; i++){
        nck[i] = ((nck[i-1] * (n-i+1))%MOD * inverse[i]+MOD)%MOD;
    }
}

void preout(ll n){
    outck[0] = 1;
    outck[1] = n;
    for(ll i=2 ; i <= n; i++){
        outck[i] = ((outck[i-1] * (n-i+1))%MOD * inverse[i]+MOD)%MOD;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    n++;
    for(int i = 0; i < 100004; i++){
        inverse[i] = inv(i);
        check[i] = -1;
    }
    for(int i = 0; i < n; i++){
        cin >> a[i];

        if(check[a[i]]>=0){

            p1=check[a[i]];
            p2 = i;
        }
        check[a[i]] = i;
    }
    ll out = p1+(n-p2-1);
    pre(n);
    preout(out);
   // cout<<out;
   // cout<<p1<<p2<<endl;
    for(int i = 1; i <= out+1; i++)nck[i]= (nck[i]-outck[i-1]+MOD)%MOD;
    for(int i = 1; i <= n; i++)cout<<nck[i]<<endl;

    return 0;
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void dfs2(int depth, int deep, int limit, int select, boolean first, char[] chs, int[] group) {
		if(select >= limit) {
			dfs(depth + 1, deep + 1, limit, chs, group);
			return;
		}
		
		if(group[select] >= 1) {
			dfs2(depth, deep, limit, select + 1, false, chs, group);
			return;
		}
		
		if(!first) {
			dfs2(depth, deep, limit, select + 1, false, chs, group);
		}
			
		group[select] = depth;
		chs[select] = (char)('a' + (depth - 1));
		dfs2(depth, deep, limit, select + 1, false, chs, group);
		group[select] = 0;
	}
	
	public static TreeSet<String> set = new TreeSet<String>();
	
	public static void dfs(int depth, int deep, int limit, char[] chs, int[] group) {
		if(deep >= limit) {
			set.add(new StringBuilder().append(chs).toString());
			return;
		}
		
		if(group[deep] >= 1) {
			dfs(depth, deep + 1, limit, chs, group);
			return;
		}else {
			dfs2(depth, deep, limit, deep, true, chs, group);
		}
	}
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			dfs(1, 0, N, new char[N], new int[N]);
			for(final String s : set) {
				System.out.println(s);
			}
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 59532
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>

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

using namespace std;

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

long long N, A, B;

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

    long long c = A + B;
    long long p = (N / c) * A;
    long long r = min(N % c, A);

    cout << p + r << endl;
}



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

using namespace std;

int main(){

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

    long long n;
    cin >> n;

    if(n & 1) cout << "0\n";
    else {
        long long counter = 0;
        long long factor = 10;
        while(n >= factor){
            counter += n / factor;
            factor *= 5;
        }

        cout << counter << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
def check(S, T):
    for _ in range(len(S)):
        if S == T:
            return True
        S = S[-1] + S[:-1]
    return False


def main():
    S = input()
    T = input()
    if check(S, T):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <iostream>


int main() {
    long long int X;
    std::cin >> X;
    long long int sum = 100;
    double ratio = 1.01;

    int idx = 0;
    while (sum < X) {
        sum = sum * ratio;
        idx++;
    }

    std::cout << idx << std::endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string.h>
#include <algorithm>
typedef long long ll;
using namespace std;

int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
    int p=0;
	// ユークリッドの方法
	while( m > n )
	{
        m = m/2;
        p+=1;
	}
	return p;
}
void count(ll x, ll y, ll b[200001][200001],ll a[200001])
{
    int j;
     
}
int main()
{
    ll i,n,b[100],ans=0;
    cin >> n;
    for(i=0;i<n-1;i++){
        cin >> b[i];
    }
    ans+=b[0]+b[n-2];
    for(i=1;i<n-1;i++){
        ans+=min(b[i-1],b[i]);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;

void merge (int *first1, int *last1, int *first2, int *last2){
    int size1 = last1 - first1;
    int size2 = last2 - first2;
    int *result = new int[size1+size2];
    int i = 0;
    int j = 0;
    int index = 0;
    while (true){
        if (i < size1 && (first1[i] <= first2[j] || j >= size2)){
            result[index] = first1[i];
            ++i; ++index;
        }
        if (j < size2 && (first1[i] > first2[j] || i >= size1)){
            result[index] = first2[j];
            ++j; ++index;
        }
        if (i==size1 && j==size2){
            for (i=0; i<size1; ++i) first1[i] = result[i];
            for (j=0; j<size2; ++j) first2[j] = result[j+size1];
            delete[] result;
            return;
        }
    }
}
void MergeSort (int *first, int *last){
    int size = last - first;
    if(size <= 1) return;
    MergeSort(first, first+size/2);
    MergeSort(first+size/2, last);
    merge(first, first+size/2, first+size/2, last);
}


int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

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

  string a;

  cin >> a;

  int cnt = 0;
  if(a == "a") cnt++;
  if(a == "e") cnt++;
  if(a == "o") cnt++;
  if(a == "i") cnt++;
  if(a == "u") cnt++;

  if(cnt == 0) cout << "consonant" << endl;
  else cout << "vowel" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,m,v,p;cin>>n>>m>>v>>p;
    ll a[n];
    unordered_map<ll,ll> mp;
    rep(i,0,n){
        cin>>a[i];
        mp[a[i]]++;
    }
    sort(a,a+n);
    ll sum=0;
    ll num=-1;
    rrep(i,n-1,1){
        if(a[i]!=a[i-1]){
            sum+=mp[a[i]];
            
        }
        if(sum>=p){
            num=i+1;
            break;
        }
    }
    if(num==-1){
        sum+=mp[a[0]];
        num=1;
    }
    ll u=num;
    ll d=-1;
    while(u-d>1){
        ll mid=(u+d)/2;
        //cout<<mid<<endl;
        ll b[n];
        if(a[mid]+m<a[n-p]){
            d=mid;
            continue;
        }
        rep(i,0,mid+1)b[i]=m;
        ll su=0;
        su+=(mid+1)*m;
        ll nu=mid+1;
        rep(i,mid+1,n){
            if(a[mid]+m>a[i]){
                su+=-a[i]+a[mid]+m;
                b[i]=a[mid]+m-a[i];
                nu=i+1;
            }
            else{
                b[i]=0;
            }
        }
        if(su>=v*m){
            u=mid;
            continue;
        }
        ll zan=0;
        ll zas=m*v-su;
        //cout<<zas<<endl;
        //rep(i,0,n)cout<<b[i]<<" ";
        //return 0;
        //if(mid==0)cout<<su<<" "<<nu<<endl;
        rrep(i,n-1,0){
            ll yy=m-b[i];
            zan++;
            if(yy>=zas){
                
                break;
            }
            else{
                zas-=yy;
            }
        }
        if(zan<=p-1)u=mid;
        else d=mid;
    }
    cout<<n-u<<endl;
}


Measured memory_bytes: 6052
#include<iostream>
#include<vector>
#include<math.h>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
  vector<int> table;
  int x;
  cin >> x;
  int ii,pp;
  int prev;
  for(ii = 2 ; ii <= 31 ; ii++){
	for(pp = 2; pow(ii,pp) <= 1000 ; pp++){
	  table.push_back(pow(ii,pp));
	}
  }

  table.push_back(1);
  std::sort(table.begin(),table.end(),greater<int>());

  for(ii=0;ii<table.size();ii++){
	if(table[ii] <= x){
	  prev = table[ii];
	  break;
	}
  }

  cout << prev << endl;

  return 0;
}


Measured memory_bytes: 256
import math
def main():
    N,M,X = map(int, input().split())
    C = [0 for j in range(N)]
    A = [[0 for j in range(M)] for i in range(N)]
    for i in range(0, N):
        l = list(map(int, input().split()))
        
        C[i] = l[0]
        A[i] = l[1:]

    res = max(C)*N
    possible = False
    for i in range(0,1<<N):
        cost= 0
        und= [0 for j in range(M)]
        for j in range(N):
            if (i>>j)&1 == 1:
                cost += C[j]
                und =list(map(lambda x,y: x+y, und, A[j]))
        
        if min(und) - X >=0 and cost <= res:
            res = cost
            possible = True

    if possible:
        print(res)
    else:
        print('-1')       

if __name__ == '__main__':
    main()


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

int main() {
  int n;cin>>n;
  string s;cin>>s;
  if (s.size()<=n)cout<<s;
  else cout<<s.substr(0,n)<<"...";

}


Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.StringTokenizer;

public class Main{
	
	static class Point {
		
		int x, y;
		Point(int x, int y) {
			
			this.x = x;
			this.y = y;
		}
	}

	static char[][] grid;
	
	public static void main(String args[]) throws Exception {

		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt() - 1;
		int y = sc.nextInt() - 1;
		int a = sc.nextInt() - 1;
		int b = sc.nextInt() - 1;
		grid = new char[n][m];
		int[][] dist = new int[n][m];
		
		for (int i = 0; i < n; i++) {
			
			grid[i] = sc.next().toCharArray();
			Arrays.fill(dist[i], (int)1e8);
		}
		
		int[] dx = {1, -1, 0, 0};
		int[] dy = {0, 0, 1, -1};
		
		Deque<Point> q = new ArrayDeque<>();
		q.add(new Point(x, y));
		dist[x][y] = 0;
		
		while(!q.isEmpty()) {
			
			Point p = q.poll();
			//System.out.println(p.x + " " + p.y);
			// 0 cost edges
			for(int i = 0; i < 4; i++) {
				
				int newX = p.x + dx[i];
				int newY = p.y + dy[i];
				
				if(!isSafe(newX, newY))
					continue;
				
				if(dist[newX][newY] > dist[p.x][p.y]) {
					
					dist[newX][newY] = dist[p.x][p.y];
					q.addFirst(new Point(newX, newY));
				}
			}
			
			//1 cost edges
			for(int i = -2; i <= 2; i++) {
				for(int j = -2; j <= 2; j++) {
					
					int newX = p.x + i;
					int newY = p.y + j;
					
					if(!isSafe(newX, newY))
						continue;
					
					if(dist[newX][newY] > dist[p.x][p.y] + 1) {
						
						dist[newX][newY] = dist[p.x][p.y] + 1;
						q.addLast(new Point(newX, newY));
					}
				}
			}
		}
		
		/*for(int[] i : dist) {
			for(int p : i)
				System.out.print(p + " ");
			System.out.println();
				
		}*/
		pr.print(dist[a][b] >= (int)1e8 ? -1 : dist[a][b]);
		pr.close();
	}

	private static boolean isSafe(int x, int y) {

		if (x < 0 || y < 0 || x >= grid.length || y >= grid[0].length || grid[x][y] == '#')
			return false;

		return true;
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

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


Measured memory_bytes: 58524
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  double A,B,H,M;
  cin>>A>>B>>H>>M;
  double theta=2*M_PI*((H*60+M)/(12*60)-M/60);
  cerr<<theta<<endl;
  //固定小数点
  cout<<fixed;
  //桁数固定
  cout<<setprecision(10);
  cout<<sqrt(pow(B*cos(theta)-A,2)+pow(B*sin(theta),2))<<endl;
  return 0;
}


Measured memory_bytes: 4096
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    int D;
    cin>>D;
    vector<long int> c(26);
    rep(i,26) cin>>c[i];
    vector<vector<long int> > s(D,vector<long int>(26));
    rep(i,D){
        rep(j,26) cin>>s[i][j];
    }
    vector<long int> t(D);
    rep(i,D){
        cin>>t[i];
        t[i]--;
    }
    vector<int> last(26,-1);
    vector<long int> ans(D+1);
    for(int i=0;i<D;i++){
        ans[i+1]=ans[i]+s[i][t[i]];
        rep(j,26){
            if (t[i]==j) last[j]=i; 
            ans[i+1]-=c[j]*(i-last[j]);
        }
    }
    for (int i=1;i<D+1;i++)  cout<<ans[i]<<endl;
    return 0;
}

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

#define rep(i, a, n) for(int i=(a);i<(n);++i)
#define per(i, a, n) for(int i=(a);i>(n);--i)
#define pb emplace_back
#define mp make_pair
#define lowbit(x) (x & -x)

typedef long long LL;
typedef pair<int, int> pii;

const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1.0);

const int N = 2e5 + 10;

int n, K, a[N];

bool ok(int x){
	int num = K;
	int r;
	rep(i, 0, n){
		if(a[i] % x == 0){
			r = a[i] / x - 1;
		} else {
			r = a[i] / x;
		}
		if(num < r)	return 0;
		num -= r;
	}
	return 1;
}

int main(){
	scanf("%d %d", &n, &K);
	int low = 1, top = 0;
	rep(i, 0, n){
		scanf("%d", a+i);
		top = max(top, a[i]);
	}
	int mid, ans = top;
	while(low <= top){
		mid = low + top >> 1;
		if(ok(mid)){
			ans = min(ans, mid);
			top = mid - 1;
		} else {
			low = mid + 1;
		}
	}
	printf("%d\n", ans);
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(n); ++i)
#define INF 100000 // 2^31-1
#define MAX_V 1000


using namespace std;

using ll =long long;
using P = pair<int,int>;


 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

//5
int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main() {

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

int n;


cin>>n;



n%=10;




if(n==2 || n==4 || n==5 || n==7 || n==9){
cout<<"hon"<<endl;
}else if(n==0 || n==1 || n==6 || n==8){
cout<<"pon"<<endl;
}else if(n==3){
cout<<"bon"<<endl;
}









}

//cout << fixed << setprecision(5) <<(n*2)*M_PI << endl;

Measured memory_bytes: 3648
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  string s;
  cin >> s;
  printf("%c%d%c\n", s[0], (int)s.size() - 2, s[s.size() - 1]);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

std::string dotStartingString(int stringLength) {
    std::string returnString = "";
    
    for (int i = 0; i < stringLength; ++i) {
        
        if (i % 2 == 0) {
            returnString += ".";
        }
        
        if (i % 2 == 1) {
            returnString += "#";
        }
        
    }
    
    return returnString;
}

std::string starStartingString(int stringLength) {
    std::string returnString = "";
    
    for (int i = 0; i < stringLength; ++i) {
        
        if (i % 2 == 0) {
            returnString += "#";
        }
        
        if (i % 2 == 1) {
            returnString += ".";
        }
        
    }
    
    return returnString;
}


int main() {
    
    while (true) {
        
        int h, w = 0;
        std::cin >> h >> w;
        
        if (h == 0 && w == 0) {
            break;
        }
        
        for (int i = 0; i < h; ++i) {
            
            if (i % 2 == 0) {
                std::cout << starStartingString(w) << std::endl;
            } 
            
            if (i % 2 == 1) {
                std::cout << dotStartingString(w) << std::endl;
            }
        
        }
        
        std::cout << std::endl;
    }
    
    return 0;
}



Measured memory_bytes: 3164
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    string S,T;
    cin >> S >> T;
    bool ans=false;
    rep(i,26){
        char c='a'+i;
        string nw=S+c;
        if(nw==T) ans=true;
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3640
// 16:21

#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 
 
int32_t main()
{
    fast;
    int t;
    int n, a, b, passed = 0, rank = 0; cin >> n >> a >> b;
    Rep(i, 1, n) {
        char ch;
        cin >> ch;

        if(ch == 'a' and passed < a+b) {
            passed++;
            cout << "Yes" << '\n';
        }

        else if(ch == 'b' and passed < a+b and rank < b) {
            passed++;
            rank++;
            cout << "Yes" << '\n';
            
        }
        
        else cout << "No\n";
    }

    return 0;
}

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

int main(){
    int d,n;    
    cin >> d >> n;
    int ans = pow(100,d)*n;
    if(n == 100){
        ans = pow(100,d)*(n+1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, n) for (int i = (n)-1; i >= 0; i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase(unique(ALL(v)), v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 2e18;
const double PI = acos(-1);

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int A, B, C;
	cin >> A >> B >> C;
	vi L(N);
	REP(i, N)
	{
		cin >> L[i];
	}
	vi P(N);
	REP(i, N)
	{
		P[i] = i;
	}
	int ans = 10000;
	do
	{
		REP(i, N)
		{
			FOR(j, i + 1, N)
			{
				FOR(k, j + 1, N)
				{
					int cur = 0;
					int sum = 0;
					int cnt = -1;
					REP(l, i + 1)
					{
						sum += L[P[l]];
						cnt++;
					}
					cur += abs(sum - A);
					cur += cnt * 10;
					sum = 0;
					cnt = -1;
					FOR(l, i + 1, j + 1)
					{
						sum += L[P[l]];
						cnt++;
					}
					cur += abs(sum - B);
					cur += cnt * 10;
					sum = 0;
					cnt = -1;
					FOR(l, j + 1, k + 1)
					{
						sum += L[P[l]];
						cnt++;
					}
					cur += abs(sum - C);
					cur += cnt * 10;

					ans = min(ans, cur);
				}
			}
		}
	} while (next_permutation(ALL(P)));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include"stdio.h"
#include"stdlib.h"
int main(void){
  int N,K,Q;
  int i;
  scanf("%d %d %d", &N, &K, &Q);
  int A[Q];
  int hold_point[N];
  for( i=0; i<N; i++){
    hold_point[i]=0;
  }
  
  for( i=0; i<Q; i++){
    scanf("%d", &A[i]);
    hold_point[A[i]-1]++;
  }
  
  if( K>Q ){
    for( i=0; i<N; i++){
      printf("Yes\n");
    }
    return 0;
  }


  for( i=0; i<N; i++){
    if( K-(Q-hold_point[i])>0 ){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
  }
  return 0;
}


Measured memory_bytes: 1280
import collections
n, k = map(int, input().split())
a = list(map(int, input().split()))
c = collections.Counter(a)
ans=0
num=[]
seta=set(a)
if len(seta)-k <0:
    print(0)
else:
    for x in seta:
        num.append(c[x])
    num.sort()
    for i in range(len(seta)-k):
        ans+=num[i]
    print(ans)

Measured memory_bytes: 39984
//  Created by ZJYelizaveta on 2017年11月18日 星期六 20时59分12秒
//  Copyright (c) 2017年 ZJYelizaveta. All rights reserved.

#include <bits/stdc++.h>
using namespace std;

int num;
int a[5], opt[5];

vector<int> vec;
inline bool check() {
	int res = 0;
	for (int i = 0; i < vec.size(); ++i) {
		if (opt[i]) res += vec[i];
		else res -= vec[i];
	}
	return res == 7 ? true : false;
}

inline void print() {
	if (opt[0] == 1 || vec[0] == 0) printf("%d", vec[0]);
	else printf("-%d", vec[0]);
	for (int i = 1; i < 4; ++i) {
		if (opt[i]) printf("+%d", vec[i]);
		else printf("-%d", vec[i]);
	}
	printf("=%d\n", 7);
}

int main()
{
	char str[10];
	cin >> str;
	for (int i = 0; i < 4; ++i) vec.push_back(str[i] - '0');

//	for (int i = 0; i < vec.size(); ++i) printf("%d ", vec[i]); printf("\n");

	for (int S = 0; S <= 15; ++S) {
		memset(opt, 0, sizeof opt);
		for (int i = 0; i < 4; ++i) if (S & (1 << i)) {
			opt[i] = 1;
		}
		if (check()) {
			print();
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,a,b,flag;
	flag=0;
	scanf("%d",&n);
	if(n==1||n==2||n==3)
	{
		printf("Yes\n");
	}
	else
	{
		for(int i=2;i*i<=n;i++)
		{
			if(n%i==0)
			{
				a=i;
				b=n/i;
				if(a<10&&b<10)
				{	
					flag=1;
				} 
			}	
		}		
		if(flag==1)
		{	
			printf("Yes\n");
		}	
		else
		{
			printf("No\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>

using namespace std;
using ll = long long;

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

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

int main() {
	int N;
	cin >> N;

	ll ans = 1LL;

	for (int i = 0; i < N; i++) {
		ll T;
		cin >> T;
		ans = lcm(ans, T);
	}

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,cnt=0;
long long a;
map<long long,bool>mp;
cin>>n;
while(n--){
    cin>>a;
    if(mp[a]){
        cnt--;
        mp[a]=0;
    }
    else{
        mp[a]=1;
        cnt++;
    }

}
cout<<cnt;
}

Measured memory_bytes: 9668
#include <iostream>

using namespace std;

const int kMaxN = 100001;

int a[kMaxN];
int n, m, x, y, c;

int R(int x) {
  return a[x] == x ? x : a[x] = R(a[x]);
}

int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    a[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    if (R(x) != R(y)) {
      c++;
      a[R(x)] = R(y);
    }
  }
  cout << n - 1 - c;
  return 0;
}

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

namespace ABC099
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> list = new List<string>();
            while (true)
            {
                string line = Console.ReadLine();
                if (line == null) break;
                list.Add(line);
            }
            double a = double.Parse(list[0]);
            double b = double.Parse(list[1]);

            if (a==b)
            {
                Console.WriteLine("EQUAL");
            }else if(a>b)
	        {
                Console.WriteLine("GREATER");
            }
            else
            {
                Console.WriteLine("LESS");
            }
        }

    }
}


Measured memory_bytes: 13140
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;

int main()
{

    int n,m,ans;
    scanf("%d %d",&n,&m);

    ans=n*(n-1)+m*(m-1);
    ans=ans/2;

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

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = n;
		int i = 0;
		while(true) {
			i++;
			if(m <= 111) {
				System.out.println(i*111);
				break;
			}
			m-=111;
		}
		sc.close();
	}

}


Measured memory_bytes: 21844
n,a,b = map(int,input().split())

if (b-a)%2==0:
  print((b-a)//2)
  exit()
else:
  print(min(
    (n-a),
    (b-1),
    (((b-a-1)//2)+n-b+1),
    (((b-a-1)//2)+a)
  ))

Measured memory_bytes: 2940
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC_prac
{
    public class Program
    {
        #region templete

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        /// <summary>
        /// 最小公倍数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
        /// <summary>
        /// 最小公約数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
        public static void Main(string[] args)
        {
            new Program().Solve();
            Read();
        }

        #endregion

        public void Solve()
        {
            var n = ReadInt();
            var s = Read();
            int x = 0;
            int max = x;

            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'I') x++;
                else if (s[i] == 'D') x--;
                max = (max > x) ? max : x;
            }

            WriteLine($"{max}");

        }
    }
}


Measured memory_bytes: 13140
# input
inputs = []
while True:
  try:
    inputs.append(list(map(float,input().split())))
  except EOFError:
    break

# calculation
for i in inputs:
  x=(i[2]*i[4]-i[1]*i[5])/(i[0]*i[4]-i[1]*i[3])
  y=(i[0]*i[5]-i[2]*i[3])/(i[0]*i[4]-i[1]*i[3])
  if x == -0.000:x=0
  if y == -0.000:y=0
  print("{0:.3f} {1:.3f}".format(x,y))

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

int main(){
  string S;
  cin>>S;
  int j=0;
  for(char c:S)
    if(c=='o')
      j++;
  if(15-S.size()+j<8)
    cout<<"NO"<<endl;
  else
    cout<<"YES"<<endl;
}

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

using namespace std;

int main() {
    int n;  cin >> n;
    map <string, int> mp;
    for (int i = 1; i <= n; i++) {
        string s;   cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << '\n';
    cout << "WA x " << mp["WA"] << '\n';
    cout << "TLE x " << mp["TLE"] << '\n';
    cout << "RE x " << mp["RE"] << '\n';
#ifndef ONLINE_JUDGE
    system("pause");
#endif
    return 0;
}

Measured memory_bytes: 3644
import sys

input = sys.stdin.readline

L, R = map(int, input().split())

def main():
    if R // 2019 != L // 2019:
        ans = 0
    else:
        # ansLi = L % 2019
        # ansLj = (L+1) % 2019
        # ansL = ansLi * ansLj

        # ansRi = R % 2019
        # ansRj = (R-1) % 2019
        # ansR = ansRi * ansRj
        ansL = L*(L+1) % 2019
        ansR = R*(R-1) % 2019

        ans = min(ansL, ansR)

    return int(ans)

# print(main())

def search_all():
    if R // 2019 != L // 2019:
        return 0
    ans = float("inf")
    for i in range(L, R):
        for j in range(i+1, R+1):
            ans = min(i*j % 2019, ans)
            if ans == 0:
                break
    return ans

print(search_all())

Measured memory_bytes: 38896
#include<stdio.h>
int main(){
  int i,j,n,k;
  int p,q,tp;
  int ans=0;
  int a[1001]={99999};
  
  scanf("%d %d",&n,&k);
  
  for(i=0;i<n;i++){ 
    scanf("%d ",&a[i]);
  }
  
  for(p=0;p<n;p++){
    for(q=p;q<n;q++){
     if(a[p]>a[q]){
      tp=a[p];
       a[p]=a[q];
       a[q]=tp;
     }
    }
  }
    
  for(i=0;i<k;i++){
   ans+=a[i]; 
  }
    
  printf("%d",ans);
  
 return 0; 
}






Measured memory_bytes: 2172
#include<stdio.h>
 
int main(){
  int i, n, result;
  for (i = 1; i <= 9; i++) {
    for (n = 1; n <= 9; n++) {
      result = i * n;
      printf("%dx%d=%d\n", i, n, result);
    };
  }; 
  return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, M;
    cin >> N >> M;
    Graph graph(N);
    rep(i, M) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vector<bool> visited(N, false);
    visited[0] = true;
    vector<ll> ans(N, -1);
    queue<ll> que;
    que.push(0);
    ans[0] = 0;
    while (!que.empty()) {
        ll u = que.front();
        que.pop();
        for (ll v: graph[u]) {
            if (!visited[v]) {
                visited[v] = true;
                ans[v] = u;
                que.push(v);
            }
        }
    }
    bool ok = true;
    rep(i, N) {
        if (ans[i] == -1) {
            ok = false;
        }
    }
    if (ok) {
        cout << "Yes" << '\n';
        rep2(i, 1, N) {
            cout << ans[i] + 1 << '\n';
        }
    } else {
        cout << "No" << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        cin >> p[i];
        if(p[i] != i + 1)   cnt++;
    }
    if(cnt > 2){
        cout << "NO\n";
    }
    else{
        cout << "YES\n";
    }
}

Measured memory_bytes: 256