akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <unordered_map>
 
using namespace std;
typedef long long ll;
 
int main()
{
    ll N;
    cin >> N;
    ll* x = new ll[N];
    ll* y = new ll[N];
    ll* h = new ll[N];

    ll** pos = new ll*[101];
    for(ll i = 0; i < 101; i ++){
        pos[i] = new ll[101];
        for(ll n = 0; n < 101; n ++){
            pos[i][n] = -1;
        }
    }

    for(ll i = 0; i < N; i ++){
        cin >> x[i] >> y[i] >> h[i];
    }

    for(ll i = 0; i < N; i ++){
        if(h[i] == 0){
            continue;
        }
        for(ll j = 0; j < 101; j ++){
            for(ll m = 0; m < 101; m ++){
                ll height = h[i] + abs(x[i] - j) + abs(y[i] - m);
                if(pos[j][m] == -1){
                    pos[j][m] = height;
                }
                else if(pos[j][m] != height){
                    pos[j][m] = -999;
                }
            }
        }
    }
    for(ll j = 0; j < 101; j ++){
        for(ll m = 0; m < 101; m ++){
            if(pos[j][m] == -1){
                pos[j][m] = 1;
            }
        }
    }

    for(ll i = 0; i < N; i ++){
        if(h[i] != 0){
            continue;
        }
        pos[x[i]][y[i]] = -999;
        for(ll j = 0; j < 101; j ++){
            for(ll m = 0; m < 101; m ++){
                if(pos[j][m] <= 0){
                    continue;
                }
                ll height = pos[j][m] - abs(x[i] - j) - abs(y[i] - m);
                if(height > 0){
                    pos[j][m] = -999;
                }
            }
        }
    }

    for(ll i = 0; i < 101; i ++){
        for(ll n = 0; n < 101; n ++){
            if(pos[i][n] >= 1){
                cout << i << " " << n << " " << pos[i][n];
                return 0;
            }
        }
    }

    while(true){

    }

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
  int n,wei[10],ka=1,temp,ba[10];
  for(int i=0;i<10;i++){
    wei[i]=ka;
    ka*=2;
  }
   while(cin>>n){
     temp=-1;
    for(int i=0;i<10;i++){
      ba[i]=0;
    }
    for(int i=9;i>=0;i--){
      if(n!=0){
	if(n-wei[i]>=0){
	  n-=wei[i];
	  ba[i]=wei[i];
	}
      }if(n==0){
	break;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	temp++;
      }
    }
    for(int i=0;i<10;i++){
      if(ba[i]!=0){
	cout<<ba[i];
	if(temp>0){
	  cout<<" ";
	  temp--;
	}
      }
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

int d[4];

int main() {
	for (int i = 0; i < 3; i++) {
		int v1, v2;
		cin >> v1 >> v2;
		v1--;
		v2--;
		d[v1]++;
		d[v2]++;
	}
	sort(d, d + 4);
	if ((d[0] == 1) && (d[1] == 1) && (d[2] == 2) && (d[3] == 2)) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}

	return 0;
}


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

int main(void) {
    int A,B,C,D;cin>>A>>B>>C>>D;
    while (true) {
        C -= B;
        A -= D;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }
        if (A <= 0) {
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}

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

#define task "A"
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define Rep(i, r, l) for (int i = (r); i >= (l); --i)
#define DEBUG(X) { cerr << #X << " = " << (X) << '\n'; }
#define PR(A, n) { cerr << #A << " = "; FOR(_, 1, n) cerr << A[_] << ' '; cerr << '\n'; }
#define sz(x) ((int)(x).size())
#define pb push_back
#define F first
#define S second
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a));
#define next ackjalscjaowjico
#define prev ajcsoua0wucckjsl
#define y1 alkscj9u20cjeijc
#define left lajcljascjljl
#define right aucouasocjolkjl
#define y0 u9cqu3jioajc

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vl;
string s;
int ans = 0;
int main()
{
	//freopen(task".in","r",stdin);
	//freopen(task".out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	cin >> s;
	int n = sz(s);
	s = '0' + s;
	rep(i, 1, n / 2) if (s[i] != s[n - i + 1]) ans++;
	cout << ans;
}


Measured memory_bytes: 256
S=input()
N=len(S)
O=1
A=[0]*(N+1)
AB=[0]*(N+1)
ABC=[0]*(N+1)
for i in range(1,N+1):
  A[i]=A[i-1]
  AB[i]=AB[i-1]
  ABC[i]=ABC[i-1]
  if S[i-1] is "A":
    A[i]+=O
  elif S[i-1] is "B":
    AB[i]+=A[i-1]
  elif S[i-1] is "C":
    ABC[i]+=AB[i-1]
  elif S[i-1] is "?":
    A[i]*=3
    A[i]+=O
    AB[i]*=3
    AB[i]+=A[i-1]
    ABC[i]*=3
    ABC[i]+=AB[i-1]
    O*=3
  A[i]=A[i]%(10**9+7)
  AB[i]=AB[i]%(10**9+7)
  ABC[i]=ABC[i]%(10**9+7)
  O=O%(10**9+7)
print(int(ABC[N]%(10**9+7)))

Measured memory_bytes: 15108
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[][] xyh = new int[n][3];// x,y,h
    for (int i = 0; i < n; i++) {
      xyh[i][0] = sc.nextInt();
      xyh[i][1] = sc.nextInt();
      xyh[i][2] = sc.nextInt();
    }
    int H = 0;
    for (int cx = 0; cx <= 100; cx++) {
      Outer: for (int cy = 0; cy <= 100; cy++) {
        for (int i = 0; i < n; i++) {
          if (xyh[i][2] > 0) {
            H = Math.abs(xyh[i][0] - cx) + Math.abs(xyh[i][1] - cy) + xyh[i][2];
            break;
          }
        }
        for (int i = 0; i < n; i++) {
          int j = H - Math.abs(xyh[i][0] - cx) - Math.abs(xyh[i][1] - cy);
          if (j > 0 && xyh[i][2] != j) {
            continue Outer;
          } else if (j <= 0 && xyh[i][2] != 0) {
            continue Outer;
          }
        }
        System.out.println(cx + " " + cy + " " + H);
      }
    }
  }
}


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

class ModComb {
    long long *fact, *facti;
    const int mod;
public:
    explicit ModComb(int n, int m) : mod(m) {
        fact = new long long[n+1];
        facti = new long long[n+1];
        fact[0] = 1; facti[0] = 1;
        for (int i = 1; i <= n; i++) fact[i] = (fact[i-1] * i) % m;
        // calc 1/n!
        long long &inv = facti[n], pw = fact[n];
        inv = 1;
        for (int e = mod-2; e > 0; e /= 2) {
            if (e&1) inv = inv * pw % mod;
            pw = pw * pw % mod;
        }
        for (int i = n-1; i > 0; i--) facti[i] = (facti[i+1] * (i+1)) % m;
    }

    ~ModComb() {
        if (fact) delete[] fact;
        if (facti) delete[] facti;
    }

    long long get(int n, int k) const {
        if (n < 0 || k < 0 || k > n) return 0;
        return fact[n] * facti[k] % mod * facti[n-k] % mod;
    }

    long long getPerm(int n, int k) const {
        if (n < 0 || k < 0 || k > n) return 0;
        return fact[n] * facti[n-k] % mod;
    }
};

#define M 1000000007

int main() {
    int n, k; cin >> n >> k;
    int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
    if (n == 1) {
        cout << "0\n";
    } else {
        sort(a, a+n);
        ModComb mc(n, M);
        long long s[n+1] = {0};
        for (int i = 0; i < n; i++) s[i+1] = (s[i] + a[i]) % M;
        long long ans = 0;
        for (int l = k; l <= n; l++)
            ans += mc.get(l-2, k-2) * (s[n] - s[l-1] - s[n-l+1]) % M;
        ans %= M;
        if (ans < 0) ans += M;
        cout << ans << endl;
    }
}

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

int main(){
  string s;
  getline(cin, s);
  for(int i = 0; i < s.size(); i++){
    if(islower(s.at(i))){
      s.at(i) = toupper(s.at(i));
    }
    else if(isupper(s.at(i))){
      s.at(i) = tolower(s.at(i));
    }
  }
  cout << s << endl; 
}



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

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

int main()
{
	int N, i;
	cin >> N >> i;
	cout << N - i + 1 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll long long
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=1e5+10;
const int MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
vector<int>adj[MAX];
int n;
ll k;
vector< vector< ll > >  matmul(vector<vector< ll > > mat1,vector< vector< ll > > mat2){
	vector< vector < ll > > res(n , vector<ll>(n));
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k =0;k<n;k++){
				res[i][j]=(res[i][j]+mat1[i][k]*mat2[k][j]+MOD)%MOD;
			}
		}
	}
	return res;
}
vector< vector< ll > > mpower(vector< vector< ll > > mat){
	vector<vector< ll > > res(n , vector<ll > (n));
	for(int i=0;i<n;i++)
		res[i][i]=1;
	while(k){
		if(k%2){
			res=matmul(mat, res);
		}
		mat=matmul(mat, mat);
		k=k/2;
	}
	return res;
}
int main() 
{ 
	//ios_base::sync_with_stdio(false);
  //  cin.tie(NULL);	
//	#ifndef ONLINE_JUDGE
//	freopen("inp.txt" ,"r", stdin );
//	freopen("out.txt", "w", stdout);
//	#endif
	cin>>n>>k;
	vector< vector<ll > >v(n , vector<ll>(n));
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++)
			{
				cin>>v[i][j];
			}
	}
	
	v=mpower(v);
	ll ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			ans=(ans+v[i][j])%MOD;
		}
		
	}
	cout<<ans;
	
	
}

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

using namespace std;

#define MAX 334
typedef pair<int, int> pii;

int main()
{
    int s, d, m;
    while (cin >> s >> d >> m) {
        vector<pii> v[s];
        for (int i = 0; i < s; i++) {
            int k, w, p;
            cin >> k;
            for (int j = 0; j < k; j++) {
                cin >> w >> p;
                v[i].push_back(pii(w, p));
            }
        }

        int dp[MAX], f;
        memset(dp, -1, sizeof(dp));
        dp[m] = 0;
        for (int i = 0; i < d; i++) {
            cin >> f;
            for (int j = 0; j < (int)v[f].size(); j++) {
                for (int k = 0; k <= m; k++) {
                    if (dp[k] == -1) continue;
                    int nm = k - v[f][j].second;
                    if (nm >= 0) {
                        dp[nm] = max(dp[nm], dp[k] + v[f][j].first);
                    }
                }
            }   
        }
        
        int idx = m;
        for (int i = m-1; i >= 0; i--) {
            if (dp[i] > dp[idx]) {
                idx = i;
            }
        }
        cout << dp[idx] << " " << m - idx << endl;
    }
    return 0;
}

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

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline T gcd(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T lcm(T a,T b){return a*b/gcd(a,b);}

const int INF=1e9;
const double eps=0.0000000001;

int main(){
int r,g,b,n,ans=0;
cin >> r >> g >> b >> n;
FOR(i,n/b+1){
  FOR(j,(n-i*b)/g+1){
    if((n-i*b-j*g)%r==0){
      ans++;
    }
  }
}
cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector> //可変長配列
#include <queue> //キュー
#include <unordered_map> //ハッシュ連想配列
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define ll long long int
#define INFTY (1<<21)

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    int x,a,b; cin>>x>>a>>b;
    cout<<(x-a)%b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9


int main() {
	int H, W; cin >> H >> W;
	char s[52][52];

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) cin >> s[i][j];
	}

	for (int i = 0; i <= H + 1; i++) {
		s[i][0] = '.';
		s[i][W + 1] = '.';
	}

	for (int i = 0; i <= W + 1; i++) {
		s[0][i] = '.';
		s[H + 1][i] = ',';
	}

	bool ans = true;

	for (int i = 1; i <= H && ans == true; i++) {
		for (int j = 1; j <= W && ans == true; j++) {
			if (s[i][j] == '#') {
				ans = (s[i - 1][j] == '#' || s[i + 1][j] == '#' || s[i][j - 1] == '#' || s[i][j + 1] == '#');
			}
		}
	}

	if (ans) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
ans={}
for n in range(N):
  a,b=map(int,input().split())
  if a in ans.keys():
    ans[a]+=b
  else:
    ans[a]=b
answer=sorted(ans.items(), key=lambda x:x[0])
count=0
for k in range(len(answer)):
  count+=answer[k][1]
  if count>=K:
    print(answer[k][0])
    break


Measured memory_bytes: 15044
#include "bits/stdc++.h"
#define _USE_MATH_DEFINES
#include <math.h>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef string ST;
 
 
#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl
 
 
LL modpow(LL a, LL n, LL mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

LL modinv(LL a, LL m) {
  LL b = m, u = 1, v = 0;
  while (b) {
    LL t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0){
     u += m;
  }
  return u;
}
void func() {
  LL N;
  cin >>N;
  vector<LD> X(N);  
  vector<LD> Y(N);  
  vector<LL> A(N);  
  
  REP(i,N){
    A[i]=i;
    cin >> X[i];
    cin >> Y[i];
  }


  vector<LD> dist_list;
  do
  {
    //PRINTSP(A);
    LD dist = 0;
    REP(i,N-1){
      //cerr << A[i]<< " "<<A[i+1]<<  endl;
      //cerr << dist << endl;
      dist += sqrtl((X[A[i]]-X[A[i+1]])*(X[A[i]]-X[A[i+1]])+(Y[A[i]]-Y[A[i+1]])*(Y[A[i]]-Y[A[i+1]]));
    }
    dist_list.push_back(dist);
  } while (std::next_permutation(A.begin(), A.end()));

  LD dist_mean = 0;
  for(auto dist: dist_list){
    dist_mean += dist/(LD)dist_list.size();
  }
  //cout << dist_sum<< " : " << dist_list.size();
  //cout << dist_mean;
  fprintf(stdout,"%.10llf",dist_mean);
  return;
}

int main()
{
  func();
  return 0;
}
 

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

int main() {
  int s, s1, s2, s3;
  cin >> s;
  s1 = s / 100;
  s2 = (s - s1 * 100) / 10;
  s3 = s - s1 * 100 - s2 * 10;
  cout << s1 + s2 + s3 << endl;  
}

Measured memory_bytes: 3644
n = int(input())
h = [int(i) for i in input().split()]
max_cnt, cnt = 0, 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        cnt += 1
    else:
        max_cnt = max(max_cnt, cnt)
        cnt = 0
print(max(max_cnt, cnt))

Measured memory_bytes: 20040
#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>

using namespace std;

int main()
{
	int N,M,C;
	cin >> N >> M >> C;
	int A[N][M];
	int B[M];
	for(int i=0;i<M;i++)
	{
		cin >> B[i];
	}
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<M;j++)
		{
			cin >> A[i][j];
		}
	}
	int count = 0;
	for(int i=0;i<N;i++)
	{
		int sum = C;
		for(int j=0;j<M;j++)
		{
			sum = sum + A[i][j]*B[j];
		}
		if(sum>0)
		{
			count = count + 1;
		}
	}
	cout << count << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

#define INF 1e9
#define LLINF 1e18
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int over = 0;
    int ansmin = 0;
    int ansmax = 0;
    vector<bool> color(8, false);
    rep(i, n) {
        cin >> a.at(i);
        if (a.at(i) < 400) color.at(0) = true;
        else if (a.at(i) < 800) color.at(1) = true;
        else if (a.at(i) < 1200) color.at(2) = true;
        else if (a.at(i) < 1600) color.at(3) = true;
        else if (a.at(i) < 2000) color.at(4) = true;
        else if (a.at(i) < 2400) color.at(5) = true;
        else if (a.at(i) < 2800) color.at(6) = true;
        else if (a.at(i) < 3200) color.at(7) = true;
        else over++;
    }
    rep(i, 8) {
        if(color.at(i)) ansmin++;
    }
    if (ansmin == 0) {
        ansmin = 1;
        cout << ansmin << " ";
    }
    else {
        cout << ansmin << " ";
        ansmax = ansmin;
    }
    if (over > 0) {
        ansmax += over;
    }
    cout << ansmax << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

int main() {
	int H, W;
	std::cin >> H >> W;
	std::vector<std::vector<char>> pixel(H, std::vector<char>(W));
	std::vector<char> edge(W + 2, '#');
	for (int h = 0; h < H; h++) {
		for (int w = 0; w < W; w++) {
			std::cin >> pixel.at(h).at(w);
		}
	}

	for (int i = 0; i < edge.size(); i++) {
		std::cout << edge.at(i);
	}
	std::cout << std::endl;
	
	for (int h = 0; h < H; h++) {
		std::cout << '#';
		for (int w = 0; w < W; w++) {
			std::cout << pixel.at(h).at(w);
		}
		std::cout << '#' << std::endl;
	}

	for (int i = 0; i < edge.size(); i++) {
		std::cout << edge.at(i);
	}
	system("pause");
	return 0;
}

Measured memory_bytes: 504
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
sum1=sum(a)
for i in range(n):
    if a[i]>=b[i]:
        a[i]-=b[i]
        b[i]=0
    elif b[i]>a[i]:
        b[i]-=a[i]
        a[i]=0
        if a[i+1]>=b[i]:
            a[i+1]-=b[i]
            b[i]=0
        else:
            a[i+1]=0
print(sum1-sum(a))

Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    int mini = -1, maxi = -1;
    for(int i=0; i<n; i++){
        int a; cin >> a;
        if(a > maxi || maxi == -1) maxi = a;
        if(a < mini || mini == -1) mini = a;
    }
    cout << maxi - mini << endl;
}

Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var nextString func() string

func init() {
	nextString = newReadString(os.Stdin)
}

func main() {
	n := nextInt()
	k := nextInt()

	ans := 1
	for i := 0; i < n; i++ {
		ans = min(ans*2, ans+k)
	}
	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func nextInt() (result int) {
	result, _ = strconv.Atoi(nextString())
	return
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
		}
		return r.Text()
	}
}


Measured memory_bytes: 640
import java.util.*; 
 
class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
       String s=sc.next();
String[] a=s.split("");
 
 
 	if(a[0].equals("7")||a[1].equals("7")||a[2].equals("7")){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 }
 
    	System.out.println();
    }
}

Measured memory_bytes: 35716
#include <bits/stdc++.h>
#define INF (1<<30)
#define INFLL (1ll<<60)
using namespace std;
map <int,int> mp;
typedef pair<int, int> P;
typedef long long ll;
static const int MAX=100000;

int main(){
    int A,B;
    char c;
    cin>>A>>c>>B;

    cout<<(c=='+'?A+B:A-B)<<"\n";

    
    return 0;
}



Measured memory_bytes: 256
using System;
class Program
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int A = int.Parse(input[0]);
    int B = int.Parse(input[1]);
    int sockets = 1;
    int count = 0;
    while(true)
    {
      if (sockets >= B)
      {
        break;
      }
      sockets += A - 1;
      count++;
    }
    Console.WriteLine(count);
  }
}

Measured memory_bytes: 13140
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ls x<<1
#define rs x<<1|1
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=5e5+100;
char s[maxn];
ll get(ll x){
	return x*(x+1)/2;
}
void solve()
{
	scanf("%s",s+1);
	int len=strlen(s+1);
	int cnt=1;
	ll ans=0;
	int mark=0;
	for(int i=2;i<=len;i++){
		if(s[i]==s[i-1])cnt++;
		else {
			if(s[i-1]=='<'){
				ans+=get(cnt-1);
				mark=cnt;
			}
			else {
				ans+=get(cnt-1);
				ans+=max(cnt,mark);	
			}
			cnt=1;
		}
	}
	if(s[len]=='<'){
		ans+=get(cnt);
	}
	else {
		ans+=get(cnt-1);
		ans+=max(cnt,mark);	
	}
	ac;
}
int main(){
    //IOS;
    solve();
    return 0;
}


Measured memory_bytes: 768
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        try (CustomReader in = new CustomReader()) {
            new Main().execute(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void execute(CustomReader in) throws IOException {
        final int N = Integer.parseInt(in.readLine());
        int[] color = new int[N];
        HashMap<Integer, List<Edge>> g = new HashMap<>();
        for (int i = 1; i < N; i++) {
            int[] uvw = in.readLineAsIntArray();
            int u = uvw[0] - 1;
            int v = uvw[1] - 1;
            int w = uvw[2];
            Edge e1 = new Edge(u, v, w);
            Edge e2 = new Edge(v, u, w);
            if (!g.containsKey(u)) {
                g.put(u, new ArrayList<>());
            }
            if (!g.containsKey(v)) {
                g.put(v, new ArrayList<>());
            }
            g.get(u).add(e1);
            g.get(v).add(e2);
        }
        boolean[] visited = new boolean[N];
        color[0] = 0;
        visited[0] = true;
        int visitCnt = 1;
        int root = 0;
        dfs(0, g, color, visited);
        for (int i = 0; i < N; i++) {
            System.out.println(color[i]);
        }
    }

    private void dfs(int root, HashMap<Integer, List<Edge>> g, int[] color, boolean[] visited) {
        int rColor = color[root];
        List<Edge> next = g.getOrDefault(root, new ArrayList<>());
        for (Edge e : next) {
            if (!visited[e.to]) {
                if (e.weight % 2 == 0) {
                    color[e.to] = rColor;
                } else {
                    color[e.to] = reverse(rColor);
                }
                visited[e.to] = true;
                dfs(e.to, g, color, visited);
            }
        }
    }

    private int reverse(int col) {
        return (col == 0) ? 1 : 0;
    }

    static class Edge {
        public final int from;
        public final int to;
        public final int weight;

        public Edge(int u, int v, int w) {
            from = u;
            to = v;
            weight = w;
        }
    }

    static class CustomReader extends BufferedReader {

        public CustomReader() throws IOException {
            super(new InputStreamReader(System.in));
        }

        public int[] readLineAsIntArray() throws IOException {
            String[] strArray = this.readLine().split(" ");
            int[] intArray = new int[strArray.length];
            for (int i = 0, n = strArray.length; i < n; i++) {
                intArray[i] = Integer.parseInt(strArray[i]);
            }
            return intArray;
        }

        public int[][] readAsIntMatrix(int rows, int columns) throws IOException {
            int[][] matrix = new int[rows][columns];
            for (int i = 0; i < rows; i++) {
                String[] r = this.readLine().split(" ");
                for (int j = 0; j < columns; j++) {
                    matrix[i][j] = Integer.parseInt(r[j]);
                }
            }
            return matrix;
        }

    }
}

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

int main() {
    string x; cin >> x;
    stack<char> s;
    for(auto c : x) {
        if(!s.empty() && s.top() == 'S' && c =='T') {
            s.pop();
        }
        else s.push(c);
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 3664
import math
a,b,x=map(int,input().split())
if a*a*b>=x*2:
    c=x*2/(b*a)
    print(math.degrees(math.atan(b/c)))
else:
    d=2*(b-x/a/a)
    print(math.degrees(math.atan(d/a)))

Measured memory_bytes: 2940
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
  char suit;
  int value;
};
int kansu(int i){
  if(i==25964)
    return 0;
    else return i;
}

struct Card L[MAX/2+2], R[MAX/2+2];

void merge(struct Card A[], int n, int left, int mid, int right){
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for ( i = 0; i < n1; i++ ) L[i] = A[left + i];
  for ( i = 0; i < n2; i++ ) R[i] = A[mid + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for ( k = left; k < right; k++ ){
    if ( L[i].value <= R[j].value ){
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}
 
void mergeSort(struct Card A[], int n, int left, int right ){
  int mid;
  if ( left+1 < right ){
    mid = (left + right)/2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int partition(struct Card A[], int n, int p, int r){
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p - 1;
  for ( j = p; j < r; j++ ){
    if ( A[j].value <= x.value ){
      i++;
      t = A[i]; A[i] = A[j]; A[j] = t;
    }
  }
  t = A[i+1]; A[i+1] = A[r]; A[r] = t;
  return i+1;
}

void quickSort(struct Card A[], int n, int p, int r){
  int q;
  if ( p < r ){
    q = partition(A, n, p, r);
    quickSort(A, n, p, q - 1);
    quickSort(A, n, q + 1, r);
  }
}

main(){
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    scanf("%s %d", S, &v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A, n, 0, n);
  quickSort(B, n, 0, n-1);

  for ( i = 0; i < n; i++ ){
    if ( A[i].suit != B[i].suit ) stable = 0;
  }

  if ( stable == 1 ) printf("Stable\n");
  else printf("Not stable\n");
  for ( i = 0; i < n; i++ ) {
    printf("%c %d\n", B[i].suit, B[i].value);
  }
}


Measured memory_bytes: 4028
#include <bits/stdc++.h>
#include <string>
using namespace std;
 
int main(){
 
    int result,a,b,c,p[110]={};

    cin >> a>>b>>c;

    p[a]=1;
    p[b]=1;
    p[c]=1;

    for(int i=0;i<=100;i++){
        result += p[i];
    }

    cout << result <<endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>

void trace(int* arr, const int& size) {
  for (int i = 0; i < size; i++) {
    std::cout << arr[i];
    if (i == size - 1) {
      std::cout << "\n";
    } else {
      std::cout << ' ';
    }
  }
}

void swap(int* arr, const int& first, const int& second) {
  int buf = arr[first];
  arr[first] = arr[second];
  arr[second] = buf;
}
int main() {
  int n;
  std::cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    std::cin >> arr[i];
  }
  int swapCount = 0;
  for (int i = 0; i < n; i++) {
    for (int j = n - 1; j > i; j--) {
      if (arr[j] < arr[j - 1]) {
        swap(arr, j, j - 1);
        swapCount++;
      }
    }
  }
  trace(arr, n);
  std::cout << swapCount << std::endl;
  return 0;
}



Measured memory_bytes: 3096
import math
a,b,h,m=map(int,input().split())


f=h / 12 * 360 - m / 60 * 360 + m / 60 / 12 * 360


theta=math.radians(f)
print(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(theta)))

Measured memory_bytes: 9540
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] x=new int[n];
		for(int i=0;i<n;i++){
			x[i] = sc.nextInt();
		}
		int cd = 0;
		for(;;){
			int t = 0;
			for(int i=0;i<n;i++){
				if(x[i]%2==0){
					x[i]/=2;
					t++;
				}
			}
			if(t==n)
				cd++;
			else
				break;
		}
		System.out.println(cd);
	}
}

Measured memory_bytes: 23892
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctype.h>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if(a <= c && c <= b){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
a = gets.split.map(&:to_i)
b = Array.new(N,0)
a.each do |e|
    b[e-1] += 1
end 
c = b.map{|e|(e*e-e)/2}
cs = Array.new(N+1,0)
N.times do |i|
    cs[i+1] = cs[i] + c[i]
end
N.times do |i|
    puts cs[N] - c[a[i]-1] + ((b[a[i]-1]-1)**2 - (b[a[i]-1]-1))/2
end 

Measured memory_bytes: 26380
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#define LL long long
using namespace std;

int main()
{
 LL A,B,k,counter;
  counter=0;
 scanf("%lld %lld",&A, &B);

 for(k=0;k<=1000000000;k++){
 	
   if(A+B==2*k){     
     counter++;
     break;
   }

 }
  
  if(counter!=0){ 
 	printf("%lld",k); 

  }else{
  	
    puts("IMPOSSIBLE");
  
  }
  
  
     return 0;
}

Measured memory_bytes: 128
#import <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n)  for(ll i = 0; i < (n); ++i)
#define  repp(i,n) for(ll i = 1; i <=(n); ++i)
#define  red(i,n)  for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;

int main(){
    ll n,h; cin>>n;
    ll a[n]; rep(i,n)cin>>a[i];
    h=a[n-1];
    red(i,n-1){
        if(a[i]-h>=2)yn(0),exit(0);
        if(a[i]-h==1) a[i]--;
        h=a[i];
    }
    yn(1);
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
 
using namespace std;

bool canBeMMYY(int a,int b){
	if( 1 <= a && a <= 12 && 0 <= b && b <= 99) return true;
	return false;
}

bool canBeYYMM(int a,int b){
	if( 1 <= b && b <= 12 && 0 <= a && a <= 99) return true;
	return false;
}

double myLog2(double x){
	return log(x) / log(2.0);
}


int main()
{
	double N,K;
	double probability = 0;
	cin>>N>>K;
	for(double i = 1; i <= N; i++){
		if( i < K){
			double x = ceil(myLog2(K/i));
			probability += (1/N)*pow(0.5,x);
		}else{
			probability += 1/N;
		}
	}
	printf("%0.12lf\n",probability);
	return 0;
}

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

const ll mod = 1e9;

int main(){
    ll n;
    cin >> n;
    int ans = 1e9;
    for (int i=1;i<=pow(n,0.5);i++){
        if (n%i==0){
            ll a = n / i;
            ll b = i;
            int fa = 1;
            while (a >= 10){
                a /= 10;
                fa++;
            }
            int fb = 1;
            while (b >= 10){
                b /= 10;
                fb++;
            }
            ans = min(ans,max(fa,fb));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    N%=10;
    if(N==3) cout << "bon" << endl;
    else if(N==1 || N==0 || N==6 || N==8) cout << "pon" << endl;
    else cout << "hon" << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}



int main(){
  int n;  
  cin >> n ;
  vector<ll> vec(n);
  ll sum=0;
  rep(i,n){
    cin >> vec[i];
    sum+=vec[i];
  }
  ll num=0;
  int k=0;
  while((double)num<(double)sum/2){
    num+=vec[k];
    k++;
  }
  // leftをけずる　おｒ　rightを増やす
  ll left1=num;
  ll right1=sum-num;
  ll left2=num-vec[k-1];
  ll right2=sum-num+vec[k-1];
  cout<< min(left1 -right1,right2-left2) << endl;
  
}


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

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll n,i;
    cin>>n;
    vector<ll> v(n);
    for(i=0;i<n;i++)
        cin>>v[i];
    
    vector<ll> dp(n,INT_MAX);
    dp[0]=0;
    for(i=0;i<n;i++)
    {
        if(i+1<n)
            dp[i+1]=min(dp[i+1],dp[i]+abs(v[i+1]-v[i]));
        if(i+2<n)
            dp[i+2]=min(dp[i+2],dp[i]+abs(v[i+2]-v[i]));
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1792
#pragma warning (disable :4996)
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
typedef long long ll;
const int N = 1e7 + 10;

int A[100010];
int Partition(int A[], int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p; j < r; j++) {
		if (A[j] <= x) swap(A[++i], A[j]);
	}
	swap(A[++i], A[r]);
	return i;
}
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
	int pos=Partition(A, 1, n);
	for (int i = 1; i < pos; i++) printf("%d ", A[i]);
	printf("[%d]", A[pos]);
	for (int i = pos + 1; i <= n; i++) printf(" %d", A[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int N, M; 
vector<int> E[200010]; 
int par[200010]; 
int depth[200010]; 
int size[200010] = {}; 
void init(){
	for(int i = 0; i < N * 2; i++){
		par[i] = i; depth[i] = 0; size[i] = 1; 
	}
}
int find(int x){
	if(par[x] == x){
		return x;
	}
	else{
		return par[x] = find(par[x]); 
	}
}
void unite(int x, int y){
	x = find(x); 
	y = find(y); 
	if(x == y) return;
	else if(depth[x] < depth[y]){
		par[x] = y; 
		size[y] += size[x]; 
	}else{
		par[y] = x; 
		size[x] += size[y];  
		if(depth[x] == depth[y]) depth[x] ++; 
	}
}
bool same(int x, int y){
	return find(x) == find(y); 
}
int siz(int x){
	return size[find(x)]; 
}
int main(){
	cin >> N >> M; 
	init(); 
	for(int i = 0; i < M; i++){
		int a, b; cin >> a >> b; 
		a--; b--; 
		unite(a, b+N); unite(b, a+N); 
	}
	long long nibu = 0; long long notnibu = 0; long long koritu = 0; 
	bool seen[200010] = {}; 
	for(int i = 0; i < N; i++){
		if(seen[find(i)]) continue; 
		if(find(i) == find(i+N)) notnibu ++; 
		else if(siz(i) == 1) koritu ++; 
		else nibu ++; 
		seen[find(i)] = true; seen[find(i+N)] = true; 
	}
	long long ans = nibu * nibu + (nibu + notnibu) * (nibu + notnibu) + 2 * (long long) N * koritu - koritu * koritu; 
	cout << ans << endl; 
}

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

int main(){
	int n,count=-1;
	bool g=true;
	cin>>n;
	vector<int> vec(n);
	for(int i=0;i<n;i++){
		cin>>vec.at(i);
	}
	while(g){
		for(int i=0;i<n;i++){
			if(vec.at(i)%2==0){
				vec.at(i)/=2;
			}
			else{
				g=false;
				break;
			}
		}
		count++;
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説通りに作成したソースコード
 * 
 * https://atcoder.jp/contests/abc103/submissions/15700130 にも参考
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			@SuppressWarnings("unused")
			int n = scanner.nextInt(), m = scanner.nextInt();
			Pair[] pairs = new Pair[m];
			IntStream.range(0, m).forEach(i -> pairs[i] = new Pair(scanner.nextInt() - 1, scanner.nextInt() - 1));
			Arrays.sort(pairs);
			int count = 1, current = pairs[0].b;
			for (int i = 1; i < m; i++) {
				if (pairs[i].a >= current) {
					current = pairs[i].b;
					count++;
				}
			}
			System.out.println(count);
		}
	}

	/**
	 * aとbを格納するクラス
	 */
	private static class Pair implements Comparable<Pair> {
		int a;
		int b;

		Pair(int a, int b) {
			super();
			this.a = a;
			this.b = b;
		}

		@Override
		public int compareTo(Pair pair) {
			return Integer.compare(this.b, pair.b);
		}
	}
}


Measured memory_bytes: 64060
s = gets.to_i

if [1, 2, 4].include?(s) then
	p 4
else
	count = 1

	while s != 1 do
		if s.odd? then
			s = 3*s + 1
		else
			s = s/2
		end
		count += 1
	end

	p count + 1
end



Measured memory_bytes: 1788
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int a[100001];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a, a + n);
	if(n == 2){
		cout << a[1] - a[0] << endl;
		cout << a[1] << " " << a[0] << endl;
		return 0;
	}
	int sum1 = accumulate(a + 1, a + n, 0);
	int sum2 = a[0];
	int ans = sum1 - sum2;
	int ind = 0;
	for(int i = 1; i < n - 1; i++){
		sum1 -= a[i];
		sum2 += a[i];
		if(sum1 - sum2 > ans){
			ans = sum1 - sum2;
			ind = i;
		}
	}
	cout << ans << endl;
	int tmp = a[0];
	for(int i = ind + 1; i < n - 1; i++){
		cout << tmp << " " << a[i] << endl;
		tmp -= a[i];
	}
	cout << a[n - 1] << " " << tmp << endl;
	tmp = a[n - 1] - tmp;
	for(int i = 1; i <= ind; i++){
		cout << tmp << " " << a[i] << endl;
		tmp -= a[i];
	}
}


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

  
int main() {
	int n;
	unsigned long long lcm, num;
	cin >> n;
	cin >> lcm;
	for (int i = 1; i < n; i++){ 
    	cin >> num;
        lcm =  ( num/__gcd(num, lcm) ) * lcm;
	}
	cout << lcm;
	return 0;
}

Measured memory_bytes: 256
# ABC 95, c
A, B, C, X, Y = [int(el) for el in input().split(' ')]
min_total = 10**9
for c in range(max(X, Y) * 2, -1, -2):
    a = max(X - c // 2, 0)
    b = max(Y - c // 2, 0)
    min_total = min(A*a + B*b + C*c, min_total)
print(min_total)


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

#define ll long long
#define fast_in_out  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{
    fast_in_out;
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
}


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

int main() {
  int n;
  while (cin >> n, n != -1) {
    string s;
    while (n) {
      int t = n % 4;
      s = to_string(t) + s;
      n /= 4;
    }
    cout << (s.size() ? s : "0") << "\n";
  }
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using LL = long long;
const int MAX_N = 200 + 10;

int n;
LL a[MAX_N];
char s[MAX_N];
struct LB {
	LL a[61];
	
	LL add(LL x) {
		for (int i = 60; i >= 0; --i)
			if (x >> i & 1) {
				if (a[i] == 0) {
					a[i] = x;
					break;
				}
				x ^= a[i];
			}
		return x;
	}
} lb;

int main() {
	int T;
	for (scanf("%d", &T); T; --T) {
		scanf("%d", &n);
		for (int i = 1; i <= n; ++i) scanf("%lld", a + i);
		scanf("%s", s + 1);
		for (int i = 0; i <= 60; ++i) lb.a[i] = 0;
		int ans = 0;
		for (int i = n; i >= 1; --i)
			if (s[i] == '0') {
				lb.add(a[i]);
			} else {
				LL d = lb.add(a[i]);
				ans |= d != 0;
			}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
class dice{
public:
	int up,down,right,left,oku,temae;
	int up1,down1,right1,left1,oku1,temae1;
	void change(char s){
		if(s=='E'){
			up1=left,left1=down,down1=right,right1=up;
			up=up1,left=left1,down=down1,right=right1;
		}
		if(s=='W'){
			up1=right,left1=up,down1=left,right1=down;
			up=up1,left=left1,down=down1,right=right1;
		}
		if(s=='N'){
			up1=temae,temae1=down,down1=oku,oku1=up;
			up=up1,temae=temae1,down=down1,oku=oku1;
		}
		if(s=='S'){
			up1=oku,temae1=up,down1=temae,oku1=down;
			up=up1,temae=temae1,down=down1,oku=oku1;
		}
	}
};
			
signed main(){
	dice d;
	cin>>d.up>>d.temae>>d.right>>d.left>>d.oku>>d.down;
	string s;
	cin>>s;
	rep(i,s.size())d.change(s[i]);
	cout<<d.up<<endl;
	return 0;
}



Measured memory_bytes: 3172
"""
AtCoder :: Beginner Contest 173 :: Judge Status Summary
https://atcoder.jp/contests/abc173/tasks/abc173_b
"""
import sys
from collections import defaultdict


def main():
    """Main program."""
    N = int(sys.stdin.readline())
    freq = defaultdict(int)
    for _ in range(N):
        status = sys.stdin.readline().strip()
        freq[status] += 1

    for status in ['AC', 'WA', 'TLE', 'RE']:
        print("{} x {}".format(status, freq[status]))



if __name__ == '__main__':
    main()


Measured memory_bytes: 9472
import java.io.*;
class Main{
  public static void main(String[] args)throws java.io.IOException{
             BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
  
             String hoge = input.readLine();
             int x = Integer.parseInt(hoge);
             int ans=0;
 
             ans = x*x*x;
  
             System.out.println(ans);
       }
}
     

Measured memory_bytes: 16860
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n;
	cin >> n;
	set<int> se;
	int cnt = 0;
	vector<int> a(n);
	int maxa = 0, mina = 100000000;
	rep(i, n) {
		cin >> a[i];
		if (se.count(a[i])) cnt++;
		else se.insert(a[i]);
	}
	if (cnt % 2 == 0) {
		cout << se.size() << endl;
	}
	else {
		cout << se.size() - 1 << endl;
	}
}

Measured memory_bytes: 5376
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
for i in range(n-m+1):
  row=a[i]
  if b[0] in row:
    j=row.find(b[0])
    c=0
    for k in range(i,i+m):
      if a[k][j:j+m]==b[k-i]:
        c+=1
      else:
        break
    if c==m:
      print("Yes")
      exit()
print("No")

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

using namespace std;

int main()
{
    long long int k,n;
    cin>>k>>n;int a[n];
    long long int sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum<=k)
    cout<<k-sum;
    else
    cout<<-1;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#define INF 1e+18
#define int long long
using namespace std;

signed main(){
	int n;
	while(cin >> n,n){
		int mi = INF,ma = 0,sum = 0;
		for(int i = 0;i < n;i++){
			int t;
			cin >> t;
			mi = min(t,mi);
			ma = max(t,ma);
			sum += t;
		}
		sum -= (mi + ma);
		cout << sum / (n - 2) << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
#include <cstdio>

int main()
{
  int n;
  scanf("%d", &n);
  for (int dataset = 1; dataset <= n; ++dataset) {
    int s;
    scanf("%d", &s);

    printf("Case %d:\n", dataset);
    for (int i = 0; i < 10; ++i) {
      s = s * s;
      s /= 100;
      s %= 10000;
      printf("%d\n", s);
    }
  }
  return 0;
}

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

int sumar(int mat[4]){
	return mat[0]+mat[1]+mat[2]+mat[3];
}

int main(){
	int a[4];
	int b[4];
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
		cin>>b[0]>>b[1]>>b[2]>>b[3];
		cout<<max(sumar(a),sumar(b))<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.*;

public class Main{
	final static int MOD = 1000000007;
	final static int INF = 1000000000;

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Queue<Process> que = new ArrayDeque<Process>();
		int n = Integer.parseInt(sc.next());
		int q = Integer.parseInt(sc.next());
		for(int i = 0; i < n; ++i){
			String nm = sc.next();
			int t = Integer.parseInt(sc.next());
			que.add(new Process(nm, t));
		}
		sc.close();
		int t = 0;
		while(!que.isEmpty()){
			Process cur = que.poll();
			int prctime = Math.min(q, cur.getTime());
			cur.setTime(cur.getTime() - prctime);
			t += prctime;
			if(cur.getTime() > 0)
				que.add(cur);
			else System.out.printf("%s %d\n", cur.getName(), t);
		}
	}
	
	
	
	static class Process{
		String name; int time;
		public Process(String s, int t){
			name = s; time = t;
		}
		public void setName(String nm){
			name = nm;
		}
		public String getName(){
			return name;
		}
		public void setTime(int t){
			time = t;
		}
		public int getTime(){
			return time;
		}
	}

}


Measured memory_bytes: 87668
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
ans=0
for i in range(K):
    L=T[i::K]
    l=len(L)
    rest='x'
    for k in range(l):
        c='p' if L[k]=='r' else 'r' if L[k]=='s' else 's'
        if(c!=rest):
            rest=c
            ans+=P if c=='p' else S if c=='s' else R
        else:
            rest='x'
print(ans)

Measured memory_bytes: 3316
#include<iostream>

using namespace std;

int main() {

	int x, s, m, h;

	cin >> x;

	h = x / 3600;

	m = (x % 3600) / 60;

	s = (x % 3600) % 60;

	cout << h << ":" << m << ":" << s << endl;

}

Measured memory_bytes: 3108