akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) {
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}
template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
template<typename T>
void read(T& val){
    cin >> val;
}
template<typename T>
void read(vector<T>& a){
    for(int i = 0; i < (int)a.size(); ++i){
      read(a[i]);
    }
}
template<typename Head, typename... Tail>
void read(Head& H, Tail&... T){
    read(H);
    read(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
#define vec vector
#define i64 long long
#define endl '\n'
#define sz(x) (x).size()
#define times(n) for(int i = 0; i < (n); ++i)
#define bits(x) __builtin_popcount(x)
 
int test_case_number = 1;

void print_case(){
    #ifdef LOCAL
    cout << "Case #" << test_case_number++ << ": ";
    #endif
}

void solve(){
    int n, x, t;
    cin >> n >> x >> t;
    int ans = (n + x - 1)/x;
    cout << ans * t << endl;
}
 
int main(){
    solve();
}

Measured memory_bytes: 3600
s = input()

while True:
    s = s[:-1]
    L = len(s)
    if L%2 != 0:
        continue

    ok = True
    for i in range(L//2):
        if s[i] != s[L//2+i]:
            ok = False
    if ok:
        break

print(len(s))


Measured memory_bytes: 2940
n, m = [int(x) for x in input().split()]
l_lst = []
r_lst = []
for _ in range(m):
    l, r = [int(x) for x in input().split()]
    l_lst.append(l)
    r_lst.append(r)

l_max = max(l_lst)
r_min = min(r_lst)

if l_max <= r_min:
    num = r_min - l_max + 1
else:
    num = 0
print(num)

Measured memory_bytes: 11008
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
long long p10[17];
int S(long long a){
	int ret=0;
	while(a){
		ret+=a%10;
		a/=10;
	}
	return ret;
}
int main(){
	long long a;
	scanf("%lld",&a);
	vector<long long>hb;
	p10[0]=1;
	for(int i=1;i<17;i++)p10[i]=p10[i-1]*10;
	for(int i=1;i<=15;i++){
		for(int j=0;j<9;j++){
			for(int k=0;k<10;k++){
				for(int l=0;l<10;l++){
					if(k&&i==1)continue;
					if(l&&i<3)continue;
					if(i>2)hb.push_back(p10[i]-1-j*p10[i-1]-k*p10[i-2]-l*p10[i-3]);
					else if(i>1)hb.push_back(p10[i]-1-j*p10[i-1]-k*p10[i-2]);
					else hb.push_back(p10[i]-1-j*p10[i-1]);
				}
			}
		}
	}
	std::sort(hb.begin(),hb.end());
	int cnt=0;
	for(int i=0;i<hb.size();i++){
		bool ok=true;
		for(int j=i+1;j<hb.size();j++){
			if(hb[i]*S(hb[j])>hb[j]*S(hb[i])){ok=false;break;}
		}
		if(ok){
			printf("%lld\n",hb[i]);
			cnt++;
			if(cnt==a)break;
		}
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    string s, t;
    cin >> s >> t;

    vector<set<int>> alpha(26);

    rep(i, s.size()){
        int id = s[i] - 'a';
        alpha[id].insert(i);
    }


    ll ans = 0;
    int itr = -1;
    rep(i, t.size()){
        int id = t[i] - 'a';
        if (alpha[id].empty()) {cout << -1 << endl; return 0;}
        auto new_itr = alpha[id].upper_bound(itr);
        if (new_itr == alpha[id].end()){
            itr = -1;
            itr = *alpha[id].upper_bound(itr);
            ans += s.size();
        } else {
            itr = *new_itr;
        }
    }
    ans += itr+1;

    cout << ans << endl;
}



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

int main(){
	int n, p[3];
	cin >> n;
	for(int i=0; i < n; i++) cin >> p[i];

	if(n == 2) p[2] = p[1];
	sort(p, p+3);

	for(int i=1; i < p[0]; i++){
		if(!(p[0] % i || p[1] % i || p[2] % i)) cout << i << endl;
	}
}

Measured memory_bytes: 1176
K=int(input())

if K<=10:
    print(K)
else:
    K=K-10
    lun=[n for n in range(1,10)]
    i=0

    for e in lun:

        a=e%10-1
        b=e%10
        c=e%10+1

        if a>=0:
            lun.append(10*e+a)
            i+=1
            if i>K:
                print(lun[-1])
                break

        lun.append(10*e+b)
        i+=1
        if i>K:
            print(lun[-1])
            break

        if c<10:
            lun.append(10*e+c)
            i+=1
            if i>K:
                print(lun[-1])
                break

Measured memory_bytes: 7320
//In the name of the Almighty

   #include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main( )
{

  optimize();
  int n; cin>>n;
  if (n==1) cout<<"0"<<endl;
  else cout<<"1"<<endl;

       return 0;
}


Measured memory_bytes: 3648
#include <iostream>
    using namespace std;
    int main() {
        int a;
        cin >> a;
     
        switch(a){
        case 3:
        case 5:
        case 7:
            cout << "YES" << endl;
            break;
        default:
            cout << "NO" << endl;
            break;
        }
        
        return 0;
    }

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


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define snd second
#define fst first
#define debug printf("--%d--\n",__LINE__)
#define ll long long int

int main(void){
	string s;
	cin >> s;
	int cnt = 0, ans = 0;
	for(int i=0;i<s.size();i++){
		if (s[i]=='S'){
			cnt++;
		}else{
			if (cnt>0) cnt--;
			else ans++;
		}
	}
	ans += cnt;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define N 2
using namespace std;
typedef long long ll;
bool used[N];
  
ll SumD(ll a,ll d,ll n){return (n*(2*a+(n-1)*d))/2;}
  
bool mark(ll n){
  bool res=1;
  for(ll i=1;i*i<=N;i++)res&=!used[i],used[i]=1;
  return res;
}
  
int main(){
  while(1){
    ll n,m,p[21];
    cin>>n>>m;
    if(!n&&!m)break;
    for(int i=0;i<m;i++)cin>>p[i];
    sort(p,p+m);
    
    ll sum=0,cnt=0;
    for(int i=0;i<m;i++){
      sum+=SumD(p[i],p[i],n/p[i]);
      cnt+=n/p[i];
      memset(used,0,sizeof(used));
      for(int j=0;j<i;j++){
    ll lcm=(p[i]/__gcd(p[i],p[j]))*p[j];
    if(!mark(lcm))continue;
    sum-=SumD(lcm,lcm,n/lcm);
    cnt-=(n/lcm);
      }
    }
    printf("%.8f\n",(1.0*SumD(1,1,n)-sum)/max(1LL,(n-cnt)));
  }
  return 0;
}

Measured memory_bytes: 3256
#include <stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int i,j;
  unsigned long long int cur,sum=0,mod=1000000007,ans=0;
  for (i=0;i<n;i++){
    scanf("%llu",&cur);
 	ans+=((cur%mod)*(sum))%mod;
    ans=ans%mod;
    sum+=cur%mod;
    sum=sum%mod;
  }
  printf("%llu\n",ans);
  return 0;
}

Measured memory_bytes: 1728
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();   
        long[] L = new long[N + 1];

        L[0] = 2;
        L[1] = 1;
        
        for(int i = 2; i <= N; i++){
            L[i] = L[i - 1] + L[i - 2];
        }
        System.out.println(L[N]);
    }   
}


Measured memory_bytes: 21712
#include <stdio.h>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
const int N=1e5+10;
int main(){
    int n;
    pi a[N];
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d%d",&a[i].F,&a[i].S);
    sort(a,a+n);
    for(int i=0;i<n;i++)printf("%d %d\n",a[i].F,a[i].S);
}


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

string s, t;

int main() {
	cin >> s >> t;
	for (int i=0; i<s.length(); i++) {
		if (s[i] != t[i]) {
			cout << "No\n";
			exit(0);
		}
	}
	cout << "Yes\n";
}

Measured memory_bytes: 3600
n, a, b, c = gets.split.map(&:to_i)

ans = []
i = true
j = false
n.times do 
    s = gets.chomp
    next if !i

    if s == "AB"
        if a == 0 && b == 0
            if j
                a = 1
                b = 1
                c = 0
                ans[-1] = ans[-1] == j[0] ? j[1] : j[0]
                ans << (ans[-1] == s[0] ? s[1] : s[0])
                j = false
            else
                i = false
            end
        elsif a == 1 && b == 1
            j = "AB"
            a += 1
            b -= 1
            ans << "A"
        else
            j = false
            if a > b
                a -= 1
                b += 1
                ans << "B"
            else
                a += 1
                b -= 1
                ans << "A"
            end
        end
    elsif s == "BC"
        if b == 0 && c == 0
            if j
                b = 1
                c = 1
                a = 0
                ans[-1] = ans[-1] == j[0] ? j[1] : j[0]
                ans << (ans[-1] == s[0] ? s[1] : s[0])
                j = false
            else
                i = false
            end
        elsif b == 1 && c == 1
            j = "BC"
            b += 1
            c -= 1
            ans << "B"
        else
            j = false
            if b > c
                b -= 1
                c += 1
                ans << "C"
            else
                b += 1
                c -= 1
                ans << "B"
            end
        end
    else
        if c == 0 && a == 0
            if j
                c = 1
                a = 1
                b = 0
                ans[-1] = ans[-1] == j[0] ? j[1] : j[0]
                ans << (ans[-1] == s[0] ? s[1] : s[0])
                j = false
            else
                i = false
            end
        elsif c == 1 && a == 1
            j = "AC"
            c += 1
            a -= 1
            ans << "C"
        else
            j = false
            if c > a
                c -= 1
                a += 1
                ans << "A"
            else
                c += 1
                a -= 1
                ans << "C"
            end
        end
    end
end

if i
    puts "Yes"
    puts ans
else
    puts "No"
end


Measured memory_bytes: 21264
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int ans = 0;
  for(int i = 0; i < (S.size()/2); i++){
    if(S.at(i) != S.at(S.size()-i-1)){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int N = sc.nextInt();
        
        int A[] = new int[N];
        for(int i = 0; i < N; ++i){
            A[i] = sc.nextInt();
        }
        int total = 0;
        for(int i = 0; i < N; ++i){
            total += A[i];
        }
        if(total >= H){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

using ll = long long;
const ll INF = 1001001001001001001;
ll f_sum[100005], l_sum[100005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;
    priority_queue<int, vector<int>, greater<int>> first;   // 前半部
    priority_queue<int> latter;     // 後半部
    vector<int> middle(n);          // 中間部
    for(int i = 0; i < n; ++i){
        int temp;
        cin >> temp;
        first.push(temp);
        f_sum[0] += temp;
    }
    for(int i = 0; i < n; ++i){
        cin >> middle[i];
    }
    for(int i = 0; i < n; ++i){
        int temp;
        cin >> temp;
        latter.push(temp);
        l_sum[n] += temp;
    }
    
    for(int i = 0; i < n; ++i){
        first.push(middle[i]);
        int temp = first.top();
        first.pop();
        f_sum[i+1] = f_sum[i] + middle[i] - temp;
    }
    for(int i = n-1; i >= 0; --i){
        latter.push(middle[i]);
        int temp = latter.top();
        latter.pop();
        l_sum[i] = l_sum[i+1] + middle[i] - temp;
    }
    
    ll ans = -INF;
    for(int i = 0; i <= n; ++i){
        ans = max(ans, f_sum[i] - l_sum[i]);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;
// 解説
int ans;
ll dist1[305][305], dist2[305][305];

int main(void) {
    int N, M;
    ll L;
    cin >> N >> M >> L;
    rep(i, 0, 305) rep(j, 0, 305) {
        dist1[i][j] = (ll)INF;
        dist2[i][j] = (ll)INF;
    }

    rep(i, 0, M) {
        int a, b;
        ll c;
         scanf("%d %d %lld", &a, &b, &c);
         dist1[a][b] = c;
         dist1[b][a] = c;
    }

    rep(k, 1, N+1) rep(i, 1, N+1) rep(j, 1, N+1) {
        dist1[i][j] = min(dist1[i][j], dist1[i][k]+dist1[k][j]);
    }

    rep(i, 1, N+1) rep(j, 1, N+1) {
        if (dist1[i][j]<=L) dist2[i][j] = 1;
    }

    rep(k, 1, N+1) rep(i, 1, N+1) rep(j, 1, N+1) {
        dist2[i][j] = min(dist2[i][j], dist2[i][k]+dist2[k][j]);
    }

    int Q;
    cin >> Q;
    rep(i, 0, Q) {
        int s, t;
        scanf("%d %d", &s, &t);
        printf("%lld\n", dist2[s][t] == (ll)INF ? -1 : dist2[s][t]-1);
    }
  
    return 0;
}



Measured memory_bytes: 5280
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}

map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
vector<vector<ll>> as;
vector<bool> visited;
ll ma = 0;
ll dfs(ll st) {
    ll ret = 1;
    visited[st] = true;
    REP(i, as[st].size()) {
        if (!visited[as[st][i]]) {
            ret += dfs(as[st][i]);
        }
    }
    return ret;
}
int main() {
    ll n, m;
    cin >> n >> m;
    as.resize(n);
    visited.resize(n);
    REP(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        as[a].push_back(b);
        as[b].push_back(a);
    }
    ll maa = 0;
    REP(i, n) { maa = max(maa, dfs(i)); }
    cout << maa << endl;
}

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

const int INF = 100000000;

int main(int argc, char const *argv[]) {
    int a, b;
    cin >> a >> b;

    int ans = INF;
    for (int i = 1; i <= 1250; i++) {
        if (int(i*0.08) == a && int(i*0.1) == b) {
            ans = min(ans, i);
        }
    }

    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653

vector<vector<vector<bool>>> reached(310,vector<vector<bool>>(310,vector<bool>(310,false)));
vector<vector<vector<double>>> dp(310,vector<vector<double>>(310,vector<double>(310,0.0)));
vector<int> a(3);

double f(int x, int y, int z, int n){
	if (reached[x][y][z]==true) return dp[x][y][z];
	reached[x][y][z] = true;
	dp[x][y][z] = (double)n/(x+y+z);
	if (x>0) dp[x][y][z] += (double)((double)x*f(x-1,y,z,n))/(x+y+z);
	if (y>0) dp[x][y][z] += (double)((double)y*f(x+1,y-1,z,n))/(x+y+z);
	if (z>0) dp[x][y][z] += (double)((double)z*f(x,y+1,z-1,n))/(x+y+z);
	return dp[x][y][z];
}

int main(){
	int n, k; cin >> n;
	for (int i=0;i<n;i++){
		cin >> k;
		a[k-1]++;
	}
	dp[1][0][0] = n;
	reached[1][0][0] = true;
	cout << fixed << setprecision(11);
	cout << f(a[0],a[1],a[2],n) << endl;
/*	for (int i=0;i<n;i++) for (int j=0;j<n;j++) for (int k=0;k<n;k++){
		cout << i << j << k << " " << dp[i][j][k] << endl;
	}*/
}

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

using namespace std;

#define lint long long
#define P pair<lint, lint>

int main(){
    int A, B;
    cin >> A >> B;
    int ans = 0;
    for(int i = A; i <= B; ++i){
        int tmp = i;
        int n[5];
        for(int j = 0; j < 5; ++j){
            n[j] = tmp % 10;
            tmp /= 10;
        }
        if(n[0] == n[4] && n[1] == n[3]){
            ans++;
        }
    }

    cout << ans << endl;
}

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

int main() {
    int r, c;
    cin >>r >>c;
    vector<int>S(c, 0);
    for (int i=0; i<r; i++) {
        int S0=0;
        for (int j=0; j<c; j++) {
            int a;
            cin >>a;
            S0 +=a;
            S.at(j) +=a;
            cout <<a <<' ';
        }
        cout <<S0 <<endl;
    }
    int S0=0;
    for (int j=0; j<c; j++) {
        cout <<S.at(j) <<' ';
        S0 +=S.at(j);
    }
    cout <<S0 <<endl;
    return 0;
}


Measured memory_bytes: 3116
if __name__ == '__main__':

    while True:
        key_in = input()
        data = key_in.split(' ')

        a = int(data[0])
        op = data[1]
        b = int(data[2])

        if op == '+':
            print('{0}'.format(a + b))
        if op == '-':
            print('{0}'.format(a - b))
        if op == '*':
            print('{0}'.format(a * b))
        if op == '/':
            print('{0}'.format(a // b))
        if op == '?':
            break

Measured memory_bytes: 7656
#include<iostream>
using namespace std;
int main()
{

   int n;
   cin>>n;
   long int a[n],st =0,d,i;
   for(i=0;i<n;i++)
    cin>>a[i];
   for(i=1;i<n;i++)
   {
       d =a[i-1]-a[i];
       if(d>0)
        {
            st = st+d;
            a[i]=a[i]+d;
        }


   }
   cout<<st;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define F first
#define S second
int const M=2e5+10,M2=1e6+10,M3=5e3+10,inf=1e9+10,mod=1e9+7;
int a[M];
int tmp[M];
void check(int i,int j,int k)
{
	tmp[0]=i,tmp[1]=j,tmp[2]=k;
	int ans=a[0];
	for(int l=0;l<3;l++)
	{
		if(tmp[l]==0)
			ans-=a[l+1];
		else
			ans+=a[l+1];
	}
	if(ans==7)
	{
		cout<<a[0];
		for(int l=0;l<3;l++){
			if(tmp[l]==0)
				cout<<"-";
			else
				cout<<"+";
			cout<<a[l+1];
		}
		cout<<"=";
		cout<<"7";
		exit(0);
	}	
}
main()
{
	string x;
	cin>>x;
	for(int i=0;i<x.size();i++)
		a[i]=x[i]-'0';
	for(int i=0;i<=1;i++)
		for(int j=0;j<=1;j++)
			for(int k=0;k<=1;k++)
				check(i,j,k);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#define graph_from1 true
#define graph_tree true
#define graph_weight false
#define mod 1000000007
typedef long long ll;
using namespace std;

class Graph_func
{
public:
	int N;
	int N_edge;
	int K;
	int paintini;
	ll ans;
	vector<pair<int, int> > edgelist;
	vector<int> edgeweight;
	vector<vector<int> > adjlist;
	vector<vector<int> > adjlistweight;
	vector<int> adjnum;

	vector<int> xdist;

	vector<bool> x_fixed;

	void read_edge();
	void adjini();
	ll paint(int n, int n_old);

	bool xydist_def = false;
};

void Graph_func::read_edge()
{
	cin >> N >> K;
	if (graph_tree)
		N_edge = N - 1;// graph
	else
		cin >> N_edge;
	edgelist.resize(N_edge);
	edgeweight.resize(N_edge);
	adjnum.resize(N);
	xdist.resize(N);
	adjlist.resize(N);
	if (graph_weight)
		adjlistweight.resize(N);
	//cout << N << " " << N_edge << endl;
	for (int i = 0; i < N_edge; i++)
	{
		if (graph_weight)
			cin >> edgelist[i].first >> edgelist[i].second >> edgeweight[i];
		else
			cin >> edgelist[i].first >> edgelist[i].second;
		if (graph_from1)
		{
			edgelist[i].first--;
			edgelist[i].second--;
		}
	}
	return;
}

void Graph_func::adjini()
{
	for (int i = 0; i < N; i++)
		adjnum[i] = 0;
	for (int i = 0; i < N_edge; i++)
	{
		int x = edgelist[i].first;
		int y = edgelist[i].second;
		int xyweight = edgeweight[i];
		adjlist[x].push_back(y);
		adjlist[y].push_back(x);
		if (graph_weight)
		{
			adjlistweight[x].push_back(xyweight);
			adjlistweight[y].push_back(xyweight);
		}
		adjnum[x]++;
		adjnum[y]++;
	}
	return;
}


ll Graph_func::paint(int n, int n_old) // included adjini()
{
	int Nsum = adjnum[n];
	int count = 0;
	for (int i = 0; i < Nsum; i++)
	{
		int n_new = adjlist[n][i];
		if (n_new != n_old)
		{
			int paintN = K - 2 - count;
			if (n == paintini)
				paintN++;
			paintN = max(0, paintN);
			paintN %= mod;
			ans *= paintN;
			ans %= mod;
			count++;
			paint(n_new, n);
		}
	}
}

int main(void)
{
	Graph_func graph;
	graph.read_edge();
	graph.adjini();
	graph.ans = graph.K;
	int Nsta, Nstamax = 0;
	for (int i = 0; i < graph.N; i++)
	{
		if (Nstamax < graph.adjnum[i])
		{
			Nsta = i;
			Nstamax = graph.adjnum[i];
		}
	}
	graph.paintini = Nsta;
	graph.paint(Nsta, mod);
	cout << graph.ans << endl;

	return 0;
}

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

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}

int main(void){

  int n;
  scanf("%d\n", &n);
  char s[n][11];
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
  }

  qsort(s, n, sizeof(s[0]), cmp_s);

  int count_list[n];
	count_list[0] = 1;
	int max = 1;
	for (int i = 1; i < n; i++) {
		if (strcmp(s[i],s[i-1]) == 0) {
			count_list[i] = count_list[i-1]+1;
			if (count_list[i] > max) {
				max = count_list[i];
			}
		} else {
			count_list[i] = 1;
		}
	}
	for (int i = 0; i < n; i++) {
		if (count_list[i] == max) {
			printf("%s\n", s[i]);
		}
	}

  return 0;
}

Measured memory_bytes: 4808
n,m = gets.chomp.split.map(&:to_i)
even_number = (1..(n * 2)).select{|i| i.even?}
odd_number = (1..((m * 2) - 1)).select{|i| i.odd?}

puts ((even_number.combination(2).to_a.length) + (odd_number.combination(2).to_a.length))

Measured memory_bytes: 2172
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

int main() {
	int n, k, s;
	cin >> n >> k >> s;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		if (i < k)
			v.push_back(s);
		else if (s == (int)pow(10, 9))
			v.push_back(1);
		else
			v.push_back(s + 1);
	}
	for (int i = 0; i < n; i++) {
		cout << v[i];
		if (i == n - 1)
			cout << endl;
		else
			cout << " ";
	}
}

Measured memory_bytes: 1784
S = input()
if S == 'abc':
    print('Yes')
elif S == 'acb':
    print('Yes')
elif S == 'acb':
    print('Yes')
elif S == 'bac':
    print('Yes')
elif S == 'bca':
    print('Yes')
elif S == 'cab':
    print('Yes')
elif S == 'cba':
    print('Yes')
else:
    print('No')

Measured memory_bytes: 8904
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author RiaD
 */

#include <iostream>
#include <fstream>

#include <iostream>
//#define PROBLEM "problem_name.h"
//#include PROBLEM
//#include <message.h>
//#include <spcppl/dgcj.h>

using namespace std;

class TaskB {
public:
	void solve(std::istream& in, std::ostream& out) {
		int64_t n, a, b, c, d;
		in >> n >> a >> b >> c >> d;
		n -= 1;
		for (int64_t i = 0; i <= n; ++i) {
			int64_t j = n - i;
			int64_t mn = a + i * c - j * d;
			int64_t mx = a + i * d - j * c;
			if (b >= mn && b <= mx) {
				//cerr << i << ' ' << mn << ' ' << mx << endl;
				out << "YES\n";
				return;
			}
		}
		out << "NO\n";
	}
};


int main() {
	std::ios_base::sync_with_stdio(false);
	TaskB solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
	out << std::fixed;
	out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	for(int n, p; cin >> n >> p, n || p;) {
		vector<int> v(n, 0);

		int player = 0;
		int win;
		while(true) {
			if(p == 0) {
				p += v[player];
				v[player] = 0;
			} else {
				p--;
				v[player]++;
				if(p == 0 && accumulate(all(v), 0) - v[player] == 0) {
					win = player;
					break;
				}
			}

			player++;
			player %= n;
		}
		cout << win << endl;
	}
	return 0;
}

Measured memory_bytes: 908
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_9_B
{
    public class Program

    {
        public static void Main(string[] args)
        {

            while (true)
            {
                string line = ReadSt();
                if (line.Equals("-")) return;

                int n = ReadInt();

                for (int i = 0 ; i < n ; i++)
                {
                    int x = ReadInt();
                    line = line.Substring(x, line.Length - x) + line.Substring(0, x);
                }
                Console.WriteLine(line);
            }

        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 15928
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <unordered_map>
#define fo(i,a,n) for(int i=a;i<n;i++)
#define ll long long
const ll MOD = 1000000007;
using namespace std;
int main()
{
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   ll arr[4];
   arr[0]=a*c;
   arr[1]=a*d;
   arr[2]=b*c;
   arr[3]=b*d;
   ll max=arr[0];
   for(int i=1;i<4;i++)
   if(arr[i]>max)
   max=arr[i];
   cout<<max;


}

Measured memory_bytes: 3676
#include<stdio.h>
 int dp[50];

int fibonacci( int n ){
  if ( n == 0 || n == 1)return dp[n] =1;
  if ( dp[n] != -1 )return dp[n];
  return dp[n] = fibonacci( n - 1 ) + fibonacci( n - 2 );//?????°
}

int main(){
  int n,i;
  for( i = 0 ; i <=44 ; i++)dp[i] = -1;

  scanf("%d",&n);
  printf("%d\n",fibonacci(n));

  return 0;
}

Measured memory_bytes: 596
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var inputs = ReadLongs();
            var A = inputs[0];
            var B = inputs[1];

            var coin = 0L;
            if (A > B)
            {
                coin += A;
                A--;
            }
            else
            {
                coin += B;
                B--;
            }

            if (A > B)
            {
                coin += A;
                A--;
            }
            else
            {
                coin += B;
                B--;
            }

            return coin;
        }

        #region Console

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a=sc.nextDouble(),b=sc.nextDouble(),c=sc.nextDouble();

		double h=b*Math.sin(Math.toRadians(c));
		double S=a*h/2;
		double l=Math.sqrt(a*a+b*b-2*a*b*Math.cos(Math.toRadians(c)))+a+b;
		System.out.printf("%f", S);
		System.out.println();
		System.out.printf("%f", l);
		System.out.println();
		System.out.printf("%f", h);


	}
}


Measured memory_bytes: 28364
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    int d,x;
    cin>>d>>x;
    REP(i,n){
        int t;
        cin>>t;
        x+=(d+t-1)/t;
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
    int N, K, ans;
    cin >> N >> K;
    std::vector<int> v(N);
    for(int i=0; i<N; i++)  cin >> v[i];
    std::sort(v.begin(),v.end());
    ans = 0;
    for(int i=0; i<K; i++)  ans += v[i];
    cout << ans;
}

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


string t1;
int main(){
	for(int i = 0 ; i < 26 ; i++) t1 += 'a'+i,t1 += 'A'+i;
	sort(t1.begin(),t1.end());
	rotate(t1.begin(),t1.begin()+26,t1.end());
	int n;
	while(cin >> n && n){
		vector<int> k(n);
		string s;
		for(int i = 0 ; i < n ; i++) cin >> k[i];
		cin >> s;
		for(int i = 0 ; i < s.size() ; i++){
			int p = k[i%n];
			int pos = t1.find(s[i]);
			int hoge = (pos - p) % 52 + 52;
			hoge %= 52;
			cout << t1[hoge];
		}
		cout << endl;
	}
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
#define int long long 
signed  main(){
  int a,b,c,d;
  int q,i;
  while(true){
    cin>>a>>b>>c>>d;
    if(a+b+c+d==0){
      break;
    }
    if(a/b>=c){
      cout<<"0\n";
    }
    else{
      i=1;
      while(1){
	if((i*d+a)/b>=c){
	  cout<<i<<"\n";
	  break;
	}
	i++;
      }
    }
  }
}



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

using namespace std;
bool isPrime (int x ) ;

int main()
{
    int x ;
    scanf ("%d",&x);
    while (1)
    {
                 if (isPrime(x))
                 {
                            printf ("%d",x);  break ;
                 }
                 x++;
    }
    return 0;
}
bool isPrime (int x )
{
             if (x==1) return false ;
             int i ;
             for (i=2 ; i<x ; i++)
             {
                          if (x%i==0)
                                       return false ;
             }
             return true ;
}


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

void convert(int x){
    if ( x == 0 ) return;
    convert(x/4); cout << x%4;
}

main(){
    int n;
    while( cin >> n && n >= 0 ) {
	if ( n == 0 ) cout << 0 << endl;
	else {
	    convert(n); cout << endl;
	}
    }
}

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

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

  vector<ll> A(N);
  rep(i, N) cin >> A[i];

  sort(A.begin(), A.end());

  vector<pair<ll, int>> V;
  ll last = A.front();
  ll count = 1;
  rep(i, N) {
    if (A[i] != last) {
      if (count >= 2)
        V.emplace_back(last, count);
      last = A[i];
      count = 1;
    } else {
      count++;
    }
  }
  if (count >= 2)
    V.emplace_back(last, count);

  sort(V.rbegin(), V.rend());

  if (V.size() == 0 || (V.size() == 1 && V.front().second < 4)) {
    cout << 0 << endl;
    return 0;
  }

  ll area = 0;

  ll e1 = V[0].first;
  if (V[0].second >= 4)
    area = max(area, e1 * e1);

  if (V.size() >= 2) {
    ll e2 = V[1].first;
    area = max(area, e1 * e2);
  }

  cout << area << endl;
}

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

#define N 0
#define INF 0x3f3f3f3f
#define LL long long
#define mz(x) ms(x,0)
#define ms(x,y) memset(x,y,sizeof(x))
#define mc(x,y) memcopy(x,y,sizeof(y))
#define MOD 1000000007

using namespace std ;

int p[200010], _rank[200010], sum[200010] ;

void make_set (int x)
{
	p[x] = x ;
	_rank[x] = 0 ;
	sum[x] = 1 ;
}

int find_set (int x)
{
	if (x != p[x])
		p[x] = find_set (p[x]) ;
	
	return p[x] ;
}

void link_set (int x, int y)
{
	if (x == y)
		return ;
	
	if (_rank[x] > _rank[y])
	{
		p[y] = x ;
		sum[x] += sum[y] ;
	}
	else
	{
		p[x] = y ;
		sum[y] += sum[x] ;
	}
		
	if (_rank[x] == _rank[y])
		_rank[y]++ ;
}

void union_set (int x, int y)
{
	link_set (find_set(x), find_set(y)) ;
}

int set_sum (int x)
{
	return sum[find_set(x)] ;
}

int main()
{
	int n, m ;
	scanf ("%d%d", &n, &m) ;
	
	for (int i=1; i<=n; i++)
		make_set (i) ;
	
	while (m--)
	{
		int x, y ;
		scanf ("%d%d", &x, &y) ;
		union_set (x, y) ;
	}
	
	int ans = 0 ;
	for (int i=1; i<=n; i++)
		ans = max (ans, set_sum(i)) ;
		
	cout << ans << endl ;

	return 0 ;
}

Measured memory_bytes: 5572
#include<iostream>

using namespace std;

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

int s[100][100], k[100], r[100];

int main() {
  int n;
  cin >> n;
  rep (i, n * (n - 1) / 2) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b;
    s[a][b] = c > d ? 3 : c == d ? 1 : 0;
    s[b][a] = d > c ? 3 : c == d ? 1 : 0;
  }
  rep (i, n) rep (j, n) k[i] += s[i][j];
  int t = 1;
  for (int i = 3 * n; i >= 0; --i) {
    int tt = 0;
    rep (j, n) if (k[j] == i) {
      ++tt;
      r[j] = t;
    }
    t += tt;
  }
  rep (i, n) cout << r[i] << endl;
}

Measured memory_bytes: 1204
import java.util.*;

class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if(x==2){
            System.out.println(x);
            return;
        }
        while(true){
            boolean isMod = true;
            for(int i=2;i<Math.sqrt(x);i++){
                if(x%i==0){
                    isMod = false;
                    break;
                }
                else{
                    isMod = true;
                }
            }
            if(isMod){
                System.out.println(x);
                return;
            }
            x++;
        }
        
    }
}


Measured memory_bytes: 23764
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
#include<math.h>

typedef int32_t i32;
typedef int64_t i64;

const i32 mod = 1000000007;

#define ADD(x, a) do{(x) += (a); if ((x) >= mod) (x) -= mod;} while (0)
#define SUB(x, a) do{(x) += mod - (a); if ((x) >= mod) (x) -= mod;} while (0)

i32 inv (i32 a) {
  i32 t = 1;
  while (a > 1) {
    t = (i64) t * (mod - mod / a) % mod;
    a = mod % a;
  }
  return t;
}

i32 mod_pow (i32 r, i32 n) {
  i32 t = 1;
  i32 s = r;
  while (n > 0) {
    if (n & 1) t = (i64) t * s % mod;
    s = (i64) s * s % mod;
    n >>= 1;
  }
  return t;
}

i32 *fact = NULL;
i32 *iFact = NULL;
void init_fact (const i32 n) {
  fact = (i32 *) calloc (n + 1, sizeof (i32));
  fact[0] = 1;
  for (i32 i = 1; i <= n; ++i) {
    fact[i] = (i64) i * fact[i - 1] % mod;
  }
  iFact = (i32 *) calloc (n + 1, sizeof (i32));
  iFact[n] = inv (fact[n]);
  for (i32 i = n - 1; i >= 0; --i) {
    iFact[i] = (i64) (i + 1) * iFact[i + 1] % mod;
  }
}

i32 perm (i32 n, i32 k) {
  if (!(0 <=k && k <= n)) return 0;
  return (i64) fact[n] * iFact[n - k] % mod;
}

i32 comb (i32 n, i32 k) {
  if (!(0 <= k && k <= n)) return 0;
  return (i64) fact[n] * iFact[k] % mod * iFact[n - k] % mod;
}

#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) > (0) ? (a) : -(a))

const i32 f = 10000000;

i64 func (i64 n) {
  i64 sum = 0;
  while (n > 0) {
    sum += n / mod;
    n /= mod;
  }
  return sum;
}

i32 calc_fact (i32 n) {
  i32 res = 1;
  while (n > 0) {
    res = (i64) res * n % mod;
    n--;
  }
  return res;
}

i32 calc_comb (i64 n, i64 k) {
  if (func (n) - func (k) - func (n - k) > 0) {
    return 0;
  }
  i32 nu = (i64) mod_pow (mod - 1, n / mod) * calc_fact (n % mod) % mod;
  i32 de = (i64) mod_pow (mod - 1, k / mod) * calc_fact (k % mod) % mod * mod_pow (mod - 1, (n - k) / mod) % mod * calc_fact ((n - k) % mod) % mod;
  return (i64) nu * inv (de) % mod;
}

void run (void) {
  i64 n, m, k;
  scanf ("%" SCNi64 "%" SCNi64 "%" SCNi64, &n, &m, &k);
  init_fact (n * m);
  i64 ans = 0;
  i32 c = calc_comb (n * m - 2, k - 2);
  for (i32 d = 1; d < m; ++d) {
    ans = (ans + (i64) c * d % mod * (m - d) % mod * n % mod * n) % mod;
  }
  for (i32 d = 1; d < n; ++d) {
    ans = (ans + (i64) c * d % mod * (n - d) % mod * m % mod * m) % mod;
  }
  printf ("%" PRIi64 "\n", ans);
}

void gen (void) {
  
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 1792
import java.util.*;
import java.lang.Math.*;
 
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    String str[] = new String[a];
    for(int i=0;i<b+2;i++){
      System.out.print("#");
    }
    
    System.out.println();
    
    for(int i=0;i<a;i++){
      str[i] = sc.next();
      System.out.println("#" + str[i] + "#");
    }
    
    for(int i=0;i<b+2;i++){
      System.out.print("#");
    }
    
    System.out.println();
    
  }
}

Measured memory_bytes: 22228
S = list(input())
cnt = 0
if S[0] == 'R':
    if S[1] == 'R':
        if S[2] == 'R':
            cnt = 3
        else:
            cnt = 2
    else:
        cnt = 1
else:
    if S[1] == 'R':
        if S[2] == 'R':
            cnt = 2
        else:
            cnt = 1
    else:
        if S[2] == 'R':
            cnt = 1
        else:
            cnt = 0
print(cnt)

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

int main(){
    double A, B, P, Q, R;
    cin >> A >> B >> P >> Q >> R;
    double ans = (Q*A + B*P + R*B) / (Q+R);
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}



Measured memory_bytes: 3288
#include <iostream>
#include <stdio.h>
#include <map>
#include <algorithm>
#include <string>

int main(void)
{
    int t;
    int pasta=10000, juice=10000;

    std::cin >> t;
    pasta = std::min(t,pasta);
    std::cin >> t;
    pasta = std::min(t,pasta);
    std::cin >> t;
    pasta = std::min(t,pasta);

    std::cin >> t;
    juice = std::min(t,juice);
    std::cin >> t;
    juice = std::min(t,juice);

    std::cout << (pasta+juice-50) << std::endl;

    return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>

int main(void)
{
int a[10000];
int n=0;
while(1){
	
	scanf("%d %d",&a[n],&a[n+1]);
	if(a[n]==0&&a[n+1]==0)break;

	n+=2;
}
int b=0;

while(b<n)
{

	if(a[b]<a[b+1])
	{
		printf("%d %d\n",a[b],a[b+1]);
	}
	else
	{
		printf("%d %d\n",a[b+1],a[b]);
	}
	b+=2;


}

return 0;

}

Measured memory_bytes: 620
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <tuple>

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
10 7
1 5 18
3 4 8
1 3 5
4 7 10
5 9 8
6 10 5
8 10 3
)");
#define cin input
#endif

const ll inf = (1ll << 62) - 1;

struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;
    vector<bool> lazyFlag;

public:
    LazySegmentTree(int sz) {
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, inf);
        lazyFlag.resize(2*n-1, false);

        for(int i=0; i<sz; i++) node[i+n-1] = inf;
        for(int i=n-2; i>=0; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }

    void lazyEvaluate(int k, int l, int r) {
        if(lazyFlag[k]) {
            node[k] = min(lazy[k], node[k]);
            if(r - l > 1) {
                lazy[k*2+1] = min(lazy[k], lazy[k*2+1]);
				lazy[k*2+2] = min(lazy[k], lazy[k*2+2]);
                lazyFlag[k*2+1] = lazyFlag[k*2+2] = true;
            }
            lazyFlag[k] = false;
        }
    }

    void update(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazyEvaluate(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] = min(x, lazy[k]);
            lazyFlag[k] = true;
            lazyEvaluate(k, l, r);
        }
        else {
            update(a, b, x, 2*k+1, l, (l+r)/2);
            update(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = min(node[2*k+1], node[2*k+2]), node[k];
        }
    }

    ll find(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazyEvaluate(k, l, r);
        if(b <= l || r <= a) return inf;
        if(a <= l && r <= b) return node[k];
        ll vl = find(a, b, 2*k+1, l, (l+r)/2);
        ll vr = find(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
    }
};

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

	multimap<int, pair<int, int>> e;

	LazySegmentTree st(n);

	REP (i, m)
	{
		int l, r, c;
		cin >> l >> r >> c;
		e.emplace(l - 1, make_pair(r - 1, c));
	}
	st.update(0, 1, 0);

	for (auto& i : e)
	{
		st.update(i.first, i.second.first + 1, st.find(i.first, i.second.first + 1) + i.second.second);
	}

	const auto res = st.find(n - 1, n);

	cout << (res == inf ? -1 : res) << endl;

	return 0;
}


Measured memory_bytes: 10496
#include <cstdio>
#include <iostream>
#include <bitset>
#include <queue>
#include <utility>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long ll;

#define ALL(obj) (obj).begin(), (obj).end() 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)

int main(){
    ll n;
    cin >> n;
    n++;
    ll keta=1,t=10;
    while(n > t){
        keta++;
        t *= 10;
    }
    t /= 10; 
    ll ans = (n / t) * t - 1;
    ll sol=0;
    while(t != 0){
        sol += ans / t;
        ans -= t * (ans / t);
        t /= 10;
    }
    cout << sol << endl;
    return 0;
}

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

using namespace std;

class Solution {
public:
	/* time: O(n), space: O(1) */
	int lower(const vector<int>& h) {
		const int n = h.size();
		int ans = 0, L = 0;
		for (int R = 0; R < n; ++R) {
			ans = max(ans, R - L);
			if (R < n - 1 && h[R] < h[R + 1])
				L = R + 1;
		}
		return ans;
	}
};

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

	vector<int> h(n);
	for (int i = 0; i < n; ++i)
		cin >> h[i];

	Solution sol;
	int ans = sol.lower(h);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640