akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int get_line(char line[]);

int main(void)
{
    int i;

    char line[100];
    int len = get_line(line);

    for (i = 0; i < len; i++) {
        if ('a' <= line[i] && line[i] <= 'z') {
            line[i] = toupper(line[i]);
        }
    }

    printf("%s\n", line);

    return 0;
}

int get_line(char line[])
{
    int i = 0;
    char c;

    while ((c = getchar()) != '\n' && c != EOF) {
        line[i++] = c;
    }
    line[i] = '\0';

    return i;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n;
    cin >> n;
    vector<lint> x(n);
    repeat(i, n) cin >> x[i];
    
    auto to_positive = [](lint n) -> lint {
        return (n <= 0 ? 1 - n : 0);
    };
    auto to_negative = [](lint n) -> lint {
        return (n >= 0 ? n + 1 : 0);
    };
    
    lint pans = to_positive(x[0]);
    lint nans = to_negative(x[0]);
    lint psum = x[0], nsum = x[0];
    psum = max(psum, 1LL);
    nsum = min(nsum, -1LL);
    
    repeat_from(i, 1, n) {
        bool makepositive = (psum < 0 ? true : false);
        //dump(psum); dump(pans); dump(nsum); dump(nans); cout << boolalpha; dump(makepositive); cout << endl;
        psum += x[i];
        nsum += x[i];
        if (makepositive) {
            pans += to_positive(psum), psum = max(psum, 1LL);
            nans += to_negative(nsum), nsum = min(nsum, -1LL);
        }
        else {
            pans += to_negative(psum), psum = min(psum, -1LL);
            nans += to_positive(nsum), nsum = max(nsum, 1LL);
        }
    }
    cout << min(pans, nans) << endl;        
    return 0;
}

Measured memory_bytes: 1024
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];
vi v[N];

int solve() 
{
	//happy coding

	int n,m;
	cin>>n>>m;

	while(m--){
		int a,b;
		cin>>a>>b;
		--a;--b;
		v[a].pb(b);
		v[b].pb(a);
	}
	vi vis(n,-1);
	vis[0] = 0;
	queue<int>q;
	q.push(0);
	while(q.size()){
		int x = q.front();
		q.pop();
		for(auto u: v[x]){
			if(vis[u]<0){
				vis[u] = x;
				q.push(u);
			}
		}
	}

	for(int i=1;i<n;i++){
		if(vis[i]<0){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	for(int i=1;i<n;i++){
		cout<<vis[i]+1<<endl;
	}

	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

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

int main() {
  char c;
  cin >> c;
  
  if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  float t,a,h,b;
  int n,ans=1;
  scanf("%d",&n);
  scanf("%f %f",&t,&a);
  scanf("%f",&h);
  b=t-0.006*h;
  for(int i=2;i<=n;i++){
    scanf("%f",&h);
    if(fabs(a-b)>fabs(a-(t-0.006*h))){
      ans=i;
      b=t-0.006*h;
    }
  }
  printf("%d\n",ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define ld long double
#define MOD 1000000007
#define nl cout << bl
#define rt ll Q[100005] = {0}
#define mp make_pair
#define test() \
    ull t;     \
    cin >> t;  \
    while (t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define s(ar, n) sort(ar, ar + n)
#define rs(ar, n) sort(ar, ar + n, greater<ll>())
#define oa(a, n)               \
    for (ll i = 0; i < n; i++) \
        cout << a[i] << " ";
#define cn(a, n)               \
    for (ll i = 0; i < n; i++) \
        cin >> a[i];
#define ov(a, n)                    \
    for (ll i = n - 1; i >= 0; i--) \
        cout << a[i] << " ";        \
    nl
#define ovp(a, n)              \
    for (ll i = 0; i < n; i++) \
        cout << a[i].ff << " " << a[i].ss << bl;
#define maxa(ar, N) *max_element(ar, ar + N)
#define mina(ar, N) *min_element(ar, ar + N)
#define present(c, x) ((c).find(x) != (c).end())
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
typedef pair<int, int> pii;
ll fast_exp(ll base, ll exp)
{
    ll res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res % MOD;
}
ll fib(ll n)
{
    if (n < 2)
        return n;
    ll a = 0, b = 1, pre;
    int i = 1;
    while (i < n)
    {
        pre = (a + b) % MOD;
        a = b;
        b = pre;
        i++;
    }
    return pre;
}
ll fac(ll n)
{
    if (n % 2 == 0)
        return 2;

    for (ll i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
            return i;
    }

    return n;
}
ll fact(ll n)
{
    if (n > 1)
        return n * fact(n - 1);
    else
        return 1;
}
bool sortbysec(const tuple<int, int, int> &a,
               const tuple<int, int, int> &b)
{
    return (get<1>(a) < get<1>(b));
}
int last_digit(int n)
{
    int ans = 0;
    while (n != 0)
    {
        ans = n % 10;
        n /= 10;
    }
    return ans;
}
long long moduloMultiplication(long long a,
                               long long b,
                               long long mod)
{
    long long res = 0; // Initialize result

    // Update a if it is more than
    // or equal to mod
    a %= mod;

    while (b)
    {
        // If b is odd, add a with result
        if (b & 1)
            res = (res + a) % mod;

        // Here we assume that doing 2*a
        // doesn't cause overflow
        a = (2 * a) % mod;

        b >>= 1; // b = b / 2
    }

    return res;
}
int main()
{
    int S;
    cin >> S;
    vector<int> a;
    for (int i = 3; i <= S; i++)
    {
        a.pb(i);
    }
    vector<int> dp(S + 1, 0);
    dp[0] = 1;
    for (int i = 0; i <= S; i++)
    {
        for (int j = 0; j < (int)a.size(); j++)
        {
            if (i >= a[j])
            {
                dp[i] += dp[i - a[j]];
                dp[i] %= MOD;
            }
        }
    }
    cout << dp[S] << "\n";
}


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

using ll = long long;

class union_find {
public:
    union_find(int n) : par(n, -1) {}

    int root(int x) {
        return par[x] < 0 ? x : par[x] = root(par[x]);
    }

    bool unite(int x, int y) {
        x = root(x), y = root(y);
        if(x == y) return false;
        if(par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

private:
    vector<int> par;
};

struct edge {
    int u, v, cost;
    edge(int u_, int v_, int cost_) : u(u_), v(v_), cost(cost_) {}
    bool operator<(edge const& that) const {
        return cost < that.cost;
    }
};

int main() {
    int n, m, k; cin >> n >> m >> k;
    vector<int> c(n);
    union_find uf(2 * n);
    {
        int iter = n;
        for(int i = 0; i < n; ++i) {
            cin >> c[i];
            if(c[i] == 0) {
                c[i] = iter++;
            }
        }
    }
    vector<edge> es;
    for(int i = 0; i < m; ++i) {
        int u, v, w; cin >> u >> v >> w;
        es.emplace_back(c[u - 1], c[v - 1], w);
    }
    sort(begin(es), end(es));

    int used = 0;
    ll ans = 0;
    for(int i = 0; i < m && used < k - 1; ++i) {
        if(uf.unite(es[i].u, es[i].v)) {
            used += 1;
            ans += es[i].cost;
        }
    }

    if(used != k - 1) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
}


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(void){
    int i,a,b,c,k;
    scanf("%d %d %d %d",&a,&b,&c,&k);
    if(k<=a){
        printf("%d",k);
        return 0;
    }
    else if(k<=a+b){
        printf("%d",a);
        return 0;
    }
    printf("%d",2*a+b-k);
    return 0;
}

Measured memory_bytes: 1728
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	int s, t, u, n, o, d;
	int[] e, c, h, a;

	void run() {
		Scanner sc = new Scanner(System.in);
		s = sc.nextInt(); t = sc.nextInt(); u = sc.nextInt(); n = sc.nextInt(); o = sc.nextInt(); d = sc.nextInt();
		e = new int[t]; c = new int[t]; h = new int[n]; a = new int[n];
		
		for (int i=0;i<t;i++) {
			e[i] = sc.nextInt(); c[i] = sc.nextInt();
		}
		
		for (int i=0;i<n;i++) {
			h[i] = sc.nextInt(); a[i] = sc.nextInt();
		}
		
		int[][] stamina = new int[s+1][u+1];
		for (int[] a : stamina) fill(a, -1);
		stamina[0][0] = 0;
		
		for (int l=0;l<t;l++) for (int j=s-e[l];j>=0;j--) for (int k=0;k<u;k++) if (stamina[j][k] >= 0){
			stamina[j+e[l]][k+1] = max(stamina[j+e[l]][k+1], stamina[j][k] + c[l]);
		}
//		for (int[] a: stamina) debug(a);
		int max_cal = 0;
		for (int i=0;i<=s;i++) max_cal = max(max_cal, stamina[i][u]);
		int cal = max_cal;
		int[] happy = new int[cal+1];
		fill(happy, -1); happy[0] = 0;
		
		for (int j=0;j<=cal;j++) for (int i=0;i<n;i++) if (j+a[i] <= cal){
			happy[j+a[i]] = max(happy[j+a[i]], happy[j] + h[i]);
			happy[j+1] = max(happy[j+1], happy[j]);
		}
		
//		debug(happy);
		
		int[][] dp = new int[2][s+1];
		fill(dp[0], -1); dp[0][s] = 0;
		int x = 0;
		for (int i=0;i<d;i++) {
			fill(dp[1-x], -1);
			for (int j=0;j<=s;j++) if (dp[x][j] >= 0){
				for (int k=0;k<=j;k++) if (stamina[k][u] >= 0){
					dp[1-x][min(s, j-k+o)] = max(dp[1-x][min(s, j-k+o)], dp[x][j] + happy[stamina[k][u]]);
				}
			}
//			debug(dp[1-x]);
			x = 1 - x;
		}
		
		int ret = -1;
		for (int i=0;i<=s;i++) ret = max(ret, dp[x][i]);
		
		System.out.println(ret);
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 23428
#include<stdio.h>
#include<algorithm>
using namespace std;
int a[3];
int main()
{
    for(int i=0;i<3;i++)
    {
         scanf("%d",&a[i]);
    }
    sort(a,a+3);
    printf("%d\n",a[0]+a[1]);
   return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int i,n,b,f,r,v;
	int b1[10] = { 0 };
	int b2[10] = { 0 };
	int b3[10] = { 0 };
	int b4[10] = { 0 };
	int b5[10] = { 0 };
	int b6[10] = { 0 };
	int b7[10] = { 0 };
	int b8[10] = { 0 };
	int b9[10] = { 0 };
	int b10[10] = { 0 };
	int b11[10] = { 0 };
	int b12[10] = { 0 };

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

		if (b == 1) {
			switch (f) {
			case 1:
				b1[r-1] += v;
				break;
			case 2:
				b2[r-1] += v;
				break;
			case 3:
				b3[r-1] += v;
				break;
			}
		}
		else if (b == 2) {
			switch (f) {
			case 1:
				b4[r-1] += v;
				break;
			case 2:
				b5[r-1] += v;
				break;
			case 3:
				b6[r-1] += v;
				break;
			}
		}
		else if (b == 3) {
			switch (f) {
			case 1:
				b7[r-1] += v;
				break;
			case 2:
				b8[r-1] += v;
				break;
			case 3:
				b9[r-1] += v;
				break;
			}
		}
		else if (b == 4) {
			switch (f) {
			case 1:
				b10[r-1] += v;
				break;
			case 2:
				b11[r-1] += v;
				break;
			case 3:
				b12[r-1] += v;
				break;
			}
		}
	}
		for (i = 0; i < 10; i++) {
			printf(" %d", b1[i]);
		}
		printf("\n");

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

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

		printf("####################\n");

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

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

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

		printf("####################\n");

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

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

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

		printf("####################\n");

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

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

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

	return 0;
}


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

using namespace std;

const int N=2e5;
long long a[N+2],sum[N+2];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int i,n;
    long long x,ans=0,mod=1e9+7;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        cin >> a[i];
        sum[i]=(sum[i-1]+a[i])%mod;
    }
    for(i=1;i<n;i++)
    {
        x=(sum[n]-sum[i]+mod)%mod;
        ans+=x*a[i];
        ans%=mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 6672
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var items = Console.ReadLine().Split().ToArray();
            var A = decimal.Parse(items[0]);
            var B = (decimal)(double.Parse(items[1]) * 100);
            var answer = (A * B).ToString("000");
            Console.WriteLine(answer.Substring(0, answer.Length - 2));
        }
    }
}


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

def  DigitsSum(n):
    s = 0
    while True:
        if n // 10 != 0:
            s += n % 10
            n = n // 10
        else:
            s += n
            break
    return s

S = 0

for i in range(1,int(N/2)+1):
    A = i
    B = N - i
    if S == 0 :
        S = DigitsSum(A)+DigitsSum(B)
    else:
        if S > DigitsSum(A)+DigitsSum(B):
            S = DigitsSum(A)+DigitsSum(B)
        else:
            continue

print(S)


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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);


int main(){
  fastIO;
  ll n;
  ll a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  --n;
  ll x = max(b-a,a-b);
  ll j;
  ll li, ri;
  ll lj, rj;
  for(ll i = 0 ; i <= n ; i ++ ){
    j = n - i;
    li = i * c;
    ri = i * d;
    lj = j * c;
    rj = j * d;
    if(x >= li - rj && x <= ri - lj){
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define bitcnt(a) (ll) __builtin_popcount((a))
using namespace std;
typedef long long ll;
ll N /*値*/;
bool prime[114514];
void eratosthenes() {
  REP(i, N) prime[i] = 1;
  prime[0] = prime[1] = 0;
  REP(i, N) {
    if (prime[i]) {
      for (int j = i + i; j < N; j += i) {
        prime[j] = 0;
      }
    }
  }
}

int main() {
  N = 55556;
  ll n;
  cin >> n;
  eratosthenes();
  vector<ll> v;
  ll cnt = 0;
  REP(i, N) {
    if (i % 5 == 1 && prime[i] == 1) {
      v.pb(i);
      cnt++;
      if (cnt == n)
        break;
    }
  }
  REP(i, cnt) {
    if (i)
      cout << " ";
    cout << v[i];
  }
  cout << endl;
}


Measured memory_bytes: 256
import java.util.*
import java.math.*

fun main(args: Array<String>) {

    var (N, M) = readLine()!!.split(" ").map { it.toInt() }
//    var N = readLine()!!.toLong()
//    val S = readLine()!!
//    val D = readLine()!!.split(" ").map { it.toLong() }
    val A = readLine()!!.split(" ").map { it.toLong() }.toLongArray()
    val mod = 1000000007L

    A.sort()
    A.reverse()
    val BC = mutableMapOf<Long,Long>()
    for (i in 0 until M) {
        var (B, C) = readLine()!!.split(" ").map { it.toLong() }
        BC[C] = B + (BC[C]?:0)
    }

    val list = BC.toList().sortedBy { -it.first }

    var ans = mutableListOf<Long>()

    var a = 0
    var l = 0
    var sc = 0L

    while (ans.size < N) {
        var ad = 0L
        if (l >= list.size || A[a] >= list[l].first) {
            ad = A[a]
            a++
        }else {
            ad = list[l].first
            sc++
            if (list[l].second == sc) {
                l++
                sc = 0
            }
        }
        ans.add(ad)
    }

    print(ans.sum())
}

Measured memory_bytes: 115400
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:usize,
    b:usize,
    c:usize,
    }
    let mut ans:usize=c;
    for i in 0..10 {
        ans=ans*a-b;
        println!("{}",ans);
    }
}

Measured memory_bytes: 2080
n = int(input())
a = list(map(int,input().split()))
ans = ""

lis = [a[0]] + [0] * (n-1)
fo = 1
be = -1

if n % 2 == 0:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:

            lis[be] = a[i]
            be -= 1
            #ans = str(a[i])+" "+ans

        else:

            lis[fo] = a[i]
            fo += 1
            #ans = ans+" "+ str(a[i])


else:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:
            
            lis[fo] = a[i]
            fo += 1
            #ans = str(a[i])+" "+ans

        else:
            
            lis[be] = a[i]
            be -= 1
            #ans = ans+" "+ str(a[i])

            
for i in range(n):

        i -= n//2

        ans += str(lis[i]) + " "


#print(lis)
print(ans)


Measured memory_bytes: 25744
#include <bits/stdc++.h>
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define rep(i,a,b) for(int i = a;i < b; ++i)
using namespace std;

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

int main(){
	cin.tie(0);	
	cout.tie(0);	
	ios_base::sync_with_stdio(0);
	ll a,b,k;
	cin >> a >> b >> k;
	ll del = min(a,k);
	a-=del;
	k-=del;
	del = min(b,k);
	b-=del;
	cout << a << ' ' << b << '\n';
}


Measured memory_bytes: 256
#include  <iostream>
using namespace std;
int main(){
    int N, n;
    cin >> N;
    int F[N][10];
    int P[N][10];

    for( int i = 0; i < N; ++i ){
        for ( int j = 0; j < 10; ++j ){
            cin >> F[i][j];
            }
    }
    for( int i = 0; i < N; ++i ){
        for ( int j = 0; j < 11; ++j ){
            cin >> P[i][j];
            }
    }
    
    int max = -(1 << 30);
    for (int bin = 1; bin < (1<<10); ++bin){
        int sum = 0;
        for( int i = 0; i < N; ++i ){
            int count = 0;
            for ( int j = 0; j < 10; ++j ){
                if ((bin >> j & 1) && F[i][j]) ++count;
            }
            sum += P[i][count];
         }
        if (max < sum) max = sum;
    }
    cout << max << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
			int n=scan.nextInt();
			int m=scan.nextInt();
			int l=scan.nextInt();
			long a[][] =new long[100][100];
			long b[][] =new long[100][100];
			long c[][] = new long[100][100];
			for(int i=0;i<n;i++) {
				for(int j=0;j<m;j++) {
					a[i][j]=scan.nextInt();
				}
			}
			for(int i=0;i<m;i++) {
				for(int j=0;j<l;j++) {
					b[i][j]=scan.nextInt();
				}
			}
			for(int i=0;i<n;i++) {
				for(int j=0;j<l;j++) {
					for(int k=0;k<m;k++) {
						c[i][j] += a[i][k] * b[k][j];
					}
				}
			}
			for(int i=0;i<n;i++) { 
				for(int j=0;j<l-1;j++) {
					System.out.print(c[i][j]+" ");
				}
				System.out.println(c[i][l-1]);
			}
		scan.close();
}
}


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


int main(){
    int64_t X,Y;
    cin >> X >> Y;

    if((4*X-Y) % 2 == 0 && 4*X-Y >= 0 && Y-2*X >= 0 && (Y-2*X) % 2 == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

bool vis[2010][2010];

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

	int w, h;
	while(cin >> w >> h, w) {
		int n;
		cin >> n;
		int x1[1000], y1[1000], x2[1000], y2[1000];
		map<int, int> xm, ym;
		xm[0] = ym[0] = -1;
		xm[w - 1] = -1;
		ym[h - 1] = -1;
		for(int i = 0; i < n; i++) {
			cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
			x2[i]--, y2[i]--;
			for(int d = -1; d <= 1; d++) {
				if(0 <= x1[i] + d && x1[i] + d < w) xm[x1[i] + d] = -1;
				if(0 <= x2[i] + d && x2[i] + d < w) xm[x2[i] + d] = -1;
				if(0 <= y1[i] + d && y1[i] + d < h) ym[y1[i] + d] = -1;
				if(0 <= y2[i] + d && y2[i] + d < h) ym[y2[i] + d] = -1;
			}
		}

		int xc = 0, yc = 0;
		for(auto v : xm) {
			xm[v.first] = xc++;
		}
		for(auto v : ym) {
			ym[v.first] = yc++;
		}

		memset(vis, 0, sizeof vis);
		for(int i = 0; i < n; i++) {
			x1[i] = xm[x1[i]];
			x2[i] = xm[x2[i]];
			y1[i] = ym[y1[i]];
			y2[i] = ym[y2[i]];
			for(int y = y1[i]; y <= y2[i]; y++) {
				for(int x = x1[i]; x <= x2[i]; x++) {
					vis[y][x] = 1;
				}
			}
		}

		int ans = 0;
		for(int i = 0; i < yc; i++) {
			for(int j = 0; j < xc; j++) {
				if(vis[i][j]) continue;
				ans++;
				vis[i][j] = 1;
				queue<P> q;
				q.push({ j, i });
				int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
				while(q.size()) {
					int x = q.front().first, y = q.front().second;
					q.pop();
					for(int k = 0; k < 4; k++) {
						int nx = x + dx[k], ny = y + dy[k];
						if(0 <= nx && nx < xc && 0 <= ny && ny < yc && !vis[ny][nx]) {
							vis[ny][nx] = 1;
							q.push({ nx, ny });
						}
					}
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 7164
s = int(input())
mod = 10 ** 9 + 7
dp = [0 for i in range(s + 1)]
dp[0] = 1

for i in range(0, s + 1):
    for j in range(0, (i - 3) + 1):
        dp[i] += dp[j]
        dp[i] = dp[i] % mod 

ans = dp[s]
print(ans)

Measured memory_bytes: 9208
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <map>
#include <utility>
#include <queue>
#define ull unsigned long long
#define ll long long
#define mod 998244353
using namespace std;

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

    int h[n];
    for (int i=0;i<n;i++) cin>>h[i];

    if ( n == 1 ){
        cout<<"Yes";
        return 0;
    }

    for (int i=1;i<n;i++){
        if ( h[i-1] > h[i] ){
            if ( h[i-1] - h[i] >= 2 ){
                cout<<"No";
                return 0;
            }
            else{
                h[i]++;
            }
        }
    }

    cout<<"Yes"<<endl;
    return 0;
}


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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
			while (true) {
				int n = sc.nextInt();
				int r = sc.nextInt();
				if (n == 0 && r == 0) {
					break;
				}
				int[] numbers = new int[n];
				for (int i = 0; i < numbers.length; i++ ) {
					numbers[i] = i + 1;
				}
				int[] p = new int[r];
				int[] c = new int[r];
				for (int i = 0; i < p.length; i++) {
					p[i] = sc.nextInt();
					c[i] = sc.nextInt();
						int[] cp = new int[p[i] - 1];
						for (int j = 0; j < cp.length; j++) {
							cp[j] = numbers[n - 1 - j];
						}
						for (int j = 0; j < c[i]; j++) {
							numbers[n - 1 - j] = numbers[n - p[i] - j];
						}
						for (int j = 0; j < cp.length; j++) {
							numbers[n - c[i] - 1 - j] = cp[j];
						} 
				}
				System.out.println(numbers[n - 1]);
			}
		}
	}

}


Measured memory_bytes: 37016
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	
	Scanner sc = new Scanner(System.in);
	public void run() {
			int m = sc.nextInt();
			sc.nextLine();
			calc(m);
	}
	public void calc(int m){
		for(int i = 0; i < m; i++){
			String line = sc.nextLine();
			calc2(line);
		}
	}

	public void calc2(String line){
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		map.put(line, 1);
		int ans = 1;
		for(int i = 1; i < line.length(); i++){
			String saki = line.substring(0,i);
			String ato = line.substring(i);
			String revSaki = reverse(saki);
			String revAto = reverse(ato);
			
			String s = saki + revAto;
			if(!map.containsKey(s)){
				map.put(s, 1);
				ans++;
			}
			s = revSaki + ato;
			if(!map.containsKey(s)){
				map.put(s, 1);
				ans++;
			}
			s = revSaki + revAto;
			if(!map.containsKey(s)){
				map.put(s, 1);
				ans++;
			}
			s = ato + saki;
			if(!map.containsKey(s)){
				map.put(s, 1);
				ans++;
			}
			s = revAto + saki;
			if(!map.containsKey(s)){
				map.put(s, 1);
				ans++;
			}
			s = ato + revSaki;
			if(!map.containsKey(s)){
				map.put(s, 1);
				ans++;
			}
			s = revAto + revSaki;
			if(!map.containsKey(s)){
				map.put(s, 1);
				ans++;
			}
		}
		System.out.println(ans);
	}
	public String reverse(String s){
		if(s.length() == 1) return s;
		else return reverse(s.substring(1)) + s.substring(0,1);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 90512
#include <bits/stdc++.h>
using namespace std;
int main()
{	
	int h,w,x=0;
	char str[60][60];
	cin >> h >> w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> str[i][j];
		}
	}
	for(int k=0;k<h;k++){
		for(int m=0;m<w;m++){
			if(str[k][m]=='#'){
				if(str[k-1][m]!='#' && str[k][m-1]!='#' && str[k][m+1]!='#' && str[k+1][m]!='#'){
					x++;
				}
			}
		}
	}
	if(x==0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int y,m,d;
  string g;
  while(cin>>g&&g!="#"){
    cin>>y>>m>>d;
    if(y==31&&m>=5){
      g='?'; y-=30;
    }
    if(y>31){
      g='?'; y-=30;
    }
    cout<<g<<" "<<y<<" "<<m<<" "<<d<<endl;
  }
  return 0;
}



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

int main(){
    int n;
    cin >> n;
    ll ans = 1;
    vector<ll> A(n);
    for(int i = 0; i < n; i++){
        ll a;
        cin >> a;
        if(a == 0){
            cout << 0;
            return 0;
        }
        A[i] = a;
    }
    for(int i = 0; i < n; i++){
        if(ans > 1000000000000000000/A[i]){
            cout << -1 << endl;
            return 0;
        }
        ans *= A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4060
#include <bits/stdc++.h>
using namespace std;
int main() 
{
ios_base::sync_with_stdio(false);
cout.tie(0);
cin.tie(NULL);
  int n; cin>>n;
  int a[n],b[n],c[n];
  for(int i=0;i<n;i++)
  cin>>a[i]>>b[i]>>c[i];
  int A=a[0],B=b[0],C=c[0];
  int a1,b1,c1;
  for(int i=1;i<n;i++)
  {
  	a1=max(B,C)+a[i];
  	b1=max(A,C)+b[i];
  	c1=max(A,B)+c[i];
  	A=a1; B=b1; C=c1;
  }
  cout<<max(A,max(B,C));
}

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

int main(){
    ll a;
    double b;
    cin >> a >> b;
    ll ib = b*100+0.5;
    a *= ib;
    a /= 100;
    printf("%lld\n",a);
    return 0;
}

Measured memory_bytes: 3816
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int n;

int main() {
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    REP(i, n){
        cin >> a[i] >> b[i] >> c[i];
    }
    vector<vector<int>> dp(n+1,vector<int>(3,0));
    REP(i,n){
        dp[i+1][0]=max(dp[i][1],dp[i][2])+a[i];
        dp[i+1][1]=max(dp[i][0],dp[i][2])+b[i];
        dp[i+1][2]=max(dp[i][0],dp[i][1])+c[i];
    }
    put(*max_element(dp[n].begin(), dp[n].end()));
    return 0;
}




Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
typedef pair<int,int>pii;
const int mxN=1e5+10;
int n,m,start=1,dist[mxN],a,b,tot,vis[mxN];
int dp[mxN];
vector<int>adj[mxN];
int solve(int u=1){
    if(dp[u]>=0)return dp[u];
    int temp=0;
    for(int v:adj[u]){
        temp=max(temp,1+solve(v));
    }
    return dp[u]=temp;
}
// LONG LONG CASE
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(dp,-1,sizeof(dp));
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        adj[a].pb(b);
    }
    for(int i=1;i<=n;i++){
        if(dp[i]==-1)solve(i);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,dp[i]);
    } 
    cout<<ans;
}

Measured memory_bytes: 8192
#include<iostream>
#include<algorithm>
using namespace std;
char O(char z){
	if('a'<=z&&z<='z')z-=32;
	return z;
}
int main(){
	string a,b,c;
	cin>>a>>b>>c;
	cout<<O(a[0])<<O(b[0])<<O(c[0])<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
int main() {
	int h, m, s,t,t3;
	while (scanf("%d%d%d", &h, &m, &s)) {
		if (h + m + s == -3) break;
		t = t3 = 7200 - h * 3600 - m * 60 - s;
		t3 *= 3;
		h = t / 3600, t %= 3600;
		m = t / 60, t %= 60;
		printf("%02d:%02d:%02d\n", h, m, t);
		h = t3 / 3600, t3 %= 3600;
		m = t3 / 60, t3 %= 60;
		printf("%02d:%02d:%02d\n", h, m, t3);
	}

	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int a,b;
  for(int i=0;i<n;i++){
    if(s.at(i) == 'A'){
      a = i;
      break;
    }
  }
  for(int i=n-1;i>=0;i--){
    if(s.at(i) == 'Z'){
      b = i;
      break;
    }
  }
  
  cout << b-a+1 << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include <set>
#include <queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[510][510];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}

ll combi[2100][2100];

int main() {
	cin >> n;
	ll x, y;
	cin >> x >> y;
	for (ll i = 1; i <= n; i++) {
		for (ll j = 1; j <= n; j++) {
			combi[i][j] = INF;
		}
	}
	map<ll, ll> mp;
	for (ll i = 1; i <= n; i++) {
		for (ll j = 1; j <= n; j++) {
			if (i != j) {
				combi[i][j] = min(abs(i - j), abs(x - i) + abs(j - y) + 1);
				chmin(combi[i][j], abs(x - j) + abs(i - y) + 1);
			}
		}
	}
	for (ll i = 1; i <= n; i++) {
		for (ll j = 1; j <= n; j++) {
			if (i != j) {
				mp[combi[i][j]]++;
			}
		}
	}
	for (ll i = 1; i < n; i++) {
		cout << mp[i]/2 << endl;
	}
}

Measured memory_bytes: 33152
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, t;
    cin >> n >> t;
    vi A(n);
    set<int> ss;
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
        ss.insert(A[i]);
    }
    int maxi = 0, cnt = 0;
    for (int i = 0; i < n-1; ++i) {
        ss.erase(A[i]);
        int right = *ss.rbegin();
        if (maxi < right - A[i]) {
            maxi = right - A[i];
            cnt = 1;
        } else if (maxi == right - A[i]) {
            cnt++;
        }
    }
    cout << cnt << "\n";
    return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(n, c);
    vvi table(30, vi(100010, 0));
    rep(i, n) {
        int3(s, t, tmp);
        tmp--;
        table[tmp][s]++;
        table[tmp][t+1]--;
    }
    rep(i, 30) {
        Rep(j, table[0].size()) {
            table[i][j] += table[i][j-1];
        }
    }

    int ans = 0;
    rep(i, table[0].size()) {
        int cnt = 0;
        rep(j, 30) {
            if (table[j][i]) cnt++;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 24576
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

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

    ll result=0;
    result = ceil(N / 1.08);

    if(floor(result*1.08) == N){
        cout << result << endl;
    }else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#define MOD 1000000007
#define SIZE 2000005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll inv[SIZE],fac[SIZE],finv[SIZE];
void make()
{
	fac[0]=fac[1]=1;
	finv[0]=finv[1]=1;
	inv[1]=1;
	for(int i=2;i<SIZE;i++)
	{
		inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
		fac[i]=fac[i-1]*(ll) i%MOD;
		finv[i]=finv[i-1]*inv[i]%MOD;
	}
}
ll C(int a,int b)
{
	if(a<b) return 0;
	return fac[a]*(finv[b]*finv[a-b]%MOD)%MOD;
}
int main()
{
	make();
	int n;
	scanf("%d",&n);
	ll ret=fac[n];
	for(int k=1;k<n;k++)
	{
		int zan=n-k-1;
		ret-=C(k-1,zan)*fac[k]%MOD*fac[n-k-1]%MOD;
		if(ret<0) ret+=MOD;
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 46976
/* tempate
 *
 *
 */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> d(n);
    rep(i, n) cin >> d[i];
    sort(all(d));
    ll res = d[n / 2] - d[n / 2 - 1];
    cout << res;
    cout << endl;
    return 0;
}


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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    ll n, d;
    cin >> n >> d;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        ll x, y;
        cin >> x >> y;
        if(d*d >= x*x + y*y) ans++;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3604
#include<string>
#include<cstdio>
#include<iostream>

using namespace std;
 
int main(){
	int n;
	double x[6],y[6];

	cin >>n;
	while(n--){
		cin >>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3];
		
		x[4]=x[0]-x[1];
		y[4]=y[0]-y[1];
		x[5]=x[2]-x[3];
		y[5]=y[2]-y[3];

		if(x[4]*y[5]-x[5]*y[4]) cout<< "NO" << endl;
		else cout<<"YES" << endl;
    }
 
    return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
	    Scanner s = new Scanner(System.in);
	    String st = s.nextLine();
	    
	    int cnt = 0;
	    
	    for(int i = 0; i < st.length(); i++){
	    	
	     	if(st.charAt(i) == 'R')
	          cnt += 1;
	      	else
	          if(cnt != 0)
	            break;
	      
	    }  
	    
	    System.out.println(cnt);
	}

}

Measured memory_bytes: 35892
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();

            return N < 3 ? 0 : N / 3;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 27452
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    ll p=pow(10,9)+7;
    int n,m;
    cin>>n>>m;
    vector<int>s(n);
    vector<int>t(m);
    for(int i=0;i<n;i++){
        cin>>s.at(i);
    }
    for(int i=0;i<m;i++){
        cin>>t.at(i);
    }

    //二次元dpの実装
    ll ans[n+1][m+1];
    for(int i=0;i<n+1;i++){
        for(int j=0;j<m+1;j++){
            if(i==0){
                ans[i][j]=1;
            }
            else if(j==0){
                ans[i][j]=1;
            }
            else{
                ans[i][j]=0;
            }
        }
    }
    // for(int i=0;i<n+1;i++){
    //     for(int j=0;j<m+1;j++){
    //         cout<<ans[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }

    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(s.at(i)==t.at(j)){//一緒だった場合、(965,945)みたいなペアだとすると、(965,94)が持っていたペアの末尾に5をつけてもそれがまた条件を満たすペアになるので、2倍。
                                //さらに、(96,945)が持っていたペアに5をつけてもそれはまた条件を満たすので2倍。しかし、(96,94)のペアに5をつけたものがダブっているのでそれをひく。
                ans[i+1][j+1]=ans[i][j+1]+ans[i+1][j];
            }
            else{
                ans[i+1][j+1]=ans[i][j+1]+ans[i+1][j]-ans[i][j];
            }
            ans[i+1][j+1]=(ans[i+1][j+1]+p)%p;

        }
    }
    cout<<ans[n][m]%p<<endl;
    // for(int i=0;i<n+1;i++){
    //     for(int j=0;j<m+1;j++){
    //         cout<<ans[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }





    return 0;
}


Measured memory_bytes: 31488
n,x=map(int,input().split())

bagaAtsusas=[]
bagaAtsusasP=[]
def bagaAtsusa(number):
  if number==0:
    bagaAtsusas.append(1)
    return 1
  else:
    tmp=3+ bagaAtsusa(number-1)*2
    bagaAtsusas.append(tmp)
    return tmp

def bagaAtsusaP(number):
  if number==0:
    bagaAtsusasP.append(1)
    return 1
  else:
    tmp=1 + bagaAtsusaP(number-1)*2
    bagaAtsusasP.append(tmp)
    return tmp

#どのバーガーまであるのかを知りたい
def donoBaga(bagaLevel,fukasa,numList,ans):
  if(fukasa==1):
    numList[bagaLevel-1]=0
    #今までのを足せばわかる
    for i in range(bagaLevel-1,len(numList)):
      ans+=bagaAtsusasP[i]*numList[i]
    print(ans)
  elif(fukasa<bagaAtsusas[bagaLevel-1]+1):
    #つぎへ
    numList[bagaLevel-1]=0
    fukasa=fukasa-1
    donoBaga(bagaLevel-1,fukasa,numList,ans)
  elif (fukasa==bagaAtsusas[bagaLevel-1]+1):
    numList[bagaLevel-1]=1
    #今までのを足せばわかる
    for i in range(bagaLevel-1,len(numList)):
      ans+=bagaAtsusasP[i]*numList[i]
    print(ans)
  elif (fukasa==bagaAtsusas[bagaLevel-1]+2):
    numList[bagaLevel-1]=1
    #今までのを足せばわかる
    for i in range(bagaLevel-1,len(numList)):
      ans+=bagaAtsusasP[i]*numList[i]
    ans=ans+1
    print(ans)
  elif(fukasa<bagaAtsusas[bagaLevel-1]*2+2):
    #つぎへ
    numList[bagaLevel-1]=1
    fukasa=fukasa-(bagaAtsusas[bagaLevel-1]+2)
    ans=ans+1
    donoBaga(bagaLevel-1,fukasa,numList,ans)
  elif (fukasa==bagaAtsusas[bagaLevel-1]*2+2):
    numList[bagaLevel-1]=2
    #今までのを足せばわかる
    for i in range(bagaLevel-1,len(numList)):
      ans+=bagaAtsusasP[i]*numList[i]
    ans=ans+1
    print(ans)
  elif (fukasa==bagaAtsusas[bagaLevel-1]*2+3):
    numList[bagaLevel-1]=2
    #今までのを足せばわかる
    for i in range(bagaLevel-1,len(numList)):
      ans+=bagaAtsusasP[i]*numList[i]
    ans=ans+1
    print(ans)
    
bagaAtsusa(n)
bagaAtsusaP(n)
numList=[0]*n
ans=0
donoBaga(n,x,numList,ans)
#print(numList)
#print(bagaAtsusas)
#print(bagaAtsusasP)

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

#define lld long long
#define pp pair<int,int>
#define pb push_back
#define MOD 10007
#define left lleft
#define right rright
#define INF 2000000000
#define Linf 1000000000000000000LL
#define next nnext

using namespace std;

int N;

int main(){
	scanf("%d",&N);
	for(int i=1;; i++){
		if(i*(i+1)>=N*2){
			printf("%d\n",i);
			break;
		}
	}

	return 0;
}


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

using namespace std;

constexpr static int MAXN = 1e6;
constexpr static int MOD = 1e9 + 7;

vector <int> adj[MAXN];
int cnt[MAXN];
bool vis[MAXN];

int dfs(int i) {
    cnt[i] = 1;
    vis[i] = true;
    int64_t val = 0;
    for (int j : adj[i])
        if (!vis[j])
            val ^= dfs(j);
    cnt[i] += val;
    return cnt[i];
}

bool solve() {
    int N;
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(0);

    int sum = 0;
    for (int i : adj[0])
        sum ^= cnt[i];

    return sum != 0;
}

int main() {
    cout << (solve() ? "Alice" : "Bob") << endl;
}


Measured memory_bytes: 32768
#include<stdio.h>
int main(void)
{
  int n,a,b,c,r[15],s;
  scanf("%d",&n);
  while(n--){
    scanf("%d%d",&a,&b);
    c=0;
    if(a>b)s=-1;
    else s=1;
    while(a!=b){
      r[c++]=a;
      if(a<6){
        a+=s;if(a==0)s=1;
      }
      else{
        a++;if(a>9)a=5,s=-1;
      }
    }
    for(a=0;a<c;a++){
      printf("%d ",r[a]);
    }
    printf("%d\n",b);
  }
  return 0;
}

Measured memory_bytes: 0