akhauriyash/Code-Regression huggingface dataset:
n = int(input())
a = list(map(int,input().split()))
ans = 0
def check_all():
    global a,n
    for i in range(n):
        if a[i]%2!=0:
            return False
    return True
while check_all():
    ans += 1
    for i in range(n):
        a[i] //= 2
print(ans)

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

int main()
{
	int A,B,C,X;
	int ans = 0;
	cin >> A >> B >> C >> X;
	for(int i = 0; i <=A; i++){
		for(int j = 0; j <= B; j++){
			for(int k = 0; k <= C; k++){
				if(500 * i + 100 * j + 50 * k == X)
					ans++;
			}
		}
	}

	cout << ans << "\n";
	
	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++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

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

  vector<int> h(n);
  rep(i, n) cin >> h[i];

  vector<vector<int> > G(n, vector<int>());
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  int cnt = 0;
  rep(i, n){
    bool ok = true;
    rep(j, G[i].size()){
      if(h[G[i][j]] >= h[i]){
        ok = false;
      }
    }
    if(ok) cnt++;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 8804
/*
读题不规范，爆零两行泪。
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
*/
#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
const int N=3000,M=3000;
int n,m;
int dp[2*M+1][N+1][2];
int main(){
	cin>>n>>m;
	for(int i=0;i<=m;i++)dp[0][i][i==0]=1;
	for(int i=1;i<=m;i++)for(int j=0;j<=n;j++){
		if(j==0){
			if(j<n){
				(dp[2*i-1][j][1]+=dp[2*i-2][j][1])%=mod;
				(dp[2*i-1][j][1]+=(dp[2*i-2][j+1][0]+dp[2*i-2][j+1][1])%mod)%=mod;
			}
			(dp[2*i][j][1]+=dp[2*i-1][j][1])%=mod;
		}
		else{
			if(j<n){
				(dp[2*i-1][j][0]+=dp[2*i-2][j][0])%=mod,(dp[2*i-1][j][1]+=dp[2*i-2][j][1])%=mod;
				(dp[2*i-1][j][0]+=dp[2*i-2][j+1][0])%=mod,(dp[2*i-1][j][1]+=dp[2*i-2][j+1][1])%=mod;
			}
			(dp[2*i][j][0]+=dp[2*i-1][j][0])%=mod,(dp[2*i][j][1]+=dp[2*i-1][j][1])%=mod;
			(dp[2*i][j][0]+=dp[2*i-1][j-1][0])%=mod,(dp[2*i][j][1]+=dp[2*i-1][j-1][1])%=mod;
		}
	}
//	for(int j=n;~j;j--){for(int i=0;i<=2*m;i++)printf("(%2d,%2d) ",dp[i][j][0],dp[i][j][1]);puts("");}
	int ans=0;
	for(int i=0;i<=n;i++)(ans+=dp[2*m][i][1])%=mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 144324
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        int q = sc.nextInt();

        long left = (long)0, right = (long)0;
        String[] ans = new String[q];
        for(int i=0; i<q; i++){
            long p = sc.nextLong();
            String c = sc.next();
            long n = sc.nextLong();
            if(c.equals("(")) left += n;
            else right += n;
            if(left==right) ans[i] = "Yes";
            else ans[i] = "No";
        }

        for(int i=0; i<q; i++) System.out.println(ans[i]);
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 47368
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
//2-dim:vector<vector<Type>> vv(n, vector<Type>(m, d));
//3-dim:vector<vector<vector<Type>>> vvv(n, vector<vector<Type>>(m, vector<Type>(l, d)));


signed main(){
    int n; cin >> n;
    int x; cin >> x;
    n=2*n-1;
    if(n==3){
        if(x==2){
            cout << "Yes" << endl;
            cout << 1 << endl;
            cout << 2 << endl;
            cout << 3 << endl;
        }
        else cout << "No" << endl;
    }
    else if(x==1||x==n){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
        vector<int> v(n,-1);
        vector<bool> ok(n,1);
        int mid=n/2;
        v[mid-1]=x-1; ok[x-2]=0;
        v[mid]=x; ok[x-1]=0;
        v[mid+1]=x+1; ok[x]=0;
        if(x-2>0){ v[mid+2]=x-2; ok[x-3]=0; }
        else{ v[mid-2]=x+2; ok[x+1]=0; }
        int j=0;
        rep(i,n){
            if(v[i]==-1){
                while(j<n&&!ok[j]) j++;
                v[i]=j+1; ok[j]=0;
            }
        }
        rep(i,n) cout << v[i] << endl;
    }
}




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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N);
  vector<vector<int>> Grev(N);

  int a, b;
  rep(i, M){
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    Grev[b].push_back(a);
  }

  int min_cycle = -1;
  int min_cycle_dist = (1<<29);

  rep(i, N){

    // 幅優先
    
    queue<int> q;
    vector<int> dist(N);
    rep(j, N){
      dist[j] = -1;
    }
    dist[i] = 0;

    q.push(i);

    while(!q.empty()){

      int v = q.front();
      q.pop();

      for(auto nv : G[v]){

        if(nv == i){
          if(chmin(min_cycle_dist, dist[v])){
            min_cycle = i;
            break;
          }
        }

        if(dist[nv] >= 0) continue;

        dist[nv] = dist[v] + 1;
        q.push(nv);
      }
    }
  }

  if(min_cycle_dist == (1<<29)){
    cout << -1 << endl;
  }else{
    vector<int> dist(N);
    rep(i, N) dist[i] = -1;
    queue<int> q;
    dist[min_cycle] = 0;
    q.push(min_cycle);

    while(!q.empty()){
      int v = q.front();
      q.pop();

      for(auto nv : G[v]){
        if(dist[nv] >= 0) continue;

        dist[nv] = dist[v] + 1;
        q.push(nv);
      }
    }

    set<int> ans;
    ans.insert(min_cycle);

    int now = min_cycle;
    int cnt = min_cycle_dist;
    while(ans.size() < min_cycle_dist+1){

      for(auto nv : Grev[now]){

        if(dist[nv] == cnt){
          ans.insert(nv);
          now = nv;
          cnt--;
          break;
        }

      }
    }

    cout << ans.size() << endl;
    for(auto itr = ans.begin(); itr != ans.end(); itr++){
      cout << (*itr)+1 << endl;
    }

  }




  return 0;
}


Measured memory_bytes: 384
N=int(input())
s=[int(input()) for _ in range(N)]
ss = [s[i] for i in range(N) if s[i]%10!=0]
if sum(s)%10 != 0:
    print(sum(s))
else:
    if not ss:
        print(0)
    else:
        print(sum(s) - min(ss))

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

typedef long long llong;
// -2.1e-9 <= int <= 2.1e9

int main()
{
    int H, N;
    cin >> H >> N;
    vector<int> A(N);

    int sum = 0;
    for (auto &a: A) {
        cin >> a;
        sum += a;
    }
    if (H <= sum)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
//元音指a,e,i,o,u
	char a;
	cin>>a;
	if(a=='a'||a=='e'||a=='i'||a=='u'||a=='o'){
		cout<<"vowel";
	}
	else{
		cout<<"consonant";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <set>
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define vii vector<pair<int, int> >
#define si stack<int>
#define pb push_back
#define mp make_pair
#define ALL(T) (T).begin(), (T).end()
#define MODU 1000000007
typedef long long ll;
using namespace std;

ll intmax = (1LL<<32)-1;
ll llmax = (1LL<<60)-1;

const int INF = 1e9 + 5;

class fastio{
public:
	fastio(){
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
	}
} __fastio;

template <typename T>
T abs(T x){
	if(x < 0) return -x;
	else return x;
}

void DFSVisit(int u, vector<int> g[], vector<bool> &visited){
    visited[u] = true;
    for(int i=0; i<(int)g[u].size(); i++){
        if(!visited[g[u][i]]){
            DFSVisit(g[u][i], g, visited);
        }
    }
}

void DFS(vector<int> adj[], int V){
    vector<bool> visited(V, false);
    for(int u=0; u<V; u++)
        if(!visited[u])
            DFSVisit(u, adj, visited);
}


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


Measured memory_bytes: 892
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
using namespace std;

class Nums {
public:
	int a, b, c;

	Nums(int _a, int _b, int _c) {
		a = _a;
		b = _b;
		c = _c;
	}

	bool operator<(const Nums& other) const {
		return a < other.a;
	}
};

//           a * 1000 * 1000 + b * 1000 + c;
//bool isUsed[1000][1000][1000]; // <- 10億要素あるからダメ
//set<int> UsedNumbers // 使った値だけを入れてあげる

int main() {
	int X, Y, Z;
	int K;
	cin >> X >> Y >> Z;
	cin >> K;
	vector<long long> A(X), B(Y), C(Z);
	for (int i = 0; i < X; i++) cin >> A[i];
	for (int i = 0; i < Y; i++) cin >> B[i];
	for (int i = 0; i < Z; i++) cin >> C[i];
	A.push_back((long long)-1e17);
	B.push_back((long long)-1e17);
	C.push_back((long long)-1e17);

	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());
	sort(B.begin(), B.end());
	reverse(B.begin(), B.end());
	sort(C.begin(), C.end());
	reverse(C.begin(), C.end());

	priority_queue<pair<long long, Nums>> pq;
	pq.push(make_pair(A[0] + B[0] + C[0], Nums(0, 0, 0)));
	//PriorityQueueに入れたかどうかを管理する
	set<int> s;
	s.insert(0);

	vector<long long> ans;

	while (ans.size() < K) {
		auto v = pq.top(); pq.pop();
		ans.push_back(v.first);

		for (int i = 0; i < 3; i++)
		{
			int a = v.second.a;
			int b = v.second.b;
			int c = v.second.c;
			if (i == 0) a++;
			if (i == 1) b++;
			if (i == 2) c++;
			//hashを作る
			int hash = (a << 20) + (b << 10) + c;
			if (s.find(hash) == s.end()) {
				s.insert(hash);
				pq.push(make_pair(A[a] + B[b] + C[c], Nums(a, b, c)));
			}
		}
	}

	for (int i = 0; i < K; i++)
	{
		cout << ans[i] << endl;
	}

}



Measured memory_bytes: 896
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

const int MAXN = 110;
int a[MAXN];

int n;

int main() {
    GI(n);

    int M = 0;

    FOR1(i, n) {
        GI(a[i]);
        M = max(M, a[i]);
    }

    for (int i = M; i >= (M+1) / 2; i--) {
        int cnt = 0; FOR1(j, n) cnt += (a[j] == i);

        if (i == (M+1) / 2) { // last iteration
            if (cnt != 2 - (M % 2 == 0)) {
                cout << "Impossible\n";
                return 0;
            }
        }
        else {
            if (cnt < 2) {
                cout << "Impossible\n";
                return 0;
            }
        }
    }

    cout << "Possible\n";
    return 0;
}

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

int main() {
	int N = 0;
	int M = 0;
	cin >> N >> M;

	bool root1[200000 + 1];
	bool rootN[200000 + 1];
	for (int i = 0; i < N + 1; i++) {
		root1[i] = false;
		rootN[i] = false;
	}

	int a = 0;
	int b = 0;
	for (int i = 0; i < M; i++) {
		cin >> a >> b;
		if (a == 1)
			root1[b - 1] = true;
		else if (a == N)
			rootN[b - 1] = true;
		else if (b == 1)
			root1[a - 1] = true;
		else if (b == N)
			rootN[a - 1] = true;
	}

	for (int i = 0; i < N; i++) {
		if (root1[i] && rootN[i]) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}

	cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
string a;
int i,j,n;
int main()
{
	cin>>a;
	for (i=0;i<a.size();i++)
	{
		if (n==0 && a[i]=='C')
		  n=1;
		if (n==1 && a[i]=='F')
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

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

    cout<<ceil((b-1)/(double)(a-1))<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    long n;
    cin >> n;
    int t = n;
    int c=0;
    while(n != 0){
        c += n % 10;
        n /= 10;
    }
    if(t%c==0)
        cout << "Yes";
    else
        cout <<"No";
}

Measured memory_bytes: 256
#include<cstdio>

int n,l,sum;
int max,min;

int main() {
	scanf("%d %d",&n,&l);
	min=l,max=l+n-1;
	for(int i=min;i<=max;i++)
		sum+=i;
	if(min>0)
		sum-=min;
	else if(max<0)
		sum-=max;
	else sum-=0;
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;



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

	cin >> N;
	vector<string>s(N);
	for (auto &i : s)cin >> i;
	vector<vector<int>>edge(N, vector<int>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			edge[i][j] = s[i][j] - '0';
		}
	}
	vector<int>dis(N, MOD);
	dis[0] = 0;
	queue<int>Q;
	Q.push(0);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (int i = 0; i < N; i++) {
			if (edge[cn][i]) {
				if (dis[i] > dis[cn] + 1) {
					dis[i] = dis[cn] + 1;
					Q.push(i);
				}
			}
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (edge[i][j] && dis[i] == dis[j]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		vector<int>dist(N, MOD);
		dist[i] = 0;
		Q.push(i);
		while (!Q.empty()) {
			int cn = Q.front();
			Q.pop();
			for (int j = 0; j < N; j++) {
				if (edge[cn][j]) {
					if (dist[j] > dist[cn] + 1) {
						dist[j] = dist[cn] + 1;
						Q.push(j);
					}
				}
			}
		}
		ans = max(ans, *max_element(dist.begin(), dist.end()));
	}
	cout << ans + 1 << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define N 3005
#define endl "\n"
#define mod 1000000007
ll n,ar[N]; ll dp[N][N];
ll maxval(ll l,ll r,ll chance){
	if(l==r){
		if(chance%2==0) return ar[l];
		else return -ar[l];
	}
	if(dp[l][r]!=-1){
		return dp[l][r];
	}

	if(chance%2==0){
		return dp[l][r]=max(maxval(l+1,r,chance+1)+ar[l],maxval(l,r-1,chance+1)+ar[r]);
	}	
	else {
		return dp[l][r]=min(maxval(l+1,r,chance+1)-ar[l],maxval(l,r-1,chance+1)-ar[r]);
	}
}
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	for(i=1;i<=n;i++){
		cin>>ar[i];
	}

	k=maxval(1,n,2);
	cout<<k;
	return 0;
}


Measured memory_bytes: 70912
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);++i)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;--i)
#define FOR(i,s,n) for(int i = s;i < (int)n;++i)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;--i)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline void out(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
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;}
constexpr int INF = 1e18;

signed main(){
	int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int N;
	cin >> N;
	out(a[N-1]);
}

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

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

	cout << (a[0] + a[1]) << "\n";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  REP(i, SZ(s)) {
    ll x = ((s[i] - 'A') + n) % 26;
    char c = 'A' + x;
    cout << c;
  }
  cout << endl;
}

Measured memory_bytes: 256
"use strict";
function Main(input) {
	let textNum = input.split('\n')[0]*1;
  	
  	// 両方とも後で配列の値を比較するために文字列化
  	let text1 = input.split('\n')[1].split(' ').map(i => i*1).toString();
    let text2 = input.split('\n')[2].split(' ').map(i => i*1).toString();
  	  	
  	// 1からの連番配列を生成 
	const dictionaryResorce = [...Array(textNum).keys()].map(i => ++i);
  
  	// 配列を比較したかったのでmapで各要素を文字列にしてる
  	const dictionary = makeOrder(dictionaryResorce).map(x => x.toString());
  	
  	// それぞれが何番目かを計算
  	const x1 = dictionary.indexOf(text1);
    const x2 = dictionary.indexOf(text2);
  
  	// 答えを出す
	let ans = Math.abs(x1 - x2); 
  	console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

//辞書網羅用のコード （https://gist.github.com/umezo/8582650）
function makeOrder( list ){
  //要素がなければ並び順は作れない
  if( list.length === 0 ){
    return null;
  }
  //再帰にありがちな固定return
  if( list.length === 1 ){
    return [ [ list[0] ] ];
  }
  let //生成された並び順を格納する配列
      result = [], 

      //一時変数 ループ中の先頭要素
      head,

      //一時変数 ループ内で破壊的にlistを弄りたいため
      cloneList;
  for( var i = 0 , n = list.length; i<n ; i++ ){

    //listをクローン
    cloneList = list.concat([]);

    //準々に先頭要素を交代していく
    head = cloneList.splice( i,1 );

    //先頭要素以外で全ての並び順を生成する (再帰)
    let remainList = makeOrder( cloneList );

    //生成されたルートに先頭要素を足す
    for( var j = 0 , m = remainList.length ; j<m ; j++ ){
      remainList[j].unshift( head[0] );
      result.push( remainList[j] );
    }   
  }

  return result;
}


Measured memory_bytes: 50484
n=int(input())
a=list(map(int,input().split()))
b=[]
i=n-1
if n==1:
    print(a[0])
    exit()
for _ in range(n//2+1):
    b.append(a[i])
    i-=2
    if i<=-1:
        break
if n%2==0: 
    i=0
else:
    i=1
for _ in range(n//2+1):
    b.append(a[i])
    i+=2
    if i>=n-1:
        break
print(' '.join(map(str,b)))

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

int n,m;
int x,y,z;
int ans=0;
int f[100002];
vector<pair<int,int> >vec[100002];

int slv(int now){
	f[now]=1;
	for(int i=0;i<vec[now].size();i++){
		int next = vec[now][i].first;
		if(f[next]==0){
			slv(next);
		}
	}
	return(0);
}

int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		f[i]=0;
		cin>>x>>y>>z;
		vec[x].push_back(make_pair(y,z));
		vec[y].push_back(make_pair(x,z));
	}

	for(int i=1;i<=n;i++){
		if(f[i]==0){
			ans++;
			slv(i);
		}
	}

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

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)
#define SUM(v) accumulate((v).begin(),(v).end(),0ll)
#define range(i,left,right) (left<=i && i<right)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

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;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int iscount(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    int n,k,c;
    string s;
    cin>>n>>k>>c>>s;
    Vi work1(n),work2(n);

    int i=0,count=0;
    while(i<n){
        if(s[i]=='o'){
            work1[i]=1;
            count++;
            i += c+1;
        }else{
            i++;
        }
    }
//    cout<<count<<endl;
    if(count!=k) return 0;

    int j=n-1;
    while(j>=0){
        if(s[j]=='o'){
            work2[j]=1;
            j -= c+1;
        }else{
            j--;
        }
    }
    REP(k,0,n){
        if(work1[k]==1 && work2[k]==1){
            cout<<k+1<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5012
#include<bits/stdc++.h>
#define pb push_back
#define NL cout<<'\n';
using namespace std;

int main(){

    int t=1;
   // cin >> t;
    while(t--){

         int n;
         int l,r,d;
         cin >> l >> r >> d;

         cout<<r/d - (l-1)/d<<endl;

    }

  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
const ll key = 998244353;
int main() {
	int n;
	while (cin >> n, n) {
		string s, t; int tim[100000] = {};
		for (int i = 0; i < n; i++) {
			cin >> s >> t;
			int sta = 0; int las = 0;
			sta += 36000 * (s[0] - '0');
			sta += 3600 * (s[1] - '0');
			sta += 600 * (s[3] - '0');
			sta += 60 * (s[4] - '0');
			sta += 10 * (s[6] - '0');
			sta += s[7] - '0';
			las += 36000 * (t[0] - '0');
			las += 3600 * (t[1] - '0');
			las += 600 * (t[3] - '0');
			las += 60 * (t[4] - '0');
			las += 10 * (t[6] - '0');
			las += t[7] - '0';
			tim[sta+1]++;
			tim[las+1]--;
		}
		for (int i = 1; i < 100000; i++) {
			tim[i] += tim[i - 1];
		}
		int ma = 0;
		for (int i = 0; i < 100000; i++) {
			ma = max(ma, tim[i]);
		}
		cout << ma << endl;
	}
	return 0;
}


Measured memory_bytes: 3500
// ABC 126 A: Changing a character
// https://atcoder.jp/contests/abc126/tasks/abc126_a
#include <iostream>
#include <string>

int main() {
    int str_len, nth; std::cin >> str_len >> nth;
    std::string abc; std::cin >> abc;
    nth--;
    if (abc.at(nth) == 'A') abc.at(nth) = 'a';
    else if (abc.at(nth) == 'B') abc.at(nth) = 'b';
    else abc.at(nth) = 'c';
    std::cout << abc; 
}

Measured memory_bytes: 256
worda=input()
nagasa=len(worda)
word=""
for i in range(nagasa):
    word+=worda[nagasa-i-1]
#print(word)

status=0
renzoku=0
kazu=0

for i in range(nagasa):
    if word[i]=='C':
        if status==3:
            pass
        if status==2:
            pass
        if status==1:
            renzoku=0
        if status==0:
            renzoku=0
        status=1
    elif word[i]=='B':
        if status==3:
            renzoku=0
        if status==1:
            status=2
            renzoku+=1
        else:
            status=0
            renzoku=0
    else:
        if status==1:
            status=0
        elif status==2:
            kazu+=renzoku
            status=3
        elif status==3:
            kazu+=renzoku

print(kazu)

Measured memory_bytes: 3500
#include<stdio.h>
#define N 100000

typedef struct{
  char name[100];
  int time;
} queue;

queue q[100000];
int head=0,tail=0;

void enqueue(queue);
queue dequeue(void);

int main(){
  int n,i,quantum,count=0,sum=0;
  queue nt;

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

  for(i=0;i<n;i++){
    scanf("%s%d",nt.name,&nt.time);
    enqueue(nt);
  }

  while(1){
    if(head==tail) break;
    else if(q[head].time>quantum){
      nt=dequeue();
      nt.time=nt.time-quantum;
      enqueue(nt);
      sum=sum+quantum;
    }
    else{
      nt=dequeue();
      printf("%s %d\n",nt.name,nt.time+sum);
      sum=sum+nt.time;
    }
  }
  return 0;
}

void enqueue(queue a){
  q[tail]=a;
  if(tail+1==N){
    tail=0;
  }
  else tail++;
}

queue dequeue(){
  queue z;

  z=q[head];
  if(head+1==N){
    head=0;
  }
  else head++;
  return z;
}

Measured memory_bytes: 10756
def main():
	V,E,r,*L = map(int,open(0).read().split())
	INF = float("inf")
	G = [[] for _ in range(V)]
	for s,t,c in zip(*[iter(L)]*3):
		G[s].append((t,c))
	for i in dijkstra(G,r):
		if i==INF:
			print("INF")
		else:
			print(i)

from heapq import heappop,heappush
def dijkstra(G:list, source=0):
	INF = float("inf")
	V = len(G)
	D = [INF]*V
	D[source] = 0
	vis = [False]*V
	H = [(0,source)]
	while H:
		dist, cur = heappop(H)
		if vis[cur]:
			continue
		vis[cur] = True
		for nxt, cost in G[cur]:
			t = dist + cost
			if D[nxt] > t:
				D[nxt] = t
				heappush(H, (t, nxt))
	return D

if __name__=="__main__":main()


Measured memory_bytes: 167356
n = gets.chomp.to_i
s = gets.chomp.chars

i, j = 0, n - 1

answer = 0
while i < j do
  if s[i] == 'W' && s[j] == 'R'
    s[i] == 'R'
    s[j] == 'W'
    answer += 1

    i += 1
    j -= 1
  else
    i += 1 if s[i] == 'R'
    j -= 1 if s[j] == 'W'
  end
end

puts answer


Measured memory_bytes: 30680
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;
vector<int> to[100005];

int main(){
    int n;
    int m;
    cin >> n >> m;
    int h[n];
    rep(i,n)cin >> h[i];
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--,b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    int ans = 0;
    rep(i,n){
        bool ok = 1;
        for(auto j:to[i]){
            if(h[i]<=h[j])ok=0;
        }
        if(ok)ans++;
    }
    cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++){
        cin >> A.at(i);
        cout << A.at(i);
        if(i < n-1){
            cout << " ";
        }
    }
    cout << endl;

    for(int i = 1; i < n; i++){
        int v = A.at(i);
        int j = i - 1;
        while(j >= 0 && A.at(j) > v){
            A.at(j+1) = A.at(j);
            j--;
        }
        A.at(j+1) = v;
        for(int k = 0; k < n; k++){
            cout << A.at(k);
            if(k < n-1){
                cout << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;


int main(){

  ll N;cin>>N;
    vector<string> A(N+1);
    
    for(int i=0;i<N;i++){
        cin>>A[i];
        sort(all(A[i]));
    }
    
    A[N]="zzzzzzzzzzz";
    
    sort(all(A));
    
    ll ans=0;
    
    ll now=0;
    
    for(ll i=1;i<N+1;i++){
        bool ok=true;
        
        if(A[now]!=A[i]) ok=false;
        if(!ok){
            ans+=(i-now)*(i-now-1)/2;
            now=i;
        }
    }
    
    cout<<ans<<endl;
}



Measured memory_bytes: 7424
#include<stdio.h>

int main(void)
{
	int H=1,W=1;
	
	for(;H!=0&&W!=0;){
		
		scanf("%d %d",&H,&W);
		
		for(int s=0;s<H;s++){
			
			for(int t=0;t<W;t++){
				
				if((s+2)%2==0){
					
					if((t+2)%2==0){
					
					printf("#");
					
				}
				else printf(".");
				}
				else if((t+2)%2==0){
					
					printf(".");
					
				}
				else printf("#");
			}
			printf("\n");
		}
		if(H!=0&&W!=0){
			
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2588
/*
 *  AUTHOR : MANAV PATEl
*/
#include<bits/stdc++.h>
#include<functional>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

namespace fastio {

	template <class T> istream &operator>>(istream &os, vector<T> & vec) {
		for (auto &u : vec)os >> u;
		return os;
	}
	template <class T> ostream &operator<<(ostream &os, const vector<T> & vec) {
		for (auto &u : vec)os << u << " ";
		return os;
	}
	template<class T1, class T2> inline istream& operator>>(istream& os, pair<T1, T2>& p) {
		return os >> p.first >> p.second;
	}
	template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
		return os << p.first << " " << p.second;
	}
	template <class T> ostream &operator<<(ostream &os, set<T> & con) {
		for (auto &u : con) os << u << " ";
		return os;
	}
	void re() {}
	template <typename T, typename... args> void re(T& x, args&... tail) {
		cin >> x;
		re(tail...);
	}
	void pr() {}
	template <typename T> void pr(const T& x) {
		cout << x;
	}
	template <typename T, typename... args> void pr(const T& x, const args&... tail) {
		cout << x << " ";
		pr(tail...);
	}
	template <typename... args> void prln(const args&... tail) {
		pr(tail...);
		cout << "\n";
	}
}
using namespace fastio;

typedef long long int ll;
typedef long double ld;

const ll mod = 1e9+7;
const ll mod1 = 998244353;

#define fill(a)  memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back

int main()
{
	cin.sync_with_stdio(false);
	cin.exceptions(cin.failbit);
	cin.tie(0);
	ll a, b;
	re(a,b);
	ll x = a*b;
	ll x1 = __gcd(a,b);
	cout<<x/x1;
}


Measured memory_bytes: 256
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<random>
#include<ctime>
#include<complex>
using namespace std;
typedef long long LL;
mt19937 gene(233);
typedef complex<double> Complex;
#define fi first
#define se second
#define ins insert
#define pb push_back
inline char GET_CHAR(){
	const int maxn = 131072;
	static char buf[maxn],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxn,stdin),p1==p2)?EOF:*p1++;
}
inline int getInt() {
	int res(0);
	char c = getchar();
	while(c < '0') c = getchar();
	while(c >= '0') {
		res = res * 10 + (c - '0');
		c = getchar();
	}
	return res;
}

inline LL fastpo(LL x, LL n, LL mod) {
	LL res(1);
	while(n) {
		if(n & 1) {
			res = res * (LL)x % mod;
		}
		x = x * (LL) x % mod;
		n /= 2;
	}
	return res;
}

inline string itoa(int x, int width = 0) {
  string res;
  if(x == 0) res.push_back('0');
  while(x) {
    res.push_back('0' + x % 10);
    x /= 10;
  }
  while((int)res.size() < width) res.push_back('0');
  reverse(res.begin(), res.end());
  return res;
}
template<const LL mod> struct MI{
	LL a;
	MI operator + (const MI & b) {
		MI res{a + b.a};
		if(res.a >= mod) res.a -= mod;
		return res;
	}
	MI operator - (const MI & b) {
		MI res{a - b.a};
		if(res.a <= 0) res.a += mod;
		return res;
	}
	MI operator * (const MI & b) {
		return MI{a * b.a % mod};
	}
	MI operator / (const MI & b) {
		return MI{a * fastpo(b.a, mod - 2, mod) % mod};
	}
};
const int N = 300033;
const int LOG = 20;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int f[N];
int main() {
	string t;
	cin >> t;
	int n = t.size();
	int sta = 1;
	int cnt = 0;
	LL ans = 0;
	for(int i = 0; i < n; i++) {
		if(sta) {
			if(t[i] == '1') {
				cnt++;
				ans += cnt;
				f[i] = true;
				sta = 0;
			}
		}else {
			ans += cnt;
			f[i] = true;
			sta = 1;
		}
	}
	int len = 0;
	for(int i = 0; i < n; i++) len += f[i];
	int c0 = 0, c1 = 0;
	for(int i = n - 1; i >= 0; i--) {
		if(!f[i]) {
			swap(c0, c1);
			if(t[i] == '1') c0++;
			ans = ans + (len + 1) / 2 + (len % 2 == 0 ? c0 : c1);
		}else {
			len--;
			swap(c0, c1);
			if(t[i] == '1') c0++;
		}
	}
	cout << ans << endl;
}






Measured memory_bytes: 4544
#include <bits/stdc++.h>
#define de(x) cout << #x << "=" << x << ", "
#define dd cout << '\n';
#define Eriri ios::sync_with_stdio(0), cin.tie(0);
#define F first
#define S second
#define int long long
using namespace std;
typedef pair<int,int> Pii;
const int N = 1e5+10;

int dp[N], n, h[N];

signed main()
{
    Eriri
    cin >> n;
    for (int i=1; i<=n; i++)
        cin >> h[i];
    dp[n-1] = abs(h[n]-h[n-1]);
    for (int i=n-2; i>0; i--)
    {
        dp[i] = min(dp[i+1] + abs(h[i] - h[i+1]),dp[i+2] + abs(h[i] - h[i+2]));
    }
    cout << dp[1] << '\n';
}

Measured memory_bytes: 5184
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <locale>
#include<set>



using namespace std;

#define MAX 300000
int main() {
    int h,w,i,j;
    bool flg;
    cin>>h>>w;
    vector<vector<char>> s(h,vector<char>(w));

    for(i=0;i<h;i++) {
        for (j = 0; j < w; j++) {
            cin>>s[i][j];
        }
    }
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if(s[i][j]=='#'){
                flg=false;
                if(j!=0&&s[i][j-1]=='#') {
                    flg=true;
                }
                if(j!=w-1&&s[i][j+1]=='#'){
                    flg=true;
                }
                if(i!=0&&s[i-1][j]=='#') {
                    flg=true;
                }
                if(i!=h-1&&s[i+1][j]=='#'){
                    flg=true;
                }

                if(!flg){
                    cout << "No" << endl;
                    return 0;
                }
            }

        }
    }


    std::cout << "Yes" << std::endl;
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
fn main() {
    use std::cmp::max;
    use std::cmp::min;

    input!{
        x: usize,
        a: usize,
        b: usize,
    }
    println!("{}", (x-a)%b);
}


Measured memory_bytes: 4352
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class B
{
	public static void Main()	
	{
		int N = Int32.Parse(Console.ReadLine());
		int numSitting = 0;
		for(int i = 0; i < N; i++)
		{
			string[] args = Console.ReadLine().Split(' ');
			int l = Int32.Parse(args[0]);
			int r = Int32.Parse(args[1]);
			numSitting += r - l + 1;
		}
		Console.WriteLine(numSitting);
	}
}





Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  int i;
  int od=0;
  int tw=0;
  int fo=0;
  for(i=0;i<n;i++){
    cin>>a.at(i);
    if(a.at(i)%2==0){
      if(a.at(i)%4==0){
      fo++;
      }else{
      tw++;
      }
    }else{
    od++;
    }
  }
  if(tw==0){
    if((fo+2)>od){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }else{
    if(fo>=od){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
  
}


Measured memory_bytes: 640
N=int(input())
H=list(map(int,input().split()))
H.insert(0,0)#H[i]はiコメの高さ
current=[0,0]#current[x]はx個目まで行く時のコストの最安値
current.append(abs(H[2]-H[1]))
for i in range(3,N+1):#i個目まで行くときのコストの最安値を追加
    one=current[i-1]+abs(H[i]-H[i-1])
    two=current[i-2]+abs(H[i]-H[i-2])
    current.append(min([one,two]))
print(current[-1])


Measured memory_bytes: 53624
#include <stdio.h>

int main()
{
	int n, m, l;
	scanf("%d %d %d", &n, &m, &l);

	int first[n][m], second[m][l];
        long result[n][l];

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			scanf("%d", &first[i][j]);
		}
	}

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			scanf("%d", &second[i][j]);
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			result[i][j] = 0;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				result[i][j] = result[i][j] + first[i][k] * second[k][j];
			}
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			printf("%ld", result[i][j]);
                        if (j != l -1) printf(" ");
		}
		printf("\n");
	}
}


Measured memory_bytes: 2104
def q_c():
    a, b = map(int, input().split())

    if a > b:
        tmp = a
        a = b
        b = tmp

    b0 = b
    a0 = a
    while b % a != 0:
        c = b % a
        b = a
        a = c

    print(int(b0 * a0 / a))


if __name__ == '__main__':
    q_c()


Measured memory_bytes: 3060
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

dp = [[0] * (3) for i in range(n)]

dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]
for i in range(1, n):
    dp[i][0] = max(a[i] + dp[i - 1][1], a[i] + dp[i - 1][2])
    dp[i][1] = max(b[i] + dp[i - 1][0], b[i] + dp[i - 1][2])
    dp[i][2] = max(c[i] + dp[i - 1][0], c[i] + dp[i - 1][1])

print(max(dp[n - 1]))

Measured memory_bytes: 34636
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<typeinfo>
#include<functional>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




struct P{
    ll a;
    char c;
    
    bool operator < (const P &p){
        return a<p.a;
    }
    
    bool operator > (const P &p){
        return a>p.a;
    }
};

void select_sort(vector<P> &A){
    for(int i=0;i<A.size();i++){
        ll mi=i;
        for(int t=i;t<A.size();t++){
            if(A[t]<A[mi]){
                mi=t;
            }
        }
        swap(A[i],A[mi]);
    }
}


void merge_sort(vector<P> &A){
    bool j=true;
    while(j){
        j=false;
        for(int i=0;i+1<A.size();i++){
            if(A[i]>A[i+1]){swap(A[i],A[i+1]); j=true;}
        }
    }
}


int main(){
    ll n;
    cin>>n;
    vector<P> A(n);
    vector<P> B(n);
    for(int i=0;i<n;i++){
        char c;
        ll a;
        cin>>c>>a;
        A[i]={a,c};
        B[i]={a,c};
    }
    merge_sort(A);
    select_sort(B);
    for(int i=0;i<A.size();i++){
        cout<<A[i].c<<A[i].a;
        if(i+1!=A.size()){cout<<" ";}
    }
    cout<<endl<<"Stable"<<endl;
    bool s=true;
    for(int i=0;i<B.size();i++){
        cout<<B[i].c<<B[i].a;
        if(i+1!=B.size()){cout<<" ";}
        if(B[i].c!=A[i].c){s=false;}
    }
    cout<<endl<<(s?"Stable":"Not stable")<<endl;
    
    
    
    
    return 0;
}



Measured memory_bytes: 3116
from itertools import*
def g():
 n=int(input())
 a=[[s for s in input().split()]for _ in range(n)]
 for b in a:
  b[3:5]=b[4],b[3]
 t=0
 for d,e in combinations(a,2):
  for p in('012345','152043','215304','302541','410352','514320'):
   f=[d[int(i)]for i in p]
   if f[0]==e[0]and f[5]==e[5]:
    f=f[1:5]*2
    for k in range(4):
     if f[k:k+4]==e[1:5]:t=1
 print(['Yes','No'][t])
g()


Measured memory_bytes: 5660
nums = gets.chomp
n = nums.length
t = 2**(n - 1)
sum = 0

t.times do |i|
	loc_plus = i.to_s(2).rjust(n-1,"0")
	prev = 0
	j = 0
	res = 0
	
	# puts loc_plus
	
	while j < loc_plus.length
		while loc_plus[j] == "0"
			j += 1
		end
		# puts "--#{nums[prev..j].to_s.to_i}"
		res += nums[prev..j].to_s.to_i
		prev = j+1
		j += 1
	end
	# puts "--#{nums[prev..j].to_s.to_i}"
	res += nums[prev..j].to_s.to_i
	sum += res
end


puts sum

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>    // std::copy
#include <iterator>     // std::back_inserter
using namespace std;

struct TNode
{
	int Id;
	TNode* Parent;
	TNode* LChild;
	TNode* RChild;
};

vector<int> Input(int n)
{
	vector<int> Tree(n);
	for(int i = 0; i < n; i++){
		cin >> Tree[i];
	}
	return Tree;
}

void PostorderOutput(const TNode* Node)
{
	if(Node == NULL) return;
	PostorderOutput(Node->LChild);
	PostorderOutput(Node->RChild);
	cout << Node->Id;
	if(Node->Parent){
		cout << ' ';
	}else{
		cout << endl;
	}
}

void Delete(const TNode* Node)
{
	if(Node == NULL) return;
	Delete(Node->LChild);
	Delete(Node->RChild);
	delete Node;
}

vector<int> Subvec(vector<int> X, int m, int n)
{
	vector<int> Y;
	for(int i = m; i <= n; i++){
		Y.push_back(X[i]);
	}
	return Y;
}

TNode* MakeTree(const vector<int>& PreorderRow, const vector<int>& InorderRow)
{
	//PreorderRow????????????????´?Root?????¨???*
	int Root = PreorderRow[0];
	
	//InorderRow??????????????????Root??????InorderRowLeft?????¨???
	vector<int>::const_iterator it = find(InorderRow.begin(), InorderRow.end(), Root);
	int RootIndex = it - InorderRow.begin();
	
	vector<int> InorderRowLeft;
	copy(InorderRow.begin(), InorderRow.begin() + RootIndex, back_inserter(InorderRowLeft));
	
	//PreorderRow???2??????????????????InorderRowLeft??¨???????????°???PreorderRowLeft?????¨???
	vector<int> PreorderRowLeft;
	
	copy(PreorderRow.begin() + 1, PreorderRow.begin() + RootIndex + 1, back_inserter(PreorderRowLeft));
	
	//PreorderRow??¨InorderRow???????????????PreorderRowRight,InorderRowRight?????¨???
	vector<int> PreorderRowRight;
	copy(PreorderRow.begin() + RootIndex + 1, PreorderRow.begin() + PreorderRow.size(), back_inserter(PreorderRowRight));
	vector<int> InorderRowRight;
	copy(InorderRow.begin() + RootIndex + 1, InorderRow.begin() + InorderRow.size(), back_inserter(InorderRowRight));
	
	//ID???Root??¨????????????????????????**
	TNode* RootNode;
	RootNode = new TNode;
	*RootNode = {Root, NULL, NULL, NULL};
	
	//PreorderRowLeft,InorderRowLeft??????*~**??¨????§???????????????????(?????????????´????RootLeft??¨??????)
	if(PreorderRowLeft.size() > 0){
		TNode* LeftNode = MakeTree(PreorderRowLeft, InorderRowLeft);
		//Root??¨RootLeft???????????????
		RootNode->LChild = LeftNode;
		LeftNode->Parent = RootNode;
	}
	
	//PreorderRowRight,InorderRowRight??????*~**??¨????§???????????????????(?????????????´????RootRight??¨??????)
	if(PreorderRowRight.size() > 0){
		TNode* RightNode = MakeTree(PreorderRowRight, InorderRowRight);
		//Root??¨RootRight???????????????
		RootNode->RChild = RightNode;
		RightNode->Parent = RootNode;
	}
	
	return RootNode;
}

int main()
{
	int n;
	cin >> n;
	vector<int> PreorderRow = Input(n);
	vector<int> InorderRow  = Input(n);
	TNode* RootNode = MakeTree(PreorderRow, InorderRow);
	PostorderOutput(RootNode);
	Delete(RootNode);
    return 0;
}

Measured memory_bytes: 3164