akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std; 
typedef pair<long long int,long long int> pa;
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
#define pb push_back
#define  MAX 200000
long long int MOD=998244353;
long long int INF=1e18;
/*    :-]  */
 
int main()
{
         ios_base::sync_with_stdio(false); 
         cin.tie(NULL);
         cout.tie(NULL);
         long long int i,j,k=0,l=0,r=0,m=0,n,c,p=0,cnt=0,cnt1=0,x,y,z=0,a,b,low,mid,high,ans=0,maxi=0,mini=INF,t,x1,y1;
         cin>>n;
         string s;
         cin>>s;
         low=1;
         high=n-1;
         ans=0;
    while(low<=high)
    {
        mid=(low+high)/2;
        string s1="";
        string s2="";
        x=0;
        map<string,long long int>ma;
        for(i=0;i<mid;i++)
        {
            s1.push_back(s[i]);
        }
        ma[s1]=i-mid;
        
        for(i=mid;i<n;i++)
        {
            reverse(s1.begin(),s1.end());
            s1.pop_back();
            reverse(s1.begin(),s1.end());
            s1.push_back(s[i]);
            
            if(ma.find(s1)!=ma.end())
            {
                if(ma[s1]+mid<=i-mid+1)
                {
                    x=1;
                }
            }
            else
                ma[s1]=i-mid+1;
        }
        if(x==0)
        {
            high=mid-1;
        }
        else
        {
            ans=max(ans,mid);
            low=mid+1;
        }
    }
    cout<<ans<<endl;
 
    
    
}

Measured memory_bytes: 6704
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}

int main(){
    int k,n;
    cin >> k >> n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }
    vector<int>b(n);
    for(int i=1;i<n;i++){
        b.at(i-1)=abs(a.at(i)-a.at(i-1));
    }
    b.at(n-1)=k-abs(a.at(0)-a.at(n-1));
    ll ans = 0;
    sort(b.begin(),b.end());
    for(int i=0;i<n-1;i++){
        ans+=b.at(i);
    }
    cout << ans <<endl;
}



Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N, M;
    cin >> N >> M;
    int lmax = 0;
    int rmin = 100001;
    int l, r;
    for(int i = 0; i < M; i++){
        cin >> l >> r;
        if(l > lmax) lmax = l;
        if(r < rmin) rmin = r;
    }
    
    if(rmin < lmax) cout << 0 << endl;
    else cout << (rmin- lmax) + 1 << endl;
}


Measured memory_bytes: 256
import heapq
import queue

N, K = map(int, input().split())

trees = []
heapq.heapify(trees)

for _ in range(N):
    heapq.heappush(trees, int(input()))

ans = 1 + 10**9

q = queue.Queue(maxsize=K-1)

for _ in range(K-1):
    q.put(heapq.heappop(trees))

for _ in range(N-K+1):
    curmin = q.get()
    nextmin = heapq.heappop(trees)

    ans = min(ans, nextmin-curmin)

    q.put(nextmin)

print(ans)


Measured memory_bytes: 8212
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author emli
 */


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define pow5(x) x*x*x*x*x
class DIHateFactorization {
public:
    void solve(std::istream& cin, std::ostream& cout) {
		ios::sync_with_stdio(false);
        cin.tie(nullptr);



        ll x;

        cin >> x;

        for(ll a = -1000; a <= 1000; a++)
            for(ll b = -1000; b <= 1000; b++)
                    if (pow5(a) - pow5(b) == x){
                        cout << a << " " << b << endl;
                        return;
                    }

	}
};




int main() {
	DIHateFactorization solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	vector <ll>a[100010];
	for(ll i=0;i<n-1;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		a[x].push_back(y);
		a[y].push_back(x);
	}
	queue<ll>s,f;
	f.push(0);
	s.push(n-1);
	ll ch[100010];
	for(ll i=0;i<n;i++){
		ch[i]=0;
	}
	ch[0]=1;
	ch[n-1]=2;
	while(f.size()!=0||s.size()!=0){
		queue<ll>F,S;
		while(f.size()!=0){
		ll now=f.front();f.pop();
		for(ll i=0;i<a[now].size();i++){
			ll next=a[now][i];
			if(ch[next]!=0){
				continue;
			}
			ch[next]=1;
			F.push(next);
		}
		}
		while(s.size()!=0){
		ll now=s.front();s.pop();
		for(ll i=0;i<a[now].size();i++){
			ll next=a[now][i];
			if(ch[next]!=0){
				continue;
			}
			ch[next]=2;
			S.push(next);
		}
		}
		while(F.size()!=0){
			ll now=F.front();F.pop();
			f.push(now);
		}
		while(S.size()!=0){
			ll now=S.front();S.pop();
			s.push(now);
		}
	}
	ll cntf=0,cnts=0;
	for(ll i=0;i<n;i++){
		if(ch[i]==1){
			cntf++;
		}
		else if(ch[i]==2){
			cnts++;
		}
	}
//	cout << cntf<<endl;
//	cout << cnts<<endl;
	if(cntf>cnts){
		cout << "Fennec";
	}
	else{
		cout << "Snuke";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 7296
def resolve():
	count = 0
	msg = 'No'
	N = int(input())
	for n in range(N):
		D = input().split()
		if D[0] == D[1]:
			count += 1
			if count == 3:
				msg = 'Yes'
				break
		else:
			count = 0
	print(msg)
resolve()

Measured memory_bytes: 9176
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(ll i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF (INT_MAX / 2)

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

int main(void){
    ll n,money=1000,stock=0;
    cin>>n;
    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n-1){
        if(a[i]<a[i+1]){
            //i日目
            stock=money/a[i];
            money%=a[i];
            //i+1日目の朝
            money+=a[i+1]*stock;
            stock=0;
        }
    }
    cout<<money;
}
/*
a[i] <  a[i+1] : buy  -> sell
a[i] >= a[i+1] : none
*/

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

#include <math.h>

void vec_diff(int N, long long int *a, long long int *b){
	/* Calcurate the difference of two vectors. Be caution that b[N] changes.*/
	for (int i = 0; i < N; i++){
		b[i] -= a[i];
	}
}

int main(){


	long long int *A, *w, sum;
	int i, j, k, N, p;


	scanf("%d", &N);

	A = (long long int *)malloc(N * sizeof(long long int));


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


	sum = 0;
	for (i = 0; i < N; i++){
		if (i % 2 == 0){
			sum += A[i];
		}
		else{
			sum -= A[i];
		}
	}
	printf("%lld ", sum);

	for (i = 1; i < N; i++){
		sum = 2 * A[i - 1] - sum;
		printf("%lld ", sum);
	}
		return(0);
	}

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

typedef long long ll;
typedef pair<int, int> ii;

int n;
int cnt[10][10];

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

  cin >> n;

  for (int i = 1; i <= n; ++i) {
    int last = i % 10;
    if (last == 0) continue;
    int num = i;
    while (num >= 10) {
      num /= 10;
    }
    int first = num;
    ++cnt[first][last];
  }

  int res = 0;
  for (int i = 1; i <= 9; ++i) {
    for (int j = 1; j <= 9; ++j) {
      res += cnt[i][j] * cnt[j][i];
    }
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc106/tasks/abc106_b


def solve(N):
    result = 0
    for x in range(1, N+1, 2):
        divisor_cnt = 0
        # print('x: {}'.format(x))
        for i in range(1, x+1, 2):
            # print('i: {}'.format(i))
            if x % i == 0:
                divisor_cnt += 1
        if divisor_cnt == 8:
            result += 1

    return result


if __name__ == "__main__":
    N = int(input())
    print(solve(N))


Measured memory_bytes: 38896
n = int(input())
l = []
for i in range(1, 50401):
    l.append(int(i*1.08))
if n in l:
    if n/108*100 % 1 == 0:
        print(int(n/108*100))
    else:
        print(int(n/108*100)+1)
else:
    print(":(")


Measured memory_bytes: 41968
N = int(input())
A, B, C = [], [], []
for _ in range(N):
    a, b, c = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)

dp = [[0] * 3 for _ in range(N + 5)]
for i in range(3):
    dp[0][i] = 0

for i in range(N):
    dp[i + 1][0] = max(dp[i][1] + A[i], dp[i][2] + A[i])
    dp[i + 1][1] = max(dp[i][0] + B[i], dp[i][2] + B[i])
    dp[i + 1][2] = max(dp[i][0] + C[i], dp[i][1] + C[i])
# print(dp)
ans = 0
for i in range(N + 1):
    for j in range(3):
        ans = max(ans, dp[i][j])
print(ans)

Measured memory_bytes: 78808
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}} return v;}

signed _main(){
  int N; cin >> N;
  unordered_map<int,int> mp;
  v<int> A(N);
  rep(i,N){
    cin >> A[i];
    mp[A[i]]++;
  }

  sort(ALL(A));
  set<int> se;
  int ans=1;
  if(mp[A[0]]==1){
    ans=1;
  }
  else ans=0;
  se.insert(A[0]);
  for(int i=1;i<N;i++){
    if(mp[A[i]]>=2){
      se.insert(A[i]);
      continue;
    }
    v<int> num=getDivisor(A[i]);
    int counter=0;
    fore(j,num){
      //cout << A[i] << " num: " << j << endl;
      if(se.find(j)==se.end()){
        counter++;
      }
    }
    if(counter==SZ(num)){
      ans++;
      se.insert(A[i]);
    }

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


Measured memory_bytes: 22320
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N, x; cin >> N >> x;
    vector<int> B(N);
    rep(i,N) {
        cin >> B.at(i);
    }
    ll step = 0;
    if (B[0] > x) {
        step += B[0] - x;
        B[0] -= step;
    }
    for (int i = 0; i < N-1; i++) {
        ll WA = B[i] + B[i+1];
        if (WA > x) {
            ll diff = WA - x;
            step += diff;
            if (B[i+1] < diff) {
                diff -= B[i+1];
                B[i+1] = 0;
                B[i] -= diff;
            } else {
                B[i+1] -= diff;
            }
        }
    }
    cout << step << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
string s;
bool a[10];
bool check=false;
void dfs(int i,int sum){
    if(i==s.length()){
        if(sum==7&&check==false){
            cout << s[0];
            for(int j=1;j<s.length();j++){
                if(a[j]==true) cout << "+";
                else cout << "-";
                cout << s[j];
            }
            cout << "=7\n";
            check=true;
        }
    } 
    else{
        a[i]=true;
        dfs(i+1,sum+(s[i]-'0'));
        a[i]=false;
        dfs(i+1,sum-(s[i]-'0'));
    }
}

int main(){
    cin >> s;
    fill(a,a+10,false);
    dfs(1,s[0]-'0');
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100


void selectionsort(int A[], int n, int *c){
  int i,j,s,minj=0;

  for(i=0;i<=n-1;i++){
    minj=i;
    for(j=i;j<=n-1;j++){
      if(A[j]<A[minj])
	minj = j;
    }
    if(A[i]!=A[minj])
      (*c)++;
    s=A[i];
    A[i]=A[minj];
    A[minj]=s;
  }
}




int main(){

  int A[N],n,i,c=0;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    scanf("%d",&A[i]);

  selectionsort(A,n,&c);

  for(i=0;i<n;i++){
    if((i+1)==n)
      printf("%d",A[i]);
    else
      printf("%d ",A[i]);
  }
  putchar('\n');
  printf("%d",c);
  putchar('\n');
  return 0;

}



Measured memory_bytes: 2732
participants = gets.to_i
heights = gets.split.map(&:to_i)

dp = Array.new(participants * 2) { 0 }

res = 0

heights.each_with_index do |el, index|
  dp[el + index] += 1 if el + index < participants * 2

  res += dp[index - el] if el < index
end

puts res

Measured memory_bytes: 30468
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
 
using namespace std;
typedef long long int lli;
//const int MAX=;
 
int main(){
	int N,A,B;
	cin>>N>>A>>B;
	cout<<min(A,B)<<" "<<max(0,(A+B-N));
}

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

#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < int(n); i++)

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int MOD = 1000000007;
std::vector<int> graph[100001];
int incoming[100001];
int dp[100001];
int ans = 0;

int DFS(int node) {
    if(dp[node] != -1) return dp[node];
    dp[node] = 0;
    for(int x : graph[node]) {
        dp[node] = max(dp[node], DFS(x) + 1);
    }
    return dp[node];
}

int main() {
    IOS;
    memset(dp, -1, sizeof(dp));
    int n, m;
    cin >> n >> m;
    while(m--) {
        int u, v;
        cin >> u >> v;
        graph[u].push_back(v);
        incoming[v]++;
    }
    for(int i = 1; i <= n; i++) {
        if(incoming[i] == 0) {
            ans = max(DFS(i), ans);
        }
    }
    cout << ans;
    return 0;
}

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

int main(){
	int k,a[100005];
	ll Min=2,Max=2;
	cin>>k;
	for(int i=0; i<k; i++)cin>>a[i];
	for(int i=k-1; i>=0; i--){
		Min=((Min-1)/a[i]+1)*a[i];
		Max=Max/a[i]*a[i]+a[i]-1;
	}
	if(Min>Max)cout<<"-1"<<endl;
	else cout<<Min<<" "<<Max<<endl;
}



Measured memory_bytes: 640
#include<stdio.h>

char CheckZero(int* a_acX);

int main(void) {
	int acX[5] = { 0,0,0,0,0 };
	int i;	
	//5つの変数それぞれに数値を入力
	for (i = 0;i < 5;i++) {
		scanf("%d", &acX[i]);
	}
	//0が何番目の変数に代入されたかを判断し、それを出力
	printf("\n%d\n", CheckZero(acX));

	return 0;
}

/**********
*	5つの変数のうち何番目の変数に0が代入されたか確認する関数
*	*a_acX	入力された5つの変数
*/
char CheckZero(int* a_acX) {
	int i;
	//順番に0をかどうかを確認し、0があったら何番目の変数に入っているかを戻り値として返す
	for (i = 0;i < 5;i++) {
			if (a_acX[i] == 0) {
			break;

		}
		else {}
	}
	return(i+1);
}


Measured memory_bytes: 1724
#include <stdio.h>
#include <ctype.h>
           
int main(void)
{
int i,sum[26]={0};
char ABC,j;

while(scanf("%c",&ABC) != EOF)
           
/*EOF(ファイル終了[End Of File])でないかどうか確認*/

{
if (isalpha(ABC))
           
/*入力されたものがアルファベットかどうか確認*/
           
{
j = tolower(ABC);
sum[(j - 'a')]++;
           
/*入力されたアルファベットを小文字に変換&0~25の数値に変換*/
           
}
}
for(i = 'a';i <= 'z';i++)
{
printf("%c : %d\n",i,sum[(i -'a')]);
}
return 0;
}


Measured memory_bytes: 2048
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int ans[3] = { 0 };
	int N, A, B, P;
	cin >> N >> A >> B;
	rep(i, 0, N)
	{
		cin >> P;
		if (P <= A)ans[0]++;
		else if (P <= B)ans[1]++;
		else ans[2]++;
	}

	sort(ans, ans + 3);

	cout << ans[0] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
    #include <vector>
#include <algorithm>
    using namespace std;
     
    int main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int p, q , r;
      cin >> p >> q >> r;
      
      vector<int> arr;
      arr.push_back(p);
      arr.push_back(q);
      arr.push_back(r);
      sort(arr.begin(), arr.end());
      
      cout << arr[0] + arr[1];
      
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    string s; cin >> s;
    string t = "YAKI";

    if(s.size() < 4){
        cout << "No" << endl;
        return 0;
    }

    bool flg = true;
    for(int i=0; i<4; i++) if(s[i] != t[i]) flg = false;

    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
} 

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] n = sc.next().toCharArray();
		if (n[0]=='9' || n[1]=='9'){
        	System.out.print("Yes");
        }else{
			System.out.print("No");
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  for (int i = 1; i <= 100000; i++) {
    if (int(i*0.08) == a && int(i*0.1) == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;


int main(){
    string S, T;
    int cnt=0;
    cin >> S;
    cin >> T;
    for(int i=0;i<S.length();i++){
        if(S[i] != T[i]){
            cnt ++;
        }
    }
    cout << cnt << endl;


    return 0;
}


Measured memory_bytes: 3848
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define sort(v)     sort((v).begin(),(v).end())
#define rall(v)     (v).rbegin(),(v).rend()
#define rsort(v)     sort((v).rbegin(),(v).rend())
#define gcd(a,b)    __gcd((a),(b))
#define minn(v)     *min_element(v.begin(), v.end());
#define maxx(v)     *max_element(v.begin(), v.end());
#define print(x)    cout<<(x)<<endl;
typedef pair<int,int> pii;  
typedef vector<int> vi;


bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}
struct type{
    int k, i, j;
};
signed main() 
{
    fastio;
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(u==s)cout<<a-1<<" "<<b<<endl;
    else cout<<a<<" "<<b-1<<endl;
    
    
    
    
    
    
    
}


Measured memory_bytes: 256
from collections import deque
def enqlun(deq):
    temp = deq.popleft()
    if temp % 10 != 0:
        deq.append((temp*10)+(temp%10)-1)
    deq.append((temp*10)+(temp%10))
    if temp % 10 != 9:
        deq.append((temp*10)+(temp%10)+1)
K = int(input())
d = deque([1,2,3,4,5,6,7,8,9])
for i in range(K-1):
    enqlun(d)
print(d.popleft())

Measured memory_bytes: 11872
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int SumNumber(int n) {

    return (1 + n) * n / 2;

}

int main() {

    int n;
    int k;
    vector<int> numbers;
    
    int max_sum = 0;
    int max_index = 0;

    int now_sum = 0;

    cin >> n >> k;

    max_index = k - 1;

    for(int i = 0; i < n; ++i) {
        int num;
        cin >> num;

        numbers.push_back(num);

        if(i < k) {
            max_sum += num;
            now_sum += num;
        } 
        else {
            now_sum += num;
            now_sum -= numbers[i - k];


            if(now_sum > max_sum) {
                max_sum = now_sum;
                max_index = i;


            }

        }

    }


    double answer = 0;

    for(int i = max_index; i > max_index - k; i--) {
        answer += (double)SumNumber(numbers[i]) / (double)numbers[i];
    }

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

    return 0;

}

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

int main() {
	int n,p;
	cin >> n;
	cin >> p;
	int d[n];
	for(int i = 0;i<n;i++)
		cin >> d[i];
	sort(d, d+n);
	int z[n-p+1];
	for(int i = 0;i<n-p+1;i++)
		z[i] = d[i+p-1]-d[i];
	sort(z, z+n-p+1);
	cout << z[0] << endl;
	return 0;
}

Measured memory_bytes: 1024
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        n:usize,
        a:[i64;n+1],
    }
    if n == 0 {
        if a[0] == 1 {
            println!("{}", 1);
            return;
        }
    }

    if a[0] != 0 {
        println!("{}", -1);
        return;
    }

    let mut l = vec![0; n + 2];
    let mut r = vec![0; n + 2];
    l[n] = a[n];
    r[n] = a[n];
    for i in (0..n).rev() {
        l[i] = a[i] + (l[i + 1] + 1) / 2;
        r[i] = a[i] + r[i + 1];
    }
    if l[0] > 1 {
        println!("{}", -1);
        return;
    }
    let mut now = 1;
    let mut ans = 0;
    for i in 0..=n {
        ans += now;
        now = min((now - a[i]) * 2, r[i + 1]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 5152
#define _CRT_SECURE_NO_WARNINGS

#pragma GCC optimize("O3")

#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstring>
#include <numeric>
#include <set>
#include <queue>
#include <deque>
#include <array>
#include <string>
#include <cmath>
#include <random>
#include <ctime>
#include <map>
#include <functional>
#include <bitset>
#include <complex>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using ld = long double;

const int N = 301;
int n;
ld dp[N + 1][N + 1][N + 1];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int c3 = 0; c3 < N; c3++) {
		for (int c2 = 0; c2 < N; c2++) {
				for (int c1 = 0; c1 < N; c1++) {
					if(c1 + c2 + c3) {
						dp[c1][c2][c3] = 1.0 * n / (c1 + c2 + c3) +
							(c1 ? 1.0 * c1 / (c1 + c2 + c3) * dp[c1 - 1][c2][c3] : 0) +
							(c2 ? 1.0 * c2 / (c1 + c2 + c3) * dp[c1 + 1][c2 - 1][c3] : 0) +
							(c3 ? 1.0 * c3 / (c1 + c2 + c3) * dp[c1][c2 + 1][c3 - 1] : 0)
							;
					}
			}
		}
	}
	vi c(3);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		c[x - 1]++;
	}
	cout.precision(10);
	cout << fixed << dp[c[0]][c[1]][c[2]];
}


Measured memory_bytes: 430336
a, b, k = map(int, input().split())
if (b < a):
    t = a
    a = b
    b = t

l = []
n = 0
while(b != n):
    n += 1
    if (a % n == 0 and b % n == 0):
        l.append(n)

print(l[-k])

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-

N = int(input())
H = [int(i) for i in input().split()]

j = 0
count = 0
num_lis = []

for j in range(N-1):
    if H[j] > H[j+1] or H[j] == H[j+1]:
        count += 1
    else:
        num_lis.append(count)
        count = 0

num_lis.append(count)
    
print(max(num_lis))

Measured memory_bytes: 14252
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 100005, mod = 1000000007;
int N, A, B, a[maxn], p[maxn];
int fac[maxn], inv[maxn];
int Pow(int x, int y) {
    int ans = 1;
    for(; y; y >>= 1, x = 1LL * x * x % mod)
	if(y & 1) ans = 1LL * ans * x % mod;
    return ans;
}
void init_fac(int n) {
    fac[0] = 1;
    for(int i = 1; i <= n; ++i) fac[i] = 1LL * fac[i - 1] * i % mod;
    inv[n] = Pow(fac[n], mod - 2);
    for(int i = n - 1; ~i; --i) inv[i] = 1LL * inv[i + 1] * (i + 1) % mod;
}
int C(int n, int m) {
    return 1LL * fac[n] * inv[m] % mod * inv[n - m] % mod;
}
int main() {
    scanf("%d", &N);
    for(int i = 1, a; i <= N + 1; ++i) {
	scanf("%d", &a);
	if(p[a]) A = p[a], B = i;
	p[a] = i;
    }
    B = N + 2 - B;
    init_fac(N + 1);
    for(int i = 1; i <= N + 1; ++i) {
	if(i == 1) printf("%d\n", N);
	else {
	    long long t = 0;
	    if(i <= N - 1) t = C(N - 1, i);
	    if(i >= 2) t = (t + C(N - 1, i - 2)) % mod;
	    t = (t + C(N - 1, i - 1) * 2LL % mod) % mod;
	    if(i <= A + B - 1) t = (t - C(A + B - 2, i - 1) + mod) % mod;
	    printf("%lld\n", (t + mod) % mod);
	}
    }
    return 0;
}


Measured memory_bytes: 2304
def main():
    N, A, B = (int(i) for i in input().split())
    if B < A or (N == 1 and A != B):
        return print(0)
    max_v = B*(N-1) + A
    min_v = A*(N-1) + B
    print(max(max_v - min_v + 1, 0))


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  S = input()
  d = {}
  for c in S:
    if not c in d:
      d[c] = 0
    d[c] += 1
  if len(d.keys()) == 2 and d[list(d.keys())[0]] == 2:
    print("Yes")
  else:
    print("No")

if __name__ == "__main__":
  main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
int n,a[200000],cnt=0;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>a[i];
        if(a[i]%2)cnt++;
    }
    if(cnt%2)puts("NO");
    else puts("YES");
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <queue>
#include <algorithm>

const int MAXN = 1e5 + 1;

int n, m, ans, cur;

struct job {
    int wait, val;

    job(int ww = 0, int vv = 0) {
        wait = ww;
        val = vv;
    }

    bool operator < (const job &another) const {
        return wait < another.wait;
    }
}arr[MAXN];

struct node {
    int key;

    node (int kk = 0) {
        key = kk;
    }

    bool operator < (const node &another) const {
        return key < another.key;
    }
};

std::priority_queue<node> q;

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i) {
        scanf("%d%d", &arr[i].wait, &arr[i].val);
    }
    std::sort(arr + 1, arr + n + 1);
    cur = 1;
    for (int i = 1; i <= m; ++i) {
        while (cur <= n && arr[cur].wait <= i) {
            q.push(node(arr[cur].val));
            ++cur;
        }
        if (!q.empty()) {
            ans += q.top().key;
            q.pop();
        }
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 1660
#!/usr/bin/env python3
from copy import deepcopy
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]

last = {}
for i in range(26):
    last[i] = -1

s = 0
Ret = []
for d in range(D):
    sr = {}
    ll = {}
    for c in range(26):
        last_cp = deepcopy(last)
        s_cp = deepcopy(s)
        last_cp[c] = d
        s_cp += S[d][c]
        for i in range(26):
            s_cp -= C[i] * (d-last_cp[i])
        sr[c] = s_cp
        ll[c] = last_cp
    sr = sorted(sr.items(), key=lambda x:x[1])
    #print(ll)
#    print(sr)
    ret = sr[-1][0]
#    print(ll[ret])
    s = sr[-1][1]
    last = deepcopy(ll[ret])
    Ret.append(ret+1)

for r in Ret:
    print(r)


Measured memory_bytes: 73128
#include<stdio.h>
/* 配列の要素を交換する */
void Swap(int x[ ], int i, int j)
{
    int temp;
    
    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

/* クイックソートを行う */
void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;
    
    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */
    
    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */
    
    while (1) {                    /* 無限ループ */
        
        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */
        
        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */
        
        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }
    //ShowData(x, 10);               /* 途中経過を表示 */
    
    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

int main(){
    int N,i,j,tmp;
    int count=0;
    int d[100000];
    
    scanf("%d",&N);
    for(i = 0 ; i < N ; i++){
        scanf("%d",&d[i]);
    }
    QSort(d,0,N-1);
    
    for(i = 1; i <= 100000 ; i++){
        if(i > d[(N/2)-1] && i <= d[N/2]){
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 512
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int ver=scan.nextInt();
    int side=scan.nextInt();
    int rednum=scan.nextInt();
    int ans=0;
    int bronum=0;
    String[][] squ=new String[ver][side];
    int blackver[]=new int[ver];
    int blackside[]=new int [side];
    String test;
    for(int a=0; a<squ.length; a++){
      test=scan.next();
      squ[a]=test.split("");
      /*for(int b=0; b<squ[a].length; b++){
        if(squ[a][b].equals("#")){
          blackver[a]++;
          blackside[b]++;
        }
      }*/
    }
    //int bitvermax=1<<ver;
    //int bitsidemax=1<<side;
    int bit=0;
    for(int a=0; a<1<<ver; a++){
      for(int b=0; b<1<<side; b++){
        bit=0;//1=no, 0=red
        for(int c=0; c<ver; c++){
          for(int d=0; d<side; d++){
            if(((a>>c & 1)==1) && ((b>>d & 1)==1)){
              //System.out.println(a+" "+b+" "+squ[c][d]);
              if(squ[c][d].equals("#")){
                bit++;
              }
            }
          }
        }
        //System.out.println(a+" "+b+" "+bit);
        if(bit==rednum){
          ans++;
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 36036
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
ll read()
{
	ll tmp=0; char f=1,c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1; c=getchar();}
	while('0'<=c&&c<='9'){tmp=tmp*10+c-'0'; c=getchar();}
	return tmp*f;
}
using namespace std;
int cnt[110];
int n;
int main()
{
	n=read();
	for(int i=1;i<=n;i++)++cnt[read()];
	int ans=0;
	for(int i=1;i<=100;i++)if(cnt[i])++ans;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
/*
    TOP GUN: MAVERICK!!
                                */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli mod=1e9+7ll;
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
struct edge
{
    lli x,y,z,w;
};
bool cmp(edge a,edge b)
{
    if(a.x==b.x)
    {
        return a.y<b.y;
    }
    else
    return a.x<b.x;
}
lli parent[200005];
lli ran[200005];
void make_set(int v) {
    parent[v] = v;
    ran[v] = 0;
}
lli find_set(lli v)
{
if(v==parent[v])
return v;
return parent[v]=find_set(parent[v]);
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (ran[a] < ran[b])
            swap(a, b);
        parent[b] = a;
        if (ran[a] == ran[b])
            ran[a]++;
    }
}
int main()
{
    int a,b;
    cin>>a>>b;
    b=2*b;
    a=max(0,a-b);
    cout<<a;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    char s[256];
    scanf("%s", s);
    int len = 0;
    for (int i = 0;; i++) {
        if(s[i] == '\0'){
            len = i;
            break;
        }
    }
    //kaibun
    for (int i = 0; i < (len + 1) / 2; i++) {
        if(s[i] != s[len - i - 1]){
            printf("No\n");
            return 0;
        }
    }
    //bubun
    for (int i = 0; i <  (len - 1) / 2 - 1 - i; i++) {
        if(s[i] != s[(len - 1) / 2 - 1 - i]){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	 long GCD=0,LCM=0,a=0,b=0,xb=0,xa=0,r = 0,i=0;
	//while(scanf("%d %d",a,b)){
	while(cin>>a>>b){
    xa=a;
    xb=b;
		if(a==0 || b== 0){continue;}
		while(1){
			if(b==a){break;
			}
			if(a>b){
			a = a-b; 
			}
			else if(a<b){
			b = b-a;
			}
			
		}
		GCD=b;
		LCM=(xa*xb)/b;
		cout<<GCD<<" ";
		cout<<LCM;
		printf("\n");
		GCD=0;LCM = 0;xa = 0;xb = 0;a = 0;b = 0;
	}

	return 0;

}

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

const int N = 55;

string s[N];
int cnt[26];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < (int)s[0].size(); i++) {
    cnt[s[0][i] - 'a']++;
  }
  for (int i = 1; i < n; i++) {
    int curcnt[26];
    for (int j = 0; j < 26; j++) curcnt[j] = 0;
    for (int j = 0; j < (int)s[i].size(); j++) {
      curcnt[s[i][j] - 'a']++;
    }
    for (int j = 0; j < 26; j++) {
      cnt[j] = min(cnt[j], curcnt[j]);
    }
  }
  vector<char> v;
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < cnt[i]; j++) {
      v.push_back(i + 'a');
    }
  }
  sort(v.begin(), v.end());
  for (char c : v) cout << c;
  cout << endl;
  return 0;
}


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

int main() {

    int A,B,C;
    int K;

    cin >> A >> B >> C >> K;

    int count = 0;

   while(true){
        if (A >= B){
            B *= 2;
            count += 1;
        }

        else break;
    }

    while(true){
        if(B>=C){
            C *= 2;
            count += 1;
        }

        else break;
    }

    if(count <=K){
        cout << "Yes" << endl;
    }

    else cout << "No" << endl;

}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int X, Y, Z;


signed main(){
    cin >> X >> Y >> Z;

    swap(X, Y);
    swap(X, Z);

    cout << X << ' ' << Y << ' ' << Z << endl;

    return 0;
}

Measured memory_bytes: 256
# スペース区切りの整数の入力
N,M = map(int, input().split())

KS_list=[]

for i in range(M):
  KS_list.append([int(e) for e in input().split()])

P_list = [int(e) for e in input().split()]

#総当たりする
switch_state=[]
switch_stop=[]
ans=0

for i in range(N):
  switch_state.append("0")
  switch_stop.append("1")

while switch_state!=switch_stop:
  #print(switch_state)

  #switch_stateの検査
  for i in range(M):
    k = KS_list[i][0]
    on_number = 0
    for j in range(1,k+1):
      #print("check No.",KS_list[i][j],":",end="")
      if switch_state[KS_list[i][j]-1]=="1":
        #print("on")
        on_number+=1
      #else:
        #print("off")
  
    #print(on_number,",",end="")
    #print(P_list[i])
    
    if on_number%2!=P_list[i]:
      #print("NG")
      break
    elif on_number%2==P_list[i] and i==M-1:
      #print("OK")
      ans+=1
 
  #switch_stateの変更
  if switch_state.pop(-1)=="0":
    switch_state.append("1")
  else:
    i = 1
    while(switch_state.pop(-1)!="0"):
      i = i + 1

    switch_state.append("1")
    for j in range(i):
      switch_state.append("0")

#print(switch_state)
#switch_stateの検査

for i in range(M):
  k = KS_list[i][0]
  on_number = 0
  for j in range(1,k+1):
    #print("check No.",KS_list[i][j],":",end="")
    if switch_state[KS_list[i][j]-1]=="1":
      #print("on")
      on_number+=1
    #else:
      #print("off")
      
  #print(on_number,",",end="")
  #print(P_list[i])

  if on_number%2!=P_list[i]:
    #print("NG")
    break
  elif on_number%2==P_list[i] and i==M-1:
    ans+=1
    #print("OK")
    
print(ans)

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

int solve(vector<int> R, vector<int> L){
  if ( R.size() == 0 || L.size() == 0 ) return 0;
  sort(R.begin(), R.end());
  sort(L.begin(), L.end());
  return R[0] + L[0];
}

int main() {
  int A[10], W[10];
  int N, a, w;
  vector<int> R, L;
  cin >> N;
  for ( int i = 0; i < N; i++ ) cin >> A[i];
  for ( int i = 0; i < N; i++ ) cin >> W[i];
  for ( int i = 0; i < N; i++ ){
    if ( A[i] == 0 ) R.push_back(W[i]);
    if ( A[i] == 1 ) L.push_back(W[i]);
  }

  cout << solve(R, L) << endl;
}




Measured memory_bytes: 3168
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    //static long mod = 1000000007;

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var n     = int.Parse(spl[0]);
        var m     = int.Parse(spl[1]);

        StringBuilder str = new StringBuilder();
        for(int i=0; i<n; i++) {
            str.Append("X");
        }

        //Dictionary<int, int> hash = new Dictionary<int, int>();

        for(int i=0; i < m; i++) {
            spl   = input.ReadLine().Split(' ');
            var s = int.Parse(spl[0]);
            var c = int.Parse(spl[1]);

            var ch = (char)('0' + c);

            if (n != 1 && s == 1 && c == 0) return -1;
            if (str[s - 1] != 'X' && str[s - 1] != ch) return -1;

            str[s - 1] = ch;
        }

        if (str[0] == 'X' && n !=1 ) str[0] = '1';

        var v = int.Parse(str.Replace('X', '0').ToString());
        return v;
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <vector>
#include <map>

using ll = long long;
constexpr ll Mod = 1e9+7;

struct Solver {
  std::map<int, ll> cache;
  std::vector<bool> const& can_step;

  Solver(int N, std::vector<bool> const& can_step)
    : cache()
    , can_step(can_step)
  {}

  ll solv(int const n) {
    if (! can_step[n]) return 0;

    if (n == 0) return 1;
    if (n == 1) return 1;

    if (cache.count(n) > 0) {
      return cache[n];
    }

    ll ans = solv(n-2) + solv(n-1);
    ans %= Mod;
    cache.emplace(n, ans);

    return ans;
  }
};

int main() {
  int N, M;

  std::cin >> N >> M;

  std::vector<bool> A(N+1, true);

  for (int i=0; i<M; i++) {
    int a;
    std::cin >> a;
    A[a] = false;
  }

  int ans = Solver(N, A).solv(N);

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 8448
#include <stdio.h>

int main(void)
{
    int i;
    char n[4];
    scanf("%s", n);
    while (n[i] != '\0')
    {
        if (n[i] == '1')
        {
            n[i] = '9';
            goto end;
        }

        if (n[i] == '9')
        {
            n[i] = '1';
            goto end;
        }

        end:
        i++;
    }

    printf ("%s", n);

    return (0);
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int h[n];
    int res = 0;
    for(int i = 0; i < n; i++) {
        scanf("%d", h+i);
        int cansee = 1;
        for(int j = 0; j < i; j++){
            if(h[j] > h[i]){
                cansee *= 0;
            }
        }
        res += cansee;
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int N, K;
vector<int> H;

namespace std {
  template <>
  class hash<std::pair<int, int>> {
  public:
    size_t operator()(const std::pair<int, int>& x) const{
      return hash<int>()(x.first) ^ hash<int>()(x.second);
    }
  };
}



int main(){
  cin >> N >> K;
  rep(i,N){
    int h;
    cin >> h;
    H.push_back(h);
  }

  unordered_map<pair<int,int>,ll> dp;
  dp[make_pair(0,0)] = 0;
  rep(i,N){
    int h = H[i];
    unordered_map<pair<int,int>,ll> ndp;
    FOR(it,dp){
      int ph = (it->first).first;
      int change = (it->first).second;
      ll cnt = it->second;
      if(change < K){
        // left
        if(ndp.count(make_pair(ph,change+1)) == 0){
          ndp[make_pair(ph,change+1)] = cnt;
        }else{
          ndp[make_pair(ph,change+1)] = min(ndp[make_pair(ph,change+1)], cnt);
        }
        // right
        int nh = 0;
        if(i<N) nh = H[i+1];
        if(ndp.count(make_pair(nh,change+1)) == 0){
          ndp[make_pair(nh,change+1)] = cnt + (ph<nh?nh-ph:0);
        }else{
          ndp[make_pair(nh,change+1)] = min(ndp[make_pair(nh,change+1)], cnt + (ph<nh?nh-ph:0));
        }
      }
      // no change
      if(ndp.count(make_pair(h,change)) == 0){
        ndp[make_pair(h,change)] = cnt + (ph<h?h-ph:0);
      }else{
        ndp[make_pair(h,change)] = min(ndp[make_pair(h,change)], cnt + (ph<h?h-ph:0));
      }
    }
    dp = ndp;
  }

  ll ret = 10000000000000000LL;
  FOR(it,dp){
    ret = min(ret, it->second);
  }

  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 5980
#include <algorithm>
#include <iostream>
#include <cmath>

const int MOD = 1E9+7;
using namespace std;


long long ans[100005];
long long res[100005];

int main(){
    int n,m;
    cin>>n>>m;
    for (int i=0;i<n;i++){
        cin>>ans[i];
    }
    for (int j=0;j<m;j++){
        cin>>res[j];
    }
    long long x=0,y=0,result=0;
    for (long long i=0;i<n;i++){
        x=(x+i*ans[i])%MOD;
        x=(x-(n-i-1)*ans[i]%MOD+MOD)%MOD;
    }
    for (long long i=0;i<m;i++){
        y=(y+i*res[i])%MOD;
        y=(y-(m-i-1)*res[i]%MOD+MOD)%MOD;
    }
    result = (x*y)%MOD;
    cout<<result<<endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
int n;
scanf("%d", &n);
for(int testcase = 0; testcase < n; ++testcase) {
bool yes = false;
int s = 10;
vector<int> x;
x.resize(s);
for(int i = 0; i < s; ++i)
scanf("%d", &x[i]);
for(int bit = 0; bit < (1 << s); ++bit) {
bool valid = true;
for(int lr = 0; lr < 2; ++lr) {
int prev = -100;
for(int i = 0; i < s; ++i) {
if(((bit >> i) & 1) == lr) {
if(prev >= x[i]) {
valid = false;
break;
}
prev = x[i];
}
}
}
if(valid) {
yes = true;
break;
}
}
printf("%s\n", yes ? "YES" : "NO");
}
return 0;
}

Measured memory_bytes: 1012