akhauriyash/Code-Regression huggingface dataset:
// Created by nachiketbhuta
// I don't give a damn about ratings!!!!!!!!!!
// Write the solution on your own, don't copy......


#include <bits/stdc++.h>

using namespace std;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define ll long long
#define lli long long int
#define PI 3.1415926535897932384626
#define MOD1 1000000007
#define MOD9 998244353
#define precision(x, y) cout<<fixed<<setprecision(y)<<x<<endl
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define deb4(x, y, z, w) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << ", " << #w << "=" << w << endl

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

    int ac = 0, wa = 0, tle = 0, re = 0;
    string x;
    for (int i = 0; i < n; ++i)
    {
        cin >> x;
        if (x == "AC") ac++;
        else if (x == "WA") wa++;
        else if (x == "TLE") tle++;
        else if (x == "RE") re++;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    return 0;
}

Measured memory_bytes: 3632
# K - Stones
def main():
    N, K, *A = map(int, open(0).read().split())
    dp = [0] * (K + 1)
    for i in range(1, K + 1):
        for a in A:
            if i - a >= 0:
                dp[i] |= dp[i - a] ^ 1
            if dp[i]:
                break
    print("First" if dp[-1] else "Second")


if __name__ == "__main__":
    main()


Measured memory_bytes: 40048
try:
    while True:
        a = map(float, raw_input().split())
        if (a[0] < a[4] > a[2] or a[0] > a[6] < a[2] or
                a[1] < a[5] > a[3] or a[1] > a[7] < a[3]):
            print 'NO'
        else:
            print 'YES'
except EOFError:
    pass

Measured memory_bytes: 4220
# include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>
# include <queue>

# define ll long long
# define pii pair<int,int>
# define FOR(a,b) for(int a=1; a<=b; a++)
# define REP(a,b) for(int a=0; a<b; a++)
# define FORU(a,b,c) for(int a=b; a<=c; a++)
# define FORD(a,b,c) for(int a=b; a>=c; a--)

using namespace std;

int len[100005];
int main(){

    ios :: sync_with_stdio(false);
    
    int N, L;
    cin >> N >> L;
    FOR(i,N) cin >> len[i];

    int pos = -1;
    FOR(i,N-1){
        if(len[i] + len[i+1] >= L){
            pos = i;
            break;
        }
    }

    if(pos == -1){
        cout << "Impossible" << endl;
        return 0;
    }

    cout << "Possible" << endl;
    FOR(i,pos-1) cout << i << endl;
    FORD(i,N-1,pos+1) cout << i << endl;
    cout << pos << endl;
    return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
int main(){
  int a,b,c,k,ans;
  scanf("%d %d %d %d",&a,&b,&c,&k);
  if(k<=a){ans=k;}
  else if(k>a+b){ans=a-(k-a-b);}
  else{ans=a;}
  printf("%d\n",ans);
}

Measured memory_bytes: 1732
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int number = Integer.parseInt(sc.next());
		int[] arrays = new int[number];

		for (int i = 0; i < number; i++) {

			arrays[i] = Integer.parseInt(sc.next());

		}
		
		StringBuilder sb =insertionSort(arrays,number);
		
		System.out.print(sb);
		sc.close();
		
	}

	private static StringBuilder insertionSort(int[] arrays, int number) {
		
		StringBuilder sb = new StringBuilder();
		
		store(sb,arrays);
		for(int i =1;i<number;i++){
			
			int v = arrays[i];
			int j = i -1;
			while( 0<= j && v < arrays[j]){
				arrays[j+1] = arrays[j];
				j--;
			}
			arrays[j+1] = v;
			store(sb,arrays);
		}
		
		return sb;
		
	}

	private static void store(StringBuilder sb, int[] arrays) {
		
		for(int i =0; i<arrays.length;i++){
			
			sb.append(arrays[i]);
			
			if(i != arrays.length -1){
				sb.append(" ");
			}
			
			
		}
		
		
		sb.append("\n");
	}
}



Measured memory_bytes: 27360
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

ans = 0

for i, a in enumerate(A):
    big_mae = 0
    big_ushiro = 0
    for j in range(i):
        if A[j] < a:
            big_mae += 1
    for j in range(i + 1, N):
        if A[j] < a:
            big_ushiro += 1
    
    # print((big_mae, big_ushiro, big_ushiro*K + (big_mae + big_ushiro)*K*(K-1)//2))

    ans += big_ushiro*K + (big_mae + big_ushiro)*K*(K-1)//2
    ans %= 1000000007

print(ans) 

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};

#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int nax=3007;

int n;
int tab[nax];

int tak[nax];

vector <int> graf[nax];

int main()
{
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
		scanf("%d", &tab[i]);
	for (int i=1; i<n; i++)
	{
		int p1, p2;
		scanf("%d%d", &p1, &p2);
		graf[p1].push_back(p2);
		graf[p2].push_back(p1);
	}
	for (int h=1; h<=n; h++)
	{
		for (int i=1; i<=n; i++)
		{
			tak[i]=0;
			for (int j=0; j<graf[i].size(); j++)
			{
				if (tab[graf[i][j]]<tab[i] && !tak[graf[i][j]])
				{
					tak[i]=1;
				}
			}
			
		}
	}
	for (int i=1; i<=n; i++)
		if (tak[i])
			printf("%d ", i);
	printf("\n");
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int n;
	int mat[11][11] = {0};
	int i, j;
	
	while (1) {
		scanf("%d", &n);
		if (n == 0) break;
		
		for (i = 0; i < n; i++) {
			for (j = 0; j < n; j++) {
				scanf("%d", &mat[i][j]);
				mat[i][n] += mat[i][j];
				mat[n][j] += mat[i][j];
			}
			mat[n][n] += mat[i][n];
		}
		
		for (i = 0; i <= n; i++) {
			for (j = 0; j <= n; j++) {
				printf("%5d", mat[i][j]);
				mat[i][j] = 0;
			}
			printf("\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 612
package main

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

func main() {
	a := nextString()
	b := nextString()

	if a == "H" {
		fmt.Println(b)
	} else if b == "H" {
		fmt.Println("D")
	} else {
		fmt.Println("H")
	}
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	if x < y {
		return x
	}

	return y
}

// ---------- Util.


Measured memory_bytes: 640
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    string s;
    cin >> s;
    int n = s.length();
    int cnt = 0;
    int ans = 0;
    REP(i,n) {
        for (int j = i; j < n; ++j) {
            if (s[j] == 'A' || s[j] == 'T' || s[j] == 'G' || s[j] == 'C') cnt++;
            else break;
        }
        ans = max(ans, cnt);
        cnt = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define endl "\n"
#define SIZE 1000001
ll parent[1000001];
ll Rank[1000001];
int findParent(int a)
{
    if (parent[a] == a)
    {
        return a;
    }
    else
    {
        parent[a] = findParent(parent[a]);
    }
    return parent[a];
}
void Union(int a, int b)
{
    int parentA = findParent(a);
    int parentB = findParent(b);
    if (parentA == parentB)
    {
        if (Rank[parentA] < Rank[parentB])
        {
            parent[parentA] = parentB;
        }
        else if (Rank[parentB] < Rank[parentA])
        {
            parent[parentB] = parentA;
        }
        else
        {
            parent[parentB] = parentA;
            Rank[parentA]++;
        }
    }
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
// gcd of a and b
void count(int curIndex, int originalIndex, int &day, vector<int> &days, vector<int> &a)
{
    if (curIndex == originalIndex)
    {
        days[originalIndex - 1] = day;
        return;
    }
    day++;
    count(a[curIndex - 1], originalIndex, day, days, a);
    days[curIndex - 1] = days[originalIndex - 1];
}
void rever(string &str, int index)
{
    index++;
    if (index - 1 < 0)
    {
        return;
    }
    for (int i = 0; i < index; i++)
    {
        if (str[i] == '0')
        {
            str[i] = '1';
        }
        else
        {
            str[i] = '0';
        }
    }
    for (int i = 0; i < index / 2; i++)
    {
        swap(str[i], str[index - i - 1]);
    }
}
ll powe(ll x, ll y)
{
    ll res = 1;
    x = x % mod;

    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % mod;

        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}
int sign(int a)
{
    if (a > 0)
    {
        return 1;
    }
    if (a < 0)
    {
        return -1;
    }
    return 0;
}

void solve()
{
    string s, t;
    cin >> s >> t;
    int n = s.length();
    int m = t.length();
    int L[n + 1][m + 1];
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= m; j++)
        {
            if (i == 0 || j == 0)
            {
                L[i][j] = 0;
            }
            else if (s[i - 1] == t[j - 1])
            {
                L[i][j] = 1 + L[i - 1][j - 1];
            }
            else
            {
                L[i][j] = max(L[i - 1][j], L[i][j - 1]);
            }
        }
    }
    int index = L[n][m];
    char lcs[index + 1];
    lcs[index] = '\0';
    int i = n, j = m;
    while (i > 0 && j > 0)
    {
        if (s[i - 1] == t[j - 1])
        {
            lcs[index - 1] = s[i - 1];
            i--;
            j--;
            index--;
        }
        else if (L[i - 1][j] > L[i][j - 1])
        {
            i--;
        }
        else
        {
            j--;
        }
    }
    cout << lcs << endl;
}
//STL based comparing
int main()
{

    int t = 1;
    //cin >> t;
    //t = 1;
    for (int i = 1; i <= t; i++)
    {
        //cout << "Case #" << i << ":" << endl;
        solve();
    }
    return 0;
}

Measured memory_bytes: 38764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


int main(){
    string n ;
    cin >> n ;
    int64_t s ;
    for (int i = 0; i < n.size(); i++)
    {
        s += n.at(i) - '0' ;
    }
    if (s % 9 == 0)
    {
        cout << "Yes" << endl ;
    }else
    {
        cout << "No" << endl ;
    }
    
    
    
}


Measured memory_bytes: 3724
#include <iostream>

int main() {
    int s; std::cin >>s;
    int cn=0,t;
    t=s;
    while(s!=0) {
        cn += s - (s / 10) * 10;
        s /= 10;
    }
    if((cn==0) || ((t%cn)==0))
        std::cout<<"Yes";
    else
        std::cout <<"No";
    return 0;
}

Measured memory_bytes: 256
from itertools import combinations
n, m, x = list(map(int, input().split()))
ca = [list(map(int, input().split())) for _ in range(n)]
mincost = 1e+7
can = False
for i in range(1, n + 1):
    for J in combinations(range(n), i):
        score = [0] * m
        cost = 0
        for j in J:
            cost += ca[j][0]
            for k in range(m):
                score[k] += ca[j][k + 1]
        if all([a >= x for a in score]):
            mincost = min(mincost, cost)
            can = True
if can:
    print(mincost)
else:
    print('-1')

Measured memory_bytes: 68600
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<map>
#include<set> 
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<math.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll ksm(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
		{
			ans=ans*a%mod;
		}
		b>>=1;
		a=a*a%mod;
	}
	return ans;
}
int main()
{
	ll n;
	cin>>n;
	ll ans=(ksm(10,n)-ksm(9,n)-ksm(9,n)+ksm(8,n))%mod;
	ans=(ans+mod)%mod; 
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#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()
{
    int n;
    cin >> n;
    ll sum = 0;
    if(n == 1){
        cout << 0 << endl;
    }
    else{
        for(int i = 1; i < n; i++){
            sum += i;
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N;
    cin >> N;
    vector<string> w;
    string tmp;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        w.push_back(tmp);
    }
    bool f = true;

    for (int i = 1; i < N; i++)
    {
        if (w[i - 1][w[i - 1].length() - 1] != w[i][0])
        {
            f = false;
        }
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            if (w[i] == w[j])
            {
                f = false;
            }
        }
    }
    if (f == true)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*CODE BY VIJAY MUKHIJA*/
#include<bits/stdc++.h>
#define lli long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define MOD 1000000007
#define SMOD 998244353
#define what_is(x) cout << #x << " is " << x << endl
#define what_are(x,y) cout<< #x <<" is " << x << " "<< #y <<" is " << y <<endl
using namespace std;

lli Powerm(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m; lli t=Powerm(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
lli Power(lli a,lli b){ if(b==0) return 1; if(b==1) return a; lli t=Power(a,b/2); t=(t*t); if(b&1)t=(t*a); return t;}
lli Gcd(lli a,lli b) { if(b==0) { return a; } else { return Gcd(b,a%b); } }
lli LeftMostSetBit(lli n){ if (n == 0){return 0; } lli msb = 0; while (n != 0) {n = n / 2; msb++; } return msb; }
lli RightMostSetBit(lli n){ return __builtin_ffsl(n); }
lli LLsqrt(lli x){ if(x==0 || x==1) return x; lli start=1, end=x/2, ans; while(start<=end) { lli mid=(start+end)/2; if(mid*mid==x) return mid;
else if(mid <= x/mid) ans=mid,start=mid+1; else end=mid-1; }  return ans; }
void input()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int main()
{
    lli a;
    cin>>a;
    cout<<a+a*a+a*a*a<<endl;

    
}

Measured memory_bytes: 3604
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAXN = 100010;

int n, m;
int F[MAXN], size[MAXN];
int a[MAXN], b[MAXN];

int father(int x)
{
	return F[x] == x ? x : F[x] = father(F[x]);
}

int main()
{

	cin >> n >> m;
	for (int i = 1; i <= n; ++ i)
	{
		F[i] = i;
		size[i] = 1;
	}
	for (int i = 1; i <= m; ++ i)
		cin >> a[i] >> b[i];
		
	ll ans = (ll)n*(n-1)/2;
	vector<ll> v;
	for (int i = m; i >= 1; -- i)
	{
		v.push_back(ans);
		int x = father(a[i]), y = father(b[i]);
		if (x == y) continue;
		ans -= (ll)size[x]*size[y];
		F[x] = y;
		size[y] += size[x];
	}
	reverse(v.begin(), v.end());
	for (auto c : v)
		cout << c << endl;

	return 0;
}


Measured memory_bytes: 3828
#include <iostream>

using namespace std;

int main() {
	int e;
	while ( cin >> e, e ) {
		int ans = e;
		for (int z = 0; z*z*z <= e; ++z) {
			for (int y = 0; z*z*z + y*y <= e; ++y) {
				int x = e - (y*y + z*z*z);
				ans = min(ans, x+y+z);
			}
		}
//		int x = 0, y = 0, z = 0;
//		if (e >= 8) { for (z = 2; z*z*z <= e; ++z); --z, e -= z*z*z; }
//		if (e >= 4) { for (y = 2; y*y <= e; ++y); --y, e -= y*y; }
//		x = e;
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
import sys
sys.setrecursionlimit(100000) 

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
AB = AB[::-1]
res = (N*(N-1))//2
ans = []
for l in AB:
    l[0] -= 1
    l[1] -= 1
parent = [-1]*N


def root(node):
    if parent[node] < 0:
        return node
    else:
        parent[node] = root(parent[node])
        return parent[node]


def size(node):
    return -parent[root(node)]


def connect(a, b):
    a = root(a)
    b = root(b)
    if a == b:
        return False
    parent[a] += parent[b]
    parent[b] = a
    return True


for A, B in AB:
    ans.append(res)
    a = size(A)
    b = size(B)
    if connect(A, B):
        res -= a*b

for i in ans[::-1]:
    print(i)


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

using namespace std;

int main() {
    int N;
    cin >> N;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (i * j == N) {
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
}

Measured memory_bytes: 256
import sys
N = int(input())
s = input()
not_sw = {'S':'W', 'W':'S'}

for sw1 in ['S', 'W']:
    for sw2 in ['S', 'W']:
        flag = True
        ans = [''] * (N+1)
        ans[0] = sw1
        ans[-1] = sw1
        if (s[0] == 'o' and ans[0] == 'S')  or (s[0] == 'x' and ans[0] == 'W'):
            ans[1] = sw2
            ans[-2] = sw2
        elif (s[0] == 'x' and ans[0] == 'S')  or (s[0] == 'o' and ans[0] == 'W'):
            ans[1] = not_sw[sw2]
            ans[-2] = sw2
        for i in range(1, N-2):
            if (s[i] == 'o' and ans[i] == 'S')  or (s[i] == 'x' and ans[i] == 'W'):
                ans[i+1] = ans[i-1]
            elif (s[i] == 'x' and ans[i] == 'S')  or (s[i] == 'o' and ans[i] == 'W'):
                ans[i+1] = not_sw[ans[i-1]]
        for i in range(N-2, N):
            if (s[i] == 'o' and ans[i] == 'S')  or (s[i] == 'x' and ans[i] == 'W'):
                if ans[i+1] != ans[i-1]:
                    flag = False
            elif (s[i] == 'x' and ans[i] == 'S')  or (s[i] == 'o' and ans[i] == 'W'):
                if ans[i+1] != not_sw[ans[i-1]]:
                    flag = False
        if flag:
            print(''.join(ans[:-1]))
            sys.exit()
print(-1)


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

int main()
{
	long long i = 0, j = 0, k = 0, ans = 0;
	long double n, t, a, h[1000] = {0};
	cin >> n >> t >> a;
	for (i; i < n;i++)
		cin >> h[i];

	long double l = LLONG_MAX;
	for (i = 0; i < n;i++){
		long double tem = t - h[i] * 0.006;
		if(l>fabsl(a-tem)){
			l = fabsl(a-tem);
			ans = i+1;
		}
	}

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

Measured memory_bytes: 256
#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(){
  int n,i=0,s=1;
  cin >> n;
 while(s!=0)
 {
      i++;
 	s=n*i;
   s=s%360;

 }
  cout << i <<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>

int main()
{
    int x,a,b,c,d;
    scanf("%d",&x);
    a=x%10;
    x=x/10;
    b=x%10;
    x=x/10;
    c=x%10;
    x=x/10;
    d=x%10;
    if(a == b && a==c){
        printf("Yes\n");
    }
    else if(d == c && d == b){
        printf("Yes\n");
    }
    else
        printf("No\n");
    return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repv(i,a,b) for(ll i=b-1;i>=a;i--)

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;}

int n,arr[25];

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=0;i<n;i++) cin>>arr[i];
    int cnt=0;
    for(int i=1;i<n-1;i++)
    {
        if((arr[i]>arr[i-1] && arr[i]<arr[i+1]) || (arr[i]<arr[i-1] && arr[i]>arr[i+1])) cnt++; 
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
{-# LANGUAGE CPP #-}
module Main where

import qualified Data.Vector.Unboxed as V 
import qualified Data.Map.Strict as M
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.Char

dump :: (Show a) => a -> IO()
#if __GLASGOW_HASKELL__ >= 800
dump x = print x
#else
dump _ = pure ()
#endif

-- "101010" -> [1,0,1,0,1,0]
readToList :: String -> [Int]
readToList [] = []
readToList (x:xs) = read [x] : readToList xs

-- "10 10 10" -> [10, 10, 10]
getlist :: IO [Int]
getlist = (fmap (read . BS.unpack) . BS.words) <$> BS.getLine

-- "10 10 10" -> [10, 10, 10]
getIntVec :: Int -> IO (V.Vector Int)
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readmat :: Int -> IO [[Int]]
readmat rows = replicateM rows getlist

newtype UF a = UF (M.Map a a) deriving (Show) -- Map node parent

makeuf :: Int -> UF Int
makeuf n = let m = M.fromList $ zip [0..n] [0..n]
                in UF m

union :: (Eq a, Ord a) => a -> a -> UF a -> UF a
union l r uf@(UF m) = let lp = find l uf
                          rp = find r uf
                      in if lp == rp
                         then uf
                         else if size l uf < size r uf
                              then UF $ M.update (const $ Just rp) lp m
                              else UF $ M.update (const $ Just lp) rp m

find :: (Eq a, Ord a) => a -> UF a -> a
find x uf@(UF m) = let px = m M.! x
                in if px == x
                   then px
                   else find px uf -- TODO 貼り直し

size :: (Eq a, Ord a) => a -> UF a -> Int
size x (UF m) = M.size $ M.filter (\par -> par==x) m

genbit :: Int -> [[Int]]
genbit 0 = []
genbit 1 = [[0],[1]]
genbit len = do
  x <- [0,1]
  map (x:) $ genbit (len-1)

base :: Int
base = 10 ^ 9 + 7

forn :: (Num a, Enum a, Monad m) => a -> (a -> m b) -> m [b]
forn x = forM [0..(x-1)]

count :: (Eq a) => a -> [a] -> Int
count y = length . filter (== y)

step :: Maybe (Int,Int) -> (Int,Int,Int) -> Maybe (Int,Int)
step (Just (t1, x1)) (t,x,y) = if (t-t1) `mod` 2 == (x+y-x1) `mod` 2 && (t-t1) >= (x+y-x1)
                                  then Just (t, x+y)
                                  else Nothing
step Nothing _ = Nothing

main :: IO()
main = do
  [n] <- getlist
  xs<- replicateM n $ (\[t,x,y] -> (t,x,y)) <$> getlist
  let r = foldl step (Just (0,0)) xs
  if r == Nothing
     then putStrLn "No"
     else putStrLn "Yes"


Measured memory_bytes: 35580
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  ll a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  ll syou = 0;
  syou = min(a,b);
  syou = min(syou,c);
  syou = min(syou,d);
  syou = min(syou,e);
  ll kaisuu = 0;
  if(n % syou == 0)kaisuu = n / syou;
  else kaisuu = n / syou + 1;
  cout << 4 + kaisuu << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

#define MAX_V 100010
#define INF 1000000000

struct edge{int to, cost;};
typedef pair<int,int> P;

vector<edge> G[MAX_V];
int mn[MAX_V];

void ae(int from, int to, int cost){
  edge e = {to,cost};
  G[from].push_back(e);
}

void dijk(int start, int V){
  priority_queue<P, vector<P>, greater<P> > que;
  for(int i = 0; i < V; i++)mn[i] = INF;
  mn[start] = 0;
  que.push(P(0,start));
  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.second;
    if(mn[v]<p.first)continue;
    for(int i = 0; i < G[v].size(); i++){
      edge e = G[v][i];
      if(mn[e.to] > mn[v]+e.cost){
        mn[e.to] = mn[v]+e.cost;
        que.push(P(mn[e.to],e.to));
      }
    }
  }
}

ll d1[100010];
ll d2[100010];
ll dd[100010];

vector<vector<ll> > vv;

void dfs(ll a, ll p, ll h){
  if(vv[a].sz==1&&p!=-1){
    return;
  }
  rep(i,0,vv[a].sz){
    if(vv[a][i]==p)continue;
    dfs(vv[a][i],a,h+1);
  }
  return;
}

int main(){
  ll n,x,y;
  cin>>n>>x>>y;
  x--;y--;
  vector<pair<ll,ll> > vp;
  rep(i,0,n-1){
    ll a,b;
    cin>>a>>b;
    a--;b--;
    vp.pb(mp(a,b));
    ae(a,b,1);
    ae(b,a,1);
  }
  dijk(x,n);
  rep(i,0,n){
    d1[i] = mn[i];
  }
  dijk(y,n);
  rep(i,0,n){
    d2[i] = mn[i];
  }
  clr(dd,0);
  rep(i,0,n){
    if(d1[i]>=d2[i]){
      dd[i] = 1;
    }
  }
  ll mx = 0;
  rep(i,0,n){
    if(dd[i]==0){
      mx = max(mx,d2[i]);
    }
  }
  cout << mx-1 << endl;
  return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;

    if(a != 1 && b != 1){
        cout << 1 << endl;
    }
    if(a != 2 && b != 2){
        cout << 2 << endl;
    }
    if(a != 3 && b != 3){
        cout << 3 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
#define GETINT(x) int (x); cin >> (x);
#define FOR(i, N) for(int i = 0; i < (N); (i)++)
#define RET cout << endl;
constexpr int _10e(int n) { return n == 0 ? 1 : 10 * _10e(n - 1); }

int main() {
    GETINT(N);
    GETINT(M);

    map<int, map<int, int>> prefs;
    FOR(i, M) {
        GETINT(P);
        GETINT(Y);
        prefs[P][Y] = i;
    }

    map<int, pair<int, int>> cities;
    for (int p = 1; p <= N; p++) {
        int cnum = 1;
        for (auto m: prefs[p]) {
            cities[m.second] = make_pair(p, cnum++);
        }
    }

    for (int c = 0; c < M; c++) {
        auto city = cities[c];
        ostringstream sout;
        sout << setfill('0') << std::setw(6) << city.first << setfill('0') << std::setw(6) << city.second;
        cout << sout.str() << endl;
    }

    return 0;
}

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

ll comb[500][10];
ll ans, dif[10];
ll n,m,l;
ll alpha[3][10];
int use[10];

ll calc(void){
  ll dp[10][70] = {};
  rep(i,m)dp[0][i] = 1;

  rep(i,l-1)rep(j,m){
    if(dif[i]==2){
      for(int k=j+2;k<m;k++)dp[i+1][k] += dp[i][j];
    }else{
      if(j+dif[i]<m)dp[i+1][j+dif[i]] += dp[i][j];
    }
  }
  
  ll res = 0;
  rep(i,m)res += dp[l-1][i];

  int len = 1;
  rep(i,l-1){
    if(dif[i]==0)len++;
    else{
      res *= comb[n][len];
      len = 1;
    }
  }
  res *= comb[n][len];

  return res;
}

bool check(int d){
  if(d==3)return true;

  int tmpu[10], tmpa[10];
  rep(i,l){
    int cnt = 0;
    rep(j,l)tmpu[j] = use[j];
    rep(j,10){
      tmpa[j] = alpha[d][j];
      cnt += alpha[d][j];
    }

    int p = i, num = 0, sum = 0;
    while(p<l && tmpa[num]){
      while(p<l && tmpa[num]){
	if(!use[p] && sum == num){
	  use[p] = 1;
	  tmpa[num]--;
	  cnt--;
	}
	sum += dif[p];
	p++;
      }
      num++;
    }

    if(cnt==0 && check(d+1))return true;
    rep(j,l)use[j] = tmpu[j];
  }
  return false;
}

void rec(int d){
  if(d == l-1){
    memset(use,0,sizeof(use));
    if(!check(0))return;

    ans += calc();
    return;
  }

  rep(i,3){
    dif[d] = i;
    rec(d+1);
  }
}

int main(){
  memset(comb,0,sizeof(comb));
  comb[0][0] = 1;
  rep(i,420){
    comb[i+1][0] = 1;
    rep(j,7)comb[i+1][j+1] = comb[i][j+1] + comb[i][j];
  }

  while(cin >> n >> m >> l, n){
    vector<string> h(l);
    rep(i,l)cin >> h[i];
    memset(alpha,0,sizeof(alpha));
    
    rep(i,l){
      if(h[i] == "*")continue;
      int id = h[i][0]-'a';
      alpha[id][h[i].size()-1]++;
    }
    
    ans = 0;
    rec(0);
    cout << fixed << setprecision(9) << (double)ans/comb[n*m][l] << endl;
  }
}

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

#define vi vector<int>
#define vvi vector<vi>

int main() {

    int N;
    cin >> N;

    int count = 0;
    if (N < 10) {
        cout << N << endl;
        return 0;
    }
    count += 9;

    if (N < 100) {
        cout << count << endl;
        return 0;
    }

    if (N < 1000) {
        count += (N - 99);
        cout << count << endl;
        return 0;
    }

    count += 900;

    if (N < 10000) {
        cout << count << endl;
        return 0;
    }

    if (N < 100000) {
        count += (N - 9999);
        cout << count << endl;
        return 0;
    }

    count += 90000;
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var A = sc.nextInt()
    var B = sc.nextInt()

    if (A == 1) {
        A = 14
    }
    if (B == 1) {
        B = 14
    }
    if (A > B) {
        println("Alice")
    } else if (A < B) {
        println("Bob")
    } else {
        println("Draw")
    }
}


Measured memory_bytes: 21560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int N, tmp;
    vi L;
    cin >> N;
    REP(i, N)
    {
        cin >> tmp;
        L.push_back(tmp);
    }
    sort(ALL(L));
    int minn, maxx;
    int ans = 0;
    REP(i, N - 2)
    {
        FOR(j, i + 1, N - 1)
        {
            minn = L[j] - L[i];
            maxx = L[i] + L[j];
            FOR(k, j + 1, N)
            if (L[k] > minn)
                if (L[k] < maxx)
                    ans++;
        }
    }
    cout << ans << endl;

    // system("pause");
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_b() {
	ull x;

	cin >> x;

	ull val = 100;
	ull ans = 0;
	while (1) {
		if (val >= x) {
			break;
		}
		val *= 1.01;
		ans++;
	}

	cout << ans << "\n";
}

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

	solve_abc_b();

	return 0;
}

Measured memory_bytes: 3652
from collections import Counter

n = int(input())
xs = [int(w) for w in input().split()]

counter = Counter(xs)

descent = sorted(xs, reverse=True)

def minimal_greater_power(x):
    b = len("{0:b}".format(x))
    return 2 ** b

ans = 0

for x in descent:
    if x not in counter:
        continue
    if counter[x] == 0:
        continue

    counter[x] -= 1

    pair = minimal_greater_power(x) - x
    if pair not in counter:
        continue
    if counter[pair] == 0:
        continue

    ans += 1
    counter[pair] -= 1

print(ans)


Measured memory_bytes: 33216
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <random>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

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

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    int D, alp = 26;
    cin >> D;
    vector<int> c(alp), t(D);
    vector<vector<int>> s(D, vector<int>(alp));
    for (int i = 0; i < alp; i++) {
        cin >> c[i];
    }
    for (int i = 0; i < D; i++) {
        for (int j = 0; j < alp; j++) {
            cin >> s[i][j];
        }
    }

    for (int i = 0; i < D; i++) {
        cout << distance(s[i].begin(), max_element(s[i].begin(), s[i].end())) + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3688
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<queue>
#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MAX 1000000007
#define MAX_V 2*100000+10

using namespace std;



bool cmpf(const pair<lli, lli> left, const pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmps(const pair<lli, lli> left, const pair<lli, lli> right) {
	return left.second < right.second;
}
using namespace std;
lli k, n, m, e;


int main() {
	cin >> n;
	vector<lli>a(n + 2, 0), b(n + 2, 0);
	lli ans=0;
	rep1(i, n+1) {
		cin >> a[i];
	}
	rep1(i, n) {
		cin >> b[i];
	}
	
	rep1(i, n+1) {
		ans += min(a[i], b[i]+b[i - 1]);
		a[i] -= min(a[i], b[i - 1]);
		b[i] -= min(a[i], b[i]);
	}
	cout << ans;
}




Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<complex>
#include <string>
#include <vector>
#include <queue>
using namespace std;
 
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long

int main(){
    int a, b, t;
    cin >> a >> b >> t;
    cout << b * (t/a) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define fi first
#define se second
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 998244353;
int n, m, k;
ll fac[N], inv[N];
ll powmod(ll a, ll b)
{
	a %= mod;
	ll ans = 1;
	while(b)
	{
		if(b&1) ans = ans*a%mod;
		a = a*a%mod;
		b >>= 1;
	}
	return ans;
}
void init(int n)
{
	fac[0] = 1;
	for(int i=1; i<=n; i++) fac[i] = fac[i-1]*i%mod;
	inv[n] = powmod(fac[n], mod-2);
	for(int i=n-1; i>=0; i--) inv[i] = inv[i+1]*(i+1)%mod;
}
ll comp(ll a,ll b)
{
	if(a<b||b<0||a<0) return 0;
	return fac[a]*inv[b]%mod*inv[a-b]%mod;
}
int main()
{
	scanf("%d%d%d", &n, &m, &k);
	init(n);
	ll ans = 0;
	for(int i=0; i<=k; i++)
		(ans += comp(n-1, n-i-1)*m%mod*powmod(m-1, n-i-1)%mod) %= mod;
	if(ans<0) ans += mod;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 6836
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

int main(){
	int n, m;
	std::cin >> n >> m;

	using image = std::vector<std::string>;
	image As( n ), Bs( m );

	for( auto&a : As )
		std::cin >> a;
	for( auto&b : Bs )
		std::cin >> b;

	bool ans = true;
	for( int i{}; i <= n - m; ++i )
	{
		for( int j{}; j <= n - m; ++j )
		{
			ans = true;
			for( int k{}; k < m; ++k )
			{
				const auto x = As[i+k].substr( j, m ) == Bs[k];
				ans &= x;
//				std::cout << i << " " << j << " " << k << " => " << ( ans ? "t" : "f" ) << "\n";
			}
			if( ans )
				break;
		}
		if( ans )
			break;
	}


	std::cout << ( ans ? "Yes" : "No" ) << "\n";

	return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)      //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++)    //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> PII;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;

/*FUNCs=================================================*/
vi move1 = {0,0,1,-1};
vi move2 = {1,-1,0,0};

/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);
    
    string s; cin >> s;
    int cnt = 0;

    for(int i = 0; i < SIZE(s)/2; i++) {
        if(s[i]!=s[s.size()-1-i]) cnt++;
        //debug(s[i]);
        //debug(s[s.size()-1-i]);
        //debug(cnt);
    }


    cout << cnt<< '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
 
int main() {
    string s;
    cin >> s;
    map<char, ll> m;
    for(auto c : s) {
        m[c]++;
    }
    ll res = s.size() * (s.size() - 1) / 2 + 1;
    for(auto& p : m) {
        res -= p.second * (p.second - 1) / 2;
    }
    cout << res << endl;
}

Measured memory_bytes: 640
module.exports=function(t){var r={};function i(n){if(r[n])return r[n].exports;var e=r[n]={i:n,l:!1,exports:{}};return t[n].call(e.exports,e,e.exports,i),e.l=!0,e.exports}return i.m=t,i.c=r,i.d=function(t,r,n){i.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,r){if(1&r&&(t=i(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var e in t)i.d(n,e,function(r){return t[r]}.bind(null,e));return n},i.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(r,"a",r),r},i.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},i.p="",i(i.s=0)}([function(t,r,i){"use strict";var n=i(1);i(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,r){t.exports=require("fs")},function(t,r,i){"use strict";var n=i(3),e=i(5);t.exports=function(t){var r=new n(t);e(r)}},function(t,r,i){"use strict";var n=i(4);t.exports=class{constructor(t){var r=t.trim().split(/\s+/g);this.inp=new n(r)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,r,i){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,r,i){"use strict";var n=i(6);t.exports=function(t){for(var r=t.in(),i=t.in(),e=new n(r),s=0;s<i;s++){var o=t.in(),u=t.in();e.unite(o-1,u-1)}for(var a=t.in(),c=0;c<a;c++){var f=t.in(),h=t.in();e.isSameGroup(f-1,h-1)?console.log("yes"):console.log("no")}}},function(t,r,i){"use strict";t.exports=class{constructor(t){this.N=t,this.par=new Array(this.N),this.rank=new Array(this.N);for(var r=0;r<this.N;r++)this.par[r]=r,this.rank[r]=0}find(t){return this.par[t]==t?t:this.par[t]=this.find(this.par[t])}unite(t,r){var i=this.find(t),n=this.find(r);i!=n&&(this.rank[i]<this.rank[n]?this.par[i]=n:(this.par[n]=i,this.rank[i]==this.rank[n]&&this.rank[i]++))}isSameGroup(t,r){return this.find(t)==this.find(r)}}}]);


Measured memory_bytes: 41136
#include<stdio.h>

int main(void) {
    int n, k, i, j, nonsense, ans = 0, l[50];

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

    for(i = 0; i < n; i++) {
        for(j = i+1; j < n; j++) {
            if(l[i] < l[j]) {
                nonsense = l[i];
                l[i] = l[j];
                l[j] = nonsense;
            }
        }
    }

    for(i = 0; i < k; i++) {
        ans += l[i];
    }

    printf("%d", ans);
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#define MAX 100001
using namespace std;

int main()
{
    int n, temp;
    //scanf("%d", &n);
    cin >> n;

    vector<int> vec;
    for (int i = 0; i < n; i++)
    {
        //scanf("%d", &temp);
        cin >> temp;
        vec.push_back(temp);
    }

    int q, num;
    //scanf("%d", &q);
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        //scanf("%d", &num);
        cin >> num;
        vector<int>::iterator itr = lower_bound(vec.begin(), vec.end(), num);
        vector<int>::iterator upper = upper_bound(vec.begin(), vec.end(), num);
        //printf("%d %d\n", itr - vec.begin(), upper - vec.begin());
        cout << itr - vec.begin() << " " << upper - vec.begin() << endl;
    }


    return 0;
}



Measured memory_bytes: 3516
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '(L' << __LINE__ << ')' << ' ' << __FILE__ << endl;




uint64_t N,ANS;

uint64_t gcd(uint64_t a,uint64_t b){
    if(a<b){swap(a,b);}
    if(b==0) return a;
    return gcd(b,a%b);
}

uint64_t lcm(uint64_t a,uint64_t b){
    if(a==b){return a;}
    //return a*b/gcd(a,b);
    return a/gcd(a,b)*b;
    
}

int main(){
 
    cin>>N;
    uint64_t t1,t2;
    cin>>t1;
    REP(i,N-1){
        cin>>t2;
        t1=lcm(t1,t2);
        cerr<<"lcm:"<<t1<<endl;
    }
    
    cout<<t1<<endl;

}



Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cstdio>
#include<queue>
#include<cstdlib>
#define MAX 3000
#define F first
#define S second
using namespace std;

class P{
public:
  int to,rev,capacity;
  P():to(0),rev(0),capacity(0){}
  P(int to,int capacity,int rev):to(to),capacity(capacity),rev(rev){}
};

typedef pair<int,vector<int> > IVI;

typedef vector<int> VI;
typedef vector<vector<P> > VVP;
map<int,map<int,bool> > exist;
VVP G;
int st,ed;
bool used[MAX];

void add_node(int from,int to)
{
  G[from].push_back(P(to,1,G[to].size()));
  G[to].push_back(P(from,0,G[from].size()-1));
}

int dfs(int now,int f)
{
  if(now == ed)
    return f;
  used[now] = true;

  for(int i=0;i < G[now].size();i++)
    {
      P& p =  G[now][i];
      if(used[p.to] || p.capacity <= 0)
	continue;

      int res = dfs(p.to,min(f,p.capacity));
      if(res <= 0)
	continue;

      p.capacity -= res;
      G[p.to][p.rev].capacity += res;
      return res;
    }
  return 0;
} 

int maximum_flow(int n)
{
  int res = 0;
  for(;;)
    {
      for(int i=0;i<n;i++)
	used[i] = false;
      int f = dfs(st,1000000000);
      if(!f)
	return res;
      res += f;
    }
}


map<int,bool> decomp(int v)
{
  if(exist.count(v) > 0)
    return exist[v];

  int index = v;
  map<int,bool> vi;
  for(int i=2;i<=sqrt(v);i++)
    {
      if(!(v%i))
	{
	  vi[i] = true;
	  while(!(v%i))
	    v /= i;
	  if(v == 1)
	    break;
	}
    }
  if(v != 1)
    vi[v] = true;

  exist[index] = vi;
  return vi;
}


int main()
{


  int b,r,bn,rn;

  while(true)
    {
      // 0 -> start, bn+rn+1

      cin >> bn >> rn;
      if(bn+rn == 0)
	break;

      st = 0,ed = bn+rn+1;
      G.clear();
      G.resize(2+bn+rn);
  

      vector<map<int,bool> > bs;
      bs.resize(bn+1);
    
      for(int i=0;i<bn;i++)
	{
	  cin >> b;
	  add_node(0,i+1);
	  bs[i] = decomp(b);
	}

      for(int i=0;i<rn;i++)
	{
	  cin >> r;
	  add_node(bn+i+1,ed);
	  map<int,bool> vi = decomp(r);
	  for(int k=0;k<bn;k++)
	    {
	      for(map<int,bool>::iterator it = bs[k].begin();it != bs[k].end();it++)
		{
		 
		  if(vi[(*it).F])
		    {
		    
		      add_node(k+1,bn+i+1);
		      break;
		    }
		}
	    }
	}

      /*
      for(int i=0;i<=ed;i++)
	{
	  cout << "i = " << i << endl;
	  for(int j=0;j<G[i].size();j++)
	    {
	      cout << G[i][j].to << " ";
	    }
	  cout << endl;
	}
      */
      cout << maximum_flow(bn+rn+2) << endl;


    }

  return 0;
}

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

int main(){
    string s,t;
    cin >> s >> t;
    ll ans = inf;
    for(int i=0; i<=s.size()-t.size(); i++){
        ll a = 0;
        for(int j=0; j<t.size(); j++){
            if(s.at(j+i)!=t.at(j)){
                a++;
            }
        }
        ans = min(ans,a);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636