akhauriyash/Code-Regression huggingface dataset:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    n, m = map(int, input().split())

    #output
    mod = pow(10, 9) + 7

    n_ = 5 * pow(10, 5) + 5
    fun = [1] * (n_+1)
    for i in range(1, n_+1):
        fun[i] = fun[i-1] * i % mod
    rev = [1] * (n_+1)
    rev[n_] = pow(fun[n_], mod-2, mod)
    for i in range(n_-1, 0, -1):
        rev[i] = rev[i+1] * (i+1) % mod
    def cmb(n,r):
        if n < 0 or r < 0 or r > n: return 0
        return fun[n] * rev[r] % mod * rev[n-r] % mod
    def perm(n, r):
        if n < 0 or r < 0 or r > n: return 0
        return fun[n] * rev[n-r] % mod

    #Aを1, 2, ..., nとする。
    #求める写像の総数をs(n, m)とする。
    #s(n, m) = sum(k=0, n)(cmb(n, k)* (-1)^k * cmb(m-k, n-k)*(n-k)!)

    import math
    answer = 0
    for i in range(n+1):
        temp = perm(n, i) * cmb(m, i) * pow(perm(m-i, n-i), 2)
        temp %= mod
        if i % 2 == 0:
            answer += temp
        else:
            answer -= temp
    print(answer % mod)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()


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

using namespace std;

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

	int n, k;
	cin >> n >> k;
	double ans = 0.0;
	for (int i = 1; i <= n; i++) {
		double cnt = 1.0;
		for (int j = i; j < k; j *= 2)
			cnt *= 0.5;
		ans += (1.0/n) * cnt;
	}
	cout.precision(10);
	cout << ans << endl;
    return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	VI a(n);
	rep(i, n) cin >>a[i];
	
	ll sm = accumulate(all(a), 0LL);
	VI dv;
	for(ll i=1; i*i <=sm; i++){
		if(sm % i ==0){
			dv.push_back(i);
			if(i*i != sm)dv.push_back(sm/i);
		}
	}
	sort(dv.rbegin(), dv.rend());

	for(auto cn: dv){
		VI b(n);
		ll sm = 0, sm2 =0;
		rep(i, n) b[i] = a[i]%cn;
		sort(all(b));
		rep(i, n) sm +=  (cn - b[i])%cn;
		if(sm <= k){ cout <<cn <<"\n"; return 0;}
		rep(i, n){
			sm  -= (cn - b[i])%cn;
			sm2 += b[i];
			if(max(sm, sm2) <= k){ cout <<cn <<"\n"; return 0;}
		}
	
	}
	
	
	return 0;
	
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

bingo_list = [[],[], []]
bingo_list[0] = list(map(int, input().split()))
bingo_list[1] = list(map(int, input().split()))
bingo_list[2] = list(map(int, input().split()))
n = int(input())
b_list = [int(input()) for i in range(n)]

selected_num_list = []

# 選ばれた数字とビンゴカードが一致するか調べる
for b in b_list:
    for i in range(3):
        for j in range(3):
            if b == bingo_list[i][j]:
                selected_num_list.append((i, j))

# ビンゴかどうか調べる
bingo_flag = False
for i in range(3):
    line_flag = False
    for j in range(3):
        if (i, j) in selected_num_list:
            line_flag = True
        else:
            line_flag = False
            break
    if line_flag == True:
        bingo_flag = True
        break

# 縦
for i in range(3):
    row_flag = False
    for j in range(3):
        if (j, i) in selected_num_list:
            row_flag = True
        else:
            row_flag = False
            break
    if row_flag == True:
        bingo_flag = True
        break

# 斜め
cross_flag = False
for i in range(3):
    for j in range(3):
        if i == j:
            if (i, j) in selected_num_list:
                cross_flag = True
            else:
                cross_flag = False
    if cross_flag == False:
        break


if cross_flag == True:
    bingo_flag = True

# 逆斜め
cross_flag = False
if (0, 2) in selected_num_list:
    if (1, 1) in selected_num_list:
        if (2, 0) in selected_num_list:
            bingo_flag = True


# 表示
if bingo_flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38384
H, W, K = map(int, input().split())
c = [list(input()) for _ in range(H)]
erabikata = 0
for i in range(2 ** H):
    if i == 0:
        continue
    ans_h = []
    for ii in range(H):
        if i >> ii & 1:
            ans_h.append(c[ii])
    if ans_h:
        ans_h = [list(x) for x in zip(*ans_h)]
    for j in range(2 ** W):
        ans_all = []
        count = 0
        if j == 0:
            continue
        for jj in range(W):
            if j >> jj & 1:
                ans_all.append(ans_h[jj])
        for v in sum(ans_all, []):
            if v == '#':
                count += 1
        if count == K:
            erabikata += 1
print(erabikata)


Measured memory_bytes: 9248
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using static System.Math;


class P
{
    static void Main()
    {
        long[] abc = Console.ReadLine().Split().Select(long.Parse).ToArray();
        Console.WriteLine(Min(abc[0] + abc[1] + 1, abc[2]) + abc[1]);
    }
}


Measured memory_bytes: 13396
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{

    class Program
    {
        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long A = input[0];
            long B = input[1];
            long K = input[2];

            if (K > A)
            {
                K -= A;
                A = 0;
            }
            else
            {
                A -= K;
                K = 0;
            }

            if(K != 0)
            {
                if(K > B)
                {
                    K -= B;
                    B = 0;
                }
                else
                {
                    B -= K;
                    K = 0;
                }
            }
       


            Console.WriteLine(A+" "+B);
        }
    }
}

Measured memory_bytes: 28184
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    a = list(map(int, input().split()))

    for ai in a:
        if ai % 2 == 0:
            if (ai % 3 == 0) or (ai % 5 == 0):
                pass
            else:
                print('DENIED')
                exit()

    print('APPROVED')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.*;
public class Main {
	public static void main(String...args) {
      	final Scanner sc = new Scanner(System.in);
      	final int N = sc.nextInt();
      	final int[] A = new int[N];
      	for(int i = 0; i < N; i++)
        	A[i] = sc.nextInt();
      	Arrays.sort(A);
      	long longer = 0;
      	for(int i = N - 1, p = -1; i >= 0; i--)
        	if(p == A[i]) {
            	if(longer > 0) {
                	System.out.println(longer * p);
                  	return;
                } else {
                	longer = p;
                  	p = -1;
                }
            } else
              	p = A[i];
      	System.out.println(0);
    }
}

Measured memory_bytes: 50800
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo (1LL<<63-1)
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define Matrix vector< vector < long long > >

using namespace std;

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

const long double Pi=acos(-1),e=2.718;
const int N=2e5+10,mod=1e9+7;

int main ()
{
    FASTIO
    ll s , w;
    cin >> s >> w;
    if(w>=s)
    {
        cout << "unsafe" << endl;
    }
    else{
        cout << "safe" << endl;
    }
    return 0;
}
/**

*/


Measured memory_bytes: 3652
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
    ll r, d, x; cin>>r>>d>>x;
    for(int i=1; i<=10; i++){
        x=r*x-d;
        cout<<x<<endl;
    }
    return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int> data(n);
  for(int i=0;i<n;i++)cin >>data[i];
  sort(data.begin(),data.end());
  int ans=1;
  for(int i=0;i<n;i++){
    if(data[i]<data[i+1])ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
/**
    * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0003
    * Is it a Right Triangle?
    */
  object Main {
    def main(args: Array[String]): Unit = {
      val N = io.StdIn.readInt()
      Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).take(N)
        .map(_.split(" +").map(_.toInt) match { case Array(a, b, c) => (a, b, c) })
        .map { case (a, b, c) => isRightTriangle(a, b, c) }
        .map(if (_) "YES" else "NO")
        .foreach(println)
    }

    def isRightTriangle(x: Int, y: Int, z: Int): Boolean = {
      val (a, b, c) = Seq(x, y, z).sorted match {
        case Seq(_a, _b, _c) => (_a, _b, _c)
      }
      math.pow(a.toDouble, 2) + math.pow(b.toDouble, 2) == math.pow(c.toDouble, 2)
    }

  }

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

int main(){
	int N;
	cin>>N;
	int K=0; int P=0;
	int a[100];

	for(int i=0;i<N;i++){
		cin>>K>>P;
		if(K%P==0)
			a[i]=P;
		else
			a[i]=K%P;
	}

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

Measured memory_bytes: 3096
S = input()
a = []
ls = ['A', 'C', 'G', 'T']
num = 0
for x in S:
    if x in ls:
        num += 1
        a.append(num)
    else:
        if num > 0:
            num = 0
if len(a) == 0:
    print(0)
else:
    print(max(a))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define MAXN 128*4
using namespace std;
int n,m;
vector<int>g[MAXN];
int a[MAXN][MAXN],b[MAXN][MAXN],us[MAXN][MAXN],used[MAXN],mt[MAXN];
void read()
{
    int i,j;
    cin>>n>>m;
    for(i=0; i<n; i++)
        for(j=0; j<m; j++)
            cin>>a[i][j];
}

bool try_kuhn (int v)
{
    if(used[v])  return false;
    used[v] = true;
    for (size_t i=0; i<g[v].size(); ++i)
    {
        int to = g[v][i];
        if (mt[to] == -1 || try_kuhn (mt[to]))
        {
            mt[to] = v;
            mt[v]=to;
            return true;
        }
    }
    return false;
}

void solve()
{
    int i,j,l;
    for(l=0; l<m; l++)
    {
        for(i=0; i<n; i++)g[i].clear();
        for(i=0; i<n; i++)
        {
            for(j=0; j<m; j++)
            {
                if(!us[i][j])
                {
                    g[i].push_back(a[i][j]/m-(a[i][j]%m==0)+n);
                    g[a[i][j]/m-(a[i][j]%m==0)+n].push_back(i);
                }
            }
        }

        memset(mt,-1,sizeof(mt));
        for (int v=0; v<n; ++v)
        {

            memset(used,0,sizeof(used));
            try_kuhn (v);
        }

        for (int i=0; i<n; ++i)
        {
            if (mt[i] != -1)
            {
                for(j=0; j<m; j++)
                {
                    if(a[i][j]/m-(a[i][j]%m==0)+n==mt[i]&&!us[i][j])
                    {
                        us[i][j]=true;
                        b[i][l]=a[i][j];
                        break;
                    }
                }
            }
        }
    }

    for(i=0; i<n; i++)
    {
        for(j=0; j<m; j++)
        {
            cout<<b[i][j]<<" ";
        }
        cout<<endl;
    }

    vector<int>h;
    for(j=0; j<m; j++)
    {
        h.clear();
        for(i=0; i<n; i++)
        {
            h.push_back(b[i][j]);
        }
        sort(h.begin(),h.end());
        for(i=0; i<n; i++)
        {
            b[i][j]=h[i];
        }
    }

    for(i=0; i<n; i++)
    {
        for(j=0; j<m; j++)
        {
            cout<<b[i][j]<<" ";
        }
        cout<<endl;
    }
}

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


Measured memory_bytes: 4096
a,b = input().split(" ")
a,b = int(a),int(b)
list = []
list2 = []
for i in range(a):
  list += input().split(" ")[1:]
list = [int(i) for i in list]
list2 = []
for i in range(b+1):
  if list.count(i) == a:
    list2.append(i)
print(len(list2))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int p[30];
  int cnt = 0;
  
  cin >> n;
  for(int i = 0;i < n;i++){
	cin >> p[i];
  }

  for(int i = 1;i < n - 1;i++){
	if(p[i - 1] > p[i] && p[i] > p[i + 1] || p[i - 1] < p[i] && p[i] < p[i + 1]){
	  cnt ++;
	}
  }

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



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        if(N*A>B){
            System.out.println(B);
        }else{
            System.out.println(N*A);
        }
    }
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<pair<int64_t, int64_t>> A(N);
  for (int i = 0; i < N; i++) {
    int64_t x, l;
    cin >> x >> l;
    A[i] = make_pair(x - l, x + l);
  }
  sort(A.begin(), A.end(),
       [](pair<int64_t, int64_t> a, pair<int64_t, int64_t> b) {
         return a.second < b.second;
       });
  int res = 0;
  int64_t cur = -(1LL << 50);
  for (int i = 0; i < N; i++) {
    if (cur <= A[i].first) {
      cur = A[i].second;
      res++;
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 1792
import collections

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

A_count = collections.Counter(A)
A_most = A_count.most_common()

ans = []
for a in A_most:
    if a[1] > 1:
        ans.append(a[0])
        if a[1] > 3:
            ans.append(a[0])

ans.sort()

print(ans[-1] * ans[-2] if len(ans) > 0 else 0) 

Measured memory_bytes: 21668
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

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

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;
}

template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {
	o << "{" << obj.first << ", " << obj.second << "}"; return o;
}

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}

int main() {
	int N; cin >> N;
	int M;
	FOR(i,1,N+1){
		if(N<=(i*(i+1))/2) {
			M = i;
			break;
		}
	}
	for(int i = M; 0 < i; --i){
		if (N >= i) {
			cout << i << endl;
			N -= i;
		}
	}


	
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int x,i,j,ans=1;
    cin>>x;
    for (i=2;i<=32;i++)
    {
        for (j=2;;j++)
        {
            if ((int)pow(i,j)>x)
                break;
            else
                ans=max(ans,(int)pow(i,j));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int t = 0;        
        while (input.hasNextInt()) {
            int x = input.nextInt();
            if (x == 0) break;
            else System.out.println("Case " + ++t + ": " + x);
        }
    }         
}

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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    vector<int> a(n+1);
    for(int i=0;i<n;++i)cin>>a[i];
    vector<ll> dp(n+1);
    dp[0] = 1000;
    for(int i=1;i<n;++i){
        dp[i] = dp[i-1];
        for(int j=0;j<i;++j){
            ll num = dp[j]/a[j];
            ll w = dp[j] + (a[i] - a[j])*num;
            dp[i] = max(dp[i],w);
        }
    }
    cout << dp[n-1] << endl;
    return 0;
    
}


Measured memory_bytes: 3656
// C - Not so Diverse

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

map<int, int> num_to_cnt;
vector<int> cnt;

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

	int A;
	for (int i=0; i<N; i++) {
		cin >> A;
		num_to_cnt[A]++;
	}

	for (auto itr : num_to_cnt) {
		cnt.push_back(itr.second);
	}

	sort(cnt.begin(), cnt.end(), greater<int>());

	int ans = 0;

	for (int i=0; i<cnt.size(); i++) {
		if (i >= K) ans += cnt[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 10748
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

inline auto kaijo (size_t n) noexcept -> size_t
{
  return n == 0 ? 1 : n * kaijo (n - 1);
}

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

  size_t n;
  cin >> n;

  using P = pair <double, double>;
  vector <P> v;
  rep (i, n)
  {
    double x, y;
    cin >> x >> y;
    v.emplace_back (x, y);
  }

  vector <double> ds;
  rep (j, n) rep (i, j)
  {
    double x1, y1, x2, y2;
    tie (x1, y1) = v [i];
    tie (x2, y2) = v [j];
    auto d = sqrt ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    cerr << "(" << x1 << ", " << y1 << ")->(" << x2 << ", " << y2 << ") = " << d << endl;
    ds.emplace_back (move (d));
  }

  double ans = 0;
  for (auto && elem : ds) ans += elem * kaijo (n - 1) * 2;
  ans /= kaijo (n);
  cout << fixed << setprecision (15) << ans << endl;
}


Measured memory_bytes: 256
def euclidean_algorithm(x, y):
    if x < y:
        x, y = y, x
    while y > 0:
        r = x % y
        x, y = y, r
    return x


def main():
    x, y = map(int, input().split(' '))
    print(euclidean_algorithm(x, y))


if __name__ == '__main__':
    main()



Measured memory_bytes: 5600
#include <bits/stdc++.h>
       
    using namespace std;
    #define ll long long
    #define ld long double
    #define pll pair<long long,long long>
    #define vll vector<long long>
    #define pb push_back
    #define mp make_pair
    #define ff first
    #define ss second
    #define deb(x) cout << #x << "=" << x << endl
    #define F(i,a,b) for(ll i=a;i<=b;i++)
    #define RF(i,a,b) for(ll i=a;i>=b;i--)
    #define in(a,n) F(i,0,n-1)cin>>a[i]
    #define vi vector<int>
    #define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
    #define mod 998244353
    #define trace1(x)                cerr<<#x<<": "<<x<<endl
    #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
    #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
    #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
    #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
    #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
    #define int long long
    set < ll> primes;
    const int N=1e7+5;
    vector<int>v[N];
     void Sieve(ll n) 
{ 
    bool prime[n+1];
	for(ll i=0;i<n+1;++i)
		prime[i]=true;
    for (ll p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (ll i=2*p; i<=n; i += p) {
                prime[i] = false; 
                v[i].pb(p);
                
            }
        } 
    }  
    for(ll p=2; p<=n; p++) 
       if (prime[p]) 
		primes.insert(p);  
}

    int32_t main()
    {
    	ios::sync_with_stdio(false);
        cin.tie(NULL);
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            int n;
            cin>>n;
             
            int ans=0;
            
            vector<int>f(N);
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j*i<=n;j++)
                f[i*j]++;
                
                ans+=i*f[i];
            }
            cout<<ans;
        }
        
        
       
    }

Measured memory_bytes: 315756
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> L(N);
    int ans = 0;
    int max = -10000;
    for(int i=0;i<N;++i){
        cin>>L[i];
        ans += L[i];
        if(max<L[i]){
            max = L[i];
        }
    }
    ans -= max;
    if(ans>max) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        long result = 0;
        for (int i = 1; i < n; i++) {
            result += i;
        }

        System.out.println(result);
    }
}


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

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

  int G = 0, W = 0, Y = 0, P = 0;
  rep(i, N) {
    string S;
    cin >> S;
    if (S == "G") {
      G = 1;
    } else if (S == "W") {
      W = 1;
    } else if (S == "Y") {
      Y = 1;
    } else if (S == "P") {
      P = 1;
    }
  }

  if (G + W + Y + P == 3) {
    cout << "Three" << endl;
  } else {
    cout << "Four" << endl;
  }
}



Measured memory_bytes: 256
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

# N = 2000
# K = 10 ** 9
# A = [i for i in range(2000)]

count1 = 0

# 初回A
for i in range(N):
    for j in range(i + 1, N):
        # print(i, j, A[i], A[j])
        if A[i] > A[j]:
            count1 += 1

count2 = 0

# 2回目以降のA
for i in range(N):
    for j in range(N):
        # print(i, j, A[i], A[j])
        if A[i] > A[j]:
            count2 += 1

# print(count)

ans = ((count1 * K) + (count2 * K * (K - 1) // 2)) % ((10 ** 9) + 7)

print(ans)


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

int main() {
	int	N;
	cin >> N;
	vector<int> vec;
	rep(i, N)
	{
		int	a;
		cin >> a;
		vec.push_back(a);
	}
	vec.erase(unique(vec.begin(), vec.end()), vec.end());
	rep(i, vec.size())
	{
		if (i)
			cout << ' ';
		cout << vec.at(i);
	}
	cout << endl;
}



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

using namespace std;
using ll = long long;
using ull = unsigned long long;

namespace
{
	void TopologicalSort(int N, const vector<pair<int, int> >& src, vector<int>& dst)
	{
		dst.clear();
		dst.reserve(N);
		struct Edge {
			set<int> from;
			set<int> to;
		};

		vector<Edge> vertex(N);
		for (auto& x : src)
		{
			int from = x.first;
			int to = x.second;
			vertex[from].to.insert(to);
			vertex[to].from.insert(from);
		}

		queue<int> qu;
		for (int i = 0; i < N; ++i)
		{
			if (vertex[i].from.size() == 0)
				qu.push(i);
		}
		while (!qu.empty())
		{
			int i = qu.front();
			qu.pop();
			dst.push_back(i);
			auto& t = vertex[i].to;
			for (auto p = t.begin(); p != t.end(); ++p)
			{
				int k = *p;
				auto& s = vertex[k].from;
				s.erase(i);
				if (s.empty())
				{
					qu.push(k);
				}
			}
			t.clear();
		}
	}

	int Loc(int i, int j, int N)
	{
		if (i > j)
			swap(i, j);
		return i * N + j;
	}
	pair<int, int> Reverse(int loc, int N)
	{
		int i = loc / N;
		int j = loc - N * i;
		return pair<int, int>(i, j);
	}
}
void ABC139E()
{
	int N;
	cin >> N;
	vector<vector<int> > A(N,vector<int>(N-1));
	vector<pair<int, int> > order; order.reserve(N*N);
	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < N - 1; ++j)
		{
			cin >> A[i][j];
			--A[i][j];
		}
	}

	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < N - 2; ++j)
		{
			int f = Loc(i, A[i][j],N);
			int s = Loc(i, A[i][j + 1], N);
			order.push_back({ f,s });
		}
	}
	vector<int> ret;
	TopologicalSort(N*N, order, ret);
	if (ret.size() < N*N)
	{
		cout << -1 << endl;
		return;
	}

	int ct = 1;
	set<int> match;
	for (int i = 0; i < ret.size(); ++i)
	{
		auto x = Reverse(ret[i], N);
		if (x.first >= x.second)
			continue;
		if (match.find(x.first) != match.cend() || match.find(x.second) != match.cend())
		{
			++ct;
			match.clear();
		}
		match.insert(x.first);
		match.insert(x.second);
	}
	cout << ct << endl;
}

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

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

using ld = long double;

const ld pi = acos(-1.0);
constexpr ld eps = 1e-9;

int main() {
    int n; cin >> n;
    vector<ld> rr(n);
    for(int i = 0; i < n; ++i) {
        cin >> rr[i];
    }
    sort(begin(rr), end(rr));

    ld ans = 0;
    for(int S = 1; S < (1 << n); ++S) {
        vector<ld> r;
        for(int i = 0; i < n; ++i) {
            if(S & (1 << i)) {
                r.push_back(rr[i]);
            }
        }
        const int m = r.size();
        if(m < 3) continue;
        do {
            ld tans = 0, ang_sum = 0;
            auto check = [&] (ld theta) {
                ang_sum = theta;
                tans = 0.5 * r[0] * r[1] * sin(theta);
                for(int i = 1; i < m; ++i) {
                    const auto ang = acos(max(-1.0L, min(1.0L, r[0] * r[1] / r[i] / r[(i + 1) % m] * cos(theta))));
                    tans += 0.5 * r[i] * r[(i + 1) % m] * sin(ang);
                    ang_sum += ang;
                }
                return ang_sum < 2 * pi;
            };
            ld lb = 0, ub = pi;
            for(int lp = 0; lp < 100; ++lp) {
                const auto mid = (lb + ub) / 2;
                (check(mid) ? lb : ub) = mid;
            }
            if(abs(ang_sum - 2 * pi) < eps) {
                ans = max(ans, tans);
            }
        } while(next_permutation(begin(r) + 1, end(r)));
    }
    cout << fixed << setprecision(10) << ans << endl;
}



Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<queue>
#define INF 100000000
using namespace std;

typedef pair<int,int> P;
typedef pair<P,P> P2;

int main(){
  int w,h;
  char grid[100][50];
  vector<P2> G[2][100][50];
  int d[2][100][50];
  int dy[] = {-2,-1,0,1,2,-1,0,1,0} , dx[] = {1,1,1,1,1,2,2,2,3};

  while(cin >> w >> h , w||h){
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
	scanf(" %c ",&grid[i][j]);

    priority_queue<P2,vector<P2>,greater<P2> > q;

    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
	G[0][i][j].clear();
	G[1][i][j].clear();
	if(grid[i][j] == 'S'){
	  d[0][i][j] = d[1][i][j] = 0;
	  q.push(P2(P(0,0),P(i,j)));
	  q.push(P2(P(0,1),P(i,j)));
	}else d[0][i][j] = d[1][i][j] = INF;
      }
    
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	for(int k=0;k<9;k++){
	  int sy = i+dy[k], sx = j+dx[k];
	  if(sy<0 || sx<0 || h<=sy || w<=sx)continue;
	  if('1'<=grid[sy][sx] && grid[sy][sx]<='9')
	    G[0][i][j].push_back(P2(P(grid[sy][sx]-'0',1),P(sy,sx)));
	  if(grid[sy][sx] == 'S' || grid[sy][sx] == 'T')
	    G[0][i][j].push_back(P2(P(0,1),P(sy,sx)));
	}
	for(int k=0;k<9;k++){
	  int sy = i+dy[k], sx = j-dx[k];
	  if(sy<0 || sx<0 || h<=sy || w<=sx)continue;
	  if('1'<=grid[sy][sx] && grid[sy][sx]<='9')
	    G[1][i][j].push_back(P2(P(grid[sy][sx]-'0',0),P(sy,sx)));
	  if(grid[sy][sx] == 'S' || grid[sy][sx] == 'T')
	    G[1][i][j].push_back(P2(P(0,0),P(sy,sx)));
	}
      }
    }

    while(q.size()){
      P2 p = q.top();q.pop();
      
      int t = p.first.first, f = p.first.second;
      int y = p.second.first, x = p.second.second;

      for(int i=0;i<(int)G[f][y][x].size();i++){
	int tt = G[f][y][x][i].first.first, tf = G[f][y][x][i].first.second;
	int ty = G[f][y][x][i].second.first, tx = G[f][y][x][i].second.second;

	if(d[tf][ty][tx] > t + tt){
	  d[tf][ty][tx] = t+tt;
	  q.push(P2(P(t+tt,tf),P(ty,tx)));
	}
      }
    }
    int ans = INF;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
	if(grid[i][j] == 'T')
	  ans = min(ans,min(d[0][i][j],d[1][i][j]));
    if(ans ==INF)cout << -1 << endl;
    else cout << ans << endl;
  }
}

Measured memory_bytes: 1980
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let n: usize = read();
    println!("{}", n * n * n);
}


Measured memory_bytes: 4352
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    D = I()
    ans = 'Christmas'
    pad = ' Eve'
    ans += (25-D) * pad
    print(ans)

main()



Measured memory_bytes: 83404
#include <bits/stdc++.h>
#define LL long long
using namespace std;
int main()
{
    int n; cin>>n;
    int a[n+5];
    for(int i=1;i<=n;i++)cin>>a[i];
    if(n%2)
    {
        for(int i=n;i>0;i-=2)cout<<a[i]<<" ";
        for(int i=2;i<n;i+=2)cout<<a[i]<<" ";
    }
    else
    {
        for(int i=n;i>0;i-=2)cout<<a[i]<<" ";
        for(int i=1;i<n;i+=2)cout<<a[i]<<" ";
    }
return 0;
}


Measured memory_bytes: 2944
///Bismillahir Rahmanir Rahim
///Hello_World_Its_Rakib_Alam_Bappi
#include<bits/stdc++.h>
using namespace std;
///ascii for  A=65   and   a=97
#define		int 	long long
#define 		pb 	push_back
#define 		mp 	make_pair
#define 		pi 	2*acos(0.0)
#define 		loopi 	for(int i = 0 ; i <t ; i++)
#define 		loopj 	for(int j = 0 ; j < n ; j++)
#define 		backj 	for(int j = n-1 ; j >=0 ; j--)
#define 		vect 	vector<int>
#define 		vec_it 	vector<int>::iterator vi
#define 		mapp 	map<int,int>m
#define 		pairr 	pair<int,int>p
#define 		sett	set<int>s
#define 		set_it 	set<int>::iterator si
#define 		yes 	cout<<"YES"<<endl
#define 		no 	cout<<"NO"<<endl
#define 		xx 	first
#define 		xy 	second
main()
{
    /// freopen ("in.txt" , "r",  stdin) ;
    string st;
    double n,k,t,temp=0,cnt=0,x,y=0,sum=0;
    cin>>n;
    sum=2*pi*n;
    printf("%.16lf",sum);
    
}

Measured memory_bytes: 3808
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let q: usize = sc.read();
    for _ in 0..q {
        let a: i64 = sc.read();
        let b: i64 = sc.read();
        println!("{}", solve(a, b));
    }
}

fn solve(a: i64, b: i64) -> i64 {
    let (a, b) = if a > b { (b, a) } else { (a, b) };

    let mut ok = 0;
    let mut ng = b;
    while ng - ok > 1 {
        let m = (ok + ng) / 2;
        if get_max(a, m) < a * b {
            ok = m;
        } else {
            ng = m;
        }
    }
    ok + a - 1
}
// (a+1)*m, (a+2)(m-1), ... (a+m-1)*2, (a+m)
// 1 <= x <= m
// (a+x)(m+1-x) = -(x-m-1)(x+a)
// -(xx +(a-m-1)x +..)
// -(x+(a-m-1)/2)^2...
// x= -(a-m-1)/2
fn get_max(a: i64, m: i64) -> i64 {
    // 1 <= -(a-m-1)/2 <= m
    // 2 <= -(a-m-1) <= 2m
    if 2 <= -(a - m - 1) && -(a - m - 1) <= 2 * m {
        let x1 = -(a - m - 1) / 2;
        let x2 = x1 + 1;
        [x1, x2]
            .into_iter()
            .filter(|&&x| 1 <= x && x <= m)
            .map(|&x| (a + x) * (m + 1 - x))
            .max()
            .unwrap()
    } else {
        cmp::max((a + 1) * m, a + m)
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

const int maxn = 1e5+5;
int n;
int a[maxn], b[maxn];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n;
    ll ans = 0;
    vector<pair<int,int>> as;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        ans -= b[i];
        as.push_back({a[i],b[i]});
    }
    sort(as.begin(),as.end(),[](auto x, auto y) { return x.first + x.second > y.first + y.second; });
    for (int i = 0; i < n; i += 2) {
        ans += as[i].first + as[i].second;
    }
    cout << ans << '\n';

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  if (N%1000%111 == 0 || ((N-N%10)/10)%111 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
S = input()
a, b = int(S[:2]), int(S[2:])
if 0 < a < 13 and 0 < b < 13:
    print("AMBIGUOUS")
elif 0 < a < 13:
    print("MMYY")
elif 0 < b < 13:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 2940
# include<cstdio>
# include<cstring>
int main() {
    char str1[100], str2[100], str3[100];
    scanf("%s %s", &str1, &str3);
    strcpy(str2, str1);
    strcat(str1, str2);
    if ( strstr(str1, str3) == NULL ) printf("No\n");
    else printf("Yes\n");
    return 0;
}


Measured memory_bytes: 2744
using System.Text;
using System;

public class hello
{
    public static void Main()
    {
        var sb = new StringBuilder();
        var INF = " 1000000001";
        var INF2 = 1000000001;
        Console.ReadLine().Trim();
        string[] line = (Console.ReadLine().Trim() + INF).Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        Console.ReadLine().Trim();
        line = (Console.ReadLine().Trim() + INF).Split(' ');
        var b = Array.ConvertAll(line, int.Parse);
        var p = 0; var q = 0;
        while (true)
        {
            if (a[p] == INF2 || b[q] == INF2) break;
            else if (a[p] == b[q]) { sb.Append(string.Format("{0}\n", a[p++])); q++; }
            else if (a[p] < b[q]) p++;
            else  q++;
        }
        Console.Write(sb);
    }
}


Measured memory_bytes: 53848
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
long long int sum[9000000]={};
long long mm=1e9+7;
/*long long poww(long long a,long long b){
    if(b==0)
        return 1;
    else if(b==1)
        return a;
    long long v=poww(a,b/2);
    v*=v;
    v%=mm;
    if(b%2==1){
        v*=v;
        v%=mm;
    }
    return v;
}*/    //function to pow
/*long long pow2(long long k){
long long j=2;
while(--k)
    {j*=2;
    j%=mm;}
return j;


}*/
/*bool prime[100000];
vector<long long >v;
void sieve(){
prime[0]=prime[1]=true;
long int n=10000;
int t=sqrt(n);
for(long int i=2;i<=n;++i){
    if(prime[i]==false){
        v.push_back(i);
        for(long int p=i*i;p<=n;p+=i)
            prime[p]=true;
    }
}
}*/
int main()
{
    ios_base::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     long long a,b,c,d,i=1;
     cin>>a>>b>>c>>d;
     while(a>0&&c>0){
        if(i%2==1)
        {c-=b;
        i+=1;}
        else{
        a-=d;
        i+=1;}
     }
     if(c>a)
        cout<<"No";
     else
        cout<<"Yes";


    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int n, m, x, y;
	cin>>n>>m>>x>>y;
	vector<int>xs(n); vector<int>ys(m);
	for(auto &e:xs)cin>>e;
	for(auto &e:ys)cin>>e;

	for(int i=x+1; i<=y; ++i) {
		bool is_war=false;
		if(!is_war) {
			for(auto e:xs) {
				if(e>=i) {
					is_war=true;
					break;
				}
			}
		}
		if(!is_war) {
			for(auto e:ys) {
				if(e<i) {
					is_war=true;
					break;
				}
			}
		}
		if(!is_war) {
			cout<<"No War"<<endl;
			return 0;
		}
	}
	cout<<"War"<<endl;

	return 0;
}


Measured memory_bytes: 256
from sys import stdin
from collections import Counter
s = list(stdin.readline().rstrip())
odd = Counter(s[0::2])
even = Counter(s[1::2])
if odd['1'] > even['1']:
    print(odd['0']+even['1'])
elif odd['1'] < even['1']:
    print(odd['1']+even['0'])
else:
    if odd['0'] > even['0']:
        print(odd['1']+even['0'])
    elif odd['0'] < even['0']:
        print(odd['0']+even['1'])
    else:
        print(len(s)//2)

Measured memory_bytes: 4644
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main() {
    int n, m;

    while (cin >> n >> m && n) {
        vector<double> a(n), b(n), c(n);
        REP(i,n) cin >> a[i] >> b[i] >> c[i];

        double ans = 0.0;
        REP(i,1<<n){
            vector<double> aa, bb, cc;
            REP(j,n){
                if ((i>>j) & 1) {
                    aa.push_back(a[j]);
                    bb.push_back(b[j]);
                    cc.push_back(c[j]);
                }
            }
            if (aa.size() != m) continue;
            double res = 0.0;
            REP(p,m-1) FOR(q,p+1,m-1){
                res += pow(aa[p]-aa[q],2) + pow(bb[p]-bb[q],2) + pow(cc[p]-cc[q],2);
            }
            ans = fmax(ans, res);
        }
        printf("%.10f\n", ans);
    }

    return 0;
}

Measured memory_bytes: 3280
a,b,c,x,y = map(int, input().split())

if a+b >= 2*c:
    if x >= y:
        if a>=2*c:
            print(2*x*c)
        else:
            print(y*2*c+(x-y)*a)
    else:
        if b>=2*c:
            print(2*y*c)
        else:
            print(x*2*c+(y-x)*b)

else:
    print(x*a+y*b)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string strc,strd,stra,strb;
    int a,b,i;
    cin>> a >> b;
    stra=a+48;
    strb=b+48;
    for(i=1;i<=a;i++)
        strc=strc+strb;
    for(i=1;i<=b;i++)
        strd=strd+stra;
    if(strc==strd)
        cout<< strc<<endl;
    else
        cout << min(strc,strd)<<endl;;
    return 0;
}


Measured memory_bytes: 3628
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    N, A, B = Scanner.map_int()
    winner = ""
    while True:
        if A + 1 == B:
            A -= 1
        else:
            A += 1
        if B - 1 == A:
            B += 1
        else:
            B -= 1
        if A < 0:
            winner = "Borys"
            break
        elif B >= N:
            winner = "Alice"
            break
    print(winner)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 38640
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

n = int(input())
for i in range(n+1):
    if int(i*1.08) == n:
        print(i)
        sys.exit()
print(":(")

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    int n;
    ll x;
    cin >> n >> x;
    vector<ll> h(51),p(51);
    h[0]=1; p[0]=1;
    for(int i=1; i<=n; i++){
        h[i]=2*h[i-1]+3;
        p[i]=2*p[i-1]+1;
    }

    ll sum=0;
    while(true){
        if(x==h[n]){
            sum+=p[n];
            break;
        }else if(x>h[n-1]+1){
            sum+=p[n-1]+1;
            x-=h[n-1]+2;
            n--;
        }else{
            x--;
            n--;
        }
        // cout << n << ' ' << x << ' ' << sum << endl;
        if(n==0){
            if(x==1) sum++;
            break;
        }
    }
    cout << sum << endl;

    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    vector<P> V(N);
    for (auto &p: V) cin >> p.first >> p.second;

    ll ans = 0;
    rep(d, 2) {
        ll max = (ll)-INF*INF, min = (ll)INF *INF;
        for (auto &p : V) {
            if (d == 0) {
                chmax(max, (ll)p.first - p.second);
                chmin(min, (ll)p.first - p.second);

            }

            else {
                chmax(max, (ll)p.first + p.second);
                chmin(min, (ll)p.first + p.second);
            }
        }
        chmax(ans, max - min);
    }

    cout << ans << endl;
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,n) for(ll i=0;i<=n;i++)
#define all(n) n.begin(),n.end()
#define yn(x) cout << (x ? "Yes":"No") << endl;


int main() {
  int k,s;
  cin >> k >> s;
  int cnt = 0;
  rep2(i,k){
    rep2(j,k){
      if((s-i-j)<=k && (s-i-j)>=0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
abc = input().split()

a = int(abc[0])
b = int(abc[1])
c = int(abc[2])
import math
if a > c:
  print('No')
elif b > c:
  print('No')
elif 4*a*b < a**2 + b**2 +c**2 - 2*a*c -2*b*c + 2*a*b:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define INF (1ll<<60)
using namespace std;

decltype(0) main () {
  string s; cin >> s;
  int n = s.length();
  vector<int> numright(n+1,0);
  vector<int> numleft(n+1,0);
  int tt = 0;
  for (int i=1; i<=n; i++) {
    if (s[i-1] == '<') tt++;
    else tt = 0;
    numright[i] = tt;
  }
  tt = 0;
  for (int i=n; i>0; i--) {
    if (s[i-1] == '>') tt++;
    else tt = 0;
    numleft[i-1] = tt;
  }
  //for (auto &i : numright) cerr << i << " ";
  //cerr << endl;
  //for (auto &i : numleft) cerr << i << " ";
  //cerr << endl;
  vector<int> res(n+1);
  int sum = 0;
  for (int i=0; i<=n; i++) {
    res[i] = max(numleft[i], numright[i]);
    sum += res[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 12548
#include <iostream>
#include <algorithm>
#include <utility>
#include <cstring>
#include <string>

#define MAXN 3005
#define fst first
#define snd second

using namespace std;

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

ll arr[MAXN];
ll dp[MAXN][MAXN];
bool vis[MAXN][MAXN];

ll solve(int lo, int hi) {
    if(lo > hi) return 0LL;
    if(lo == hi) return arr[lo];
    if(vis[lo][hi]) return dp[lo][hi];
    dp[lo][hi] = max(arr[lo] - solve(lo + 1, hi),
                    arr[hi] - solve(lo, hi - 1));
    vis[lo][hi] = true;
    return dp[lo][hi];
}

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

    memset(vis, false, sizeof(vis));

    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> arr[i];
    }
    cout << solve(1, n) << '\n';

    return 0;
}

Measured memory_bytes: 58768