akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef int ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<ll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t+1) out("Case #" << i << ": " << solve());
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (i = a; i < b; ++i)
#define FORI(i, a, b, c) for (i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb emplace_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define printv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln}
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ' '; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1               // check ith bit
#define bitcount __builtin_popcount               // count set bits
#define firstbitindex __builtin_ctz               // count trailing zeros
#define lastbitindex __builtin_clz                // count leading zeros
#define bitparity __builtin_parity                // check set bits are even or odd
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll MAXN = 1e7 + 1, MOD = 998244353, SIZE = 2e7, ROOT = 3162, INF = 0x7f7f7f7f7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);
const int INFi = 0x7f7f7f7f;

//<<------Declare Variables Here----->>//
ll n, x, y, z, i, j;
vll spf(MAXN, 2), factors;
long long a, f;

//<<-----Implement Functions Here---->>//
void sieve()
{
	FORI(i, 3, MAXN, 2)
		spf[i] = i;
	FORI(i, 3, ROOT, 2)
		if (spf[i] == i)
			FORI(j, i * i, MAXN, i)
				if (spf[j] == j)
					spf[j] = i;
}
void solve()
{
	in(n)
	a = 1;
	for (i = 2; i <= n; ++i)
	{
		x = i, z = 1, factors = {};
		while(x > 1)
			y = spf[x], x /= y, y > z ? factors.push_back(2), z = y : ++factors.back();
		f = 1;
		for (ll it: factors)
			f *= it;
		a += i * f;
	}
	out(a)
}

//<<----------Start of Main---------->>//
int main()
{
	fastio
	sieve();
	solve();
    return 0;
}

Measured memory_bytes: 42192
import java.util.Arrays;
import java.util.Scanner; // 文字列を標準入力からscanする

public class Main { 

  static long return_smaller(long a, long b){
    if(a > b){
      return b;
    }
      return a;
  }
    
  public static void main(final String[] args) {
    Scanner scan = new Scanner(System.in);
		String str = "";
    str = scan.nextLine();
    String[] strs2 = str.split(" ");
    int N = Integer.parseInt(strs2[0]);
    int K = Integer.parseInt(strs2[1]);
    
    long[] hi = new long[110000];
    long[] dp = new long[110000];
    long oo = 1L << 60;
    Arrays.fill(dp, oo);

    str = scan.nextLine();
    String[] strs3 = str.split(" ");
    for(int i=0; i<strs3.length; i++) {
      hi[i] = Integer.parseInt(strs3[i]);
    }
    scan.close();

    int i = 0;
    int j = 0;

    dp[0] = 0;
    for (i = 0; i < N; i++) {
      for(j = 1; j <= K; j++){
        dp[i+j] = return_smaller(dp[i+j], dp[i] + Math.abs(hi[i] - hi[i+j]));
      }
    }

    System.out.println(dp[N-1]);

  }
}

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

int selectionSort(vector<int> &a, int n) {
    int count=0;
    for(int i=0; i<n; ++i) {
        int minj=i;
        for(int j=i; j<n; ++j) {
            if(a[j] < a[minj]) minj = j;
        }
        int v = a[i];
        a[i] = a[minj];
        a[minj] = v;
        if(i!=minj) ++count;
        }
    return count;
}
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int c = selectionSort(A, N);
    rep(i,N) if(i==N-1) cout << A[i] << endl; else cout << A[i] << " ";
    cout << c << endl; 
    return 0;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll x, t;

	cin >> x >> t;

	if (t > x) {
		cout << 0 << endl;
	}
	else {
		cout << x - t << endl;
	}
}

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

typedef long long ll;
ll N;
vector<ll> A, X;
vector<ll> R;

int main() {
  cin >> N;
  A.resize(N + 1);
  for (ll i = 1; i <= N; ++i) cin >> A[i];
  X.resize(N + 1);
  for (ll i = N; i >= 1; --i) {
    X[i] = A[i];
    for (ll k = 2 * i; k <= N; k += i) X[i] ^= X[k];
    if (X[i]) R.push_back(i);
  }
  cout << R.size() << endl;
  bool first = true;
  for (ll r : R) {
    cout << (first ? "" : " ") << r;
    first = false;
  }
  return 0;
}


Measured memory_bytes: 4980
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def rl(proc=None):
    if proc is not None:
        return proc(sys.stdin.readline())
    else:
        return sys.stdin.readline().rstrip()

def srl(proc=None):
    if proc is not None:
        return list(map(proc, rl().split()))
    else:
        return rl().split()

def main():
    t1, t2 = srl(int)
    a1, a2 = srl(int)
    b1, b2 = srl(int)
    if a1 < b1:
        a1, b1 = b1, a1
        a2, b2 = b2, a2
    if a1 * t1 + a2 * t2 == b1 * t1 + b2 * t2:
        print('infinity')
        return
    elif a1 * t1 + a2 * t2 > b1 * t1 + b2 * t2:
        print('0')
        return
    s1 = a1*t1 - b1*t1
    s2 = a1 * t1 + a2 * t2 - b1 * t1 - b2 * t2
    s2 = -s2
    b = int(s1 % s2 == 0)
    k = s1 // s2 + 1
    print(2*k-1-b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int n = nk[0];
			int k = nk[1];
			var positions = new XY[n];
			for (int i = 0; i < n; i++) {
				var xy = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
				positions[i] = new XY { X = xy[0], Y = xy[1] };
			}

			long ans = long.MaxValue;
			for (int x = 0; x < n; x++) {
				for (int y = 0; y < n; y++) {
					for (int x2 = 0; x2 < n; x2++) {
						if (x == x2) {
							continue;
						}

						for (int y2 = 0; y2 < n; y2++) {
							if (y == y2) {
								continue;
							}

							
							long left = positions[x].X < positions[x2].X 
								? positions[x].X : positions[x2].X;
							long right = positions[x].X < positions[x2].X
								? positions[x2].X : positions[x].X;
							long bottom = positions[y].Y < positions[y2].Y
								? positions[y].Y : positions[y2].Y;
							long top = positions[y].Y < positions[y2].Y
								? positions[y2].Y : positions[y].Y;
							int count = 0;
							for (int i = 0; i < n; i++) {
								var pos = positions[i];
								if (pos.X >= left && pos.X <= right && pos.Y >= bottom && pos.Y <= top) {
									++count;
								}
							}

							if (count >= k) {
								long area = (right - left) * (top - bottom);
								ans = Math.Min(ans, area);
							}
						}
					}
				}
			}

			Console.WriteLine(ans);
		}

		public struct XY
		{
			public long X { get; set; }
			public long Y { get; set; }
		}
	}
}


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

int main(){
	vector<long long int> a(200001);
	int n;
	unsigned long long int min = 4 * pow(10, 14) + 1;
	long long int tmp;
	cin >> n;
	for(int i = 1;i<=n;i++){
		cin >> tmp;
		a[i] = a[i - 1] + tmp;
	}
	for(int i = 1;i<n;i++){
		tmp = abs(2 * a[i] - a[n]);
		if(min > tmp) min = tmp;
	}
	cout << min << endl;
	return 0;
}

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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;
const double PI=3.1415926535897932;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

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

ll mod = 1e9+7;
ll inv(ll x) {
    ll res = 1;
    ll k = mod - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % mod;
        y = (y * y) % mod;
        k /= 2;
    }
    return res;
}




const int SIZE = 1e5+10;
ll n;
pair<ll, ll> tmp[SIZE];
ll x,l;

int main(){

    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x >> l;
        tmp[i].first = x+l;
        tmp[i].second = x-l;
    }

    sort(tmp, tmp+n);

    ll ans = 1,t = tmp[0].first;
    for(int i = 1; i < n; i++){
        if(t <= tmp[i].second){
            ++ans;
            t = tmp[i].first;
        }
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define N 2000010
#define INF 0x3f3f3f3f

using namespace std;

int n_road,n_rail;
int city;
int road_cont[2][N];
int road[2][N];
bool visit[N];
int cont[N];
int connected[N];

set <int> way_cont[2][N],temp_cont;
set <int>::iterator it;

int Find(bool way,int x)
{
    if(x==road_cont[way][x])return x;
    else
    {
        road_cont[way][x]=Find(way,road_cont[way][x]);
        return road_cont[way][x];
    }
}

void join(bool way,int a,int b)
{
    if(road[way][a]<road[way][b])
    {
        road_cont[way][a]=b;
        ++road[way][a];
    }
    else
    {
        road_cont[way][b]=a;
        ++road[way][b];
    }
}

void Create()
{
    int i;
    int x,y;
    for(i=1; i<=city; ++i)
    {
        road_cont[0][i]=road_cont[1][i]=i;
    }
    for(i=1; i<=n_road; ++i)
    {
        scanf("%d%d",&x,&y);

        int f1=Find(0,x);
        int f2=Find(0,y);
        if(f1!=f2) join(0,f1,f2);
    }
    for(i=1; i<=n_rail; ++i)
    {
        scanf("%d%d",&x,&y);

        int f1=Find(1,x);
        int f2=Find(1,y);
        if(f1!=f2) join(1,f1,f2);
    }
    //Create_tree
    for(int j=1; j<=city; ++j)
    {
        way_cont[0][Find(0,j)].insert(j);
    }
    //公路
    for(int j=1; j<=city; ++j)
    {
        way_cont[1][Find(1,j)].insert(j);
    }
    //火车
    memset(visit,0,sizeof(visit));
}

void Travel_Tree()
{
    for(int i=1; i<=city; i++)
    {
        if(visit[i])continue;
        int top=0;
        int Root1,Root2;
        Root1=Find(0,i);
        Root2=Find(1,i);
        bool road;
        if(way_cont[0][Root1].size() > way_cont[1][Root2].size())
        {
            temp_cont=way_cont[1][Root2];
            road=true;
        }
        else
        {
            temp_cont=way_cont[0][Root1];
            road=false;
            int t=Root1;
            Root1=Root2;
            Root2=t;
        }

        for(it=temp_cont.begin(); it!=temp_cont.end(); it++)
        {
            int p=*it;
            if(way_cont[!road][Root1].find(p)!=way_cont[!road][Root1].end())
            {
                top++;
                connected[top]=(p);
                visit[p]=1;
                /*cont[p]++;
                 
                */

                way_cont[road][Root2].erase(p);
                way_cont[!road][Root1].erase(p);
            }
        }
        for(int j=1; j<=top; j++)
        {
            cont[connected[j]]=top;
        }
    }
}

int main()
{
    scanf("%d%d%d",&city,&n_road,&n_rail);
    Create();
    Travel_Tree();
    for(int i=1; i<=city; ++i)
    {
        if(i!=1)printf(" ");
        printf("%d",cont[i]);
    }
    printf("\n");
    return 0;
}


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

#define int long long

template<typename T>
struct Dinic {
  const T INF = 1<<28;
  
  struct FlowEdge {    
    int to, rev;
    T cap;    
    FlowEdge() {}
    FlowEdge(int to, T cap, int rev) : to(to), cap(cap), rev(rev) {}
  };

  int n;
  vector<vector<FlowEdge> > G;
  vector<int> level, iter;

  Dinic() {}
  Dinic(int sz) : n(sz), G(n), level(n), iter(n) {}
  
  void add_edge(int from, int to, T cap) {
    G[from].push_back(FlowEdge(to, cap, G[to].size()));    
    // undirected
    //G[to].push_back(FlowEdge(from, cap, G[from].size()-1));
    // directed
    G[to].push_back(FlowEdge(from, 0, G[from].size()-1));    
  }
  
  void bfs(int s) {
    fill(level.begin(), level.end(), -1);
    queue<int> Q;
    level[s] = 0;
    Q.push(s);
    while ( !Q.empty() ) {
      int v = Q.front(); Q.pop();
      for ( int i = 0; i < (int)G[v].size(); i++ ) {
	FlowEdge &e = G[v][i];
	if ( e.cap > 0 && level[e.to] < 0 ) {
	  level[e.to] = level[v]+1;
	  Q.push(e.to);
	}
      }
    }
  }
  
  T dfs(int v, int t, T f) {
    if ( v == t ) return f;
    for ( int &i = iter[v]; i < (int)G[v].size(); i++ ) {
      FlowEdge &e = G[v][i];
      if ( e.cap > 0 && level[v] < level[e.to] ) {
	T d = dfs(e.to,t,min(f,e.cap));
	if ( d > 0 ) {
	  e.cap -= d;
	  G[e.to][e.rev].cap += d;
	  return d;
	}
      }
    }
    return 0;
  }
  
  T max_flow(int s, int t, int lim) {
    T flow = 0;
    while ( 1 ) {
      bfs(s);
      if ( level[t] < 0 || lim == 0 ) return flow;
      fill(iter.begin(), iter.end(), 0);
      T f;
      while ( (f=dfs(s, t, lim)) > 0 ) {	
	flow += f;
	lim -= f;
      }
    }
  }

  T max_flow(int s, int t){
    return max_flow(s, t, INF);
  }

  /*
    get_cut() is used ONLY after using max_flow()
    (because get_cut needs the infomation of level)
    
    @ret 
    infomation about the graph after using max_flow()    
    if res[i] == false, vertex i belongs to same set as s
    else vertex i belongs to same set as t
  */  
  vector<bool> get_cut(int s, int t) {
    vector<bool> res(n);
    for ( int i = 0; i < n; i++ ) {
      res[i] = (level[i] == -1);      
    }
    return res;  
  }
};



signed main(){
  int V,E;
  cin >> V >> E;
  
  Dinic<int> dinic(V);  
  for ( int i = 0; i < E; i++ ) {
    int u, v, c;
    cin >> u >> v >> c;
    dinic.add_edge(u, v, c);
  }
  
  cout << dinic.max_flow(0,V-1) << endl;
  
  return 0;
}

/*
  verified on 2018/7/15
  http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3029326#1
*/



Measured memory_bytes: 3136
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
      String d = input.nextLine();
      
     switch(d){
     case"SUN":
     System.out.println("7");
     break;
     case"MON":
     System.out.println("6");
  break;
     case"TUE":
     System.out.println("5");
    break;
     case"WED":
     System.out.println("4");
     break;
     case"THU":
     System.out.println("3");
    break;
     case"FRI":
     System.out.println("2");
     break;
     case"SAT":
     System.out.println("1");
     break;

  }
}
}

Measured memory_bytes: 26684
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 1e5+5;

int n, a[5][5], b[5][5];
int main(){
    for(int i=0; i<3; i++) for(int j=0; j<3; j++) cin >> a[i][j];
    cin >> n;
    for(int i=1; i<=n; i++){
        int x;
        cin >> x;
        for(int j=0; j<3; j++) for(int k=0; k<3; k++) 
            if(a[j][k] == x) 
                b[j][k] = 1;
    }
    bool flag = false;
    for(int i=0; i<3; i++) {
        int sum1 = 0, sum2 = 0;
        for(int j=0; j<3; j++)
            sum1 += b[i][j], sum2 += b[j][i];
        if(sum1 == 3 || sum2 == 3) flag = true;
    }
    int sum1 = b[0][0] + b[1][1] + b[2][2]; 
    int sum2 = b[0][2] + b[1][1] + b[2][0];
    flag |= (sum1==3); flag |= (sum2==3);
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

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

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a < c && b > c || a > c && b < c ? "Yes" : "No") << endl;
}

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

using namespace std;

#define r(i, start, end) for (int(i) = (start); (i) < (end); (i)++)
#define rr(i, end, start) for (int(i) = (end); (i) >= (start); i--)
#define len(ar) (sizeof(ar) / sizeof(ar[0]))

int main() {
  int N, K, a[50];
  cin >> N >> K;
  r(i, 0, N) { cin >> a[i]; }
  sort(a, a + N, greater<int>());

  int ans = 0;
  r(i, 0, K) ans += a[i];
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let s: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let mut res = vec![];
    for &c in &s {
        if c == '0' { res.push('0'); }
        if c == '1' { res.push('1'); }
        if c == 'B' { res.pop(); }
    }
    let ans = res.iter().map(|&c| c.to_string()).collect::<String>();

    println!("{}", ans);
}

Measured memory_bytes: 4352
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬╬╬██╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓▓█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<60
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define debug(x)  cout << #x << " = " << (x) << endl;
typedef pair<int,int> P;
typedef vector<vector<P>> Graph;

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

  int n,k;
  cin >> n >> k;

  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  sort(a.begin(),a.end());

  int ans = INF;
  REP(i,n){
    if(i+k-1 >= n) break;
    ans = min(ans,a[i+k-1]-a[i]);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = Integer.parseInt(scanner.nextLine());
        int b = Integer.parseInt(scanner.nextLine());
        int h = Integer.parseInt(scanner.nextLine());
        System.out.println((a + b) * h / 2);
    }
}


Measured memory_bytes: 21716
n,m,p=map(int,input().split())
b=list(map(int,input().split()))
a=[]
c=0
d=0
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(n):
    for j in range(m):
        c+=a[i][j]*b[j]
    if c+p>0:
        d+=1
    c=0
    
print(d)


Measured memory_bytes: 3060
def main():
    w, a, b = map(int, input().split())

    rt = 0
    if a + w < b:
        rt = abs(a + w - b)
    elif b + w < a:
        rt = abs(b + w - a)
    else:
        rt = 0

    print(rt)


if __name__ == "__main__":

    main()


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
	cout<<"1407 38"<<endl;
	int t=2;
	rep(i,38){
		cout<<1<<" ";rep(j,37){
			cout<<t<<" ";
			t++;
		}
		cout<<endl;
	}		
	rep(i,37){rep(j,37){
			cout<<i+2<<" ";
			rep(l,37)cout<<2+37*(l+1)+(j+i*l)%37<<" ";
			cout<<endl;
		}	
	}	
}

Measured memory_bytes: 3568
////////////////////////////////////
///     Please Give Me AC!!!     ///
////////////////////////////////////

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    string S; cin>> S;
    if(S[S.size() - 1] == 's'){
        cout<< S << "es" << endl;
    }else{
        cout<< S << 's' << endl;
    }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(); cout.tie();
    int n, k = 0, h;
    cin >> n >> h;
    for (int i = 0; i < n; i++){
        int inp;
        cin >> inp;
        if (inp >= h)
            k++;
    }
    cout << k << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main {
    static double[][][] dp;
    static double recurse(int cnt1, int cnt2, int cnt3, int n) {
        if(cnt1<0 || cnt2<0 || cnt3<0)
            return 0;
        if(cnt1==0 && cnt2==0 && cnt3==0)
            return 0;
        if(dp[cnt1][cnt2][cnt3]>0)
            return dp[cnt1][cnt2][cnt3];
        double expectedValue = n + cnt1*recurse(cnt1-1, cnt2, cnt3, n) +
                               cnt2*recurse(cnt1+1, cnt2-1, cnt3, n) +
                               cnt3*recurse(cnt1, cnt2+1, cnt3-1, n);
        dp[cnt1][cnt2][cnt3] = expectedValue/(cnt1+cnt2+cnt3);
        return dp[cnt1][cnt2][cnt3];
    }
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] c = new int[3];
        for(int i = 0; i<n; i++) {
            int x = sc.nextInt()-1;
            c[x]++;
        }
        dp = new double[301][301][301];
        for(double[][] i: dp)
            for(double[] j: i)
                Arrays.fill(j, -1);
        System.out.println(recurse(c[0], c[1], c[2], n));
    }
}

Measured memory_bytes: 306388
#include <iostream>
#include <vector>
//#include <algorightm>
#include <map>
#include <tuple>
//#include <cstudio>

int main() {
    int N;
    std::cin >> N;
    int Num = N;
    int sum = 0;
    int dig;
    while (N){
        dig = N%10;
        sum +=dig;
        N/=10;
    }
    if (!(Num%sum)) {
        std::cout << "Yes" <<std::endl;
    }
    else{
        std::cout << "No" <<std::endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long int;
int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll ans1 = a * c;
    ll ans2 = b * d;
    ll ans3 = a * d;
    ll ans4 = b * c;
    cout << max(max(ans1,ans2),max(ans3,ans4));
    return 0;
}


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

using namespace std;

int main(int argc, const char** argv) {
  string s;

  int base = 'a';
  int id = 0;
  int app_num[26]={0};
  int check=0;

  cin >> s;

  for (size_t i = 0; i < s.size(); i++)
  {
    id = (char)s[i] - base;
    app_num[id]++;
  }

  for (size_t i = 0; i < 26; i++)
  {
    check += (app_num[i] % 2);
  }

  if (check==0)
  {
    cout << "Yes" << endl;
  } else
  {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
c=[list(map(int,input().split())) for i in range(10)]
a=[list(map(int,input().split())) for i in range(h)]

for i in range(10):
    for j in range(10):
        for k in range(10):
            c[j][k]=min(c[j][k],c[j][i]+c[i][k])
ans=0
for i in range(h):
    for j in range(w):
        if a[i][j]!=-1:
            ans+=c[a[i][j]][1]
print(ans)

Measured memory_bytes: 3316
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

int main() {
	int n;
	cin >> n;
	int a[100000];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int> v;
	for (int i = 0; i < n; i++) {
		if (v.size() == 0 || v[v.size() - 1] >= a[i]) {
			v.push_back(a[i]);
		} else {
			for (int j = 0; j < v.size(); j++) {
				if (v[j] < a[i]) {
					v[j] = a[i];
					break;
				}
			}
		}
	}
	cout << v.size() << endl;
}

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

int main(){
    int ans=0;
    int n;
    pair<int,int> edge,edger;
    map<pair<int,int>,int> e;
    cin >> n;

    if(n%2==1){

        for (int i = 1; i < n; i++){
            e[make_pair(n,i)]=1;
        }
        n--;
    }

    for (int i = n; i > 0; i--){
        for (int j = 1; j <= n; j++){
            if(j == n+1-i || i==j)continue;
            edge = make_pair(i,j);
            edger = make_pair(j,i);

            if(e.find(edge) == e.end() && e.find(edger) == e.end()){
                e[edge]=1;
            }
        }
    }
    

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << e.size() << endl;

    for (auto i =e.begin() ; i != e.end(); i++){
        cout << i->first.first << " " << i->first.second << endl;
    }
    

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u) {
	int v;
	color[u] = GRAY;
	d[u] = ++tt;
	for (v = 0; v < n; v++) {
		if (M[u][v] == 0)continue;
		if (color[v] == WHITE) {
			dfs_visit(v);
		}
	}
	color[u] = BLACK;
	f[u] = ++tt;
}
void dfs() {
	int u;
	for (u = 0; u < n; u++)color[u] = WHITE;
	tt = 0;
	for (u = 0; u < n; u++) {
		if (color[u] == WHITE)dfs_visit(u);
	}
	for (u = 0; u < n; u++) {
		cout << u + 1 << " " << d[u] << " " << f[u] << endl;
	}
}

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

	int u, v, k;
	cin >> n;
	memset(M, 0, sizeof(M));
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}
	dfs();
	return 0;
}


Measured memory_bytes: 3228
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

public class Main {
	static boolean debug = false;

	public static void main(String[] args) throws IOException {

		UserScanner scan = new UserScanner();
		PrintWriter pwriter = new PrintWriter(System.out);

		int n = scan.nextInt();
		int kw = scan.nextInt();
		Knap knap = new Knap(n);
		for (int i = 0; i < n; i++)
			knap.addItem(i, scan.nextInt(), scan.nextInt());
		pwriter.println(knap.getAnswer(kw));

		pwriter.flush();
		scan.close();
		System.exit(0);
	}
}

class Knap {
	int[] v, w;
	int[] hist;

	public Knap(int n) {
		v = new int[n];
		w = new int[n];
	}

	public int getAnswer(int kw) {
		hist = new int[kw + 1];
		for (int i = 0; i < hist.length; i++)
			hist[i] = -1;
		for(int w=0;w<kw;w++)
			getMaxValue(w);
		return getMaxValue(kw);
	}

	private int getMaxValue(int kw) {
		if (kw < 0)
			return Integer.MIN_VALUE / 2;
		if (kw == 0)
			return 0;
		if (hist[kw] >= 0)
			return hist[kw];
		int max = 0;
		for (int i = 0; i < v.length; i++) {
			int kv = v[i] + getMaxValue(kw - w[i]);
			if (max < kv)
				max = kv;
		}
		hist[kw] = max;
		return max;
	}

	public void addItem(int i, int v, int w) {
		this.v[i] = v;
		this.w[i] = w;
	}

}

class UserScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean read() throws IOException {
		ptr = 0;
		buflen = in.read(buffer);
		if (buflen <= 0)
			return false;
		else
			return true;
	}

	private byte getByte() throws IOException {
		if (ptr >= buflen)
			read();
		if (isCtlSpace(buffer[ptr])) {
			return -1;
		} else
			return buffer[ptr++];
	}

	private void skipCtlSpace() throws IOException {
		if (ptr >= buflen)
			read();
		if (isCtlSpace(buffer[ptr])) {
			ptr++;
			skipCtlSpace();
		}
	}

	private boolean isCtlSpace(byte b) {
		if (b <= ' ' || b > '~')
			return true;
		else
			return false;
	}

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

	public String next() throws IOException {
		skipCtlSpace();
		StringBuilder sb = new StringBuilder();
		byte b;
		while ((b = getByte()) != -1) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() throws IOException {
		skipCtlSpace();
		int n = 0;
		boolean minus = false;
		byte b;
		while ((b = getByte()) != -1) {
			if (b == '-')
				minus = true;
			else {
				n *= 10;
				n += (b - '0');
			}
		}
		if (minus)
			return n * -1;
		else
			return n;
	}
}

Measured memory_bytes: 25184
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

vector<int> a(4);
void dfs(string s, string& c){
    if(s.size()==3){
        int ans=a[0];
        if(s[0]=='+')ans+=a[1];
        else ans-=a[1];
        if(s[1]=='+')ans+=a[2];
        else ans-=a[2];
        if(s[2]=='+')ans+=a[3];
        else ans-=a[3];

        if(ans==7){
            c=s;
        }
        return;
    }


    dfs(s+'+',c);
    dfs(s+'-',c);
}

int main(void)
{
    REP(i, 4){
        char c;cin >> c;
        a[i] = c-'0';
    }
    string s,c;
    dfs(s,c);
    cout << a[0] << c[0] << a[1] << c[1] << a[2] << c[2] << a[3] << "=7" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
    
int main(void)
{
    int inSec;
    int hour;
    int minute;
    int second;
       
    scanf("%d",&inSec);
       
    hour = inSec / 3600;
    minute = (inSec - (hour * 3600) ) / 60;
    second = (inSec - (hour * 3600) ) % 60;
    
    printf("%d:%d:%d\n",hour,minute,second);
    
   return 0;
   
}

Measured memory_bytes: 592
#include <stdio.h>

int main(){
  
  int i,n[3],original;
  scanf("%d",&original);
  
  n[2] = original % 10;
  n[1] = (original % 100 - n[2]) / 10;
  n[0] = (original - n[2] - n[1] * 10) / 100;
  
  for(i = 0 ; i < 3 ; i++){
    if(n[i] == 1){
      n[i] = 9;
    }else if(n[i] == 9){
      n[i] = 1;
    }
  }
  
  for(i = 0 ; i < 3 ; i++){
    printf("%d",n[i]);
  }
  
  return 0;
  
}

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

int main(){
	int n;
	while(cin >> n , n){
		int cou = 0;
		string str[101];
		for(int i=0;i<n;i++){
			cin >> str[i];
			if(i % 2 == 1){
				if(str[i][1] == 'u' && str[i-1][1] == 'u') cou++;
				else if(str[i][1] == 'd' && str[i-1][1] == 'd') cou++;
			}

		}
		cout << cou << endl;
	}
}

Measured memory_bytes: 1204
# we collect the input A1 upto An.
# limit cannot exceed 10**18
# if N = 0 then ans = 0
# in N is in range then compute ans * A[n]
# else if  ans is greater than limit then display 1
# finally if length equal 1 then display -1
N = int(input())
ans = 1
limit = 10 ** 18
length = 0

A = list(map(int, input().split()))

A0 = set(A)
if 0 in A0:
    ans = 0
else:
    pass

for n in range(N):
    ans = ans * A[n]
    if ans == 0:
        break
    elif ans > limit:
        length = 1
        break
    else:
        pass

if length == 1:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 21524
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int n, div4, div2;
    string answer;
    div4 = 0;
    div2 = 0;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; ++i){
        cin >> a[i];
    }

    for (int i=0; i<n; ++i){
        if(a[i] % 4 == 0){
            div4++;
        }
        else if(a[i] % 2 == 0){
            div2++;
        }
    }
    if((div4 >= n / 2) || ((n - 2 * div4) <= div2)){
        answer = "Yes";
    }
    else {
        answer = "No";
    }
    cout << answer << endl;
}

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

int main(){
  int n,m;
  cin>>n>>m;
  vector <int>a(m),b(m);
  for (int i=0;i<m;i++) cin>>a.at(i)>>b.at(i);
  for(int p=0;p<n;p++){
    int sum=0;
    for (int i=0;i<m;i++){
      if((a.at(i)==p+1)||(b.at(i)==p+1))
        sum++;
    }
    cout<<sum<<endl;
  }
}

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

using namespace std;
const int N = 1e6 + 77 , Mod = 1e9 + 7;
int n , dp[N] , ps[N];
int main(){
	scanf("%d" , & n);ps[0] = 1;
	dp[1] = ps[1] = n ;ps[1]++;
	for(int i = 2;i <= n;i++){
		dp[i] = (dp[i - 1] * 1ll + (n - 1) * 1ll * (n - 1) + 1 + n - i) % Mod;
		if(i > 2)dp[i] = (dp[i] + ps[i - 3]) % Mod;
		ps[i] = (ps[i - 1] + dp[i]) % Mod;
	}
	printf("%d" , dp[n]);
	return (0);
}

Measured memory_bytes: 8064
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;

int main()
{
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='C')
        {
            for(int j=i+1;j<s.size();j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
from numpy import cumsum
from collections import Counter
N=int(input())
A=Counter(cumsum(list(map(int,input().split(' ')))))
ans = 0
zeros = 0
for k,v in A.items():
    if k!=0:
        ans += v*(v-1)//2
    else:
        ans += v+v*(v-1)//2
print(ans)

Measured memory_bytes: 38064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    char c;
    cin >> c;
    if ('a' <= c && c <= 'z')
        cout << 'a' << endl;
    else
        cout << 'A' << endl;
}

Measured memory_bytes: 3632
n,m= list(map(int, input().split()))
num=[0 for i in range(n)]
for i in range(m):
    tmp=list(map(int,input().split()))
    if tmp[0]==1 and tmp[1]==0 and len(num)!=1:
        print("-1")
        exit(0)
    if num[tmp[0]-1]!=0 and num[tmp[0]-1]!=tmp[1]:
        print("-1")
        exit(0)
    num[tmp[0]-1] = tmp[1]

if num[0]==0 and len(num)!=1:
    num[0] =1
for i in range(n-1):
    print(num[i],end="")
print(num[n-1])

Measured memory_bytes: 3064
// 173

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>
#include <string>
#include <cmath>

using namespace std;
using ll = long long int;
#define NUM 1000000007

int main(){
    int n, ans=0;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++){
        cin >> v.at(i);
    }
    sort(v.begin(), v.end());
    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            for(int k=j+1; k<n; k++){
                if(v.at(i) == v.at(j) || v.at(i) == v.at(k) || v.at(j) == v.at(k) || v.at(i)+v.at(j) <= v.at(k)) continue;
                else ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<deque>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
#define WHITE 0
#define BLACK 1
typedef long long ll;
typedef pair<ll,ll> pl;
typedef pair<int,int> pi;
int INFi=1000000000;
ll INFl=1000000000000000;

struct UnionFind{
    vector<int> par;//初期化
    vector<int> rank;//高さ
    UnionFind(int n=0):par(n),rank(n,0){
        for(int i=0;i<n;i++) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);//経路圧縮
    }
    void unite(int x,int y){
        int rx=root(x);
        int ry=root(y);
        if(rx==ry) return;
        if(rank[rx]<rank[ry]) rank[rx]=ry;
        else rank[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
        }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};

int main(){
    vector<int> v(3);
    cin>>v[0]>>v[1]>>v[2];
    cout<<*min_element(v.begin(),v.end())<<' '<<*max_element(v.begin(),v.end())<<endl;
}


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

int main() {
    int r, d, x;
    cin >> r >> d >> x;
    rep(i, 10) {
        x = r * x - d;
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int x;
    int s, e, m;
    
    scanf("%d", &x);
    s = 1;
    e = 1e5;
    while(s < e) {
        m = (s + e) / 2;
        if((long long)m * (m + 1) / 2 < x) s = m + 1;
        else e = m;
    }
    printf("%d", s);
    return 0;
}

Measured memory_bytes: 128
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define swap(p,q) r=(p);(p)=(q);(q)=r
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;

struct drink_t {
	ll int num;
	ll int cost;
} ;

int compare_cost(const void *a, const void *b) {
	struct drink_t *A = (struct drink_t *)a;
	struct drink_t *B = (struct drink_t *)b;
	if(A->cost - B->cost >0){
		return 1;
	}else if(A->cost - B->cost >0){
		return -1;
	}else{
		return 0;
	}
}


int main(void)
{
	//変数の宣言
	int n,m;
	static struct drink_t drink[100010];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	ll int ans=0;
	int count=0;
	ll int temp,temp1,temp2;
	int max,min;
	int len;
	int sum=0;
	int ok,ng;



	//データの読み込み


	scanf("%d %d",&n,&m);
//	scanf_s("%d %d",&n,&m);

	for(i=0;i<n;i++){
		scanf("%lld %lld",&drink[i].cost,&drink[i].num);
//		scanf_s("%lld %lld",&drink[i].cost,&drink[i].num);

	}

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	qsort(drink,n,sizeof(drink_t),compare_cost);

	temp=0;
	for(i=0;i<n;i++){
		if(temp+drink[i].num<m){
			temp=temp+drink[i].num;
			ans=ans+drink[i].cost*drink[i].num;
		}else{
			ans=ans+drink[i].cost*(m-temp);
			break;
		}
	}

	//	printf("計算部分終了\n");

	//出力


	printf("%lld",ans);


	//	printf("結果の出力終了\n");


	return 0;
}



Measured memory_bytes: 3324
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


a, b, c = LI()
if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)


Measured memory_bytes: 3060
package main

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

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n,_ = strconv.Atoi(NextLine())
  return n
}
func NextIntIntMap() map[int]int {
  var s []string = strings.Split(NextLine()," ")
  var n,a int
  n = len(s)
  m := map[int]int{}
  for i:=0;i<n;i++ {
    a,_ = strconv.Atoi(s[i])
    m[a]++
  }
  return m
}

func main() {
  var n int
  n = NextInt()
  a := NextIntIntMap()
  b := Entries{}
  for key,val := range a {
    e := Entry{key,val}
    b = append(b,e)
  }
  sort.Sort(sort.Reverse(b))
  n = 0
  for i:=0;i<b.Len();i++ {
    var k int = b[i].key
    var v int = b[i].val
    v += a[k-1] + a[k+1]
    if n < v { n = v }
  }
  fmt.Println(n)
}
type Entry struct {
  key int
  val int
}
type Entries []Entry
func(entries Entries) Len() int {
  return len(entries)
}
func(entries Entries) Swap(i,j int) {
  entries[i],entries[j] = entries[j],entries[i]
}
func(entries Entries) Less(i,j int) bool {
  if entries[i].val == entries[j].val {
    return entries[i].key < entries[j].key
  } else {
    return entries[i].val < entries[j].val
  }
}

Measured memory_bytes: 12416
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main() {
	double r;
	cin >> r;
	cout << fixed;
	cout << setprecision(6);
	cout << r * r * M_PI << " " << 2 * r * M_PI << endl;
}


Measured memory_bytes: 3264
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, M) = Slice2<long>();
            var from1toN = new HashSet<long>();
            for (var i = 0; i < M; ++i)
            {
                var (a, b) = Slice2<long>();
                if (a == 1)
                {
                    if (from1toN.Contains(b))
                    {
                        WriteLine("POSSIBLE");
                        return;
                    }
                    from1toN.Add(b);
                }
                if (b == N)
                {
                    if (from1toN.Contains(a))
                    {
                        WriteLine("POSSIBLE");
                        return;
                    }
                    from1toN.Add(a);
                }
            }
            WriteLine("IMPOSSIBLE");
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 54800
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
      	int l = sc.nextInt() + sc.nextInt();
      	int r = sc.nextInt() + sc.nextInt();
        if(l > r){
          System.out.println("Left");
        }else if (l < r){
          System.out.println("Right");
        }else{
       		System.out.println("Balanced");
        }
            
    }
}


Measured memory_bytes: 35736