akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

string s;
int main() {
    cin>>s;
    string match="keyence";
    int now=0;
    REP(i,0,s.size()){
        if(s[i]==match[now]){
            now++;
        }else{
            break;
        }
    }
    int now_r=6;
    RREP(i,0,s.size()){
        if(now <= now_r && s[i]==match[now_r]){
            now_r--;
        }else{
            break;
        }
    }
    if(now==now_r+1 || now==7 || (now_r==-1)){
        p("YES");
    }else{
        p("NO");
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
//#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//const int mod = 998244353;
const int N = 2000005;
const int K = 1000000;
vector < int > ans[N];
vector < int > pol;
int mod;
int binpow(int x, int y){
    if (y == 0) return 1;
    if (y % 2) return x * binpow(x, y - 1) % mod;
    int z = binpow(x, y / 2);
    return z * z % mod;
}
vector < int > mp(vector < int > p, int x, int y){
    vector < int > res;
    int c = 0;
    for (int i = 0; i < p.size(); i++){
        p[i] += c;
        res.pb((p[i] * x % mod + mod) % mod);
        c = (y * (p[i] - c) % mod + mod) % mod;
    }
    res.pb(c);
    return res;
}
vector < int > dv(vector < int > p, int x, int y){
    vector < int > res;
    int c = 0;
    for (int i = 0; i < p.size() - 1; i++){
        p[i] += c;
        res.pb((p[i] % mod + mod) % mod);
        c = (-y * p[i] % mod + mod) % mod;
    }
    return res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n;
    int tx = 0;
    vector < int > v1, v2, v3;
    cin >> n;
    tx = 0;
    for (int i = 1; i <= n; i++){
        tx ^= i;
    }
    int m = n;
    while(m % 2 == 0) m /= 2;
    if (m == 1){
        cout << "No";
        return 0;
    }
    if (tx == 0){
        cout << "Yes" << endl;
        for (int i = 1; i < n + n; i++){
            cout << i << " " << i + 1 << endl;
        }
        return 0;
    }
    if (tx == 1){
        v1.pb(1);
        v2.pb(2);
        v2.pb(3);
        for (int i = 4; i <= n; i++){
            v3.pb(i);
        }
    } else{
        int z = 1;
        while(z + z <= tx) z += z;
        v1.pb(z);
        if ((tx ^ z) != 0) v1.pb((tx ^ z));
        v2.pb(z + 1);
        if ((tx ^ (z + 1)) != 0) v2.pb((tx ^ (z + 1)));
        for (int i = 1; i <= n; i++){
            int f = 1;
            for (auto j: v1) if (i == j) f = 0;
            for (auto j: v2) if (i == j) f = 0;
            if (f) v3.pb(i);
        }
    }
    cout << "Yes" << endl;
    set < pair < int, int > > ans;
    vector < int > t1, t2;
    for (auto j: v1) t1.pb(j);
    for (auto j: v2) t1.pb(j);
    for (auto j: v1) t1.pb(j + n);
    for (auto j: v2) t1.pb(j + n);
    for (auto j: v3) t2.pb(j);
    for (auto j: v2) t2.pb(j);
    for (auto j: v3) t2.pb(j + n);
    for (int i = 0; i < t1.size() - 1; i++){
        ans.insert({min(t1[i], t1[i + 1]), max(t1[i], t1[i + 1])});
    }
    for (int i = 0; i < t2.size() - 1; i++){
        ans.insert({min(t2[i], t2[i + 1]), max(t2[i], t2[i + 1])});
    }
    for (auto i: ans){
        cout << i.F << " " << i.S << endl;
    }
}


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

typedef long long ll;

using namespace std;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a.at(i);
        a.at(i) -= i + 1;
    }
    sort(a.begin(), a.end());
    ll median = (n % 2 ? a.at(n / 2) : (a.at(n / 2 - 1) + a.at(n / 2)) / 2), sum = 0;
    for (ll i = 0; i < n; ++i) {
        a.at(i) -= median;
        sum += max(a.at(i), -a.at(i));
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main() {
    int n;cin>>n;
    vector<P>V(n);
    rep(i,n){
        int x;cin>>x;
        V[i]=make_pair(x,i+1);
        
    }
    sort(all(V));
    rep(i,n)cout<<V[i].S<<' ';
}

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

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, a;
	
	cin >> n >> a;
	n %= 500;
	
	if(n <= a)
		cout << "Yes";
	else
		cout << "No";
	
	return 0;
}//main


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  long long n;
  cin>>n;
  long long cnt[10000005] = {};
  for(long long d = 1; d <= n; d++){
    long long t = 1;
    while(d * t <= n){
      cnt[d * t]++;
      t++;
    }
  }
  long long ans = 0;
  for(long long m = 1; m <= n; m++) ans += m * cnt[m];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 81788
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
 int n;
  cin >> n;
  vector<int> vec(n);
  rep(i, n) {
  cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  string word = "YES";
  rep(i, n - 1) {
  if (vec.at(i) == vec.at(i + 1)) {
    word = "NO";
    break;
  }
  }
    cout << word << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
  int rainy=0,max=0,c=getchar();
  while(c=='R'||c=='S'){{if(c=='R')rainy++;else rainy=0;}max=max<rainy?rainy:max;c=getchar();}
  return printf("%d\n",max),0;
}

Measured memory_bytes: 1592
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;

int main()
 {
 	int n,i,a=0,b=0,c=0,d=0;
 	cin>>n;
 	string s[n];
 	for(i=0;i<n;i++)
 		cin>>s[i];
 	for(i=0;i<n;i++)
 		{
 			if(s[i]=="AC")
 				a++;
 			else if(s[i]=="WA")
 				b++;
 			else if(s[i]=="TLE")
 				c++;
 			else if(s[i]=="RE")
 				d++;
		 }
		cout<<"AC x "<<a<<endl;
		cout<<"WA x "<<b<<endl;
		cout<<"TLE x "<<c<<endl;
		cout<<"RE x "<<d<<endl;
		
	 
 	return 0;
}
 	
 					

Measured memory_bytes: 6720
import itertools
n,m,q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]

l = range(1,m+1)
point = 0
for v in itertools.combinations_with_replacement(l,n):
    p = 0
    for a,b,c,d in abcd:
        if v[b-1] - v[a-1] == c:
            p += d
    if p > point: point = p
print(point)

Measured memory_bytes: 9136
#include <cstdio>
int a[10];

bool dfs(int k, int B, int C){
    if(k == 10) return true;
    if(a[k] > B){
        if(dfs(k + 1, a[k], C))
            return true;
    }
    if(a[k] > C){
        if(dfs(k + 1, B, a[k]))
            return true;
    }
    return false;
}

void solve(){
    if(dfs(0, 0, 0))
        printf("YES\n");
    else
        printf("NO\n");
}

int main(int argc, char const *argv[]){

    int t;
    scanf("%d", &t);
    while(t --){
        for(int i = 0; i < 10; i ++)
            scanf("%d", &a[i]);
        solve();
    }

    return 0;
}

Measured memory_bytes: 1008
N = int(input())
A = list(map(int, input().split()))

B = [0]

B = B+A+[0]

count = 0

for i in range (1, N+2):
	count+=abs(B[i]-B[i-1])

for i in range (1, N+1):
	if B[i+1] - B[i] >= 0:
		if B[i] - B[i-1] >= 0:
			print(count)
		else:
			print(count-abs(B[i+1]-B[i])-abs(B[i]-B[i-1])+abs(B[i+1]-B[i-1]))
	else:
		if B[i] - B[i-1] <= 0:
			print(count)
		else:
			print(count-abs(B[i+1]-B[i])-abs(B[i]-B[i-1])+abs(B[i+1]-B[i-1])) 

Measured memory_bytes: 20452
#include<bits/stdc++.h>
    using namespace std;
     
    void frog2(vector<int>&cost, int m){
    	int n = cost.size();
    	if(n == 0){
    		cout << 0 << endl;
    	}
    	int dp[n];
    	dp[0] = 0;
    	dp[1] = abs(cost[1]-cost[0])+dp[0];
    	int j;
    	for(int i=2; i<n; i++){
			int mn=1e9+5;
			for(int k=0; k<m; k++){
				if(i-k-1>=0) mn = min(mn , abs(cost[i]-cost[i-k-1])+dp[i-k-1]);
			}
			dp[i]=mn;
    	}
    	cout << dp[n-1] << endl;
    }
     
    int main(){
    	int n;
		int k;
    	cin >> n;
		cin >> k;
    	vector<int> cost;
    	int  val;
    	for(int i=0; i<n; i++){
    		cin >> val;
    		cost.push_back(val);
    	}
    	frog2(cost, k);
    	return 0;
    }

Measured memory_bytes: 1144
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		long N = stdIn.nextLong();
		long ans = 0;
		for(long a = 1; a <= N; a++){
			if(a % 3 == 0 || a % 5 == 0){
				ans = ans + 0;
			}
			else{
				ans = ans + a;
			}
		}
		System.out.println(ans);
		stdIn.close();
	}
}

Measured memory_bytes: 35700
#include <stdio.h>
#include <string.h>
int main(void){
	char s[11];
	scanf("%s",s);
	int len=0,ans=0;
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G')len++;
		else{
			ans = ans>len?ans:len;
			len=0;
		}
	}
	ans = ans>len?ans:len;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

// constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
// constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

void solve() {
    char a;
    cin >> a;
    if (a >= 'A' && a <= 'Z') cout << "A" << endl;
    else cout << "a" << endl;
}

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

Measured memory_bytes: 3632
#include<stdio.h>
int main()
{
    int n,i;
    scanf("%d",&n);
    long long int a[n+5],sum=0,k,min,j;
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    if(n==1)
        printf("%lld\n",a[0]);
    else{
    min=a[0];
    for(i=1;i<n;i++)
    {
        if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%min==0)sum++;
    }
    if(sum==n)printf("%lld\n",min);
    else
    {
        for(j=0;j<999;j++)
        {
        sum=0;
        for(i=0;i<n;i++)
       {
           k=a[i]%min;
           if(k==0)a[i]=min;
           else
           a[i]=k;
       }
       min=a[0];
    for(i=1;i<n;i++)
    {
        if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%min==0)sum++;
    }
    if(sum==n){
            printf("%lld\n",min);
            k=1;
    break;
    }
        }
    }
    }
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> H;
  int h;
  REP(i,N) {
    cin >> h;
    H.pb(h);
  }
  for(int i = N - 1; i > 0; --i) {
    if (H[i-1] <= H[i]) continue;
    if (H[i-1] == H[i] + 1) {
      --(H[i-1]);
      continue;
    }
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 1400
N=int(input())
s=list(map(int,input().split()))
# N=6
# s=[4 ,1 ,3 ,1 ,6 ,2]


from collections import Counter
S=Counter(s)#カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})

if S.most_common(1)[0][1]==1:
    print("YES")
else:
    print("NO")




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

//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = (LL)INF * INF;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0, a + b - n) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,suma=0;
		cin>>n;
		int o1[n],o2[n];
		for (int i=0;i<n;i++){
			cin>>o1[i];}
		for (int i=0;i<n;i++){
			cin>>o2[i];}
		
		for (int i=0;i<n;i++){
			if(o1[i]>o2[i]){
				suma=suma+(o1[i]-o2[i]);
			}
			}
		cout<<suma;
	return 0;
}

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

int main() {
    int N,D,X;
    cin>>N>>D>>X;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i);
    }
    int choco=0;
    for(int j=0;j<N;j++){
        for(int k=0;;k++){
            if(k*A.at(j)+1<=D){

            }else{
                choco+=k;
                break;
            }
        }
    }
    cout<<choco+X<<endl;
return 0;}
/*
g++ code.cpp
./a.out
*/

Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, T = get_ints
X = []
N.times do |i|
  X[i] = get_ints
end

xx = X.filter { |c, t| t <= T }

if xx.length > 0
  puts xx.sort { |a, b| a[0] <=> b[0] }.first[0]
else
  puts 'TLE'
end





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

long long N;
long long ans = 0;

int main() {
    cin >> N;
    for (long long i=1; i*i<=N; ++i) {
        if (N % i == 0) {
            long long cand = (N-i)/i;
            if (cand == 0) continue;
            if (N%cand==N/cand) ans += cand;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int dp[5001][5001];
int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) dp[i][j] = 0;
  }
  for (int i=0; i<n; i++) {
    for (int j=1; j<n; j++) {
      if (i >= j) {
        continue;
      }
      if (s[i] == s[j]) {
        if (i == 0) {
          dp[i][j] = 1;
        } else if (i < j - dp[i-1][j-1]) {
          dp[i][j] = dp[i-1][j-1] + 1;
        } else{
          dp[i][j] = dp[i-1][j-1];
        }
      }
    }
  }
  int ans = 0;
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      ans = max(dp[i][j], ans);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 97920
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    n = II()
    ans = n * 800
    print(ans-(n//15)*200)
    return

#B
def B():
    n = II()
    print(math.factorial(n)%mod)
    return

#C
def C():

    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 4740
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  int count = 0;
  for(int i = 0;i < 3;i++){
    if(s.charAt(i) == 'o')count++;
  }
  System.out.println(700 + count*100);
}}

Measured memory_bytes: 23764
#include<stdio.h>
long long MIN(long long a,long long b){return a<b?a:b;}
int main(){
  long long a,b,c;
  scanf("%lld %lld %lld",&a,&b,&c);
  printf("%lld\n",(a%2)*(b%2)*(c%2)?MIN(a*b,MIN(b*c,a*c)):0);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const int INF = INT_MAX;
const ll MOD = 1e9+7;


struct PotentializedUnionFind {
  typedef long long Weight;
  vector<int> par;
  vector<Weight> val;
  PotentializedUnionFind(int size) : par(size, -1),val(size,0) { }
  bool unionSet(int y, int x,Weight w) {
    w += potential(x);w -= potential(y);
    x = root(x); y = root(y);
    if (x != y) {
      if (par[y] < par[x]) swap(x, y),w=-w;
      par[x] += par[y]; par[y] = x;
      val[y] = w;
    }
    return x != y;
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    if(par[x] < 0)return x;
    int r = root(par[x]);
    val[x] += val[par[x]];
    return par[x]=r;
  }
  int size(int x) {
    return -par[root(x)];
  }
  Weight potential(int x){
    root(x);
    return val[x];
  }
  Weight diff(int x,int y){
    return potential(x)-potential(y);
  }
};

int main(){
  int N,M;cin>>N>>M;
  PotentializedUnionFind UF(N);
  bool isok=true;
  repeat(i,M){
    int L,R,D;cin>>L>>R>>D;L--;R--;
    if(UF.same(L,R)){
      isok &= UF.diff(R,L)==D;
    }
    UF.unionSet(R,L,D);
  }
  //debug(UF.diff(2,0));
  cout<<(isok?"Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int a,b; cin>>a>>b; cout<<max(a+b,max(a-b,a*b))<<endl;
}

Measured memory_bytes: 256
t,x,y,z=0,0,0,0
while True:
    try:
        a=sorted(list(map(int,input().split())))
        if a[0]+a[1] > a[2]:
            t+=1
            if a[0]**2 + a[1]**2 == a[2]**2:
                x+=1
            elif a[0]**2 + a[1]**2 > a[2]**2:
                y+=1
            else:
                z+=1
        else:
            print( t, x, y, z )
            quit()
    except ValueError:
        break
print( t, x, y, z )


Measured memory_bytes: 5604
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO 自動生成されたメソッド・スタブ

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] V = new int[N];
        int[] C = new int[N];
        int[] difference = new int[N];

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

            V[i] = sc.nextInt();
        }

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

            C[i] = sc.nextInt();
        }

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

            difference[i] = V[i]-C[i];
        }

        int max = 0;

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

            if( difference[i] > 0 ) {

                max += difference[i];
            }
        }

        System.out.println(max);

        sc.close();
    }
}

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

int main() {
    string s;
    cin >> s;
    if (s == "Sunny") {
        cout << "Cloudy";
    } else if (s == "Cloudy") {
        cout << "Rainy";
    } else {
        cout << "Sunny";
    }
}

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

using namespace std;

int main() {
    string s;
    cin >> s;
    vector<char> A(26);
    A = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    bool check;
    bool kekka = 0;
    char ans;
    for (size_t i = 0; i < 26; i++)
    {
        check = 1;
        for (size_t j = 0; j < s.size(); j++)
        {
            if (A.at(i) == s.at(j))
            {
                check = 0;
                break;
            }
            
        }
        if (check)
        {
            kekka = 1;
            ans = A.at(i);
            break;

            /* code */
        }
        
        
    }

    if(kekka) {
        cout << ans << endl;
    } else {
        cout << "None" << endl;
    }
    

    

    return 0;
}

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

using namespace std;

const int N = (int) 1e5 + 7;
int n, sum[N];
pair<int, int> pmin[N];
string s;

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

  cin >> s;
  n = (int) s.size();
  for (int ch = 0; ch < 26; ch++) {
    for (int i = 1; i <= n; i++) {
      if (s[i - 1] - 'a' == ch) {
        sum[i] = sum[i - 1] + 1;
      } else {
        sum[i] = sum[i - 1] - 1;
      }
      pmin[i] = min(pmin[i - 1], {sum[i], i});
    }
    for (int i = 2; i <= n; i++) {
      if (sum[i] - pmin[i - 2].first > 0) {
        cout << pmin[i - 2].second + 1 << " " << i << "\n";
        return 0;
      }
    }
  }
  cout << "-1 -1\n";
}


Measured memory_bytes: 1616
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef long double lld;

const ll mod = 1000000007;

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

	string s; int d; cin >> s >> d;
	int k = s.length();

	vector<vector<vector<ll>>> dp(k + 1, vector<vector<ll>>(10, vector<ll>(d, 0)));

	for(int i = 0; i < 10; i++) {
		dp[0][i][i % d]++;
	}

	for(int i = 1; i <= k; i++) {
		for(int j = 0; j < 10; j++) {
			if(j == 0) {
				for(int x = 0; x < d; x++) {
					for(int y = 0; y < 10; y++) {
						dp[i][j][x] += dp[i - 1][y][x];
						dp[i][j][x] %= mod;
					}
				}
				continue;
			}
			for(int x = 0; x < d; x++) {
				dp[i][j][(x + 1) % d] += dp[i][j - 1][x];
			}
		}
	}

	ll ans = 0; int dsum = 0;
	for(int i = 0; i < k; i++) {
		int digit = s[i] - '0';
		for(int j = 0; j < digit; j++) {
			ans = ans + dp[k - 1 - i][j][(d - dsum) % d];
			ans = ans % mod;
		}
		dsum = (dsum + digit) % d;
	}
	ans = ans + (dsum % d == 0 ? 0: mod - 1);
	cout << ans % mod << endl;
}

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

int main()
{
    int n,k,ans=0;
    cin>>n;
    for(int i=0;i<=n/7;i++)
    {
        for(int j=0;j<=n/4;j++)
        {
            if(7*i+4*j==n) ans=1;
        }
    }
    if(ans==1) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

ll n;
ll ans = 0;

void check(ll m) {
    string s = to_string(m);
    ll cnt3 = 0, cnt5 = 0, cnt7 = 0;
    rep(i, s.size()) {
        if(s[i] == '3') {
            cnt3 = 1;
        }
        else if(s[i] == '5') {
            cnt5 = 1;
        }
        else if(s[i] == '7') {
            cnt7 = 1;
        }
    }
    if(cnt3 + cnt5 + cnt7 == 3) {
        ans++;
    }
}

void dfs(ll depth, ll x) {
    if(n < x) {
        return;
    }
    check(x);
    dfs(depth+1, 10*x+3);
    dfs(depth+1, 10*x+5);
    dfs(depth+1, 10*x+7);
}

int main() {

    cin >> n;

    dfs(0, 0);

    out(ans);
    re0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    vector<int>A(3);
    REP(i,3)cin>>A[i];
    sort(A.rbegin(),A.rend());
    cout<<A[0]*10+A[1]+A[2]<<endl;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Text;
using static Scanner;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Solve();
        Console.Out.Flush();
    }
    static void Solve() {
        string N = (ScanInt() - 1).ToString(), B = Scan();
        Console.WriteLine(Dp(B) - Dp(N));
    }
    static int Dp(string S) {
        if (S == "9999") S = "10000";
        var digits = S.Length;
        var dp = new int[digits + 1, 2];
        dp[0, 0] = 1;
        for (int d = 0; d < digits; d++) {
            var cur = S[d] - '0';
            for (int s = 0; s <= 1; s++) {
                for (var n = 0; n <= (s == 1 ? 9 : cur); n++) {
                    var isSmall = s == 1 || n < cur ? 1 : 0;
                    var a = d == 3 && n == S[1] - '0';
                    var b = d == 4 && n == S[0] - '0';
                    if (d >= 3 && !a && !b) continue;
                    dp[d + 1, isSmall] += dp[d, s];
                }
            }
        }
        return dp[digits, 0] + dp[digits, 1];
    }
}

public static class Scanner
{
    static readonly Stream stream = Console.OpenStandardInput();
    static readonly byte[] buffer = new byte[1024];
    static int length, p;
    static bool isEof;
    private static byte ConsoleIn() {
        if (isEof) return 0;
        if (p < length) return buffer[p++];
        p = 0;
        if ((length = stream.Read(buffer, 0, 1024)) > 0) return buffer[p++];
        isEof = true;
        return 0;
    }
    public static char GetChar() {
        var by = ConsoleIn();
        while ((by < '!' || '~' < by) && !isEof) by = ConsoleIn();
        return (char) by;
    }
    public static string Scan() {
        var sb = new StringBuilder();
        for (var ch = GetChar(); '!' <= ch && ch <= '~'; ch = (char) ConsoleIn()) {
            sb.Append(ch);
        }
        return sb.ToString();
    }
    public static int ScanInt() {
        var temp = 0;
        for (var ch = GetChar(); '0' <= ch && ch <= '9'; ch = (char) ConsoleIn()) {
            temp = temp * 10 + ch - '0';
        }
        return temp;
    }
}

Measured memory_bytes: 23736
def find_pattern(s, p):

    l = len(s)
    res = "No"

    for i in range(l):
        if i == 0:
            new_s = s[i:l]
        else:
            new_s = s[i:l] + s[0:i]

        #print(new_s)

        if p in new_s:
            res = "Yes"

    print(res)

if __name__ == "__main__":

    s = input()
    p = input()

    find_pattern(s, p)



Measured memory_bytes: 5564
// AOJ 2306 Rabbit Party
// 2018.4.8 bal4u

#include <stdio.h>

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int n;
int rel[102][102];
int hi[102];
int id[102];
int ans;

void calc(int v, int d)
{
	int i, j, t, c, max, sum;

	id[d] = v;
	max = 14, sum = 0;
	for (i = 0; i <= d; i++) {
		if (hi[id[i]] < max) max = hi[id[i]];
		if (!d) break;
		c = 1000000;
		for (j = 0; j <= d; j++) if (i != j) {
			if ((t=rel[id[i]][id[j]]) < c) c = t;
		}
		sum += c;
	}
	if (d && sum > ans) ans = sum;
	if (d == max) return;
	for (i = v+1; i < n; i++) {
		if (hi[i] <= d) continue;
		for (j = 0; ; j++) {
			if (j == d) { calc(i, d+1); break; }
			if (!rel[i][id[j]]) break;
		}
	}
}

int main()
{
	int m, i, u, v;

	n = in(), m = in();
	while (m--) {
		u = in()-1, v = in()-1;
		hi[u]++, hi[v]++;
		rel[u][v] = rel[v][u] = in();
	}
	ans = 0;
	for (i = 0; i < n; i++) calc(i, 0);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2136
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int n,m;
vector<pair<int,int> >G1[100010],G2[100010];
int s,t;
bool vis[100010];
long long ds[100010],dt[100010];
long long alld[100010];
set<pair<long long,int> >st;
void dijkstra(int S,long long dis[],vector<pair<int,int> >G[])
{
	for(int i=1;i<=n;i++)dis[i]=1e18;
	memset(vis,false,sizeof(vis));
	priority_queue<pair<long long,int>, vector<pair<long long,int> > ,greater<pair<long long,int> > >q;
	dis[S]=0LL;
	q.push(make_pair(0,S));
	for(int i=1;i<=n;i++)
	{
		while(!q.empty() && (vis[q.top().second] || dis[q.top().second]!=q.top().first))q.pop();
		int x=q.top().second;
		q.pop();
		vis[x]=true;
		for(int j=0;j<G[x].size();j++)
		{
			int y=G[x][j].first;
			if(vis[y] || dis[x]+G[x][j].second>=dis[y])continue;
			dis[y]=dis[x]+G[x][j].second;
			q.push(make_pair(dis[y],y)); 
		}
	}
}
int main()
{
	scanf("%d%d%d%d",&n,&m,&s,&t);
	for(int i=1;i<=m;i++)
	{
		int u,v,a,b;
		scanf("%d%d%d%d",&u,&v,&a,&b);
		G1[u].push_back(make_pair(v,a));
		G1[v].push_back(make_pair(u,a));
		G2[u].push_back(make_pair(v,b));
		G2[v].push_back(make_pair(u,b));
	}
	dijkstra(s,ds,G1);
	dijkstra(t,dt,G2);
	for(int i=1;i<=n;i++)alld[i]=ds[i]+dt[i],st.insert(make_pair(alld[i],i));
	for(int i=0;i<n;i++)
	{
		printf("%lld\n",1000000000000000LL-(*st.begin()).first);
		st.erase(st.find(make_pair(alld[i+1],i+1)));
	}
	return 0;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

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

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;

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

int main(){
    int N, T; cin >> N >> T;
    vi A(N), B(N);
    for(int i=0; i<N; i++){
        cin >> A[i] >> B[i];
    }
    vi ids(N);
    for(int i=0; i<N; i++) ids[i]=i;
    sort(all(ids), [&](int i, int j){return A[i] < A[j];});
    ll res=0;
    vector<vector<ll>> dp(N+1, vector<ll>(T+4000, 0));
    for(int i=0; i<N; i++){
        for(int j=0; j<(T+4000); j++){
            if(j-A[ids[i]] >= 0 && j-A[ids[i]] <= T-1){
                chmax(dp[i+1][j], dp[i][j-A[ids[i]]]+B[ids[i]]);
            }
            chmax(dp[i+1][j], dp[i][j]);
            chmax(res, dp[i+1][j]);
        }
    }
    cout << res << endl;
    return 0;
}

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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
typedef struct {
	vector <int> to;
	bool visited;
} node;

int main( void ){
	// initialize();
	int N, M;
	cin >> N >> M;
	vector <vector<int>> G( N );
	vector <int> dir( N-1, -1 );
	rep( i, 0, M ){	// グラフ定義, 0オリジン
		int a, b; cin >> a >> b;
		a--; b--;
		G[ a ].push_back( b );
		G[ b ].push_back( a );
	}

	queue <int> que;
	que.push( 0 );
	while(!que.empty()){	// BFS
		int q = que.front(); que.pop();
		for(auto to:G[ q ]){	// つながってる部屋毎に
			if (dir[to-1] != -1)
				continue;
			dir[ to-1 ] = q+1;
			que.push( to );
		}
	}
	bool can = true;
	for(auto d:dir){	// 到達してない部屋確認
		if (d == -1){
			can = false;
			break;
		}
	}
	if(!can)
		cout << "No\n";
	else {
		cout << "Yes\n";
		for(auto d:dir)
			printf("%d\n", d);

	}
}


Measured memory_bytes: 10348
#include<cstdio>
#include<iostream>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;

const int less_months[] = {4,6,9,11};
const string bar[10] = {"1110111", "0010010", "1011101", "1011011", "0111010",
			"1101011", "1101111", "1010010", "1111111", "1111011"};

inline bool is_uruu(int y){
  if(y%400==0)return true;
  if(y%100==0)return false;
  if(y%4==0)return true;
  return false;
}

inline int count(int x, int len, int pos, vector<int> &v){
  int res = 0;
  while(len--){
    pos--;
    for(int i=0;i<7;i++){
      if(bar[x%10][i] == '1' && v[pos*7+i] == 1)res++;
    }
    x /= 10;
  }
  return res;
}

int main(){
  int n;
  scanf("%d",&n);
  int k;
  scanf("%d",&k);
  vector<int> v(14*7,1);
  for(int i=0;i<k;i++){
    int a,b;
    scanf("%d%d",&a, &b);
    v[a*7+b] = 0;
  }

  ll ymd[110] = {}, hms[110] = {};
  for(int y=0;y<=9999;y++){
    int Y = count(y,4,4,v);

    for(int m=1;m<=12;m++){
      int M = count(m,2,6,v);

      int lim_d = 31;
      for(int i=0;i<4;i++){
	if(less_months[i]==m)lim_d = 30;
      }
      if(m==2){
	if(is_uruu(y))lim_d = 29;
	else lim_d = 28;
      }

      for(int d=1;d<=lim_d;d++){
	int D = count(d,2,8,v);
	ymd[Y+M+D]++;
      }
    }
  }

  for(int h=0;h<24;h++){
    int H = count(h,2,10,v);
    for(int m=0;m<60;m++){
      int M = count(m,2,12,v);
      for(int s=0;s<60;s++){
	int S = count(s,2,14,v);
	hms[H+M+S]++;
      }
    }
  }

  ll ans = 0;
  for(int i=0;i<=n;i++){
    ans += ymd[i] * hms[n-i];
  }
  printf("%lld\n",ans);
}

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

#define VMAX 10000

void counting_sort(int A[], int B[], int C[], int k, int n) {
    // init C (counter) array
    for (int i = 0; i <= k; i++) {
        C[i] = 0;
    }

    // count the number of A[j] into C
    for (int j = 1; j <= n; j++) {
        C[A[j]]++;
    }

    // set the number which is equal to or smaller than C[i] into C[i]
    for (int i = 1; i <= k; i++) {
        C[i] = C[i] + C[i-1];
    }

    for (int j = n; j > 0; j--) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }
}

int main() {
    int n, C[VMAX+1];
    cin >> n;

    int *A, *B;
    A = (int*)malloc(sizeof(int) * n + 1);
    B = (int*)malloc(sizeof(int) * n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> A[i];
    }

    counting_sort(A, B, C, VMAX, n);

    for (int i = 1; i <= n; i++) {
        if (i-1) cout << " ";
        cout << B[i];
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 18764
#include <iostream>

int abs(int a)
{
  return (a > 0) ? a : -a;
}

int main()
{
	
  int n, k;
  std::cin >> n >> k;
  
  int a[n], dp[n];
  for ( int i = 0; i < n; i++ )
    std::cin >> a[i];

  dp[0] = 0;
  
  for ( int i = 1; i < n; i++ )
  {
    dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
    for ( int j = 2; j <= k; j++ )
    {
      if (i >= j)
        dp[i] = std::min(dp[i], dp[i - j] + abs(a[i - j] - a[i]));
    }
  }
  std::cout << dp[n - 1] << std::endl;
  return 0;
}

Measured memory_bytes: 1024
module Main (main) where

import qualified Data.ByteString.Char8     as C8
import           Data.Maybe

main :: IO ()
main = do
  [m] <- readInts
  print . showAnswer $ solve m

type Input  = (Int)
type Output = Int

solve :: Input -> Output
solve m = 48-m

showAnswer :: Output -> Answer
showAnswer = Number

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | Compare Ordering
  | Compare2 Ordering

instance Show Answer where
  show (YesNo b)   = if b then "Yes" else "No"
  show (YESNO b)   = if b then "YES" else "NO"
  show (AB b)      = if b then "A"   else "B"
  show (Number i)  = show i
  show (Compare o)
    | o == EQ = "="
    | o == LT = "<"
    | o == GT = ">"
  show (Compare2 o)
    | o == EQ = "Balanced"
    | o == LT = "Right"
    | o == GT = "Left"

Measured memory_bytes: 508
#include<stdio.h>

int main(){
    int a,b,c,x;
    scanf("%d %d %d", &a,&b,&c);

    if (b < a) {
      x = a;
      a = b;
      b = x;
    } 
    if (c < b) {
      x = b;
      b = c;
      c = x;
    }
    if (b < a) {
      x = a;
      a = b;
      b = x;
	}
    
    printf("%d %d %d\n",a,b,c);
	
    return 0;
}


Measured memory_bytes: 2048
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;

ll popcount(ll num){
    num = num - ((num >> 1) & 0x55555555);
    num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
    return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

vector<pair<ll,ll>> factor_arr;

void myfactor(ll num){ 
    ll count = 0;   
    while (!(num % 2)) { 
        num >>= 1; count++; 
    }  
    if (count) factor_arr.push_back({2,count}); 
    for (auto i = 3; i <= sqrt(num); i += 2) { 
        count = 0; 
        while (num % i == 0) { 
            count++; 
            num /= i; 
        } 
        if (count) factor_arr.push_back({i,count}); 
    } 
    if (num > 2) factor_arr.push_back({num,1});
}

void virus(){
        ll len;
        cin>>len;
        vector<ll> arr(len);
        for(auto &i:arr) cin>>i;
        sort(arr.begin(),arr.end());
        ll ans = 0;
        for(auto i=len-1; i>=0; i--){
            for(auto j=i-1; j>=0; j--){
                ll tot = lower_bound(arr.begin(),arr.end(),arr[i]+arr[j]) - arr.begin();
                ans += (len - 1 - i) - (len - tot);
            }
        }
        cout<<ans;
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t=1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
         //cout << "Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 3588
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, k = sc.nextInt
  var snk = (1 to n).toSet

  for (_ <- 1 to k) {
    snk = snk -- Set.fill(sc.nextInt)(sc.nextInt)
  }

  println(snk.size)
}


Measured memory_bytes: 58580
N,R = map(int,input().split(" "))

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

x10 = N
x2 = Base_10_to_n(x10, R)
print(len(x2))

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.Arrays;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String words[] = new String[100];
		int pages[][] = new int[100][100];
		int last = 0;
		int pagesLast[] = new int[100];
		
		while (true)
		{
			String str;
			int n;
			try
			{
				str = sc.next();
				n = sc.nextInt();
			}
			catch (Exception e)
			{
				break;
			}
			boolean sameWords = true;
			for (int i = 0; i < last; i++)
			{
				if ((str + " " + i).equals(words[i]))
				{
					pages[i][pagesLast[i]] = n;
					pagesLast[i]++;
					sameWords = false;
					break;
				}
			}
			if (sameWords)
			{
				words[last] = str + " " + last;
				pages[last][pagesLast[last]] = n;
				pagesLast[last]++; 
				last++;
			}
		}
		
		Arrays.sort(words, 0, last);
		for (int i = 0; i < last; i++)
		{
			String str[] = words[i].split(" ");
			
			System.out.println(str[0]);
			
			int num = Integer.parseInt(str[1]);
			Arrays.sort(pages[num], 0, pagesLast[num]);
			int j;
			for (j = 0; j < pagesLast[num] - 1; j++)
			{
				System.out.print(pages[num][j] + " ");
			}
			System.out.println(pages[num][j]);
		}
	}
}

Measured memory_bytes: 12000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


// ヒープソート(昇順) *****************

int A[100001], B[100001], tmp; // Bでソート(Aは従属) 必要に応じて要素数と型を変える
int length;                    // 要素数:sort()を呼び出す前に設定する


void swap(int i, int j) {
    int tmp;
    tmp  = A[i];
    A[i] = A[j];
    A[j] = tmp;
    tmp  = B[i];
    B[i] = B[j];
    B[j] = tmp;
}

void downheap(int k, int r) {
    int j, v, w;
    v = B[k];
    w = A[k];
    while (1) {
        j = 2 * k + 1;
        if (j > r) break;
        if (j != r) {
            if (B[j + 1] > B[j]) {
                j = j + 1;
            }
        }
        if (v >= B[j]) break;
        B[k] = B[j];
        A[k] = A[j];
        k = j;
    }
    B[k] = v;
    A[k] = w;
}

void sort() {
    int i;
    for (i = (length - 2) / 2; i >= 0; i--) {
        downheap(i, length - 1);
    }
    for (i = length - 1; i > 0; i--) {
        swap(0, i);
        downheap(0, i - 1);
    }
}

// ***************** ヒープソート(昇順) 


int main() {
  int N, result;
  int i;
  scanf ("%d", &N);
  
  for (i=0;i<N;i++) {
      scanf("%d", &B[i]);
      A[i] = i+1;
  }
  length = N;
  sort ();
  
  
  for (i=0;i<N;i++) {
      printf("%d ", A[i]);
  }
  return 0;
}




Measured memory_bytes: 1536
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    string s;
    cin >> s;
    
    int len = size(s);
    
    if (s[len - 1] == 's')
        cout << s + "es";
    else
        cout << s + "s";

    return 0;
}

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

int main(){
  int n,m;
  std::cin >> n>>m;
  std::vector<long> a(n);
  std::vector<pair<long,long>> b(m);
  for (int i = 0; i < n; i++) {
    /* code */
    std::cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    /* code */
    std::cin >> b[i].second>>b[i].first;
  }
  sort(a.begin(),a.end());
  sort(b.begin(), b.end());
  int scope=0;
  for (int i = m-1; i >=0 ; i--) {
    /* code */
    
    for (int j = 0; j < b[i].second; j++) {
      /* code */
      if(a[scope]<=b[i].first){
        a[scope]=b[i].first;
        scope++;
      }else{
         goto owari;
      }
    }
  }
owari:
  std::cout << accumulate(a.begin(),a.end(),0LL) << std::endl;
  
}

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

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

#define max_n 100

int N;

int main() {

	cin >> N;

	int ans = 0;

	for(int i=1;i<N;i++)
	{
		if (i >= N - i)break;
		ans++;
	}

	cout << ans << endl;
	
	

	return 0;	
}

Measured memory_bytes: 256
def sumofdegit(x):
  sum = 0
  while x > 0:
    sum += x % 10
    x //= 10
  return sum

n,a,b = map(int,input().split())
total = 0
for i in range(1, n+1):
  if a <= sumofdegit(i) <= b:
    total += i
print(total)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int dfs(int i,int s,int j);
int main(){
  int n,k;
  int ans=1;
  cin >> n >> k;
  for(int i=0;i<n;i++){
    if((ans*2)<(ans+k)){
      ans*=2;
    }
    else{
      ans+=k;
    }
  }
  cout << ans << endl;
  }


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

using namespace std;

int main()
{
    int symbol[6];
    for (int i = 0; i < 6; i++)
    {
        cin >> symbol[i];
    }
    string commands;
    cin >> commands;

    for (const char &c : commands)
    {
        if (c == 'N')
        {
            swap(symbol[0], symbol[1]);
            swap(symbol[1], symbol[5]);
            swap(symbol[5], symbol[4]);
        }
        if (c == 'S')
        {
            swap(symbol[5], symbol[4]);
            swap(symbol[1], symbol[5]);
            swap(symbol[0], symbol[1]);
        }
        if (c == 'W')
        {
            swap(symbol[0], symbol[2]);
            swap(symbol[2], symbol[5]);
            swap(symbol[5], symbol[3]);
        }
        if (c == 'E')
        {
            swap(symbol[5], symbol[3]);
            swap(symbol[2], symbol[5]);
            swap(symbol[0], symbol[2]);
        }
    }

    cout << symbol[0] << endl;
    return 0;
}


Measured memory_bytes: 3168