akhauriyash/Code-Regression huggingface dataset:
using System;
    using System.Linq;
    using System.Collections.Generic;

    public class Program
    {
        public static void Main(string[] args)
        {
            List<int> inputAB= Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            List<string> input = Console.ReadLine().Split('-').ToList();

            Console.WriteLine(input[0].Length == inputAB[0] && input[1].Length == inputAB[1] ? "Yes":" No");
        }
    }

Measured memory_bytes: 13268
n=int(input())
n_list=list(map(int,input().split()))
alice=[]
bob=[]
while(n_list!=[]):
    a=max(n_list)
    alice.append(a)
    n_list.remove(a)
    if(n_list==[]):
        break
    b=max(n_list)
    bob.append(b)
    n_list.remove(b)
print(sum(alice)-sum(bob))

Measured memory_bytes: 9124
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
typedef pair<ll, ll> P;
typedef map<string, ll> M;
typedef unordered_map<ll, ll> HM;
typedef set<ll> S;
typedef multiset<ll> MS;
typedef queue<ll> Q;

int main(){
    ll n,m; cin>>n>>m;
    ll a[n];
    for(int i=0; i<n; i++)
        cin >> a[i];
    for(int i=1; i<n; i++)
        a[i] += a[i-1];
    map<ll, ll> cnt;
    for(int i=0; i<n; i++){
        cnt[a[i]%m]++;
    }
    ll ans = 0;
    for(auto p : cnt){
        ans += p.second*(p.second-1)/2;
    }
    OUT(ans+cnt[0]);
}


Measured memory_bytes: 4992
#include<stdio.h>
long long int min(long long int a, long long int b)
{
	if (a < b)
		return a;
	else
		return b;
}
int main()
{
	long long int n, m, k;
	scanf("%lld %lld %lld", &n, &m, &k);
	long long int i, j;
	long long int a[200005], b[200005];
	for (i = 0; i < n; i++)
		scanf("%lld", &a[i + 1]);
	for (i = 0; i < m; i++)
		scanf("%lld", &b[i + 1]);
	a[0] = b[0] = 0;
	for (i = 0; i < n; i++)
		a[i + 1] += a[i];
	for (i = 0; i < m; i++)
		b[i + 1] += b[i];
	long long int ans = 0;
	j = m;
	for (i = 0; i <= n; i++)
	{
		while (j >= 0 && a[i] + b[j] > k)
			j--;
		if (j >= 0)
			if (ans < i + j)
				ans = i + j;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4860
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
const int mod=1000000007;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;


int main(){
    int n;
    string s;
    int dig[10][10][10] = {0};
    cin >> n;
    cin >> s;
    // rep(i,2,n-1){
    //     rep(j,1,i-1){
    //         rep(k,0,j-1){
    //             int now = s[i] -'0';
    //             int mae = s[j] -'0';
    //             int maemae = s[k] -'0';
    //             dig[maemae][mae][now] = 1;
    //         }
    //     }
    // }
    int ans = 0;
    rep(i,0,9){
        rep(j,0,9){
            rep(k,0,9){
                //ans += dig[i][j][k];
                bool flg_i=false,flg_j=false;
                rep(l,0,n-1){
                    int now = s[l] - '0';
                    if(!flg_i && now == i){
                        flg_i=true;
                        continue;
                    }
                    if(!flg_j && flg_i && now == j){
                        flg_j = true;
                        continue;
                    }
                    if(flg_j && now == k){
                        ++ans;
                        break;
                        //cout << i << j << k << endl;
                    }
                }
            }
        }
    }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main()
{
	int A=0;
	int B=0;
	int t=0;
	
	scanf("%d %d",&A,&B);
	
	if(A>B)
	{
		t=A;
		A--;
		if(A>B)
		{
			printf("%d",t+t-1);
		}
		else
		{
			printf("%d",t+B);
		}
	}
	
	else
	{
		t=B;
		B--;
		if(A<B)
		{
			printf("%d",t+t-1);
		}
		else
		{
			printf("%d",A+t);
		}
	}
	return 0;
}

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

int cnt[27] = { 0 };

int main() {
	string str;

	while (cin >> str) {

		for (int i = 0; i < str.size(); ++i) {
			if (str[i] <= 'Z' && str[i] >= 'A') {
				str[i] += 'a' - 'A';
			}
			if (str[i] <= 'z' && str[i] >= 'a') {
				cnt[str[i] - 'a']++;
			}
		}
	}

	for (int i = 0; i < 26; ++i) {
		cout << (char)('a' + i) << " : " << cnt[i] << endl;
	}

	return 0;
}

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

long long int memo[111][11][1111];

long long int solve(int p, int n, int s){
  
  if(n == 1 && s >= p && s < 101) return memo[p][n][s] = 1;
  if(n == 1 || n*100 < s) return memo[p][n][s] = 0;
  if(~memo[p][n][s]) return memo[p][n][s];
  
  long long int ans = 0;
  for(int i=p;i<101;i++) if(s-i >= 0) ans += solve(i+1, n-1, s-i);
  
  return memo[p][n][s] = ans;
}

int main(){

  memset(memo, -1, sizeof(memo));

  int n, s;
  while(cin >> n >> s, n+s) cout << solve(0, n, s) << endl;
  
}

Measured memory_bytes: 11760
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <set>
#include <map>

using namespace std;

#define pb push_back
#define mp make_pair
#define x first
#define y second

typedef long long ll;

const ll INF = 1e9+5;
const ll MOD = 1e9+7;

int main() {
	int a, b, c;
  	cin >>a>>b>>c;
  	cout <<(a+b-1)/b*c<<endl;
	return 0;
}

Measured memory_bytes: 3656
var arr = require('fs')
	.readFileSync('/dev/stdin', 'utf8')
	.split(" ")
	.map(function(elem) { return elem|0; });
if (arr[0] == arr[1]) console.log("a == b");
else if (arr[0] > arr[1]) console.log("a > b");
else console.log("a < b");

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

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it = (c).begin(); it != (c).end(); it++)
#define X first
#define Y second

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int N = 20;

int w, h, res;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int m[N][N];

void dfs(pii, int);

int main(void){
    for(; cin >> w >> h, w; cout << res << endl){
        res = INF;
        pii p;

        rep(y, h)
            rep(x, w){
                cin >> m[y][x];

                if(m[y][x] == 2) p = mp(x, y), m[y][x] = 0;
            }
       
       dfs(p, 10); 
       if(res == INF) res = -1;
    }

    return 0;
}

void dfs(pii p, int n){
    if(!n) return;
    
    n--;
    rep(i, 4){
        pii next = p;
        rep(j, N){
            next = mp(next.X + dx[i], next.Y + dy[i]);
            if(next.X < 0 || w <= next.X ||
               next.Y < 0 || h <= next.Y) break;
            if(m[next.Y][next.X] == 3){
                res = min(res, 10 - n);
                break;
            }
            if(m[next.Y][next.X] == 1){
                if(!j) break;

                m[next.Y][next.X] = 0;
                dfs(mp(next.X - dx[i], next.Y - dy[i]), n);
                m[next.Y][next.X] = 1;
                break;
            }
        }
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define mkp make_pair
#define pb push_back
#define clr(a,b) memset(a, b, sizeof(a))
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vii;

void compute(){
    int a, b;
    cin>>a>>b;
    if(b%a == 0)
        cout<<a+b<<"\n";
    else
        cout<<b-a<<"\n";
}

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


Measured memory_bytes: 384
#include<stdio.h>
int main(){
    int r,d;
    int x[2020];
    scanf("%d%d%d",&r,&d,&x[2000]);
    for(int i=2000;i<2010;i++){
        x[i+1]=r*x[i]-d;
        printf("%d\n",x[i+1]);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

void solve(void)
{
  ui  N{}; std::cin >> N;
  typedef std::pair<ull, ull> Pair;
  std::vector<Pair> vc(N);
  rep(0, N)
    std::cin >> vc[i].second // A_i : 作業必要時間
             >> vc[i].first; // B_i : 作業目標時間

  boost::partial_sum(boost::sort(vc), vc.begin(), [](Pair before, Pair current) {
    return Pair{ current.first, before.second + current.second };
    });

  auto ans = boost::accumulate(vc, 1U,
    [](auto ans, Pair p) {
      // 必要時間の部分和が、各段階での目標時間を超過してはならない
      return ans & (p.first >= p.second);
    });

  std::cout << (ans ? "Yes" : "No") << "\n";

  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 3328
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main 
{
	static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) 
	{
		int n = scan.nextInt();
		
		for(int i = 0; i < n; i++)
		{
			new Cave();
		}
	}
	
	static class Cave
	{
//		List<Integer> xp = new ArrayList<Integer>();
//		List<Integer> yp = new ArrayList<Integer>();
		int x = 0;
		int y = 0;
		float maxD;
		int maxX = 0;
		int maxY = 0;
		
		public Cave()
		{
			while(true)
			{
				int x1 = scan.nextInt();
				int y1 = scan.nextInt();
				
				if(x1 == 0 && y1 == 0)
				{
					//compute
					System.out.println(maxX + " " + maxY);
					return;
				}
				else
				{
					x += x1;
					y += y1;
//					System.out.println("cur pos " + x1 + " " + y1);
					float d = (float) Math.sqrt(x*x + y*y);
					
					if(d > maxD || d == maxD && x > maxX)
					{
						maxD = d;
						maxX = x;
						maxY = y;
					}
				}
			}
		}
	}

}



Measured memory_bytes: 33040
using System;
class income{
    public static void Main(){
        Calc c = new Calc();
        int numofhuman = int.Parse(Console.ReadLine());
        int[] arrayofincome = new int[10001];
        while(numofhuman != 0){
            String[] str = Console.ReadLine().Split(' ');
            for(int i=0; i<numofhuman; i++){
                arrayofincome[i] = int.Parse(str[i]);
            }
            Console.WriteLine(c.countnum(arrayofincome,
              c.calaverage(arrayofincome,numofhuman),numofhuman));
            numofhuman = int.Parse(Console.ReadLine());
        }
    }
}

class Calc{
    public double calaverage(int[] arrayofincome, int numofhuman){
        int sum=0;
        for(int i=0; i<numofhuman; i++){
          sum+=arrayofincome[i];
        }
        return sum/numofhuman*(1.0);
    }
    public int countnum(int[] arrayofincome, double average, int numofhuman){
        int count=0;
        for(int i=0; i<numofhuman; i++){
          if(average >= arrayofincome[i])
            count++;
        }
        return count;
    }
}



Measured memory_bytes: 16776
package main

import "fmt"

func main() {
	var x, y int
	fmt.Scanf("%d %d", &x, &y)
	b2 := y - 2*x

	if b2%2 != 0 || b2 < 0 {
		fmt.Println("No")
		return
	}
	a := x - b2/2
	if a < 0 {
		fmt.Println("No")
		return
	}

	fmt.Println("Yes")

}


Measured memory_bytes: 1816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); 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; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N,M;
    cin >> N >> M;
    vl A(N, -1);
    rep(i,M){
        ll s, c;
        cin >> s >> c;
        s--;
        if(A[s]!=-1&&A[s]!=c){
            cout << -1 << endl;
            return 0;
        }
        A[s] = c;
    }
    string ans = "";
    rep(i,N){
        if (i == 0 && A[0] == -1) ans += '1';
        else if(A[i]==-1)
            ans += '0';
        else{
            ans += '0' + A[i];
        }
    }

    if(A[0]==0&&N>1){
        cout << -1 << endl;
        return 0;
    }else if(A[0]==0){
        cout << 0 << endl;
        return 0;
    }else if(N==1&&M==0){
        cout << 0 << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  string s;
  int K;
  while (cin >> s >> K) {
    for (int i = 0; i + 1 < s.size(); i++) {
      for (char c = 'a'; c <= 'z'; c++) {
        int cost = (c - s[i] + 26) % 26;
        if (cost <= K) {
          s[i] = c;
          K -= cost;
          break;
        }
      }
    }
    if (K > 0) {
      s[s.size() - 1] = 'a' + (s[s.size() - 1] - 'a' + K) % 26;
    }
    cout << s << endl;
  }
  return 0;
}


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(1, n):
    if a[i] - 1 == a[i - 1]:
        ans += c[a[i - 1] -1]
print(sum(b) + ans)

Measured memory_bytes: 3064
s = list(input())

ans = []
for i in range(len(s)):
    if s[i] == "0":
        ans.append("0")
    elif s[i] == "1":
        ans.append("1")
    else:
        if len(ans) == 0:
            pass
        else:
            ans.pop(-1)

print("".join(ans))

Measured memory_bytes: 3060
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	a,b = readline() |> split |> parseMap
	p = readline() |> split |> parseMap
	ca = 0
	cb = 0
	for i in 1:n
		if p[i] <= a
			ca += 1
		elseif p[i] <= b
			cb += 1
		end
	end
	println(min(ca,cb,n-ca-cb))
end

main()


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
    string s;
    cin>>s;
    sort(all(s));
    if(s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

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

Measured memory_bytes: 768
def main(R, G, B, N):
    count = 0
    for r in range(N+1):
        for g in range(N+1):
            remain = N - R * r - G * g
            if remain >= 0 and remain % B == 0:
                count += 1
    return count


if __name__ == "__main__":
    R, G, B, N = list(map(int, input().split()))
    print(main(R, G, B, N))


Measured memory_bytes: 40684
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;

int a,b,c,d,e,f;
vector<int> water,sugar;
int memo[3010];

void Wdfs(int w)
{
    if(memo[w]) return;
    water.emplace_back(w),memo[w] = 1;
    if(w+a*100 <= f) Wdfs(w+a*100);
    if(w+b*100 <= f) Wdfs(w+b*100);
}

void Sdfs(int s)
{
    if(memo[s]) return;
    sugar.emplace_back(s),memo[s] = 1;
    if(s+c <= f) Sdfs(s+c);
    if(s+d <= f) Sdfs(s+d);
}

int main()
{
    cin >> a >> b >> c >> d >> e >> f;

    Wdfs(0); //���̑S��
    sort(water.begin(),water.end());
    for(int i = 0; i < 3010; i++) memo[i] = 0; 
    Sdfs(0); //�����̑S��
    sort(sugar.begin(),sugar.end());
    water.erase(water.begin());
    sugar.erase(sugar.begin());
    //for(auto x: water) cout << x << endl;
    //for(auto y: sugar) cout << y << endl;

    int ww = a*100,ss = 0;
    double ma = 0.0;
    for(auto x: water){
        for(auto y: sugar){
            if(x+y <= f && 100.0*y/(x+y) <= 100.0*e/(100+e) && 100.0*y/(x+y) > ma){
                ma = 100.0*y/(x+y);
                ww = x;
                ss = y;   
            }

        }
    }

    cout << ww + ss << ' ' << ss << endl;

    return 0;
}

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

using namespace std ; 

int main()
{
	vector<long long int > A(5) ;  
	for(int i = 0 ; i < 5 ; ++i)
		cin >> A[i] ; 
	for(int i = 0 ; i< 5 ; ++i ){
		if(A[i]==0LL){
			cout << i + 1 << "\n";
			return 0 ; 
		}
	}
	// cout << "Hello World\n" ; 
	return 0 ; 
}

Measured memory_bytes: 3160
#include<stdio.h>
int main(){
	int i,g,t,s=0;
	for(;;s=0){
		scanf("%d",&g);
		if(g==0)break;
		for(i=0;i<g/4;i++){
			scanf("%d",&t);
			s+=t;
		}
		printf("%d\n",s);
	}
	return 0;
}

Measured memory_bytes: 0
def scoring(d, t):
    last[t] = d
    return S[d][t] - sum((d - l) * c for l, c in zip(last, C))

D = int(input())
C = list(map(int, input().split()))
S = []
for _ in range(D):
    s = list(map(int, input().split()))
    S.append(s)
T = [int(input()) - 1 for _ in range(D)]
last = [-1] * 26
score = 0
for i in range(D):
    score += scoring(i, T[i])
    print(score)

Measured memory_bytes: 9280
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    // char ;
    ll a,b,c,x,y,ans=0;
    scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&x,&y);
    // ll [n];
    if(2*c<=a+b){
        ans+=c*2*min2(x,y);
        ll r = max2(x,y) - min2(x,y);
        if(x>y){
            if(2*c>a){
                ans+=r*a;
            }else{
                ans+=c*r*2;
            }
        }else{
            if(2*c>b){
                ans+=r*b;
            }else{
                ans+=c*r*2;
            }
        }
    }else{
        ans+=a*x+b*y;
        // ll r = max2(x,y) - min2(x,y);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True

def main():
    A,B = LMIIS()
    print(max(A+B,A-B,A*B))





    pass
if __name__ == '__main__':
    main()

Measured memory_bytes: 38496
#include "cstring"
#include "iostream"

using namespace std;

int main()
{
	char s[2];
	char str[50];
	char kaiga[50][50];
	int H, W;
	int i, j;
	int judge = 0;
	int fjudge	= 1;

	cin >> H >> W;
	for (i = 0; i < H; i++) {
		cin >> str;
		for (j = 0; j < W; j++) {
			kaiga[i][j] = str[j];
		}
	}

	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			judge = 0;
			if(kaiga[i][j]=='#'){

					if (i - 1 >= 0) {
						if (kaiga[i - 1][j] == '#')
							judge = 1;
					}

					if (j - 1 >=  0) {
						if (kaiga[i][j-1] == '#')
							judge = 1;
					}

					if (i + 1 <H) {
						if (kaiga[i +1][j] == '#')
							judge = 1;
					}

					if (j + 1 < W ) {
						if (kaiga[i][j + 1] == '#')
							judge = 1;
					}

					if (judge ==0){
						fjudge = -1 ;
					}
			}
			

		}
	}



	if (fjudge == -1) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}
	
	

	return 0;
}

Measured memory_bytes: 256
extern crate core;

use std::io;

#[derive(PartialEq, Debug)]
enum Gender {
    Male,
    Female,
}

fn main() {
    let n = read_line().parse::<i32>().unwrap();
    println!("0");
    let g = read_g();
    is_ok(g, 0, n - 1);
}

fn is_ok(start_g: Gender, start: i32, end: i32) {
    let i = (start + end) / 2;
    let i = if i == start { end } else { i };
    println!("{}", i);
    let g = read_g();
    //左右どっちに矛盾があるか調べる
    //iが奇数なら異性、偶数なら同姓のはず
    let b = if (i - start) % 2 == 0 {
        start_g == g
    } else {
        start_g != g
    };

    //bがtrueなら右に矛盾。falseなら左に矛盾
    if b {
        is_ok(g, i, end);
    } else {
        is_ok(start_g, start, i);
    }
}

fn read_g() -> Gender {
    let input = read_line();
    match input.as_ref() {
        "Male" => Gender::Male,
        "Female" => Gender::Female,
        _ => std::process::exit(0),
    }
}

fn read_line() -> String {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input.trim().to_string()
}


Measured memory_bytes: 4948
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

mod=10**9+7
n=int(input())
arr=list(map(int,input().split()))
ans=0
sums=sum(arr)
for val in arr:
    ans+=(val*sums)%mod
    ans-=(val*val)%mod
print((ans*pow(2,mod-2,mod))%mod)

Measured memory_bytes: 92120
N, K = gets.split.map(&:to_i)

if K == 0
  puts N * N
  exit 0
end

ans = 0
(1..N).each do |b|
  n = [b - K, 0].max
  c1 = N / b * n
  c2 = [N % b + 1 - K, 0].max
  ans += c1 + c2
end
puts ans


Measured memory_bytes: 3836
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define lli long long int
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll  gcd(ll a,ll b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}
ll a[200001];
ll ar[200001];
int main()
{
ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);
ll n;
cin>>n;
ll x,y;
for(ll i=0;i<n;i++)
{
	cin>>x>>y;
	a[i]=x+y;
	ar[i]=x-y;
}
sort(a,a+n);
sort(ar,ar+n);
ll ans=0;
ans=ar[n-1]-ar[0];
cout<<max(ans,(a[n-1]-a[0]))<<endl;
}




Measured memory_bytes: 6748
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <list>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <random>
#include <queue>
#include <fstream>
#include <iterator> // std::back_inserter
#include <chrono>
#include <string>

using namespace std;


int main(int argc, char *argv[])
{
    int N;
    cin >> N;

    char a;

    int R=0, B=0;

    for(int i=0; i<N; i++){
        cin >> a;
        if(a == 'R') R++;
        else B++;
    }

    if(R>B) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[3001][3001];
pair < int, int > p[3001][3001];
int main(){
string s, t;
cin >> s >> t;
ll n = s.size();
ll m = t.size();

p[0][0] = {-1, -1};
for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
        if (s[i] == t[j]){
            if(i > 0 && j > 0){
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            else{
                dp[i][j] = 1;
            }
            p[i][j] = {i - 1, j - 1};
        }
        else{
            if(i > 0 && j > 0){
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
                if(dp[i - 1][j] > dp[i][j - 1]){
                    p[i][j] = {i - 1, j};
                }
                else{
                    p[i][j] = {i, j - 1};
                }

            }
            else if (i > 0){
                dp[i][j] = dp[i - 1][j];
                p[i][j] = {i - 1, j};
            }
            else if (j > 0){
                dp[i][j] = dp[i][j - 1];
                p[i][j] = {i, j - 1};
            }
            else
            p[i][j] = {-1, -1};
        }
    }
}
ll x = s.size() - 1;
ll y = t.size() - 1;
string ans = "";
while(x >= 0 && y >= 0){
    if(s[x] == t[y]){
        ans = ans + s[x];
    }
    ll a = x;
    ll b = y;
    x = p[a][b].first;
    y = p[a][b].second;
}
for(int i = ans.size() - 1; i >= 0; i--){
    cout << ans[i];
}
}


Measured memory_bytes: 140928
#include<cstdio>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

typedef pair<int,int> P;

vector<P> G[10100];
bool isBase[10100];
int baseNum[10100];

int par[10100];

vector<P> es;
int N;

void init(){
	for(int i=0;i<N;i++){
		G[i].clear();
		isBase[i]=false;
		baseNum[i]=0;
	}
	es.clear();
}

void dfs(int v,int p){
	baseNum[v]=isBase[v]?1:0;
	par[v]=p;
	for(int i=0;i<G[v].size();i++){
		int u=G[v][i].first;
		if(u==p){
			es.push_back(P(G[v][i].second,v));
		}else{
			dfs(u,v);
			baseNum[v]+=baseNum[u];
		}
	}
}

int main(){
	int datano=0;
	while(true){
		datano++;
		init();
		int T,K;
		scanf("%d%d%d",&N,&T,&K);
		if(N==0) break;
		for(int i=0;i<N-1;i++){
			int u,v,c;
			scanf("%d%d%d",&u,&v,&c);
			u--;v--;
			G[u].push_back(P(v,c));
			G[v].push_back(P(u,c));
		}
		for(int i=0;i<T;i++){
			int in;
			scanf("%d",&in);
			in--;
			isBase[in]=true;
		}
		dfs(0,-1);
		sort(es.begin(),es.end());
		int ans=0;
		int cnt=0;
		if(K==0) goto output;
		for(int i=0;i<N-1;i++){
			int v=es[i].second;
			int p=par[v];
			int c=es[i].first;
			int x=baseNum[v];
			int y=0;
			int tmp=p;
			while(p!=-1){
				y=max(y,baseNum[p]);
				p=par[p];
			}
			if(x>0&&y>x){
				p=tmp;
				while(p!=-1){
					baseNum[p]-=x;
					p=par[p];
				}
				par[v]=-1;
				ans+=c;
				cnt++;
			}
			if(cnt==K) break;
		}
		output:;
		printf("Case %d: %d\n",datano,ans);
	}
	return 0;
}

Measured memory_bytes: 2772
N,K=map(int,input().split())
L=list(map(int,input().split()))
R=list()
if K>=N:
  sums=0
  c=dict()
  for i in range(N):
    sums+=L[i]
    sums%=K
    a=(sums-i-1)%K
    if a in c:
      c[a]+=1
    else:
      c[a]=1
  ans=0
  for i in c:
    ans+=(c[i]-1)*c[i]//2
  if 0 in c:
    print(ans+c[0])
  else:
    print(ans)
else:
  ans=0
  c=[0]*K
  sums=0
  for i in range(N):
    sums+=L[i]
    sums%=K
    a=(sums-i-1)%K
    R.append(a)
  for i in range(K-1):
    c[R[i]]+=1
  ans+=c[0]
  c[R[K-1]]+=1
  for i in range(N):
    if i<N-K:
      ans+=c[R[i]]-1
      c[R[i]]-=1
      c[R[i+K]]+=1
    else:
      ans+=c[R[i]]-1
      c[R[i]]-=1
  print(ans)

Measured memory_bytes: 41332
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 998244353;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a%mod; a = a * a%mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// head

template <uint MD> struct ModInt {
	using M = ModInt;
	const static M G;
	uint v;
	ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
	M& set_v(uint _v)
	{
		v = (_v < MD) ? _v : _v - MD;
		return *this;
	}
	explicit operator bool() const { return v != 0; }
	M operator-() const { return M() - *this; }
	M operator+(const M& r) const { return M().set_v(v + r.v); }
	M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
	M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
	M operator/(const M& r) const { return *this * r.inv(); }
	M& operator+=(const M& r) { return *this = *this + r; }
	M& operator-=(const M& r) { return *this = *this - r; }
	M& operator*=(const M& r) { return *this = *this * r; }
	M& operator/=(const M& r) { return *this = *this / r; }
	bool operator==(const M& r) const { return v == r.v; }
	M pow(ll n) const
	{
		M x = *this, r = 1;
		while (n) {
			if (n & 1) r *= x;
			x *= x;
			n >>= 1;
		}
		return r;
	}
	M inv() const { return pow(MD - 2); }
	friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<mod>;

const Mint ibase = Mint(10).pow(18).inv();

const int MAXN = 100000 + 5;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	//	freopen("a.in","r",stdin);
	//	freopen("a.out","w",stdout);

	int n, m;
	cin >> n;
	
	int u, v;
	vector<vector<Mint>> sumg(3);
	rep(x, 0, 3)
	{
		cin >> m;
		vector<vi> G(n + 1);
		rep(i, 0, m)
		{
			cin >> u >> v;
			if (u > v) swap(u, v);
			G[u].push_back(v);
		}

		vi grundy(n + 1, 0);
		vi vis(n + 1, -1);
		per(i, 1, n + 1)
		{
			for (int to : G[i]) {
				vis[grundy[to]] = i;
			}
			while (vis[grundy[i]] == i) grundy[i]++;
			while (sumg[x].size() <= grundy[i]) sumg[x].resize(grundy[i] + 1);
			sumg[x][grundy[i]] += Mint(10).pow(18 * i);
		}
	}

	Mint ans = 0;
	rep(i, 0, sumg[0].size())
	{
		rep(j, 0, sumg[1].size())
		{
			int k = i ^ j;
			if (k < sumg[2].size()) {
				ans += sumg[0][i] * sumg[1][j] * sumg[2][k];
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N, T;
  cin >> N >> T;
  vector<int> t(N);
  for(int i = 0; i < N; ++i) cin >> t[i];
  int e = 0, ans = 0;
  for(int i = 0; i < N; ++i){
    ans += min(T,t[i]+T-e);
    e = t[i] + T;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;

    int a[n];
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    sort(a, a + n, greater<int>());

    long long result = 0;
    for(int i = 0; i < n; i++) {
        if(k > 0) {
            k--;
            continue;
        }
        result += a[i];
    };
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 1024
/*
TEMPLATE
by.YXH_XianYu
   2018.7.21
*/
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LLI long long
#define DBL double
#define CHR char
#define BOL bool
#define REG register
#define rep(i, j, k) for(int i = j, lim = k; i <= lim; i++)
#define req(i, j, k) for(int i = j, lim = k; i >= lim; i--)
#define MXN 105

int a[4];

int main() {
	//freopen("TEMPLATE.in", "r", stdin);
	//freopen("TEMPLATE.out", "w", stdout);
	
	scanf("%d %d %d", &a[1], &a[2], &a[3]);
	std::sort(a+1, a+4);
	printf("%d\n", a[3]-a[1]);



	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x

using namespace std;
int main()
{

	std::ios::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != t[i])ans++;
	}
	cout << ans;
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rp(i,n) cin >> s.at(i);
    sort(s.begin(),s.end());
    int ans=n;
    rp(i,n-1){
        if(s[i]==s[i+1]) ans--;
    }
    cout << ans << endl;
}

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

int main() {
	int N;
	cin >> N;
	int j = 1;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		if (a == j) j++;
		else ans++;
	}
	cout << (ans < N ? ans : -1) << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC170A
{
    class Program
    {
        static void Main(string[] args)
        {
            var xs = Console.ReadLine().Split().Select(int.Parse).ToArray();
            
            for (var i = 0; i < xs.Length; i++)
            {
                if (xs[i] == 0)
                {
                    Console.WriteLine(i + 1);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 19040
#include <stdio.h>

int main(){
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if(x - r < 0 || W < x + r || y - r < 0 || H < y + r){
		printf("No\n");
	} else {
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <map>
using namespace std;
 
int main() {
  int n, a[4][13] = {0};//????¬??????????a?????£?¨????????´??????°???4*13???                                                                                                                                      
  map<char, int> m;//?????????????????°??¨??????m????¨???????
  char c[4];//??????c?????£?¨????????´??????°???4??????
  m['S'] = 0; m['H'] = 1; m['C'] = 2; m['D'] = 3;
  c[0] = 'S'; c[1] = 'H'; c[2] = 'C'; c[3] = 'D';  
  /*??????????????°????????°??????????????????????????????????????\?????????????????????
  m????????°??????????´????c???????????????????´??????????*/                                                                                                           
  cin >> n;
  for (int i = 0; i < n; i++) {
    char suit; int rank;//suit???S,H,C,D??????????????????
    cin >> suit >> rank; 
    a[m[suit]][rank-1] = 1;                                                                                                                                   
  }
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 13; j++) 
      if (a[i][j] == 0) {
        cout << c[i] << ' ' << j + 1;
        cout << endl;
      }
  return 0;
}

Measured memory_bytes: 1200
import java.lang.reflect.Array;
import java.util.*;

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

        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++)
            H[i] = sc.nextInt();
        sc.close();

        int count = 0;
        int maxMv = 0;

        for (int i = 0; i < N - 1; i++) {
            if (H[i] >= H[i + 1]) {
                count++;
                if (i == N - 2) {
                    if (maxMv < count) {
                        maxMv = count;
                    }
                }
            } else {
                if (maxMv < count) {
                    maxMv = count;
                }
                count = 0;
            }
        }

        System.out.println(maxMv);


    }
}

Measured memory_bytes: 50864
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

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

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

const int INF = 1001001001;

int main()
{
	int m, n;
	while(scanf("%d%d", &m, &n), m){
		pii car[10][2];
		rep(i, 10) rep(j, 2)
			car[i][j] = pii(0, 0);
		
		vi ans;
		queue<pii> Q;
		rep(i, 2000){
			rep(j, m){
				rep(k, 2){
					if(car[j][0].first != 0){
						--car[j][0].second;
						if(car[j][0].second <= 0){
							ans.push_back(car[j][0].first);
							car[j][0] = car[j][1];
							car[j][1] = pii(0, 0);
						}
						else
							k = 2;
					}
				}
				car[j][1].second = max(0, car[j][1].second-1);
			}
			if(i%10 == 0 && i/10 < n){
				int t;
				scanf("%d", &t);
				Q.push(pii(i/10+1, t));
			}
			while(!Q.empty()){
				int x = -1;
				rep(j, m){
					if(car[j][0].first == 0){
						x = j;
						break;
					}
				}
				int t = Q.front().second;
				if(x == -1){
					int best = INF;
					rep(j, m){
						if(car[j][1].first == 0){
							int diff = car[j][0].second - t;
							if(diff < 0)
								diff = INF / 2 - diff;
							if(diff < best){
								best = diff;
								x = j;
							}
						}
					}
					if(x == -1)
						break;
					car[x][1] = car[x][0];
				}
				car[x][0] = Q.front();
				Q.pop();
			}
		}
		rep(i, n)
			printf("%d%c", ans[i], i==n-1?'\n':' ');
	}
	return 0;
}

Measured memory_bytes: 1056
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#define ll long long

using namespace std;

struct card {
	int value;
	char mark;
};

card a[50];
card b[50];

int main() {
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		int ipti; char iptc;
		cin >> iptc >> ipti;
		a[i].value = ipti;
		b[i].value = ipti;
		a[i].mark = iptc;
		b[i].mark = iptc;
	}

	// bubble
	for (int i = 0; i < N; i++) {
		for (int j = N - 1; j > i; j--) {
			if (a[j-1].value > a[j].value) {
				card tmp = a[j-1];
				a[j-1] = a[j];
				a[j] = tmp;
			}
		}
	}
	for (int i = 0; i < N; i++) {
		if (i != 0)cout << " ";
		cout << a[i].mark << a[i].value;
	}
	cout << endl << "Stable" << endl;

	// selection
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i; j < N; j++) {
			if (b[j].value < b[minj].value) {
				minj = j;
			}
		}
		if (i != minj) {
			card tmp = b[i];
			b[i] = b[minj];
			b[minj] = tmp;
		}
	}
	for (int i = 0; i < N; i++) {
		if (i != 0)cout << " ";
		cout << b[i].mark << b[i].value;
	}
	for (int i = 0; i < N; i++) {
		if (a[i].mark != b[i].mark || a[i].value != b[i].value) {
			cout << endl << "Not stable" << endl;
			return 0;
		}
		else continue;
	}
	cout << endl << "Stable" << endl;






	return 0;
}





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

int main(){
    string s;
    int k;
    cin>>k>>s;
    if(s.size()>k){
        for(int i=0;i<k;i++){
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }else{
        cout<<s<<endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main() {
    int N;
    long long L[87] = {2, 1};

    cin >> N;

    for (int i = 2; i <= N; i++) {
        L[i] = L[i-1] + L[i-2];
    }
    cout << L[N] << endl;

    return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
#define MOD (int)(1E9 + 7)
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int k, x;
    cin >> k >> x;
    if (k * 500 >= x)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    GAME_OVER;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
        int n, i, c;
        cin >> n;
        string s;
        c=1;
        cin >> s;
        for (i=0;i<n-1;i++){
                if (s[i]!=s[i+1]){
                        c = c + 1;
                }
        }
        cout << c;
}




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

using namespace std;

void solve()
{
	string str;
	cin >> str;
	for(int i = str.size() - 1; i >= 0; --i)
	{
		cout << str[i];
	}
	cout << endl;
}

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

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

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> c(n);
    int a[n][m];
    rep(i,n){
        cin >> c[i];
        rep(j,m){
            cin >> a[i][j];
        }
    }
    int ans = inf;
    for(int i=0; i<(1<<n); i++){
        ll tot = 0;
        ll b[m];
        rep(k,m) b[k] = 0;
        for(int j=0; j<n; j++){
            if(i & (1<<j)){
                rep(k,m){
                    b[k]+=a[j][k];
                }
                tot += c[j];
            }
        }
        rep(k,m){
            if(b[k]<x) break;
            if(k==m-1){
                ans = min(ll(ans),tot);
                //cout << i << " " << tot << endl;
            }
        }
    }
    if(ans == inf){
        cout << -1 << endl;
    }
    else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <stdio.h>
using namespace std;

int main() {
  int A,B;
  cin >> A >> B;
  int maxN,minN;
  maxN = B + (A-1);
  if(maxN > 1000000) maxN = 1000000;
  minN = B - (A-1);
  if(minN < -1000000) minN = -1000000;
  
  for(int i = minN; i<=maxN; ++i) cout << i << " ";
  cout << endl;
}	

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
public static void main(String[] args){

 int a;
 int b;
int c;
Scanner s = new Scanner(System.in);
a=s.nextInt();
b=s.nextInt();
c=s.nextInt();

if(a<b&b<c){ System.out.println("Yes");}
else{System.out.println("No");}
}}



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

using namespace std;

int main(){
    int a , b; cin >> a >> b;
    if(b < 10) a = a * 10 + b;
    else if(b < 99) a = a * 100 + b;
    else if(b == 100) a= a * 1000 + b;
    int k = sqrt((double)a);
    
    if(k * k == a) cout << "Yes" << endl;
    else cout << "No" << endl;
}



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

 long long LCM(long long a,long long b){
	 long long r,x;
	 if(a<b) swap(a,b);
	 r=a%b;
	 x=a*b;
	 while(r!=0){
		 a=b;
		 b=r;
		 r=a%b;
	 }
	return x/b;
}

int MOD=1000000007;
int main(void){
	long long  A,B,L;
	cin >> A >> B;
	L=LCM(A,B);
	cout << L << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q; cin >> n >> q;
    vector<vector<int> > graph(n);
    rep (_, n - 1) {
        int a, b; cin >> a >> b; a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vector<ll> c(n);
    rep (_, q) {
        int p, x; cin >> p >> x; p--;
        c[p] += x;
    }
    priority_queue<int> que; que.push(0);
    vector<int> used(n); used[0] = true;
    while (!que.empty()) {
        int p = que.top(); que.pop();
        for (int i : graph[p]) {
            if (used[i]) continue;
            used[i] = true;
            c[i] += c[p];
            que.push(i);
        }
    }
    rep (i, n) cout << c[i] << (i != i_len ? ' ' : '\n');
    return 0;
}

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

int main()
{
	string s1,s2;
	cin >> s1 >>s2;
	int ans = 0;
	for(int i = 0;i < 3;i++){
		if(s1[i] == s2[i]) ans++;
	}
	cout << ans <<endl;
	return 0;
}

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

int main()
{
    int i=0;
    int n=0,k=0;
    int h[10000000];
    int result = 0;

    scanf("%d %d",&n,&k);

    while(i < n)
    {
        
        if(i < n-1)scanf("%d ",&h[i]);
        else scanf("%d",&h[i]);
        if(h[i] >= 1 && h[i] <= 500){
            if(h[i] >= k) result++;
            else{}
        }
        i++;
    }

    printf("%d\n",result);

    return 0;
    
}

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

using namespace std;

typedef long long ll;

int main()
{
  ll n;
  cin >> n;
  ll minn = 1e13L;
  for(ll i=1; i*i<=n; ++i)
  if (n%i==0)
  {
    ll sum = (i-1) + (n/i -1);
    minn= min(minn,sum);
  }
  cout << minn;
  return 0;
}

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

using namespace std;

vector<int> split(const string &s, char delim) {
  vector<int> elems;
  stringstream ss(s);
  string item;
  while (getline(ss, item, delim)) {
    if (!item.empty()) {
      elems.push_back(stoi(item));
    }
  }
  return elems;
}


int main() {
  int n;
  cin >> n;
  cin.ignore();
  string tline;
  getline(cin, tline);
  vector<int> tvec;
  tvec = split(tline, ' ');
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int p, x;
    cin >> p >> x;
    int sum = 0;
    for (int j = 0; j < tvec.size(); ++j) {
      if (j == p - 1) {
        sum += x;
      }
      else {
        sum += tvec[j];
      }
    }
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m) = readLine()?.split(" ")?.map { it.toInt() } ?: return
    val tryCount = Math.pow(2.0, m.toDouble()).toLong()
    val result = (100 * (n - m) * tryCount) + (1900 * m * tryCount)
    println(result)
}

Measured memory_bytes: 37692