akhauriyash/Code-Regression huggingface dataset:
import std.stdio,
       std.string,
       std.conv,
       std.algorithm;

void main() {
  int N = readln.chomp.to!(int);
  int[][] A;
  for (int i = 0; i < 2; i++) {
      A ~= readln.chomp.split.to!(int[]);
  }

  int ans;
  for (int i = 0; i < N; i++) {
    int t, row;
    for (int j = 0; j < N; j++) {
      if (j == i) {
        t += A[row][j];
        row = 1;
      }
      t += A[row][j];
    }
    ans = max(ans, t);
  }

  writeln(ans);
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


public class Main {
    private static int MOD = 1000000007;


    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String str = br.readLine();
        char[] chars = str.toCharArray();

        if(chars[2] == chars[3] && chars[4] == chars[5]) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

}


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

int main()
{

    int N;
    cin >> N;

    long n = 1;
    long x = pow(10, 9) + 7;
    for (int i = 1; i <= N; i++)
    {
        n = n * (i % x);
        n = n % x;
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<queue>
using namespace std;
string s;int len;
int main()
{
	cin>>s;len=s.length();
	if((s[0]==s[len-1]&&len%2==1)||(s[0]!=s[len-1]&&len%2==0))cout<<"Second\n";
	else cout<<"First\n";
 	return 0;
}



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

bool f(int val, int rhs) {
  bool ok = false;
  for (int i = 1; i < 100; i++) {
    if (i*(i+val) == rhs) ok = true;
  }
  return ok;
}

int main() {
  int N; cin >> N;
  vector<int> ans(N);
  vector<vector<bool>> table(200, vector<bool> (10000));
  for (int i = 0; i < 200; i++) {
    for (int j = 0; j < 10000; j++) {
      table[i][j] = f(i, j);
    }
  }

  for (int x = 1; x <= N; x++) {
    int num = 0;
    for (int i = 1; i*i < x; i++) {
      for (int j = 1; j*j < x; j++) {
        int rhs = x-i*i-j*j-i*j;
        if (rhs <= 0) continue;
        else {
          int val = i+j;
          if (table[val][rhs]) num ++;
        }
      }
    }
    ans[x-1] = num;
  }
  for (int i = 0; i < N; i++) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 3732
#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() {
  int n;
  while (cin >> n) {
    vector<string> S(n);
    for (int i = 0; i < n; i++) {
      cin >> S[i];
    }
    string res = "";
    for (char c = 'a'; c <= 'z'; c++) {
      int minCount = 100;
      for (auto s : S) {
        minCount = min(minCount, (int)count(s.begin(), s.end(), c));
      }
      res += string(minCount, c);
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
fn main() {
    fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    let n: i32 = read_line().parse().unwrap();

    if n == 1 {
        println!("Hello World");
    } else {
        let a: i32 = read_line().parse().unwrap();
        let b: i32 = read_line().parse().unwrap();
        println!("{}", a + b);
    }
}



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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//最終奥義 #define int long long
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 put_double(double obj){printf("%.12f\n",obj);};
//lambda: [](int x, int y){return x<y;}

signed main(void){
    int ans=0,n;cin>>n;
    rep(i,n){
        int a;cin>>a;
        ans+=a-1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(998244353)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
	int n,m;
	cin>>n>>m;
	vii adj(3*n);
	vector<ll>dist(3*n,-1);
	for(int i=0;i<m;i++){
		int v,u;
		cin>>v>>u;
		v--;u--;
		for(int j=0;j<3;j++){
			adj[v+j*n].pb(u+((j+1)%3)*n);
		}
	}
	int s,t;
	cin>>s>>t;
	s--;t--;
	queue<int>q;
	q.push(s);
	dist[s] = 0;
	while(!q.empty()){
		int v = q.front();
		q.pop();
		for(int x:adj[v]){
		    if(dist[x] == -1){
				dist[x] = dist[v]+1;
				q.push(x);
			}
		}
	}
	if(dist[t] == -1)cout<<-1;
	else cout<<dist[t]/3;
}


Measured memory_bytes: 22000
import scala.io.StdIn._
object Main extends App {
  val Mod = 1000000007
  val s = readLine

  def dp(rems: Array[Long], digit: Char): Array[Long] = {
    val ret = new Array[Long](13)
    if (digit == '?') {
      for {
        i <- (0 to 9)
        j <- (0 to 12)
      } {
        ret((j * 10 + i) % 13) += rems(j)
        ret((j * 10 + i) % 13) %= Mod
      }
    } else {
      for {
        i <- Seq((digit - '0').toInt)
        j <- (0 to 12)
      } {
        ret((j * 10 + i) % 13) += rems(j)
        ret((j * 10 + i) % 13) %= Mod
      }
    }
    ret
  }

  val init = s.head match {
    case '?' => Array.tabulate(13)(i => if (i < 10) 1L else 0L)
    case c => Array.tabulate(13)(i => if (i == c - '0') 1L else 0L)
  }

  val result = s.tail.foldLeft(init){(z, d) => dp(z, d)}
  println(result(5))
}

Measured memory_bytes: 47112
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>

#define ll long long
#define md  1000000007

using namespace std;
long long n;


int main(){
    cin>>n;
    vector<vector<int> > a(2, vector<int>(n));
    vector<vector<int> > s(2, vector<int>(n,0));
    for(int i=0; i<2; i++)
	for(int j=0; j<n; j++){
	    cin>>a[i][j];
	    if(j==0){
		s[i][j] = a[i][j];
	    }else{
		s[i][j] = s[i][j-1]+a[i][j];
	    }
    }
    int res=0;
    for(int i=0; i<n; i++){
	int s1 = s[0][i];
	int s2 = s[1][n-1];
	if(i>0)s2-=s[1][i-1];
	if(s1+s2>res){
	    res = s1+s2;
	}
    }
    cout<<res<<"\n";
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
    int b = sc.nextInt();
    if (a>8 || b>8) {
      System.out.println(":(");
    } else {
      System.out.println("Yay!");
    }
  }
}

Measured memory_bytes: 21716
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

struct Node {
  vector<int> edge_to;
  vector<int> edge_from;
  vector<ll> edge_cost;
  vector<ll> edge_from_cost;

  bool done;
  bool contain;
  ll cost;
};

int main() {
  int n, m, R;
  cin >> n >> m >> R;
  vector<int> r(R);
  for(int i = 0; i < R; i++) {
    cin >> r[i];
    r[i]--;
  }
  sort(r.begin(), r.end());
  vector<Node> node(n);
  for(int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    node[a].edge_to.push_back(b);
    node[a].edge_cost.push_back(c);
    node[b].edge_to.push_back(a);
    node[b].edge_cost.push_back(c);
  }

  vector<vector<ll>> dis(n + 1, vector<ll>(n + 1, -1));
  for(int i = 0; i < R; i++) {
    for(int j = 0; j < n; j++) {
      node[j].done = false;
      node[j].cost = -1;
    }
    auto compare = [](Node a, Node b) { return a.cost < b.cost; };
    priority_queue<Node, vector<Node>, decltype(compare)> q{compare};
    node[r[i]].cost = 0;
    q.push(node[r[i]]);
    while(!q.empty()) {
      Node doneNode = q.top();
      q.pop();
      doneNode.done = true;
      for(int j = 0; j < doneNode.edge_to.size(); j++) {
        ll to = doneNode.edge_to[j];
        ll cost = doneNode.cost + doneNode.edge_cost[j];
        if(node[to].cost < 0 || cost < node[to].cost) {
          node[to].cost = cost;
          q.push(node[to]);
        }
      }
    }
    for(int j = 0; j < R; j++) {
      dis[r[i]][r[j]] = node[r[j]].cost;
    }
  }

  ll ans = 100101001001001;
  do {
    ll sum = 0;
    for(int i = 0; i < R - 1; i++) {
      sum += dis[r[i]][r[i + 1]];
    }
    ans = min(ans, sum);
  } while(next_permutation(r.begin(), r.end()));

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

Measured memory_bytes: 1760
use proconio::{input, fastout};
// use itertools::Itertools;

#[fastout]
fn main() {
  input!{
    a: u64,
    b: f64
  };
  let b: u64 = (b * 100.0 + 0.1) as u64;
  let ans = a * b / 100;
  println!("{}", ans);
}


Measured memory_bytes: 2196
#include<bits/stdc++.h>
using namespace std;
using ull =unsigned long long;
int main()
{
  ull sum=0;
  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    if(i%3!=0&&i%5!=0)
    {
    	sum+=i;
    }
    
  }
  cout<<sum<<endl;
  
return 0;}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF INT_MAX/2

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> Node;
typedef pair<Node, int> pni;

struct Comp {
	bool operator() (pni a, pni b) {
		return a.second > b.second;
	}
};

int solve(int N, int M, int L)
{
	vvi D(N, vi(N, -1));
	vvi E(N, vi(N, -1));

	rep(i, 0, M)
	{
		int a, b, d, e;
		cin >> a >> b >> d >> e;
		a--; b--;
		
		D[a][b] = d; D[b][a] = d;
		E[a][b] = e; E[b][a] = e;
	}

	priority_queue<pni, vector<pni>, Comp> que;
	map<Node, int> dist;
	set<Node> done;

	que.push(pni(Node(0, L), 0));
	while (!que.empty())
	{
		Node n = que.top().first;
		int c = que.top().second;
		que.pop();

		if (done.find(n) != done.end()) continue;
		done.insert(n);

		if (n.first == N - 1) return c;

		rep(i, 0, N)
		{
			if (D[n.first][i] < 0) continue;

			int newcost;
			Node newnode;

			// ????????????
			newcost = c + E[n.first][i];
			newnode = Node(i, n.second);
			if (dist.find(newnode) == dist.end()) dist[newnode] = INF;
			if (newcost < dist[newnode])
			{
				dist[newnode] = newcost;
				que.push(pni(newnode, newcost));
			}

			// ?????????????????????
			if (n.second < D[n.first][i]) continue;
			newcost = c;
			newnode = Node(i, n.second - D[n.first][i]);
			if (dist.find(newnode) == dist.end()) dist[newnode] = INF;
			if (newcost < dist[newnode])
			{
				dist[newnode] = newcost;
				que.push(pni(newnode, newcost));
			}
		}
	}
}



int main()
{
	while (1)
	{
		int N, M, L;
		cin >> N >> M >> L;
		if (N == 0) return 0;

		cout << solve(N, M, L) << endl;
	}
}

Measured memory_bytes: 4212
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
const int N = 1e5 + 10;
int t[N], f[N], p, n;
int main() {
	memset(f, 0x3f, sizeof(f)); f[0] = 0;
	for ( int i = 6; i < N; i *= 6) t[++ p] = i;
	for ( int i = 9; i < N; i *= 9) t[++ p] = i;
	t[++ p] = 1; sort(t+1, t+1+p);
//	for ( int i = 1; i <= p; i ++) printf("%d ", t[i]); puts("");
	scanf("%d", &n);
	for ( int i = 1; i <= n; i ++) 
		for ( int k = 1; k <= p && t[k] <= i; k ++) f[i] = min(f[i], f[i-t[k]] + 1);
	printf("%d\n", f[n]);
}

Measured memory_bytes: 512
import numpy as np
h, n = map(int, input().split())
a = np.zeros(n, int)#np.emptyの方が少し早い
b = np.zeros(n, int)
for i in range(n):
    a[i], b[i] = map(int, input().split())
    
dp = np.zeros(h+1, int)
for i in range(1, h+1):
    rh = i - a# rhは実際にはH # まずは全ての魔法を使ってみる
    rh[rh<0] = 0 # 魔法を使ってHが0以下になるのであればその魔法で一発で0にできるということ
    dp[i] = np.min(dp[rh]+b)# dp[i]は残りのHPがiのときに必要な最小MP　# bは今回使用した魔法の消費MP

print(dp[h])

Measured memory_bytes: 18952
#include <stdio.h>

int main(void)
{
    int n;
    double h;
    int height[6] = {0};
    int i, j;

    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%lf", &h);

        if (h < 165){
            height[0]++;
        }
        else if (h < 170){
            height[1]++;
        }
        else if (h < 175){
            height[2]++;
        }
        else if (h < 180){
            height[3]++;
        }
        else if (h < 185){
            height[4]++;
        }
        else {
            height[5]++;
        }
    }

    for (i = 0; i < 6; i++){
        printf("%d:", i + 1);
        for (j = 0; j < height[i]; j++){
            printf("*");
        }
        printf("\n");
    }

    return (0);
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
// constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  while(1){
    int N;
    cin >> N;
    if(N == 0) break;
    vector<int> A(N);
    for(int i=0; i<N; i++){
      cin >> A[i];
    }
    int ans = 0;
    for(int i=0; i<N; i++){
      for(int j=1; j<=3; j++){
        swap(A[i],j);
        int l = i;
        int r = i+1;
        int cnt = 0;
        while(0<=l && r<N){
          int now = A[l];
          int temp = 1;
          while(1){
            if(1<=l && A[l-1]==now){
              temp++;
              l--;
              continue;
            }
            if(r<N && A[r]==now){
              r++;
              temp++;
              continue;
            }
            break;
          }
          if(temp < 4){
            break;
          }else{
            cnt += temp;
          }
          l--;
        }
        chmax(ans,cnt);
        swap(A[i],j);
      }
    }
    cout << N-ans << "\n";
  }
  return 0;
}



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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)

int main() {
    int n;
    cin >> n;
    cout << n*n*n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

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


  int count = 0;
  rep(i, s.size()) {
    if(s[i] == '1') {
      count++;
    }
  }

  cout << count << endl;
}


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

using namespace std;

using ull = unsigned long long;

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

  ull a = 2;
  ull b = 1;

  if (n == 0) {
    cout << a << endl;
    return 0;
  }
  if(n == 1){
    cout << b << endl;
    return 0;
  }

  ull tmp;
  for (int i = 0; i <= n-2; i++){
    tmp = a + b;
    a = b;
    b = tmp;
  }

  cout << b << endl;
  return 0;
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n, k;
    cin >> n >> k;
    vec<ll> a(n);
    ll d = 0;
    REP(i, n) {
        cin >> a[i];
        d = gcd(d, a[i]);
    }

    REP(i, n) {
        if(a[i] < k)
            continue;
        if((k - a[i]) % d)
            continue;
        cout << "POSSIBLE" << en;
        return;
    }
    cout << "IMPOSSIBLE" << en;
}

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

    solve();
    /*
    ll t;
    cin >> t;
    REP(i, t) { solve(); }*/

    return 0;
}


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

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

typedef long long ll;
using namespace std;

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

  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int dx = x2 - x1;
  int dy = y2 - y1;
  cout << x2 - dy << " " << y2 + dx << " " << x1 - dy << " " << y1 + dx << endl;

  return 0;
}


Measured memory_bytes: 256
gA = [1,3,5,7,8,10,12]
gB = [4,6,9,11]
gC = [2]

def get_g(x):
	g = 0
	if x in gA:
		g = 0

	if x in gB:
		g = 1

	if x in gC:
		g = 2
	return g

inputs = input().split(" ")
ix = int(inputs[0])
iy = int(inputs[1])

if get_g(ix) == get_g(iy):
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
bool f(pair<int,int> a, pair<int,int> b){
	if(a.second==b.second) return false;
	return a.second<b.second;
}
int main(){
	/*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	#endif*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n; 
	cin>>n;
	pair<int,int> a[n];
	for(int i=0;i<n;i++){
		cin>>a[i].first>>a[i].second;
	}
	if(n==1){
		cout<<1; return 0;
	}
	vector<pair<int,int>> diff;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int x=a[i].first-a[j].first;
			int y=a[i].second-a[j].second;
			diff.push_back({x,y});
			diff.push_back({-x,-y});
		}
	}
	int ans=n;
	for(int i=0;i<diff.size();i++){
		int x=diff[i].first;
		int y=diff[i].second;
		int vis[n]={0};
		vector<pair<int,int>> b;
		for(int i=0;i<n;i++){
			b.push_back(a[i]);
		}
		//cout<<x<<" "<<y<<"\n";
		if(x==0 && y==0) continue;
		if(x<0)
		sort(b.begin(),b.end());
		else if(x > 0){
			reverse(b.begin(),b.end());
			/*if(x==2 && y==3){
				for(auto z : b) cout<<z.first<<" "<<z.second<<"\n";
			}*/
		}
		else{
			sort(b.begin(),b.end(),f);
			if(y > 0) reverse(b.begin(),b.end());
		}
		int l=0;
		for(int j=0;j<n;j++){
			if(vis[j]==1) continue;
			pair<int,int> pre=b[j];
			for(int k=j+1;k<n;k++){
				if(vis[k]==1) continue;
				int x1=pre.first-b[k].first;
				int y1=pre.second-b[k].second;
				if( (x==x1 && y==y1) || (x==-x1 && y==-y1) ){
					vis[k]=1; pre=b[k];
				}
			}
			l++;
		}
		ans=min(ans,l);
	}
	cout<<ans;
}


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

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

    int R[n];

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

    int minv = R[0];
    int maxv = -2000000000;

    for (int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}

Measured memory_bytes: 3876
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		short h = Short.parseShort(sc.next());
		short w = Short.parseShort(sc.next());

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			a[i] = sc.next().toCharArray();
		}

		short[][][][] dp = new short[17][h][h][w];
		boolean cflag;
		char tmps;

		for (int i = w - 1; i >= 0; i--) {//w1
			for (int j = 0; j < h; j++) {//h1
				if (i == w - 1) {
					dp[0][j][j][i] = (short) (w - 1);
					continue;
				}
				if (a[j][i] == a[j][i + 1]) {
					dp[0][j][j][i] = dp[0][j][j][i + 1];
				} else {
					dp[0][j][j][i] = (short) i;
				}
			}
		}

		for (int i = 0; i < w; i++) {
			for (int j = 0; j < h - 1; j++) {
				tmps = a[j][i];
				cflag = false;
				for (int k = j + 1; k < h; k++) {
					if (cflag == false && a[k][i] != tmps) {
						cflag = true;
					}
					if (cflag == true) {
						dp[0][j][k][i] = -1;
						continue;
					}
					dp[0][j][k][i] = (short) Math.min(dp[0][j][k - 1][i], dp[0][k][k][i]);
				}
			}
		}
		short tmpw;
		short tmp = -1;
		int m;
		short tmpy;
		short tmpz;

		for (int i = 1; i < 17; i++) {
			for (int j = 0; j < w; j++) {//w1
				for (int k = 0; k < h; k++) {//h1
					m = k;
					tmpw = dp[i - 1][k][k][j];
					dp[i][k][k][j] = tmpw == w - 1 ? (short) (w - 1) : dp[i - 1][k][k][tmpw + 1];
					for (int l = k + 1; l < h; l++) {//h2
						tmpw = dp[i - 1][k][l][j];
						if (tmpw == w - 1) {
							dp[i][k][l][j] = (short) (w - 1);
							continue;
						}
						tmp = -1;
						if (tmpw != -1) {
							tmp = (short) Math.max(tmpw, dp[i - 1][k][l][tmpw + 1]);
						}
						tmpy = (short) Math.min(dp[i - 1][k][m][j], dp[i - 1][m + 1][l][j]);
						while (m < l - 1) {
							tmpz = (short) Math.min(dp[i - 1][k][m + 1][j], dp[i - 1][m + 2][l][j]);
							if (tmpz < tmpy) {
								break;
							} else {
								m++;
								tmpy = tmpz;
							}

						}
						dp[i][k][l][j] = (short) Math.max(tmp, tmpy);
					}
				}
			}
		}
//		for (int i = 0; i < h; i++) {
//			for (int j = i; j < h; j++) {
//				for (int k = 0; k < w; k++) {
//					System.out.print(i + "," + j + "," + k + " ");
//					for (int l = 0; l < 5; l++) {
//						System.out.print(dp[l][i][j][k] + ",");
//					}
//					System.out.println();
//				}
//			}
//		}
		int ans = 0;
		while (true) {
			if (dp[ans][0][h - 1][0] == w - 1) {
				break;
			}
			ans++;
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 295064
def floor(a, b):
    return ((-a)//b)*-1


N = int(input())
ratio = []
for _ in range(N):
    ratio.append(list(map(int, input().split())))

v_T = ratio[0][0]
v_A = ratio[0][1]

for t, a in ratio[1:]:
    diff_t = t - v_T
    diff_a = a - v_A

    if diff_t < 0 and diff_a < 0:
        d = max(floor(v_T, t), floor(v_A, a))
        v_T = d*t
        v_A = d*a

    elif diff_t < 0:
        d = floor(v_T, t)
        v_T = d*t
        v_A = d*a

    elif diff_a < 0:
        d = floor(v_A, a)
        v_T = d*t
        v_A = d*a

    elif diff_t >= 0 and diff_a >= 0:
        m = max(diff_t, diff_a)
        v_T = t
        v_A = a

print(v_T+v_A)


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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;

using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 
	ll n , m;
	cin >> n >> m;
	ll ans = 0;
	ans = min(n , m / 2);
	n -= ans;
	m -= 2 * ans;
	ans += (m / 4);
	die(ans);

	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
strToInt s = (read :: String -> Int) s

main = do
    n <- readLn :: IO Int
    an <- map strToInt . words <$> getLine
    let s = sum an
    let sxn = reverse (tail (reverse (slist an)))
    let ans = [abs (2*x-s) | x <- sxn]
    
    print $ minimum ans

slist :: [Int] -> [Int]
slist an = reverse $ slist_ [] an
           where slist_ [] (a:an) = slist_ [a] an
                 slist_ sn [] = sn
                 slist_ sn (a:an) = slist_ ((a + head sn) : sn) an
                 --slist_ sn (a:an) = slist_ (sn ++ [(last sn) + a]) an

Measured memory_bytes: 123260
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};


int main(){
    int N,c;
    cin >> N;
    int isSomeone[9];
    rep(i,9){
        isSomeone[i] = 0;
    }
    rep(i,N){
        cin >> c;
        int color = c/400;
        if (color<=7){
            isSomeone[color] ++;
        }else{
            isSomeone[8] ++;
        }
    }
    int cnt=0;
    rep(i,8){
        if (isSomeone[i]>0) cnt++;
    }
    if (cnt==0){
        cout << 1 << " " << isSomeone[8] << endl;
    }else{
        if (isSomeone[8]>0){
            cout << cnt <<" "<< cnt + isSomeone[8] << endl;
        }else{
            cout << cnt <<" "<< cnt << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner
object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val s: Long = sc.nextLong
    val w: Long = sc.nextLong
    
    val diff = s - w
    diff match {
        case ls if ls == 0 => println("unsafe")
        case ls if ls < 0 => println("unsafe")
        case ls if ls > 0 => println("safe")
    }



    
  }
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(c-a) <= d){
        cout << "Yes" << endl;
    }
    else if (abs(a-b) <= d && abs(b-c) <= d) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TEST ll t;cin>>t;while(t--)
ll sizes[100001];
ll arr[100001];

bool ok=true;
ll A[100001];
pll B[100001];

ll root(ll i){
    while(i!=arr[i]) i=arr[i];
    return(i);
}
void Union(ll i,ll j){
    ll root_i=root(i),root_j=root(j);
    if(root_i==root_j) return;
    if(sizes[root_i]>sizes[root_j]) swap(root_i,root_j);
    sizes[root_j]+=sizes[root_i];
    arr[root_i]=arr[root_j];
    return;
}
ll Arr[100001];
bool solve(ll n){
    if(n==1) return(true);
    set<ll> st;
    for(ll i=0;i<n;i++){
        ll m=(Arr[i]+i)%n;
        if(m<0) m+=n;
        if(st.count(m)) return(false);
        st.insert(m);
    }
    return(true);
}
ll power[11];

int main(){
    IO
    int h,w;
    cin>>h>>w;
    bool ans=true;
    vector<string> v;
    string s;
    for(int i=0;i<h;i++){
        cin>>s;
        v.push_back(s);
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(v[i][j]=='.') continue;
            bool ok=false;
            for(int k=0;k<4;k++){
                int x=i+dx[k],y=j+dy[k];
                if(x<0 || y<0 || x>=h || y>=w) continue;
                if(v[x][y]=='#') {ok=true;break;}
            }
            if(!ok) {ans=false;break;}
        }
        if(!ans) break;
    }
    if(ans) cout<<"Yes";
    else cout<<"No";
    return(0);
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll n, k, r, s, p;
  str t;
  cin >> n >> k >> r >> s >> p >> t;
  ll ans = 0;
  for(ll i = n - 1;i >= 0;i--)
  {
    if (t[i] == 'r')
    {
      ans += p;
      if (t[i - k] == 'r')
      {
        t[i - k] = 'n';
      }
    }
    if (t[i] == 's')
    {
      ans += r;
      if (t[i - k] == 's')
      {
        t[i - k] = 'n';
      }
    }
    if (t[i] == 'p')
    {
      ans += s;
      if (t[i - k] == 'p')
      {
        t[i - k] = 'n';
      }
    }
  }
  fin(ans)
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    set<int> s = {1,2,3,5,6,9,10,13,17};
    if(s.count(N)){
        cout << "No";
    }else{
        cout << "Yes";
    }
}

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

int main(){

	int n, cnt, x, y, fig[9][9];

	cnt = 0;

	while(cin >> n){
		if(n == 0) break;
	
		//(y, x)
		x = 0;
		y = 0;
		fig[0][0] = 1;
		
		for(int i=2; i<=n*n; i++){
			if((x + y) % 2 == 0){
				if(x == n-1){
					y++;
				}
				else if(y == 0) {
					x++;
				}
				else {
					x++;
					y--;
				}
			}
			else {
				if(y == n-1){
					x++;
				}
				else if(x == 0){
					y++;
				}
				else {
					y++;
					x--;
				}
			}
			fig[y][x] = i;
		}
		cnt++;
		
		cout << "Case " << cnt << ":" << endl;
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				if(fig[i][j] < 10){
					cout << "  " << fig[i][j];
				}
				else {
					cout << " " << fig[i][j];
				}
			}
			cout << endl;
		}
	}

	return 0;

}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
//#include"functions.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define INF 0x7fffffff
#define LLINF 0x7fffffffffffffff
#define EPS 1e-5
#define LDEPS 1e-9
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define FOR(a,b) for(int a=0;a<b;a++)
#define FORN(a,m,n) for(int a=m;a<n;a++)
#define REP(a,m,n) for(int a=0;a<m;a+=n)
#define REPN(a,m,n,p) for(int a=m;a<n;a+=p)
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdfopen(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define ifopen(a) freopen(a,"r",stdin);
#define ofopen(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int> v;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		v.pb(x);
	}
	int mx=-1;
	for(int i=0;i<v.size();i++){
		mx=max(mx,v[i]);
		if(mx-v[i]>=2){
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
	return 0;
}

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

using ll = long long;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

const ll INF = (ll)1e11;

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    vector<ll> div;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i > 0) continue;
        div.push_back(i);
        if (i * i != N) div.push_back(N / i);
    }
    sort(div.begin(), div.end());

    ll ans = 0;
    for (auto q : div) {
        ll m = N / q - 1;
        if (m <= 0) continue;
        if (N / m == N % m) ans += m;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = (int)1e9 + 7;
int INF = (int)2e18;


signed main() {
    int N, X;
    cin >> N >> X;
    int ans = 1, temp = 0;
    for (int i = 0; i < N; i++) {
        int L;
        cin >> L;
        temp += L;
        if (temp <= X) ++ans;
    }
    cout << ans << endl;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    
    vector<int> town(n);
    rep(i,n) town[i] = 0;
    
    vector<int> road(2*m);
    
    rep(i,2*m){
        int a;
        cin >> a;
        town[a-1]++;
    }
    
    rep(i,n){
        cout << town[i] << endl;
    }
}


Measured memory_bytes: 256
$cnt = 0
def bubble_sort(arr, n)
  flag = true
  while flag
    flag = false
    (1..n-1).reverse_each {|i|
      if arr[i] < arr[i-1]
        arr[i], arr[i-1] = arr[i-1], arr[i]
        flag = true
        $cnt += 1
      end
    }
  end
  return arr
end

n = gets.to_i
arr = gets.split.map(&:to_i)
ans = bubble_sort(arr, n)
puts ans.join(" ")
puts $cnt


Measured memory_bytes: 6944
#include <stdio.h>
struct C{
  int num;
  char c;
};
 
int main(){
 
  int n, i, j, tmp, min, flag = 0;
  char tmpc;
  struct C card[36], out[36];
 
  scanf("%d",&n);
 
  for(i = 0;i < n;i++){
    scanf(" %c%d",&card[i].c,&card[i].num);
    out[i].c = card[i].c;
    out[i].num = card[i].num;
  }

 
  for(i = 0;i < n;i++){
    for(j = n - 1;i < j;j--){
      if(card[j].num < card[j-1].num){
    tmp = card[j].num;
    tmpc = card[j].c;
    card[j].num = card[j-1].num;
    card[j].c = card[j-1].c;
    card[j-1].num = tmp;
    card[j-1].c = tmpc;
      }
       
    }

  }
 
  for(i = 0;i < n;i++){
    if(i == 0) printf("%c%d",card[i].c,card[i].num);
    else printf(" %c%d",card[i].c,card[i].num);
    }
  printf("\n");
 
  printf("Stable\n");
  
 
 
  for(i = 0;i < n;i++){
    min = i;
    for(j = i;j < n;j++){
      if(out[j].num < out[min].num) min = j;
 
       
    }
      tmp = out[min].num;
      tmpc = out[min].c;
      out[min].num = out[i].num;
      out[min].c = out[i].c;
      out[i].num = tmp;
      out[i].c = tmpc;
       
     
  }
 
  for(i = 0;i < n;i++){
    if(i == 0) printf("%c%d",out[i].c,out[i].num);
    else printf(" %c%d",out[i].c,out[i].num);
 
    if(out[i].c != card[i].c) flag = 1;
      
    else if(out[i].num != card[i].num) flag = 1;
  }
  printf("\n");
 
 if(flag == 0) printf("Stable\n");
 else printf("Not stable\n");
 
 
  return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1,2,0,-2,0};
const int dy[]={0,1,-1,0,1,1,-1,-1,0,2,0,-2};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef pair<int,int> Pii;
typedef pair<int,Pii > P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
int main(){
	int n,m,a;
	while(scanf("%d%d%d",&n,&m,&a),(n|m|a)){
		P array[1280];
		int s[128]={0};
		reps(i,1,n+1){
			s[i] = i;
		}
		rep(i,m){
			int h,p,q;
			scanf("%d%d%d",&h,&p,&q);
			array[i] = P(h,Pii(p,q));
		}
		sort(array,array+m);
		rep(i,m){
			swap(s[array[i].sc.fr],s[array[i].sc.sc]);
		}
		printf("%d\n",s[a]);
	}
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int T[3];
	rep(i, 3) cin >> T[i];
	sort(T, T + 3);
	cout << T[0] + T[1] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
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())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0;//角度转弧度 
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;}
const int N = 1e4+10, M = N * 2;
char s[10][10], a[10][10];
int h, w, k;
int check() {
	int res = 0;
	rep(i, 1, h + 1) {
		rep(j, 1, w + 1) {
			if(a[i][j] == '#') res++;
		}
	}
	if(res == k) return 1;
	return 0;
}
int main() {
	cin>>h>>w>>k;
	rep(i, 1, h + 1) {
		scanf(" %s", s[i] + 1);
	}
	int ans = 0;
	rep(i, 0, (1<<h)) {
		rep(j, 0, (1<<w)) {
			memcpy(a, s, sizeof a);
			rep(r, 0, h) {
				if((i>>r)&1) {
					rep(c, 1, w + 1) a[r + 1][c] = 'R';
				}
			}
			rep(c, 0, w) {
				if((j>>c)&1) {
					rep(r, 1, h + 1) a[r][c + 1] = 'R';
				}
			}
			if(check()) ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3716
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
#define rep1(i, n) for(int i = 1; i <= (int) n; i++)
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;

int main() {
    int x;
    int n;
    cin >> x >> n;
    vector<int> p(101);
    rep(i,n) {
        int a;
        cin >> a;
        p[a]++;
    }
    int M = INT_MAX;
    int ans = 0;
    for (int i = 0; i <= 101; i++)
    {
        if (p[i] == 0) {
            if (abs(x-i) < M) {
                M = abs(x-i);
                ans = i;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
/*
int main() {
    int x,y;
    cin >> x >> y;
    for (int i = 0; i <= 100; i++)
    {
        for (int j = 0; j <= 100; j++)
        {
            if (i+j == x && 2*i+4*j == y) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}
/*
int main() {
    vector<int> a(5),b = {1,2,3,4,5};
    rep(i,5) {
        cin >> a[i];
        if (a[i] != b[i]) {
            cout << i+1 << endl;
        }
    }

    return 0;
}
*/

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

int main() {
  int A,B,C,X,Y;
  scanf("%d %d %d %d %d", &A,&B,&C,&X,&Y);
 
  int count = 0;
  int maxcount = INT32_MAX;
  for (int i = 0; i<=pow(10,5); i++){
    count = i*2*C + A*max(0,X-i) + B*max(0,Y-i);
    if(maxcount>count) maxcount = count;
  }
  cout << maxcount << endl;
}

Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  var t = o.m(n);
  t.sort((a,b)=>b[1]-a[1]);
  var a = Array(n+1).fill(0);
  var b = Array(n+1).fill(0);
  var c = 0;
  var ans = 0;
  for(var i = 0; i < n; i++){
    var x = t[i];
    if(a[x[0]] === 1)continue;
    c++;
    ans += x[1];
    a[x[0]] = 1;
    b[i] = 1;
    if(c === k)break;
  }
  var d = c;
  i = -1;
  while(d < k){
    if(b[++i] === 1)continue;
    d++;
    ans += t[i][1];
    b[i] = 1;
  }
  var s = ans;
  ans += c*c;
  var l = 0, r = n-1;
  while(l < r){
    while(b[l] === 1)l++;
    while(b[r] === 0)r--;
    if(l >= r || r < 0 || l >= n)break;
    c--;
    s += t[l][1] - t[r][1];
    if(s + c*c > ans)ans = s + c*c;
    l++; r--;
  }
  return ans;
}

Measured memory_bytes: 66032
def prime_factor(n):
    factors = {}
    if n % 2 == 0:
        cnt = 0
        while n % 2 == 0:
            cnt += 1
            n //= 2
        factors[2] = cnt
    i = 3
    while i * i <= n:
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                cnt += 1
                n //= i
            factors[i] = cnt
        i += 2
    if n != 1:
        factors[n] = 1
    return factors

N = int(input())
ans = 0
prime_factors = prime_factor(N)
for k, v in prime_factors.items():
    i = 1
    while v >= i:
        ans += 1
        v -= i
        i += 1
print(ans)

Measured memory_bytes: 62824
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
using ll = long long int;
using ull =  unsigned long long int;

int main() {
	int N;
	cin >> N;
	vector<pair<int,int>> A(N), B(N);
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		A[i] = { a,i }, B[i] = { b,i };
	}
	//sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	int time = 0;
	for (int i = 0; i < N; i++) {
		time += A[B[i].second].first;
		if (time <= B[i].first)continue;
		else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 3328
fn solve(aa: Vec<usize>) -> Option<Vec<usize>> {
    let mut ac = aa.clone();
    let n = aa.len();

    let m = n / 2 + if n % 2 == 1 { 1 } else { 0 };

    for i in (0..(n - m)).rev() {
        let mut acc = 0;
        let d = i + 1;
        let mut c = d * 2;

        while c - 1 < n {
            acc += ac[c - 1];
            c += d;
        }
        ac[i] = if acc % 2 == aa[i] { 0 } else { 1 }
    }

    let mut ans = Vec::new();

    for (i, a) in ac.iter().enumerate() {
        if *a == 1 {
            ans.push(i + 1);
        }
    }

    Some(ans)
}

#[test]
fn solve_test() {
    assert_eq!(solve(vec![1, 0, 0]), Some(vec![1]));
    assert_eq!(solve(vec![0, 0, 0, 0, 0]), Some(vec![]));
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let _n = parse_line!(usize);
    let aa = parse_vec!(usize);

    let ans = solve(aa).unwrap();

    if ans.len() == 0 {
        println!("0");
    } else {
        println!("{}", ans.len());
        println!(
            "{}",
            ans.iter()
                .map(|i| i.to_string())
                .collect::<Vec<String>>()
                .join(" ")
        );
    }
}


Measured memory_bytes: 10492