akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    int n;
    string s;
    cin >> n >> s;
    for(int i=0;i<s.size();i++){
        if(int(s.at(i))+n>90){
            s.at(i)=char(int(s.at(i))+n-26);
        }else{
            s.at(i)=char(int(s.at(i))+n);
        }
    }

    for(int i=0;i<s.size();i++) cout << s.at(i);
    cout << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int a, b;
  cin >> a >> b;
  if ((a*b) % 2 == 1) cout << "Odd" << endl;
  else cout << "Even" << endl;
  return 0;
}

Measured memory_bytes: 3640
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    using Plll = pair<ll, Pll>;
    map<Plll, ll> hash;
    const ll MS = 2;
    const ll mod[] = {999999937LL, 1000000007LL}, base = 9937;
    vector<string> v(n);
    rep(i,0,n){
        cin >> v[i];
    }
    sort(all(v), [](const auto &a, const auto &b){
        return a.size() < b.size();
    });
    ll ans = 0;
    rep(i,0,n){
        ll m = v[i].size();
        reverse(all(v[i]));
        vector<ll> cnt(26);
        rep(j,0,m){
            ll t = v[i][j] - 'a';
            cnt[t]++;
        }
        vector<ll> hs = {0,0};
        rep(j,0,m-1){
            rep(k, 0, 26){
                if(cnt[k] <= 0)continue;
                Plll p = {k, {hs[0], hs[1]}};
                if(hash.count(p)){
                    ans += hash[p];
                }
            }
            rep(k, 0, MS){
                hs[k] = (hs[k] * base + v[i][j]) % mod[k];
            }
            ll t = v[i][j] - 'a';
            cnt[t]--;
        }
        debug(v[i], cnt);
        rep(k, 0, 26){
            if(cnt[k] <= 0) continue;
            Plll p = {k, {hs[0], hs[1]}};
            if(hash.count(p)){
                ans += hash[p];
            }
        }

        ll t = v[i][m-1] - 'a';
        hash[{t, {hs[0], hs[1]}}]++;
    }

    cout << ans << "\n";
}

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

using namespace std;

const int MOD=pow(10,9)+7;

int main(){
    int N; cin >> N;
    vector<int> data(26);
    char in_chr;
    for(int i=0;i<N;i++){
        cin >> in_chr;
        data.at(in_chr - 'a')++;
    }

    long ans = 1;
    for(int i=0;i<26;i++){
        ans *= data.at(i)+1;
        ans %= MOD;
    }

    cout << ans-1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,y=1;
    //cin>>t;
    t=1;
    while(t>0)
    {
        t--;
        ll n,i,j,k,flag=1,x=0;
        cin>>n;
        ll a=0,b=0,c=0;
        ll dp[(ll)1e5+1][3];
        for(i=1;i<=n;i++)
        {
        	cin>>a>>b>>c;
        	dp[i][1]=max(dp[i-1][2]+a,dp[i-1][3]+a);
        	dp[i][2]=max(dp[i-1][1]+b,dp[i-1][3]+b);
        	dp[i][3]=max(dp[i-1][2]+c,dp[i-1][1]+c);
        }
        x=max(dp[n][1],dp[n][2]);
        x=max(x,dp[n][3]);
        cout<<x;
    }    
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  ll a = 2, b = 1, c = a + b;
  REP(i, n) {
    a = b;
    b = c;
    c = a + b;
  }
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  ll a,b,x;
  cin>>a>>b>>x;
  if(x==1){
    cout<<(b-a+1)<<endl;
    return 0;
  }
  ll ans=b/x;
  if(a)
    ans-=(a-1)/x;
 else 
    ans++;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
  var input = input.split(" ");
  // 距離(m)
  var d = parseInt(input[0], 10);
  // 時間(m)
  var t = parseInt(input[1], 10);
  // 速度(m/m)
  var s = parseInt(input[2], 10);
  
  var validate = (val) => {
      return 1 <= val && val <= 10000;
  };
  
  if (!validate(d) || !validate(t) || !validate(s)) {
    console.log("No");
    return;
  }
  
  // 速さ * 時間 = 距離
  var result = s * t >= d;

  console.log(result ? "Yes" : "No");
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int BubbleSort(int n, int a[]) {
    bool f = true;
    int ans = 0;
    while (f) {
        f = false;
        for (int i = n - 1; i > 0; i--) {
            if (a[i] < a[i - 1]) {
                swap(a[i], a[i - 1]);
                f = true;
                ans++;
            }
        }
    }

    return ans;
}

int main() {
    int n, a[110];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];

    int ans = BubbleSort(n, a);

    for (int i = 0; i < n; i++) {
        if (i == n - 1) cout << a[i];
        else cout << a[i] << " ";
    }
    cout << endl;

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


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, a, n) for(int i=a; i<n; i++)
#define ll long long
#define all(x) begin(x), end(x)
#define toInt(x) (x - '0')
#define pll pair<ll, ll>
#define pli pair<ll, int>
// #define int long long
const int inf = 1 << 30;
#define INF 1e+9
#define MAX_V 100008


signed main(){
  int n; cin >> n;
  string s; cin >> s;
  int num_w = 0;
  int num_r = 0;
  int ans = 0;
  int j=n-1;
  for (int i=0; i<j; i++){
    if(s[i] == 'W'){
      while(j >= 0 && i < j){
        if(s[j] == 'R'){
          ans++;
          swap(s[i], s[j]);
          j--;
          // cout << i << " " << j << endl;
          // cout << s << endl;
          break;
        }
        j--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int r,d,x;
    vector<int> a(10);
    cin>>r>>d>>x;
    a.at(0) = r * x - d;
    for(int i=1;i<10;i++){
        a.at(i) = r * a.at(i-1) - d;
    }
    for(int i=0;i<10;i++){
        cout<<a.at(i)<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio> 
#include<algorithm>
#define ll long long 
using namespace std;
const int maxn=500010,inf=1e9;
int n;
int a[4][maxn];
ll ans, num[maxn];
void read(int &k)
{
	int f=1;k=0;char c=getchar();
	while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while(c<='9'&&c>='0')k=k*10+c-'0',c=getchar();
	k*=f;
}
int main()
{
	read(n);
	for(int i=1;i<=3;i++)
		for(int j=1;j<=n;j++) read(a[i][j]);
	for(int i=1;i<=3;i++) sort(a[i]+1, a[i]+1+n);
	for(int i=1, j=1;i<=n;i++)
	{
		while(a[2][i]>=a[3][j] && j<=n) j++;
		num[i]=n-j+1;
	}
	for(int i=n;i;i--) num[i]+=num[i+1];
	for(int i=1, j=1;i<=n;i++)
	{
		while(a[1][i]>=a[2][j] && j<=n) j++;
		ans+=num[j];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 9344
#include<stdio.h>
#define M 1000000007
#define N_MAX 200000
long long fact[N_MAX+1];

void compute(int N, int H){
  int word[N_MAX], invalid[N_MAX];
  int deleted[100], inserted[100];
  int d_p = 0, i_p = 0;
  int i, j, s, t;
  long long ans = 0, unable;
  for ( i = 0; i < N; i++ ) {
    invalid[i] = 0;
    word[i] = i;
  }

  for ( int i = 0; i < H; i++ ){
    scanf("%d %d", &s, &t);
    s--; t--; // to 0 origin
    int tmp = word[s];
    word[s] = word[t];
    word[t] = tmp;
  }

  for ( i = 0; i < N; i++ ) if ( word[i] != i ) invalid[i] = 1;

  for ( i = 0; i < N; i++ ){
    unable = (word[i] < i) ? word[i] : i;
    for ( j = 0; j < d_p; j++ )
      if ( deleted[j] < word[i] ) unable--;
    for ( j = 0; j < i_p; j++ )
      if ( inserted[j] < word[i] ) unable++;

    ans += ((word[i] - unable) * fact[N-i-1])%M;
    ans %= M;

    if ( invalid[i] ){
      deleted[d_p++] = i;
      inserted[i_p++] = word[i];
    }
  }

  printf("%lld\n", ans);
}

int main(){
  int i;
  fact[0] = 1;
  for (i = 1; i <= N_MAX; i++ ) fact[i] = (fact[i-1]*i)%M;

  int N, H;
  while(1){
    scanf("%d", &N);
    if ( N == 0 ) break;
    scanf("%d", &H);
    compute(N, H);
  }

  return 0;
}




Measured memory_bytes: 4040
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

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

int main()
{
        int N;
        cin >> N;
        vector<int> t(N + 1), x(N + 1), y(N + 1);
        t[0] = x[0] = y[0] = 0;
        rep(i, N) cin >> t[i + 1] >> x[i + 1] >> y[i + 1];

        bool ok = true;
        rep(i, N)
        {
                int dt = t[i + 1] - t[i];
                int dx = x[i + 1] - x[i];
                int dy = y[i + 1] - y[i];
                if (abs(dx) + abs(dy) > dt)
                {
                        ok = false;
                        break;
                }

                if ((abs(dx) + abs(dy)) % 2 != dt % 2)
                {
                        ok = false;
                        break;
                }
        }
        if (ok)
                cout << "Yes" << endl;

        else
                cout << "No" << endl;

        return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  sort(all(l));

  int ans = 0;
  REP(i, 0, n) REP(j, i + 1, n) REP(k, j + 1, n) {
    if (l[i] == l[j] || l[j] == l[k]) continue;
    if (l[i] + l[j] > l[k]) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using namespace std;

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
    cout << fixed << std::setprecision(10) << endl;
    long long n,k;
    double p_kitai[200001],kitai_sum[200001],ans_kouho[200001],ans;
    cin >> n >> k;
    for(long long i=1;i<=n;i++){
        double p;
        cin >> p;
        p_kitai[i] = (p+1)/2;
    }
    // 累積和
    kitai_sum[1]=0;
    for(long long i=2;i<=n+1;i++){
        kitai_sum[i] = kitai_sum[i-1]+p_kitai[i-1];
    }
    
    // 解
    for(long long i=1;i<=n-k+1;i++){
        ans_kouho[i] = kitai_sum[i+k] - kitai_sum[i];
        if(ans < ans_kouho[i]){
            ans = ans_kouho[i];
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3456
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int N = sc.nextInt();
		int x = sc.nextInt();
		
		if(x==1 || x==2*N-1) {
			pw.println("No");
		} else {
			pw.println("Yes");
			for(int i=0; i<2*N-1; i++)
				pw.println((i+x-N+2*N-1)%(2*N-1)+1);
		}
		sc.close();
		pw.close();
	}
}


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

int main() {
	ll a,b;
	cin>>a>>b;
	if(a>=10||b>=10){
		cout << -1;
	}
	else{
		cout << a*b;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3604
n = int(input())
prime_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
d = []
e = [0,0,0,0,0]
f = [74,24,14,4,2]
for i in prime_list:
  a = n
  b = 0
  c = 1
  while a // (i**c) > 0:
    b += a // (i**c)
    c += 1
  else:
    d.append(b)
count = 0
len_d = len(d)-1
for k in f:
  for i,j in enumerate(d):
    if j < k:
      e[count] = i
      count += 1
      break
    elif i == len_d:
      e[count] = i+1
      count += 1
      break



print(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,d,sum=0,k;
cin>>n;
d=n;
while(d!=0)
{k=d%10;
d=d/10;
sum+=k;

}
if(n%sum==0){cout<<"Yes"<<endl;}
else{cout<<"No"<<endl;}
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Cmax = 30, Nmax = 500;
int N, C, D[Cmax][Cmax], X[Nmax][Nmax];
int d[Cmax][3];

int main(){
	cin >> N >> C;
	for(int i=0; i<C; i++){
		for(int j=0; j<C; j++) cin >> D[i][j];
	}
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			cin >> X[i][j];
			X[i][j]--;
		}
	}

	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			for(int k=0; k<C; k++){
				d[k][(i+j)%3] += D[X[i][j]][k];
			}
		}
	}

	ll ans = 1e16;
	for(int i=0; i<C; i++){
		for(int j=0; j<C; j++){
			if(i==j) continue;
			for(int k=0; k<C; k++){
				if(i==k||j==k) continue;
				ans = min(ans, (ll)d[i][0]+d[j][1]+d[k][2]);
			}
		}
	}

	cout << ans << endl;

	return 0;
}


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

double a[10];
double b[10];
int main(){
	double t;
	cin>>t;
	for(int i=1;i<=t;i++){
		cin>>a[i]>>b[i];
	}
	double sum=0;
	for(int i=1;i<=t;i++){
		for(int j=1;j<=t;j++){
			sum=sum+sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));	
		} 
	}
	printf("%.6lf\n",sum/t);
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  string N;
  cin >> N;
  if((N.at(0) == N.at(1) && N.at(1) == N.at(2)) || (N.at(1) == N.at(2) && N.at(2) == N.at(3)))cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map(String::toInt)
    val h = readLine()!!.split(" ").map(String::toInt)
    var num = 0
    for(i in 0 until n) {
        if(h[i] >= k) {
            num ++
        }
    }
    print(num)
}

Measured memory_bytes: 48348
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
 
import java.util.*;
import java.lang.*;
import java.io.*;

@SuppressWarnings("unchecked")
public class Main implements Runnable {

  static BufferedReader in;
  static PrintWriter out;
 
  public static void main(String[] args) {
      new Thread(null, new Main(), "whatever", 1<<29).start();
  }
 
  public void run() {
    in = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out, false);
 
    try
    {
      // in = new BufferedReader(new FileReader("class_treasurer.txt"));
      // out = new PrintWriter("output.txt");

      int t,x1,n,i,j;
      String str;
      String[] token;

      str=in.readLine().trim();
      token=str.split(" ");
      n=Integer.parseInt(token[0]);

      str=in.readLine().trim();
      token=str.split(" ");

      Double[] a=new Double[n];

      for(i=0;i<n;i++) {
        a[i]=Double.parseDouble(token[i]);
      }

      Arrays.sort(a);

      long sum=0L;

      for(i=0;i<n;i++) {
        for(j=i+1;j<n;j++) {
          int pos=Arrays.binarySearch(a,a[i]+a[j]-0.5);
          pos=-1*pos-1;
          sum+=(pos-j)-1;
        }
      }

      out.println(sum);

      out.flush();
      out.close();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
}


Measured memory_bytes: 30912
#include <stdio.h>
/********
*	????????????????????°
*********/

/*********??¢?????´?????????
*	(1)
*	(2)
*********/

int main(void)
{
	int n, x ;			//
	int karigoukei ;//???????¨????
	int i, j, k, h ;//


	
	while(1){				//??°?????\???
		h = 0;
		scanf("%d %d\n", &n, &x);
		if(n == 0 && x == 0 ){
			break;
		} else {
			
			for(i = 1 ; i < n; i++ ){
				for(j= (i+1) ; j < n ; j++ ){
					for(k = (j+1) ; k <= n ; k++ ){
						
						karigoukei = i + j + k;
						if(i < j && i < k){
								if(x == karigoukei){
									h++;
								} else {
								//????¨???????x??¨??????????????¨????????????
								}
							//??????????????¨?????????????????????????????????
						}else {
							//??????????????¨?????????????????????????????????	
						}
						
					}
				}
			}
		}
		printf("%d\n", h);
	}
    return 0;
	
}

Measured memory_bytes: 1032
#include <iostream>
int main(){
  int n;
  while(std::cin >> n, n){
    int t = 0;
    while(n != 1){
      if(n % 2)n = n * 3 + 1;
      else n /= 2;
      t++;
    }
    std::cout << t << std::endl;
  }
}

Measured memory_bytes: 0
/*
Hey there stalker....

█▀▀▄░░░░░░░░░░░▄▀▀█
░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
░░▀▄░░░▀░░░░░▀░░░▄▀
░░░░▌░▄▄░░░▄▄░▐▀▀
░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
░░░█░░░░░░░░░░░▄▀▄░▀▄
░░░█░░░░░░░░░▄▀█░░█░░█
░░░█░░░░░░░░░░░█▄█░░▄▀
░░░█░░░░░░░░░░░████▀
░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀

Like what you see?
*/
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pii         pair<ll ,ll>
#define vi          vector<ll>
#define present(container, element) (container.find(element) != container.end()) /* For set n maps */
#define cpresent(container, element) (find(all(container),element) != container.end()) /* For vectors */
#define all(a)      (a).begin(),(a).end()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.I(tmp);commands}
#define F           first
#define S           second
#define I           insert
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define trav(a, x) 	for(auto& a : x)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lcase(a) (char)tolower(a)
#define ll long long int
#define lld long double
#define endl "\n"
#define PI 3.14159265358979323844
#define MOD 1000000007
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
const int N = 1e5 + 5;
/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

int32_t main()
{
   IOS

    int TESTS=1;
   // cin >> TESTS;
    while (TESTS--)
    {
        ll n,k;
        cin>> n >> k;
        ll mini=INT_MAX;
        ll modi=n%k;
      //  what_is(modi);
        if(modi>=k/2 && modi!=0)
        {
          modi=abs(modi-k);
        //    what_is(modi);
        }

        cout<< modi << endl;

    }
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int INF = 1e9+7;
const int mod= 1e9 + 7;

int A[501][501];

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

	int H, W; cin >> H >> W;

	FOR(i, 0, H) FOR(j,0,W){
		cin >> A[i][j];
	}

	vector<pair<pair<int,int>,pair<int, int>>> P;

	FOR(i, 0, H)FOR(j, 0, W) {
		if (A[i][j] % 2==1) {
			if (i == H - 1 && j<W-1) {
				pair<int,int> e1(i, j);
				pair<int, int> e2(i, j+1);
				P.emplace_back(e1,e2);
				A[i][j]--; A[i][j+1]++;
			}
			else if (j == W - 1 && i < H - 1) {
				pair<int, int> e1(i, j);
				pair<int, int> e2(i+1, j);
				P.emplace_back(e1, e2);
				A[i][j]--; A[i+1][j]++;
			}
			else if (i != H - 1 && j != W - 1) {
				if (A[i + 1][j] <= A[i][j + 1]) {
					
					pair<int, int> e1(i, j);
					pair<int, int> e2(i+1,j);
					P.emplace_back(e1, e2);
					A[i][j]--; A[i+1][j]++;
				}
				else {
					pair<int, int> e1(i, j);
					pair<int, int> e2(i, j+1);
					P.emplace_back(e1, e2);
					A[i][j]--; A[i][j+1]++;
				}
			}
		}
	}

	cout << int(P.size()) << endl;
	
	for (auto p : P) {
		auto a1 = p.first;
		auto a2 = p.second;
		cout << a1.first+1 << " " << a1.second+1 << " " << a2.first+1 << " " << a2.second+1 << endl;
	}
	

	return 0;
}


Measured memory_bytes: 7408
#include <bits/stdc++.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;

signed main() {
  int N, aoki,taka;
  cin >> N >> taka >> aoki;
  
  Graph G(N);
  int A, B;
  for( int i = 0; i < N; i++ ){
    cin >> A >> B;
    G.at(A-1).push_back(B-1);
    G.at(B-1).push_back(A-1);
  }
  
  //青木君を根としてBFS
  vector<int> Adist(N, -1);
  queue<int> que;
  
  Adist.at(aoki-1) = 0;
  que.push(aoki-1);
  
  while( !que.empty() ){
    int v = que.front();
    que.pop();
    
    for( int nv : G.at(v) ){
      if( Adist.at(nv) != -1 ) continue;
      Adist.at(nv) = Adist.at(v)+1;
      que.push(nv);
    }
  }
  
  //高橋君から見てBFS
  vector<int> Tdist(N, -1);
  Tdist.at(taka-1) = 0;
  que.push(taka-1);
  
  while( !que.empty() ){
    int v = que.front();
    que.pop();
    
    for( int nv : G.at(v) ){
      if( Tdist.at(nv) != -1 ) continue;
      //青木君のほうが早く到達する頂点は無視
      if( Adist.at(nv) <= Tdist.at(v)+1 ) continue;
      
      Tdist.at(nv) = Tdist.at(v) + 1;
      que.push(nv);
    }
  }
  
  int ans = 0;
  for( int i = 0; i < N; i++ ){
    if( Tdist.at(i) != -1 && Adist.at(i) > ans ) ans = Adist.at(i) - 1;
  }
  cout << ans << endl;
    
}
  

Measured memory_bytes: 8064
/// awoooooo
 
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
 
const int N = (int)2e6 + 5;
const int inf = (int)1e9 + 7;
 
int n, k;
int ans;
string s;
 
int main(){
  cin >> n >> k >> s;
  for(int i = 0; i + 1 < n; ++i){
    if(s[i] == s[i + 1]){
      ++ans;
    }
  }
  ans += k * 2;
  ans = min(ans, n - 1);
  cout << ans;
  return 0;
}

Measured memory_bytes: 512
isGoo :: String -> Bool
isGoo s
    | length s `mod` 2 /= 0 = False
    | otherwise = let half = length s `div` 2
                      (a, b) = splitAt half s
                  in  a == b

lengthGooR :: String -> Int
lengthGooR [] = 0
lengthGooR (s:ss)
    | isGoo ss = length ss
    | otherwise = lengthGooR ss

main = getLine >>= print . lengthGooR . reverse

Measured memory_bytes: 892
#include <stdio.h>

int main (void) {

   int n,i;
   long long int power = 1;
   scanf("%d", &n);
   
   for(i=1;i <= n;i++) {
   power = (power*i)%1000000007;
   }
   
      printf("%d\n",power);
      
      }

Measured memory_bytes: 128
using System;

namespace AtCoder.ABC115
{
    public class A
    {
        public static void Solve()
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);

            string output;
            switch (a)
            {
                case 25:
                    output = "Christmas";
                    break;
                case 24:
                    output = "Christmas Eve";
                    break;
                case 23:
                    output = "Christmas Eve Eve";    
                    break;
                case 22:
                    output = "Christmas Eve Eve Eve";
                    break;
                default:
                    output = "";
                    break;
            }
            
            Console.WriteLine(output);
        }    
    }
}

namespace AtCoder {
    class Program
    {
        static void Main(string[] args)
        {
            ABC115.A.Solve();
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 100000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back


int a,b,q;
vector<ll> s,t;


ll f(ll x){
  int ax=lower_bound(all(s),x)-s.begin();
  int bx=upper_bound(all(t),x)-t.begin();


  ll res = LLONG_MAX;



  if(ax<a&&bx<b)
    res = min(res,max(s[ax],t[bx])-x);
 
  if(ax>0&&bx<b)
    res = min(res,t[bx]-s[ax-1]+min(t[bx]-x,x-s[ax-1]));
  
  if(bx>0&&ax<a)
    res = min(res,s[ax]-t[bx-1]+min(s[ax]-x,x-t[bx-1]));
  
  if(ax>0&&bx>0)
    res = min(res,x-min(s[ax-1],t[bx-1]));

  return res;
}


int main(){
  cin>>a>>b>>q;
  rep(i,a){
    ll c;
    cin>>c;
    s.PB(c);
  }
  rep(i,b){
    ll c;
    cin>>c;
    t.PB(c);
  }

  rep(i,q){
    ll x;
    cin>>x;
    cout<<f(x)<<endl;
  }

}


Measured memory_bytes: 3060
import java.io.*;
import java.lang.*;
import java.util.*;

public class Main
{
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        int k = sc.nextInt();
        int count = 0;
        while (b <= a) {
            b = b * 2;
            count++;
        }
        while (c <=b) {
            c = c * 2;
            count++;
        }
        if (!(count > k)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }   
    }
}


Measured memory_bytes: 35828
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
using namespace std;
int  gcd(int a, int b) {
	if (a < b) gcd(b, a);
	int r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, h, w;
	cin >> n >> h >> w;
	cout << (n - h + 1)*(n - w + 1);
}

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

using namespace std;

long add(vector<int>& a, int s, int e)
{
    long ad = 0L;
    for (int i = s; i <= e; ++i) {
        ad *= 10;
        ad += (long)a[i];
    }
    return ad;
}
int main()
{
    string s; cin >> s;
    int size = s.size();
    long ans = 0L;
    vector<int> v(size);
    for (int i = 0; i < size; ++i) v[i] = s[i] - '0';

    for (int bit = 0; bit < (1 << size-1); ++bit) {
        vector<int> a;
        for (int i = 0; i < size-1; ++i) {
            if (bit & (1 << i))
                a.push_back(i);
        }

        if (a.empty()) ans += add(v, 0, v.size()-1);
        else {
            int prev = 0;
            for (auto x : a) {
                ans += add(v, prev, x);
                prev = x+1;
            }
            ans += add(v, prev, v.size()-1);
        }
    }

    cout << ans << endl;

    return 0;
}


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

namespace AtcoderTemplateForCSharp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var a = Console.ReadLine()
                .Split()
                .Select(int.Parse);

            a = a.OrderByDescending(x => x);

            var alice = 0;
            var bob = 0;

            for (int i = 0; i < a.Count(); i++)
            {
                if (i % 2 == 0)
                {
                    alice += a.ElementAt(i);
                }
                else
                {
                    bob += a.ElementAt(i);
                }
            }

            var ans = alice - bob;

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	long long H, W;
	cin >> H >> W;
	if (H == 1 || W == 1) {
		cout << 1 << endl;
	}
	else if (H * W % 2 == 0) {
		cout << H * W / 2 << endl;
	}
	else {
		cout << (H * W + 1) / 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int main() {
  int a,b;
  S2(a,b);
  P(a*b-a-b+1);
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>

const int MOD=1e9+7.5;

char a[1010][1010];
int f[1010][1010];

int main(){
	memset(a,'#',sizeof a);
	
	int H,W;
	scanf("%d%d\n",&H,&W);
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++) scanf(" %c",&a[i][j]);
	
	f[1][1]=1;
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
			if(a[i][j]-'#') f[i][j]+=(f[i-1][j]+f[i][j-1])%MOD;
	
	return printf("%d\n",f[H][W])&0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
	if (b==0) return a;
	return gcd(b,a%b);
}
int main(){
	ll a,b;cin>>a>>b;
	cout<<a*b/gcd(a,b);
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
c = 0
s = 0
for i in range(n):
	s += abs(a[i])

for i in range(n):
	if a[i] == 0:
		print(s)
		quit()
	elif a[i] < 0:
		c += 1
	else:
		pass

if c%2 == 0:
	pass
else:
	a.sort(key = lambda x: abs(x))
	s = s - 2*abs(a[0])
print(s)



Measured memory_bytes: 14412
#include <stdio.h>

int main(void) {
    int a[2];
    while (1)
    {
        scanf("%d %d", &a[0], &a[1]);
        if (a[0]==0 && a[1]==0) {
            break;
        }
        if (a[0]>a[1]) {
          int t = a[0];
          a[0] = a[1];
          a[1] = t;
        } 
        printf("%d %d\n", a[0], a[1]);
    }
    return 0;
}


Measured memory_bytes: 2708
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
int n,m;
  cin>>n>>m;
  vector<int>broken(n+1);
  rep(i,m){
  	int a; cin>>a;
    broken[a]=1;
  }
 vector<int>dp(n+2);
 const int mod=1000000007;
  dp[n]=1;
 for(int i=n-1;i>=0;i--){
 	if(broken[i]){
    	dp[i]=0;
      	continue;
    }
   dp[i]=(dp[i+1]+dp[i+2])%mod;
 }
  cout<<dp[0]<<endl;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



string s;
void solve(){
	cin >> s;
	int n = s.size();
	
	if(n % 2){
		if(s[0] == s[n-1]){
			cout << "Second" << endl;
		}
		else{
			cout << "First" << endl;
		}
	}
	else{
		if(s[0] == s[n-1]){
			cout << "First" << endl;
		}
		else{
			cout << "Second" << endl;
		}
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <cstring>
#include <queue>
#include <climits>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll INF = 1e17;

struct edge {
	int u, v; ll w;
	edge() {}
	edge(int _u, int _v, ll _w) :
		u(_u), v(_v), w(_w) {}
};

struct node { vector<edge> edges; };

ll dp[(int)1e5 + 2][2];

//Everything is 0-indexed
struct tree {
	vector<node> nodes;
	int root, n;

	tree(int _n, int _r = 0) : n(_n), root(_r) { nodes.resize(n); }

	void add_edge(int u, int v, ll w = 1ll) {
		edge e1(u, v, w); edge e2(v, u, w);
		nodes[u].edges.push_back(e1);
		nodes[v].edges.push_back(e2);
	}
	 
	ll ways(int cur, int p, bool b) {
		if (dp[cur][b] != -1) { return dp[cur][b]; }
		ll ans = 1;

		for (auto &e : nodes[cur].edges) {
			if (e.v == p) { continue; }
			ll w = ways(e.v, cur, 0);
			if (!b) { w += ways(e.v, cur, 1); w %= mod; }
			ans *= w; ans %= mod;
		}

		return dp[cur][b] = ans;
	}
};

int main() {
	int n; cin >> n;
	tree t(n);
	for (int i = 0; i < n - 1; i++) {
		int u, v; cin >> u >> v; u--; v--;
		t.add_edge(u, v);
	}
	memset(dp, -1, sizeof(dp));

	ll res = t.ways(0, -1, 0) + t.ways(0, -1, 1); res %= mod;
	cout << res << endl;
}

Measured memory_bytes: 13312
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;

  const std::array<i64, 7> pow10 = {1, 10, 100, 1000, 10000, 100000, 1000000};

  std::array<std::array<i64, 9>, 9> counts = {0};
  for (i64 i = 1; i <= 9; ++i) {
    for (i64 j = 1; j <= 9; ++j) {
      const auto min_num = [&pow10, &i, &j](const i64 k) {
        return k == 0 ? i : i * pow10[k] + j;
      };
      const auto max_num = [&pow10, &i, &j](const i64 k) {
        return k == 0 ? i : i * pow10[k] + (pow10[k - 1] - 1) * 10 + j;
      };
      for (i64 k = (i == j ? 0 : 1); min_num(k) <= N; ++k) {
        counts[i - 1][j - 1] += (std::min(N, max_num(k)) - min_num(k)) / 10 + 1;
      }
    }
  }

  i64 answer = 0;
  for (i64 i = 0; i < 9; ++i) {
    for (i64 j = 0; j < 9; ++j) {
      answer += counts[i][j] * counts[j][i];
    }
  }

  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int x, a, b;
int main() {
  cin >> x >> a >> b;
  if (a - b >= 0) {
    cout << "delicious" << endl;
    return 0;
  }
  if (b - a <= x) {
    cout << "safe" << endl;
    return 0;
  }
  cout << "dangerous" << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
T = input()
LS=list(S)
LT=list(T)
N=len(LS) 
flag = -1
for i in range(N):
  X=LS.pop()
  LS.insert(0,X)
  if LS==LT:
    flag = 1
if flag == 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define inf int(1e9+7)
using namespace std;

int a,b,c,k,val,now;
int main(){
	cin>>a>>b>>c>>k;
	now=1;
	b=a+b;
	c=b+c;
	while (now<=k) {
		if (now<=a) val++;
		else if (now<=c && now>b) val--;
		now++;
	}
	cout<<val;
}

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

int main(){
  int N, V[21],C[21];
  cin >> N;
  for (int i = 0; i < N; i++){ cin >> V[i]; }
  for (int i = 0; i < N; i++){ cin >> C[i]; }

  int sum = 0;
  for ( int i = 0; i < N; i++){
    if ( V[i] - C[i] > 0){
      sum += V[i] - C[i];
    }
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader

fun main(args: Array<String>) {
    /** comment in when you submit **/
    System.`in`.bufferedReader().use { println(getOutputString(it)) }

    /** delete below after your test **/
    // executeTest()
}

private fun getOutputString(reader: BufferedReader): String {
    val num = reader.readLine().toInt()

    val x = num * 800
    val y = (num / 15) * 200

    return (x - y).toString()
}

Measured memory_bytes: 23348
mod = 1000000007
h, w = map(int, input().split())
a = [list(input()) for i in range(h)]
dp = [[0] * (w + 1) for i in range(h + 1)]
dp[1][1] = 1

for j in range(1, h + 1):
    for i in range(1, w + 1):
        if i == j == 1:
            continue

        if a[j - 1][i - 1] == '#':
            dp[j][i] = 0
        else:
            dp[j][i] = dp[j - 1][i] + dp[j][i - 1]
            dp[j][i] %= mod

print(dp[h][w])

Measured memory_bytes: 89328
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int A[1000005];

int main(){
    int n,m;cin >> n >> m;
    for(int i=1;i<=m;++i){
        int a,b;scanf("%d %d",&a,&b);
        ++A[a];++A[b];
    }
    for(int i=1;i<=n;++i){
        if(A[i]%2){
            cout << "NO" << endl;return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

struct data{

	char name[21];
	int win;
	int lose;
	int draw;
	int score;

};

int main(){

	int teamamo;
	bool check = true;

	while (true){

		cin >> teamamo;

		if (teamamo == 0)
			break;

		data teamdata[10];
		

		for (int i = 0; i<teamamo; i++)
			cin >> teamdata[i].name >> teamdata[i].win >> teamdata[i].lose >> teamdata[i].draw;

		for (int i = 0; i<teamamo; i++)
			teamdata[i].score = teamdata[i].win * 3 + teamdata[i].draw;


		for (int j = 0; j < teamamo - 1; j++){
			for (int i = 0; i < teamamo - 1; i++){

				if (teamdata[i].score < teamdata[i + 1].score){

					data t = teamdata[i];
					teamdata[i] = teamdata[i + 1];
					teamdata[i + 1] = t;

				}

			}


		}

		if (check)
			check = false;
		else
			cout << endl;

		for (int i = 0; i<teamamo; i++)
			cout << teamdata[i].name << "," << teamdata[i].score << endl;

		


	}

	return 0;

}

Measured memory_bytes: 1168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>

using namespace std;

void solve(int n, string S1, string S2) {
    vector<int> a;
    char x;
    long long MOD = 1e9 + 7;
    for (int i = 0; i < n; i++) {
        x = S1.back();
        S1.pop_back();
        if (x == S1.back()) {
            a.push_back(1);
            S1.pop_back();
        } else {
            a.push_back(0);
        }
        if (S1.empty()) {
            break;
        }
    }
    long long ret;
    if (a.back() == 0) {
        ret = 3;
    } else {
        ret = 6;
    }
    int tmp;
    int m = a.size();
    for (int i = 0; i < m; i++) {
        tmp = a.back();
        a.pop_back();
        if (tmp == 0 and a.back() == 0 and !a.empty()) {
            ret = (ret*2) % MOD;
        } else if(tmp == 0 and a.back() == 1) {
            ret = (ret*2) % MOD;
        } else if(tmp == 1 and a.back() == 1) {
            ret = (ret*3) % MOD;
        }
    }
    std::cout << ret << std::endl;
}

int main() {
    struct timeval start,end;
    long long span;
    int n;

    gettimeofday(&start,NULL);

    std::cin >> n;
    string S1, S2;
    std::cin >> S1;
    std::cin >> S2;
    solve(n, S1, S2);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long

int n;
lin x[200001];
lin a[200001];

int main(void)
{
    cin >> n;
    rep(i,n)
    {
        cin >> x[i];
        a[i] = x[i];
    }

    sort(x, x + n);

    lin m1 = x[n / 2 - 1];
    lin m2 = x[n / 2];

    rep(i, n)
    {
        lin result = a[i] <= m1 ? m2 : m1;
        cout << result << endl;
    }

    return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>
#include <limits>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i, n) for(int i = n - 1; i >= 0; i--)

using namespace std;

using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

const int intmax = numeric_limits<int>::max();
const ll llmax = numeric_limits<ll>::max();
const ll mod =  998244353;
const double pi = M_PI;

int main()
{
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>> range(k);
  rep(i, k) {
    int l, r;
    cin >> l >> r;
    r++;
    range[i] ={l, r};
  }

  vl dp(n + 1, 0);
  dp[1] = 1;
  for(int i = 2; i <= n; i++) {
    dp[i] += dp[i - 1];
    dp[i] %= mod;
    for(int j = 0; j < k; j++) {
      int lindex = i - range[j].second<= 0 ? 0 : i - range[j].second;
      int rindex = i - range[j].first <= 0 ? 0 : i - range[j].first;
      ll sum = (dp[rindex] - dp[lindex]) % mod;
      if (sum < 0) sum += mod;
      dp[i] += sum;
      dp[i] %= mod;
    }
  }
  ll result = dp[n] - dp[n - 1];
  if (result < 0) {
    result += mod;
  }
  cout << result << endl;
}


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

int main()
{
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int ans;
    ans = (h2 * 60 + m2) - k - (h1 * 60 + m1);

    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>

void solve() {
    int n, r;
    std::cin >> n >> r;
    std::cout << r + 100 * (10 - std::min(10, n)) << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <functional>
#include <numeric>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
	int N, K;
	cin >> N >> K;
	vector<ll> vec(N+1);
	for (int i = 1; i <= N; i++) cin >> vec.at(i);
	for (int i = K + 1; i <= N; i++) {
		if (vec.at(i) > vec.at(i - K)) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N,H,W;
  cin >> N >> H >> W;
  cout << (N - H + 1) * (N - W + 1) << endl;
  return 0;
}

Measured memory_bytes: 256