akhauriyash/Code-Regression huggingface dataset:
using System;


namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            double PI = 3.14159265358979323846264338327950;
            string x = Console.ReadLine();
            //y[]はchar
            //切り分け
            string[] y = x.Split();
            //int型に直す
            double a = int.Parse(y[0]);
            double b = int.Parse(y[1]);
            double h = int.Parse(y[2]);
            double m = int.Parse(y[3]);

            double hh, mm;
            double kakudo;
            double rad;
            double c, cc;

            hh = 30 * h + m / 2;
            mm = 6 * m;

            if (Math.Abs(hh-mm) >=  180)
            {
                kakudo = 360 - Math.Abs(hh-mm);
            }
            else {
                kakudo = Math.Abs(hh-mm);
            }
            rad = kakudo * PI / 180;          
            
            //Console.WriteLine(kakudo);
            //Console.WriteLine(rad);

            cc = b * b + a * a - 2 * a * b * Math.Cos(rad);
            c = Math.Sqrt(cc);

            string text = c.ToString("F20");
            Console.WriteLine(text);
        }
    }
}


Measured memory_bytes: 27924
#include<bits/stdc++.h>
using namespace std;
int main()
{
	vector<char> arr,brr,crr;
	vector<char>::iterator ptr,qtr;
	int n,i,j;
	cin>>n;char c;
	for(i=0;i<n;i++)
	{
		cin>>c;
		arr.push_back(c);
	}
	for(i=0;i<n;i++)
	{
		cin>>c;
		brr.push_back(c);
	}
	for(ptr=arr.begin(),qtr=brr.begin();ptr!=arr.end();ptr++,qtr++)
	{
		crr.push_back(*ptr);
	crr.push_back(*qtr);}
	for(ptr=crr.begin();ptr!=crr.end();ptr++)
	cout<<*ptr;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 505;

int n, m, d, a[MAXN][MAXN];
set <pii> vis;
vector <pii> trans;

inline void Dfs(int x, int y, int col)
{
	if (vis.find(mp(x, y)) != vis.end())
		return ;
	vis.insert(mp(x, y));
	bool fnd = 0;
	for (auto e : trans)
		if (x + e.xx >= 1 && x + e.xx <= n && y + e.yy >= 1 && y + e.yy <= m)
			a[x + e.xx][y + e.yy] = col, fnd = 1;
	if (fnd)
		Dfs(x + d, y + d, col ^ 2), Dfs(x - d, y - d, col ^ 2),
		Dfs(x + d, y - d, col ^ 1), Dfs(x - d, y + d, col ^ 1);
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read(), d = Read();
	if (d & 1)
	{
		for (int i = 1; i <= n; i ++, putchar(10))
			for (int j = 1; j <= m; j ++)
				if (i + j & 1)
					putchar('Y');
				else
					putchar('G');
		return 0;
	}
	for (int i = 0; i < d; i ++)
		trans.pb(mp(i, 0));
	for (int i = 1; i <= (d >> 1); i ++)
		for (int j = 0; j < d; j ++)
			if ((i << 1) + j < d)
				trans.pb(mp(i + j, i)), trans.pb(mp(i + j, -i));
	d >>= 1;
	Dfs(1, 1, 0);
	for (int i = 1; i <= n; i ++, putchar(10))
		for (int j = 1; j <= m; j ++)
			if (!a[i][j])
				putchar('R');
			else if (a[i][j] == 1)
				putchar('B');
			else if (a[i][j] == 2)
				putchar('Y');
			else
				putchar('G');
	return 0;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N,M; cin >> N >> M;
    vector<int> A(N,0);
    REP(i,M){
        int a,b; cin >> a >> b;
        A[a-1]++;
        A[b-1]++;
    }
    REP(i,N){
        cout << A[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
//Redistribution 

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int mod = 1000000007;
    int s;cin>>s;
    vector<int>d(300000,0);
    d[0]=1;
    rep(i,0,2500){
        rep(j,3,2500){
            d[i+j]=(d[i+j]%mod+d[i]%mod)%mod;
        }
    }
    cout<<d[s]<<nnn;
}

Measured memory_bytes: 5624
#include <stdio.h>
int main(){
  int a, b,tmp,c;
  int i=1;

  scanf("%d %d",&a,&b);
  if( a>b ){
    tmp = a;
    a = b;
    b = tmp;
  }

  while(b>0){
    tmp = a%b;
    a = b;
    b = tmp;
    if (tmp==0)break;
  }

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

Measured memory_bytes: 592
/**
 *    author:  silentnoob69      
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef unsigned long long ull;
typedef long long int llint;
typedef unsigned long long int ullint;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)
#define MAX 100000

void solve() {
    int a;
    cin>>a;
    if(a==1)
        cout<<"0";
    else if(a==0)
        cout<<"1";


}
int main() {
        solve();
   return 0;
   } 


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

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

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

    int cnt = 0;
    for(int i = 0; i < n; i++)
    {
        int flag = 0;
        for(int j = 0; j < i; j++)
        {
            if(a[i] < a[j])
            {
                flag = 1;
                break;
            }
        }
        if(!flag) cnt++;
    }
    cout << cnt <<endl;
    return 0;
}



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

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

  if (a * b % 2 == 0) {
    cout << "Even" << endl;
  }
  if (a * b % 2 != 0) {
    cout << "Odd" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	if(N == 1) {
		cout << "Hello World" << endl;
	} else {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    vec a(N); readv(a);
    vec b(N); readv(b);

    int n1 = 0, n2 = 0;
    REP(i, N){
        int d = b[i] - a[i];
        if(d > 0){
            if(d % 2){
                n1 += 1 + d / 2;
                n2 += 1;
            }else n1 += d / 2;
        }
        if(d < 0) n2 -= d;
    }
    Ans(n1 >= n2, "Yes", "No");

    return 0;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    priority_queue<int> prices;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        prices.push(a);
    }
    for (int i = 0; i < M; ++i) {
        int price = prices.top();
        prices.pop();
        price /= 2;
        prices.push(price);
    }
    long long ans = 0;
    for (int i = 0; i < N; ++i) {
        ans += prices.top();
        prices.pop();
    }
    cout << ans << endl;
}


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

using namespace std;

bitset<4000010>b;
int N;

int main(){
	int N;
	scanf("%d",&N); 
	b.reset();
	b.set(0);
	int S=0;
	while(N--){
		int A;
		scanf("%d",&A);
		S+=A;
		b|=(b << A);
	}		
	for (int i=(S+1)/2;i<=S;i++)
	if (b.test(i)){
		printf("%d\n",i);
		break;
	}		
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
const LL mod=1e9+7;
const LL LL_MAX=9223372036854775807;
using namespace std;
int main()
{
    int a[5]= {0,1,2,3,4};
    int b[5];
    for(int i=0; i<5; i++)
        scanf("%d",&b[i]);
    int ans=INT_MAX;
    int sum=0;
    do{
        sum=0;
        for(int i=0; i<4; i++){
            sum+=((b[a[i]]+9)/10)*10;
        }
        sum+=(b[a[4]]);

        ans=min(sum,ans);
    }while(next_permutation(a,a+5));
    printf("%d\n",ans);
    return 0;
}


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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  int x;  cin >> x;
  if(x>=30) cout << "Yes\n";
  else  cout << "No\n";
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cmath>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	ll n,ma=-1,mi=1000000001,w;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>w;
		ma=max(ma,w);
		mi=min(mi,w);
	}
	cout<<abs(ma-mi)<<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 deg[100005];
vector<int> to[100005];

struct UnionFind {
    vector<int> d;
    UnionFind(int n): d(n,-1) {}
    int root(int x) {
        if (d[x] < 0) return x;
        return d[x] = root(d[x]);
    }
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y);}
    int size(int x) { return -d[root(x)];}
};

int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);

    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        deg[a]++;
        deg[b]++;
        uf.unite(a, b);
    }

    int ans = 0;
    rep(i, n) {
        if (uf.d[i] < 0) {
            ans++; 
        }
    }
    printf("%d\n", ans-1);
}



Measured memory_bytes: 6456
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e6 + 5;
const int MOD = 1e9 + 7;

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int fact[N], invfact[N];

int modinv(int k)
{
	return pow(k, MOD-2, MOD);
}

void precompute()
{
	fact[0]=fact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
	}
	invfact[N-1]=modinv(fact[N-1]);
	for(int i=N-2;i>=0;i--)
	{
		invfact[i]=invfact[i+1]*(i+1);
		invfact[i]%=MOD;
	}
}

int nCr(int x, int y)
{
	if(y>x)
		return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=MOD;
	num*=invfact[x-y];
	num%=MOD;
	return num;
}

int n, k;
string s;

int32_t main()
{
	IOS;
	precompute();
	cin >> k >> s;
	n = s.size();
	int ans = 0;
	for(int len = n; len <= n + k; len++)
	{
		int cur = pow(26, n + k - len, MOD) * pow(25, len - n, MOD);
		cur %= MOD;
		cur *= nCr(len - 1, n - 1);
		cur %= MOD;
		ans += cur;
		ans %= MOD;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 35512
#include <stdio.h>
#include <stdlib.h>

int main () {
    int N, K;
    scanf("%d", &N);
    scanf("%d", &K);

    int *h = malloc((1+N) * sizeof(int));
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        scanf("%d", &h[i]);
        if (K <= h[i])
            ans++;
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long int ll;
#define INF (1e9)

ll N;
ll W;
vector<vector<ll>> dp(110,vector<ll>(101000,-1));
vector<ll> v(110);
vector<ll> w(110);

ll dfs(ll depth,ll aff){
    if(depth==N)
        return 0;
    
    if(dp[depth][aff]!=-1)
        return dp[depth][aff];
    
    ll ret;
    
    if(aff>=w[depth]){
        ll ret1=dfs(depth+1,aff-w[depth])+v[depth];
        ll ret2=dfs(depth+1,aff);
        ret=max(ret1,ret2);
    }
            
    if(aff<w[depth])
        ret=dfs(depth+1,aff);

    dp[depth][aff]=ret;
    return ret;
    
}

int main(){
    cin>>N>>W;    
    for(ll i=0;i<N;i++)
        cin>>w[i]>>v[i];    
    
    dfs(0,W);
    cout<<dp[0][W]<<endl;
    
    return 0;}

Measured memory_bytes: 88192
from heapq import heappush, heappop


n, q = map(int, input().split())
events = []

for i in range(n):
    s, t, x = map(int, input().split())
    if t >= x:
        events.append([t - x, 0, x])
        events.append([s - x, 1, x])
for i in range(q):
    d = int(input())
    events.append([d, 2, i])
events.sort()

dist = [-1] * q
walker = []
working = set()
heap = []
for t, kind, x in events:
    if kind == 0:
        working.remove(x)
    elif kind == 1:
        working.add(x)
        heappush(heap, x)
    elif working:
        while not heap[0] in working:
            heappop(heap)
        dist[x] = heap[0]

print(*dist, sep="\n")

Measured memory_bytes: 198916
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
x, y = map(int, input().split())
if x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
elif x in c and y in c:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
n=int(input())
s=input()

r = 0
r_l = []
g = 0
g_l = []
b = 0
b_l = []

for i in range(n):
    if s[i] == "R":
        r += 1
        r_l.append(i)
    if s[i] == "G":
        g += 1
        g_l.append(i)
    if s[i] == "B":
        b += 1
        b_l.append(i)
        
ans = r*g*b

for i in r_l:
    for j in g_l:
        tmp = abs(i-j)
        if 0 <= i-tmp and s[i-tmp] == "B":
            ans -= 1
        if 0 <= j-tmp and s[j-tmp] == "B":
            ans -= 1
        if i+tmp < n and s[i+tmp] == "B":
            ans -= 1
        if j+tmp < n and s[j+tmp] == "B":
            ans -= 1

        if (tmp / 2).is_integer():
            if s[max(i,j)-(tmp//2)] == "B":
                ans -= 1
            if max(i,j)-(tmp//2) != min(i,j)+(tmp//2) and s[min(i,j)+(tmp//2)] == "B":
                ans -= 1

print(ans)


Measured memory_bytes: 75804
#include <cstdio>

#define MAX_W 110
#define MAX_H 110

using namespace std;

int w, h;
char orchard[MAX_H][MAX_W];
bool visited[MAX_H][MAX_W];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};

void dfs(int x, int y) {
  visited[y][x] = true;
  for (int i = 0; i < 4; ++i) {
    int nx = x + dx[i], ny = y + dy[i];
    if ((0 <= nx && nx < w && 0 <= ny && ny < h) &&
        (!visited[ny][nx] && orchard[y][x] == orchard[ny][nx])) {
      dfs(nx, ny);
    }
  }
}

int main() {

  while (true) {
    scanf("%d %d", &h, &w);
    if (h == 0 && w == 0) break;
    
    for (int i = 0; i < h; ++i) {
      scanf("%s", orchard[i]);
    }
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        visited[i][j] = false;
      }
    }

    int ans = 0;
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        if (!visited[i][j]) {
          ++ans;
          dfs(j, i);
        }
      }
    }
    printf("%d\n", ans);
  }
  
  return 0;
}

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

#define ll long long int 
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i)) 
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'



#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main()
{
	_fastio
	string s;
	cin>>s;
	rv(s);
	if(s[0]=='3')
		cout<<"bon"<<en;
	else if (s[0]=='0' || s[0]=='1' || s[0]=='6' || s[0]=='8')
		cout<<"pon"<<en;
	else
		cout<<"hon"<<en;
}

Measured memory_bytes: 3652
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
        return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
        return readInts()[0];
}
auto readLongs() {
        return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
        return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    Tuple!(double, long)[] tp;
    foreach(i; iota(24)) {
        long p;
        double t;
        readlnTo(p, t);
        tp ~= tuple(t, p);
    }
    auto t1 = tp[0..8].sort();
    auto t2 = tp[8..16].sort();
    auto t3 = tp[16..24].sort();
    auto tr = t1[2..$].array ~ t2[2..$].array ~ t3[2..$].array;
    tr.sort();
    typeof(tp) finalists = t1[0..2].array ~ t2[0..2].array ~ t3[0..2].array ~ tr[0..2].array;
    foreach(fi; finalists) {
        writeln(fi[1], " ", fi[0]);
    }
}

Measured memory_bytes: 2652
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL dp[10][12]; //dp[i][j]代表以i开头的j位数有多少个lun number 
LL k, ans[12]; //ans[i]表示i位lun number的个数
int bit;

void dfs(int num, int lst) {
	if(num > bit) return ;
	if(num == 1) { //第一位直接枚举1 ~ 9
		for(int i = 1; i <= 9; i++) { //后缀共bit - num + 1位
			if(k > dp[i][bit - num + 1]) k -= dp[i][bit - num + 1];
			else {
				cout << i; //最高位的值
				dfs(num + 1, i); //这时候dfs进入下一层看第二高位是几, 进入else特判内, 记忆化搜索
				break;
			}
		}
	}
	else {
		for(int i = lst - 1; i <= lst + 1; i++) {
			if(!(i >= 0 && i <= 9)) continue;
			if(k > dp[i][bit - num + 1]) k -= dp[i][bit - num + 1];
			else {
				cout << i;
				dfs(num + 1, i);
				break;
			}
		}
	}
}

int main() {
	cin >> k;
	for(int i = 0; i < 10; i++) dp[i][1] = 1;
	ans[1] = 9LL;
	for(int j = 2; j <= 10; j++) { //位数:2 ~ 10
		for(int i = 0; i < 10; i++) { //最高位:0 ~ 9
			if(i == 0) dp[i][j] = dp[i][j - 1] + dp[i + 1][j - 1];
			//最高位i = 0时的j位数只能以i和i + 1作最高位的j - 1位数作为后缀
			else if(i == 9) dp[i][j] = dp[i - 1][j - 1] + dp[i][j - 1];
			//最高位i = 9时的j位数只能以i - 1和i作最高位的j - 1位数作为后缀
			else dp[i][j] = dp[i - 1][j - 1] + dp[i][j - 1] + dp[i + 1][j - 1]; 
			//最高位非0非9时, 以i - 1、i本身、i + 1作最高位的j - 1位数均可作为最高位是i的j位数的后缀
			if(i) ans[j] += dp[i][j]; //没有前导0时就将dp[i][j]表示的个数存入ans[j]
		}
	}
	for(int i = 1; i <= 20; i++) {
		if(k > ans[i]) k -= ans[i];
		else {
			bit = i; //所求转化为:位数为bit位的所有数中的第k小的那个(将当前k定位在bit位)
			break;
		}
	}
	dfs(1, 0);
	cout << endl;
	return 0;
}

/*
<-- 数位dp + 构造 -->
设dp[i][j]表示最高位是i, 位数是j的lun number的个数
根据极限样例, j最多为10位, i在0 ~ 9
首先初始化所有dp[i][1] = 1 (以i开头的一位数就是i本身, 只有1个)
转移方程3种情况:
1) dp[i][j] = dp[i][j - 1] + dp[i + 1][j - 1];
//最高位i = 0时的j位数只能以i和i + 1作最高位的j - 1位数作为后缀
2) dp[i][j] = dp[i - 1][j - 1] + dp[i][j - 1];
//最高位i = 9时的j位数只能以i - 1和i作最高位的j - 1位数作为后缀
3) dp[i][j] = dp[i - 1][j - 1] + dp[i][j - 1] + dp[i + 1][j - 1]; 
//最高位非0非9时, 以i - 1、i本身、i + 1作最高位的j - 1位数均可作为最高位是i的j位数的后缀

接下来进行构造:
首先定位第k小的lun number的位数bit
统计所有i位数中有多少lun number, 做一遍前缀和存进ans[i]
从低位向高位遍历, 找到第一个大于等于k的位数即为k的位数bit

确定好位数之后, 开始枚举每一位是什么
如果是第一位, 我们暴力枚举1 ~ 9
对k执行递减, 看k处于谁开头的bit位数
用找定位位数的方法, 我们可以定位第一个位置的值(已经记录了以i开头, 有j位的lun number有多少个)
然后后面的位置的数只有最多三种选择: 上次减一; 上次同样; 上次加一(在0 ~ 9之间)
然后记忆化搜所即可
*/

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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

int n, m, q;
vector<vector<int>> v;
void make(vector<int> __v)
{
  if (__v.size() == n)
  {
    v.push_back(__v);
    return;
  }
  int last;
  if (__v.size() == 0)
    last = 1;
  else
    last = __v[__v.size() - 1];
  for (int i = last; i <= m; i++)
  {
    __v.push_back(i);
    make(__v);
    __v.pop_back();
  }
}

signed main()
{
  cin >> n >> m >> q;
  int a[100], b[100], c[100], d[100];
  for (int i = 0; i < q; i++)
    cin >> a[i] >> b[i] >> c[i] >> d[i];

  vector<int> tmp;
  make(tmp);
  int mx = 0;
  for (int i = 0; i < v.size(); i++)
  {
    int sum_tmp = 0;
    for (int j = 0; j < q; j++)
    {
      if (v[i][b[j] - 1] - v[i][a[j] - 1] == c[j])
        sum_tmp += d[j];
    }
    mx = max(mx, sum_tmp);
  }
  cout << mx << endl;
}

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

const int INF = INT_MAX;

int main(){
    int N; cin >> N;
    vector<int> dp(N+1, INF);
    int b1, b2; cin >> b2 >> b1;
    dp[0] = 0;
    dp[1] = abs(b1-b2);
    for(int i=2; i<N; i++){
        int a; cin >> a;
        dp[i] = min(dp[i-2]+abs(a-b2), dp[i-1]+abs(a-b1));
        b2 = b1;
        b1 = a;
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long t,t2,n,k;
int main(){
	cin >> n >> k;
	if(k&1){
		t=n/k;
		cout << t*t*t;
	}
	else{
		t2=t=n/k;
		if(n%k>=k/2)t2++;
		cout << t*t*t+t2*t2*t2;
	}
} 

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <vector>
#include <cmath>

using namespace std;


unsigned long power(unsigned long x, unsigned long y)
{
    return static_cast<unsigned long>(pow(x, y));
}


vector<unsigned long> candidates;
unsigned long digits[] = {3, 5, 7};
unsigned long N;
void push_candidates(int d, unsigned long now)
{
    if (d == 0) {
        bool used[] = {false, false, false};
        for (unsigned long tmp = now; tmp != 0; tmp /= 10) {
            for (int i = 0; i < 3; i++) {
                if (tmp % 10 == digits[i])
                    used[i] = true;
            }
        }

        if (used[0] && used[1] && used[2] && now <= N)
            candidates.push_back(now);
        return;
    }

    for (const auto e : digits) {
        push_candidates(d - 1, now + e * power(10, d - 1));
    }
}


int main(void)
{
    cin >> N;

    int num_digits = 0;
    for (unsigned long tmp = N; tmp != 0; tmp /= 10)
        num_digits++;

    for (int i = 3; i <= num_digits; i++)
        push_candidates(i, 0);
    cout << candidates.size() << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
int main(){
  int n;
  while(cin >>n,n){
    vector<pair<int, int> > score;
    cin >>ws;
    for(int k=0; k<n; k++){
      vector<int> bowl;
      string s;
      int x = 0,sn,p=0;
      bool f = true;
      getline(cin,s);
      for(int i=0; i<s.size(); i++){
	if(s[i] == ' '){
	  if(f){sn = x;f = false;}
	  else{bowl.push_back(x);}
	  x = 0;
	}
	if(s[i]>='0' && s[i]<='9'){x = x*10+s[i]-'0';}
      }
      bowl.push_back(x);
      int a=0,b=0,c=0,d=0,e=2;
      for(int i=0; i<bowl.size(); i++){
	p+=bowl[i]*(a+1);
	d+=bowl[i];
	e--;
	a = b;
	b = 0;
	if(e == 1 && d == 10){
	  c++;
	  e = 2;
	  d = 0;
	  if(c<10){
	    a++;
	    b++;
	  }
	}
	if(e == 0){
	  c++;
	  e = 2;
	  if(d == 10 && c<10){a++;}
	  d = 0;
	}
      }
      score.push_back(make_pair(-p,sn));
    }
    sort(score.begin(),score.end());
    for(int i=0; i<score.size(); i++){
      cout<< score[i].second<<" "<<-score[i].first<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1232
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll N;
    cin >> N;
    vector<ll> h(N + 5, 0);
    rep(i, N) cin >> h[i];

    vector<ll> dp(N + 5, INF);
    dp[0] = 0;
    rep(i, N) {
        chmin(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        chmin(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }

    cout << dp[N - 1] << endl;


    return 0;
}

Measured memory_bytes: 4784
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

#define NONE -1

// c: øÌ 1`10
// n: oXªÂÈ®¬Ì 2`100
// m: oXÌHü 1`500
// s: start
// d: goal
int c, n, m, s, d;

// ÅZoHTõ - Ï
vector < vector <int> >	edges;

int search()
{
	// Å¬l
	vector < vector <int> >		D( n, vector <int>(c+1,NONE) );
	// KâÏÝÌm[h
	vector < vector <bool> >	V( n, vector <bool>(c+1,false) );

	D[s][c] = 0;

	while (1)
	{
		int u, w, minv = NONE;
		for ( int i = 0; i < n; i++ )
		{
			for ( int j = 0; j < c+1; j++ )
			{
				if ( V[i][j] == false && D[i][j] != NONE && ( minv == NONE || minv > D[i][j] ) )
				{
					minv = D[i][j];
					u = i;
					w = j;
				}
			}
		}
		if ( minv == NONE )
			break;

		V[u][w] = true;

		for ( int v = 0; v < n; v++ )
		{
			if ( edges[u][v] == NONE )
				continue;

			if ( D[v][w] == NONE )
				D[v][w] = D[u][w] + edges[u][v];
			else
				D[v][w] = min( D[v][w], D[u][w] + edges[u][v] );

			if ( w )
			{
				if ( D[v][w-1] == NONE )
					D[v][w-1] = D[u][w] + edges[u][v]/2;
				else
					D[v][w-1] = min(D[v][w-1], D[u][w] + edges[u][v]/2);
			}
		}

	}

	int minv = NONE;
	for ( int i = 0; i < c+1; i++ )
	{
		if ( D[d][i] != NONE )
		{
			if ( minv == NONE )
				minv = D[d][i];
			else
				minv = min( minv, D[d][i] );
		}
	}
	return minv;

}

int main( void )
{
	while ( cin >> c >> n >> m >> s >> d && c && n && m && s && d )
	{
		edges	=	vector < vector <int> >( 101, vector <int>(101, NONE) );
		s--;
		d--;


		// ú»
		for ( int i = 0; i < m; i++ )
		{
			// f: a-bÔÌRXg
			int a, b, f;
			cin >> a >> b >> f;

			a--;
			b--;

			edges[a][b] = f;
			edges[b][a] = f;

		}


		// Tõ
		int kotae = search();
		cout << kotae << endl;

	}

	return 0;
}

Measured memory_bytes: 988
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    string S;
    cin >> N;
    cin >> S;
    string ans = "No";
    if (N%2 == 0) {
        ans = "Yes";
        for (int i = 0; i < N/2; ++i) {
            if (S[i] != S[i+N/2]) {
                ans = "No";
            }
        }
    }
    puts(ans.c_str());
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a%mod; a = a * a%mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// head

int t;
int a[9];
int b[105];
int vis[105];

int main()
{
    ios::sync_with_stdio(false);
#ifdef RG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
#endif
    rep(i,0,9) {
        cin>>a[i];
    }
    cin>>t;
    rep(i,0,t) {
        cin>>b[i];
        vis[b[i]]=1;
    }
    bool flag = false;
    rep(i,0,3) {
        bool tmp = true;
        rep(j,0,3) {
            if(!vis[a[i*3+j]]) {
                tmp = false;
                break;
            }
        }
        if(tmp) {
            flag = true;
            break;
        }
        tmp = true;
        rep(j,0,3) {
            if(!vis[a[j*3+i]]) {
                tmp =false;
                break;
            }
        }
        if(tmp) {
            flag = true;
            break;
        }
    }
    if(!flag) {
        if(vis[a[0]] && vis[a[4]] && vis[a[8]]) flag=true;
        if(vis[a[2]] && vis[a[4]] && vis[a[6]]) flag=true;
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<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;
typedef long long ll;

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

    int n, i;
    cin >> n >> i;

    cout << n - i + 1 << endl;
}

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

using namespace std;

const int max_n = 101111, inf = 1000111222;

int n, k;
vector<int> ans[max_n];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d", &n);
    for (int i = 1; i * (i - 1) <= 2 * n; ++i) {
        if (i * (i - 1) == 2 * n) {
            k = i;
            break;
        }
    }
    if (k == 0) {
        puts("No");
        return 0;
    }
    int cur = 0;
    for (int num = 0, i = k - 1; i > 0; --i, ++num) {
        for (int j = k - i; j < k; ++j) {
            ans[j].push_back(cur + j - k + i);
        }
        for (int j = cur; j < cur + i; ++j) {
            ans[num].push_back(j);
        }
        cur += i;
    }
    printf("Yes\n%d\n", k);
    for (int i = 0; i < k; ++i) {
        printf("%d ", ans[i].size());
        for (int x : ans[i]) {
            printf("%d ", x + 1);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 4608
/*
Author : N_o_o_B
Created : April 22 2020 21:15:35 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    vi a(n);
    fori(i,n) cin >> a[i];
    int ans = 30;
    fori(i,n){
        int cnt = 0;
        while(a[i]%2==0){
            a[i] >>=1 ;
            cnt++;
        }
        ans = min(ans,cnt);
    }
    cout << ans << endl;

    time_taken();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
    int x;
    cin >> x;
    if(x == 3 || x == 5 || x == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  map<int, int> a_map;
  int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    a_map[a[i]]++;
  }
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  vector<int> ele_n;
  for (i = 0; i < a.size(); i++) {
    ele_n.push_back(a_map[a[i]]);
  }
  sort(ele_n.begin(), ele_n.end());
  int result = 0;
  if (ele_n.size() > k) {
    for (i = 0; i < ele_n.size() - k; i++) {
      result += ele_n[i];
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 11516
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int d; cin >> d;
	rep(i, 0, d) {
		cout << "Case " << i + 1 << ":" << endl;
		int s; cin >> s;
		rep(j, 0, 10) {
			s *= s;
			s %= 1000000;
			s /= 100;
			cout << s << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2996
package main

import (
	"fmt"
)

func main() {
	var N,l,n int
	fmt.Scan(&N)

  cnt := 0;
  for i := 0; i < N; i++ {
    fmt.Scan(&l)
    fmt.Scan(&n)
    cnt += n - l + 1
  }
  fmt.Println(cnt)
}

Measured memory_bytes: 640
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll n,a,b;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>n>>a>>b;
	cout<<min(n*a,b);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
inline bool sortat(vector<int> v) {
    int last(0);
    for (const int& x : v) {
        if (last > x)
            return false;
        last = x;
    }
    return true;
}
vector<int> v;
int n;
int main() {
    DAU
    cin >> n;
    v.resize(n);
    for (int& x : v)
        cin >> x;
 	if (sortat(v)) {
    	cout << "YES";
        PLEC  
    }
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j) {
            swap(v[i], v[j]);
            if (sortat(v)) {
                cout << "YES";
                PLEC
            }
            swap(v[i], v[j]);
        }
    cout << "NO";
    PLEC
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <utility>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

typedef long long lint;

using namespace std;




int main()
{


	lint A,B;
	cin >> A >> B;
	/*
		F(A,B) = XOR([A,B])


	*/
	// greedy
	//lint N = B - A + 1;
	//vector<lint> g(N+1,0);

//	g[0] = A;
/*
	lint ans = A;
	lint ans_pre = A;
	for (lint i = 1; i < N; i++) {
		//g[i] = g[i-1] ^ (A+i);
		ans = ans_pre ^ (A+i);
		ans_pre = ans;
	}
	*/

	lint aa,bb;
	aa = A;
	bb = B;
	// 偶数から始めたい
	bool magic = false;
	if (A % 2 != 0) {
		magic = true;
		A = A + 1;
	}
	// 
	bool magic_2 = false;
	if (B % 2 == 0) {
		magic_2 = true;
		B = B - 1;
	}

	
	lint len = B - A + 1;
	// len: even
	lint tmp = (len / 2 );
	// 1がtmp個
	if (tmp % 2 == 0) {
		tmp = 0;
	}
	else {
		tmp = 1;
	}


	// kotae: tmp ^ m ^ m2
	if (magic) tmp ^= (A-1);
	if (magic_2) tmp ^= (B+1);

			cout << tmp << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll pow2[1000];

int main(){
  pow2[0]=1;
  rep(i,50)pow2[i+1]=2*pow2[i];
  int n,p;
  cin >> n >> p;
  bool odd=false;
  rep(i,n){
    int temp;
    cin >> temp;
    if(temp%2)odd=true;
  }
  if(!odd){
    if(p)cout << 0 << endl;
    else cout << pow2[n] << endl; 
  }
  else cout << pow2[n-1] << endl;
return 0;}

Measured memory_bytes: 256
//include
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

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();
}

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

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

template <class T>
inline T nCr(T n, T r)
{
    T num = 1;
    for (int i = 1; i <= r; ++i)
    {
        num *= (n - i + 1) / i;
    }
    return num;
}
template <class T>
inline T nPr(T n, T r)
{
    r = n - r;
    T sum = 1;
    int i;
    for (i = n; i >= r + 1; --i)
        sum *= i;
    return sum;
}

template <class T>
inline T facctorial(T k)
{
    T sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

//numeric
template <class T>
inline T gcd(T a, T b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

template <class T>
inline T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}

//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 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())

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

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

//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;

int main()
{
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; ++i)
    {
        if (i < 10 || (99 < i && i < 1000) || (9999 < i && i < 100000))
        {
            ++cnt;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)

int main(){
    int N;
    scanf("%d", &N);
    int ans = 0;
    for(int i=105; i<=N; i+=2){
        int tmp = 0;
        for(int j=1; j<=i; j++){
            if(i%j == 0) tmp++;
        }
        if(tmp == 8) ans++;
    }

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

Measured memory_bytes: 1688
#include<iostream>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<cctype>

using namespace std;

int main(){

	string a,b,c;
	
	cin>>a>>b>>c;
	
	if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0]){
		cout<<"YES"<<endl;
	}else cout<<"NO"<<endl;
	
	return 0;
	
	
	

}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>

int const maxn = 110;

bool ver[maxn], hor[maxn];
int H, W;
char G[maxn][maxn];

int main()
{
  memset(ver, false, sizeof(ver));
  memset(hor, false, sizeof(hor));

  scanf("%d%d", &H, &W);

  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      scanf(" %c", &G[i][j]);
      if(G[i][j] == '#') ver[j] = true;
      if(G[i][j] == '#') hor[i] = true;
    }
  }

  for(int i = 0; i < H; i++) {
    if(!hor[i]) continue;
    for(int j = 0; j < W; j++) if(ver[j]) printf("%c", G[i][j]);
    putchar('\n');
  }

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int decode(string s){
	int res = 0, dig = 1;
	for(int i=0;i<s.size();i++){
		if(s[i]=='m') res += dig*1000;
		if(s[i]=='c') res += dig*100;
		if(s[i]=='x') res += dig*10;
		if(s[i]=='i') res += dig;
		dig = isdigit(s[i]) ? s[i]-'0' : 1;
	}
	return res;
}

string encode(int t){
	char c[4] = {'i', 'x', 'c', 'm'};
	string res = "";
	for(int i=0;i<4;i++){
		if(t%10>0) res += c[i];
		if(t%10>1) res += '0'+t%10;
		t /= 10;
	}
	reverse(res.begin(), res.end());
	return res;
}

int main(){
	int m; cin >> m;
	while(m--){
		string a, b; cin >> a >> b;
		cout << encode(decode(a)+decode(b)) << endl;
	}
}

Measured memory_bytes: 916
using System;
using System.IO;
using System.Text;

class Program{
    static void Main(string[] args){
        var N = Convert.ToString(int.Parse(Console.ReadLine()), 2);
        var sb = new StringBuilder("1");
        for (int i = 0; i < N.Length - 1; i++) sb.Append("0");
        var answer = Convert.ToInt32(sb.ToString(), 2);
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

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

int main(){
    string a;
    bool flag = false;
    cin >> a;
    string bg,ed;
    bg = a.substr(0,7);
    ed = a.substr(a.size()-7,7);
   // cout << bg <<" " << ed <<endl;
    string ans = "keyence";

    for(int i=0;i<8;i++){
        for(int j=0;j<7;j++){
            if(i>=j){
                if(bg[j]==ans[j]);//cout << "OK"; 
                else break;
            }else{
                if(ed[j]==ans[j]);//cout << "Y";
                else break;
            }
            if(j==6){flag = true;
            }
        }
//        cout << "loop" <<endl;
    }

    if(flag == true)cout << "YES" <<endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
path=[list(map(int,input().split())) for i in range(0,3)]

cnt=[0,0,0,0]

for i in range(0,3):
    for j in range(0,2):
        cnt[path[i][j]-1]+=1

if cnt[0]<3 and cnt[1]<3 and cnt[2]<3 and cnt[3]<3:
    print("YES")
else:
    print("NO")

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

int main() {
  int N;
  cin >> N;
  map<string, int> mp;
  for (int i=0; i<N; i++) {
    string ss;
  	cin >> ss;
    sort(ss.begin(), ss.end());
    mp[ss]++;
  }
  long long ans=0;
  
  for (auto& i: mp) {
  	int s = i.second;
    ans += (long long)s*(s-1)/2;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 11136