akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define ppll pair <pll, pll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
using namespace __gnu_pbds;
int main() {
  	string s; cin >> s;
  	ll l = s.length();
    ll n[l];
  	for (ll i = 0; i<l; i++) n[i] = s[i] - '0';
  	ll k; cin >> k;
  	ll c = 1;
  	ll dp[l][k+1] = {};
  	dp[0][0] = 1;
  	dp[0][1] = n[0] - 1;
  	for (ll i = 1; i<l; i++){
    	dp[i][0] = 1;
    	for (ll j = 1; j <= k; j++) dp[i][j] = dp[i-1][j-1] * 9 + dp[i-1][j];
    	if (n[i] > 0){
      		if (c <= k) dp[i][c] += 1; c++;
      		if (c <= k) dp[i][c] += n[i] - 1;
    	}
  	}
  	if (c == k) dp[l-1][k]++;
  	cout << dp[l-1][k] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int a, b, c;
	
	scanf("%d %d %d", &a, &b, &c);
	if(a >= b && a >= c) printf("%d\n", b + c);
	else if(b >= a && b >= c) printf("%d\n", a + c);
	else printf("%d\n", a + b);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main () {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if (K <= A) {
    cout << K << endl;
    return 0;
  }
  K -= A;
  if (K <= B) {
    cout << A << endl;
    return 0;
  }
  K -= B;
  cout << A - K << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = (int)1e5+10;
const ll MOD = (int)1e9+7;
struct node{
    int x,y;
    int idx;
}p[MAXN];
bool cmp_x(const node &a,const node &b){
    return a.x<b.x;
}
bool cmp_y(const node &a,const node &b){
    return a.y<b.y;
}
struct edge{
    int u,v,vl;
    edge(){}edge(int _u,int _v,int _vl){
        u=_u;v=_v;vl=_vl;
    }
}ed[MAXN<<1];
bool cmp(const edge &a,const edge &b){
    return a.vl<b.vl;
}
int cnt;
void addedge(int u,int v,int vl){
    ed[cnt++]=edge(u,v,vl);
}
int fa[MAXN];
int fi(int a){
    if(fa[a]!=a)fa[a]=fi(fa[a]);
    return fa[a];
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)fa[i]=i;
    for(int i=1;i<=n;i++)scanf("%d%d",&p[i].x,&p[i].y),p[i].idx=i;
    sort(p+1,p+1+n,cmp_x);
    for(int i=1;i<n;i++)addedge(p[i].idx,p[i+1].idx,p[i+1].x-p[i].x);
    sort(p+1,p+1+n,cmp_y);
    for(int i=1;i<n;i++)addedge(p[i].idx,p[i+1].idx,p[i+1].y-p[i].y);
    sort(ed,ed+cnt,cmp);
    int num=0;
    ll ans=0;
    for(int i=0;num<n-1;i++){
        int u,v,vl;
        u=ed[i].u;v=ed[i].v;vl=ed[i].vl;
        if(fi(u)!=fi(v)){
            fa[fa[u]]=fa[fa[v]];
            ans+=vl;
            num++;
        }
    }
    printf("%lld\n",ans);
    return 0;
}



Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
set <string> ans;
string Str,str;
bool cal(){
  bool alph[300]={};
  alph['a']=1;
  for(int i=0;i<str.size();i++){
    int flg=0;
    if(!alph[str[i]])flg=alph[str[i]]=1;
    if(str[i]-flg!=Str[i])return 0;
  }
  return 1;
}

bool used[300];
void saiki(int idx){
  while(used[str[idx]]||str[idx]=='z')idx++;
  if(idx==(int)str.size()&&cal())ans.insert(str);
  if(idx==str.size())return;
  saiki(idx+1);

  str[idx]++;
  used[str[idx]-1]=1;
  saiki(idx+1);
  used[str[idx]-1]=0;
  str[idx]--;
}

int main(){
  while(1){
  cin>>Str;
  str=Str;
  if(Str=="#")break;
  ans.clear();
  saiki(0);
  cout <<ans.size()<<endl;
  set <string>:: iterator it=ans.begin();

  int cnt=0;
  if(ans.size()<=10){
    while(it!=ans.end())cout <<*it<<endl,it++,cnt++;
  }
  else {
    while(cnt!=5) cout << *it<<endl,it++,cnt++;
    it=ans.end();
    while(cnt--)it--;
    while(it!=ans.end())cout << *it<<endl,it++;
  }
 

  
  }
  return 0;
}

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

int main()
{
    auto twos = [](int x){
        int ret = 0;
        for(int i=1; i<20; i++)
            ret += x/(1<<i);
        return ret;
    };

    int n;
    string s;
    cin >> n >> s;

    if(count(s.begin() ,s.end() ,'2') == 0){
        bool on = 0;
        for(int i=0; i<n; i++)
            on ^= (s[i] == '3')&!(twos(n-1)-twos(n-i-1)-twos(i));
        cout << 2*on << endl;
    }
    else{
        bool on = 0;
        for(int i=0; i<n; i++)
            on ^= !(s[i]&1)&!(twos(n-1)-twos(n-i-1)-twos(i));
        cout << on << endl;
    }
}


Measured memory_bytes: 1412
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
int N; 
cin >> N;
int S[110], T[110]; 
T[0] = 0; 
for(int i = 0; i < N; i++){
cin >> S[i]; 
T[i+1] = T[i] + S[i];
}
sort(S, S + N);
if(T[N] % 10 != 0)
cout << T[N] << endl; 
else{
int ans = 0; 
for(int i = 0; i < N; i++){
if( (T[N] - S[i]) % 10 != 0) {
ans = T[N] - S[i];
break;
}
}
cout << ans << endl; 
}
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(b<0) {
    if((b-a+1)%2) cout << "Negative" << endl;
    else cout << "Positive" << endl;
  } else if(a<=0&&0<=b) cout << "Zero" << endl;
  else cout << "Positive" << 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;

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

    if (k != 1)
        cout << n - k << endl;
    else
    {
        cout << 0 << endl;
    }
    
}


Measured memory_bytes: 256
n, k = map(int, input().split())
set_D = set(map(int, input().split()))

set_num = set()
for i in range(10):
    set_num.add(i)

set_use_num = set_num - set_D
set_use_num = sorted(set_use_num)


for j in range(n, 88889):
    Check = True
    for num in str(j):
        if int(num) not in set_use_num:
            Check = False
    if Check:
        ans = j
        break
    else:
        continue

print(ans)

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> tmp(n);
    rep(i,n) {
        cin >> a[i];
        tmp[i] = a[i];
    }
    sort(all(tmp));
    int f = tmp[n-1];
    int s =  tmp[n-2];   
    rep(i,n) {
        if(a[i]!=f) cout << f << endl;
        else cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll n, a[100];
 
int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) cin >> a[i];
	sort(a, a+n);
	reverse(a, a+n);
	ll res = 0;
	REP(i, n) if (i % 2 == 0) res += a[i]; else res -= a[i];
	cout << res << endl;
	return 0;
}
 

Measured memory_bytes: 256
n = input()
s = input()

st = []
for c in s:
    if st:
        bc = st.pop()
        if bc == c:
            st.append(c)
        else:
            st.append(bc)
            st.append(c)
    else:
        st.append(c)

print(len(st))
# print(st)


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int n; cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    vector<int> s = p;
    sort(ALL(s));
    int cnt = 0;
    rep(i,n) if(s[i]!=p[i]) cnt++;
    if(cnt == 0 || cnt == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] arr = new int[n];

		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}

		int temp = 0;
		int count = 0;
		for (int i = 0; i < n; i++) {
			for (int j = arr.length - 1; j > i; j--) {
				if (arr[j - 1] > arr[j]) {
					temp = arr[j];
					arr[j] = arr[j - 1];
					arr[j - 1] = temp;
					count++;
				}
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(i == 0 ? arr[i] : " " + arr[i]);
		}
		System.out.println("\n"+count);

	}
}


Measured memory_bytes: 26384
<>=~$";
for ($i=0; $i<=$`;$i++){
    for ($j=0; $j<=$`-$i; $j++){
        $k = $`-$i-$j;
        if (1000*$i+5000*$j+10000*$k==$'){
            printf("%d %d %d",$k,$j,$i);
            exit;
        }
    }
}
print "-1 -1 -1"

Measured memory_bytes: 4844
import collections
n=int(input())
D=list(map(int,input().split()))

mod=998244353
c=collections.Counter(D)

if D[0]!=0 or c[0]!=1:
  print(0)
else:
  ans=c[0]
  node=c[0]
  for i in range(1,n):
    ans*=(c[i-1]**c[i])%mod
    node+=c[i]
    if node==n:
      break
  print(ans%mod)

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



int main() {
    int n, m, k;
    cin >> n >> m >> k;
    
    vector<long int> a(n), b(m);
    int p = m-1;
    rep(i,n) {
        int x;
        cin >> x;
        if(i == 0)
            a[i] = x;
        else
            a[i] = a[i-1] + x;
    }
    rep(i,m) {
        int x;
        cin >> x;
        if(i == 0)
            b[i] = x;
        else
            b[i] = b[i-1] + x;
        
        if(b[i] > k) {
            p = i-1;
            break;
        }
    }
    
    int cnt = p+1;
    //cout << cnt << endl;
    int j = -1;
    for(int i = p; i >= -1; i--) {
        long int num;
        if(i == -1)
            num = 0;
        else
            num = b[i];
        while(j < n-1) {
            if(num + a[j+1] > k)
                break;
            else
                j++;
        }
        cnt = max(cnt, i+j+2);
        if(j == n-1 || a[j+1] > k)
            break;
    }
    
    cout << cnt << endl;
    
    return 0;
}



Measured memory_bytes: 6420
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
typedef long long LL;
const LL mod = 1e9 + 7;
// head
int n, m, a[105], b[105], cnt;

int main() {
	cin>>n>>m;
	rep(i, 1, m) {
		cin>>a[i];
		if(a[i]&1) cnt++;
	}
	if(cnt > 2) {
		cout<<"Impossible"<<endl;
		return 0;
	} 
	if(m == 1) {
		cout<<n<<endl;
		if(n == 1) cout<<1<<endl<<1<<endl;
		else cout<<2<<endl<<a[1] - 1<<" "<<1<<endl;
		return 0;
	}
	rep(i, 1, m)
		if(a[i]&1) {
			swap(a[i], a[1]);
			break;
		}
	rep(i, 2, m - 1) 
	    if(a[i]&1)
		   	swap(a[i], a[m]);
	rep(i, 1, m) cout<<a[i]<<" ";
	cout<<endl<<((a[m] == 1) ? m - 1: m)<<endl<<a[1] + 1<<" ";
	rep(i, 2, m - 1)
	    cout<<a[i]<<" "; 
	if(a[m] != 1) cout<<a[m] - 1<<endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define EPS 1e-8

using namespace std;

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

double dot (double x1, double y1, double x2, double y2 )
{
	return (x1*x2 + y1*y2 );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.orthogonal", "r", stdin );
	double xA, yA, xB, yB, xC, yC, xD, yD;

	while (scanf ("%lf %lf %lf %lf %lf %lf %lf %lf", &xA, &yA, &xB, &yB, &xC, &yC, &xD, &yD ) != EOF ){
		double ax = xB - xA, ay = yB - yA;
		double bx = xD - xC, by = yD - yC;
		if (fabs (dot (ax, ay, bx, by ) ) < EPS ){
			printf ("YES\n" );
		}else{
			printf ("NO\n" );
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1196
'''
.append(要素) リストに要素を追加 
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul


color = stdin.readline().rstrip().split()
nums = [int(s) for s in stdin.readline().rstrip().split()]
tar = stdin.readline().rstrip()
for el in range(2):
    if color[el] == tar:
        nums[el] -= 1
res = [str(s) for s in nums]
print(' '.join(res))


Measured memory_bytes: 38540
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007 #define MAX 5100000
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  ll N,M,ans=0;
  cin>>N;
  M=N;
  
  while(N>0){
    ans+=N%10;
    N/=10;
  }
  
  if(M%10!=0){
    cout<<ans<<endl;
    return 0;
  }
  
  cout<<ans+9<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 101;
using table = vector<vector<int> >;
table create(int n, int m){
	return vector<vector<int>>(n, vector<int>(m, 0));
}
int main(){
	int n, w; cin >> n >> w;
	vector<int> wi(n), vi(n);
	for(int i = 0; i < n; i++) cin >> wi[i] >> vi[i];
	table f = create(n + 1, 4 * n), nf;
	for(int i = 0; i < n; i++){
		nf = f;
		int up = wi[i] - wi[0];
		for(int j = 0; j < n; j++){
			for(int k = 0; k + up < 4 * n; k++){
				int nwe = k + up;
				nf[j + 1][nwe] = max(nf[j + 1][nwe], f[j][k] + vi[i]);
			}
		}	
		f = nf;
	}
	int ans = 0;
	for(int j = 0; j <= n; j++){
		for(int k = 0; k < 4 * n; k++){
			if(1ll * wi[0] * j + k <= w){
				ans = max(ans, f[j][k]);
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 100110;
int n, k, h[N];
int memo[N];
int dp(int i){
    if(i >= n)
        return 1e9;

    if(i == n-1)
        return 0;

    int &ret = memo[i], ans = 2e9;
    if(ret != -1)
        return ret;
    for(int j = 1; j <= k; ++j)
        ans = min(ans, dp(i+j) + abs(h[i]-h[i+j]));

    return ret = ans;
}
int main(){
    memset(memo, -1, sizeof memo);
    scanf("%d%d", &n, &k);
    for(int i = 0; i < n; ++i)
        scanf("%d", &h[i]);
    printf("%d", dp(0));
    return 0;
}


Measured memory_bytes: 5760
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,m;
Vi x,y,z;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>m;
    x.resize(n); y.resize(n); z.resize(n);
    rep(i,n){
        cin>>x[i]>>y[i]>>z[i];
    }
    ll ans=0,tmp;
    Vi v;
    int xx,yy,zz;
    rep(i,8){
        xx = 1,yy=1,zz=1;
        if(i & (1<<0))xx = -1;
        if(i & (1<<1))yy = -1;
        if(i & (1<<2))zz = -1;
        v.clear();
        rep(j,n){
            tmp = 0;
            tmp += x[j]*xx;
            tmp += y[j]*yy;
            tmp += z[j]*zz;
            v.pb(tmp);
        }
        Sort(v);
        tmp = 0;
        rep(j,m){
            tmp += v[j];
        }
        chmax(ans,tmp);
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
S = "".join(s)
T = "".join(t)
st = [S, T]
st.sort()

if S == T:
    print("No")
elif st[0] == S:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
using System;
using System.IO;
using System.Linq;

class Program
{
    static void Solve()
    {
        var max = 0;
        var min = 123;

        for (var i = 0; i < 5; i++)
        {
            var antenna = ReadInt();
            if (antenna > max) max = antenna;
            if (antenna < min) min = antenna;
        }

        var k = ReadInt();

        Console.WriteLine(max - min <= k ? "Yay!" : ":(");

    }

    static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }

    public static string Read() { return Console.ReadLine(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }

    public static string[] Reads() { return Console.ReadLine().Split(' '); }
    public static int[] ReadInts() { return Reads().Select(_ => int.Parse(_)).ToArray(); }
    public static long[] ReadLongs() { return Reads().Select(_ => long.Parse(_)).ToArray(); }
    public static double[] ReadDoubles() { return Reads().Select(_ => double.Parse(_)).ToArray(); }
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#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 loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int r; cin >> r;
	cout << 3 * r*r << endl;

	return 0;
}


Measured memory_bytes: 256
n,m,p = map(int,input().split())
L = []
for i in range(n):
    a = list(map(int,input().split()))
    L.append(a)

ans = 10**10
for i in range(1<<n):
    score = 0
    li = [0]*m
    for j in range(n):
        LL = L[j][1:]
        
        if (i>>j)&1:
            score += L[j][0]
            for k in range(m):
                li[k] +=LL[k]
    if all(x >= p for x in li):
        ans = min(ans,score)
if ans != 10**10:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 9232
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int N;
string S;
ll dp[1010101][2];

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

	cin >> S;
	int N = S.size();

	for (int i = 0; i < 1010101; i++) {
		for (int j = 0; j < 2;j++) {
			dp[i][j] = inf;
		}
	}

	dp[0][0] = 0;
	dp[0][1] = 1;
	for (int i = 1; i <= N; i++) {
		int c = S[i - 1] - '0';
		for (int k = 0; k <= 9; k++) {
			if (k >= c)dp[i][0] = min(dp[i][0],dp[i-1][0] + 2*k - c);
			else dp[i][0] = min(dp[i][0],dp[i-1][1] + 10 + 2*k - c);
			if (k - 1 >= c)dp[i][1] = min(dp[i][1],dp[i-1][0] + 2*k-1-c);
			else dp[i][1] = min(dp[i][1],dp[i-1][1] + 2*k+9-c);
		}
	}
	puts(dp[N][0]);
	return 0;
}


Measured memory_bytes: 17180
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	cout << t + s << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
mod=998244353
n=int(input())
D=list(map(int,input().split()))
Count=Counter(D)
if D[0]!=0 or Count[0]!=1:print(0);exit()

ans=1
for i in range(1,max(D)+1):
    ans *=Count[i-1]**Count[i]
    ans %=mod
print(ans)

Measured memory_bytes: 62004
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    string s;
    int c0=0,c1=0,c2=0,c3=0;
    for (int i=0;i<n;i++)
    {
        cin>>s;
        if (s=="AC")
            c0++;
        else if (s=="WA")
            c1++;
        else if (s=="TLE")
            c2++;
        else if (s=="RE")
            c3++;


    }


    cout<<"AC x "<<c0<<endl;
    cout<<"WA x "<<c1<<endl;
    cout<<"TLE x "<<c2<<endl;
    cout<<"RE x "<<c3;
    return 0;
}


Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

double power( double a, int n )
{
  double r;
  int abs_n;

  r = 1; abs_n = n < 0 ? -n : n;
  while ( abs_n > 0 ) {
    if ( abs_n % 2 == 1 ) { r *= a; }
    a *= a;
    abs_n /= 2;
  }

  return n >= 0 ? r : 1/r;
}

double nthroot( double a, int n )
{
  double x, y;

  if ( a <= 0 || n < 0 ) { return 0; }
  if ( n == 0 ) { return 1; }

  /* a > 0 かつ n > 0 の場合 */
  y = (a > 1) ? a : 1;
  do {
    x = y;
    y = ((n-1)*x + a/power(x, n-1)) / n;
  } while ( y < x );

  return y;
}

int is_power( int a )
{
  int i; 

  if ( a == 1 ) { return 1; }

  for ( i = 2; i <= floor(log2(a)); i++ ) {
    if ( power(floor(nthroot(a, i)), i) == a ) { 
      return 1;
    }
  }

  return 0;
}
int main(){
  int n;
  cin>>n;
  for(int i=n;i>=1;i--){
    if(is_power(i)){
      cout<<i<<endl;
      return 0;
    }
  }
}
  

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

int main(){
  int A, B;
  cin >> A >> B;
  int sum = 0;
  for(int ii=0; ii<2; ii++){
    if(A > B){
      sum += A;
      A--;
    }else{
      sum += B;
      B--;
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
N, M  = map( int, input().split())
A = [ list( map( int, input().split())) for _ in range(N)]
C = [ list( map( int, input().split())) for _ in range(M)]
for i in range(N):
    ans = 1
    x, y = A[i]
    path = abs(x-C[0][0]) + abs(y-C[0][1])
    for j in range(1,M):
        if path > abs(x-C[j][0]) + abs(y-C[j][1]):
            ans = j+1
            path = abs(x-C[j][0]) + abs(y-C[j][1])
    print(ans)

Measured memory_bytes: 3064
#ABC129C-TypicalStairs.py

#import list
import numpy as np
from sys import stdin, setrecursionlimit
from functools import lru_cache

input = stdin.readline
setrecursionlimit(1000)

#constant
#N = int(input())
N, M = list(map(int,input().split()))
A = {int(input()) for _ in range(M)}

#variable
rootList = np.array([1]+[0]*(N))

#function

#class

#main function
def main():
    for i in range(N):
        rootList[i+1] = (rootList[i]+rootList[i-1])%1000000007
        if i+1 in A:
            rootList[i+1] = 0
    print(rootList[N])

if __name__ == "__main__":
    main()


Measured memory_bytes: 21088
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    deque<ll> dq;
    rep(i,n){
        ll x; 
        cin >> x;
        if(n%2==0){
            if((i+1)%2==0) dq.push_front(x);
            else dq.push_back(x);
        }else{
            if((i+1)%2==0) dq.push_back(x);
            else dq.push_front(x);
        }
    }
    for(auto u : dq){
        cout << u << endl;
    }
    return 0;
}

Measured memory_bytes: 3840
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	N = int(input())
	
	DP = [[[[0 for _ in range(4)] for _ in range(4)] for _ in range(4)] for _ in range(N+1)]
	
	DP[0][3][3][3] = 1
	
	for length in range(N):
		for c3 in range(4):
			for c2 in range(4):
				for c1 in range(4):
					if DP[length][c3][c2][c1] == 0:
						continue
					for a in range(4):
						if c2 == 0 and c1 == 1 and a == 2:
							continue
						if c2 == 0 and c1 == 2 and a == 1:
							continue
						if c2 == 1 and c1 == 0 and a == 2:
							continue
						if c3 == 0 and c1 == 1 and a == 2:
							continue
						if c3 == 0 and c2 == 1 and a == 2:
							continue
						DP[length+1][c2][c1][a] = (DP[length+1][c2][c1][a] + DP[length][c3][c2][c1]) % 1000000007
	
	ans = 0
	for c3 in range(4):
		for c2 in range(4):
			for c1 in range(4):
				ans = (ans + DP[N][c3][c2][c1]) % 1000000007
	print(ans)
			
if __name__ == "__main__":
	main()
	

Measured memory_bytes: 3692
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int minv = Integer.MAX_VALUE;
        int maxv = Integer.MIN_VALUE;
        for(int i = 0; i < n; i++){
            int j = sc.nextInt();
            maxv = Math.max(j - minv, maxv);
            minv = Math.min(minv, j);
        }
        
        System.out.println(maxv);
    }
}


Measured memory_bytes: 68492
import java.text.DecimalFormat;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        final long Q = sc.nextLong();
        final long H = sc.nextLong();
        final long S = sc.nextLong();
        final long D = sc.nextLong();
        final long N = sc.nextLong();

        final long X = Math.min(Math.min(S, 2 * H), 4 * Q);

        out.println(Math.min(D * (N / 2) + X * (N % 2), X * N));

        out.flush();
    }

}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21332
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  ld X; cin >> X;
  ld now = 100;

  int cnt = 0;
  while (now < X){
    cnt++;
    now = now * 1.01;
    now = (ll)now;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;
/*
ordered_set(both these operations in log)
1. find_by_order : it returns iterator to the ith largest element.
2. order_of_key  : The number of items in a set that are strictly smaller than k.
*/

//memset(dp,-1,sizeof(dp));
//fill(v.begin(), v.end(), -1);
//priority_queue< pii, vector <pii> , greater<pii>> pq;
//vector<int> dist(V, INF);


#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define lb lower_bound
#define ub upper_bound

#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define pii                 pair<int,int>
#define vi                  vector<int>
#define vii                 vector<pii>
#define mi                  map<int,int>
#define mii                 map<pii,int>
#define all(a)              (a).begin(),(a).end()
#define fi                  first
#define se                  second
#define sz(x)               (int)x.size()
#define endl                '\n'
#define md                  1000000007
#define rep(i,a,b)          for(int i=a;i<b;i++)
#define pcout(x)	          cout<<fixed<<setprecision(x)
#define debug(x)            cout<<#x<<"::"<<x<<endl;
#define debug2(x,y)         cout<<#x<<"::"<<x<<"\t"<<#y<<"::"<<y<<endl;
#define boost               ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)



typedef long long ll;
typedef double ld;

inline ll prodm(ll a,ll b)  {return ((a%md)*(b%md))%md;}
inline ll summ(ll a,ll b)   {return ((a%md)+(b%md))%md;}
inline bool ispow2(ll x)    {return  x && (!(x&(x-1)));}

const int N = 1e5 + 5;
const ll  infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;

/**************************BounceBackBolt*********************************/
ll fastexpo(ll n,ll pwr)
{
  if(pwr==0)
    return 1;
  if(pwr==1)
    return n;
  ll ans=fastexpo(n,pwr/2);
  ans=prodm(ans,ans);
  if(pwr&1)
  {
      ans=prodm(ans,n);
  }
    return ans;
}

ll modInverse(ll base)
{return fastexpo(base,md-2);}


vector < int > g[N];
int d[N];
void dfs(int v, int p, int dd){
    d[v] = dd;
    for(int to : g[v]){
        if(to == p) continue;
        dfs(to, v, dd + 1);
    }
}

/*********************************************************************/
int main()
{
  boost;
  set<string> st;
  int T;cin>>T;
  while(T--)
  {
    string s;
    cin>>s;
    st.insert(s);

  }
  cout<<st.size();
  return 0;
}


Measured memory_bytes: 21564
from functools import reduce

N, A, B = map(int, input().split())

MOD = 10 ** 9 + 7

def f(A):
    num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))
    den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))
    return num * pow(den, MOD - 2, MOD) % MOD

answer = pow(2, N, MOD) - 1 - f(A) - f(B)
answer %= MOD
print(answer)

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

int main(){
  string s;
  cin>>s;
  int N=s.size();
  int pt1=0;//01010101のパターン
  int pt2=0;//10101010のパターン
  for(int i=0;i<N;i++){
    if (s[i]==(i%2+48)){
      pt2++;
    }else{
      pt1++;
    }
  }
  
  int ans=min(pt1,pt2);
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);

// ===

fn main() {
    let s: String = read();
    let mut price = 700;
    for u in s.into_bytes() {
      if u == b'o' {
        price += 100;
      }
    }
    println!("{}", price);
}



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

int main() {
  int a, b;
  cin >> a >> b;
  if(1 <= a && 9 >= a && 1 <= b && 9 >= b)
    cout << a*b << endl;
  else
    cout << -1 << endl;
  return 0;
}


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


using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)
        cout<<c;
    else if(a==c)
        cout<<b;
    else if(b==c)
        cout<<a;

    return 0;
}


Measured memory_bytes: 256
package main
import "fmt"
func main(){
	var n int
	fmt.Scan(&n)
	var a []int = make([]int, n)
	for i := 0;i<n;i+=1 {
		var t int
		fmt.Scan(&t)
		t -= 1
		a[t] = i+1
	}
	for i := 0;i<n;i+=1 {
		fmt.Printf("%d ",a[i])
	}
}


Measured memory_bytes: 6016
import math
s = input()
n = len(s)
ans = [0 for _ in range(n)]

count = 0

for i in range(n):
    if s[i] == "R":
        count += 1
    elif s[i] == "L" and count != 0:
        ans[i] += count // 2
        ans[i-1] += (count + 1) // 2
        count = 0

count = 0
for i in range(n-1, -1, -1):
    if s[i] == "L":
        count += 1
    elif s[i] == "R" and count != 0:
        ans[i+1] += (count + 1) // 2
        ans[i] += count // 2
        count = 0

print(' '.join([str(a) for a in ans]))



Measured memory_bytes: 17172
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    string s,s1,s2,chk3;
    cin>>s;
    chk3=s;
    n=s.size();
    for(int i=0; i<(n-1)/2; i++)
        s1+=s[i];
    string chk1=s1;
    reverse(s1.begin(),s1.end());
    for(int i=(n+3)/2-1; i<n; i++)
        s2+=s[i];
    string chk2=s2;
    reverse(s2.begin(),s2.end());
    reverse(s.begin(),s.end());
    if(chk3==s && chk1==s1 && chk2==s2)
        cout<<"Yes\n";
    else
        cout<<"No"<<endl;
    s1.clear();
    s2.clear();
    chk1.clear();
    chk2.clear();
    chk2.clear();
    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;
const int INF = 1001001001;
const int MOD = 1000000007;

int main() {
    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n) cin >> c[i];

    sort(a.begin(), a.end());
    sort(c.begin(), c.end());

    ll ans = 0;

    for (auto x : b) {
        ll cnta = lower_bound(a.begin(), a.end(), x) - a.begin();
        ll cntc = c.end() - upper_bound(c.begin(), c. end(), x);
        ans += cnta*cntc;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
package main

import (
	"fmt"
	"sort"
)

func is_larger_than(tt, ss []int) bool {
	for i := range tt {
		if len(ss) == i {
			return true
		}
		if tt[i] > ss[i] {
			return true
		} else if tt[i] < ss[i] {
			return false
		}
	}
	return false
}

func to_ints(s string) []int {
	ss := make([]int, len(s))
	for i, r := range s {
		ss[i] = int(r)
	}
	return ss
}

func main() {
	var s, t string
	fmt.Scan(&s, &t)

	ss := to_ints(s)
	tt := to_ints(t)

	sort.Ints(ss)
	sort.Sort(sort.Reverse(sort.IntSlice(tt)))

	if is_larger_than(tt, ss) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<stdio.h>
int min(int a,int b){
  if(a > b){
    return b;
  }
  return a;
}

int main(){
  int n,m,x,ans1 = 0,ans2 = 0;
  scanf("%d %d %d",&n,&m,&x);
  int a[m];
  for(int i = 0;i < m;i++){
    scanf("%d",&a[i]);
    if(a[i] < x){
      ans1++;
    }else{
      ans2++;
    }
  }
  printf("%d\n",min(ans1,ans2));
  return 0;
}

Measured memory_bytes: 128
n = int(input())
a = [0]*10**5
for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        a[x**2+y**2+z**2+x*y+y*z+z*x]+=1
for i in range(1,n+1):
  print(a[i])


Measured memory_bytes: 9752
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
 //     freopen("q.gir","r",stdin);
 //     freopen("q.cik","w",stdout);
      map<string,int>data;
      data["SUN"]=7;
      data["MON"]=1;
      data["TUE"]=2;
      data["WED"]=3;
      data["THU"]=4;
      data["FRI"]=5;
      data["SAT"]=6;
      string s;
      cin>>s;
      if(data[s]==7)cout<<7;
      else cout<<data["SUN"]-data[s];
}


Measured memory_bytes: 256
def solve(i, m, A, n):

    if m == 0:
        return True

    elif i >= n:
        return False

    return (solve(i + 1, m - A[i], A, n) or solve(i + 1, m , A, n))

def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    q = int(input())
    M = [int(a) for a in input().split()]

    sum_A = sum(A)

    for m in M:

        if m > sum_A:
            print("no")
            continue

        if solve(0, m, A, n):
            print("yes")
        else:
            print("no")

main()


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

#define ll long long int
#define li int64_t

int main()
{
	string s,t;
	cin>>s>>t;
	int max = -1;
	for(int i=0;i<=s.length()-t.length();i++)
	{
		int count = 0;
		for(int j = 0;j<t.length();j++)
		{
			if(t[j] == s[i+j])
			{
				count++;
			}
		}
		if(count>max)max = count;
	}	
	cout<<t.length()-max;
}

Measured memory_bytes: 3604
def warshal(d):
    n=len(d)
    for k in range(1,n):
        for i in range(1,n):
            for j in range(1,n):
                d[i][j]=min(d[i][j],d[i][k]+d[k][j])
    return d
n,m,l=map(int,input().split())
abc=[list(map(int,input().split())) for i in range(m)]
q=int(input())
st=[list(map(int,input().split())) for i in range(q)]
inf=float("inf")
dp=[[inf]*(n+1) for i in range(n+1)]
for i in range(1,n+1):
    dp[i][i]=0
for u in abc:
    a,b,c=u
    dp[a][b]=c
    dp[b][a]=c
dp=warshal(dp)
data=[[inf]*(n+1) for i in range(n+1)]
for i in range(1,n+1):
    for j in range(1,n+1):
        if 0<dp[i][j]<=l:
            data[i][j]=1
        elif dp[i][j]==0:
            data[i][j]=0
data=warshal(data)
for u in st:
    s,t=u
    if data[s][t]!=inf:
        print(data[s][t]-1)
    else:
        print(-1)

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

int n;
ll a[100010], s[100010], as[100010], ans;

int main(){
	scanf("%d%lld", &n, a + 1);
	s[1] = as[1] = a[1];
	for(int i = 2; i <= n; i++){
		char buf[3]; scanf("%s%d", buf, a + i);
		as[i] = as[i - 1] + a[i];
		if(buf[0] == '-') a[i] *= -1;
		s[i] = s[i - 1] + a[i];
	}
	ans = s[n];
	for(int i = 2; i <= n; i++){
		if(a[i] < 0){
			ll ts = 2 * a[i];
			for(int j = i + 1; j <= n; j++){
				if(a[j] < 0) break;
				ts -= 2 * a[j];
			}
			ans = max(ans, ts + s[i - 1] + as[n] - as[i - 1]);
		}
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 2688
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
lcm = 1
for i in range(n):
    lcm = a[i] * lcm // gcd(a[i], lcm)
b = [lcm // a[i] for i in range(n)]
print(sum(b) % (10**9+7))

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

int inf = 1e9;

int main() {
    int N, T;
    cin >> N >> T;
    int ans = inf;
    for (int i = 0; i < N; i++) {
        int c, t;
        cin >> c >> t;
        if (t <= T && c < ans) {
            ans = c;
        }
    }
    if (ans == inf) {
        cout << "TLE" << endl;
    } else {
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
package main

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

const (
	maxBufsize = 1000000
)

func inputs(lines int) []string {
	var strSlice []string

	rdr := bufio.NewReaderSize(os.Stdin, maxBufsize)

	for i := 0; i < lines; i++ {

		line := ReadLine(rdr)
		strSlice = append(strSlice, line)

	}

	return strSlice
}

// ReadLine is to read long line
func ReadLine(rdr *bufio.Reader) string {
	buf := make([]byte, 0, maxBufsize)
	for {
		l, p, e := rdr.ReadLine()

		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}

	return string(buf)
}

func main() {
	line := inputs(1)

	lineSlice := strings.Split(line[0], " ")

	a, _ := strconv.Atoi(lineSlice[0])
	b, _ := strconv.Atoi(lineSlice[1])
	c, _ := strconv.Atoi(lineSlice[2])

	fmt.Printf("%d %d %d \n", c, a, b)
}


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

using namespace std;

const int maxN = 1e3 + 5;
const int modN = 1e9 + 7;
char grid[maxN][maxN];
int dp[maxN][maxN];
int n, m;

int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; ++i)
	{
		string temp;
		cin >> temp;
		for (int j = 1; j <= m; ++j)
		{
			grid[i][j] = temp[j - 1];
		}
	}

	dp[0][1] = 1;

	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= m; ++j)
		{
			if (grid[i][j] == '.')
			{
				dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % modN;
			}
		}
	}

	cout << dp[n][m] << endl;
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long MOD = 1000000007LL; // 998244353LL;

// Repeat
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
// Container Util
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort((v).begin(),(v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

int main() {
    int N,K; cin >> N >> K;
    int ans = K;
    REP(i, N-1) ans *= (K-1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

#define RPT(i, n) for (int i = 0; i < n; i++)

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

    int cur = X;
    RPT(a, X / 100 + 1) {
        RPT(b, (X - 100 * a) / 101 + 1) {
            RPT(c, (X - 100 * a - 101 * b) / 102 + 1) {
                RPT(d, (X - 100 * a - 101 * b - 102 * c) / 103 + 1) {
                    RPT(e, (X - 100 * a - 101 * b - 102 * c - 103 * d) / 104 + 1) {
                        if ((X - 100 * a - 101 * b - 102 * c - 103 * d - 104 * e) % 105 == 0) {
                            cout << 1 << endl;
                            return 0;
                        }
                    }
                }
            }
        }
    }

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


Measured memory_bytes: 256
S = input()
Q = int(input())
q = [input() for i in range(Q)]
reverse = False
p =[]
f =[]
appP = p.append
appF = f.append

for i in range(0,Q,1):
    if q[i][0]=="1":
        reverse=not reverse

    elif q[i][0]=="2":
        num,F,C = q[i].split(sep=" ")
        if F=="1":
            if reverse == False:
                appP(C)
            else:
                appF(C)
        elif F=="2":
            if reverse == False:
                appF(C)
            else:
                appP(C)
if reverse:
    tmpP="".join(p)
    tmpF="".join(f[::-1])
    print(tmpF+S[::-1]+tmpP)
else:
    tmpF="".join(f)
    tmpP="".join(p[::-1])
    print(tmpP+S+tmpF)

Measured memory_bytes: 86232