akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
 
#define ll       long long 
#define fast     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
// #define mod      1000000007
#define pb       push_back
#define S        second
#define F        first
#define P 		 pair<ll,ll>
#define PI       3.1415926535897932384626433832795028
 
//#define ordered_set tree<ll, null_type,less_equal<>, rb_tree_tag,tree_order_statistics_node_update>
ll p[1000002]={0};
void sieve(){
	for(ll i=2;i<=1000001;i++){
		if(p[i]==0)
			for(ll j=i+i;j<=1000001;j+=i)
			{
				p[j]=1;
			}
		
	}

}

int32_t main()
{	fast

 
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	   ll x;
	   cin>>x;
	   if(x<=599 && x>=400)
	   	cout<<8<<endl;
	   else if(x<=799 && x>=600)
	   	cout<<7<<endl;
	   else if(x<=999 && x>=800)
	   	cout<<6<<endl;
	   else if(x<=1199 && x>=1000)
	   	cout<<5<<endl;
	   else if(x<=1399 && x>=1200)
	   	cout<<4<<endl;
	   else if(x<=1599 && x>=1400)
	   	cout<<3<<endl;
	   else if(x<=1799 && x>=1600)
	   	cout<<2<<endl;
	   else if(x<=1999 && x>=1800)
	   	cout<<1<<endl;
		return 0;
}

Measured memory_bytes: 3644
D,N = map(int,input().split())

if D == 0:
  if N == 100:
    print("101")
  else:
    print(N)
elif D == 1:
  if N == 100:
    print("10100")
  else:
    print(100*N)
else:
  if N == 100:
    print("1010000")
  else:
    print(10000*N)


Measured memory_bytes: 2940
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
using namespace std;
long long num[200005],pre[200005],mod=1000000007;
int main(){
	long long i,n;
	scanf("%lld",&n);
	for(i=0;i<n;i++)
		scanf("%lld",&num[i]);
	pre[0]=num[0];
	for(i=1;i<n;i++)
		pre[i]=(pre[i-1]+num[i])%mod;
	long long ans=0;
	for(i=0;i<n-1;i++){
		ans=((ans+num[i]*(pre[n-1]-pre[i]))%mod+mod)%mod;
	}
	printf("%lld\n",ans);
}


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

int main(){
   
    int N;cin>>N;
    vector<int> S(N);
    for(int i=0;i<N;i++){
        cin>>S[i];
    }
    sort(S.begin(),S.end());
    int a=S[N-1];
    auto pos1=lower_bound(S.begin(),S.end(),a/2);
    int x=*pos1,y=*(pos1-1);
    
    if(a%2==0){
    if(x-a/2>=a/2-y) cout<<a<<" "<<y<<endl;
    else cout<<a<<" "<<x<<endl;
    }else{
        if(x-a/2>=a/2-y+1) cout<<a<<" "<<y<<endl;
        else cout<<a<<" "<<x<<endl;
    }
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
    int n; cin >> n;
    vector<ll> v(n);
    map<ll, int> m;
    rep(i, n){
        cin >> v[i];
        m[v[i]]++;
    }
    if(m.size() == 1){
        if(m[0] == n)cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }
    if(m.size() > 3){
        cout << "No" << endl;
        return 0;
    }
    if(m.size() == 2){
        if(m[0] == n / 3){
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
        return 0;
    }
    if(m.size() == 3){
        auto i = m.begin();
        ll k = i ->first; i++;
        while(i != m.end()){
            k ^= i->first;
            i++;
        }
        if(k != 0){
            cout << "No" << endl;
        }
        else{
            bool f = true;
            for(auto i = m.begin(); i != m.end(); i++){
                if(i->second != n/3){
                    f = false;
                }
            }
            if(f) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
    }
    
    system("pause");
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a ,b, c, d, e;
  cin >> a>> b>>c>>d>>e;
  if(a==0) cout << 1 << endl;
  else if(b==0) cout << 2 << endl;
  else if(c==0) cout << 3 << endl;
  else if(d==0) cout << 4 << endl;
  else if(e==0) cout << 5 << endl;
  return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
          
#define pb push_back
#define PII pair<int,int>
          
#define VS vector<string>
#define VI vector<int>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {     
    int n;cin >> n;  
    vector<int> a(n);
    REP(i,n) {       
        cin >> a[i]; 
    }     
    sort(a.begin(),a.end());
          
    bool p=true;     
    int size;        
    if(n%2) {                                                                                                                              
        size = (a.size()-1)/2;
        if(a[0] != 0) p = false;
        if(p) {      
            REP(i,size) {
                if(a[2*i+1] != 2*(i+1) || a[2*i+2] != 2*(i+1)) {
                    cout << 0 << endl;
                    p = false;
                    break;
                }    
            }        
        } 
    } else {         
        size = a.size()/2;
        REP(i,size) {
            if(a[2*i] != 2*i+1 || a[2*i+1] != 2*i+1) {
                cout << 0 << endl;
                p = false;
                break;
            }        
        } 
    }     
          
    ll ans = 1;      
    if(p) {          
        REP(i,size) {
            ans = (ans*2)%(1000000007);
        } 
        cout << ans << endl;
    }     
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define INF 999999999
typedef long long ll;
using namespace std;
int main() {
    int R;
    cin >> R;
    if(R < 1200) puts("ABC");
    else if(R >= 2800) puts("AGC");
    else puts("ARC");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int tmp = 10,ans = 0;
		for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		}
		System.out.println(ans-(10-tmp));
	}
}


Measured memory_bytes: 21844
def main():
    s  = input()
    ind_a = 0
    ind_z = 0
    for i in range(len(s)):
        if(s[i]=="A"):
            ind_a = i
            break
    for i in range(len(s)-1,-1,-1):
        if(s[i]=="Z"):
            ind_z = i
            break



    print(ind_z-ind_a+1)
if __name__ == '__main__':
    main()


Measured memory_bytes: 79852
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <map>
#include <string>
#include <utility>
#include <vector>

std::map<intmax_t, int> factor(intmax_t n) {
  std::map<intmax_t, int> res;
  for (intmax_t i = 2; i*i <= n; ++i) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n > 1) ++res[n];
  return res;
}

int main() {
  intmax_t n;
  scanf("%jd", &n);

  int res = 0;
  for (auto [p, t]: factor(n)) {
    int cur = 1;
    while (cur <= t) {
      ++res;
      t -= cur;
      ++cur;
    }
  }

  printf("%d\n", res);
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  long long ans = 0;
  for(int k = 0; k < 1000; k++){
    int num = k;
    int cnt = n-1, three = 0;
    for(int div = 0; div < 3; div++){
      char c = num % 10 + '0';
      num /= 10;
      for(int i = cnt; i >= 0; i--){
        if(s.at(i) == c){
          cnt = i-1;
          three++;
          break;
        }
      }
    }
    if(three == 3) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3684
#include <cstdio>
char s[1005],t[1005];
int ls,lt,ans=1005,res;
int min(int x,int y){return x<y?x:y;}
int main(){
  while((s[++ls]=getchar())!='\n'&&s[ls]!='\t');
  --ls;
  while((t[++lt]=getchar())!='\n'&&t[lt]!='\t');
  --lt;
  for(int i=1; i<=ls-lt+1; i++){
    res=0;
    for(int j=1; j<=lt; j++){
      res+=(s[i+j-1]!=t[j]);
    }
    ans=min(ans,res);
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 1604
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif

// int dist(vector<int> a , vector<int> b ){
// 	int k = (int)a.size();
// 	int ans = 0 ;
// 	rep(i,k) ans += (a[i]-b[i])*(a[i]-b[i]) ;
// 	int tmp = sqrt(ans) ;
// 	return (tmp*tmp == ans);
// }
void solve()
{
	int n,d , ans = 0 ;
	cin >> n >> d ;
	vector<int> v[n] ;
	rep(i,n){
		v[i].resize(d) ;
		rep(j,d) cin >> v[i][j] ; // , cout << v[i][j] <<" \n"[j == d-1];
	}
	rep(i,n)
		repA(j,i+1,n-1){
			int ansx = 0 ;
			rep(x,d) ansx += (v[i][x]-v[j][x])*(v[i][x]-v[j][x]) ;
			int tmp = sqrt(ansx) ;
			ans += (tmp*tmp == ansx);
		}
	cout << ans ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 256
require 'prime'

loop {
    n, p = gets.split.map &:to_i
    break if n < 0
    primes = []
    Prime.each{|x|
        primes << x if x > n
        break if primes.size > p
    }
    puts primes.product(primes).select{|x, y| x <= y}.map{|x, y| x+y}.sort[p-1]
}

Measured memory_bytes: 10060
#include <stdio.h>
int main(){
  char n[4];
  int num[4],flag[3];
  int i,j,k,tmp;
  
  scanf("%s",&n);
  for(i=0;i<4;i++){
    num[i]=n[i]-'0';
  }
  
  for(i=0;i<2;i++){
    for(j=0;j<2;j++){
      for(k=0;k<2;k++){
        tmp=num[0];
        if(i%2==1){
          tmp+=num[1];
        } else {
          tmp-=num[1];
        }
        
        if(j%2==1){
          tmp+=num[2];
        } else {
          tmp-=num[2];
        }
        
        if(k%2==1){
          tmp+=num[3];
        } else {
          tmp-=num[3];
        }
        
        if(tmp==7){
          flag[0]=i;
          flag[1]=j;
          flag[2]=k;
        }
      }
    }
  }
  
  for(i=0;i<3;i++){
    printf("%d",num[i]);
    if(flag[i]==1){
      printf("+");
    } else {
      printf("-");
    }
  }
  printf("%d=7",num[3]);
}

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

string LCS(string s, string t){
    int m = s.size();
    int n = t.size();
    vector<vector<int> > dp(m+1, vector<int>(n+1,0));
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if(s[i-1]==t[j-1])
                dp[i][j] = 1+dp[i-1][j-1];
            else
                dp[i][j] = max(dp[i][j-1], dp[i-1][j]);

        }
    }
    string ans;
    int i = m;
    int j = n;
    while(i>0 && j>0){
        if(s[i-1]==t[j-1]){
            ans = s[i-1]+ans;
            i--;j--;
        }
        else{
            if(dp[i][j]==dp[i][j-1])
                j--;
            else
                i--;
        }
    }
    return ans;
}

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


Measured memory_bytes: 38984
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n;
  cin >> n;
  map <string, ll> score;
  vector <string> v(n);
  rep(i, n) {
    vector <char> tmp(10);
    rep(j, 10) cin >> tmp.at(j);
    sort(tmp.begin(), tmp.end());
    string str = "01";
    rep(j, 10) str += tmp.at(j);
    v.at(i) = str;
    if (score.count(str)) {
      score.at(str)++;
    } else {
      score[str] = 1;
    }
  }
  ll res = 0;
  rep(i, n) {
    ll tmp = score.at(v.at(i));
    res += tmp*(tmp-1)/2;
    score.at(v.at(i)) = 1;
  }
  cout << res << endl;
}

Measured memory_bytes: 13568
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<iomanip>
#include<algorithm>
using namespace std;

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

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

w,h,x,y,r=get_i
if x-r>=0 and x+r<=w and y-r>=0 and y+r<=h
    puts "Yes"
else
    puts "No"
end


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

using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
	char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
	vector<char*> v({token});
	while(token = strtok(NULL,", ")) v.push_back(token);
	return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
	debug() << " [" << args.back() << ": " << H << "] ";
	args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define print(x) cout << x << "\n";
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
ll mod=998244353;
const int MX=0x3f3f3f3f;

int main(){
	IOS;
	ll n;
	cin>>n;
	ll p[12],i;
	p[0]=1;
	REP(i,1,11) p[i]=26*p[i-1];
	i=1;
	string ans;
	dbg(p[10]);
	while(n-p[i]>0){
		n-=p[i];
		i++;
	}
	dbg(n,p[i]);
	n%=p[i];
	if(n==0) n=p[i];
	i--;
	while(i>=0){
		ans+=(n-1)/p[i]+'a';
		n%=p[i];
		if(n==0) n=p[i];
		i--;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3508
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  string S;
  cin >> S;

  ll Ans = 0;
  if (S == "SUN") Ans = 7;
  if (S == "MON") Ans = 6;
  if (S == "TUE") Ans = 5;
  if (S == "WED") Ans = 4;
  if (S == "THU") Ans = 3;
  if (S == "FRI") Ans = 2;
  if (S == "SAT") Ans = 1;
  cout << Ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;


public class Main {

    public static void main(String[] args) throws IOException {

        Scanner s = new Scanner(System.in);
        int n = s.nextInt(),cnt=0;
        int arr[] = new int[n];
        for(int i=0;i<n;i++)arr[i]=s.nextInt();
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                for(int k=j+1;k<n;k++){
                    if(arr[i]!=arr[j]&&arr[j]!=arr[k]&&arr[i]!=arr[k]){
                        if(arr[i]+arr[j]>arr[k] && arr[i]+arr[k]>arr[j] && arr[j]+arr[k]>arr[i] )cnt++;
                    }
                }
            }
        }
        System.out.println(cnt);

    }

}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 26316
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public static class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Program
{
    static long N, K;
    static long[] A;

    public static void Main(string[] args)
    {
        N = Input.NextLong();
        K = Input.NextLong();
        A = Input.LineLong();

        var k = K;
        int maxBitN = 0;
        for (; ;)
        {
            k = k >> 1;
            if (k == 0)
                break;
            maxBitN++;
        }

        long answer = 0;
        for (int i = maxBitN; i >= 0; i--)
        {
            long bitM = 1L << i;
            var nOf1 = A.Count(n => (n & bitM) != 0);
            var nOf0 = A.Count() - nOf1;
            var cAns = answer + ((nOf1 <= nOf0) ? bitM : 0);
            if (cAns <= K)
                answer = cAns;
        }

        Console.WriteLine(A.Sum(n => n ^ answer));
    }
}


Measured memory_bytes: 30556
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,sum,difference,multiple;
  
  cin >> a >> b;
  
  sum = a+b;
  difference = a-b;
  multiple = a*b;
  
  if ( sum >= difference and sum >= multiple){
    cout << sum << endl;
  }
  else if (difference >= sum and difference >= multiple){
    cout << difference << endl;
  }
  else if (multiple >= sum and multiple >= difference){
    cout << multiple << endl;
  }
}

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

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

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

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

    int n;
    string s;
    cin >> n >> s;
    vt<int> p(n + 1);
    for (int i = 0; i < n; i++) {
        p[i + 1] = p[i] + (s[i] == 'E');
    }

    int ans = n;
    for (int i = 0; i < n; i++) {
        ans = min(ans, p[n] - p[i + 1] + (i - p[i]));
    }
    cout << ans;
}


Measured memory_bytes: 4788
use proconio::{input, fastout};
use std::usize::MAX;

const MOD: usize = 1_000_000_007;

fn dp(step_cnt: &mut Vec<usize>, steps: usize) -> usize {
    if step_cnt[steps] != MAX { return step_cnt[steps]; }
    step_cnt[steps] = ( dp(step_cnt, steps-1) + dp(step_cnt, steps-2) ) % MOD;
    step_cnt[steps]
}

#[fastout]
fn main() {
    input! {
        n: usize, m: usize,
        broken: [usize; m],
    }

    let mut step_cnt: Vec<usize> = vec![MAX; n+4];
    step_cnt[0] = 1;
    step_cnt[1] = 1;
    step_cnt[2] = 2;

    let mut ans;
    let mut last_idx = 0;
    let mut it = broken.iter();
    let f = it.next();
    if f == None {
        ans = dp(&mut step_cnt, n-last_idx);
    } else {
        let i = f.unwrap();
        ans = dp(&mut step_cnt, i-last_idx-1);
        last_idx = *i;
        for i in it {
            if i-last_idx==1 { ans=0; break }
            ans = ans * dp(&mut step_cnt, i-last_idx-2) % MOD;
            last_idx = *i;
        }
        ans = ans * dp(&mut step_cnt, n-last_idx-1) % MOD;
    }

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


Measured memory_bytes: 7232
#include<stdio.h>
#include<stdlib.h>
#define N 100
int main(){
  int A[N],a,i,j,flag=1,cnt=0,v;
  scanf("%d",&a);
  if(a<1 || a>100)exit(0);
  for(i=0;i<a;i++){
    scanf("%d",&A[i]);
    if(A[i]<0 || A[i]>100)exit(1);
  }
  while(flag==1){
    flag=0;
    for(j=a-1;j>0;j--){
      if(A[j]<A[j-1]){
	v=A[j-1];
	A[j-1]=A[j];
	A[j]=v;
	flag=1;
	cnt++;
      }
    }
  }
  for(i=0;i<a;i++){
    printf("%d",A[i]);
  if(i==a-1)printf("\n");
  else printf(" ");
  }
  printf("%d\n",cnt);

  return 0;
}



Measured memory_bytes: 2140
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

int ctoi(const char c) {
	return c - '0';
}
int keta(int a) {
	return to_string(a).size();
}

signed main(){
	double n, m, d;
	cin >> n >> m >> d;
	if (d == 0) {
		printf("%.10lf\n", (1 / n)*(m-1));
	}
	else {
		printf("%.10lf\n",( 2 * (n - d) / (n * n))*(m-1));
	}
}


Measured memory_bytes: 256
#include <stdio.h>
 
void swap(int* pInput1, int* pInput2)
{
	int temp = *pInput1;
	*pInput1 = *pInput2;
	*pInput2 = temp;
} 
 
 
int main()
{
    int Input[3];
    scanf("%d %d %d", &Input[0], &Input[1], &Input[2]);
    while(-1){
    if (Input[0] > Input[1]) {
        swap(&Input[0], &Input[1]);
    }
    else if (Input[1] > Input[2]) {
        swap(&Input[1], &Input[2]);
    }
    else break;
    }
    printf("%d %d %d\n" ,Input[0], Input[1], Input[2]);
    return 0;
}



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

using namespace std;

typedef long long ll;

int main()
{
	int n;
	scanf("%d\n", &n);
	map<ll, int> cnt;

	for(int i = 0; i < n; i++) {
		int num;
		scanf("%d", &num);

		cnt[num]++;
	}

	ll mx = 0, mx2 = 0;
	for(auto i = cnt.rbegin(); i != cnt.rend(); i++) {
		if(i->second >= 2) {
			if(mx == 0) {
				mx = i->first;

				if(i->second >= 4)
					mx2 = i->first;
			} else {
				if(mx2 == 0) {
					mx2 = i->first;
				}
			}
		}
	}

	printf("%lld\n", mx * mx2);

	return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll N,K,i,thuong,du;
int main(){
   cin>>N>>K;
   if(N%K==0) {cout<<0;return 0;}
   du = N%K;
   cout<<min(abs(du-K),du);
   return 0;
}


Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

// =========ここまでテンプレ============

int main()
{
    ll n;
    cin >> n;
    ll result = 0;
    for (ll i = 1; i <= n; ++i)
    {
        result += i * ((n / i) * (n / i + 1)) / 2;
    }
    cout << result << endl;
}

Measured memory_bytes: 3196
#include<stdio.h>
#include<string.h>

int main(void){
    char s[3];
    int ans = 0;
    scanf("%s",s);
    char day[7][3] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

    int i;
    for(i = 0; i < 7; i++){
        if(strncmp(s,day[i],3) == 0){
            ans = 7 - i;
        }
    }

    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a < b){
            System.out.println("a < b");
        }else if(a > b){
            System.out.println("a > b");
        }else{
            System.out.println("a == b");

        }

    }

}


Measured memory_bytes: 26344
#include<stdio.h>

const int mod = 1e9 + 7;

int main(){
  int N;
  scanf("%d", &N);
  
  int dp[N + 1][5][5][5];
  for(int i = 0; i <= N; i++){
    for(int j = 0; j <= 4; j++){
      for(int k = 0; k <= 4; k++){
        for(int l = 0; l <= 4; l++){
          dp[i][j][k][l] = 0;
        }
      }
    }
  }
  dp[0][0][0][0] = 1;
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j <= 4; j++){
      for(int k = 0; k <= 4; k++){
        for(int l = 0; l <= 4; l++){
          for(int m = 1; m <= 4; m++){
            if(j == 1 && k == 2 && m == 3 ||
               j == 1 && l == 2 && m == 3 ||
               k == 2 && l == 1 && m == 3 ||
               k == 1 && l == 3 && m == 2 ||
               k == 1 && l == 2 && m == 3) continue;
            dp[i + 1][k][l][m] += dp[i][j][k][l];
            dp[i + 1][k][l][m] %= mod;
          }
        }
      }
    }
  }
  
  long long sum = 0;
  for(int j = 1; j <= 4; j++){
    for(int k = 1; k <= 4; k++){
      for(int l = 1; l <= 4; l++){
        sum += dp[N][j][k][l];
        sum %= mod;
      }
    }
  }
  
  printf("%lld\n", sum);
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


class toporogical_sort_fn_t {
public:
  toporogical_sort_fn_t(const std::vector<std::vector<int>>& G) :
    G_(G), N_(G_.size()), indices_(N_), visit_(N_)
  {
    assert(N_);
  };

public:
  std::vector<int> sort() {
    index_ = N_ - 1;

    std::fill(ALL(visit_), 0);

    for (int i = 0; i < N_; i ++)
      if (! visit_[i])
        if (! dfs(i))
          return {};

    return indices_;
  };

private:
  bool dfs(int i) {
    visit_[i] = 1;

    for (const auto& k : G_[i]) {
      // If self-loop is allowed, uncomment the following lines.
      //  if (k == i)
      //   continue;

      if (visit_[k] == 2)
        continue;

      if (visit_[k] == 1)
        return false;	// Self-loop is detected.

      if (! dfs(k))
        return false;
    }

    visit_[i] = 2;

    assert(0 <= index_ && index_ < N_);

    indices_[index_ --] = i;

    return true;
  };

private:
  const std::vector<std::vector<int>>& G_;

private:
  int N_;

  std::vector<int> indices_;

  int index_;

  std::vector<uint8_t> visit_;
};


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, M;

  std::cin >> N >> M;

  std::vector<std::vector<int>> G(N), H(N);

  for (int i = 0, u, v; i < N - 1 + M; i ++) {
    std::cin >> u >> v;

    u --;
    v --;

    G[u].push_back(v);
    H[v].push_back(u);
  }

  toporogical_sort_fn_t fn(G);

  std::vector<int> a = fn.sort();

  int d[111111], p[111111];

  memset(d, -1, sizeof(d));

  for (int i = 0; i < N; i ++) {
    int x = a[i];
    
    if (i == 0) {
      d[x] = 0;
      p[x] = 0;
    }
    else {
      int dp = -1, kp = -1;
        
      for (const auto& k : H[x]) {
        assert(d[k] >= 0);

        if (d[k] > dp) {
          dp = d[k];
          kp =   k;
        }
      }

      d[x] = dp + 1;
      p[x] = kp + 1;
    }
  }

  for (int i = 0; i < N; i ++)
    std::cout << p[i] << std::endl;

  return 0;
}


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

int ipow(int a, int b){
    int r = 1;
    for (int i = 0; i < b; i++)
    {
        r *= a;
    }
    return r;
}

void Main()
{
    int n, m;
    cin >> n >> m;
    vector<int> s(m), c(m);
    for (int i = 0; i < m; i++)
    {
        cin >> s[i] >> c[i];
        s[i]--;
    }

    int n1 = ipow(10, n-1);
    if(n==1) n1 = 0;
    int n2 = ipow(10, n);
    
    for (int i = n1; i < n2; i++)
    {
        int ok = 1;
        for (int j = 0; j < m; j++)
        {
            if(i / ipow(10, n-s[j]-1) % 10 != c[j]) {
                ok = 0;
            }
        }
        if (ok) {
            cout << i << endl;
            return;
        }
    }
    
    cout << -1 << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


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

int A, B;
string S;

int main() {
    cin >> A >> B >> S;

    bool f = true;
    for (int i = 0; i < A+B+1; i++) {
        if (i == A && S[i] != '-') {
            f = false;
            break;
        }
        else if (i != A && S[i] == '-') {
            f = false;
            break;
        }
    }

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

    return 0;
}


Measured memory_bytes: 256
n=gets.to_i
l=gets.split.map(&:to_i).sort
an=0
n.times do |c|
  c.times do |b|
    b.times do |a|
      an+=1 if l[a]+l[b]>l[c]&&l[a]!=l[b]&&l[b]!=l[c]
    end
  end
end
puts an


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

int main(){
    int r, c;
    cin>>r>>c;
    int a[r][c];
    rep(i, r){
        rep(j, c){
            cin>>a[i][j];
        }
    }
    int count=0;
    rep(i, r){
        count=0;
        rep(j, c){
            cout<<a[i][j]<<" ";
            count+=a[i][j];
        }
        cout<<count<<endl;
    }
    int sum=0;
    rep(i, c){
        count=0;
        rep(j, r){
            count+=a[j][i];
        }
        cout<<count<<" ";
        sum+=count;
    }
    cout<<sum<<endl;
}


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

public class Main {	

	private static void solve(){
		//Implement solution here.
		double X = nd();
		double M = 100D;
		int result = 0;
		while(M < X) {			
			M = Math.floor(M * 1.01);
			result++;
		}
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 25628
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 101
#define MOD 1000000007

int main(){

    ll n,m;
    cin >> n >> m;
    ll ans = 0;
    
    
    ll S = m/2;
    if(n <= S){
        ans += n;
        m-=2*n;
    }else{
        ans+= S;
        m -= 2*S;
    }
    ans += m/4;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
a.sort()
c=0
d=0
i=0
while d<m:
    if m-d>=a[i][1]:
        c+=a[i][0]*a[i][1]
    else:
        c+=a[i][0]*(m-d)
    d+=a[i][1]
    i+=1
print(c)

Measured memory_bytes: 27760
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
using namespace std;
 
typedef long long ll;
 
int main(){
	ll a[3][3];
    ll n;
    bool f= false;
    for(int i=0;i<3 ;i++){
    	for(int j=0; j<3; j++){
        	cin >> a[i][j];
        }
    } 
    cin >> n;
    ll b;
    for(int i=0;i<n;i++){
    	cin >> b;
        for(int i=0;i<3 ;i++){
    		for(int j=0; j<3; j++){
        		if(b==a[i][j]){
                	a[i][j]=0;
                }
        	}
    	} 
    }
    if(a[0][0]==0 && a[0][1]==0 &&a[0][2] ==0) f = true;
    if(a[1][0]==0 && a[1][1]==0 &&a[1][2] ==0) f = true;
    if(a[2][0]==0 && a[2][1]==0 &&a[2][2] ==0) f = true;
    if(a[0][0]==0 && a[1][0]==0 &&a[2][0] ==0) f = true;
    if(a[0][1]==0 && a[1][1]==0 &&a[2][1] ==0) f = true;
    if(a[0][2]==0 && a[1][2]==0 &&a[2][2] ==0) f = true;
    if(a[0][0]==0 && a[1][1]==0 &&a[2][2] ==0) f = true;
    if(a[0][2]==0 && a[1][1]==0 &&a[2][0] ==0) f = true;
    if(f){
    	cout << "Yes" << endl;
    }else{
    	cout << "No" << endl;
    }      
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
int v[10000]={};

int main(){
    int N;
    double sum = 0;
    cin >> N;
    rep(i,N){
        cin >> v[i];
    }
    sort(v,v+N);
    sum = v[0];
    for(int i=1;i<N;i++){
        sum += v[i];
        sum /= 2.0;
    }

    cout << std::fixed;
    cout << std::setprecision(7) << sum << endl;
}

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

vector <pair<int,int>> v;
bool cmp(pair<int,int> a,pair<int,int> b)
{
	if(a.second==b.second)
	{
		return a.first < b.first;
	}
	return a.second < b.second;
}

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

	int n,m,a,b;

	cin >> n >> m;

	for(int i=0;i<m;i++)
	{
		cin >> a >> b;
		v.push_back(make_pair(a,b));
	}

	sort(v.begin(),v.end(),cmp);

	int point = -1;
	int res = 0;

	for(int i=0;i<m;i++)
	{
		if(point<=v[i].first)
		{
			point = v[i].second;
			res++;
		}
	}

	cout << res << '\n';

	return 0;	
}

Measured memory_bytes: 1400
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    System.out.println( a * b * c == 175 ? "YES" : "NO" );
  }
}


Measured memory_bytes: 21716
#include <stdio.h>
#define min(a,b) (a<b?a:b)
#define inf 1<<30

int main(void){
    int n,i;
    scanf("%d\n",&n);
    char dir[n];
    int sum_W[n+1],sum_E[n+1];
    for(i=0;i<n+1;i++)
    {
        sum_W[i]=sum_E[i]=0;
    }
    
    for(i=0;i<n;i++)
    {
        scanf("%c",&dir[i]);
    }
    
    for(i=0;i<n;i++)
    {
        if(dir[i]=='W')
        {
            sum_W[i+1]=sum_W[i]+1;
            sum_E[i+1]=sum_E[i];
        }
        else
        {
            sum_W[i+1]=sum_W[i];
            sum_E[i+1]=sum_E[i]+1;
        }
    }
    
    int cost,ans=inf;
    for(i=0;i<n;i++)
    {
        cost=sum_W[i]+(sum_E[n]-sum_E[i+1]);
        ans=min(cost,ans);
    }
    
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 2816
using System;
using System.Collections;
using System.Linq;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        string s = sc.Next();
        int ans = 0;

        bool[] f = new bool[1000];

        var b = new bool[n + 1, 10];
        for (int i = n - 1; i >= 0; i--)
        {
            for (int j = 0; j < 10; j++)
            {
                b[i, j] = b[i + 1, j];
            }

            b[i, s[i] - '0'] = true;
        }

        bool[] c = new bool[10];
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j <= 9; j++)
            {
                if (!c[j]) continue;
                for (int k = 0; k <= 9; k++)
                {
                    if (!b[i + 1, k]) continue;
                    int tmp = j * 100 + (s[i] - '0') * 10 + k;
                    f[tmp] = true;
                }
            }

            c[s[i] - '0'] = true;
        }

        Console.WriteLine(f.Count(d => d));
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 28344
#include <bits/stdc++.h>
using namespace std ;
int n,ans ;
int sum(int a){
	int t=0 ;
	while(a){
		t+=a%10 ;
		a/=10 ;
	}
	return t ;
}
int main(){
	scanf("%d",&n) ;
	ans=0x3f3f3f3f ;
	for (int i=1;i<n;i++){
		int d1=i,d2=n-i ;
		ans=min(ans,sum(d1)+sum(d2)) ;
	}
	printf("%d\n",ans) ;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD_CONST 1000000007
typedef long long int lli;

int main(){
    int n, d;
    cin >> n >> d;
    if(d * 2 >= n){
        cout << 1 << endl;
    }else{
        int position = -1;
        int right_edge = -1;
        int ans = 0;
        while (right_edge < n - 1){
            position = (position < 0)? d : position + 2 * d + 1;
            right_edge = position + d;
            ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};


int main() {
    ll D;
    cin >> D;
    vl c(26);
    rep(i,26){
        cin >> c[i];
    }
    ll s[D][26];
    rep(i,D){
        rep(j,26){
            cin >> s[i][j];
        }
    }
    vl latest_t(26,0);
    ll k=0;
    FOR(i,1,D+1){
        vl nt=latest_t;
        ll nk=k;
        ll MX=-INF;
        ll ans;
        rep(j,26){
            nt=latest_t;
            nk=k;
            nk+=s[-1+i][j];
            nt[j]=i;
            rep(l,26){
                nk-=c[l]*(i-nt[l]);
            }
            if(nk>MX){
                MX=nk;
                ans=j;
            }
            if(j==25){
                k=MX;
            }
        }
        cout << ans+1 << endl;
        latest_t[ans]=i;
        //cout << k << endl;
    }
}

Measured memory_bytes: 3680
class dice:
    top = 1
    flont = 2
    right = 3
    def do_N(self):
        temp = self.flont
        self.flont = 7-self.top
        self.top = temp

    def do_S(self):
        temp = 7-self.flont
        self.flont = self.top
        self.top = temp

    def do_E(self):
        temp = self.top
        self.top = 7-self.right
        self.right = temp

    def do_W(self):
        temp = 7-self.top
        self.top = self.right
        self.right = temp

num1 = list(map(int, input().split()))
order1 = input()

dice1 = dice()
for i in range(len(order1)):
    if order1[i] == "N":
        dice1.do_N()
    elif order1[i] == "S":
        dice1.do_S()
    elif order1[i] == "E":
        dice1.do_E()
    elif order1[i] == "W":
        dice1.do_W()

print(str(num1[dice1.top-1]))


Measured memory_bytes: 5600