akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    vector<unsigned long long> A(N);
    priority_queue<unsigned long long> B;
    for (int i = 0; i < N;i++){
    cin >> A[i];
    B.push(A[i]);
    }
    for (int i = 0; i < M;i++){
        unsigned long long tmp = B.top();
        B.pop();
        if(tmp != 0){
            B.push(tmp / 2);
        }else{
            B.push(0);
        }
    }

    unsigned long long ans = 0;
    for (int i = 0; i < N;i++){
        ans += B.top();
        B.pop();
    }
    cout << ans << endl;
    return 0;
}
        

Measured memory_bytes: 2168
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

vector<vector<edge>> g;

vector<bool> see;

void dfs(ll i, ll j) {
	see[i] = 1;

	for (edge e : g[i]) {
		if (e.ind == j) { continue; }
		ll w = e.to;
		if (see[w] == 1) { continue; }
		dfs(w, j);
	}

	return;
}

int main() {

	ll N, M;
	cin >> N >> M;

	g.resize(N + 1);

	repn(i, M) {
		ll a, b;
		cin >> a>> b;
		g[a].push_back({ i,b,0 });
		g[b].push_back({ i,a,0 });
	}

	ll ans = 0;

	repn(i, M) {
		see.assign(N + 1, 0);
		dfs(1, i);

		ll b = 0;
		repn(i, N) { if (see[i] == 0) { b = 1; } }
		ans += b;
	}

	cout << ans;

	
	system("PAUSE");

	

}


Measured memory_bytes: 504
X, N=map(int, input().split())
if N==0:
  print(X)
  exit()
p=set(list(map(int, input().split())))

for i in range(100):
  if X-i in p:
    pass
  else:
    print(X-i)
    exit()
    
  if X+i in p:
    pass
  else:
    print(X+i)
    exit()

Measured memory_bytes: 9212
#include<bits/stdc++.h>
#define ALL(c) c.begin(),c.end()
using namespace std;
using ll = long long;
static const int MOD = 1000000007;

int main(){
    int N=0;
    cin >> N;
    vector<int> A(N),B(N);
    for(int i=0; i<N; i++){cin >> A[i];}
    for(int i=0; i<N; i++){cin >> B[i];}
    ll y=0;
    for(int i=0; i<N; i++){
        ll gap = B[i]-A[i];
        if(gap>0){y+=(gap/2);}
        if(gap<0){y+=(gap);}
    }
    if(y>=0)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<ctype.h>

/*
int main(void){
	char a[3000],b[3000];
	scanf("%s%s",a,b);
	int la = strlen(a) ;
	int lb = strlen(b);
	printf("%d\n%d\n",la,strlen(b));
	return 0;
}
*/


int main(void){
  int n,i;
  char a[1000],b[1000];
  int sum[1000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
	  scanf("%s%s",a,b);
	  if(strlen(a)>80||strlen(b)>80){
		  printf("overflow\n");
		  continue;
	  }
	  int la = strlen(a);
	  int lb = strlen(b);
	  int c = 0 , up = 0;
		  for(;c<=strlen(a)-1||c<=strlen(b)-1;){
		  int tmp = up;
		  if(strlen(b)>c)tmp += b[lb-1-c]-'0';
		  if(strlen(a)>c)tmp += a[la-1-c]-'0';
		  up = tmp/10;
		  sum[c]=tmp%10;
		  c++;
		  }
		  (up==1)?sum[c]=up:c--;
		  if(c==80&&sum[c]==1){printf("overflow\n"); continue;}
	int k=0;
	int lc = c+1;
	for(;lc-k-1>=0;){
		printf("%d",sum[lc -1 - k]);
		k++;
	}
	printf("\n");
	}
  return 0;
}

Measured memory_bytes: 616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <algorithm>

using namespace std;

int main()
{
    int a,b;
    int c;
    scanf("%d%d",&a,&b);
    c=a*b;
    if(c%2==0)
    {
        printf("Even\n");
    }
    else printf("Odd\n");
    return 0;
}


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

#define MOD_1_000_000_007 (1000000007LL)
#define LINF (1LL<<60)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)

struct DisjointSet {
  std::map<int, int> parent, rank, num;

  void makeSet(int x) {
    parent[x] = x;
    rank[x] = 0;
    num[x] = 1;
  }

  bool same(int x, int y) {
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y) {
    link(findSet(x), findSet(y));
  }

  void link(int x, int y) {
    if(rank[x] < rank[y]) {
      parent[x] = y;
      num[y] += num[x];
    } else {
      parent[y] = x;
      num[x] += num[y];
      if(rank[x] == rank[y]) rank[x]++;
    }
  }

  int numberOf(int x) {
    return num[findSet(x)];
  }

  int findSet(int x) {
    if(x == parent[x]) return x;
    else return parent[x] = findSet(parent[x]);
  }
};

namespace solver {
  using namespace std;
  typedef long long ll;

  ll N, M, A[60], B[60];

  void init() {
    scanf("%lld %lld", &N, &M);
    rep(i, M) {
      scanf("%lld %lld", &A[i], &B[i]);
      A[i]--;
      B[i]--;
    }
  }

  void solve() {
    ll ans = 0;
    rep(i, M) {
      DisjointSet ds;
      rep(j, N) ds.makeSet(j);
      rep(j, M) {
        if(i==j) continue;
        ds.unite(A[j], B[j]);
      }
      if(!ds.same(A[i], B[i])) {
        ans++;
      }
    }
    cout << ans << endl;
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>
#include <queue>
#include <stack>

using namespace std;
int main(int argc, const char * argv[]) {
    
    string s;
    cin >> s;
    for (int i=1; i<s.size(); i++) {
        if (s[i] == s[i-1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }

    cout << "Good" << endl;

    return 0;
}

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

int main(){
    int H,W;
    cin >> H >> W;
    while(H!=0||W!=0){
        for(int j=1; j<=H; j++){
            if(j==1||j==H){
               for(int i=1; i<=W; i++){
                    cout << "#";
                }
            }else{
                cout << "#";
                for(int h=1; h<=W-2; h++){
                     cout << ".";
                }
                 cout << "#";
            }
            
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
    }
    return 0;
}


Measured memory_bytes: 3080
line=input()
n=len(line)
flag=True

if line!=line[::-1]:
    flag=False
if line[0:int((n-1)/2)]!=line[0:int((n-1)/2)][::-1]:
    flag=False
if line[int((n+3)/2)-1:n]!=line[int((n+3)/2)-1:n][::-1]:
    flag=False
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int cnt=0;
	rep(i,10){
		rep(j,10){
			rep(k,10){
				bool f1=0,f2=0,f3=0;
				rep(l,s.size()){
					if(!f1){
						if(s[l]==i+'0'){
							f1=1;
						}
						continue;
					}
					if(!f2){
						if(s[l]==j+'0'){
							f2=1;
						}
						continue;
					}
					if(!f3){
						if(s[l]==k+'0'){
							f3=1;
							break;
						}
					}
				}	
				if(f3){
					cnt++;
				}
			}
		}
	}
	cout<<cnt;
	re 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}


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

  int N;
  cin>>N;

  if(N==1){
      cout<<1<<endl;
      cout<<"0"<<endl;
      return 0;
  }else if(N==2){
      cout<<2<<endl;
      cout<<"0"<<endl;
      cout<<"11"<<endl;
      return 0;
  }

  vector<string> ans;
  for(int i=2;i<=N;i++){
      string res(i,'0');
      res[0]='1';
      res[i-1]='1';
      ans.push_back(res);
  }

  cout<<ans.size()<<endl;
  for(auto s:ans) cout<<s<<endl;

  return 0;
}



Measured memory_bytes: 3264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int D;
vector<int> C;
vector<vector<int>> S;

long long getTime() {
	timespec ts;
	clock_gettime(CLOCK_REALTIME_COARSE, &ts);
	long long r = ts.tv_sec;
	r *= 1000000000;
	r += ts.tv_nsec;
	return r;
}

ll calcScore(const vector<int>& T) {
	vector<int> last(26, -1);
	ll score = 0;
	for (int i = 0; i < D; ++ i) {
		last[T[i]] = i;
		score += S[i][T[i]];
		for (int j = 0; j < 26; ++ j) {
			score -= C[j] * (i - last[j]);
		}
	}
	return score;
}

int hoge(const vector<int>& T) {
	vector<int> last(26, -1);
	vector<ll> pena(26);
	for (int i = 0; i < D; ++ i) {
		last[T[i]] = i;
		for (int j = 0; j < 26; ++ j) {
			pena[j] += C[j] * (i - last[j]);
		}
	}
	int r = 0, cnt = 1;
	for (int j = 1; j < 26; ++ j) {
		if (pena[j] > pena[r]) {
			r = j; cnt = 1;
		} else if (pena[j] == pena[r]) {
			if (rand() % ++cnt == 0) { r = j; }
		}
	}
	return r;
}

int main() {
	auto startTime = getTime();

	cin >> D;
	C.resize(26);
	for (auto& x : C) cin >> x;
	S = vector<vector<int>>(D, vector<int>(26));
	for (auto& x : S) for (auto& y : x) cin >> y;

	vector<int> res(D);
	for (int i = 0; i < D; ++ i) {
		res[i] = 0;
		for (int j = 1; j < 26; ++ j) {
			if (S[i][j] > S[i][res[i]]) res[i] = j;
		}
	}

	ll maxScore = calcScore(res);
	auto ans = res;

	for (int tt = 1; ; ++ tt) {
		int x = hoge(res);
		int ii = 0;
		ll m = -(1LL<<62);
		for (int i = 0; i < D; ++ i) {
			int tmp = res[i];
			res[i] = x;
			auto s1 = calcScore(res);
			if (s1 > m) {
				ii = i;
				m = s1;
			}
			res[i] = tmp;
		}
		if (res[ii] == x) break;
		res[ii] = x;
	}
	ans = res;

	for (int tt = 1; ; ++ tt) {
		if (tt % 1024 == 0 && getTime() - startTime >= 1900000000) break;
		int i = rand() % D;
		int tmp = res[i];
		if (tt % 2 == 0) {
			res[i] = hoge(res);
		} else {
			res[i] = rand() % 26;
		}
		if (tmp == res[i]) continue;
		auto s1 = calcScore(res);
		if (s1 > maxScore) { maxScore = s1; ans = res; }
		else { res[i] = tmp; }
	}

	for (auto x : ans) cout << x + 1 << endl;
}


Measured memory_bytes: 3680
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vint A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];
    vector<pair<int, int>> BA;
    ll ans = 0;
    ll a_sum = 0;
    bool is_same = true;
    rep(i, N) {
        if (A[i] != B[i]) is_same = false;
        if (A[i] <= B[i]) {
            ans += B[i];
            a_sum += A[i];
        }
        else {
            BA.push_back(make_pair(B[i], A[i]));
        }
    }
    if (is_same == true) {
        cout << 0 << endl;
        return 0;
    }
    sort(BA.begin(), BA.end(), greater<pair<int, int>>());
    ll S = ans - a_sum;
    rep(i, BA.size()) {
        int new_A = max(0LL, BA[i].second - S);
        if (new_A == 0) {
            S -= BA[i].second;
        }
        else {
            S = 0;
        }
        if (new_A < BA[i].first) {
            ans += BA[i].first;
        }
        S += BA[i].first - new_A;
    }


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

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

int main(void)
{
    int n, a[100];
    
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
        
    if (n)
        cout << a[n-1];
    for (int i = n - 2; 0 <= i; --i)
        cout << " " << a[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		String s = sc.next();
		
		int[] a = new int[n];
		boolean d1 = false;
		int[] d = new int[n-1];
		for(int i = 0; i < s.length(); i++)
		{
			a[i] = s.charAt(i)-'0';
			if(i>0)
			{
				d[i-1] = a[i]-a[i-1];
				if(d[i-1]<0)d[i-1]*=-1;
				if(d[i-1] == 1)d1 = true;
			}
		}
		
		
		int[] mod = new int[n]; //i! mod 2
		
		//n-1 difs
		int m = n-1;
		
		int t1 = 0;
		int t2 = 0;
		
//		System.out.println("Difs: " + m + ", from 0 to " + (m-1));
		for(int take = 0; take <= m-1; take++)
		{ //(m-1) C take 0
			int nn = m-1;
			boolean odd = ((nn) & ((nn)-take)) <= 0;
				
			if ((take & (nn-take)) > 0)
				odd = false;
			else
				odd = true;
			
			if(d[take] == 1 && odd)t1++;
			if(d[take] == 2 && odd)t2++;
			
//			System.out.println( (m-1) + "C" + take + " Dif " + take + ": " + odd);
//			System.out.println("d is " + d[take]);
//			System.out.println( (((m-1) & ((m-1)-take))));
		}
		
		t1 = t1%2;
		t2 = t2%2;
		if(t1<0)t1+=2;if(t2<0)t2+=2;
		
//		System.out.println("t: " + t1 + " " + t2);
		if(t1 == 0 && t2 == 0)
			System.out.println(0);
		else if(t2 == 1 && t1 == 0)
		{
			if(!d1)
				System.out.println(2);
			else
				System.out.println(0);
		}
		else
			System.out.println(1);
		
	}

}


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

int main() {
	char a[3];
	char a1[3];
	char a2[3];

	for (int i = 0;i < 3;i++)
		cin >> a[i];
	for (int i = 0;i < 3;i++)
		cin >> a1[i];
	for (int i = 0;i < 3;i++)
		cin >> a2[i];

	cout << a[0] << a1[1] << a2[2]<<endl;



	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>

int main(void){
	int k, a, b;
	bool c = false;

	scanf("%d %d %d", &k, &a, &b);
	for (int i = a; i <= b; i++)
		if (i % k == 0)
			c = true;
	if (c)
		printf("OK\n");
	else
		printf("NG\n");
	return 0;
}


Measured memory_bytes: 1628
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n, k, cnt = 0;
	string s; cin >> n >> k >> s;
	for (int i = 0; i < n - 1; i++) {
		if (s[i] == s[i + 1])cnt++;
	}
	cout << min(cnt + 2 * k, n - 1) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<fstream>
#include<cstring>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define P pair<int,int>
#define ll __int64
int n;
int x[4000],y[4000];
set<P>table;

	int x1,x2,y1,y2,dx,dy,vx,vy;	
bool isRect(P t1,P t2){

	if(t1.first>t2.first)swap(t1,t2);

	x1=t1.first;
	x2=t2.first;
	y1=t1.second;
	y2=t2.second;

	dx=x2-x1;
	dy=y2-y1;
	vx=dy;
	vy=-dx;
	//cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<" "<<dx<<" "<<dy<<endl;
	
	if(table.find(mp(x1+vx,y1+vy))==table.end())return false;
	if(table.find(mp(x2+vx,y2+vy))==table.end())return false;

	return true;
}

int main(){

while(cin>>n,n){

table.clear();

rep(i,4000)x[i]=y[i]=0;

rep(i,n){
	cin>>x[i]>>y[i];
	//table[mp(x[i],y[i])]=1;
	table.insert(mp(x[i],y[i]));
}

int ans=0;

for(int i=0;i<n;i++){
	for(int j=i+1;j<n;j++){
		if(isRect(mp(x[i],y[i]),mp(x[j],y[j]))){

			ans=max(ans,((x[i]-x[j])*(x[i]-x[j]))+((y[i]-y[j])*(y[i]-y[j])));
			//cout<<x[i]<<" "<<y[i]<<" "<<x[j]<<" "<<y[j]<<endl;
			
		}
	}
}
cout<<ans<<endl;
}
	return 0;
}


Measured memory_bytes: 3260
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int a = Integer.parseInt(sc.next());
    String s = sc.next();
    if (a >= 3200) {
      pw.println(s);
    } else {
      pw.println("red");
    }
  }
}


Measured memory_bytes: 23124
import java.util.Arrays;
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner x=new Scanner(System.in);
        while(x.hasNext()){
            int m=x.nextInt();
            int[] A=new int[m];
            for(int i=0;i<m;i++){
                A[i]=x.nextInt();
            }
			Show(A);
            int n =A.length;
            for(int i=1;i<n;i++){
		        int j=i;
		        while(j>=1 && A[j-1] > A[j]){
			        int temp = A[j];
			        A[j]=A[j-1];
			        A[j-1]=temp;
			        j--;
					
		        }Show(A);
		    }
		   break;
	    }
    }
	public static void Show(int[] A){
	    int i;
		for(i=0;i<A.length-1;i++){
			System.out.print(A[i]+" ");
		}
		System.out.println(A[i]);
	}
}


Measured memory_bytes: 30180
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    n=int(input())
    graph=[[] for _ in range(n)]
    for i in range(n-1):
        a,b=map(int,input().split())
        graph[a-1].append((b-1,i))
        graph[b-1].append((a-1,i))
    queue=deque([0])
    visited=[False]*n
    visited[0]=True
    colors=[0]*n
    ans=[0]*(n-1)
    while queue:
        node=queue.popleft()
        c=1
        for xnode,edge in graph[node]:
            if visited[xnode]:continue
            if colors[node]==c:c+=1
            ans[edge]=c
            colors[xnode]=c
            visited[xnode]=True
            queue.append(xnode)
            c+=1
    print(max(ans))
    for a in ans:
        print(a)

if __name__=='__main__':
    main()

Measured memory_bytes: 40776
n=int(input())
l= list(map(int, input().split()))
r= list(map(int, input().split()))
l=[0]+l
r.append(0)
 
res=1
if(l[-1]!=r[0]):
	res=0
for i in range(n):
	if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
		if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
			res=0
		if( ( (l[i]<l[i+1]) and (r[i]==r[i+1]) ) and (l[i+1]>r[i]) ):
			res=0
		if( ( (l[i]==l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]<r[i]) ):
			res=0
	else:
		res*=min(l[i],r[i])
		res%=1000000007
print(res)

Measured memory_bytes: 18752
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define mod 1000000007 
#define rep(i,j,l) for(int i=j;i<=l;i++)
#define dec(i,j,l) for(int i=j;i>=l;i--)
#define input(a,n) rep(i,0,n-1)cin>>a[i]
using namespace std;
typedef long long ll;
typedef unsigned long long ull; 
/* int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; */ // 4 Direction
/* int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; */ // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction


int main()
{  ios_base::sync_with_stdio(0); 
   cin.tie(NULL);
   int t,n,i,q,x,mn,k;
    cin>>n;
    ll a[n][3];
    rep(i,0,n-1)
    {
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }   
     
     rep(i,1,n-1)
     {  rep(j,0,2)
         { if(j==0)
             a[i][j]+=max(a[i-1][1],a[i-1][2]); 
        else if(j==1) 
             a[i][j]+=max(a[i-1][0],a[i-1][2]); 
        else 
             a[i][j]+=max(a[i-1][1],a[i-1][0]);
         }
     }  
     cout<<max(a[n-1][0],max(a[n-1][1],a[n-1][2]));
   return 0;            
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define MN 200005
#define LL long long
#define mp make_pair
#define fir first
#define sec second
#define pii pair<int,int>
inline void chkmax(int &a,int b){if(a<b)a=b;}
inline void chkmin(int &a,int b){if(a>b)a=b;}
inline int read(){
	   int a=0,fh=1;char c=getchar();
	   while(c>'9'||c<'0'){if(c=='-')fh=-1;c=getchar();}
	   while('0'<=c&&c<='9'){
		   a=a*10+c-48;
		   c=getchar();
	   }
	   return a*fh;
}
#define Mod 1000000007
LL ksm(int a,int x){
	LL ans=1,w=a;
	while(x){
		if(x&1)ans=ans*w%Mod;
		x>>=1;
		w=w*w%Mod;
	}
	return ans;
}
int n,k;
LL f[MN],ans;
int main(){
	n=read();k=read();
	for(int i=k;i;--i){
		f[i]=ksm(k/i,n);
		for(int j=i*2;j<=k;j+=i)
			f[i]=(f[i]-f[j]+Mod)%Mod;
		ans+=(LL)f[i]*i%Mod;
	}
	printf("%lld\n",ans%Mod);
	return 0;
}

















Measured memory_bytes: 4488
class RomanFigure
  def initialize
    @table = {'I' => 1, 'V' => 5, 'X' => 10, 'L' => 50, 'C' => 100, 'D' => 500, 'M' => 1000}
    @judge = {'I' => ['V','X'], 'X' => ['L','C'], 'C' => ['D','M']} 
    @inputs = []
    input
    @inputs.each do |string|
     puts check(string)
    end
  end

  def input
    while input = $stdin.gets 
      @inputs << input.chomp
    end
  end

  def check(string)
    val = 0
    array = split_elements(string)
    array.each do |elem|
      val += calc_value(elem)
    end
    return val
  end

  def calc_value(string)
    case string.size
    when 1
      @table[string.slice(0,1)]
    when 2
      @table[string.slice(1,1)] - @table[string.slice(0,1)]
    end
  end

  def split_elements(string)
    count = 0
    before = ''
    result = []
    str = ''
    string.each_char do |ch|
      if @judge[str] != nil && @judge[str].include?(ch)
        str += ch
        result << str
        str = ''
      else
        result << str if str.size > 0
        str = ch
      end
    end
    result << str if str.size > 0
    return result
  end
end

r = RomanFigure.new

Measured memory_bytes: 2376
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  ll n,t;
  cin >> n>>t;
  
  int ans=t;
  vector<ll> p(n);
  cin>>p[0];
  
  repo(i,n){
  cin>>p[i];
    if(p[i]-p[i-1]<t) ans+=p[i]-p[i-1];
    else ans+=t;
  }
  
  cout << ans << endl;
  
}


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

#define DEBUG(x) do {std::cerr << #x << ": " << x << std::endl; } while (0)

const int MAX = 100001;
unsigned long long dp [MAX];

int main(int argc, const char ** argv){
    int n, w;
    std::cin >> n >> w;

    while (n-->0){
        int weight, cost;
        std::cin >> weight >> cost;

        for (int i = w; i >= weight; --i){
            dp[i] = std::max(dp[i], dp[i - weight] + cost);
        }
    }

    std::cout << dp[w] << std::endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, M, D; 
	cin >> N >> M >> D; 
	double ans = 2.0 * (N - D) * (M - 1) / N / N; 
	if(D == 0) ans *= 0.5; 
	cout.precision(15); 
	cout << ans << endl; 
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
	if (n == 0)return 0;
	if (memo[n] != -1)return memo[n];

	int res = n;

	for (int pow6 = 1; pow6 <= n; pow6 *= 6)res = min(res, rec(n - pow6) + 1);

	for (int pow9 = 1; pow9 <= n; pow9 *= 9)res = min(res, rec(n - pow9) + 1);

	return memo[n] = res;
}

int calc(int x) {
	int ret = 0;
	while (x % 2 == 0) {
		x /= 2;
		ret++;
	}

	return ret;
}


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

	cin >> a;

	vector<int> data(a);
	rep(i, 0, a) {
		cin >> data[i];
	}

	int ans = 0;
	rep(i, 0, a) {
		ans += calc(data[i]);
	}

	cout << ans << endl;

	
}
	

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a += [a[-1]]

    dp = [10**10]*(n+1)
    dp[0] = 0
    for i in range(n-1):
        dp[i+1] = min(dp[i+1], dp[i]+abs(a[i+1]-a[i]))
        dp[i+2] = min(dp[i+2], dp[i]+abs(a[i+2]-a[i]))

    print(dp[n-1])


main()

Measured memory_bytes: 13976
N = int(input())
S = input()
addleft = 0
countleft = 0
for i in range(0, N):
	if S[i] == '(':
		countleft += 1
	if S[i] == ')':
		if countleft == 0:
			addleft += 1
		else:
			countleft -= 1
for i in range(0, addleft):
	S = '(' + S
for i in range(0, countleft):
	S = S + ')'
print(S)

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;

int main(){
    ll h, w;
    cin >> h >> w;

    ll ans = 1e12;
    for(ll i = 1; i < h; i++){
        ll Sa, Sb, Sc, Smax, Smin;
        Sa = i * w;
        Sb = ((h - i) / 2) * w;
        Sc = ((h - i) - ((h - i) / 2)) * w;
        Smax = max({Sa, Sb, Sc});
        Smin = min({Sa, Sb, Sc});
        ans = min(ans, Smax-Smin);

        Sa = i * w;
        Sb = (h - i) * (w / 2);
        Sc = (h - i) * (w - w / 2);
        Smax = max({Sa, Sb, Sc});
        Smin = min({Sa, Sb, Sc});
        ans = min(ans, Smax-Smin);
    }

    swap(h, w);
    for(ll i = 1; i < h; i++){
        ll Sa, Sb, Sc, Smax, Smin;
        Sa = i * w;
        Sb = ((h - i) / 2) * w;
        Sc = ((h - i) - ((h - i) / 2)) * w;
        Smax = max({Sa, Sb, Sc});
        Smin = min({Sa, Sb, Sc});
        ans = min(ans, Smax-Smin);

        Sa = i * w;
        Sb = (h - i) * (w / 2);
        Sc = (h - i) * (w - w / 2);
        Smax = max({Sa, Sb, Sc});
        Smin = min({Sa, Sb, Sc});
        ans = min(ans, Smax-Smin);
    }

    cout << ans << endl;

    return 0;
}

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

const int Mod = 1e9 + 7;
ll dp[101][4][4][4];

int main() {
  int N;
  cin >> N;
  dp[0][3][3][3] = 1;
  for (int i = 1; i <= N; ++i) {
    rep(j, 4) {
      rep(k, 4) {
        rep(l, 4) {
          if (l == 0) rep(m, 4) dp[i][j][k][l] += dp[i-1][m][j][k];
          else if (l == 1) {
            if ((j == 0 && k == 2) || (j == 2 && k == 0)) continue;
            rep(m, 4) dp[i][j][k][l] += dp[i-1][m][j][k];
            if (j == 2 || k == 2) dp[i][j][k][l] -= dp[i-1][0][j][k];
          }
          else if (l == 2) {
            if (j == 0 && k == 1) continue;
            rep(m, 4) dp[i][j][k][l] += dp[i-1][m][j][k];
          }
          else rep(m, 4) dp[i][j][k][l] += dp[i-1][m][j][k];

          dp[i][j][k][l] %= Mod;
        }
      }
    }
  }
  ll ans = 0;
  rep(j, 4)rep(k, 4)rep(l, 4) ans += dp[N][j][k][l];
  cout << ans % Mod << endl;
  return 0;
}

Measured memory_bytes: 256
H,W=map(int,input().split())
S=[]
for i in range(H):
    s=input()
    S.append(s)
for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            continue
        l=[(j-1,i),(j+1,i),(j,i+1),(j,i-1)]
        koritu=True
        for x,y in l:
            if 0<=y<=H-1 and  0<=x<=W-1:
                koritu=koritu and S[y][x]=="."
        if koritu:
            print("No")
            quit()
print("Yes")


Measured memory_bytes: 39536
a,b,c = list(map(int,input().split()))
k = int(input())

cnt = 0

while not a < b:
  b*=2
  cnt+=1

while not b < c:
  c*=2
  cnt+=1

#print('cnt:',cnt,'k:',k)
print('Yes' if cnt <=k else 'No')

Measured memory_bytes: 9176
H,W=map(int,input().split())
import numpy as np
C=np.array([list(map(int,input().split())) for _ in range(10)])

# print(C)
A=[]
for i in range(H):
    for a in map(int,input().split()):
        if a!=-1:
            A+=a,


dp=np.array([[100100]*10 for _ in range(10)])
for i in range(0,10):
    for j in range(0,10):
        dp[i][j]=C[i][j]
        
for _ in range(10):
    for i in range(0,9+1):
        for j in range(0,9+1):
            for k in range(0,9+1):
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j])
            
ans=0
# print(dp)
for a in A:
    ans+=dp[a][1]
print(ans)

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

using namespace std;

typedef long long ll;

#define MOD (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()

ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

pll norm(ll x,ll y)
{
  ll g=__gcd(abs(x),abs(y));
  x/=g;
  y/=g;
  if(x<0)return mp(-x,-y);
  else return mp(x,y);
}


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


ll n;cin>>n;
ll d=1e9+7;
ll cnt_zero=0;
map<pll,ll>m;

ll x,y;
ll ans=1;
for(int i=1;i<=n;i++)
{
  cin>>x>>y;
  if(x==0&&y==0)cnt_zero++;
 else if(x==0)m[{0,-1}]++;
 else if(y==0)m[{1,0}]++;
 else 
 {
  auto p=norm(x,y);
  ll a=p.ff;
  ll b=p.ss;

  m[{a,b}]++;
 }
}

ll rem=n-cnt_zero;

for(auto x:m)
{
  ll cnt1=x.ss;
  ll a=x.ff.ff;
  ll b=x.ff.ss;
 
 ll cnt2=m[{-b,a}];
 if(cnt2)
 {
  rem=rem-cnt1-cnt2;
 // cout<<cnt1<<" "<<cnt2<<"\n";

  ans*=powM(2,cnt1,d)+powM(2,cnt2,d)-1;
  ans%=d;
 }
 
}

//cout<<rem<<"\n";

ans*=powM(2,rem,d);
ans%=d;
ans+=cnt_zero-1+d;
ans%=d;

cout<<ans<<"\n";


return 0;

}


Measured memory_bytes: 31616
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll N, M, Q, l, r, p, q;
  std::cin >> N >> M >> Q;
  vvl dp = vv(N, N, 0, ll);
  vvl zahyo = vv(N, N, 0, ll);
  for(int i=0;i<M;i++) scanf("%lld %lld", &l, &r), zahyo[l-1][r-1]++;
  for(int i=0;i<N;i++)for(int j=0;j<N;j++) dp[i][j] = (j==0?0:dp[i][j-1]) + zahyo[i][j];
  for(int i=N-1;i>=0;i--) for(int j=0;j<N;j++) dp[i][j] += (i==N-1?0:dp[i+1][j]);
  for(int i=0;i<Q;i++) scanf("%lld %lld", &p, &q ), std::cout << dp[p-1][q-1] << '\n';
  return 0;
}


Measured memory_bytes: 4864
import heapq
n= int(input())
a = list(map(int, input().split( )))

pre = sum(a[:n])
post = -sum(a[2*n:])
post2 = post
ans = - pre + post

Q = []
for i in range(n):
    heapq.heappush(Q, a[i])

S_pre = [pre]

for i in range(n,2*n):
    pre += a[i]
    heapq.heappush(Q,a[i])
    q = heapq.heappop(Q)
    pre -= q
    S_pre.append(pre)

Q2 = []
for i in range(2*n,3*n):
    heapq.heappush(Q2, -a[i])
S_post = [post]
for i in range(2*n - 1,n-1,-1):
    post -= a[i]
    heapq.heappush(Q2,-a[i])
    q = heapq.heappop(Q2)
    #print(q)
    post -= q
    S_post.append(post)

#print(S_pre)
#print(S_post)
for i in range(n+1):###+1
    ans = max(ans, S_pre[n-i]+S_post[i])
print(ans)




Measured memory_bytes: 120232
n=int(input())
nums=list(map(int,input().split()))
cnt=0
flag=0
while flag is 0:
    for i in range(n):
        num=nums[0]/2
        key=nums[0]%2
        if key==1:
            flag=1
            break
        else:
            del nums[0]
            nums.append(num)
    if flag==0:
        cnt+=1

print(cnt)

Measured memory_bytes: 9260
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;



int main()
{
	int N;
	string S;
	long long int res = 0;

	std::cin >> N;
	std::cin >> S;
	long long int R=0, G=0, B=0;

	long long int excluded = 0;

	for(int i=0; i<N; i++){
		for(int j=1; j<N; j++){
			if(i+j+j >= N){
				break;
			}
			if(S[i] != S[i+j] && S[i] != S[i+j+j] && S[i+j] != S[i+j+j]){
				excluded++;
			}
		}
	}

	for(int i=0; i<N; i++){
		if(S[i] == 'R'){
			R++;
		}
		if(S[i] == 'G'){
			G++;
		}
		if(S[i] == 'B'){
			B++;
		}
	}

	res = R*G*B - excluded;
	
	std::cout << res;

	return 0;
}

Measured memory_bytes: 3644
A = input()
B = input()

if len(A) > len(B):
    print('GREATER')
elif len(A) < len(B):
    print('LESS')
else:
    for i in range(len(A)):
        if int(A[i]) > int(B[i]):
            print('GREATER')
            break
        elif int(A[i]) < int(B[i]):
            print('LESS')
            break
        else:
            if i == len(A) - 1:
                print('EQUAL')



Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include <map>
#include <math.h>
#include <vector>
#define INF 1<<30
#define MO 100000007
using namespace std;
int main()
{
	long long n,m;
	scanf("%lld %lld",&n,&m);
	long long s=m/2;
	if(s<=n)
	{
	   printf("%lld\n",min(n,s));
	}
	else
	{
		m-=n*2;
		n+=m/4;
		printf("%lld\n",n);
	}
}

Measured memory_bytes: 256
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int inverse(int x){
    return binpow(x, MOD - 2, MOD);
}

void solve()
{
    string s, t;
    cin >> s >> t;
    int n = t.size();
    int ans = INT_MAX;
    for(int i = 0; i + n < (int)s.size() + 1; i++){
        int cnt = 0;
        for(int j = 0; j < n; j++)
            if(s[i + j] != t[j])    cnt++;
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

Measured memory_bytes: 3812
#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;


int main(void){

    ll X; cin>>X;
    ll GOhyaku = X/500;
    X -= GOhyaku*500;
    ll GOju = X/5;

    cout<<GOhyaku*1000+GOju*5<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  char x, y;
  cin >> x >> y;

  if(x > y) cout << ">" << endl;
  else if(x < y) cout << "<" << endl;
  else cout << "=" << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }


int main(){
    int a,b,c; cin >> a >> b >> c;
    if(a+b+c>=22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}


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

set<char> NVC({'k', 's' , 't', 'h', 'p'});

bool check1(int idx,const string &str){
  int n = str.size();
  set<char> V({'i','u'});
  return (idx+2 == n && NVC.count(str[idx]) && V.count(str[idx+1])) || 
    (idx+2< n && NVC.count(str[idx]) && V.count(str[idx+1]) && NVC.count(str[idx+2]));
}

bool check2(int idx,const string &str){
  set<char> V({'a','o'});
  int n = str.size();
  if(idx+2 >= n || !NVC.count(str[idx]) || !NVC.count(str[idx+2]) || !V.count(str[idx+1])) return 0;
  
  return (idx+3 < n && str[idx+1] == str[idx+3])||
    (idx+4 < n && str[idx+3]=='y' && str[idx+1] == str[idx+4]) ;
}

string checkNV(string str){
  int n = str.size();
  set<char> V({'a','i','u','e','o'});
  string res;
  bool can = 1;
  for(int i=0;i<n;i++){
    char ch = str[i];
    if(i && ch == 'y' && NVC.count(str[i-1])) str[i] = 'k';
    if((check1(i,str) || check2(i,str)) && can)res =res + ch + '(' + str[i+1] + ')',i++,can = 0;
    else res += ch, can |= V.count(ch);
  }
  return res;
}

signed main(){

  while(1){
    string str;
    cin>>str;
    if(str == "#") break;
    string ans = checkNV(str);
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3220
#include <stdio.h>

int main(){
    int A,B,C;
    scanf("%d%d%d", &A,&B,&C);
    if (A == B) {
        printf("%d",C);
    }else if(B == C){
        printf("%d", A);
    }else{
        printf("%d", B);
    }
}


Measured memory_bytes: 128
// ~/Remember,remember the 6th of March

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double  EPS = 1e-8;
const ll MOD = 1000000007;
const int N = 100000 + 7;

int main()
{
    int n,m;
    cin>>n>>m;
    if(n<m)
    {
        for(int i=0; i<m; i++)
            cout<<n;
    }
    else
    {
    for(int i=0; i<n; i++)
            cout<<m;
    }
    return 0;
}


Measured memory_bytes: 256
a,b=map(int,input().split())
min=b-(a-1) 
if min<-1000000:
  min=-1000000    
max=b+(a-1)
if max>1000000:
  max=1000000
ans=[]

for i in range(min,max+1):
  ans.append(i)
print(*ans)  
  

Measured memory_bytes: 3060
n, m = map(int, input().split())
ps = [(input().split()) for i in range(m)]

flag = [False] * n
cnt = [0 for i in range(n)]
for i in ps:
    if i[1] == 'WA' and flag[int(i[0]) - 1] == False:
        cnt[int(i[0]) - 1] += 1
    elif i[1] == 'AC':
        flag[int(i[0]) - 1] = True
penal_cnt = 0
for i in range(len(flag)):
    if flag[i] == True:
        penal_cnt += cnt[i]
print(sum(flag), penal_cnt)

Measured memory_bytes: 33892
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define empb emplace_back
#define all(x) (x).begin(),(x).end()
const int N = 1e5 + 7;

int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int n; cin >> n;
	set<string> s;
	for(int i = 0; i < n; i++) {
		string t; cin >> t;
		s.insert(t);
	}
	cout << s.size() <<'\n';
	return 0;
}


Measured memory_bytes: 19276
#include <stdio.h>
int main(void){
    int n,k;
    int x[9<<14];
    int i=0;
    int j=0;
    int min=9<<25;
    
    scanf("%d%d",&n,&k);
    for(;~scanf("%d",x+i);i++){
        ;
    }
    
    for(;j<n-k+1;j++){
        min=fmin(x[j+k-1]-x[j]+fmin(abs(x[j]),abs(x[j+k-1])),min);
    }
    printf("%d",min);
}

Measured memory_bytes: 2548
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a==b)
		printf("Draw");
	else if(a==1)
		printf("Alice");
	else if(b==1)
		printf("Bob");
	else if(a>b)
		printf("Alice");
	else
		printf("Bob");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define t first
#define v second
#define wrap make_pair
using namespace std;
typedef double db;
typedef pair<db,int> pint;
typedef const pint& cpr;
typedef long long ll;
const int siz=5e5+1;

int n,L;
ll Vsum;
db Esum;
pint a[siz];
deque<pint> q;

inline
db mix(cpr a,cpr b){return (a.t*a.v+b.t*b.v)/(a.v+b.v);}

int main()
{
#ifdef DEBUG
    freopen("AT2402.in","r",stdin);
#endif
    scanf("%d%d",&n,&L);
    for(int i=1,y;i<=n;i++){
        db x;
        scanf("%lf%d",&x,&y);
        a[i]=wrap(x,y);
        while(a[i].v+Vsum>L){
            pint now=q.front();
            q.pop_front();
            int pour=min(a[i].v+Vsum-L,(ll)now.v);
            Vsum-=pour;
            Esum-=pour*now.t;
            now=wrap(now.t,now.v-pour);
            if(now.v!=0)
                q.push_front(now);
        }
        q.push_back(a[i]);
        while(q.size()>1&&q[q.size()-2].t>q.back().t){
            pint b=q.back();
            q.pop_back();
            pint c=q.back();
            q.pop_back();
            q.push_back(wrap(mix(b,c),b.v+c.v));
        }
        Esum+=a[i].t*a[i].v;
        Vsum+=a[i].v;
        printf("%.7f\n",Esum/L);
    }
    return 0;
}

Measured memory_bytes: 24976
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	long long a, b, c, d, ans;
	scanf("%lld%lld%lld", &a, &b, &c);
	if(a < b) swap(a, b);
	if(a < c) swap(a, c);
	d = a / 2;
	ans = abs(d * b * c - (a - d) * b * c);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;
using pii = pair<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
int binary_search_index(Int Y, vi &q){
    int left = 0, right = q.size() - 1;
    while (right >= left) {
        int mid = left + (right - left) / 2;
        if (q[mid] == Y) return mid;
        else if (q[mid] > Y) right = mid - 1;
        else if (q[mid] < Y) left = mid + 1;
    }
    return -1;
}


Int combination(Int n, Int r) {
    if(n == 1){return 0;}
    if ( r * 2 > n ) r = n - r;
    uintmax_t dividend = 1;
    uintmax_t divisor  = 1;
    for ( unsigned int i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return dividend / divisor;
}

int main() {
    int N,Q;
    Int K;
    cin >> N >> K >> Q;
    vector<Int> A = vi(Q);
    map<int,int> answers;
    rep(i,N){
        answers[i+1]=0;
    }

    rep(i,Q){
        int tmp;
        cin >> tmp;

        answers[tmp]++;
    }

    rep(i,N){
        int k = Q-K;
        if (answers[i+1] > Q-K){

            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 6144
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
       _N: i64,
       S: String,
    }

    // 最終状態はRRRRRRRWWWWWWWWW的な文字列

    // まず、Rの数を数えておこう
    let mut rs = 0;
    for ch in S.chars() {
        if ch == 'R' {
            rs += 1;
        }
    }

    let mut ans = 0;
    // indexが0~rs-1のうち、Wがあればそれは移動が必要。
    for i in 0..rs {
        if &S[i..i + 1] == "W" {
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2412