akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	ll mx = -INF, mi = INF;
	int mxp = -1, mip = -1;
	rep(i,n){
		cin >> a[i];
		if(mx < a[i]){
			mx = a[i];
			mxp = i;
		}
		if(a[i] < mi){
			mi = a[i];
			mip = i;
		}
	}
	cout << 2*(n-1) << endl;
	if(abs(mx) >= abs(mi)){
		for(int i = 1; i < n; ++i){
			a[i] += mx * 2;
			mx = a[i];
			cout << mxp + 1 << " " << i+1 << endl;
			cout << mxp + 1 << " " << i+1 << endl;
			mxp = i;
		}
	}
	else{
		for(int i = n-2; i >= 0; --i){
			a[i] += mi * 2;
			mi = a[i];
			cout << mip + 1 << " " << i+1 << endl;
			cout << mip + 1 << " " << i+1 << endl;
			mip = i;
		}
	}
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

#define pi 3.14159265359

int main(){
    double a, b, x;
    cin >> a >> b >> x;
    double full = (a*a) * b;
    if(x >= full / 2){
        double theta = atan(2*(full-x) / (a*a*a));
        double ans = theta * 180 / pi;
        printf("%.10f", ans);
    }else{
        double theta = pi/2 - atan(2*x/(a*b*b));
        double ans = theta * 180 / pi;
        printf("%.10f", ans);
    }
    return 0;
}

Measured memory_bytes: 3984
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll n; cin>>n;
	ll m; cin>>m;
	cout<<n*(n-1)/2+m*(m-1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

struct probst {
  int failed  = 0;
  int time    = 0;
  bool solved = 0;
};

void solve() {
  int M, T, P, R;
  while (cin >> M >> T >> P >> R, M) {
    using vps = vector<probst>;
    vector<vps> v(T, vps(P));
    while (R--) {
      int m, t, p, j;
      cin >> m >> t >> p >> j;
      t--;
      p--;
      probst ps = v[t][p];
      ps.solved |= !j;
      ps.failed += !!j;
      ps.time = ps.solved ? m : ps.time;
      v[t][p] = ps;
    }
    vpii w(v.size());
    rep(i, v.size()) {
      int s = 0;
      rep(j, P) {
        probst ps = v[i][j];
        if (ps.solved) {
          s += 50000 - ps.time - ps.failed * 20;
        }
      }
      w[i].fi = s;
      w[i].se = i + 1;
    }
    sort(rall(w), [](pii a, pii b) {
      if (a.fi < b.fi) return true;
      if (a.fi > b.fi) return false;
      if (a.se < b.se) return true;
      if (a.se > b.se) return false;
    });
    cout << w[0].se;
    loop(i, 1, w.size()) {
      cout << (w[i].fi == w[i - 1].fi ? '=' : ',');
      cout << w[i].se;
    }
    cout << endl;
  }
}

Measured memory_bytes: 3096
import math
def hoge(a):
    return a*a
    
a, b, angle = map(float, input().split())
angle = math.radians(angle)
print (a*b*math.sin(angle) / 2)
print (a+b+math.sqrt(hoge(a) + hoge(b) - 2*a*b*math.cos(angle)))
print(a*b*math.sin(angle)/a)


Measured memory_bytes: 5696
#include <stdio.h>

char A[55][55];
char B[55][55];

int main() {

	int N,M;

	scanf("%d %d",&N,&M);

	int i, j, k, m;

	for (i = 0; i < N; i++) {
		scanf("%s",&A[i]);
	}
	for (i = 0; i < M; i++) {
		scanf("%s",&B[i]);
	}


	for (i = 0; i <= N - M; i++) {
		for (j = 0; j <= N - M; j++) {
			int score = 0;

			for (k = 0; k < M; k++) {
				for (m = 0; m < M; m++) {
					if (A[i + k][j + m] == B[k][m]) { score++; }
				}
			}
			if (score == M*M) { printf("Yes\n"); return 0; }
		}
	}
	printf("No\n");

	return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	
	for(int a = 1; a < 10; a++) {
		for(int b = 1; b < 10; b++) {
			if(n == a*b) {
				cout << "Yes\n";
				return 0;
			}
		}
	}
	
	cout << "No" << endl;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {

    auto N = readln.chomp.to!long;

    auto a = readln.split.to!(long[]);

    foreach (i; 1..N) {
        a[i] += a[i-1];
    }

    auto s = a.back;


    a[0..$-1].map!(a => abs(a * 2 - s)).reduce!min.writeln;
}



Measured memory_bytes: 11392
n,k = tuple(map(int,input().split()))

d = {}
for i in range(n):
  a,b = tuple(map(int,input().split()))
  d.setdefault(a,0)
  d[a]+=b
  
l = sorted(d.items())

t = 0
for a,b in l:
  t+=b
  if t>=k:
    print(a)
    break
  
  


Measured memory_bytes: 14552
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	
#include<list>

constexpr auto PI = 3.14159265359;

using namespace std;

int make_partition(vector<int>& A, int r) {
	int x = A[r];
	int j = 0;
	for (int i = 0; i < A.size(); ++i) {
		if (A[i] <= x) {
			swap(A[j], A[i]);
			++j;
		}
	}
	return j - 1;
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	int reference_element = make_partition(A, A.size() - 1);
	for (int i = 0; i < reference_element; ++i) {
		cout << A[i] << " ";
	}
	cout << "[" << A[reference_element] << "] ";
	for (int i = reference_element + 1; i < N - 1; ++i) {
		cout << A[i] << " ";
	}
	cout << A[A.size() - 1] << endl;

	return 0;
}


Measured memory_bytes: 3268
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#include <cmath>
#include <cstdlib>
#include <climits>

//#include <stdio.h>
//#include <stdlib.h>


using namespace std;

#define debug false

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

  int N;
  cin >> N;
  printf("%d\n", N/3);

  return 0;
}


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

signed main(void)
{
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	int s[h][w];
	rep(i, h)
	{
		rep(j, w)
		{
			if (i < b && j < a)
				s[i][j] = 0;
			else if (i < b)
				s[i][j] = 1;
			else if (j < a)
				s[i][j] = 1;
			else
				s[i][j] = 0;
		}
	}
	rep(i, h) 
	{
		rep(j, w)
			cout << s[i][j];
		cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 5120
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    if(n==1||n==2){
        cout<<"No"<<endl;
        return 0;
    }
    if(n%4==3){
        cout<<"Yes"<<endl;
        rep(i,2*n-1){
            cout<<i+1<<" "<<i+2<<endl;
        }
    }
    if(n%4==2){
        int m = n/4;
        cout<<"Yes"<<endl;
        rep(i,4*m-2){
            cout<<i+1<<" "<<i+2<<endl;
            cout<<n+i+1<<" "<<n+i+2<<endl;
        }
        cout<<4*m-1<<" "<<n+1<<endl;
        cout<<4*m<<" "<<1<<endl;
        cout<<4*m+1<<" "<<4*m<<endl;
        cout<<1<<" "<<4*m+1+n<<endl;
        cout<<4*m+1+n<<" "<<4*m+n<<endl;
        cout<<4*m+2<<" "<<2<<endl;
        cout<<4*m+n+2<<" "<<4*m+1+n<<endl;
    }
    if(n%4==1){
        int m = n/4;
        cout<<"Yes"<<endl;
        rep(i,4*m-2){
            cout<<i+1<<" "<<i+2<<endl;
            cout<<n+i+1<<" "<<n+i+2<<endl;
        }
        cout<<4*m-1<<" "<<n+1<<endl;
        cout<<4*m<<" "<<1<<endl;
        cout<<4*m+1<<" "<<4*m<<endl;
        cout<<1<<" "<<4*m+1+n<<endl;
        cout<<4*m+1+n<<" "<<4*m+n<<endl;
    }
    if(n%4==0){
        int m = n/4;
        if((n^(n-1))>n){
            cout<<"No"<<endl;
            return 0;
        }
        cout<<"Yes"<<endl;
        rep(i,4*m-2){
            cout<<i+1<<" "<<i+2<<endl;
            cout<<n+i+1<<" "<<n+i+2<<endl;
        }
        cout<<4*m-1<<" "<<n+1<<endl;
        cout<<4*m<<" "<<n-2<<endl;
        cout<<4*m+n<<" "<<(n^(n-1))<<endl;
    }
    return 0;
}

Measured memory_bytes: 2816
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int a = sc.nextInt();
   int b = sc.nextInt();
 
   if(a%2==1&&b%2==1)System.out.println("Odd");
   else System.out.println("Even");
 }
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {

    public static void main(String args[]) {


        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int n = scan.nextInt();
        List<Integer> list = new ArrayList<>();

        for (int i = 0; i<n; i++ ) {
            int p = scan.nextInt();
            list.add(p);
        }

        for (int j = 0; j<=100; j++) {
            if (!list.contains(x -j)) {
                System.out.println(x - j);
                return;
            }
            if (!list.contains(x + j)) {
                System.out.println(x +j);
                return;
            }
        }
    }
}

Measured memory_bytes: 36008
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    cin >> N;
    cout << "ABC" << N << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

// #define DEBUG 100

using namespace std;
using ll = unsigned long long;
using pii = pair<int, int>;

const int oo = 1e9 + 7;
const ll mod = 1e9 + 7,maxn = 100010;
const double PI = acos(-1);
vector<pii> seg[4*maxn];
vector<ll> fat(maxn, -1), inv(maxn, -1);
vector<ll> v(maxn + 1);

ll fexp(ll base, ll p){
    ll ans = 1;

    while (p){
        if(p&1) ans = (ans * base)%mod;
        base = (base * base)% mod;
        p = p >> 1;
    }
    return ans;
}

void init(){
    fat[0] = fat[1] = inv[1] = 1;
    for (ll i=2; i<maxn; i++){
        fat[i] = (fat[i-1] * i)%mod;
        inv[i] = fexp(fat[i], mod-2);
    }
}

ll combina(ll n, ll k){
    if (n == k || k == 0) return 1;
    if (n < k) return 0;

    return (((fat[n] * inv[k])%mod)*inv[n - k])%mod;
}

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    int n;
    cin >> n;
    cout << (n-1)/2 + 1 << endl;
    return 0;
}

Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
#define int long long
template <class Q>
void clearQueue(Q & q) {
    q = Q();
}
int dp[100005][102];
int func(vector<int>&wt,vector<int>&val,int w,int n,int idx){
	if(idx==-1) return 0;
	if(dp[w][idx]!=-1) return dp[w][idx];
	int op1=-1,op2=-1;
	if(w>=wt[idx]){
		op1=func(wt,val,w-wt[idx],n,idx-1)+val[idx];
	}
	op2=func(wt,val,w,n,idx-1);
	return dp[w][idx]=max(op1,op2);
}
void solve(){
	memset(dp,-1,sizeof(dp));
	int n,w;cin>>n>>w;
	vector<int>wt(n),val(n);
	for(int i=0;i<n;i++) cin>>wt[i]>>val[i];
	cout<<func(wt,val,w,n,n-1);
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 83328
#include <bits/stdc++.h>
using namespace std;
const int N=100010;
int a[N],b[N];
map<int,int> mp; 
int main()
{
	int n,k,q;
	cin >>n>>k>>q;
	for(int i=1;i<=n;i++) a[i]=k,a[i]-=q; 
	for(int i=0;i<q;i++)
	{
		int x;
		cin >>x;
		mp[x]++;
	}
	for(int i=1;i<=n;i++) 
	{
		a[i]+=mp[i];
		if(a[i]<=0) printf("No\n");
		else printf("Yes\n");
	}
}

Measured memory_bytes: 5760
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

int[] X;
char[] Y;
void input() {
    X = readln.chomp.split(" ").map!(to!int).array;
    Y = cast(char[])(readln.chomp.split(" ").map!"a[0]".array);
}

void solve() {
    auto used = new bool[9];
    bool dfs() {
        foreach (i; 0 .. 9) {
            foreach (j; 0 .. 9) {
                foreach (k; 0 .. 9) {
                    if (i == j || j == k || k == i) continue;
                    if (used[i] || used[j] || used[k]) continue;
                    if (X[i] + 1 == X[j] && X[j] + 1 == X[k] &&
                            Y[i] == Y[j] && Y[j] == Y[k]) {
                        used[i] = used[j] = used[k] = true;
                        if (dfs) return true;
                        used[i] = used[j] = used[k] = false;
                    }
                }
            }
        }
        foreach (i; 0 .. 9) {
            foreach (j; 0 .. 9) {
                foreach (k; 0 .. 9) {
                    if (i == j || j == k || k == i) continue;
                    if (used[i] || used[j] || used[k]) continue;
                    if (X[i] == X[j] && X[j] == X[k] &&
                            Y[i] == Y[j] && Y[j] == Y[k]) {
                        used[i] = used[j] = used[k] = true;
                        if (dfs) return true;
                        used[i] = used[j] = used[k] = false;
                    }
                }
            }
        }
        return used.count(true) == 9;
    }
    writeln(cast(int)(dfs));
}
 
void main() {
    int T; scanf("%d\n", &T);
    foreach (t; 0 .. T) {
        input; solve;
    }
}

Measured memory_bytes: 1140
#include <stdio.h>
#include <math.h>
 
int main(void){
    double x1,y1,x2,y2,sd;
    scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
    sd=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    printf("%lf\n",sqrt(sd));
    return 0;
}

Measured memory_bytes: 652
S=input()
K=int(input())

def f(s):
  i=0
  c=0
  n=len(s)
  if n==1:
    return 0
  else:
    while i<n-1:
      if s[i]==s[i+1]:
        c+=1
        i+=2
      else:
        i+=1
    return c

a=0
n=len(S)
while a<n-1 and S[0]==S[a+1]:
  a+=1
  
b=-1
while a<n-1 and S[0]==S[b]:
  b-=1
  
if a==n-1:
  ans=n*K//2
elif b==-1:
  ans=f(S)*K
elif a==0 and b!=-1:
  ans=(K-1)*((-b-1)//2)+K*f(S[1:b+1])+(-b-1)//2
elif a!=0 and b!=-1:
  ans=(a+1)//2+f(S[a+1:b+1])*K+((a-b)//2)*(K-1)+(-b-1)//2
  
print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

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

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n;
    cin >> n;

    vector<P> res;

    for (int i = 1; i <= n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (i + j != n + ((n + 1) % 2))
                res.push_back({i, j});
        }
    }

    cout << res.size() << endl;

    for (auto i : res)
    {
        cout << i.first << " " << i.second << endl;
    }

    return 0;
}

Measured memory_bytes: 384
from collections import defaultdict
import numpy as np
def main():
    s = input()
    n = len(s)
    d = np.zeros(2019,np.int64)
    ans = 0
    num = 0
    pow10 = 1
    d[0] = 1
    for i in reversed(range(n)):
        pow10 = pow10 * 10 % 2019
        num += int(s[i]) * pow10
        #print(num, num % 2019, i)
        mod = num % 2019
        ans += d[mod]
        d[mod] += 1
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 27184
import java.util.*;
import java.util.stream.IntStream;

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

    public static void main(String[]$) {
        int h = scanner.nextInt();
        int w = scanner.nextInt();
        char[][] s = IntStream.range(0, h).mapToObj(i -> scanner.next().toCharArray()).toArray(char[][]::new);
        int[][] a = new int[h][w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (s[i][j] != '#') {
                    a[i][j] = j == 0 ? 1 : a[i][j - 1] + 1;
                }
            }
            for (int j = w - 2; j >= 0; j--) {
                if (s[i][j] != '#') {
                    a[i][j] = Math.max(a[i][j], a[i][j + 1]);
                }
            }
        }
        int[][] b = new int[h][w];
        for (int j = 0; j < w; j++) {
            for (int i = 0; i < h; i++) {
                if (s[i][j] != '#') {
                    b[i][j] = i == 0 ? 1 : b[i - 1][j] + 1;
                }
            }
            for (int i = h - 2; i >= 0; i--) {
                if (s[i][j] != '#') {
                    b[i][j] = Math.max(b[i][j], b[i + 1][j]);
                }
            }
        }
        long ans = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                ans = Math.max(ans, a[i][j] + b[i][j] - 1);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 82916
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

int main() {

    ll a, b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;
    

    //cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (long long 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(n);
  rep(i,n){
    cin >> vec.at(i);
  }
  int sum1, sum2;
  sum1 = 0;
  sum2 = 0;
  rep(i,n){
    sum1 += vec.at(i);
  }
  rep(i,n){
    sum2 += vec.at(i) * vec.at(i);
  }
  cout << (sum1 * sum1 - sum2) / 2;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
#define pb push_back
int main(void){
    ll x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x;
        return 0;
    }
    vector<ll>p(n);
    rep(0,i,n){
        cin>>p[i];
    }
    sort(p.begin(),p.end());
    ll c=0,m=1000,ans;
    rep(0,i,110){
        if(p[c]==i&&c<n){
            ++c;
        }else{
            if(m>abs(x-i)){
                ans=i;
                m=abs(x-i);
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N; cin >> N;
  ll u, v, w;
  vector<vector<int>> t(N);
  vector<vector<int>> c(N);
  rep(i,N-1){
    cin >> u >> v >> w;
    u--; v--; w%=2;
    t[u].pb(v);
    t[v].pb(u);
    c[u].pb(w);
    c[v].pb(w);
  }
  vector<int> D(N,-1);
  vector<bool> chk(N, false);
  priority_queue<pair<int,int>,vector<pair<int,int>>, greater<pair<int,int>>> q;
  q.push({0,0});
  while(!q.empty()){
    int d = q.top().first; int to = q.top().second; q.pop();
    if(chk[to]) continue;
    chk[to] = true;
    D[to] = d;
    rep(i,(int)t[to].size()){
      if(D[t[to][i]] != -1 && D[t[to][i] <= D[to]+c[to][i]]) continue;
      q.push({D[to]+c[to][i], t[to][i]});
    }
  }
  rep(i,N){
    cout << D[i]%2 << endl;
  }
  return 0;
}


Measured memory_bytes: 11904
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
ll a[maxn];
ll b[maxn];
int main() {
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	ll sum = 1000;
	//b[cnt++] = a[1];
	for(int i=1;i<n;i++){
		if(a[i+1]>a[i]){
			sum = (sum%a[i]+sum/a[i]*a[i+1]);
		}else {
			continue;
		}
	}
//	b[cnt] = a[n];
//	ll sum = 1000;
//	for(int i=1;i<=n;i++){
//		if(a[i]<a[i+1]){
//			sum = (sum/a[i])*a[i+1];
//		}else{
//			continue;
//		}
//	} 
	cout<<sum<<endl;
    return 0;
}



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

using namespace std;

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


Measured memory_bytes: 3624
#include<iostream>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MOD = 1000000007;
const ll INF = 1LL << 60;
int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   int x;
   cin >> x;
   cout << 10-x/200 << endl;
}

Measured memory_bytes: 3648
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep_1(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
inline int read()
{
	int num=0, w=0;
	char ch=0;
	while (!isdigit(ch))
	{
		w|=ch=='-';
		ch = getchar();
	}
	while (isdigit(ch))
	{
		num = (num<<3) + (num<<1) + (ch^48);
		ch = getchar();
	}
	return w? -num: num;
}
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
const int N=100100;
int n;
int f[N];
void solve()
{
	int n;
	cin>>n;
	int limit=sqrt(n)+1;
	for(int x=1;x<=limit;x++)
		for(int y=1;y<=limit;y++)
			for(int z=1;z<=limit;z++)
			{
				int  res=x*x+y*y+z*z+x*y+x*z+y*z;
				f[res]++;
			 } 
	for(int i=1;i<=n;i++)
		cout<<f[i]<<endl;
}
signed main()
{
	int t=1;
	while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 3752
from math import sqrt

n = int(input())

out = [str(n) + ":"]

for i in range(2, int(sqrt(n)) + 1):
    while n % i == 0:
        n //= i
        out.append(str(i))

if n != 1 and n not in out:
    out.append(str(n))

print(" ".join(out))



Measured memory_bytes: 5664
#include<bits/stdc++.h>
using namespace std;
char str[5];
int main()
{
    scanf("%s", str);
    if(str[0]==str[1] && str[1]==str[2] && str[0]=='R')puts("3");
    else if((str[0]==str[1] && str[0]=='R')||(str[2]==str[1] && str[2]=='R'))puts("2");
    else if(str[0]=='R' || str[1]=='R' || str[2]=='R')puts("1");
    else puts("0");
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int x, a;
  a = n / 111;
  if(n % 111 == 0) {
    cout << n << endl;
  } else {
    cout << 111 * (a + 1) << endl;
  }
  return 0; 
}


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

int main() {
    int n, m;
    cin >> n >> m;
    int l[m],r[m];
    for (int i = 0; i < m; i++) {
        cin >> l[i] >> r[i];
    }

    int lmax = l[0];
    int rmin = r[0];
    for (int i = 1; i < m; i++) {
        if (lmax < l[i]) {
            lmax = l[i];
        }
        if (rmin > r[i]) {
            rmin = r[i];
        }
    }
    cout << max(rmin - lmax + 1,0) << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <unordered_map>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <deque>
#include <map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	cout << min(n % k, k - n % k);
	 
	return 0;
}

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

int main(){
    int n,b,mn=10000000,ma=-10000000;
    cin>>n;
    long long ans=0;
    for(int i=0;i<n;i++){
        cin>>b;
        mn=min(mn,b);
        ma=max(ma,b);
        ans+=b;
    }
    cout<<mn<<" "<<ma<<" "<<ans<<endl;
}


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

int main()
{
	int r, d, x2000;


	cin >> r >> d >> x2000;


	for (int i = 0; i < 10; i++) {
		cout << r * x2000 - d << endl;
		
		x2000 = r * x2000 - d;
	}

	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

n = int(input())
words_count = defaultdict(int)

last_word = input()
words_count[last_word] += 1
for _ in range(n - 1):
    word = input()
    if word[0] != last_word[-1]:
        print("No")
        exit()
    if words_count[word] > 0:
        print("No")
        exit()
    words_count[word] += 1
    last_word = word

print("Yes")


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

{
  string N;
  cin>>N;
  if((N[0]==N[1] && N[1]==N[2]) ||(N[1]==N[2] && N[2]==N[3]))
    {
      cout<<"Yes"<<endl;
    }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
import copy

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')

sys.setrecursionlimit(1000000)


ans = 0


def bfs(N, edge, v, search):

    search |= {v}

    global ans
    if len(search) == N:
        ans += 1
        return

    for e in edge[v]:
        if e not in search:
            #print('test:{},{},{}'.format(e, v, search))
            bfs(N, edge, e, copy.copy(search))


def main():

    N, M = in_nn()

    edge = [[] for _ in range(N)]

    for i in range(M):
        a, b = in_nn()
        a, b = a - 1, b - 1
        edge[a].append(b)
        edge[b].append(a)

    bfs(N, edge, 0, set())

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74392
#include<bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
int main(void){
    ll a, b, k;
    cin >> a >> b >> k;
    ll zero = 0;
    if(a >= k){cout << a-k << " " << b << endl; return 0;}
    else {cout << 0 << " " << max(zero, b-(k-a)) << endl; return 0;}
}


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

const int INF = 1001001001;
//const ll INF = 1000000000000000000;

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

	int ans = 0;
	for (int x = 1; x <= n; x+=2) {
		int cnt = 0;
		for (int i = 1; i <= x; i++) {
			if (x % i == 0) cnt++;
			if (cnt > 8) break;
		}
		if (cnt == 8) ans++;
	}
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#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;

  cout << ((n+1)/2) << endl;
}


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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... Args> void rd(Args&... args) {((cin >> args), ...);}
template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    if(n%2==0){
        int m2=m/2,m1=m-m2;
        for1(i,m1) write(i,m1*2+1-i);
        int d=m1*2;
        for1(i,m2) write(d+i,d+m2*2+2-i);
    }else{
        for1(i,m) write(i,m*2+1-i);
    }
    return 0;
}



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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> cnt(2 * M);
  for (int i = 0; i < 2 * M; i++) {
    cin >> cnt.at(i);
  }
  vector<int> count(N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2 * M; j++) {
      if (i + 1 == cnt.at(j)) count.at(i)++;
    }
  }
  for (int i = 0; i < N; i++) cout << count.at(i) << endl;
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;

    if (10 > a + b) {
        cout << (a + b);
    } else {
        cout << "error";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long INT;
double PI = 3.14159265;


const long long INF = 1LL << 60;

int main() {
    int n, m, a,sum=0;

    cin >> n>>m;

    rep(i, m) {
        cin >> a;
        sum += a;
    }
    
    if (sum > n)cout << -1 << endl;
    else cout << n - sum << endl;

    return 0;
}

Measured memory_bytes: 3632
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections


def solve(N: int, M: int, A: "List[int]"):
    C = itertools.accumulate(A)
    C = [0] + [c%M for c in C]
    C = collections.Counter(C)
    ret = 0
    for v in C.values():
        ret += v*(v-1) // 2
    print(ret)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 24444
#include<bits/stdc++.h>
#define ll long long
#define rgi register int
#define rgl register ll
#define int ll
#define maxn 1000005
#define mod 10007LL
#define inf 1000000007LL
namespace lib
{
	using namespace std;
	class fastio
	{
		private:
			#define _NUMLEN 111
			char _num[_NUMLEN],_ch;
			int _f,_head;
			bool _useSTD;
		public:
			inline void ioSTD()
			{
				_useSTD=1;
				ios::sync_with_stdio(false);
				cin.tie(0),cout.tie(0);
			}
			inline void gc(char & _c)
			{
				if(_useSTD)cin>>_c;
				else _c=getchar();
			}
			inline void pc(char _c)
			{
				if(_useSTD)cout<<_c;
				else putchar(_c);
			}
			template<typename _T> inline fastio & operator - (_T & _x)
			{
				if(_useSTD)cin>>_x;
				else
				{
					_x=0;
					while(!isdigit(_ch)) _f|=_ch=='-',gc(_ch);
					while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),gc(_ch);
					_f&&(_x=-_x,_f=0);
				}
				return *this; 
			}
			template<typename _T> inline fastio & operator + (_T _x)
			{
				if(_useSTD)cin>>_x;
				else
				{
					_T _k;
					if(_x==0) {pc('0'),pc(' ');return *this;}
					if(_x<0) pc('-'),_x=-_x;
					while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
					while(_head>0) pc(_num[_head]),--_head;
					pc(' ');
				}
				return *this; 
			}
			template<typename _T> inline fastio & operator >> (_T & _x) {cin>>_x;return *this;}
			template<typename _T> inline fastio & operator << (_T _x) {cout<<_x;return *this;}
			#define endln pc('\n')
		fastio() {_f=0,_head=0,_useSTD=0,_ch=' ';}
	}io;
	inline void fileio(string _r,string _w)
	{
		if(_r[0]!='-')freopen(_r.c_str(),"r",stdin);
		if(_w[0]!='-')freopen(_w.c_str(),"w",stdout);
	}
	#define mem(_x,_set) memset(_x,_set,sizeof(_x))
}using namespace lib;

signed main()
{
//	fileio("tt.in","tt.out");
//	io.ioSTD();
	ll n,a,b;
	io-n-a-b;
	if((b-a)%2==0)
		io+(b-a)/2;
	else
		io+min((a+b-1)/2,(n-a+n-b+1)/2);
	return 0;
}

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

int h, w;
char s[23][25];
int did[23][25];
int ans = 0;

void step(int x, int y,int num) {
	if (s[x][y] == '#') {
		return;
	}
	if (did[x][y] <= num) {
		return;
	}
	did[x][y] = num;
	step(x + 1, y, num + 1);
	step(x - 1, y, num + 1);
	step(x, y + 1, num + 1);
	step(x, y - 1, num + 1);
	return;
}

/*
5 5
.###.
.....
###..
....#
....#
*/

void allfalse(void) {
	int i, j;
	for (i = 0; i < 23; i++) {
		for (j = 0; j < 25; j++) {
			did[i][j] = 500;
		}
	}
}

void calc(void) {
	int i, j;
	for (i = 1; i <= h; i++) {
		for (j = 1; j <= w; j++) {
			if (did[i][j] != 500) {
				ans = max(ans, did[i][j]);
			}
		}
	}
}

int main()
{
	int i, j;
	int ii, jj;
	string in;

	cin >> h >> w;
	for (i = 1; i <= h; i++) {
		cin >> in;
		s[i][0] = '#';
		for (j = 1; j <= in.length(); j++) {
			s[i][j] = in[j - 1];
		}
		s[i][j] = '#';
		s[i][j + 1] = NULL;
	}
	for (i = 0; i <= w + 1; i++) {
		s[0][i] = '#';
		s[h + 1][i] = '#';
	}
	s[0][i] = s[h + 1][i] = NULL;

	for (i = 1; i <= h; i++) {
		for (j = 1; j <= w; j++) {
			if (s[i][j] == '.') {
				allfalse();
				step(i, j, 0);
				calc();
			}
		}
	}

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


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdio>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
    int x[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin >> K;
    cout << x[K-1];
    
    return 0;
}


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

using namespace std;

int main()
{
  vector<int> v;

  for (int i = 0; i < 3; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }

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

  cout << v[0] + v[1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror

#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率
ll mod = 1e9 + 7;


//提出コード↓




int a, b, c, d;

int main() {

	cin >> a >> b >> c >> d;
	bool cnt = true;
	while (a > 0 && c > 0) {
		if (cnt) {
			c -= b;
			cnt = false;
		}
		else {
			a -= d;
			cnt = true;
		}
	}
	if (a > c) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 3624
import sys
input = sys.stdin.readline

def main():
    #1:初期化
    N = int(input())
    h = list(map(int, input().split()))
    #h = [int(x) for x in input().split()]
    inf = float("inf")
    dp = [inf]*(N)

    #2:初期値
    dp[0] = 0

    #3:dp実行部(貰うDP)
    for i in range(1,N):
        dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
        if(i>1): #2つ目の足場には二個前の足場がないので．
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

    # #3:dp実行部(配るDP)
    # for i in range(N):
    #     if(i+1<N):
    #         dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]))
    #     if(i+2<N):
    #         dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]))

    #4:出力
    print(dp[N-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 13716
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	vector<int> n(3);
	for (int i = 0; i < 3; i++) {
		cin >> n[i];
	}
	ssort(n);
	cout << n[0] + n[1];

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
X,Y = 0,0
dp = [[0] * (N+1) for i in range(N+1)]
# dp[i][j] ans = dp[1][N]
for i in range(1,N+1):
    if N % 2 == 1:
        dp[i][i] = a[i-1]
    else:
        dp[i][i] = -a[i-1]
for i in range(N-1,0,-1):
    for j in range(1,N+1):
        if i >= j: continue
        if (j - i) % 2 != N % 2:
            dp[i][j] = max(a[i-1] + dp[i+1][j],a[j-1] + dp[i][j-1])
        else:
            dp[i][j] = min(-a[i-1] + dp[i+1][j],-a[j-1] + dp[i][j-1])
print(dp[1][N])

Measured memory_bytes: 113372
# include <iostream>
# include <stdio.h>
# include <cstring>
# include <string>
# include <cctype>
#include <algorithm> //transformの関数はaslgorithmライブラリに入っているみたい。
using namespace std;
int main(){
  string str,temp;
  int m;
  int h;
  while(cin >> str){
    if(str == "-"){
      break;
    }
    cin >> m;
    for(int i = 0;i<m;i++){
      cin >> h;
      temp = str.substr(0,h);
      str.erase(0,h);
      str = str + temp;
    }
    cout << str << endl;
  }
  return 0;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
int main()
{
     int n,i,p=0;
     cin>>n;
     vector<pair<int,int> >v(n);
     for(i=0;i<n;i++)
     {
         cin>>v[i].first>>v[i].second;
     }
     for(i=0;i<n-2;i++)
     {
         if(v[i].first==v[i].second&&v[i+1].first==v[i+1].second&&v[i+2].first==v[i+2].second)
            p=1;
     }
     if(p==1)
        cout<<"Yes";
     else
        cout<<"No";
   return 0;
}



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

using namespace std;

class Stack{
  private:
    int top;
    int N_MAX;
    int* data;

  public:
    Stack(int N=1000){
      this->top = 0;
      this->N_MAX = N;
      this->data = new int [this->N_MAX];
    };

    ~Stack(){
      delete [] this->data;
    };

    bool isEmpty();
    bool isFull();
    void push(int x);
    int pop();
};

bool Stack::isEmpty(){
  if(this->top > 0){
    return false;
  }else{
    return true;
  }
}

bool Stack::isFull(){
  if(this->top >= N_MAX-1){
    return true;
  }else{
    return false;
  }
}

void Stack::push(int x){
  if( !this->isFull() ){
    data[this->top+1] = x;
    this->top = this->top + 1;
  }else{
    cout << "Full!" << endl;
  }
}

int Stack::pop(){
  if( !this->isEmpty() ){
    this->top = this->top - 1;
    return data[this->top+1];
  }else{
    cout << "Empty" << endl;
    return 0;
  }
}


int main(void){
  
  int a, b;
  char s[100];

  Stack stack = Stack();

  while(scanf("%s", s) != EOF){
    if( s[0] == '+' ){
      a = stack.pop();
      b = stack.pop();
      stack.push(a+b);
    }else if( s[0] == '-' ){
      a = stack.pop();
      b = stack.pop();
      stack.push(b-a);
    }else if( s[0] == '*' ){
      a = stack.pop();
      b = stack.pop();
      stack.push(a*b);
    }else{
      stack.push( atoi(s) );
    }
  }
  cout << stack.pop() << endl;

  return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using vi = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vii = vector<ii>;
using vvii = vector<vii>;

constexpr int INF = 2000000000;
constexpr ll LLINF = 9000000000000000000;
constexpr ll MOD = 1000000007;

ll pm(ll a, ll b) {
	if (b == 0) return 1LL;
	if (b == 1) return a;
	ll r = pm((a * a) % MOD, b/2);
	if (b&1) r = (r * a) % MOD;
	return r;
}

vi fac, faci;
void cfac(int n) {
	fac.push_back(1LL);
	faci.push_back(1LL);
	while ((int)fac.size() <= n) {
		fac.push_back(fac.back() * ll(fac.size()) % MOD);
		faci.push_back(pm(fac.back(), MOD - 2));
	}
}
ll nCk(int n, int k) {
	if (n < k) return 0LL;
	ll r = fac[n];
	r = (r * faci[k]) % MOD;
	r = (r * faci[n - k]) % MOD;
	return r;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	vi a(n+1, 0LL);
	for (ll &v : a) cin >> v, --v;
	
	int l = -1, r = -1;
	{
		vi p(n, -1LL);
		for (int i = 0; i < n+1; ++i)
			if (p[a[i]] == -1LL)
				p[a[i]] = i;
			else {
				l = p[a[i]];
				r = i;
			}
	}

	cfac(n+1);

	vi ans(n+2, 0LL);
	for (int i = 1; i <= n+1; ++i)
		ans[i] = nCk(n+1, i);

	int elem = l + (n+1 - r  - 1);
	for (int i = 1; i <= n+1; ++i) {
		ans[i] = (ans[i] + MOD - nCk(elem, i - 1)) % MOD; 
		cout << ans[i] << '\n';
	}
	
	return 0;
}

Measured memory_bytes: 4976
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++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; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};


int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int n;
    string a,b,c;
    cin >> n >> a >> b >> c;
    int ans = 0;
    rep(i,n){
      set<int> s;
      s.insert(a[i]);
      s.insert(b[i]);
      s.insert(c[i]);
      ans += s.size()-1;
    }
    print(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define PB push_back
using namespace std;
int main(){
    ll N,K;
    ll T[100000];
    cin>>N>>K;
    FOR(i,0,N){
        cin>>T[i];
    }
    ll S=T[N-1]-T[0];
    vector<ll> V;
    FOR(i,1,N){
        V.PB(T[i]-T[i-1]);
    }
    sort(V.rbegin(),V.rend());
    FOR(i,0,K-1){
        S-=V[i];
    }
    cout<<S+K<<endl;
    return 0;
}


Measured memory_bytes: 4672
n, k = map(int, input().split())
MOD = 998244353
a = [list(map(int, input().split())) for _ in range(k)]

dp = [0] * (n + 1)

dp[0] = 0; dp[1] = 1

for i in range(2, n+1):
    dp[i] = dp[i-1]
    for x, y in a:
        l = i - y; r = i - x
        l = max(l, 0); r = min(r, i-1)
        dp[i] = (dp[i] + (dp[r] - (dp[l - 1] if l > 0 else 0))) % MOD

print((dp[-1] - dp[-2] + MOD) % MOD)


Measured memory_bytes: 69984
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
bool visited[100005];
const int max_N=1e5+10;
ll N,K;
ll X[100005],Y[100005];
ll imos[1005][1005];
ll ans=0;
int c[100005];
int main(void)
{
  cin >> N >> K;
  for (int i = 0; i < N; ++i)
    {
      char color;
      cin >> X[i] >> Y[i] >> color;
      c[i]=(color=='W');
      X[i]=X[i]%(2*K);
      Y[i]=Y[i]%(2*K);
    }
  memset(imos,0,sizeof(imos));
  int blacknum=0;
  for (int i = 0; i < N; ++i)
    {
      c[i]+=X[i]/K + Y[i]/K;
      c[i]%=2;
      X[i]%=K;
      Y[i]%=K;
      imos[Y[i]][X[i]]+=(c[i] ? 1 : -1);
      if(c[i]==0) blacknum++;
    }
  for (int y = 0; y < K; ++y)
    {
      for (int x = 1; x < K; ++x)
	{
	  imos[y][x]+=imos[y][x-1];
	}
    }
  for (int y = 1; y < K; ++y)
    {
      for (int x = 0; x < K; ++x)
	{
	  imos[y][x]+=imos[y-1][x];
	}
    }
  for (int y = 0; y < K; ++y)
    {
      for (int x = 0; x < K; ++x)
	{
	  ll w=imos[K-1][K-1]-imos[y][K-1]-imos[K-1][x]+imos[y][x]*2+blacknum;
	  ans=max(ans,max(w,N-w));
	}
    }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
using ll = long long;


int main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++)cin >> a[i];
    sort(a.begin(),a.end());

    //xxxxxxxoooo
    //k以上のものだけ取ってMを超えれるか? ..(lef, rig]

    ll lef = 0, rig = 1e9;

    while(rig - lef > 1) {
        ll mid = (rig + lef) / 2;
        ll sum = 0;
        for(ll i = 0; i < n; i++)sum += a.end() - lower_bound(a.begin(), a.end(), mid - a[i]);

        (sum >= m ? lef : rig) = mid;
    }
    vector<ll> cum(n + 1);
    for(ll i = 0; i < n; i++)cum[i + 1] += cum[i] + a[i];


    //lefがギリギリ足りない
    ll ans = 0;
    ll num = 0;

    for(ll i = 0; i < n; i++) {
        auto itr = lower_bound(a.begin(), a.end(), rig - a[i]);
        ans += cum[n] - cum[itr - a.begin()] + (a.end() - itr) * a[i];
        num += a.end() - itr;
    }
    ans += lef * (m - num);
    cout << ans << endl;

}

Measured memory_bytes: 4824