akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

struct UnionFind {
    vector<int> par;
    UnionFind(int n) :par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    bool connect(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    int size(int x) {
        return -par[root(x)];
    }
};
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll ans = 0;
    ll n;
    cin >> n;
    UnionFind uf(n);
    ll a[n], b[n];
    vector<pair<pair<ll, ll> , ll > > x, y;
    for(int i=0;i<n;i++){
    	cin >> a[i] >> b[i];
    	x.push_back({{a[i], b[i]}, i});
    	y.push_back({{b[i], a[i]}, i});
    }
    sort(be(x));
    sort(be(y));
    multiset<pair<ll,pair<ll,ll> > > ms;
    for(int i=0;i<n;i++){
    	if(i==0){
    		ms.insert({min(abs(x[i].first.first - x[i+1].first.first), abs(x[i].first.second - x[i+1].first.second)), {x[i].second, x[i+1].second} });
    		ms.insert({min(abs(y[i].first.first - y[i+1].first.first), abs(y[i].first.second - y[i+1].first.second)), {y[i].second, y[i+1].second} });
    	}else if(i==n-1){
    		continue;
    	}else{
    		ms.insert({min(abs(x[i].first.first - x[i+1].first.first) , abs(x[i].first.second - x[i+1].first.second)), {x[i].second, x[i+1].second} });
    		ms.insert({min(abs(y[i].first.first - y[i+1].first.first) , abs(y[i].first.second - y[i+1].first.second)), {y[i].second, y[i+1].second} });
    	}
    }
    while(!ms.empty()){
    	pair<ll, pair<ll,ll> > niko = *(ms.begin());
    	ms.erase(ms.begin());
    	pair<ll,ll> maki = niko.second;
    	if(uf.root(maki.first) != uf.root(maki.second)){
    		uf.connect(maki.first, maki.second);
    		ans += niko.first;
    	}
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 20004
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

/*

↓こういう動きだけ考えればいい
左端と右端は通らない0の区間
左からパート0,1,2,3,4とする
パート0 : 左の通らない区間
パート1 : 左の二重に通る区間，偶数減らせる
パート2 : 中央の1回通る区間，奇数減らせる
パート3 : 右の二重に通る区間，偶数減らせる
パート4 : 右の通らない区間
パート0と4は区別してやらないと更新の時困る
   <----      <------      
   ---->------------>
これでDPをする
ここでポイントはパートは0->1->2->3->4としか遷移できない
あ，でも0->3みたく飛ばすのはありね
*/

int l;vector<ll> a;

ll cost(int i, int part){
    if(part==0 or part==4){
        return a[i];
    }
    if(part==1 or part==3){
        if(a[i]==0) return 2;
        if(a[i]%2==0) return 0;
        else return 1;
    }
    if(part==2){
        if(a[i]%2==0) return 1;
        else return 0;
    }
}

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

    cin>>l;
    a.resize(l);
    rep(i,l){
        cin>>a[i];
    }
    ll dp[l+1][5];
    rep(i,l+1)rep(j,5) dp[i][j]=LINF;
    dp[0][0]=0;
    rep(i,l){
        rep(j,5){
            for(int k=j;k<5;k++){
                chmin(dp[i+1][k], dp[i][j]+cost(i,k));
            }
        }
    }
    // rep(j,5){
    //     rep(i,l+1){
    //         if(dp[i][j]>=LINF) cout<<"I ";
    //         else cout<<dp[i][j]<<' ';
    //     }cout<<endl;
    // }
    ll ans=LINF;
    rep(i,5) chmin(ans,dp[l][i]);
    cout<<ans<<endl;
    return 0;
}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define REP(i,n) for(int i=0; i < (n); ++i)
#define SIZE(c) (int) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define ST first
#define ND second
#define FWD(i,a,b) for (int i=(a); i<(b); ++i)
#define BCK(i,a,b) for (int i=(a); i>(b); --i)
#define PI 3.14159265358979311600
#define pb push_back
#define mp make_pair
#define st first
#define nd second

using namespace std;

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

typedef vector < int > VI;
typedef vector<ll> VL;

typedef long double K;

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

	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n);

	REP(i, m) {
		int x, y;
		cin >> x >> y;
		--x; --y;
		g[x].push_back(y);
		g[y].push_back(x);
	}

	vector<int> was(n);
	was[0] = 1;
	int l = 0, r = 0;
	deque<int> result;
	result.push_back(0);

	while (true) {
		bool update = false;
		while (true) {
			bool localUpdate = false;
			for (auto& to : g[l]) {
				if (!was[to]) {
					l = to;
					localUpdate = true;
					break;
				}
			}
			was[l] = 1;
			update |= localUpdate;
			if (!localUpdate) {
				break;
			}
			result.push_front(l);
		}
		while (true) {
			bool localUpdate = false;
			for (auto& to : g[r]) {
				if (!was[to]) {
					r = to;
					localUpdate = true;
					break;
				}
			}
			was[r] = 1;
			update |= localUpdate;
			if (!localUpdate) {
				break;
			}
			result.push_back(r);
		}
		if (!update) {
			break;
		}
	}

	cout << SIZE(result) << '\n';
	for (auto& item : result) {
		cout << item + 1 << ' ';
	}
	cout << '\n';

	return 0;
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};


vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll n;
  cin >> n;
  if(n==1){
    cout << 0 << endl;
    return 0;
  }
  auto vec=prime_factorize(n);
  ll res = 0;
  for(auto v:vec){
    int num = v.second;
    for(int i = 1;i<100000;i++){
      if(i*(i+1)/2 <= num && num<(i+1)*(i+2)/2){
        res += i;
        break;
      }
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3656
import itertools

N=int(input())
F=[list(map(int,input().split())) for i in range(N)]
P=[list(map(int,input().split())) for i in range(N)]

c=list(itertools.product([0,1], repeat=10))
c.pop(0)

ans=-10**10
for joisino in c:
    SUM=0
    count=[0]*N
    for i in range(10):
        if joisino[i]==1:
            for g in range(N):
                if F[g][i]==1:
                    count[g]+=1
    for m in range(N):
        SUM+=P[m][count[m]]
    ans=max(ans,SUM)
print(ans)

Measured memory_bytes: 41840
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0
//#define int ll

#define MAX 3005

double minc[MAX];
vector<pair<double, double> > G[MAX];

signed main(){
  int n,m,k;
  cin>>n>>m>>k;
  for(int i=0; i<m; i++){
    int a,b,c;
    cin>>a>>b>>c;
    G[a].push_back(mk(b,c));
    G[b].push_back(mk(a,c));
  }
  for(int i=0; i<=n; i++) minc[i]=INF;
  
  for(int u=0; u<k; u++){
    double city[MAX];
    bool come[MAX];
    for(int i=1; i<=n; i++){
      city[i]=INF;
      come[i]=false;
    }
    int a;
    cin>>a;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(mk(0,a));
    city[a]=0;
    while(!que.empty()){
      int q=que.top().second; que.pop();
      come[q]=true;
      for(int i=0; i<G[q].size(); i++){
        int v=G[q][i].first;
        int c=G[q][i].second;
        if(come[v]) continue;
        if(city[v]>city[q]+c){
          city[v]=city[q]+c;
          que.push(mk(city[v],v));
        }
      }
    }
    for(int i=1; i<=n; i++){
      minc[i]=min(minc[i],city[i]);
    }
  }
  
  double max_ans=-1;
  for(int i=1; i<=n; i++){
    for(int j=0; j<G[i].size(); j++){
      int to=G[i][j].first;
      max_ans=max(max_ans,round((minc[i]+minc[to]+G[i][j].second)/2));
      max_ans=max(max_ans,(double)minc[i]);
    }
  }
  cout<<max_ans<<en;
}






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

int main() {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	int ans = 0;
	ans += min(A, K);
	K -= (A + B);
	if (K > 0) {
		ans -= K;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define OP_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fo(i,a,b) for(int i = a; i < b; i++)
#define foi(i,a,b) for(int i = a; i>=b; i--)
#define fi first
#define si second
using namespace std;

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

const ll INF = 1e18L + 5;

string getLongestSubSeq(string s, string t){
  int m = s.size();
  int n = t.size();
  int dp[m+1][n+1];
  fo(i,0,m+1){
    fo(j,0,n+1){
      if(i == 0 || j == 0){
	dp[i][j] = 0;
      }else if(s[i-1] == t[j-1]){
	dp[i][j] = 1 + dp[i-1][j-1];
      }else{
	dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
      }
    }
  }
  string ret = "";
  int i = m, j = n;
  while(i > 0 && j > 0){
    if(s[i-1] == t[j-1]){
      ret = s[i-1] + ret;
      i--;
      j--;
    }else if(dp[i-1][j] > dp[i][j-1]){
      i--;
    }else{
      j--;
    }
  }
  return ret;
}

int main(){
  OP_IO;
  string s, t;
  cin>>s>>t;
  cout<<getLongestSubSeq(s,t)<<endl;
  return 0;
}


Measured memory_bytes: 35456
#include <vector>
#include <stack>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
#include <bitset>

using namespace std;

constexpr int MOD = 1000000007;

using Long = long long;
template<typename T>
using V = vector<T>;
template<typename T>
using Vv = V<V<T>>;
using Vb = V<bool>;
using Vvb = V<Vb>;
using Vi = V<int>;
using Vvi = V<Vi>;
using Vl = V<Long>;
using Vvl = V<Vl>;
using Vd = V<double>;
using Vvd = V<Vd>;
using Vs = V<string>;

template<typename T>
T read() {
    T res;
    cin >> res;
    return res;
}

template<typename T>
V<T> readV(int n) {
    V<T> res((size_t) n);
    for (int i = 0; i < n; ++i) {
        res[i] = read<T>();
    }
    return res;
}

template<typename T>
Vv<T> readVv(int n, int m) {
    Vv<T> res((size_t) n, V<T>((size_t) m));
    for (int i = 0; i < n; ++i) {
        res[i] = readV<T>(m);
    }
    return res;
}

// *** SOLUTION BEGIN ***

void solve() {
    int n, m;
    cin >> n >> m;
    int mn = min(n, m);
    int mx = max(n, m);
    if (mn == 1) {
        if (mx == 1) {
            cout << 1;
        } else {
            cout << mx - 2;
        }
    } else {
        cout << Long(mn - 2) * (mx - 2);
    }
}

// *** SOLUTION END ***

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout << fixed;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void showArray(int[], int);
void insertionSort(int[], int);


int main(){
    int n;
    scanf("%d", &n);
    int A[n];
    for(int i=0; i<n; i++){
        scanf("%d", &A[i]);
    }
    showArray(A, n);

    insertionSort(A, n);

    return 0;
}

void showArray(int A[], int n){
    for(int i=0; i<n; i++){
        printf("%d", A[i]);
        if(i != n-1) printf(" ");
    }
    printf("\n");
}

void insertionSort(int A[], int n){
    int v, j;
    for(int i=1; i<n; i++){
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        showArray(A, n);
    }
}



Measured memory_bytes: 2740
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        long Q, H, S, D, N, ans;
        long min1L;
        boolean use2L;

        void solve(InputReader in, PrintWriter out) {
            Q = in.nextLong();
            H = in.nextLong();
            S = in.nextLong();
            D = in.nextLong();
            N = in.nextLong();

            min1L = 4*Q > 2*H ? (2*H > S ? S : 2*H) : (4*Q > S ? S : 4*Q);
            use2L = D < 2*min1L;

            if (use2L) {
                ans += D*(N/2);
                if (N % 2 == 1) ans += min1L;
            } else {
                ans += min1L*N;
            }

            out.println(ans);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }

        long nextLong() { return Long.parseLong(next()); }

        int[] nextIntArray(int n) {
        	int[] arr = new int[n];
        	for (int i = 0; i < n; ++i) {
        		arr[i] = nextInt();
        	}
        	return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; ++i) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


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

typedef long long ll;
const int maxn = 200010;
int n, T, tot1, tot2, ans;
ll f[maxn], c[maxn];
pair<ll, ll> p[maxn];

int main() {
    scanf("%d %d", &n, &T);
    for (int i = 1; i <= n; i++) {
        pair<int, int> tmp;
        scanf("%d %d", &tmp.first, &tmp.second);
        if (!tmp.first) c[++tot2] = tmp.second + 1;
        else p[++tot1] = tmp;
    }
    sort(p + 1, p + tot1 + 1, [&](pair<ll, ll> x, pair<ll, ll> y) {
        return x.first * (y.second + 1) > y.first * (x.second + 1);
    });
    sort(c + 1, c + tot2 + 1);
    for (int i = 1; i <= tot2; i++) {
        c[i] += c[i - 1];
    }
    fill(f + 1, f + 31, T + 1);
    for (int i = 1; i <= tot1; i++) {
        for (int j = 30; j; j--) {
            f[j] = min(f[j], (f[j - 1] + 1) * (p[i].first + 1) + p[i].second);
        }
    }
    for (int i = 0; i <= 30; i++) if (f[i] <= T) {
        int add = !tot2 ? 1 : upper_bound(c + 1, c + tot2 + 1, T - f[i]) - c;
        ans = max(ans, i + add - 1);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 6400
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();
    int K =sc.nextInt();
    int C =Math.min(A,B);
    int D[] =new int[K];
    int x =0;
    for(int i=C;i>0;i--){
      if(!(B%i==0)){continue;}
      if(!(A%i==0)){continue;}
      D[x]=i;
      x=x+1;
      if(x==K){break;}}
    System.out.println(D[K-1]);
  }
}

Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <algorithm>
#include <cassert>
#include <string>
#include <climits>
#include <numeric>

using namespace std;
using ll = long long;

int main()
{
	vector<int> val(3);
	for (int i = 0; i < 3; ++i)
		cin >> val[i];
	sort(val.begin(), val.end());
	int ans = val[2] * 10 + val[1] + val[0];

	cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for (int i = 0; i < 10000 && n != 0; i++) {
            System.out.println("Case " + (i+1) + ": " + n);
            n = sc.nextInt();
        }
    }
}


Measured memory_bytes: 42100
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    int out = 3, point = 0, base[3] = {0};
    string s;
    while(out){
      cin >>s;
      if(s == "OUT"){out--;}
      if(s == "HIT"){
	if(base[2]){point++;}
	for(int i=2; i>0; i--){base[i] = base[i-1];}
	base[0] = 1;
      }
      if(s == "HOMERUN"){
	for(int i=0; i<3; i++){
	  if(base[i]){point++;}
	  base[i] = 0;
	}
	point++;
      }
    }
    cout <<point<<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    ll x; cin>>x;
    for(ll a=-1000;a<=1000;a++){
        for(ll b=-1000;b<=1000;b++){
            if(a*a*a*a*a-b*b*b*b*b==x){
                cout<<a<<" "<<b<<endl;
                return 0;
            }
        }
    }
    
}


Measured memory_bytes: 3652
#include <stdio.h>

int main(){

  int N,i,j,flag,minj,c2,x;
  int  C2[36],c3,C3[36];
  char c1,C1[36],c4,C4[36];
  
  flag=0;
  
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf(" %c%d",&C1[i],&C2[i]);
    C3[i]=C1[i];
    C4[i]=C2[i];
     }

  for(i=0;i<=N-1;i++){
    for(j=N-1;j>=i+1;j--){
      if(C2[j]<C2[j-1]){
	c1=C1[j];
	C1[j]=C1[j-1];
	C1[j-1]=c1;

	c2=C2[j];
	C2[j]=C2[j-1];
	C2[j-1]=c2;	
      }
    }
  }
  for(i=0;i<N-1;i++){
    printf("%c%d ",C1[i],C2[i]);
  }  
  printf("%c%d\n",C1[N-1],C2[N-1]);
  printf("Stable\n");
  
  for(i=0;i<=N-1;i++){
    minj=i;
    for(j=i;j<=N-1;j++){
      if(C4[j]<C4[minj]){
	minj=j;
      }
    }
    c3=C3[i];
    C3[i]=C3[minj];
    C3[minj]=c3;

    c4=C4[i];
    C4[i]=C4[minj];
    C4[minj]=c4;
       
  }
  for(i=0;i<N-1;i++){
    printf("%c%d ",C3[i],C4[i]);
  }  
  printf("%c%d\n",C3[N-1],C4[N-1]);

  for(i=0;i<=N-1;i++){
    if(C1[i]!= C3[i] || C2[i]!=C4[i])
      flag=1;
  }
  if(flag==1)printf("Not stable\n");
  else printf("Stable\n");
  return 0;


}

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> ans(n + 1);
    for (int x = 1; x <= n; x++)
    {
        for (int y = 1; y <= n; y++)
        {
            if (x * x + y * y + x * y > n) break;
            for (int z = 1; z <= n; z++)
            {
                int ret = x * x + y * y + z * z + x * y + x * z + y * z;
                if (ret > n) break;
                ans[ret]++;
            }
        }
    }
    for (int i = 1; i <= n; i++)
    {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 3608
N = int(input())
S = input()

ans = 0

for i in range(1000):
        target=str(i).zfill(3)
        d=0
        for j in range(N):
            if target[d]==S[j]:
                d+=1
                if d==3:
                    ans+=1
                    break
print(ans)

Measured memory_bytes: 41052
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();

        int result = (H-h) * (W-w);
        
        System.out.println(result);
    }
}


Measured memory_bytes: 35860
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll ans=-1;
    FOR(i,0,50000){
        ld x = 1.08 * i;
        if((ll)x==n)ans=i;
    }
    if(ans==-1)cout<<":("<<endl;
    else cout<<ans<<endl;
}

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

#include <math.h>
#include <stdlib.h>


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    if(n%2 == 1){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    ll div = 5;
    while(div < n){
        ll a = n/div;
        ans += a/2;
        div *= 5;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <functional>
#include <bitset>
#include <queue>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;

#include <boost/function_output_iterator.hpp>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int count = 0;
    int max_h = 0;
    for(int i = 0; i < N; ++i)
    {
        int h;
        cin >> h;
        if(max_h <= h)
        {
            ++count;
        }
        max_h = max(max_h, h); 
    }
    cout << count << '\n';
    
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define EPS 1.0e-8
#define MAX_N 100
typedef pair<int,int> Pii;
typedef pair<int,int> Pis;
const double PI=acos(-1);

int main(){
	int w, n;
	int stage[30];
	int a, b;
	cin >> w >> n;
	rep(i,w) stage[i] = i+1;

	rep(i,n){
		scanf("%d,%d",&a,&b);	
		stage[a-1] ^= stage[b-1];
		stage[b-1] ^= stage[a-1];
		stage[a-1] ^= stage[b-1];
	}

	rep(i,w)	cout << stage[i] << endl;
}

Measured memory_bytes: 1236
from collections import deque

s = input()
q = int(input())

t = deque(s)
flg = False
for _ in range(q):
    query = input()
    if query[0] == "1":
        flg = not flg
    elif query[0] == "2":
        _, f, c = query.split()
        if f == "1":
            if flg:
                t.append(c)
            else:
                t.appendleft(c)
        elif f == "2":
            if flg:
                t.appendleft(c)
            else:
                t.append(c)
result = "".join(t)
if flg:
    result = result[::-1]
print(result)

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

int main(){ 
    int m,f,r;
    cin >> m >> f >> r;
    while (m+f!=-2){
    	if (m==-1 || f==-1){
			cout << "F" << endl;
		}else if (m+f>=80){
    		cout << "A" << endl;
		}else if (m+f>=65){
			cout << "B" << endl;
		}else if (m+f>=50 || (m+f>=30 && r>=50)){
			cout << "C" << endl;
		}else if (m+f>=30){
			cout << "D" << endl;
		}else{
			cout << "F" << endl;
		}
		cin >> m >> f >> r;
	}
} 


Measured memory_bytes: 3136
#!/usr/bin/env python3
import numpy as np

a, b, x = list(map(int, input().split()))
a *= 1000
b *= 1000
x *= 1000000000

Y = a * a * b - x
h = (2 * Y) / (a * a)

# ans = np.arctan2(h, a) * 180 / np.pi
ans = np.arctan2(h, a)
ans = np.rad2deg(ans)

if h > b:
    h = (2 * x) / (a * b)
    # ans = np.arctan2(b, h) * 180 / np.pi
    ans = np.arctan2(b, h)
    ans = np.rad2deg(ans)

print(ans)


Measured memory_bytes: 12424
#include"bits/stdc++.h"
using namespace std;

int main() {

	int X;
	cin >> X;

	if (X == 7 || X == 5 || X == 3) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	while(cin>>N) {
		VI H(N);
		REP(i, N) cin>>H[i];
		ll mx = -10000;
		ll ok = 1;
		REP(i, N) {
			if(mx-1 > H[i]) ok = 0;
			maxUpdate(mx, H[i]);
		}
		cout<<(ok?"Yes":"No")<<endl;
	}
	
	return 0;
}


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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define ALL(x) (x).begin(), (x).end()
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
int i() { int i; scanf("%d", &i); return i;}
int nl() { ll l; scanf("%lld", &l); return l;}
vi ia(int n) {vi ret(n); rep(i, n) scanf("%d", &ret[i]); return ret;}
vl la(int n) {vl ret(n); rep(i, n) scanf("%lld", &ret[i]); return ret;}

void Main() {
  int W = i();
  int H = i();
  vi P = ia(W);
  vi Q = ia(H);

  vpii E;
  forr(e, P) E.emplace_back(e, 0);
  forr(e, Q) E.emplace_back(e, 1);

  sort(ALL(E));

  ll ans = 0;

  int v = 0, h = 0;

  forr(ct, E) {
    ll c = ct.fst;

    if (ct.snd == 0) {
      ans += (H+1 - v) * c;
      h++;
    }
    else {
      ans += (W+1 - h) * c;
      v++;
    }
    //_p("(%lld,%d): %lld\n", c, ct.snd, ans);
  }
  cout << ans << endl;
}
int main() { cin.tie(0); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 3188
#include<iostream>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(((a == b) && (b == c) && (a == c)) || ((a != b) && (b != c) && (a != c))){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}


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

typedef vector<int> vi; 
typedef long long ll;
#define F first 
#define S second 
#define PB push_back 
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define pmod 1000000007
#define INF 1000000000000000000
#define pi atan(1)*4
#define modi 1000000

void solve(){
	
	ll n;
	
	cin >> n;
	
	string s;
	
	cin >> s;
	
	ll counter = 0;
	
	for(ll i = 0; i < n; i++){
		
		if(s[i] == 'R'){
			counter++;
		}
	}
	
	ll resp = 0;
	
	for(ll i = 0; i < counter; i++){
		
		if(s[i] != 'R'){
			resp++;
		}
		
	}
	
	cout << resp << endl;
	
}

int main(){
	
	ifstream fin ("text.in");
    ofstream fout ("text.out");   
	
	ll t = 1;
					
	while(t--) solve();
	
	return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<int,int>
ll n, k,a,b,c,i,j,x,y;
string s;
ll z[100000] = {};
int main() {
	cin >> s;
	a = s.size();
	x = 0;
	
	rep(i, a-1) {
		x++;
		if (s[i] == 'R' && s[i + 1] == 'L') {
			z[i] += x / 2 + x % 2;
			z[i+1] += x / 2;
			x = 0;
			y = i;
			
			
		}
		if ((s[i] == 'L' && s[i + 1] == 'R')) {
			z[y+1] += x / 2 + x % 2;
			z[y] += x / 2;
			x = 0;
			}
		if (i == a - 2) {
			if (s[i] == 'R' && s[i + 1] == 'L')z[i + 1]++;
			else {
				x++;
				z[y + 1] += x / 2 + x % 2;
				z[y] += x / 2;
				x = 0;
			
			}
		}

	}
	
	rep(i,a)cout <<z[i]<<" ";
	return 0;
}



Measured memory_bytes: 1408
#include "iostream"
using namespace std;

int main()
{
    int n;
    cin >>n;
    int ans=n%10;
    if (ans==3){
        cout<<"bon";
    }
    if (ans==0){
        cout<<"pon";
    }
    if (ans==1){
        cout<<"pon";
    }
    if (ans==6){
        cout<<"pon";
    }
    if (ans==8){
        cout<<"pon";
    }
    if (ans==2){
        cout<<"hon";
    }
    if (ans==4){
        cout<<"hon";
    }
    if (ans==5){
        cout<<"hon";
    }
    if (ans==7){
        cout<<"hon";
    }
    if (ans==9){
        cout<<"hon";
    }
}


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

long long n,tmp;
vector<int> tmp1;
multiset<int> v;
multiset<int> s;

int main(){

	cin>>n;

	for(int i=0;i<(1<<n);i++){
		cin>>tmp;
		s.insert(-tmp);
	}
	
	v.insert(*s.begin());
	s.erase(s.begin());
	
	while(s.size()>0){
		for(auto i:v){
			auto p=s.upper_bound(i);
			if(p==s.end()){
				cout<<"No"<<endl;
				return 0;
			}
			tmp1.push_back(*p);
			s.erase(p);
		}
		
		for(int i=0;i<tmp1.size();i++){
			v.insert(tmp1[i]);
		}
		tmp1.clear();
	}
	
	cout<<"Yes"<<endl;

return 0;
}


Measured memory_bytes: 13184
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#define MN 40002
#define MM 5000001
#define ll long long
#define ld long double
#define inf 0x7fffffff
#define clz 1000000007
#define ers(arr,val) memset(arr,val,sizeof(arr));
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define repd(i,b,a) for(int i=(b);i>=(a);i--)
#define repe(i,u) for(int i=h[u];i;i=e[i].nx)
using namespace std;
int n,num;
double T,A,mi=1.0*inf;
int main(){
	scanf("%d%lf%lf",&n,&T,&A);
	rep(i,1,n){
		double x;
		scanf("%lf",&x);
		if(abs((T-0.006*x)-A)<mi) mi=abs((T-0.006*x)-A),num=i;
	}
	printf("%d",num);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int N, K, ar, x, s=0;
	cin>>N>>K;
	x=N;
	for(int i=1; i<=N; ++i)
	{
		cin>>ar;
	}
	while(x>0)
	{
		if(s==0)
		{
			x-=K;
			s++;
		}
		else
		{
			x-=K-1;
			s++;
		}
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
#define N 210
int h,w,a[N][N];
ll dp[2*N][N][N];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>h>>w;
    for(int i=0;i<h;i++){
	for(int j=0;j<w;j++){
	    cin>>a[i][j];
	}
    }
    if(h>w){
	ll cop[N][N];
	for(int i=0;i<h;i++)for(int j=0;j<w;j++){
	    cop[j][i]=a[i][j];
	}
	swap(h,w);
	for(int i=0;i<h;i++)for(int j=0;j<w;j++){
	    a[i][j]=cop[i][j];
	}
    }
    if(h<=2){
	ll ans=0;
	for(int i=0;i<h;i++)for(int j=0;j<w;j++)ans+=a[i][j];
	cout<<ans<<endl;
	return 0;
    }
    for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<N;k++)dp[i][j][k]=0;
    dp[1][0][1]=a[0][1]+a[1][0]+a[0][0]+a[h-1][w-1];
    for(int i=1;i<h+w;i++){
	for(int x=0;x<h;x++)for(int y=x+1;y<h;y++){
	    if(i-x<0||w<=i-x)continue;
	    if(i-y<0||w<=i-y)continue;
	    //cout<<i<<" "<<x<<" "<<y<<" "<<dp[i][x][y]<<endl;
	    for(int xx=x;xx<=x+1;xx++)for(int yy=y;yy<=y+1;yy++){
		if(xx==yy)continue;
		if(i+1-xx<0||w<=i+1-xx)continue;
		if(i+1-yy<0||w<=i+1-yy)continue;
		chmax(dp[i+1][xx][yy],dp[i][x][y]+a[xx][i+1-xx]+a[yy][i+1-yy]);
	    }
	}
    }
    cout<<dp[h+w-3][h-2][h-1]<<endl;
}




Measured memory_bytes: 139648
def op() :
    
    while True :
        
        a, c, b = input().split()
        a = int(a)
        b = int(b)
        
        if c == '+' :
            print( a + b )
       
        elif c == '-' :
            print( a - b )
        
        elif c == '*' :
            print(int( a * b))
        
        elif c == '/' :
            print(int( a / b ))
        
        elif c == '?' :
            break
        
        
op()
         


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sc(x) scanf("%lld",&(x));
#define pb push_back
#define fi first
#define se second
#define P pair<int,int>
#define endl '\n'
int _,t,a,b,n,m,k,x;

int A[500005];


signed main()
{
    string s;
   cin>>s;
   int n = s.length();
   for(int i=0;i<n;i++)
   if(s[i]=='A')a++;
   else if(s[i]=='B')b++;
   if(a&&b){
    cout<<"Yes";
   }else cout<<"No";

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 210;
int mod;
inline int add(int a,int b){a+=b;return a>=mod?a-mod:a;}
inline int sub(int a,int b){a-=b;return a<0?a+mod:a;}
inline int mul(int a,int b){return 1ll*a*b%mod;}
inline int qpow(int a,int b){int ret=1;for(;b;b>>=1,a=mul(a,a))if(b&1)ret=mul(ret,a);return ret;}
/* math */
int n,_lim;
int binom[N][N],fac[N];

int dp[N][N];

inline int getmat(int k,int l,int lim){
	for(int i=1;i<=l;i++){
		for(int j=0;j<k;j++){
			if(i==1&&!j)dp[i][j]=1;
			else dp[i][j]=0;
			if(i)dp[i][j]=add(dp[i][j],dp[i-1][j]);
			if(j)dp[i][j]=add(dp[i][j],dp[i][j-1]);
			if(l-i+1+j-1>lim&&j)dp[i][j]=0;
		}
		for(int j=0;j<k;j++)if(k-j+i-1>lim)dp[i][j]=0;
//		for(int j=0;j<k;j++)cout << dp[i][j] << " ";
//		puts("");
	}
	int ans=0;
	for(int j=1;j<k;j++)ans=add(ans, dp[l][j]);
//	cerr << k << ":" << l << ":" << lim << ":" << ans << endl;
	return ans;
}

inline int solve(int lim,int n){
	if(n==1)return 0;
	if(n==0)return 1;
	if(lim<0)return 0;
	int ret=0;
	for(int k=1;k-1<=lim&&k<=n;k++){
		int tmp=mul(binom[n-1][k-1],mul(fac[n-k],fac[k-1]));
		ret=add(ret,mul(tmp, getmat(k,n-k,lim)));
	}
	return ret;
}

int main()
{
	cin >> n >> _lim >> mod;
	for(int i=0;i<=n;i++)for(int j=binom[i][0]=1;j<=i;j++)binom[i][j]=add(binom[i-1][j],binom[i-1][j-1]);
	for(int i=fac[0]=1;i<=n;i++)fac[i]=mul(fac[i-1],i);
	int ans=0;
	for(int i=0;i<=_lim+1;i++){
		ans=add(ans, mul(mul(fac[i],binom[n][i]),solve(_lim-i, n-i)));
//		cout << ans << endl;
	}
	cout << ans << endl;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */



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

	LL a, b, c; cin >> a >> b >> c;
	LL ans = a + b + c - max({a,b,c});
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int ans = 1;
  REP(i,n){
    if(i != n-1){
      if(s[i] != s[i+1]){
        ans++;
      }
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 3700
#include <iostream>

using namespace std;

int daimen(int, int, int);

int main(){
  int a, b, h;

  cin >> a >> b >> h;
  cout << daimen(a, b, h) << endl;

  return 0;
}

int daimen(int a, int b, int h){
  return ((a+b)*h)/2.0;
}


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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
int n , x , y ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>x>>n ;
	map<int , int>mark ;
	for(int i = 0 ; i < n ; ++i)
	{
		cin>>y ;
		mark[y] = 1 ;
	}
	int a = x , b = x ;
	for(int i = 0 ; i <= 100 ; ++i)
	{
		if(mark.find(b) == mark.end())
			return cout<<b<<"\n" , 0 ;
		if(mark.find(a) == mark.end())
			return cout<<a<<"\n" , 0 ;
		a++ , b-- ;
	}
	return 0 ;
}		

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  uni(A);
  int ans = 1;
  srep(i,2,sz(A)) {
    if(A[i-1] > A[i]) {
      if(A[i-2] < A[i-1]) {
        ans++;
        i++;
        continue;
      }
    }
    if(A[i-1] < A[i]){
      if(A[i-2] > A[i-1]) {
        ans++;
        i++;
        continue;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
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<=9&&b<=9)System.out.println(a*b);
    else System.out.println(-1);
  }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  
  	int ans = 0;
  	int n; cin>>n;
  	for(int i=1,a;i<=n;i++) {
    	cin>>a;
      	if(a&1 && i&1) ans++;
    }
  	cout<<ans;
}


Measured memory_bytes: 3584
#include <stdio.h>

int main(void) {
  int a[7], b[7];
  int i;
  for (i = 0; i < 6; i++) {
    scanf("%d%d\n", &a[i], &b[i]);
  }
  scanf("%d%d", &a[i], &b[i]);

  int result[7];
  for (i = 0; i < 7; i++) {
    result[i] = a[i] - b[i];
    printf("%d\n", result[i]);
  }
  return 0;
}



Measured memory_bytes: 2112
from sys import stdin

# stdnについては、@kusynaさんの記事が詳しい
N, K = [int(_) for _ in stdin.readline().rstrip().split()]
L = [int(_) for _ in stdin.readline().rstrip().split()]

for i in range(K+1, N+1):
	if L[i-K-1] < L[i-1]:
		print("Yes")
	else:
		print("No")

Measured memory_bytes: 31592
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

#define MAXCHAR 255

using namespace std;

int main()
{
	int input = 0;
	string input2;
	string output;
	cin >> input >> input2;
	bool addDots = false;
	addDots = input2.size() > input;
	if (addDots)
	{
		for (int i = 0; i < input; i++)
		{
			output += input2[i];
		}
		output.append("...");
	}
	else
	{
		output = input2;
	}

		
	cout << output << endl;

	return 0;
}

Measured memory_bytes: 3636
nums = list(map(int, input().split()))
total_diff = 0
max_num = max(nums)
for i in range(3):
    total_diff += max_num - nums[i]

if total_diff % 2 == 1:
    max_num += 1

print(int((max_num * 3 - sum(nums)) / 2))


Measured memory_bytes: 9172
import sys

def input():
  return sys.stdin.readline()

N=int(input())
A=list(map(int,input().split()))
B=[0]*(10**5)
for a in A:
  B[a-1]+=1
s=sum(A)
Q=int(input())
for i in range(Q):
  b,c=map(int,input().split())
  bb,bc=B[b-1],B[c-1]
  B[c-1]+=bb
  B[b-1]=0
  s+=bb*c-bb*b
  print(s)

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

//-------------------------------
int get_fact_nums(int a, int b, int K){
    
    int min;
    int count = 0;
    int mod_at_k = 0;
    
    if(a>=b){
        min = b;
    }else{
        min = a;
    };

    for(int i=min; i>=1; i--){
        int mod_a = a % i;
        int mod_b = b % i;
        
        if(mod_a==0 && mod_b==0){
            count++;
            mod_at_k = i;
        };

        if(count==K){ 
            return mod_at_k;
        };
    };
};





int main() {
    int A, B, K;
    int out;

    cin >> A >> B >> K;
    out = get_fact_nums(A, B, K);
    cout << out << endl;
}

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

bool test(int i, vector<P> p) {
  bool result = true;
  string s = to_string(i);
  for (P pp : p) {
    if ((s[pp.first - 1] - '0') != pp.second) {
      result = false;
      break;
    }
  }
  return result;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> sc(m);
  rep(i, m) {
    int s, c;
    cin >> s >> c;
    sc[i] = make_pair(s, c);
  }

  int result = -1;
  if (n == 1) {
    for (int i = 0; i <= 9; i++) {
      if (test(i, sc)) {
        result = i;
        break;
      }
    }
  } else if (n == 2) {
    for (int i = 10; i <= 99; i++) {
      if (test(i, sc)) {
        result = i;
        break;
      }
    }
  } else if (n == 3) {
    for (int i = 100; i <= 999; i++) {
      if (test(i, sc)) {
        result = i;
        break;
      }
    }
  }

  cout << result << endl;

  return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, s.length()) {
    if (s[i] != t[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3840
def solve():
  s = input()
  flag = True
  for i in range(len(s)):
    if i%2 == 0:
      if not s[i] in ["R","U","D"]:
        flag = False
    else:
      if not s[i] in ["L","U","D"]:
        flag = False
  if flag:
    print("Yes")
  else:
    print("No")
solve()

Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
	int a, b;
	
	for (a = 1; a <= 9; ++a){
		
		for (b = 1; b <= 9; ++b){
			
			printf("%dx%d=%d\n", a, b, a*b);
			
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 1744