akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;

fn main() {
    input! {
        s:String
    }

    let tomo = match s.as_str() {
        "Sunny" => "Cloudy",
        "Cloudy" => "Rainy",
        "Rainy" => "Sunny",
        _ => ""
    };

   println!("{}", tomo);

}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	char c[6];
	for(int i=0; i<6; i++){
		cin >> c[i];
    }
  	if(c[0]==c[5] && c[1]==c[4] && c[2]==c[3]){
		cout << "YES" << endl;
    }else{
		cout << "NO" << endl;
    }

	return 0;
}

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


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define sec second
#define fir first
#define pb push_back



/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
//const int inf = pow(2, 62);
//const int mod = 1e9 + 7;
const int mod = 100000;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};



/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


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




/* main */



signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b, c; cin >> a >> b >> c;

    print((a * 100 + b * 10 + c) % 4 == 0 ? "YES" : "NO");

    
    




    
    



    
    

    







   




    

    

    




    



    



    

 
    
    


    

    
   
    













}






    










    




    










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

using namespace std;

typedef pair<int,int> P;

int main()
{
  string s;
  cin >> s;
  int n = s.size();

  if(s[0] == '0' || s[n-1] == '1'){
    cout << -1 << endl;
    return 0;
  }

  s = s[n-1] + s;

  for(int i = 0; i <= n; i++){
    if(s[i] != s[n-i]){
      cout << -1 << endl;
      return 0;
    }
  }

  int now = 2;
  vector<P> ans;
  ans.push_back(P(1,2));
  for(int i = 2; i < n; i++){
    if(s[i] == '0'){
      ans.push_back(P(now,i+1));
    }else{
      ans.push_back(P(now,i+1));
      now = i+1;
    }
  }

  for(int i = 0; i < ans.size(); i++){
    cout << ans[i].first << " " << ans[i].second << endl;
  }

  return 0;
}

Measured memory_bytes: 2416
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;

int main(void){
  ll n;
  ll s=0;
  cin>>n;
  vector <int> a(n),ans(n);
  rep(i,n){
    cin>>a[i];
    s=s^a[i];
  }
  rep(i,n){
    ans[i]=s^a[i];
    cout<<ans[i]<<" "<<endl;
  }
return 0;
}


Measured memory_bytes: 4844
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
if A[-1] == 0:
    print(0)
    exit()
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)


Measured memory_bytes: 21704
#include <bits/stdc++.h>
#include<chrono>
using namespace std;
using ll = long long;

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A[i][j];
    }
  }
  
  for (int i = 0; i < H+2; i++) {
    for (int j = 0; j < W+2; j++) {
      if (i == 0 || i == H+1) {
        if (j == W+1) {
          cout << '#' << endl;
        }
        else {
          cout << '#';
        }
      }
      else {
        if (j == 0) {
          cout << '#';
        }
        else if (j == W+1) {
          cout << '#' << endl;
        }
        else {
          cout << A[i-1][j-1];
        }
      }
    }
  }
}


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

int main(){
    int N;
    cin >> N;

    vector<int> P(N);
    for(int i = 0; i < N; i++){
        cin >> P.at(i);
    }

    int minnum = P.at(0);
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(minnum >= P.at(i)){
            ans++;
            minnum = P.at(i);
        }
    }

    // int ans = 0;
    // for(int i = 0; i < N; i++){
    //     bool flag = true;
    //     for(int j = 0; j < i + 1; j++){
    //         if(P.at(i) > P.at(j)){
    //             flag = false;
    //             break;
    //         }
    //     }
    //     if(flag) ans++;
    // }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

int bubbleSort(int *a, int n){
  int cnt=0;
  bool flag=true;
  while(flag){
    flag=false;
    for(int j=n-1;j>0;j--){
      if(a[j]<a[j-1]){
	swap(a[j],a[j-1]);
	flag=true;
	cnt++;
      }
    }
  }
  return cnt;
}

int main(){
  int n;
  int *a = new int[n];
  cin >> n;
  for(int i=0;i<n;i++){
    int tmp;
    cin >> tmp;
    a[i] = tmp;
  }

  int numExchange = bubbleSort(a, n);
  for(int i=0;i<n;i++){
    if(i!=0){cout << " ";}
    cout << a[i];
  } 
  cout << endl;

  cout << numExchange << endl;
  
}

Measured memory_bytes: 1180
/*
luogu AT5256
*/
#include <bits/stdc++.h>
using namespace std;

#define int long long

int n,m;
vector<int> ans;
int ee,h[100005],nex[100005],to[100005];
int vis[100005],in[100005],top,sk[100005];
int g[1005][1005];

void addedge(int x,int y)
{
	nex[++ee] = h[x];
	to[ee] = y;
	h[x] = ee;
}

void dfs(int x)
{
	vis[x] = true;
	sk[++top] = x;
	in[x] = true;
	for(int i=h[x];i;i=nex[i])
	{
		if(in[to[i]])
		{
			do{
				ans.push_back(sk[top]);
			}while(sk[top--]!=to[i]);
			cout<<ans.size()<<endl;
			for(int i=0;i<ans.size();i++)
				cout<<ans[i]<<endl;
			exit(0);
		}
		else if(!vis[to[i]])
			dfs(to[i]);
	}
	in[x] = false;
	top--;
}

signed main()
{
	cin>>n>>m;
	for(int i=1,x,y;i<=m&&cin>>x>>y;i++)
		addedge(x,y), g[x][y] = 1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(g[i][j] && g[j][i])
				return cout<<2<<endl<<i<<endl<<j<<endl, 0;
	for(int i=1;i<=n;i++)
		if(!vis[i])
			dfs(i);
	puts("-1");
	
	return 0;
}

Measured memory_bytes: 8700
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll h,w;cin>>h>>w;
  if(h%3==0 || w%3==0){
    cout<<0<<endl;
    return 0;
  }
  ll i=1,uw=w/2,dw=(w+1)/2,ans=10000000000;
  while(i<=(h+1)/2){
    ll a=i*w,b=(h-i)*uw,c=(h-i)*dw;
    ll minnum=min(a,b),maxnum=max(a,b);
    minnum=min(minnum,c); maxnum=max(maxnum,c);
    if(maxnum-minnum<ans) ans=maxnum-minnum;
    i++;
  }ll j=1,uh=h/2,dh=(h+1)/2;
  while(j<=(w+1)/2){
    ll x=j*h,y=(w-j)*uh,z=(w-j)*dh;
    ll minnum2=min(x,y),maxnum2=max(x,y);
    minnum2=min(minnum2,z); maxnum2=max(maxnum2,z);
    if(maxnum2-minnum2<ans) ans=maxnum2-minnum2;
    j++;
  }if(w<ans && h>3) ans=w;
  if(h<ans && w>3) ans=h;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll a,b,c; cin>>a>>b>>c;
	if(a%2==1 && b%2==1 && c%2==1){
		cout<<0;
		return 0;
	}
	else if(a==b && b==c){
		cout<<"-1";
		return 0;
	}
	set<vl> s;
	ll ans=0;
	while(a%2==0 && b%2==0 && c%2==0){
		ll n=a/2,m=b/2,k=c/2;
		a=m+k;
		b=n+k;
		c=m+n;
		vl vec(3);
		vec[0]=a;
		vec[1]=b;
		vec[2]=c;
		/*if(s.count(vec)){
			cout<<-1;
			return 0;
		}*/
		s.insert(vec);
		++ans;
	}
	cout<<ans;
	
	
	
	return 0;
}

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

#define range 524289
#define mod 998244353
#define eps 1e18
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<

using namespace std;

typedef long long ll;
typedef vector <double> vi;
typedef vector<vi> vvi;
typedef pair <ll, ll> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;


int e[8] = {1,-1,1, -1, 2,2,-2,-2};
int z[8] = {2, 2,-2, -2, 1,-1,1,-1};



int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin>>t;
    while(t--){

        int n, m;
        cin>>n;
        vvi dp(n, vi(n+1));
        for (int i = 0; i < n; ++i)
        {
            /* code */
            double x;
            cin>>x;

            if(i==0){
                dp[i][0] = 1-x;
                dp[i][1] = x;
                continue;
            }
            dp[i][0] = dp[i-1][0]*(1-x);
            dp[i][i+1] = dp[i-1][i]*x;
            for(int j = i; j>0;j--){
                dp[i][j] = dp[i-1][j]*(1-x) + dp[i-1][j-1]*x;
            }
        }
        int k = n/2  + 1;
        double res = 0;
        for (int i = k; i <= n; ++i)
        {
            // cout<<i<<" "<<j<" "<<dp[i][j]<<endl;
            res += dp[n-1][i];
        }
        cout<<setprecision(10)<<res<<endl;
    }

}



Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007;
 
int N, M, A[100000];
 
int main(){
    cin >> N >> M;
    for(int i=0;i<M;i++)    cin >> A[i];
 
    for(int i=0;i<M-1;i++){
      if(A[i] == A[i+1]-1){
        cout << "0" << endl;
        return 0;
      }
    }

    int64_t DP[100001];
    DP[0] = 1;

    int j = 0;
    for(int i=1;i<=N;i++){
      if( j < M && i == A[j] ){
        DP[i] = 0;
        j++;
      } else {
        if( i == 1) DP[i] = 1;
        else DP[i] = ( DP[i-1] + DP[i-2] ) % MOD;
      }
    }

    // for(int i=0;i<=N;i++)  cout << DP[i] << endl;

    cout << DP[N] << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
typedef long long ll;
const int mod = 1e9 + 7;
const int INF = 1e9;
int main(){
    int h, n;
    cin >> h >> n;
    vector<int> dp(h+1, INF);
    dp[0] = 0;
    rep(i,n){
        int a, b;
        cin >> a >> b;
        rep(j,h+1){
            if(j < a)dp[j] = min(dp[j], b);
            else dp[j] = min(dp[j], dp[j-a] + b);
        }
    }
    cout << dp[h] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

ll s(ll n) {
    ll b = 0;
    while (n > 0) {
        b += n % 10;
        n /= 10;
    }
    return b;
}

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

    ll k;
    cin >> k;
    ll n = 1;
    vector<ll> x = {1};
    rep(i, 0, 15) x.emplace_back(*x.rbegin() * 10ll);
    debug(x);

    while (k--) {
        cout << n << endl;
        double mn = 1e18;
        int j = 0;
        rep(i, 0, 16) {
            double a = (double)(n + x[i]) / s(n + x[i]);
            if (a < mn) {
                j = i;
                mn = a;
            }
        }
        n += x[j];
    }

    return 0;
}

Measured memory_bytes: 256
import sys
 
n = int(input())
r0 = int(input())
r1 = int(input())
mx = r1-r0
mn = min(r1,r0)
 
for i in map(int,sys.stdin.readlines()):
    if mx < i - mn:
        mx = i - mn
        if 0 > i-mn:
            mn = i
    elif mn > i:
        mn = i
 
print(mx)

Measured memory_bytes: 19832
// 

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = (1 << 29);
const long long INFL = 1LL<<60;

void dump(const vector<pair<int, int>>& a)
{
  for (auto v : a) {
    cerr << v.first << " " << v.second << endl;
  }
}

void dump(const vector<int>& a)
{
  for (auto v : a) {
    cerr << v << " ";
  }
  cerr << endl;
}

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

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  int lastSS = 0;
  int lastSE = 0;
  int lastES = 0;
  int lastEE = 0;
  string tmp = "";

  for (int i = 0; i < n-1; i++) {
    if (ans > 0) {
      tmp += s[i];
    } else {
      tmp = s[i];
    }

    // cerr << "i: " << i << "  tmp: " << tmp << endl;

    int pos = s.rfind(tmp);
    if (pos <= i) {
      // not found
      if (i == 0) {
        tmp = s[i];
      } else {
        lastSS = i - ans;
        tmp = s.substr(i-ans+1, ans);
        // cerr << tmp << endl;
      }
    } else {
      ans++;
      lastSE = i;
      lastSS = i - ans + 1;
      lastES = pos;
      lastEE = pos + ans -1;
    }
    // cerr << i << " " << ans << " " << lastSS << " " << lastSE << " " << lastES << " " << lastEE << endl;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
       
#define MIN_VALUE 3
#define MAX_VALUE 10000
#define IS_ERR(a) (a < MIN_VALUE || a > MAX_VALUE)
      
int main(void)
{
    int n, x;
    scanf("%d", &n);
       
    if(IS_ERR(n)) return -1;
      
    for(int i=1;i<=n;i++)
    {
        if(i % 3 == 0 || i % 10 == 3)
        {
           printf(" %d", i);
           continue;
        }
   
        x = i;
        while(x /= 10)
        {
            if(x % 10 == 3)
            {
                printf(" %d", i);
                break;
            }
        }
    }
    printf("\n");
       
    return 0;
}


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

int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());

	string t;
	cin >> t;
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, M;
    cin >> N >> M;
    priority_queue<ll> q;
    REP(i, N)
    {
        ll a;
        cin >> a;
        q.push(a);
    }
    REP(i, M)
    {
        ll value = q.top();
        q.pop();
        value /= 2;
        q.push(value);
    }
    ll ans = 0;
    while(!q.empty())
    {
        ans += q.top();
        q.pop();
    }

    cout << ans << endl;
}


Measured memory_bytes: 1400
#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>;

vector<int> rt[11];

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    int ans = 0;
    for (int l = 0; l <= k; l++) {
      for (int r = 0; r <= k-l; r++) {
        if (l+r > n) continue;
        int d = k-l-r;
        int now = 0;
        vector<int> s;
        for (int i = 0; i < l; i++) {
          now += v[i];
          s.push_back(v[i]);
        } 
        for (int i = n-r; i <= n-1; i++) {
          now += v[i];
          s.push_back(v[i]);
        }
        sort(s.begin(), s.end());
        for (int i = 0; i < d; i++) {
          if (i >= s.size()) break;
          if (s[i] > 0) break;
          now -= s[i];
        }
        ans = max(ans, now);
      }
    }
    cout << ans << endl;
    return 0;
}

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

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

using namespace std;

int main()
{
  int l, r, d;
  int cnt = 0;
  cin >> l >> r >> d;

  for(int i=l; i<=r; i++){
    if(i%d == 0){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3588
import std.stdio, std.string, std.conv, std.algorithm, std.math;
void main() {
	for (;;) {
		auto n = readln.chomp.to!real;
		if (n == 0) break;
		auto d = readln.split.to!(real[]);
		real av = d.reduce!"a+b"/n;
		"%.8f".writefln(sqrt(d.map!(a => (a - av).pow(2)).sum / n));
	}
}

Measured memory_bytes: 2532
#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn=5e5+100;
int a[maxn],b[maxn];
const int N=3e5+100;
const int dif=1e5+100;
void solve(){
	cin >> n;
	a[dif]++,b[dif]++;
	for (int i=1;i<=n;i++){
		int x,y;cin >> x >> y;
		a[x+dif]++;
		b[y+dif]++;
	}
	for (int i=1;i<N;i++){
		b[i]+=b[i-1]; 
	}
	for (int i=N-1;i>=0;i--){
		a[i]+=a[i+1];
	}
//	for (int i=dif-10;i<=dif+10;i++) cout << a[i] << ' ';
//	cout << endl;
//	for (int i=dif-10;i<=dif+10;i++) cout << b[i] << ' ';
//	cout << endl;
	long long ans=0;
	for (int i=1;i<=N;i++){
		ans+=min((long long)a[i+1],(long long)b[i]);
	}
	cout << ans*2;
}
int main(){
	solve();
	return 0;
}


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

const int INF = 0x3f3f3f3f;

int d[101][101], a[1009], b[1009], c[1009];

int main()
{
	int n, m;
	cin >> n >> m;
	memset(d, 0x3f, sizeof(d));
	rep(i, m) {
		scanf("%d%d%d", a+i, b+i, c+i);
		d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
	}
	Rep(k, n) Rep(i, n) Rep(j, n) d[i][j] = min(d[i][k] + d[k][j], d[i][j]);
	int ans = 0;
	rep(i, m) if(d[a[i]][b[i]] != c[i]) ++ans;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;

    int ans = 0;
    for(int i = 1; i <= N; i += 2) {
        int cnt = 0;
        for(int j = 1; j <= i; ++j)
            cnt += !(i % j);
        if(cnt == 8)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


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

#define ll long long int

vector <pair<ll,ll>> p;
int n,k;
ll x,y;
vector <ll> vx,vy;
int psum[51][51];
int check[51][51];
map <ll,int> compx,compy;

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

    ll res = 9223372036854775807;

    cin >> n >> k;

    for(int i=0;i<n;i++)
    {
        cin >> x >> y;
        p.push_back(make_pair(x,y));
        vx.push_back(x);
        vy.push_back(y);
    }

    sort(vx.begin(),vx.end());
    sort(vy.begin(),vy.end());

    for(int i=0;i<n;i++)
    {
        compx[vx[i]] = i+1;
        compy[vy[i]] = i+1;
    }

    for(int i=0;i<n;i++)
    {
        check[compx[p[i].first]][compy[p[i].second]] = 1;
    }

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            psum[i][j] = psum[i-1][j] + psum[i][j-1] - psum[i-1][j-1] + check[i][j];
        }
    }

    for(int i1=0;i1<n;i1++)
    {
        for(int i2=i1+1;i2<n;i2++)
        {
            for(int j1=0;j1<n;j1++)
            {
                for(int j2=j1+1;j2<n;j2++)
                {
                    int rx = compx[vx[i2]];
                    int lx = compx[vx[i1]];
                    int ry = compy[vy[j2]];
                    int ly = compy[vy[j1]];
                    int val = psum[rx][ry] - psum[lx-1][ry] - psum[rx][ly-1] + psum[lx-1][ly-1];
                    if(val==k)
                    {
                        res = min(res,(vx[i2]-vx[i1])*(vy[j2]-vy[j1]));
                    }
                }
            }
        }
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 1000
#define NIL -1

struct Node { 
int p, l, r; 
};
struct Node T[MAX];
int n;

void middle( int u );
void follower( int u );
void preceding(int u);

int main() 
{
	int i, x, l, r, ooo;
	
	scanf("%d", &n);
	for ( i = 0; i < n; i++ ) {
		T[i].p = NIL;
	}
	
	for( i = 0; i < n; i++ ) {
		scanf("%d %d %d", &x, &l, &r);
		T[x].r = r;
		T[x].l = l;
		if ( r != NIL) T[r].p = x;
		if ( l != NIL) T[l].p = x;
	}

	for ( i = 0; i < n; i++ ){
		if ( T[i].p == NIL ) ooo = i;
	}

	printf("Preorder\n");
	preceding(ooo);
	printf("\n");
	printf("Inorder\n");
	middle(ooo);
	printf("\n");
	printf("Postorder\n");
	follower(ooo);
	printf("\n");

	return 0;
}

/* 後行順巡回 */
void follower( int u ) {
	if ( u == NIL ) return;
	follower(T[u].l);
	follower(T[u].r);
	printf(" ");
	printf("%d", u);
}

/* 先行順巡回 */
void preceding(int u) {
	if ( u == NIL ) return;
	printf(" ");
	printf("%d", u);
	preceding(T[u].l);
	preceding(T[u].r);
}


/* 中間順巡回 */
void middle( int u ) {
 	if ( u == NIL ) return;
 	middle(T[u].l);
 	printf(" ");
 	printf("%d", u);
 	middle(T[u].r);
}





Measured memory_bytes: 2052
'''
（１）2つの数の和がKの倍数になる条件
aとbがともにKの倍数である
aとbの mod K の和がKの倍数である
（２）3つの数の内、どの2つを足してもKの倍数になる条件
3つの数全てがKの倍数である
3つの数全てのmod K がK/2である
（３）Kが奇数の時、
3つの数全てがKの倍数である
Kが偶数の時、
3つの数全てがKの倍数である
3つの数全てのmod K がK/2である
を満たす数を数え上げて、その数を3乗（重複を許した3つの数の順列）
'''
n,k=map(int,input().split())
s=n//k
t=0
if k%2==0:
  t=(n+k//2)//k
print(s*s*s+t*t*t)

Measured memory_bytes: 2940
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
 
d,n = Is()
if n == 100:
    n += 1
print(n*(100**d))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//~ const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};



int main(){
	ll x; cin>> x;
	ll a = (x/500) * 1000;
	ll b = (x%500)/5 * 5;
	cout<< a+ b;

    return 0;
}
	


Measured memory_bytes: 256
main = do
  getLine
  h <- map read.words<$>getLine :: IO [Int]
  print$ solve h 0 0

solve (a:b:h) acc ma
  | a >= b = solve (b:h) (acc+1) (max ma$acc+1)
  | otherwise = solve (b:h) 0 (max ma acc)
solve _ _ ma = ma


Measured memory_bytes: 38268
n, m, p = gets.chomp.split.map(&:to_i)
arr, arr2 = [0], [0]
m.times{
    diff = gets.to_i - p
    diff += n if diff < 0
    arr << diff
    arr2 << n - diff
}
arr.sort!
arr2.sort!.reverse!
min = nil
arr.zip(arr2){|a, b|
    x, y = [a, b].minmax
    cost = x * 2 + y
    min = cost if min.nil? || min > cost
}
puts min * 100




Measured memory_bytes: 7124
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<cstring>
#include<utility>
#include<vector>
#include<memory> 
using namespace std;

int main()
{
	int a,b;
	cin>>a>>b;
	if(a==1) a+=1000;
	if(b==1) b+=1000;
	if(a>b) cout<<"Alice"<<endl;
	else if(a<b) cout<<"Bob"<<endl;
	else cout<<"Draw"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = n - 1; i > 0; i--) cout << a[i] << " ";
  cout << a[0] << endl;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int cnt1=0,cnt2=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='0'){
			cnt1++;
		}
		else{
			cnt2++;
		}
	}
	if(cnt1==0||cnt2==0){
		cout<<"0";
		return 0;
	}
	else{
		cout<<min(cnt1,cnt2)*2;
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int N=100005; 

int il[N];

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

	for(i=0;i<N;i++) il[i]=0;

	int a;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a);
		il[a]++;
		il[a+1]++;
		il[a-1]++;
	}

	printf("%d\n",*max_element(il+1,il+N-1));
 }


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int N;
int A[105];
void Read()
{
    cin >> N;
    for(int i = 1; i <= N; i++)
        cin >> A[i];
}

void Solve()
{
    int ans = 0;
    for(int i = 2; i <= N; i++)
    {
        if(A[i] == A[i - 1])
        {
            ++ans;
            ++i;
        }
    }
    cout << ans << "\n";
}
int main()
{
    Read();
    Solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
int lcm(int a,int b)
{
	return a/__gcd(a,b)*b;
}
const int Mod=1e9+7;
int n;
string s[2];
LL F[55];
int main()
{
	cin>>n>>s[0]>>s[1];
	F[0]=3*(s[0][0]==s[1][0]);
	F[1]=(s[0][1]==s[1][1])*2*F[0];
	F[1]+=(s[0][0]==s[0][1] && s[1][0]==s[1][1])*6;
	rep(i,2,n)
	{
		if(s[0][i]==s[1][i])
		{
			if(s[0][i-1]==s[1][i-1])
				F[i]+=F[i-1]*(s[0][i]==s[1][i])*2;
			else 
				F[i]+=F[i-1]*(s[0][i]==s[1][i]);
		}
		if(s[0][i]==s[0][i-1] && s[1][i]==s[1][i-1])
		{
			if(s[0][i-2]!=s[1][i-2])
				F[i]+=F[i-2]*3;
			else
				F[i]+=F[i-2]*2;
		}
		F[i]%=Mod;
	}
	cout<<F[n-1]<<endl;
	return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n;
		String s = "";

		n = sc.nextInt();

		for (int i = 0; i < n; ++i) {
			s = sc.next();
			if (s.equals("Y"))
				break;
		}

		if (s.equals("Y"))
			System.out.println("Four");
		else
			System.out.println("Three");

		sc.close();
	}

}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

template<typename T> class RPQ : public PQ<T, vector<T>, greater<T>> { };

string s;
int k;
set<string> se;

int main() {
	cin >> s >> k;
	
	inc(i, s.size()) {
		inc1(j, 5) {
			if(i + j > s.size()) { continue; }
			se.insert(s.substr(i, j));
		}
	}
	
	int c = 0;
	FOR(it, se) {
		c++;
		if(c == k) { cout << (*it) << endl; }
	}
	
	return 0;
}


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


int main(){
  int h,w;cin>>h>>w;
  vector<vector<char>> v(h,vector<char>(w));
  rep(i,h){
    rep(j,w){cin>>v.at(i).at(j);}
  }
  string ans="Yes";
  bool a1,a2,a3,a4;
  rep(i,h){
    rep(j,w){
      a1=false;a2=false;a3=false;a4=false;
      if(v.at(i).at(j)=='#'){
        if(i>0){
          if(v.at(i-1).at(j)=='#'){
            a1=true;}
        }
        if(i<h-1){
          if(v.at(i+1).at(j)=='#'){
            a2=true;}
        }
        if(j>0){
          if(v.at(i).at(j-1)=='#'){
            a3=true;}
        }
        if(j<w-1){
          if(v.at(i).at(j+1)=='#'){
            a4=true;}
        }
        if(a1||a2||a3||a4){continue;}
        else{ans="No";break;}
      }    
    }
  }
  
  cout<<ans;
}

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

int main() {
  vector<int> vec = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
  int x, y;
  cin >> x >> y;
  if(vec[x] == vec[y]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3568
#ifdef loc
    #include "loc_debug.h"
#else
    #include <bits/stdc++.h>
    #define pr(...)
    #define pra(a,n)
    #define praa(a,n,m)
    #define prl()
#endif
using namespace std;

typedef long long ll;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define sz(a) int(a.size())
const int N = 16;
ll a[N][N];
ll f[1 << N], g[1 << N];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    rep(i, 0, n) {
        rep(j, 0, n) {
            cin >> a[i][j];
        }
    }
    rep(i, 1, int(1 << n)) {
        vector<int> b;
        rep(j, 0, n) {
            if((i >> j) & 1) {
                b.emplace_back(j);
            }
        }
        rep(j, 0, sz(b)) {
            rep(k, j + 1, sz(b)) {
                g[i] += a[b[j]][b[k]];
            }
        }
    }
    rep(i, 1, int(1 << n)) {
        vector<int> b;
        rep(j, 0, n) {
            if((i >> j) & 1) {
                b.emplace_back(j);
            }
        }
        rep(j, 1, int(1 << sz(b))) {
            int cur = 0;
            rep(k, 0, sz(b)) {
                if((j >> k) & 1) {
                    cur |= (1 << b[k]);
                }
            }
            f[i] = max(f[i], g[cur] + f[i ^ cur]);
        }
    }
    cout << f[(1 << n) - 1] << endl;
}

Measured memory_bytes: 1280
using System;

namespace tes
{
    class Program
    {
        static void Main(string[] args)
        {
            var line1 = Console.ReadLine().Split();
            int a = int.Parse(line1[0]);
            int b = int.Parse(line1[1]);

            int d = a / b;
            int r = a % b;
            double f = (double)a / (double)b;

            Console.WriteLine(d+" "+r+" "+"{0:0.00000}",f);
        }
    }
}

Measured memory_bytes: 9360
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=1e5+10,mod=1e9+7;
int n,f[maxn],g[maxn],sumf[maxn],sumg[maxn],Lf[maxn],Lg[maxn];
ll a[maxn],A,B;
int main(){
	n=read(),A=readll(),B=readll();
	REP(i,1,n) a[i]=readll();
	REP(i,1,n){
		Lf[i]=Lf[i-1];
		while(a[i]-a[Lf[i]+1]>=A) ++Lf[i];
	}
	REP(i,1,n){
		Lg[i]=Lg[i-1];
		while(a[i]-a[Lg[i]+1]>=B) ++Lg[i];
	}
	Lf[n+1]=Lg[n+1]=n-1;
	REP(i,1,n) chkmin(Lf[i],i-2),chkmin(Lg[i],i-2);
	int lstf=0,lstg=0;
	f[0]=g[0]=sumf[0]=sumg[0]=1;
	REP(i,1,n){
		if(i>1 && a[i]-a[i-1]<A) lstf=i-1;
		if(i>1 && a[i]-a[i-1]<B) lstg=i-1;
		if(lstf<=Lg[i+1]) f[i]=(sumg[Lg[i+1]]-(lstf==0?0:sumg[lstf-1])+mod)%mod;
		if(lstg<=Lf[i+1]) g[i]=(sumf[Lf[i+1]]-(lstg==0?0:sumf[lstg-1])+mod)%mod;
		sumf[i]=(sumf[i-1]+f[i])%mod,sumg[i]=(sumg[i-1]+g[i])%mod;
	}
	printf("%d\n",(f[n]+g[n])%mod);
	return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v;

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        switch (a) {
            case 0: {
                int b;
                cin >> b;
                v.push_back(b);
                break;
            }
            case 1: {
                int b;
                cin >> b;
                cout << v[b] << endl;
                break;
            }
            case 2: {
                v.pop_back();
                break;
            }
        }
    }

    return 0;
}


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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> D(K);
  for(int i=0;i<K;i++){
    cin >> D.at(i);
  }
  int i=N;
  while(true){
    bool ok = true;
    int x = i;
    while(x>0){
      for(int j=0;j<K;j++){
        if(D.at(j) == x%10){
          ok = false;
          break;
        }
      }
      x /= 10;
    }
    if(ok){
      break;
    }
    i ++;
  }
  cout << i << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int i,n,x;
    scanf("%d",&n);
    
    for(i=1; i<=n; i++){
        x=i;
        if(x%3==0){
            printf(" %d",i);
        }else if(x%10==3){
            printf(" %d",i);
        }else{
            while(1){
                x/=10;
                if(x==0)break;
                if(x%10==3){
                    printf(" %d",i);
                    break;
                }
            }
        }
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 2108
X,N=map(int, input().split())
P=list(map(int, input().split()))
if N==0:
    print(X)
    exit()
if X not in P:
    print(X)
    exit()
add=1
while True:
    if X-add not in P:
        print(X-add)
        break
    if X+add not in P:
        print(X+add)
        break
    add+=1

Measured memory_bytes: 9188
using System;
class p
{
  static void Main()
  {
    string[] ipt = Console.ReadLine().Split(' ');
    int A = int.Parse(ipt[0]);
    int B = int.Parse(ipt[1]);
    int C = int.Parse(ipt[2]);
    if ((A == B && A != C) || (A == C && A != B) || (B == C && B != A)) {
      Console.WriteLine("Yes");
    } else {
      Console.WriteLine("No");
    }
  }
}

Measured memory_bytes: 13140
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}

int n,m;
vector<vector<int>> to;

signed main(){
	string s;
	cin>>s;
	cout<<s[0]<<s.size()-2<<s.back()<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}

int main(){
  while(1){
    int n,a,b,c,x;
    cin>>n>>a>>b>>c>>x;
    if(n==0&&a==0&&b==0&&c==0&&x==0) break;
    int ans=0;
    int j,i;
    for(i=0;i<n;i++){
      int rand;
      cin>>rand;
      for(j=0;j<10001;j++){
	if(x==rand){
	  rand=-1;
	  break;
	}
	x=(a*x+b)%c;
	ans++;
	if(ans>10000){
	  ans=-1;
	  break;
	}
      }
      if(ans==-1){
	ans=-1; break;
      }
      if(rand!=-1){
	ans=-1; break;
      }
      x=(a*x+b)%c;
      ans++;
    }
    if(i==n-1) 1;
    else lp(k,n-1-i){
	int rand;
	cin>>rand;
      }
    if(ans==-1) cout<<"-1"<<endl;
    else cout<<ans-1<<endl;
  }
  return 0;
}



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

class Merge {
public:
	Merge() : count(0){}

	void mergeSort(int A[], int left, int right) {
		if (left + 1 >= right) {
			return;
		}
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}

	int getCount() {
		return count;
	}

private:
	void merge(int A[], int left, int mid, int right) {
		int numL = mid - left;
		int numR = right - mid;

		//?????§A??????????????´??°???????????§??\?????????????????????????????????
		int L[250002];
		int R[250002];
		for (int i = 0; i < numL; i++) {
			L[i] = A[left + i];
		}
		for (int i = 0; i < numR; i++) {
			R[i] = A[mid + i];
		}
		//??????????????¨????????\???????????????
		L[numL] = 2000000000; 
		R[numR] = 2000000000;
		int iL = 0;
		int iR = 0;
		for (int j = left; j < right; j++) {
			if (L[iL] <= R[iR]) {
				A[j] = L[iL];
				iL++;
			}
			else {
				A[j] = R[iR];
				iR++;
			}
			count++;
		}
	}

	int count;
};

int main() {
	int A[500000];
	int numA;
	Merge mer;
	cin >> numA;
	for (int i = 0; i < numA; i++) {
		cin >> A[i];
	}

	mer.mergeSort(A, 0, numA);

	for (int i = 0; i < numA; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << mer.getCount() << endl;
	return 0;
}

Measured memory_bytes: 6952
import sys
def input(): return sys.stdin.readline().rstrip()
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

import math
def is_prime(n):
    if n==1:return False
    for k in range(2,int(math.sqrt(n))+1):
        if n%k==0:
            return False
    return True
    
def main():
    a,b=map(int,input().split())
    a_s,b_s=set(make_divisors(a)),set(make_divisors(b))
    c_s=a_s&b_s
    ans=[]
    c=list(c_s)
    c.sort()
    ans=1
    for cc in c:
        if is_prime(cc):
            ans+=1
    print(ans)


if __name__=='__main__':
    main()

Measured memory_bytes: 42988
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
typedef struct node
{
    int s, t, x;
    node(int a, int b, int c)
    {
        s = a;
        t= b;
        x = c;
    }
} Node;
bool compare(const Node &l, const Node &r)
{
    return l.x < r.x;
}
int main()
{
    she_told_me_dont_worry
    int n, q;
    vector<Node> blocks;
    int i;
    cin>>n>>q;
    set < ii > ppl;
    FOR0(i, n)
    {
        int s, t, x;
        cin>>s>>t>>x;
        blocks.pb(Node(s, t, x));
    }
    FOR0(i, q)
    {
        int d;
        cin>>d;
        ppl.insert(mp(d, i));
    }
    int ans[q+5];
    memset(ans, -1, sizeof ans);
    sort(blocks.begin(), blocks.end(), compare);
    FOR0(i, n)
    {
        int x = blocks[i].x , s = blocks[i].s, t = blocks[i].t;
        set < ii >::iterator it = ppl.lower_bound(ii(s - x, 0)), it2;
        int bound = t - x - 1;
        int dif = MAX2(0, x - t + s + 1);
        while( it!=ppl.end() && it->ff <= (bound))
        {
            it2 = it;
            it2++;
            ans[it->ss] = x;
            ppl.erase(it);
            it = it2;
        }
    }
    FOR0(i, q)
    {
        cout<<ans[i]<<endl;
    }
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 14448
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	printf("%d\n",(a+b)%24);
	
    return 0;
}


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

using namespace std;

int a,b,c,n,m,ans;

int main(){
	scanf("%d%d%d%d%d",&a,&b,&c,&n,&m);
	if (a+b>=c*2){
		int mn=min(n,m);
		ans+=c*2*mn;
		n-=mn; m-=mn;
	}
	int mx=max(n,m);
	ans+=min(c*2*mx,a*n+b*m);
	printf("%d\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 256
#include <stdio.h>
typedef long long int lld;

int sum(int n) {
  int r = 0;
  while (--n > 0) {
    r += n;
  }
  return r;
}

int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  printf("%d\n", sum(n) + sum(m));
}


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

class UnionFindTree{
private:
  vector<int> parent;
  vector<int> rank;
  vector<int> diff;
  
  int getRoot(int i){
    if(parent[i] == i)return i;

    int r = getRoot(parent[i]);
    diff[i] += diff[parent[i]];
    return parent[i] = r;
  }

  int weight(int x){
    getRoot(x);
    return diff[x];
  }

public:
  UnionFindTree(int n) : parent(n) , rank(n) , diff(n){
    for(int i=0; i<n; i++){ parent[i] = i; rank[i] = diff[i] = 0; }
  }

  void unite(int x, int y, int z){

    z += weight(x); z-= weight(y);
    
    x = getRoot(x);
    y = getRoot(y);
    
    if(x == y)return;
    if(rank[x] < rank[y]) swap(x,y) , z = -z;
    if(rank[x] == rank[y])rank[x]++;
    parent[y] = x;
    diff[y] = z;
  }

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

  int getDiff(int x, int y){
    return weight(y) - weight(x);
  }

};
  
int main(){

  int n,q;
  cin >> n >> q;
  UnionFindTree uft(n);

  for(int i=0; i<q; i++){
    int com, x, y, z;
    cin >> com >> x >> y;
    if(com == 0){
      cin >> z;
      uft.unite(x,y, z);
    }
    else{
      if( uft.same(x,y) ) cout << uft.getDiff(x,y) << endl;
      else cout << "?" << endl; 

    }
  }
    

  return 0;
}



Measured memory_bytes: 3864
N = int(input())
C = [[0]*10 for _ in range(10)]
for i in range(1,N+1):
    C[int(str(i)[0])][int(str(i)[-1])] += 1
answer = 0
for i in range(10):
    for j in range(10):
        answer += C[i][j] * C[j][i]
print(answer)

Measured memory_bytes: 40428
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pairs;

#define MOD 998244353


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

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}



 
int main(){
    ll a,b;
    cin>>a>>b;
    for(ll i = 0; i<10000; i++){
        ll za = i*8/100;
        ll zb = i*10/100;
        if(a == za && b == zb){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}
 
    
    



Measured memory_bytes: 256