akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int n; cin >> n;
    int a[n],b[n],c[n-1];
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n-1) cin >> c[i];
    int ans = 0;

    rep(i,n){
        --a[i];
        ans += b[a[i]];
        if(i>0){
            if(a[i-1]+1 == a[i]) ans += c[a[i-1]];
        }
    }
    
    cout << ans << ln;
    return 0;
 }

Measured memory_bytes: 256
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (200006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define MSB(bm) ((bm==0)?-1:(63-__builtin_clzll((bm))))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void degug_out() { cerr << endl; }template <typename Head, typename... Tail>void degug_out(Head H, Tail... T) {cerr << " " << to_string(H);degug_out(T...);}inline ll gcd(ll a,ll b){if(a>b)swap(a,b);if(a==0)return b;return gcd(b%a,a);}
#ifdef LOCAL
// #define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
// #define degug(...) 663
#define cerr if(0)cout
#endif
#warning "// FOR has been inclusive now!!!!"
ll n, h, w;
vector<spi>edges;
struct ufds_ {
	int p[MAXN], edges[MAXN], sz[MAXN];
	ufds_() {
		FOR(i,0,MAXN-1) p[i]=i, sz[i]=1, edges[i]=0; 
	}
	void merge(ll x,ll y) {
		x=find(x), y=find(y);
		if(x==y) {
			edges[x] ++;
		} else {
			sz[y]+=sz[x];
			p[x]=y;
			edges[y]+=edges[x]+1;
			sz[x]=edges[x]=-INF;
		}
	}
	ll gete(ll x) { return edges[find(x)]; }
	ll gets(ll x) { return sz[find(x)]; }
	ll find(ll x) { return (p[x]==x)?x:p[x]=find(p[x]); }
	bool same(ll a,ll b) { return find(a)==find(b); }
} ufds;
int main()
{
	FAST
	cin>>n>>h>>w;
	edges.resize(n);
	FOR(i,0,n-1){
		cin>>edges[i].s.f>>edges[i].s.s>>edges[i].f;
		edges[i].s.s+=h;
	}
	sort(all(edges),greater<spi>());
	ll ans=0;
	for(auto i:edges) {
		ll a=i.s.f, b=i.s.s;
		if(ufds.gete(a)+ufds.gete(b)+1<=ufds.gets(a)+ufds.gets(b)){
			ufds.merge(a,b);
			ans+=i.f;
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 5248
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        Console.WriteLine(char.IsUpper(Console.ReadLine()[0]) ? 'A' : 'a');
    }
}


Measured memory_bytes: 25880
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int evenV[] = new int[n/2];
        int oddV[] = new int[n/2];
        HashSet<Integer> evenNum = new HashSet<>();
        HashMap<Integer,Integer> evenCount = new HashMap<>();
        HashSet<Integer> oddNum = new HashSet<>();
        HashMap<Integer,Integer> oddCount = new HashMap<>();

        for(int i=0;i<n;i++){
            if(i%2==0)evenV[i/2]=sc.nextInt();
            else oddV[i/2]=sc.nextInt();
        }
        
        for(int i=0;i<evenV.length;i++){
            if(evenNum.contains(evenV[i])){
                int temp = evenCount.get(evenV[i]);
                evenCount.remove(evenV[i]);
                evenCount.put(evenV[i],temp+1);
            }else{
                evenNum.add(evenV[i]);
                evenCount.put(evenV[i],1);
            }
        }
        for(int i=0;i<evenV.length;i++){
            if(oddNum.contains(oddV[i])){
                int temp = oddCount.get(oddV[i]);
                oddCount.remove(oddV[i]);
                oddCount.put(oddV[i],temp+1);
            }else{
                oddNum.add(oddV[i]);
                oddCount.put(oddV[i],1);
            }
        }

        int even1 = mode(evenNum,evenCount);
        evenNum.remove(even1);
        int even2 = mode(evenNum,evenCount);

        int odd1 = mode(oddNum,oddCount);
        oddNum.remove(odd1);
        int odd2 = mode(oddNum,oddCount);

        int conf = 0;

        //System.out.println(even1 +" "+ even2 +" "+ odd1+" "+odd2);

        if(even1==odd1){
            if(evenCount.get(even2)==null||oddCount.get(odd2)==null){
                conf=evenCount.get(even1);
            }else {
                if (evenCount.get(even2) >= oddCount.get(odd2)) {
                    conf = evenCount.get(even2) + oddCount.get(odd1);
                } else {
                    conf = evenCount.get(even1) + oddCount.get(odd2);
                }
            }
        } else {
            conf = evenCount.get(even1)+ oddCount.get(odd1);
        }

        System.out.println(n-conf);


        
    }
    private static int mode(HashSet<Integer> num,HashMap<Integer,Integer> count){
        int max=0;
        int mode = 0;
        for(Integer i:num){
            if(max<count.get(i)){
                max=count.get(i);
                mode=i;
            }
        }
        return mode;
    }
}


Measured memory_bytes: 69800
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int h1,m1,h2,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	m1+=(h1*60);
	m2+=(h2*60);
	cout << m2-m1-k << endl;




}

Measured memory_bytes: 3160
#include <stdio.h>

int main(void)
{
	int a,b,c,d,e,f,g,h,i;
	
	scanf("%d %d %d",&a,&b,&c);
	
	if (a>b){
		d=b;
		e=a;
	}else{
		d=a;
		e=b;
	}
	if (e>c){
		f=c;
		g=e;
	}else{
		f=e;
		g=c;
	}
	if (d>f){
		h=f;
		i=d;
	}else{
		h=d;
		i=f;
	}
	
	printf("%d %d %d\n",h,i,g);
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main() {
    ll n ,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector <ll> a(n, 0);
    ll count = 0;
    for (ll i=0; i < n-1; i++) {
        a[i] = count;
        if (s[i] == 'A' && s[i+1] == 'C') {
            count++;
        }
    }
    a[n-1] = count;
    ll l,r;
    vector <ll > ans(q);
    for(ll i =0;i <q; i++) {
        cin >> l >> r;
        ans[i] = a[r-1] - a[l-1];
    }
    for(ll i =0;i <q; i++) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 4512
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    int n;
    cin >> n;
    cout << "ABC" << n << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

A,B,C = I()
if C <= A+B:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9952
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define vvll vector<vll>
#define mll map<ll,ll>
#define f(i,m,n) for(i=m;i<n;i++)
#define ee endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define take(v,n) for(i=0;i<n;i++) cin>>v[i];
#define print(v,n) for(i=0;i<n;i++) cout<<v[i]<<" ";
#define NO() cout<<"NO"<<endl
#define YES() cout<<"YES"<<endl
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sot(v) sort(v.begin(),v.end());
#define PI 3.14159265   ;
ll mod =1000000007;
bool isPrime(int n)
{
	// Corner cases 
	if (n <= 1)  return false;
	if (n <= 3)  return true;

	// This is checked so that we can skip  
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) return false;

	for (int i = 5; i*i <= n; i = i + 6)
		if (n%i == 0 || n % (i + 2) == 0)
			return false;

	return true;
}

ll powe(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) res =( res * x)%mod;
		y = y >> 1;
		x = (x * x)%mod;
	}
	return res;
}
struct hash_pair {
	template <class T1, class T2>
	size_t operator()(const pair<T1, T2>& p) const
	{
		auto hash1 = hash<T1>{}(p.first);
		auto hash2 = hash<T2>{}(p.second);
		return hash1 ^ hash2;
	}
};


void solve()
{
	ll i, x, y, j, k, h, n, w, k1, k2, q;
	cin>>n;
	vector<pair<ll,ll>> v;
	f(i,0,n)
	{
		cin>>j>>k;
		v.pb({j,k});
	}
	for(i=0;i<=n-3;i++)
	{
		if(v[i].ff==v[i].ss && v[i+1].ff==v[i+1].ss && v[i+2].ff==v[i+2].ss)
		{
			cout<<"Yes"<<ee;
			return;
		}
	}
	cout<<"No"<<ee;	
}

int main() {
	fast;
	ll i, j, l, k, t, n;
	t=1;
	for (i = 1; i <= t; i++)
	{
		// cout<<"Case #"<<i<<": ";
		solve();
	}
}
// 

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
    char s;
    int r;
    vector<vector<bool> > none(4, vector<bool>(13, true));
    for (int i = 0; i < n; ++i)
    {
        cin >> s >> r;
        int l = (s == 'S' ? 0 : (s == 'H' ? 1 : (s == 'C' ? 2 : 3)));
        none[l][r - 1] = false;
    }
    for (int i = 0; i < 4; ++i)
    {
        for (int j = 0; j < 13; ++j)
        {
            if (none[i][j])
            {
                cout << (i == 0 ? "S " : (i == 1 ? "H " : (i == 2 ? "C " : "D "))) << j + 1 << endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	int ans = 0;
	int N;
	string S;
	cin >> N >> S;
	for(int i=1; i<N; ++i){
		string T = "";
		int count = 0;
		for(int j=0; j<i; ++j){
			bool flag = false;
			for(int l=0; l<T.length(); ++l){
				if(S[j]==T[l]){
					flag = true;
					break;
				}
			}
			if(flag) continue;
			for(int k=i; k<N; ++k){
				if(S[j]==S[k]){
					T.push_back(S[j]);
					++count;
					break;
				}
			}
		}
		ans = max(ans, count);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3616
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m,k = map(int,input().split())
ab = []
cd = []
uf = UnionFind(n)
fr = [0] * n
dis = [0] * n
for i in range(m):
    ab.append(list(map(int,input().split())))
    uf.union(ab[i][0]-1,ab[i][1]-1)
    fr[ab[i][0]-1] += 1
    fr[ab[i][1]-1] += 1
for i in range(k):
    cd.append(list(map(int,input().split())))
    if uf.same(cd[i][0]-1,cd[i][1]-1):
        dis[cd[i][0]-1] += 1
        dis[cd[i][1]-1] += 1
ans = [0] * n
for i in range(n):
    ans[i] = uf.size(i)-fr[i]-dis[i] - 1
print(*ans)




Measured memory_bytes: 63776
// スタックサイズ: 100MB

#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1e18;
const double EPS = 1e-10;
const ll mod = 1e9 + 7;
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }




int main() {
	fastio;

	ll a, b;
	cin >> a >> b;
	if (13 <= a) cout << b << endl;
	else if(6 <= a) cout << b / 2 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
lst_x = list(map(int, input().split()))


ans = float("INF")
for i in range(N - K + 1):
    l = lst_x[i]
    r = lst_x[i + K - 1]
    dx = r - l
    d = min(abs(l) + dx, abs(r) + dx)
    ans = min(ans, d)
print(ans)

Measured memory_bytes: 15020
#include <iostream>
#include <vector>
using namespace std;
char nnnnn[8010];
int xcor, ycor;
vector <int> x;
vector <int> y;
int total_sum_X =0;
int total_sum_Y =0;
bool sub1[8010][8010]; ///1st -->sum 2nd --> elements
bool sub2[8010][8010];
bool check_subs2(int sumi)
{
    for (int i = 0; i <=y.size(); i++)
        sub2[i][0]= true;
    for (int i = 1 ; i<=sumi; i++)
        sub2 [0][i] = false;
    for (int i = 1 ; i<=y.size(); i++)
    {
        for (int j = 1; j<=sumi; j++)
        {
            if (j<y[i-1])
            {
                sub2[i][j] = sub2[i-1][j];
            }
            else
            {
                sub2[i][j] = sub2[i-1][j] || sub2[i-1][j-y[i-1]];
            }
        }
    }
    return sub2[y.size()][sumi];
}
bool check_subs1(int sumi)
{
    for (int i = 0; i <=x.size(); i++)
        sub1[i][0]= true;
    for (int i = 1 ; i<=sumi; i++)
        sub1 [0][i] = false;
    for (int i = 2 ; i<=x.size(); i++)
    {
        for (int j = 1; j<=sumi; j++)
        {
            if (j<x[i-1])
            {
                sub1[i][j] = sub1[i-1][j];
            }
            else
            {
                sub1[i][j] = sub1[i-1][j] || sub1[i-1][j-x[i-1]];
            }
        }
    }
    return sub1[x.size()][sumi];
}
int main()
{
    cin >> nnnnn;
    bool flip =false;
    cin >> xcor >> ycor;
    int sum =0;
    for (int i = 0; nnnnn[i]!=0; i++)
    {

        if (flip ==false)
        {
            if (nnnnn[i]=='T')
            {
                flip = true;
                x.push_back(sum);
                total_sum_X = total_sum_X + sum;
                sum=0;
            }
            else
            {
                sum++;
            }
        }
        else
        {
            if (nnnnn[i]=='T')
            {
                flip = false;
                total_sum_Y = total_sum_Y + sum;
                y.push_back(sum);
                sum = 0;
            }
            else
            {
                sum++;
            }
        }

    }
    if (flip == false)
    {
        total_sum_X = total_sum_X + sum;
        x.push_back(sum);
    }
    else
    {
        y.push_back(sum);
         total_sum_Y = total_sum_Y + sum;
    }
    if ((total_sum_X + xcor)%2 == 1 || (total_sum_Y + ycor)%2==1)
    {
        cout << "No";
        return 0;
    }

    if (check_subs1((total_sum_X+xcor)/2 - x[0])==true && check_subs2((total_sum_Y+ycor)/2)==true)
    {
        cout << "Yes";
        return 0;
    }
    cout << "No";
    return 0;
}



Measured memory_bytes: 62848
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
const ll mod = 1e9+7;
const ll INF = 2e9;
const double PI = 3.1415926535;

ll a[500];
ll b[500];
ll mae[500];
ll ush[500];

int main(void){
    ll n, k; cin >> n >> k;
    ll sum = 0;
    for(int i = 0;i < n;i++){cin >> a[i]; sum += a[i];}
    priority_queue <ll>que;
    for(int i = 1;i * i <= sum;i++){
        if(sum % i == 0){
            que.push(i); que.push(sum/i);
        }
    }
    while(true){
        ll ans = que.top(); que.pop();
        ll pos = 0;
        ll neg = 0;
        for(int i = 0;i < n;i++){
            b[i] = a[i]%ans;
        }
        sort(b, b + n);
        mae[0] = b[0];
        for(int i = 1;i < n;i++){
            mae[i] = mae[i-1] + b[i];
        }
        ush[n-1] = ans - b[n-1];
        for(int i = n-2;i >= 0;i--){
            ush[i] = ush[i+1] + ans - b[i];
        }
        for(int i = 0;i < n-1;i++){
            if(mae[i] <= k && ush[i+1] <= k){
                cout << ans << endl;
                return 0;
            }
        }
    }
	return 0;
}

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

int main (void) {
    char in[3];
    scanf("%s", in);

    if (strcmp(in, "SUN") == 0) {
        printf("7\n");
    } else if (strcmp(in, "MON") == 0) {
        printf("6\n");
    } else if (strcmp(in, "TUE") == 0) {
        printf("5\n");
    } else if (strcmp(in, "WED") == 0) {
        printf("4\n");
    } else if (strcmp(in, "THU") == 0) {
        printf("3\n");
    } else if (strcmp(in, "FRI") == 0) {
        printf("2\n");
    } else if (strcmp(in, "SAT") == 0) {
        printf("1\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;
	cin >> n;
	int a[n];
	for (int i=0;i<n;i++) cin >> a[i];
	int lcm = 1;
	for (int i=0;i<n;i++){
		lcm = lcm * a[i] / __gcd(lcm, a[i]);
	}
	cout << lcm << endl;
}


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

void show(int* A, int N);

int selectionSort(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;
			}
		}
		if (minj != i) {
			int C = A[i];
			A[i] = A[minj];
			A[minj] = C;
			++Count;
		}
		
	}
	return Count;
}

void show(int* A, int N) {
	for (int i = 0; i < N; ++i) {
		if (i > 0) { cout << ' '; }
		cout << A[i];
	}
	cout << endl;
}

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

	int* A = new int[N];
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	int Count = selectionSort(A, N);

	show(A, N);

	cout << Count << endl;

	delete[] A;
}


Measured memory_bytes: 3140
import java.util.Scanner;

public class Main {
    public static void main(String[] $) {
        var s = new Scanner(System.in);
        int m = 1000000007;
        int t = s.nextInt();
        int[][] x = {{0,765144583,346175634,347662323,5655049,184117322,927321758,444014759,542573865,237315285,417297686,471090892,183023413,660103155,727008098,869418286},{539588932,729548371,700407153,404391958,962779130,184117322,927321758,444014759,542573865,237315285,417297686,471090892,183023413,660103155,727008098,869418286}};
        while (t --> 0) {
            int n = s.nextInt();
            long a = 0, p = 1;
            for (int i = 0; i < 16; i++) {
                a += (p * x[n & 1][i]) % m;
                p = (p * n) % m;
            }
            System.out.println(a % m);
        }
    }
}


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

int main()
{
  int X, A;
  int res=0;
  cin >> X >> A;

  if(X>=A) res=10;
  
  cout << res << endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.append(0)
m=1000
s=0
for i in range(n):
    if a[i]<a[i+1]:
        if s == 0:
            pass
        else:
          m=m + s * a[i]
          s=0   
        s=m // a[i]
        m=m % a[i]
    else:
        m=m + s * a[i]
        s=0
print(m)

Measured memory_bytes: 9196
#include<iostream>
long n,k,a,i,j,m=1e9+7,v[2<<20];main(){for(std::cin>>n>>k;i++<n;)for(j=0;j++<n;v[i]>v[j]?(a+=k*(k-1)/2+(i<j?k:0))%=m:0)i-1||std::cin>>v[j];std::cout<<a;}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef long double ld;
vector<ld> a;
int main(){
	ll i,n,k;
	cin >> n >> k;
	for(i=0;i<n;i++){
		ll x; cin >> x;
		a.push_back(x);
	}
	sort(a.begin(),a.end());
	ll r = 1000000000000000001;
	ll l = -1000000000000000001;
	while(r - l>1){
		ll mid = (l + r)/2,cnt = 0;
		for(i=0;i<n;i++){
			if(a[i]==0){
				if(mid>=0){
					cnt += n - 1;
				}
			}
			if(a[i]>0){
				auto it = upper_bound(a.begin(),a.end(),(ld)mid/a[i]);
				cnt += (it - a.begin());
				if(a[i]*a[i]<=mid) cnt--;
			}
			if(a[i]<0){
				auto it = lower_bound(a.begin(),a.end(),(ld)mid/a[i]);
				cnt += n - (it - a.begin());
				if(a[i]*a[i]<=mid) cnt--;
			}
		}
		cnt /= 2;
		if(cnt>=k) r = mid;
		else l = mid;
	}
	cout << r << endl;
}
			
	

Measured memory_bytes: 6384
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        sc.close();
        System.out.println(Math.min(Math.min(a + b , a + c) , b + c));
    }
}

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

using namespace std;

long long n,k,x,sum,an;

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

    sum = n/k;
    an = sum*sum*sum;

    if (k%2 == 0){
        n += k/2;
        sum = n/k;
        an += sum*sum*sum;
    }

    cout << an << "\n";

}


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

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

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
// Union-Find木(素集合データ構造) -
// グループ分けを木構造で管理する。任意の２要素が同じグループに所属するか判定する
struct UnionFind {
  // 親ノードのインデックス
  vector<int> parent;

  UnionFind(int size) {
    parent.resize(size);
    rep(i, size) {
      parent[i] = i;
    }  // 初期状態は自ノードが親ノード(＝すべてのノードが独立)
  }

  // 木の根(root)を取得する
  int root(int x) {
    // 要素xが根の場合
    if (parent[x] == x) return x;

    // 経路圧縮
    parent[x] = root(parent[x]);

    return parent[x];
  }

  // 同じグループかどうか判定する
  bool same(int x, int y) { return root(x) == root(y); }

  // ２つのグループを併合する
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) parent[x] = y;
  }
};

signed main() {
  int N, M;
  cin >> N >> M;

  vector<int> A(M), B(M);
  rep(i, M) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }

  int ans = 0;
  rep(i, M) {
    UnionFind uf(N);
    rep(j, M) {
      if (j == i) continue;
      uf.unite(A[j], B[j]);
    }
    if (!uf.same(A[i], B[i])) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

signed main(){
    Vec(a,3);
    cin >> a[0] >> a[1] >> a[2];
    int itr = 0;
    int ans;
    while(1){
        if(a[itr].size()==0){
            ans = itr;
            break;
        }
        int tmp = a[itr][0] - 'a';
        a[itr].erase(a[itr].begin());
        itr = tmp;
    }
    if(ans==0){
        print("A")
    }
    else if(ans==1){
        print("B")
    }
    else{
        print("C")
    }
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


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

using namespace std;

int N, M;
vector< pair< int, int > > g[200000];
using int64 = unsigned long long;
bool ans[200000];

struct StronglyConnectedComponents {
  vector< vector< int > > gg, rg;
  vector< pair< int, int > > edges;
  vector< int > comp, order, used;

  StronglyConnectedComponents(size_t v) : gg(v), rg(v), comp(v, -1), used(v, 0) {}

  void add_edge(int x, int y) {
    gg[x].push_back(y);
    rg[y].push_back(x);
    edges.emplace_back(x, y);
  }

  int operator[](int k) {
    return (comp[k]);
  }

  void dfs(int idx) {
    if(used[idx]) return;
    used[idx] = true;
    for(int to : gg[idx]) dfs(to);
    order.push_back(idx);
  }

  void rdfs(int idx, int cnt) {
    if(comp[idx] != -1) return;
    comp[idx] = cnt;
    for(int to : rg[idx]) rdfs(to, cnt);
  }

  void build() {
    for(int i = 0; i < gg.size(); i++) dfs(i);
    reverse(begin(order), end(order));
    int ptr = 0;
    for(int i : order) if(comp[i] == -1) rdfs(i, ptr), ptr++;
  }
};

void dfs(int idx) {

  for(int _ = 0; _ < g[idx].size(); _ += 64) {
    int l = _, r = min< int >(g[idx].size(), _ + 64);

    queue< int64 > que;
    vector< int64 > dp(N);
    vector< vector< int64 > > qs(N);

    for(int i = l; i < r; i++) {
      auto &e = g[idx][i];
      qs[e.first].emplace_back(i - l);
      dp[idx] |= 1uLL << (i - l);
    }
    que.emplace(idx);

    while(que.size()) {
      int p = que.front();
      que.pop();
      for(int i = 0; i < g[p].size(); i++) {
        auto &e = g[p][i];
        auto pv = dp[e.first];
        if(p == idx && l <= i && i < r && (dp[p] >> (i - l)) & 1) {
          dp[e.first] |= dp[p] ^ (1uLL << (i - l));
        } else {
          dp[e.first] |= dp[p];
        }
        if(pv != dp[e.first]) que.emplace(e.first);
      }

    }

    for(int i = 0; i < N; i++) {
      for(auto &s : qs[i]) {
        if((dp[i] >> s) & 1) ans[g[idx][s + l].second] = true;
      }
    }

  }
}

int X[200000], Y[200000];
bool v[2000][2000];

void dfs2(int idx, int idx2) {
  if(v[idx][idx2]++) return;
  for(auto &to : g[idx]) dfs2(to.first, idx2);
}

int main() {

  scanf("%d %d", &N, &M);
  StronglyConnectedComponents scc(N);

  for(int i = 0; i < M; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a, --b;
    X[i] = a, Y[i] = b;
    g[a].emplace_back(b, i);
    scc.add_edge(a, b);
  }
  scc.build();

  for(int i = 0; i < N; i++) {
    dfs(i);
    dfs2(i, i);
  }
  for(int i = 0; i < M; i++) {
    puts(ans[i] ^ (scc[X[i]] == scc[Y[i]]) ? "diff" : "same");
  }
}


Measured memory_bytes: 19056
#include<stdio.h>
#include<algorithm>
using namespace std;
int n,a;
int main(){
    scanf("%d%d",&n,&a);
    if(a>=500){
        printf("Yes\n");
        return 0;
    }
    if(n%500<=a){
        printf("Yes\n");
        return 0;
    }
    printf("No\n");
    return 0;
}


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

int N;
ll nums[100100];
ll memo[100100][2];
constexpr ll LINF = - (INF * INF);

ll dp_go(int i, bool flip) {
  if (memo[i][flip] != LINF){
    return memo[i][flip];
  }
  const ll x = flip ? - nums[i] : nums[i];
  if (i == N-1) {
    return x;
  }
  // flip.
  ll ans1 = -x + dp_go(i+1, true);
  // no flip
  ll ans2 = x + dp_go(i+1, false);
  return memo[i][flip] = max(ans1, ans2);
}

int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> N;
  rep(i,N){
    cin >> nums[i];
  }
  rep(i,N+2){
    rep(j,2){
      memo[i][j] = LINF;
    }
  }

  cout << dp_go(0, false) << endl;

  return 0;
}


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

#define y1 as214
#define ii pair < int , int >
#define iii pair < int , ii >
#define iv pair < ii , ii >

#define fi first
#define se second
#define fr front()
#define pb push_back
#define t top()

#define FOR(i , x , n) for(int i = x ; i <= n ; ++i)
#define REP(i , n) for(int i = 0 ; i < n ; ++i)
#define FORD(i , x , n) for(int i = x ; i >= n ; --i)

#define ll long long
#define oo 1e17
#define int long long

const int N = 3e3 + 5;
int n;
double res;
double p[N];
double dp[N][N];

main()
{
    //freopen("I.inp","r",stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    FOR(i , 1 , n)
        cin >> p[i];
    dp[0][0] = 1;
    FOR(i , 1 , n)
    {
        FOR(j , 0 , n / 2)
        {
            if(j == 0)
                dp[i][j] = dp[i - 1][j] * p[i];
            else
                dp[i][j] = dp[i - 1][j - 1] * (1 - p[i]) + dp[i - 1][j] * p[i];
        }
    }
    FOR(j , 0 , n / 2)
        res += dp[n][j];
    cout << setprecision(10) << fixed << res;
}


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

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

    long long n;
    cin >> n;
    long long ans = 1e18;
    for (int i = 1; 1LL * i * i <= n; i++) {
        if (n % i == 0) {
            ans = min(ans, i + n / i - 2);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(15);
vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	cout << min(a+b,min(b+c,c+a)) << endl;
}

Measured memory_bytes: 3612
// abc129d.cpp : Lamp
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,n) for(int i=0;i<(n);i++)
#define irp(i,n) for(int i=(n);i>=0;i--)

int main(){
	int h,w; cin>>h>>w;

	vector<string> s(h);
	vector<vi> U(h,vi(w)), L(h,vi(w));

	rp(i,h) cin>>s[i];

	rp(i,h)
		rp(j,w){
			if(i>0 && s[i][j]=='.' && s[i-1][j]=='.') U[i][j] = U[i-1][j] + 1;
			if(j>0 && s[i][j]=='.' && s[i][j-1]=='.') L[i][j] = L[i][j-1] + 1;
		}

	irp(i,h-1)
		irp(j,w-1){
			if(i<h-1 && s[i][j]=='.' && s[i+1][j]=='.') U[i][j] = U[i+1][j];
			if(j<w-1 && s[i][j]=='.' && s[i][j+1]=='.') L[i][j] = L[i][j+1];
		}

	int ans = 1;
	rp(i,h)
		rp(j,w){
			int s = U[i][j] + L[i][j] + 1;
			if(ans<s) ans = s;
		}

	cout<< ans <<endl;
}

Measured memory_bytes: 35712
// finish date: 2018/01/28
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;


int main() {
    int X,A,B;
    cin >> X>>A>>B;
    X=X-A;
    cout<<X%B<<endl;


    return 0;
}



Measured memory_bytes: 764
n, T = map(int,input().split())

list = []
for i in range(n):
    c, t = map(int,input().split())
    if t <= T:
        list.append([c,t])
    
list.sort(key = lambda x : x[0])

if  len(list) > 0:
    print(list[0][0])
else:
    print("TLE")

Measured memory_bytes: 3060
program abc051
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: xs,xg, ys,yg
    integer(int32):: dx,dy, i, si
    character(:),allocatable:: ans

    read*, xs,ys, xg,yg

    dx = xg-xs
    dy = yg-ys

    si = 1
    ! print'(i0)', 4*dx+4*dy+8
    allocate(character(4*dx+4*dy+8):: ans)

    do i=si,si+dy-1
        ans(i:i) = 'U'
    end do

    si=si+dy
    
    do i=si,si+dx-1
        ans(i:i) = 'R'
    end do

    si=si+dx

    do i=si,si+dy-1
        ans(i:i) = 'D'
    end do

    si=si+dy
    
    do i=si,si+dx-1
        ans(i:i) = 'L'
    end do

    si=si+dx

    ans(si:si) = 'L'
    si=si+1



    do i=si,si+(dy+1)-1
        ans(i:i) = 'U'
    end do

    si=si+dy+1
    
    do i=si,si+(dx+1)-1
        ans(i:i) = 'R'
    end do

    si=si+dx+1

    ans(si:si) = 'D'
    si=si+1
    ans(si:si) = 'R'
    si=si+1
    do i=si,si+(dy+1)-1
        ans(i:i) = 'D'
    end do

    si=si+(dy+1)
    
    do i=si,si+(dx+1)-1
        ans(i:i) = 'L'
    end do

    si=si+dx+1

    ans(si:si) = 'U'

    print'(a)', ans

end program abc051

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
      
    int N = sc.nextInt();
    int M = sc.nextInt();
      
      if(N==M){
      System.out.println("Yes");
      }
      else{
      System.out.println("No");
      }
    }
}

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

int main()
{
  int A, B;
  cin >> A >> B;
  for (int i = 1; i <= 10000; i++)
  {
    int a = floor(i * 0.08);
    int b = floor(i * 0.10);
    if (a == A && b == B)
    {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX_NUM 25

typedef struct Node{
    int key;
    int left;
    int right;
    int parent;
}node;

int Root(node *tree,int len){
    int i;
    for(i=0; i<len; i++){
        if(tree[i].key != -1 && tree[i].parent == -1){
            return i;
        }
    }
    return -1;
}

void PrintPreorder(node *tree, int n){
    if(n == -1)return;
    printf(" %d",tree[n].key);
    PrintPreorder(tree,tree[n].left);
    PrintPreorder(tree,tree[n].right);
}

void PrintInorder(node *tree, int n){
    if(n == -1)return;
    PrintInorder(tree,tree[n].left);
    printf(" %d",tree[n].key);
    PrintInorder(tree,tree[n].right);
}

void PrintPostorder(node *tree, int n){
    if(n == -1)return;
    PrintPostorder(tree,tree[n].left);
    PrintPostorder(tree,tree[n].right);
    printf(" %d",tree[n].key);
}

int main(){
    int num,i,k,l,r,root;
    node tree[MAX_NUM];

    scanf("%d",&num);
    for(i=0; i<num; i++){
        tree[i].key = -1;
        tree[i].parent = -1;
    }
    for(i=0; i<num; i++){
        scanf("%d%d%d",&k,&l,&r);
        tree[k].key = k;
        tree[k].left = l;
        tree[k].right = r;
        if(l!=-1)tree[tree[k].left].parent = k;
        if(r!=-1)tree[tree[k].right].parent = k;
    }

    root = Root(tree,num);
    printf("Preorder\n");
    PrintPreorder(tree,root);
    printf("\nInorder\n");
    PrintInorder(tree,root);
    printf("\nPostorder\n");
    PrintPostorder(tree,root);
    printf("\n");

    return 0;
}


Measured memory_bytes: 2112
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using ll = long long;
using namespace std;

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

int main() {
    int n; cin >> n;
    ll t[101];
    ll lcm = 1LL;
    for(int i = 0; i < n; i++){
        cin >> t[i];
        lcm = t[i] * (lcm / gcd(lcm, t[i]));
    }
    cout << lcm << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 100100
using namespace std;
struct edge{
	int r,nxt;
}e[maxn<<1];
int head[maxn],esz,size[maxn],n;
void addedge(int u,int v){
	e[++esz].r=v;e[esz].nxt=head[u];head[u]=esz;
	e[++esz].r=u;e[esz].nxt=head[v];head[v]=esz;
}
void dfs(int u,int f){
	for(int t=head[u];t;t=e[t].nxt)if(e[t].r!=f)
		dfs(e[t].r,u),size[u]^=size[e[t].r]+1;
}
int main(){
	scanf("%d",&n);
	for(int i=2,u,v;i<=n;++i)
		scanf("%d%d",&u,&v),addedge(u,v);
	dfs(1,0);
	if(size[1])puts("Alice");
	else puts("Bob");
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for ( auto blockTime = make_pair(chrono::high_resolution_clock::now(), true);blockTime.second;\
debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false)
#define li long long int
#define ld long double
#define eb push_back
#define pb pop_back
#define INF 1e18+10
#define MINF -1e18-10
#define rep(i,a,b) for(li i=a;i<b;i++)
#define size(a) a.size()
#define rev(a) reverse(a.begin(),a.end())
#define len(a) a.length()
#define f first
#define s second
#define sort(a) sort(a.begin(),a.end())
#define vli vector<li>
#define vvli vector<vli >
#define pli pair<li,li>
#define vpli vector<pli>
#define inp(t) li t;cin>>t; while(t--)
using namespace std;
const li mod = 1e9+7;
#define MAXN 1000005 

li power(li a, li b, li mod) { a%=mod; li ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
li powerinv(li a)
{
  return power(a,mod-2,mod);
}

li facts[200005] = {0};
li fact()
{ 
  facts[0] = 1; 
  for (li i = 1; i <= 2e5+5; i++) 
    facts[i] = (facts[i - 1] * i) % mod;
}

void solve()
{
  string s,t;
  cin>>s>>t;

  li count = 0;
  rep(i,0,size(s))
  {
    if(s[i]!=t[i])
      count++;
  }

  cout<<count<<endl;
}

int main()
{
    IOS;

    solve();
    return 0;
}

Measured memory_bytes: 3812
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
int main(){
	double a,b,C,S,L,h;
	cin>>a>>b>>C;
	C=C*M_PI/180;
	S=a*b*sin(C)/2;
	L=a+b+sqrt(a*a+b*b-2*a*b*cos(C));
	h=b*sin(C);
	cout<<fixed<<setprecision(4)<<S<<endl;
	cout<<fixed<<setprecision(4)<<L<<endl;
	cout<<fixed<<setprecision(4)<<h<<endl;
	return 0;
}

Measured memory_bytes: 1312
h,w = map(int, input().split())

temp = ['.'*(w+2)]+['.'+input()+'.' for _ in range(h)]+['.'*(w+2)]

# print(temp)

ans_list = []

for h_i in range(1, h+1):
  w_list = []
  for w_i in range(1, w+1):
    if temp[h_i][w_i] == '.':
      top_1 = temp[h_i-1][w_i-1]
      top_2 = temp[h_i-1][w_i]
      top_3 = temp[h_i-1][w_i+1]
      left = temp[h_i][w_i-1]
      right = temp[h_i][w_i+1]
      bottom_1 = temp[h_i+1][w_i-1]
      bottom_2 = temp[h_i+1][w_i]
      bottom_3 = temp[h_i+1][w_i+1]

      count = [top_1,top_2,top_3,left,right,bottom_1,bottom_2,bottom_3].count('#')
      w_list.append(count)
    else:
      w_list.append('#')
   
  ans_list.append(w_list)

for ans_i in ans_list:print(*ans_i, sep='')

Measured memory_bytes: 3444
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

int calculate_digits_total(int x) {
	int digits_total = 0;
	while (x) {
		digits_total += x % 10;
		x /= 10;
	}

	return digits_total;
}


int main(void) {
	LL X, Y, Z;
	cin >> X >> Y >> Z;

	LL ans = 1;
	for (LL i = 2; i <= 100000; i++) {
		if (i*Y+(i+1)*Z <= X) {
			ans = i;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define MAX_T 30
#define MAX_N 100
#define INF 1e9

int N,T,dp[MAX_N+1][MAX_T];
int arr[MAX_N],t[MAX_T],d;

int solve(int idx,int pos){
  if(idx == d+1) return 0;
  if(dp[idx][pos] != -1){
    return dp[idx][pos];
  }
  int res = INF;
  for(int i = 0 ; i < T ; i++){
    if(t[pos] <= arr[idx]){
      res = min(res,solve(idx+1,(pos+1)%T));
    }
    res = min(res,solve(idx+1,1)+1);
  }
  return dp[idx][pos] = res;
}

int main(){
  while(cin >> T, T){
    for(int i = 0 ; i < MAX_N ; i++){
      arr[i] = INF;
    }
    for(int i = 0 ; i < T ; i++){
      cin >> t[i];
    }
    int D,M;
    d = 0;
    cin >> N;
    for(int i = 0 ; i < N ; i++){
      cin >> D >> M; D--;
      d = max(d,D);
      arr[D] = min(arr[D],M);
    }
    memset(dp,-1,sizeof(dp));  
    cout << solve(0,0) << endl;
  }
  return 0;
}

Measured memory_bytes: 1184
#!/usr/bin/env python
#-*- coding: utf-8 -*-

from collections import defaultdict
from math import factorial as f
from fractions import gcd as g

n, k = [int (i)  for i in raw_input ().split ()]
a = [int (i)  for i in raw_input ().split ()]
a.sort (reverse = True)
print sum (a [:k])


Measured memory_bytes: 4392
if __name__=="__main__":
    l = list(input())
    N = len(l)
    results = []
    for i in range(0,N-1):
        if not l[i]==l[i+1]:
            results.append(max(i+1,N-i-1))
    if len(results):
        print(min(results))
    else:
        print(N)

Measured memory_bytes: 5904