akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define pi pair<int, int>
int n;
pi a[100005];

int main(){
	cin>>n;
  	for(int i=1, x; i<=n; i++){
    	cin>>x;
      	a[i]={x, i};
    }
  	sort(a+1, a+n+1);
  	for(int i=1; i<=n; i++){
    	cout<<a[i].second<<" ";
    }
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;
int main(){
  int x;
  cin>>x;

  for(int a=0;;a++){
     for(int b=-a;b<a;b++){
        if(pow(a,5)-pow(b,5)==x) {
           cout<<a<<" "<<b;
           return 0;
        }
     }
  }

return 0;
}


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

int main(){
    int n;
    cin >> n;
    int i;
    int amari;
    string result;
    result = "No";
    for(i=0;i<4;i++){
        amari = n % 10;
        n /= 10;
        //cout << n << endl;
        if(amari == 7){
            result = "Yes";
            break;
        }
    }
    cout << result << endl;
}

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

class weight_value{
    public:
    ll weight;
    ll value;
};

int main(){
    ll n,w;
    cin>>n>>w;
    weight_value input[n];
    for(ll i=0;i<n;i++){
        cin>>input[i].weight;
        cin>>input[i].value;
    }
    ll maxValue = n * 1000;
    ll dp[n][maxValue + 1];
    for(ll i=0;i<n;i++){
        dp[i][0] = 0;
    }
    for(ll i=1;i<=maxValue;i++){
        dp[0][i] = INT_MAX;
    }
    dp[0][input[0].value] = input[0].weight;
    for(ll i=1;i<n;i++){
        for(ll j=1;j<=maxValue;j++){
            if(j - input[i].value < 0){
                dp[i][j] = dp[i-1][j];
                continue;
            }
            dp[i][j] = min(dp[i-1][j], input[i].weight + dp[i-1][j - input[i].value]);
        }
    }
    ll ans = 0;
    for(ll i=1;i<=maxValue;i++){
        if(i > ans && dp[n-1][i] <= w){
            ans = i;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<pair<int,int>> V(N);
    rep(i,N) {
        cin >> V[i].first >> V[i].second;
    }
    int count = 0;
    int max = 0;
    rep(j,N) {
        if (V[j].first == V[j].second) {
            count++;
        }
        else {
            count = 0;
        }
        if (count > max) {
            max = count;
        }
    }
    if (max >= 3) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3632
def digits_sum(N):
	sum=0
	while N/10!=0:
		sum+=N%10
		N//=10
	return sum
	
N=input()
N=list(N)
for k in range(len(N)):
	N[k]=int(N[k])
ans=0
pos=0
for i in range(1,len(N)):
	if N[i]!=9:
		N[i-1]=N[i-1]-1
		pos=i
		break
if pos==0:
	print(sum(N))
else:
	for j in range(pos):
		ans+=N[j]
	ans+=9*(len(N)-pos)
	print(ans)

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll h, w, ch, cw, dh, dw;
  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--; cw--; dh--; dw--;
  
  vector<vc> s(h, vc(w));
  rep(i, h) rep(j, w) cin >> s[i][j];
  
  vvl magic(h, vl(w, INF));
  magic[ch][cw] = 0;
  
  ll num=0;
  queue<pl> q;
  q.push(pl (ch, cw));
  
  while(1) {
    bool f=0;
    vpl Q;
    
    while(!q.empty()) {
      pl p = q.front();
      q.pop();
      Q.push_back(p);
      ll x = p.first, y = p.second;
  
      if(x-1>=0 and s[x-1][y]=='.') {
        if(chmin(magic[x-1][y], magic[x][y])) q.push(pl (x-1, y));
      }
      if(x+1<h and s[x+1][y]=='.') {
        if(chmin(magic[x+1][y], magic[x][y])) q.push(pl (x+1, y));
      }
      if(y-1>=0 and s[x][y-1]=='.') {
        if(chmin(magic[x][y-1], magic[x][y])) q.push(pl (x, y-1));
      }
      if(y+1<w and s[x][y+1]=='.') {
        if(chmin(magic[x][y+1], magic[x][y])) q.push(pl (x, y+1));
      }
    }
  
    for(pl P: Q) {
      ll X = P.first, Y = P.second;
      rep2(i, -2, 2) rep2(j, -2, 2) if(X+i>=0 and X+i<h and Y+j>=0 and Y+j<w and magic[X+i][Y+j] == INF and s[X+i][Y+j] == '.') {
        f=1;
        magic[X+i][Y+j] = num+1;
        q.push(pl (X+i, Y+j));
      }
    }
    num++;
    
    if(!f) break;
  }
  
  if(magic[dh][dw] == INF) cout << -1 << newl;
  else cout << magic[dh][dw] << newl;
  return 0;
}

Measured memory_bytes: 12644
#include<bits/stdc++.h>
using namespace std;
inline long long readl()
{
    long long ret=0,f=1;
    char ch=getchar();
    while(ch>'9'||ch<'0')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        ret=(ret<<1)+(ret<<3)+ch-'0';
        ch=getchar();
    }
    return ret*f;
}
const int mod=1e9+7;
long long n;
map<long long,long long>f;
long long solve(long long n)
{
    if(f[n])
		return f[n];
    return f[n]=(solve(n/2)+solve((n-1)/2)+solve((n-2)/2))%mod;
}
int main()
{
	n=readl();
    f[0]=1;
	f[1]=2;
    printf("%lld\n",solve(n)%mod);
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <conio.h>
using namespace std;

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

#define rep(i,n)	for(ll i=0;i<(n);i++)
#define SZ(x) ((ll)x.size())
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define int ll
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll MOD = INT_MAX;
const double PI = acos(-1);

void openfile(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}
const int N = 1e5+5;
int dp[N][3];

signed main(){
	IOS
	int n;	cin >> n;
	int a[n][3];
	rep(i,n){
		rep(j,3)	cin >> a[i][j];
	}
	rep(i,n){
		rep(j,3){
			if(i != 0) rep(k,3)	if(k != j)	dp[i][j] = max(dp[i][j],dp[i-1][k]);
			dp[i][j] += a[i][j];
		}
	}
	cout << max({dp[n-1][0],dp[n-1][1],dp[n-1][2]}) << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int N,H;
    cin>>N>>H;
    vector<int> a(N);
    vector<int> b(N);

    int A = -1;
    int ans = 0;

    for(int i = 0;i < N;i++){
        cin>>a[i]>>b[i];
        A = max(A,a[i]);
    }

    sort(b.rbegin(),b.rend());
    
    for(int i = 0; i < N; i++){
        if(b[i] < A || H <= 0) break;
        H -= b[i];
        ans++;
    }

    while(H>0){
        H -= A;
        ans++;
    }

    cout<<ans<<endl;

}    


Measured memory_bytes: 1152
#include <limits>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;

    int cost = 0;

    if(A+B > 2*C)
    {
        const int mi = min(X, Y);
        X -= mi;
        Y -= mi;
        cost += 2 * mi * C;
    }
    if(A > 2 * C)
    {
        cost += 2 * X * C;
    }
    else
    {
        cost += A * X;
    }
    if(B > 2 * C)
    {
        cost += 2 * Y * C;
    }
    else
    {
        cost += B * Y;
    }

    cout << cost << '\n';

    return 0;
}


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

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

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    A[0] = -1;
    rep(i, N - 1) {
        ll num;
        cin >> num;
        --num;
        A[i] = num;
    }
    vector<ll> ans(N, 0);

    for (int i = 1; i < N; ++i) {
        ++ans[A[i]];
    }

    for (int i = 0; i < N; ++i) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 6428
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int):
    N = str(N)
    if '7' in N:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61708
import sys

import math

input = sys.stdin.readline


def main():
    h, w = map(int, input().split())
    if h == 1 or w == 1:
        print(1)
        return
    print((math.ceil(w / 2) * math.ceil(h / 2)) + ((w // 2) * (h // 2)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
fun main(args: Array<String>) {
    val xs = listOf(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
    val k = readLine()!!.toInt()
    println(xs[k - 1])
}


Measured memory_bytes: 31940
n = int(input())
lis = []
for i in range(1,n+1):
    s,p = input().split()
    lis.append((s,int(p),i))
from operator import itemgetter
lis = sorted(lis,key=itemgetter(1),reverse=True)
lis = sorted(lis,key=itemgetter(0))
for i in range(n):
    print(lis[i][2])

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

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vi vector<int>

#define ll long long
#define vl vector<ll>
#define vll vector<vl>
#define P pair<ll, ll>

const int INF = 1e9;
const long double pi=3.14159265358979323846;

int main() {
	ll n;
	long double l;
	cin >> n >> l;
	long double t[3010];
	rep(i, n) cin >> t[i];
	long double ansx=0, ansy=0;
	rep(i, n-1)
	{
		for(int j=i+1; j<n; j++)
		{
			long double x=cos(pi*(t[i]+t[j])/l);
			long double y=sin(pi*(t[i]+t[j])/l);
			ansx+=(long double)(n-2-2*(j-i-1))*x;
			ansy+=(long double)(n-2-2*(j-i-1))*y;
		}
	}
	long double kosu=(long double)(n*(n-1)*(n-2))/(long double)6.0;
	cout << setprecision(15) << fixed << ansx/kosu << ' ' << ansy/kosu << endl;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void){
int a,b;
 do{
 scanf("%d%d",&a,&b);
 }while(a<1 || b<1 || a>100 || b>100);
if((a+b)%3 == 0 || a%3 == 0 || b%3 ==0) printf("Possible");
else printf("Impossible");
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int revsnumber(int n)
{
    int s=0,flage=0;
    while(n!=0)
    {
        s=n%10;
        flage+=s;
        n/=10;
    }
    return flage;
}

int main()
{
	int s,c;
	cin>>s;
	c=revsnumber(s);
	if(s%c==0)
		printf("Yes");
	else
		printf("No");
	return 0;
}

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

using namespace std;

bool IsSiritori(string inputs[], int length) {
	bool result = true;
	for (int i = 1; i < length; i++) {
		if (inputs[i].front() != inputs[i - 1].back()) {
			result = false;
			break;
		}
	}
	return result;
}

int main()
{
	string inputs[3]{};
	cin >> inputs[0] >> inputs[1] >> inputs[2];
	cout << (IsSiritori(inputs, 3) ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
n,w = map(int,input().split())
dp = [[0 for i in range(w+1)]for j in range(n+1)]

for i in range(n):
    weight,value = map(int,input().split())
    for j in range(w+1):
        if j >= weight:
            dp[i+1][j] = max(dp[i][j-weight]+value,dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[n][w])

Measured memory_bytes: 171400
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

# nCk
## 0!~n!をmodしつつ求める
def fact_all(n,M=mod):
    f = [1]*(n+1)
    ans = 1
    for i in range(1,n+1):
        ans = (ans*i)%M
        f[i] = ans
    return f

## inv(0!)~inv(n!)をmodしつつ求める
def fact_inv_all(fact_all,M=mod):
    N = len(fact_all)
    finv = [0]*N
    finv[-1] = pow(fact_all[-1],M-2,M)
    for i in range(N-1)[::-1]:
        finv[i] = finv[i+1]*(i+1)%M
    return finv

## nCkをmodしつつ返す
def nCk(n,k,fact_list,inv_list,M=mod):
    return (((fact_list[n]*inv_list[k])%M)*inv_list[n-k])%M

K = I()
S = list(input())
N = len(S)

fl = fact_all(N+K+1)
il = fact_inv_all(fl)

beki25 = [1]*(N+K+1)
for i in range(1,N+K+1):
    beki25[i] = beki25[i-1]*25
    beki25[i] %= mod

beki26 = [1]*(N+K+1)
for i in range(1,N+K+1):
    beki26[i] = beki26[i-1]*26
    beki26[i] %= mod

ans = 0
for i in range(N-1,N+K):
    ans += nCk(i,N-1,fl,il)*beki25[i-N+1]*beki26[N+K-1-i]
    ans %= mod

print(ans)

Measured memory_bytes: 202324
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<iostream>
#define pb push_back
#define fi first
#define se second
#define sz(x)  x.size()
#define cl(x)  x.clear()
#define all(x)  x.begin() , x.end()
#define r(x)  scanf("%d", &x)
#define rr(x , y)  scanf("%d%d" , &x , &y)
#define rst(s)  scanf("%s" , s)
#define rl(x)  scanf("%lld" , &x)
#define rrl(x , y)  scanf("%lld%lld" , &x , &y)
#define w(x)  printf("%d" , x)
#define ww(x , y)  printf("%d %d" , x , y)
#define wl(x)  printf("%lld" , x)
#define wwl(x , y)  printf("%lld %lld" , x , y)
#define sp()  printf(" ")
#define en()  puts("")
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++)
#define per(i , n , x)  for(int i = n ; i >= x ; i --)
#define mem0(x)  memset(x , 0 , sizeof(x))
#define mem_1(x)  memset(x , -1 , sizeof(x))
#define mem_inf(x)  memset(x , inf , sizeof(x))
#define mem_linf(x)  memset(x , linf , sizeof(x))
#define p_queue priority_queue
#define debug(x)  cout << '*' << x << '\n'
#define ddebug(x , y)  cout << '*' << x << ' ' << y << '\n'
#define ios std::ios::sync_with_stdio(false) , cin.tie(0)
using namespace std ;
//mt19937  rnd(chrono::high_resolution_clock::now().time_since_epoch().count()) ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int , int> pii ;
typedef pair<ll , ll> pll ;
typedef pair<int , ll> pil ;
typedef pair<ll , int> pli ;
const ll linf = 0x3f3f3f3f3f3f3f3f ;
const int inf = 0x3f3f3f3f ;
const int maxn = 2005 ;
const int maxm = 30 ;
const double eps = 1e-6 ;
int n , m , s ;
struct node
{
	int v , a , b ;
} ;
vector<node> g[maxn] ;
ll c[55] , d[55] ;
ll dp[55][2505] ;
int in[55][2505] ;
queue<pii> q ;
void bfs()
{
	mem0(in) ;
	q.push({1 , s}) ;
	in[1][s] = 1 ;
	while(!q.empty())
	{
		pii u = q.front() ;
		q.pop() ;
		int v = u.fi ;
		int a = u.se ;
		in[v][a] = 0 ;
		//cout << v << ' ' << a << ' ' << dp[v][a] << '\n' ;
		rep(i , 1 , 2500)
		{
			int nxt = a + i * c[v] ;
			ll sum = dp[v][a] + i * d[v] ;
			int min1 = min(nxt , 2500) ;
			if(sum < dp[v][min1])
			{								
				dp[v][min1] = sum ;
				if(!in[v][min1])  q.push({v , min1}) , in[v][min1] = 1 ;	
			}
			if(nxt >= 2500)  break ;
		}
		for(auto x : g[v])
		{
			int nxt_v = x.v ;
			int nxt_a = x.a ;
			int nxt_b = x.b ;
			ll sum = dp[v][a] + nxt_b ;
			if(a >= nxt_a && sum < dp[nxt_v][a - nxt_a])
			{
				dp[nxt_v][a - nxt_a] = sum ;
				if(!in[nxt_v][a - nxt_a])
				  in[nxt_v][a - nxt_a] = 1 ,
				q.push({nxt_v , a - nxt_a}) ;
			}
		}
	}
	rep(i , 2 , n)
	{
		ll min1 = 1e18 ;
		rep(j , 0 , 2500)  min1 = min(min1 , dp[i][j]) ;
		wl(min1) , en() ;
	}
}
int main()
{
	rr(n , m) , r(s) ;
	s = min(s , 2500) ;
	rep(i , 1 , m)
	{
		int u , v , a , b ;
		rr(u , v) , rr(a , b) ;
		g[u].pb((node){v , a , b}) ;
		g[v].pb((node){u , a , b}) ;
	}
	rep(i , 1 , n)  rrl(c[i] , d[i]) ;
	rep(i , 1 , n)  rep(j , 0 , 2500)  dp[i][j] = 1e18 ;
	dp[1][s] = 0 ;
	bfs() ;
	return 0 ;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int n;
int a[11];

void rec(int idx, int old) {
   if (idx == 10) return;
   if (a[idx] > old) {
      rec(idx + 1, a[idx]);
   } else {

   }
}

int main() {
   cin >> n;
   rep (k, n) {
      rep (i, 10) {
         cin >> a[i];
      }
      // rec(0, -1);
      bool printed = false;
      rep (mask, (1<<10)) {
         bool ok = true;
         int oldA = -1, oldB = -1;
         rep (j, 10) {
            if ((mask>>j)&1) {
               if (a[j] > oldA) {
                  oldA = a[j];
               } else {
                  ok = false;
               }
            } else {
               if (a[j] > oldB) {
                  oldB = a[j];
               } else {
                  ok = false;
               }
            }
         }
         if (ok) {
            puts("YES");
            printed = true;
            break;
         }
      }
      if (!printed) puts("NO");
   }

   return 0;
}


Measured memory_bytes: 2988
#include<bits/stdc++.h>
using namespace std;
int main(){
	int k,n;
  cin>>k>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin>>a[i];
  int ans=k-a[n-1]+a[0];
  for(int i=0;i<n-1;i++)
    ans=max(ans,a[i+1]-a[i]);
  cout<<k-ans<<"\n";
  return 0;
}

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    vector<ll> F(n, 0);
    rep(i, n) rep(j, 10) {
        ll f; cin >> f;
        F[i] |= f << j;
    }
    vector<vector<ll>> S(n, vector<ll>(11)); cin >> S;
    ll ans = -linf;
    rep(i, 1, 1LL<<10) {
        ll a = 0;
        rep(j, n) {
            ll c = __builtin_popcountll(F[j] & i);
            a += S[j][c];
        }
        chmax(ans, a);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define INF 0x3f3f3f3f
#define MOD 1000000007
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	int N;
	cin>>N;
	long long pow=1;
	for(int i=1;i<=N;i++){
		pow=pow*i%MOD;
	}
	cout<<pow<<endl;
	return 0;
}

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

using namespace std;

#define M (ll)(1e9+7)
#define EPS (double)(1e-12)
#define ll long long
#define N (ll)(2*1e5)



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

    double res;
    int value;

    cin >> value;

    res = (double)2*value*(double)M_PI;

    cout << setprecision(10) << fixed << res << endl;

    return 0;
}

Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
const int INF=999999999;

int main() {
   int A,B;
   cin>>A>>B;
   int ans=INF;
   for(int i=0;i<=10000;i++){
      int t=i*0.08;
      int k=i*0.1;
      if(t==A&&k==B){ans=min(ans,i);}
   }
  if(ans==INF){cout<<-1<<endl;}
  else{cout<<ans<<endl;}
return 0;}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    static char[][] s;
    static int[][] a;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int K = sc.nextInt();
        s = new char[h][w];
        a = new int[h][w];
        for (int i = 0; i < h; i++) {
            s[i] = sc.next().toCharArray();
            for (int j = 0; j < w; j++) {
                a[i][j] += s[i][j] == '1' ? 1 : 0;
                if(0 < i) a[i][j] += a[i-1][j];
            }
        }
        int ans = (h)*(w);
        for (int i = 0; i < 1<<(h-1); i++) {
            int t = 0;
            int hc = Integer.bitCount(i);
            int[] hd = new int[hc+1];
            int idx = 0;
            for (int j = 0; j < h-1; j++) if((i>>j & 1) == 1) hd[idx++] = j;
            hd[hc] = h-1;
            int[] ts = new int[hc+1];
            int widx = -1;
            OUTER:for (int j = 0; j < w; j++) {
                INNER:for (int k = 0; k < hd.length; k++) {
                    ts[k] += a[hd[k]][j];
                    if(0 < k) ts[k] -=  a[hd[k-1]][j];
//                    if(ts[k] == K && j!=w-1) widx = j;
                    if(K < ts[k]){
                        if(widx == j-1){
                            t = -1;
                            break OUTER;
                        }
                        widx = j-1;
                        j--;
                        break INNER;
                    }
                }
                if(-1 < widx){
                    t++;
                    Arrays.fill(ts, 0);
                    widx = -1;
                }
            }
            if(t < 0) continue;
            t += hc;
            if(t < ans) ans = t;
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 22776
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

char s[110];
int szS;

bool isPali(int l, int r) {
	while (l < r) {
		if (s[l] != s[r])
			return false;
		l++;
		r--;
	}
	return true;
}

int main()
{
	scanf("%s", s);
	szS = strlen(s);
	
	if (isPali(0, szS - 1) == false) {
		printf("No\n");
		return 0;
	}
	
	int l = (szS - 1) / 2 - 1;
	if (isPali(0, l) == false) {
		printf("No\n");
		return 0;
	}
	
	int r = (szS + 1) / 2;
	if (isPali(r, szS - 1) == false) {
		printf("No\n");
		return 0;
	}
	
	printf("Yes\n");
	return 0;
}

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

int main() {
	int N, i, x;
	int a[100000];
	scanf("%d", &N);
	
	//出席番号がindex 1～n
	//到着した順に番号与える
	//ex)[2.3.1] → id3,id1,id2の順で到着
	for (i = 1; i <= N; i++) {
		scanf("%d", &x);
		a[x] = i;
	}
	for (i = 1; i <= N; i++) {
		printf("%d ", a[i]);
	}
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

int main(){
    int n;
    cin >> n;
    vector<long> a(n),b(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=1;i<n;i++){
        b[i]=2*a[i-1]-b[i-1];
    }
    long diff = b[0]+b[n-1]-2*a[n-1];
    long p = diff/2;
    for(int i=0;i<n;i++){
        if(i%2==0){b[i] -= p;}
        else{b[i] += p;}
    }
    for(auto elem:b){
        cout << elem << " ";
    }

}

Measured memory_bytes: 2816
#include <iostream>
#include <cstdio>
#include <vector>
#include <deque>
#include <algorithm>
#include <climits>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
 
int main(){
    ll N,T;
    cin >> N >> T;
    ll m = LLONG_MAX;
    ll val_max = LLONG_MIN;
    vector<ll> mm;
    REP(i,N){
        ll a;
        cin >> a;
        ll val = max(0LL, a - m);
        if(val_max < val){
            val_max = val;
            mm.clear();
            mm.push_back(m);
        }else if(val_max == val){
            mm.push_back(m);
        }
        m = min(m, a);
    }

    sort(mm.begin(), mm.end());
    ll num = -1;
    ll ans = 0;
    REP(i,mm.size()){
        //printf("min:%d\n", mm[i]);
        if(num != mm[i]) ans++;
        num = mm[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 892
#include <stdio.h>

int main()
{
    int n,cnt,a,b,c,d;

    while(scanf("%d",&n)!=EOF){
        cnt=0;

        if(n>36){
            printf("0\n");
            continue;
        }

        for(a=0;a<=9;a++){
            for(b=0;b<=9;b++){
                for(c=0;c<=9;c++){
                    for(d=0;d<=9;d++){
                        if(a+b+c+d==n) cnt++;
                    }
                }
            }
        }

        printf("%d\n",cnt);
    }

    return 0;
}

Measured memory_bytes: 1804
#include <cstdio>
#include <algorithm>
using std::__gcd;
using std::sort;
int main(){
	int in[10];
	for(int i=0;i<10;++i)
		scanf("%d",&in[i]);
	sort(in,in+10);
	for(int i=9;i>=7;--i)
		printf("%d\n",in[i]);
		
	return 0;	
}

Measured memory_bytes: 1044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;
    int A[N];
    rep(i,N){
        cin>>A[i];
    }
    sort(A,A+N);
    int ans=1;
    if(A[0]==0){
        cout << 0 << endl;
        return 0;
    }
    rep(i,N){

        int x=1000000000000000000/ans;
        if(A[i]<x+1){
            ans*=A[i];
        }else{
            cout << -1 << endl;
            return 0;
        }
        if(ans>1000000000000000000){
            ans=-1;
            break;
        }
    }
    cout << ans << endl;

    



}


Measured memory_bytes: 4428
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int G[15][15];
int main() {
	int N,M;
	cin>>N>>M;
	rep(i,M){
		int k;cin>>k;
		rep(j,k){
			int s;
			cin>>s;
			s--;
			G[s][i] = 1;
		}
	}
	vector<int> p(M);
	rep(i,M)cin>>p[i];

	int ans = 0;
	for (int bit = 0; bit < (1 << N); ++bit) {
		cerr<<bitset<10>(bit)<<endl;
		vector<int> q(M,0);
		for (int i = 0; i < N; ++i) {
			// i個目のスイッチがs付いてるなら
			if ((bit >> i) & 1) {
				cerr<<"i: "<<i<<endl;
				rep(j,M){
					if(G[i][j] == 1){
						cerr<<"i,j: "<<i<<" "<<M-1-j<<endl;
						q[j]+=1;
						q[j]%=2;
					}
				}
			}
		}
		int cnt = 0;
		print(p);
		print(q);
		rep(j,M){
			if(p[j] == q[j])cnt++;
		}
		cerr<<"cnt: "<<cnt<<endl;
		if(cnt == M)ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
def cmb(n, r):
    mod = 10**9+7
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result = result % mod
    return result

n,a,b = map(int,input().split())
ans = 0
mod = 10**9+7
ans = pow(2,n,mod)-1
ma = cmb(n,a)
mb = cmb(n,b)
ans = ans-ma-mb
ans = ans%mod
print(ans)

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

int main() {

	int a, b,c;
	string op;

	while (true) {

	  cin >> a >> op >> b;

	  if (op == "?" ) break;

	  if (op == "+") cout << a + b << endl;

	  else if (op == "-") cout << a - b << endl;

	  else if(op=="*") cout << a*b << endl;

	  else cout << a / b << endl;

	}


	return 0;

}

Measured memory_bytes: 3088
#include <iostream>
#include<cmath>
#include<vector>
#include<map>
#include<sstream>
#include<deque>
#include<iomanip>
#include<algorithm>
#include<set>
#include<queue>
#include<bitset>
#include<stack>
#include<unordered_set>
using namespace std;
//	int x=atoi(s.c_str()); s_to_in;
int dx[] = { -1,0,0,1 };
int dy[] = { 0,1,-1 ,0};
#define endl '\n'
long long mo = 1e9;
const long double P = 3.141592653589793238L;
void trust_yourself()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
long long gcd(long long x, long long y)
{
	if (x == 0)
		return y;
	return gcd(y%x, x);
}
long long fast_power(long long x, long long y, long long mo)
{
	long long p = 1;
	while (y)
	{
		if (y & 1)
			p = (p*x) % mo;
		y = (y >> 1); //y/=2
		x = (x*x) % mo;
	}

	return p;
}
long long convert_to_num(string x) {
	long long  num = 0;
	for (int i = 0; i < x.size(); i++) {
		num *= 2;
		num += x[i] - '0';
	}
	return num;
}

long long com(long long n, long long r) {
	long long p = 1, p1 = 1;
	for (long long i = r + 1; i <= n; i++) {
		p = p * i;
		p /= p1;
		p1++;
	}
	return p;
}



int main()
{
	trust_yourself();
	//freopen("hussien.in", "r", stdin);
	
	int n; long long s = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 1; k <= n; k++) {
				int g = gcd(i, j);
				g = gcd(g, k);
				s += g;
			}
		}
	}
	cout << s;
	
	return 0;

}

Measured memory_bytes: 3652
# import single number
def import_number():
    return int(input())

# import string
def import_string():
    return str(input())

# import n line int
def import_int(n):
    return [int(input()) for i in range(n)]

N = import_string()
if '7' in N:
    print('Yes')
else:
    print('No')

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

using namespace std;
#define PI 3.14159265358979323846264338327950L
#define endl '\n'
const int MOD = 1000000007;

void solve()
{
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12 - (long double)m / 60.0);
	long double res = (long double)(a * a + b * b) - (long double)(2 * a * b) * cosl(rad);
	printf("%20.20Lf\n", sqrtl(res));
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	solve();
	// cout << sqrt(27.6492938519);
	return 0;
}

Measured memory_bytes: 4016
#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;
typedef long long LL;

const int MOD = 1e9+7;
void solve(){
    string s,t;
    cin>>s;
    cin>>t;
    int a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(u==s) a--;
    else b--;
    cout<<a<<" "<<b<<endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    // cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:

};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m, q;
    cin >> n >> m >> q;
    vector<long long> A(n);
    vector<long long> B(m);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    for (int i = 0; i < m; ++i) {
        cin >> B[i];
    }
    sort(B.begin(), B.end());

    const long long INF = 1LL << 60;
    vector<long long> da(n, INF);
    vector<long long> db(m, INF);
    for (int i = 0; i < n; ++i) {
        auto it = lower_bound(B.begin(), B.end(), A[i]);
        if (it != B.end()) {
            da[i] = min(da[i], *it - A[i]);
        }
        if (it != B.begin()) {
            --it;
            da[i] = min(da[i], A[i] - *it);
        }
    }
    for (int i = 0; i < m; ++i) {
        auto it = lower_bound(A.begin(), A.end(), B[i]);
        if (it != A.end()) {
            db[i] = min(db[i], *it - B[i]);
        }
        if (it != A.begin()) {
            --it;
            db[i] = min(db[i], B[i] - *it);
        }
    }
    while (q-- > 0) {
        long long x;
        cin >> x;

        long long res = INF;
        {
            auto it = lower_bound(A.begin(), A.end(), x);
            int idx = it - A.begin();
            if (idx < n) {
                long long ans = A[idx] - x + da[idx];
                res = min(res, ans);
            }
            if (idx > 0) {
                long long ans = x - A[idx - 1] + da[idx - 1];
                res = min(res, ans);
            }
        }
        {
            auto it = lower_bound(B.begin(), B.end(), x);
            int idx = it - B.begin();
            if (idx < m) {
                long long ans = B[idx] - x + db[idx];
                res = min(res, ans);
            }
            if (idx > 0) {
                long long ans = x - B[idx - 1] + db[idx - 1];
                res = min(res, ans);
            }
        }

        cout << res << "\n";
    }

    return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using pii = pair<int,int>;

template<typename T> ostream& operator<< (ostream& os,const vector<T>& vec){ os << "{"; for(T v:vec) os << v << ","; os << "}"; }
template<typename T> ostream& operator<< (ostream& os,const set<T>& st){ os << "{"; for(T v:st) os << v << ","; os << "}"; }
template<typename T,typename U> ostream& operator<< (ostream& os,const pair<T,U>& p){ os << "{" << p.first << "," << p.second << "}"; return os; }

constexpr double eps = 1e-10;

int h,w;

void solve(){
    int c = w*w+h*h;
    int ansh,answ,anst;


    using P = tuple<int,int,int>;
    vector<P> v;
    for(int i=1;i<=150;i++){
        for(int j=i+1;j<=150;j++){
            int hh = i;
            int ww = j;
            int t = ww*ww+hh*hh;

            P p = make_tuple(t,hh,ww);
            v.pb(p);
        }
    }
    sort(v.begin(),v.end());

    for(int i=0;i<v.size();i++){
        int t,hh,ww;
        tie(t,hh,ww) = v[i];
        //cout << t << " " << hh <<  " " << ww << endl;
        if(t>c){
            cout << hh << " " << ww << endl;
            return;
        }else if(t==c and hh>h){
            cout << hh << " " << ww << endl;
            return;
        }
    }
}

int main(){
    while(1){
        cin >> h >> w;
        if(h==0 and w==0) break;
        solve();
    }
}

Measured memory_bytes: 3208
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100010
#define inf 2147483647
#define ll long long
using namespace std;
struct edge{int x, y, z, next;}a[N*2];
int n, l, p[N], f[N], size[N], x, y, z, b[N], mn;
ll ans;
inline void add(int x, int y, int z){a[++l].x=x; a[l].y=y; a[l].z=z; a[l].next=p[x]; p[x]=l;}
inline void dfs(int x, int fa, int w){
	f[x]=0; size[x]=1;
	for(int i=p[x]; i; i=a[i].next)if(fa!=a[i].y){
		dfs(a[i].y, x, a[i].z); size[x]+=size[a[i].y];
		f[x]=max(f[x], size[a[i].y]);
	}
	f[x]=max(f[x], n-size[x]);
	ans+=(ll)w*min(size[x], n-size[x])*2;
}
int main(){
	scanf("%d", &n);
	l=0; memset(p, 0, sizeof(p));
	for(int i=1; i<=n-1; i++){scanf("%d%d%d", &x, &y, &z); add(x, y, z); add(y, x, z);}
	ans=0; dfs(1, 0, 0);
	l=0; mn=inf;
	for(int i=1; i<=n; i++)
		if(f[i]<mn){l=1; b[1]=i; mn=f[i];}
		else if(f[i]==mn)b[++l]=i;
	if(l==1){
		x=b[1]; mn=inf;
		for(int i=p[x]; i; i=a[i].next)mn=min(mn, a[i].z);
		ans-=mn;
	}else{
		x=b[1]; y=b[2];
		for(int i=p[x]; i; i=a[i].next)if(a[i].y==y)ans-=a[i].z;
	}
	printf("%lld", ans);
	return 0;
}

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

const int maxnm = 1e5+5;

int N,M;

map<int, vector<int> > edges, parents, g;
int dp[maxnm], indeg[maxnm];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>N>>M;
    int x,y;
    for(int i = 0; i<N-1+M; i++){
        cin>>x>>y;
        edges[x].push_back(y);
        parents[y].push_back(x);
        indeg[y]++;
        
    }
    
    int root = 0;
    for(int i = 1; i<= N; i++){
        if(parents.count(i) == 0){
            root = i;
            break;
        }
    }
    

    queue<int> q;
    dp[root] = 0;
    q.push(root);
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for(auto v: edges[u]){
            dp[v] = max(dp[v], dp[u]+1);
            indeg[v]--;
            if(indeg[v]==0)q.push(v);
        }
    }

    for(int i = 1; i<=N;i++){
        if(i == root){cout<<0<<endl;continue;}
        for(auto u: parents[i]){
            if(dp[u] == dp[i]-1){
                cout<<u<<endl;
            }
        }
    }
    

    return 0;
}



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

///assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
typedef long long int ll;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
#define  pb push_back
// #define f(i,a,b) for(ll i=a;i<b;i++)
#define f(i,a,b,c) for(ll i=a;i<b;i+=c)
#define fo(i,a,b) for(ll i = a; i<=b;i++)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define tests() int test_cases ; cin >> test_cases ; while(test_cases--)
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define MAXN 100010
#define MOD 1000000007
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define sp " "
#define MS(x,y) memset(x,y,sizeof(x))
#define INF 1000000000000000000

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

    //tests(){}
    //v/ll fis;
    //cout<<fis.size();
    ll arr[3];
    cin>>arr[0]>>arr[1]>>arr[2];

    sort(arr,arr+3);

    if (arr[0] == arr[1]&& arr[0] != arr[2]	)
    {
    	cout<<"Yes"<<endl;
    return 0;
    }

    if (arr[2] == arr[1]&& arr[0] != arr[2])
    {
    	cout<<"Yes"<<endl;
    return 0;
    }
    cout<<"No"<<endl;
  	
    return 0;
}




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

using namespace std;
typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n; cin >> n;
  ll res = 1e18;
  for(ll x = 1; x * x <= n; ++x) {
    if(n % x == 0) {
      res = min(res, x - 1 + n / x - 1);
    }
  }
  cout << res << '\n';
  return 0;
}


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


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

  string res = "No";
  int chk = 0;
  int calc = 0;
  
  for ( int i = 1;i < 10;i++){
    chk = N%i;
    if ( chk == 0){
      calc = N/i;
    }
    else{
      continue;
    }
    if ( calc < 10 ){
     	res = "Yes";
      break;
    }
    else{
      continue;
    }
     
      
      
    
/*   for ( int j = 1; j < 10 ; j++){
   		chk = calc%j;
 		cout << "i:" << i << " j:" << j << " calc:" << calc << endl;
   		if ( chk == 0){
    		res = "YES";
      		break;
    	}
    	else{
      		continue;
    	}
     
   }
*/    
  }

  cout << res << endl;
}







Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int m,d;
    cin>>m>>d;
    for(int i=1;i<=m;i++){
        for(int j=2;j<=d;j++){
            int g= j/10;
            int r=j%10;
            int c=r*g;
            if(g>=2&&(r)>=2&&(c==i))ans++;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    VI a(3);
    REP(i,3) cin >> a[i];
    sort(ALL(a));
    cout << a[0] + a[1] + 10 * a[2] << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7) #再帰関数の呼び出し制限

N = int(input())
g = [[] for _ in range(N+1)] #1-index
for _ in range(N-1):
    u, v, w = map(int, input().split())
    g[u].append([v, w]) 
    g[v].append([u, w]) 

def dfs(v, p, c): #pを親にもつvをcにする
    color[v] = c #vをcに着色
    for i in g[v]:
        nv, w = i[0], i[1]
        if nv == p: continue #次の点が親なら何もしない
        else:
            if w % 2 == 1: 
                dfs(nv, v, 1-c) #奇数なら違う色
            else:
                dfs(nv, v, c) #偶数なら同じ色
    

color = [-1]*(N+1) #1-index
dfs(1,-1,1) #どこでもいいが点１から開始。色は０

for i in range(1, N+1):
    print(color[i])

Measured memory_bytes: 85204
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  vector<vector<pair<int, int> > > edge(N);
  int A;
  int x, y;
  for(int i=0;i<N;++i){
    cin>>A;
    for(int j=0;j<A;++j){
      cin>>x>>y;
      x--;
      edge[i].push_back(mp(x, y));
    }
  }
  bool ok;
  int ans = 0;
  int tmp;
  for(int bit=0;bit<(1<<N);++bit){
    map<int, int> amap;
    tmp = 0;
    for(int i=0;i<N;++i){
      if((bit&(1<<i))!=0){
        amap[i] = 1;
        tmp++;
      }
    }
    ok = true;
    for(int i=0;i<N;++i){
      if(amap[i]==1){
        for(int j=0;j<edge[i].size();++j){
          if(amap[edge[i][j].fi] != edge[i][j].se){
            ok = false;
          }
        }
      }
    }
    if(ok) {
      ans = max(ans, tmp);
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main(){
  ll n,m,l,q,s,t,x,y,z,i,j,k;
  cin>>n>>m>>l;
  vector<vector<ll>> d(n,vector<ll>(n,1e10)),f(n,vector<ll>(n));
  for(i=0;i<n;i++) d[i][i]=0;
  for(i=0;i<m;i++){
    cin>>x>>y>>z;
    if(z>l) continue;
    x--;y--;
    d[x][y]=z;
    d[y][x]=z;
  }
  for(k=0;k<n;k++){
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(i==j) continue;
      else if(d[i][j]<=l) f[i][j]=1;
      else f[i][j]=d[i][j];
    }
  }
  for(k=0;k<n;k++){
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        f[i][j]=min(f[i][j],f[i][k]+f[k][j]);
      }
    }
  }
  cin>>q;
  for(i=0;i<q;i++){
    cin>>s>>t;
    s--;t--;
    if(f[s][t]<1e10) cout<<f[s][t]-1<<endl;
    else cout<<-1<<endl;
  }
}

Measured memory_bytes: 5012
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) > (b); --(i))
#define rep(i, c) for(auto &(i) : (c))
#define x first
#define y second
#define pb push_back
#define PB pop_back()
#define iOS ios_base::sync_with_stdio(false)
#define sqr(a) (((a) * (a)))
#define all(a) a.begin() , a.end()
#define error(x) cerr << #x << " = " << (x) <<endl
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define errop(a) cerr<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define L(x) ((x)<<1)
#define R(x) (((x)<<1)+1)
#define umap unordered_map
#define double long double
typedef long long ll;
typedef pair<int,int>pii;
typedef vector<int> vi;
typedef complex<double> point;
template <typename T> using os =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>  inline void smax(T &x,T y){ x = max((x), (y));}
template <class T>  inline void smin(T &x,T y){ x = min((x), (y));}
const int maxn = 210;
int a[maxn], n;
int main(){
	iOS;
	cin >> n;
	For(i,0,2*n)
		cin >> a[i];
	sort(a,a+2*n);
	int ans = 0;
	For(i,0,n)
		ans += a[L(i)];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())

str1_list = []
str2_list = []

for i in range(b):
    str1_list.append(str(a))

for i in range(a):
    str2_list.append(str(b))

str1 = ''.join(str1_list)
str2 = ''.join(str2_list)

if(str1 < str2):
    print(str1)
else:
    print(str2)

Measured memory_bytes: 3060