akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define rt return
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll powmod(ll a,ll b,ll MOD){ll ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/

int main()
{
    int a,b;
    cin>>a>>b;
    if(b%a==0)
    {
    	printf("%d\n",a+b );
    }else
    {
    	printf("%d\n",b-a );
    }
    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define ll long long
#define X first
#define Y second
#define pb push_back
#define E Maxke_pair
#define pii pair<int, int>
#define ls rt << 1
#define rs rt << 1 | 1
#define sz(x) (int)(x).sze()
#define ALL(x) (x).insgin(), (x).end()
#define vi vector<int>
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int mod = 1e9 + 7;
const int INF = 1e9 + 7;
const int N = 2e5 + 10;
const int M = 2e6 + 10;
int sum[4010][4010];
int n,k;
int get(int x1,int y1,int x2,int y2)
{
    return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x1 - 1][y2] - sum[x2][y1 - 1];
}
int query(int x,int y)
{
    return get(x, y, x + k - 1, y + k - 1) + get(x + k, y + k, x+ 2 * k - 1, y + 2 * k - 1);
}
int main()
{
	n = read();
	k = read();
    int kk = 2 * k;
    rep(i, 1, n)
    {
        int x, y; 
        char s[5];
        scanf("%d%d%s", &x, &y, s);
        if(s[0] == 'B') y -= k;
        x = (x % kk + kk) % kk;
        y = (y % kk + kk) % kk;
        sum[x + 1][y + 1] ++;
        sum[x + 1+ 2 * k][y + 1] ++;
        sum[x + 1][y + 1 + 2* k] ++;
        sum[x + 1 + 2 * k][y + 1 + 2 * k] ++;
    }
    rep(i, 1, 4 * k)
    	rep(j, 1, 4 * k)
    		sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
    int ans = 0;
    rep(i, 1, 2 * k)
    	rep(j, 1, 2 * k)
            ans = max(ans,query(i, j));
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 62848
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
using namespace std;

int main(){
  int n;
  cin >> n;
  string s;
  int score;
  pair<pair<string,int >, int > rest[n];
  for (int i=0;i<n;i++){
    cin >> s >> score;
    rest[i].first = make_pair(s,-1*score);
    rest[i].second = i;
  }
  sort(rest,rest+n);
  for(int i=0;i<n;i++) cout << rest[i].second + 1 << endl;
  return 0;
}

Measured memory_bytes: 256
from heapq import *
n, h = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

a = []
b = []
for i, j in ab:
    a.append(i)
    b.append(-j)
heapify(b)
max_a = max(a)

cnt = 0
while h > 0:
    temp = heappop(b) * (-1) if b else 0
    if temp > max_a:
        h -= temp
        cnt += 1
    else:
        temp = (h + max_a - 1)/max_a
        h -= max_a * int(temp)
        cnt += int(temp)

print(cnt)

Measured memory_bytes: 32248
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
 
#define endl "\n"
 
#define ll long long
#define MOD 1000000007
 
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
 
const double PI = 3.1415926535897932238460;
 
int main(){

    int k, a;
    cin >> k>> a;
    if (a>=k*2 && a<=k*4 && a%2==0)
        cout << "Yes"<<endl;
        else cout << "No"<<endl;
return 0;
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a=0,b=0,c=0,d=0,n=0,x,y;
    string s,s1,s2;
    cin >> s;
    VI m(n);

    if(s[0]==s[3] && s[1] ==s[2] &&s[1]!=s[0]) cout << "Yes" << endl;
    else if(s[0]==s[2] && s[1] == s[3]&&s[1]!=s[0]) cout << "Yes" << endl;
    else if(s[0]==s[1] && s[2] == s[3]&& s[2]!=s[0]) cout << "Yes" << endl;
    

    else cout << "No" << endl;
    return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
main()
{
	//freopen("input.txt","rt",stdin);
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	int count = 0;
	int p =1;
	for(int i=0;i<n;i++)
	{
		if(arr[i] != p)
		{
			count++;
		}
		else
		{
			p++;
		}
	}
		if(count == n)
		{
			cout<<"-1"<<endl;
		}
		else
		{
			cout<<count<<endl;
		}
}

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

int main (){
  int a,b;
  cin >> a >> b;
  if(a==b){
    cout << "Draw" << endl;
  }else{
    if((a>b&&b!=1)||a==1){
      cout << "Alice" << endl;
    }else{
      cout << "Bob" << endl;
    }
  }
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int n; cin >> n;
  vi arr(n);
  rep(i,n) cin >> arr[i];

  vl sum(n+1);
  sum[0] = 0;
  rep(i,n) sum[i+1] = sum[i] + arr[i];

  ll ans = 2e14+1;

  for (int med=2; med<=n-2; ++med) {
    vl tmp(4);

    auto q1 = upper_bound(all(sum), sum[med]/2);
    ll x1 = *q1;
    --q1;
    ll x2 = *q1;
    tmp[3] = abs(sum[med]-x1*2) < abs(sum[med]-x2*2) ? x1 : x2;
    tmp[2] = sum[med];

    auto q3 = upper_bound(all(sum), (sum[n]+sum[med])/2);
    ll y1 = *q3;
    --q3;
    ll y2 = *q3;
    tmp[1] = abs(sum[n]+sum[med]-y1*2) < abs(sum[n]+sum[med]-y2*2) ? y1 : y2;
    tmp[0] = sum[n];

    rep(i,3) tmp[i] -= tmp[i+1];
    sort(all(tmp));
    ans = min(ans, tmp[3]-tmp[0]);
  }

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


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A+B > C+D){
    cout << "Left" << endl;
  }
  else if(A+B < C+D){
    cout << "Right" << endl;
  }
  else{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
import java.math.BigInteger;

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

		while(true){
			int n = sc.nextInt();
			if(n == 0) break;

			ArrayList<ArrayList<Edge>> map = new ArrayList<ArrayList<Edge>>();
			for(int i=0;i<n;i++){
				ArrayList<Edge> tmp = new ArrayList<Edge>();
				for(int j=0;j<2;j++){
					int to = sc.nextInt();
					int cost = sc.nextInt();
					tmp.add(new Edge(to,cost));
				}
				map.add(tmp);
			}

			boolean[] used = new boolean[n];
			BigInteger ans = BigInteger.ONE;
			for(int i=0;i<n;i++){
				if(!used[i]){
					int max = 0;
					int now = i;
					int before = i;

					while(now != i || before == i){
						Edge a = map.get(now).get(0);
						Edge b = map.get(now).get(1);

						max = Math.max(max,a.cost);
						max = Math.max(max,b.cost);

						int tmp = now;
						now = (before != a.to ? a.to : b.to);
						before = tmp;
					}

					int sum = 0;
					now = i;
					while(!used[now]){
						used[now] = true;
						Edge a = map.get(now).get(0);
						Edge b = map.get(now).get(1);
						if(a.cost == max) sum++;
						if(b.cost == max) sum++;

						now = (!used[a.to] ? a.to : b.to);
					}

					ans = ans.multiply(new BigInteger(Integer.toString(sum/2)));
				}
			}

			System.out.println(ans.mod(new BigInteger("10007")));
		}
	}

}

class Edge{
	int to,cost;

	Edge(int to,int cost){
		this.to = to;
		this.cost = cost;
	}
}

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

// templates -------------------------------------

#define ULL unsigned long long
#define LL long long
#define LLD long long double
#define REP(i, n) for(LL i = 0; i < n; i++)
#define INV_REP(i, n) for(LL i = n; 0 <= i; i--)

LL combination(LL n, LL m)
{
  LL nume = 1;
  REP(i, m) nume *= (n-i);
  LL demo = 1;
  for(int i = 1; i <= m; i++) demo *= i;
  return nume / demo;
}

template<class T>
class UnionFind
{
private:
  vector<T> par;
  vector<T> rank;
  vector<T> size;

public:
  UnionFind(T N) :
    par(N, T()), rank(N, T()), size(N, T())
  {
    REP(i, N)
    {
      par[i] = i;
      rank[i] = 0;
      size[i] = 1;
    }
  }

  inline T root(T x)
  {
    return par[x] == x ? x : par[x] = root(par[x]);
  }

  inline bool same(T x, T y)
  {
    return root(x) == root(y);
  }

  inline T getSize(T x)
  {
    return size[root(x)];
  }

  void unite(T x, T y)
  {
    T r1 = root(x);
    T r2 = root(y);
    if(r1 == r2) return;

    if(rank[r1] < rank[r2]) swap(r1, r2);
    if(rank[r1] == rank[r2]) rank[r1]++;
    par[r2] = r1;
    size[r1] += size[r2];
  }
};

// --------------------------------------

int M;

void input()
{
  cin >> M;
}

void solve()
{
  cout << 24+(24-M) << endl;
}

int main()
{
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline void out(T a){ cout << a << '\n'; }

const ll INF=1e18;

struct edge{ll to,cost;};


struct PP{
    ll min_d,vert;
};

bool operator> (const PP &p1, const PP &p2){
    return p1.min_d > p2.min_d;
};


class Dijkstra{
public:
    ll n;//頂点数,辺数
    V<V<edge>> G;
    V<ll> d;
    V<ll> pr;

    explicit Dijkstra(ll sz_n){
        n=sz_n;
        G.resize(sz_n);
        d.resize(sz_n);
        pr.resize(sz_n);
    }

    void add_edge(ll from,ll to,ll cost){
        G[from].push_back((edge){to,cost});
        G[to].push_back((edge){from,cost});//有向辺の場合は削除
    }

    void exe(ll s){//頂点sからの最短距離
        priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> que;
        rep(i,n) d[i]=INF;
        d[s]=0;
        que.push(make_pair(0,s));//pair...first->最短距離、second->頂点

        while(!que.empty()){
            pair<ll,ll> p=que.top();que.pop();
            ll v=p.second;
            if(d[v]<p.first) continue;
            for(int i=0;i<(int)G[v].size();i++){
                edge e=G[v][i];
                if(d[e.to]>d[v]+e.cost){
                    d[e.to]=d[v]+e.cost;
                    que.push(make_pair(d[e.to],e.to));
                    pr[e.to]=v;
                }
            }
        }
    }

    ll dist_to(ll t){
        return d[t];
    }

    //頂点tへの最短路
    vector<ll> get_path(ll t){
        vector<ll> path;
        for(;t!=-1;t=pr[t]) path.push_back(t);//tがsになるまでprev[t]をたどっていく
        reverse(all(path));
        return path;
    }

};


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    Dijkstra ds(n);
    rep(i,n-1){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        ds.add_edge(a,b,c);
    }
    int Q;ll k;
    cin>>Q>>k;
    k--;
    ds.exe(k);
    while(Q--){
        ll x,y;
        cin>>x>>y;
        x--;y--;
        out(ds.dist_to(x)+ds.dist_to(y));
    }
}


Measured memory_bytes: 14804
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @x = gets.to_s.to_i
  end

  def solve
    return 8 if x < 600
    return 7 if x < 800
    return 6 if x < 1000
    return 5 if x < 1200
    return 4 if x < 1400
    return 3 if x < 1600
    return 2 if x < 1800
    return 1 if x < 2000
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end

Measured memory_bytes: 14332
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] week = new String[] {"SUN","MON","TUE","WED","THU","FRI","SAT"};
		int[] ans = new int[] {7,6,5,4,3,2,1};
		String X = sc.next();

		for (int i = 0; i < ans.length; i++) {
			if (X.equals(week[i])) {
				System.out.println(ans[i]);
			}
		}
	}
}

Measured memory_bytes: 35708
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector as V

main :: IO ()
main = do
  [h, w] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    encode :: (Int, Int) -> Int
    encode (i, j) = i * w + j
    decode :: Int -> (Int, Int)
    decode ij = ij `divMod` w
  xs <- VU.fromList . map ('.' ==) . concat . lines <$> getContents :: IO (VU.Vector Bool)
  let
    ls = VU.constructN (h * w) rec
      where
        rec :: VU.Vector Int -> Int
        rec v | not (xs VU.! ij) = 0
              | 0 < j            = VU.last v + 1
              | otherwise        = 1
          where
            l = VU.length v :: Int
            ij = l :: Int
            (_, j) = decode ij
    rs = VU.constructrN (h * w) rec
      where
        rec :: VU.Vector Int -> Int
        rec v | not (xs VU.! ij) = 0
              | j < w - 1        = VU.head v + 1
              | otherwise        = 1
          where
            l = VU.length v :: Int
            ij = h * w - l - 1 :: Int
            (_, j) = decode ij
    us = VU.constructN (h * w) rec
      where
        rec :: VU.Vector Int -> Int
        rec v | not (xs VU.! ij) = 0
              | w <= l           = v VU.! (l - w) + 1
              | otherwise        = 1
          where
            l = VU.length v :: Int
            ij = l :: Int
    ds = VU.constructrN (h * w) rec
      where
        rec :: VU.Vector Int -> Int
        rec v | not (xs VU.! ij) = 0
              | w <= l           = v VU.! (w - 1) + 1
              | otherwise        = 1
          where
            l = VU.length v :: Int
            ij = h * w - l - 1 :: Int
    ys = op <$> [0 .. (h - 1)] <*> [0 .. (w - 1)]
      where
        op :: Int -> Int -> Int
        op i j = max 0 . subtract 3 $ ls VU.! ij + rs VU.! ij + us VU.! ij + ds VU.! ij
          where
            ij = encode (i, j)
  print . maximum $ ys

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


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

int n, a[100011], p;
ll ans;

inline ll Calc(int s, int e) {
    ll ret = 0, ret2 = 0;
    for (int i = s; i <= e; ret2 += (a[i++] %= 2)) ret += a[i] >> 1;
    return ret + ret2 / 2;
}

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", a + i);
        if (a[i] == 0) ans += Calc(p, i-1), p = i+1;
    }
    printf("%lld\n", ans + Calc(p, n));
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define debug(...)   printf( __VA_ARGS__ )
//#define debug(...)   /****nothing****/
#define pb push_back
#define mp make_pair
#define LL long long
#define resett(arr,val,N) for(int ii=0;ii<(N);ii++) arr[ii]=val;
#define PI 2*acos(0.0)
int n,x,ar[100007];

int main(){
    //freopen("d://i.txt","r",stdin);
    //freopen("d://o.txt","w",stdout);
    //ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) ;
    while(cin>>n){

        int mx=-2;

        for(int i=0;i<n;i++){
            scanf("%d",ar+i);
            mx=max(mx,ar[i]);
        }

        LL low=0,high=2+1LL*n*mx;
        LL ans1,ans2;

        while(high-low>1){
          LL mid=(low+high)>>1;
          LL temp=mid;
          int i;

          for(i=0;i<n;i++){
            temp=temp-temp%ar[i];
            if(temp<2)
                goto jump;
          }

          if(temp>=2){
            high=mid;
          }
          else{
           jump:;
           low=mid;
          }

        }

        ans1=high;
//        printf("%lld ",high);
        low=0,high=2+1LL*n*mx;

        while(high-low>1){
          LL mid=(low+high)>>1;
          LL temp=mid;
          int i;

          for(i=0;i<n;i++){
            temp=temp-temp%ar[i];
            if(temp<2)
                goto jump2;
          }

          if(temp<=2){
            jump2:;
            low=mid;
          }
          else{
           high=mid;
          }

        }

        if(ans1>low)
            printf("-1\n");
        else
           printf("%lld %lld\n",ans1,low);


    }

    return 0;
}

/// complexity : O(n+2*( log2(10^18) * n ) )
///            =>O(n*(1+2log2(10^18)) )
///            =>O(2*n*log2(10^18))
///            =>O(n*log2(10^18))


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;

  if(a==b&&b==c){
    cout << 1 << endl;
  }
  else if(a==b||b==c||c==a){
    cout << 2 << endl;
  }
  else if(a!=b&&b!=c&&c!=a){
    cout << 3 << endl;
  }
}

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

signed main(){
    int N,M;
    cin>>N>>M;
    REP(i,M){
        int a;cin>>a;
        N-=a;
    }
    if(N<0)N=-1;
    cout<<N<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int t,p,r;
    while (cin>>t>>p>>r) {
        if (t==0&&p==0&&r==0) {
            break;
        }
        long long int tID,pID,times;
        string message;
        std::map<long long int, long long int> correct;
        for (int i=1;i<=t;i++) {
            correct[i]=0;
        }
        std::map<pair<long long int,long long int>, long long int> incorrect;
        std::map<long long int, long long int> penalty;
        for (int i=0;i<r;i++) {
            cin>>tID>>pID>>times>>message;
            if (message=="CORRECT") {
                correct[tID]++;
                penalty[tID]+=incorrect[make_pair(tID,pID)]*1200+times;
            } else {
                incorrect[make_pair(tID,pID)]++;
            }
        }
        std::multimap<long long int, long long int,greater<long long int>> rank;
        std::map<long long int, long long int,greater<long long int>> correct_num;
        for (auto itr=correct.begin();itr!=correct.end();itr++) {
            rank.emplace(itr->second,itr->first);
            correct_num[itr->second]=1;
        }
        for (auto itr=correct_num.begin();itr!=correct_num.end();itr++) {
            auto p=rank.equal_range(itr->first);
            multimap<long long int,long long int> penalty_check;
            std::map<long long int, long long int> penalty_num;
            for (auto itr2=p.first;itr2!=p.second;itr2++) {
                penalty_check.emplace(penalty[itr2->second],itr2->second);
                penalty_num[penalty[itr2->second]]=1;
            }
            for (auto itr3=penalty_num.begin();itr3!=penalty_num.end();itr3++) {
                auto q=penalty_check.equal_range(itr3->first);
                for (auto itr4=q.first;itr4!=q.second;itr4++) {
                    cout<<itr4->second<<" "<<itr->first<<" "<<itr3->first<<endl;
                }
            }
        }
    }
}


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

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

  for (int i = 0; i < 3; i++){
    if (A.at(i) == B.at(i))
      c++;
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int a[1010];
int main() {
	int n, q;
	cin >> n;
	rep(i, n)cin >> a[i];
	cin >> q;
	while (q--) {
		int x, y, k;
		cin >> x >> y >> k;
		int ans = 0;
		for (int i = x; i < y; i++)ans += (a[i] == k);
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3080
#include<stdio.h>
int main(void)
{
	int x[15]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int a,b,s,i;
	while(1){
		scanf("%d%d",&a,&b);
		if(a==0||b==0) break;
		s=0;
		for(i=1;i<a;i++){
			s+=x[i];
		}
		s+=b;
		if(s%7==0){
			printf("Wednesday\n");
		}
		else if(s%7==1){
			printf("Thursday\n");
		}
		else if(s%7==2){
			printf("Friday\n");
		}
		else if(s%7==3){
			printf("Saturday\n");
		}
		else if(s%7==4){
			printf("Sunday\n");
		}
		else if(s%7==5){
			printf("Monday\n");
		}
		else if(s%7==6){
			printf("Tuesday\n");
		}
	}
	return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 30;

const int nmax=200010;
int n,d;
int x[nmax],y[nmax],b[nmax];

int idx[nmax];

int offset;
int xdata[1<<19][2],ydata[1<<19][2];

void init(int m){
	offset=1;
	while(offset<m) offset*=2;
	rep(i,2*offset-1){
		xdata[i][0]=ydata[i][0]=inf;
		xdata[i][1]=ydata[i][1]=-inf;
	}
}

void update(int data[1<<19][2],int k,int x){
	k+=offset-1;
	data[k][0]=min(data[k][0],x);
	data[k][1]=max(data[k][1],x);
	while(k>0){
		k=(k-1)/2;
		data[k][0]=min(data[2*k+1][0],data[2*k+2][0]);
		data[k][1]=max(data[2*k+1][1],data[2*k+2][1]);
	}
	return;
}

pii query(int data[1<<19][2],int a,int b,int k,int l,int r){
	// cerr << a << " " << b <<" " << k << " " << l << " " << r << endl;
	if(b<=l||r<=a)
		return make_pair(inf,-inf);
	if(a<=l&&r<=b)
		return make_pair(data[k][0],data[k][1]);
	else{
		pii vl=query(data,a,b,2*k+1,l,(l+r)/2);
		pii vr=query(data,a,b,2*k+2,(l+r)/2,r);
		return	make_pair(min(vl.first,vr.first),max(vl.second,vr.second));
	}
}

int main(void){
	cin >> n >> d;
	rep(i,n) cin >> x[i] >> y[i] >> b[i];
	rep(i,n) idx[i]=b[i];
	sort(idx,idx+n);
	int m=unique(idx,idx+n)-idx;
	init(m);

	rep(i,n){
		int pos=lower_bound(idx,idx+m,b[i])-idx;
		update(xdata,pos,x[i]);
		update(ydata,pos,y[i]);
	}


	ll ans=0LL;
	rep(i,m){
		int j=upper_bound(idx,idx+m,idx[i]+d)-idx;
		pii xx=query(xdata,i,j,0,0,offset);
		pii yy=query(ydata,i,j,0,0,offset);
		ans=max(ans,1LL*(xx.second-xx.first)*(yy.second-yy.first));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12488
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	if len(s)&1 == 1 {
		fmt.Println("No")
		return
	}

	for i := 0; i < len(s)/2; i += 2 {
		if s[i] != 'h' || s[i+1] != 'i' {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
	return
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n, t;
    cin >> n >> t;
    vector<pair<int,int>> v(n);
    for(auto& i : v) cin >> i.first >> i.second;

    sort(all(v));

    vector<vector<int>> dp(n+1, vector<int>(t+1, 0));

    REP(i, n){
        dp[i+1] = dp[i];
        REP(j, t){
            chmax(dp[i+1][min(t, j + v[i].first)], dp[i][j] + v[i].second);
        }
    }

    cout << MAX(dp[n]) << endl;
    return 0;
}


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


typedef long double ld;
typedef long long ll;

using namespace std;

ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
	}
	
	mod& operator=(const ll & tx) {
		x = tx;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return (x + m2.x) % MOD;
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return (x - m2.x + MOD) % MOD;
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return (x * m2.x) % MOD;
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return mod(((*this).x * (*this).inv().x) % MOD);
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}

/* TEMPLATE ENDS HERE */

int main() {
	int a, b;
	cin >> a >> b;
	if (2 * b >= a) {
		cout << 0 << endl;
	} else {
		cout << a - 2 * b << endl;
	}
	

	return 0;
}


Measured memory_bytes: 3568
#include <stdio.h>

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

Measured memory_bytes: 128
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    p = read_int_list()
    res = 0
    m = p[0]
    for i in range(n):
      if p[i] <= m:
        res += 1
        print(' i = ', i, file=sys.stderr)
      m = min(m, p[i])
    print(res)


main()


Measured memory_bytes: 26096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////



int main(){fastio
    ll n,k;cin>>n>>k;
    dd ans=0.0;
    rep(s,1,n){
        dd p=1.0;
        ll now=s;
        while(now<k){
            now*=2;
            p/=2;
        }
        ans+=p;
    }
    cout<<setprecision(15)<<ans/n<<endl;
    return 0;
}


Measured memory_bytes: 764
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
const int maxn = 100000;
typedef long long LL;
LL a[maxn + 5];
int n;
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)scanf("%lld", &a[i]);
	sort(a + 1, a + n + 1);
	LL sum = 0;
	int m = (n + 1) / 2;
	for(int i = 1; i <= m; i++) {
		if(i + m <= n)sum += a[i + m] - a[i];
		if(i + m + 1 <= n)sum += a[i + m + 1] - a[i];
	}
	if(n & 1)sum += max(a[m + 1] - a[m], a[m] - a[m - 1]);
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 896
(N, K) = map(int, input().split())
h = []
for i in range(N):
    h.append(int(input()))

h.sort()
ans = 10**9 + 100
for i in range(N-K+1):
    d = abs(h[i]-h[i+K-1])
    if d < ans:
        ans = d

print(ans)

Measured memory_bytes: 7512
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		boolean ans = false;
		for(int i = 0; i <= N/7; i++) {
			if((N-7*i)%4 == 0) {
				ans = true;
			}
		}
		if(ans) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

	}

}

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

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
    
    string x; cin >> x;
    for(char c : x){
        if(c == '7'){
            cout << "Yes";
            return 0;
        } 
    }

    cout << "No";
}


Measured memory_bytes: 3604
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
  string a;
  cin>>a;
  if(a.at(0)==a.at(2)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
    // ll N,S,K;
    // ll a,b,c;
    string s;

    cin >> s;

    string whether[3];
    whether[0] = "Sunny";
    whether[1] = "Cloudy";
    whether[2] = "Rainy";

  ll ans =0;
  for (ll i = 0; i < 3; i++)
  {
    if (s==whether[i]) ans=i;
  }
  

  cout << whether[(ans+1)%3 ];

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 1e5 + 5;
const int inf = 1e9;
const int mod = 1e9 + 7;

int bit[maxn];
void update(int x , int val){
    for( ; x < maxn ; x += x & -x){
        bit[x] += val;
        if(bit[x] >= mod)bit[x] -= mod;
    }
}
int query(int x){
    int res = 0;
    for( ; x > 0 ; x &= x - 1){
        res += bit[x];
        if(res >= mod)res -= mod;
    }
    return res;
}

int a[maxn],b[maxn];
int n,m;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> m;
    for(int i = 1 ; i <= n ; ++i){
        cin >> a[i];
    }
    for(int i = 1 ; i <= m ; ++i){
        cin >> b[i];
    }
    vector<ii> val;
    vector<int> val1(1,0);
    for(int i = 1 ; i <= n ; ++i){
        int j = lower_bound(b + 1 , b + m + 1 , a[i]) - b;
        if(j == 1 || j > m)continue;
        val.pb(mp(a[i] - b[j - 1] , b[j] - a[i]));
        val1.pb(b[j] - a[i]);
    }
    sort(val.begin(),val.end(),[&](const ii a , const ii b){
        if(a.first == b.first)return a.second > b.second;
        return a.first < b.first;
         });
    update(1,1);
    sort(val1.begin(),val1.end());
    val1.erase(unique(val1.begin(),val1.end()),val1.end());
    val.erase(unique(val.begin(),val.end()),val.end());
    for(auto & c : val){
//        cout << c.first << " " << c.second << endl;
        c.second = lower_bound(val1.begin(),val1.end(),c.second)-val1.begin();
//        cout << query(c.second) << endl;
        update(c.second+1,query(c.second));
    }
    cout << query(n+1);
}


Measured memory_bytes: 3828
import java.util.*;

public class Main{
    static int[] par;
    static int[] rank;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        
        int[] idx = new int[n+1];
        Arrays.fill(idx, -1);
        
        int w = -1;
        int wri = -1;
        for(int i=0; i<n+1; i++){
            int tmp = Integer.parseInt(sc.next());
            if(idx[tmp] == -1){
                idx[tmp] = i;
            }else{
                w = tmp;
                wri = i;
            }
        }
        
        int l = idx[w];
        int r = wri;
        
        final int MOD = (int)1e9+7;
        final int MAX = (int)1e5+5;
        
        Mod_nCr mncr = new Mod_nCr(MOD, MAX);
        
        
        
        //
        for(int k=1; k<=n+1; k++){
            long ans = mncr.nCr(n+1, k) + MOD;
            ans -= mncr.nCr(l+n-r, k-1);
            System.out.println(ans%MOD);
        }
    }
}

//インスタンス作るだけでO(max)掛かるよ
//更に定数倍きついよ

class Mod_nCr{
    int mod;
    long[] fact;
    long[] rfact;
    
    public Mod_nCr(int mod, int max){
        this.mod = mod;
        fact = new long[max];
        rfact = new long[max];
        
        fact[0] = 1;
        rfact[0] = 1;
        
        for(int i=1; i<max; i++){
            fact[i] = (fact[i-1]*i)%mod;
            rfact[i] = mod_inverse(fact[i], mod);
        }
    }
    
    //
    private long mod_pow(long x, long p, long m){
        long a = 1;
        while(p>0){
            if(p%2==1){
                a = a*x%m;
            }
            x = x*x%m;
            p /= 2;
        }
        return a;
    }
    
    private long mod_inverse(long a, long m){
        return mod_pow(a, m-2, m);
    }
    
    //
    public long nCr(int n, int r){
        if(n < r) return 0;
        return fact[n]*rfact[r]%mod * rfact[n-r]%mod;
    }
}


Measured memory_bytes: 47448
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0 ,0 };


int main(void) {
	
	int n;
	double x[11];
	string u[11];
	double total = 0;

	cin >> n;
	FOR(i, 1, n) {
		cin >> x[i] >> u[i];
		if (u[i] == "JPY") {
			total += x[i];
		}
		else {
			total += x[i] * 380000;
		}
	}

	cout << total << endl;


	return 0;
}

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

int main() {
	long long n;
	cin >> n;
	long long t = 1000000000 + 7;
	long long a, b, c;
	a = 1;
	b = 1;
	c = 1;
	for(int i=1; i<=n; i++){
		a = a * 10 % t;
		b = b * 9 % t;
		c = c * 8 % t;
	}
	b = b * 2;

	long long ans;

	ans = (a-b)%t;
	ans = (ans + c)%t;
	if(ans < 0) cout << (t + ans) << endl;
	else cout << ans << endl;

	return 0;

  
}


Measured memory_bytes: 3612
n = int(input())
lst = [0] * 10000
def kake(a, b, c):
    return a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a
for i in range(1,50):
  for j in range(i, 60):
    for k in range(j, 110):
      m = kake(i, j, k)
      if m <= 10000:
        if i != j and j != k:
          lst[m - 1] += 6
        elif i == j and j == k:
          lst[m - 1] += 1
        else:
          lst[m - 1] += 3
for i in range(n):
  print(lst[i])

Measured memory_bytes: 9148
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    ll s[100003];
    for(int i = 0; i < n; i++) cin >> s[i];
    ll ans = 0;
    for(int i = 1; i < n; i++){
        ll sum = 0;
        for(int j = 1; ; j++){
            if((i * j >= (n - 1) - i * j && (i * j - ((n - 1) - i * j)) % i == 0) || (n - 1) - i * j < i) break;
            sum += s[i * j] + s[(n - 1) - i * j];
            ans = max(ans, sum);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define loop(i, a, b) for (int i = a; i < (int)(b); i++)
 
 
int main() {
    string s;
    cin >> s;
    int count1 = 0;
    int count2 = 0;

    int n = s.length();
    rep(i, n) {
        char c = s[i];
        char c1 = (i % 2 == 0) ? '0' : '1';
        char c2 = (i % 2 > 0) ? '0' : '1';
        if (c1 != c) {
            count1++;
        }
        if (c2 != c) {
            count2++;
        }
    }
    int count = min(count1, count2);
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
    int x,n;
    n = 1;
    while(1){
        cin >> x;
        if (x == 0)break;
        cout << "Case" << " "<< n << ":" << " " << x << endl;
        n = n + 1;
    }return 0;
}


Measured memory_bytes: 3068
N, M, X, Y = gets.split.map(&:to_i)
x = gets.split.map(&:to_i)
y = gets.split.map(&:to_i)
is_occur_war = true

(X+1).upto(Y).each do |n|
  if x.all? {|i| i < n } && y.all? {|j| j >= n }
    is_occur_war = false
    break
  end
end

if is_occur_war
  puts "War"
else
  puts "No War"
end


Measured memory_bytes: 1788
#include <stdio.h>

int main(void)
{
  int i, n = 0, e = 0;
  char s[3][101], c[3][2] = {{"A"}, {"B"}, {"C"}};

  for (i = 0; i < 3; i++) {
    scanf("%s", s[i]);
  }

  while (1) {

    for (i = 0; i < 101; i++) {

      if (s[n][i] == 'a') {
	s[n][i] = 1;
	n = 0;
	break;
      } else if (s[n][i] == 'b') {
	s[n][i] = 1;
	n = 1;
	break;
      } else if (s[n][i] == 'c') {
	s[n][i] = 1;
	n = 2;
	break;
      } else if (s[n][i] == '\0') {
	e = -1;
	break;
      }
    }
    
    if (e == -1) {
      printf("%s\n", c[n]);
      break;
    }
  }
  
  return 0;
}


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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  ll X,t;
  cin >> X >> t;
  cout << (X-t >= 0 ? X-t : 0) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <functional>

#define big ((long long)(1e9) + 7)

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define DBG(x) cerr << #x << ": " << (x) << " (L" << __LINE__ << ")" << endl;

int main()
{
    string s;
    cin >> s;
    ll k;
    cin >> k;
    ll cnt = 1;
    vector<ll> a;
    for (ll i = 1; i < s.size(); i++)
    {
        // cnt++;
        // cout << s.at(i-1) << " " << s.at(i) << endl;
        if (s.at(i - 1) != s.at(i))
        {
            a.push_back(cnt);
            cnt = 1;
        }
        else
        {
            cnt++;
        }
    }
    a.push_back(cnt);

    ll ans = 0;
    if (a.size() == 1)
    {
        cout << k*s.size()/2 << endl;
        return 0;
    }

    // for(ll i = 0;i < a.size();i++)
    // {
    //     cout << a[i] << " ";
    // }
    // cout << endl;

    bool flag = false;
    int sub = 0;
    if(s.at(0) == s.at(s.size()-1) && (a[0]+a[a.size()-1])%2==0)
    {
        a[0] += a[a.size()-1];
        a[a.size()-1] = 0;
        flag = true;
    }
    for (ll i = 0; i < a.size(); i++)
    {
        ans += a[i] / 2;
    }
    if(flag)
    {
        sub--;
    }
    cout << ans * k + sub << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>//头文件
using namespace std;
string a;
int ans,l,maxx=-1*0x7fffffff;//maxx为int的最小值
int main(){
    cin>>l>>a;//输入长度和字符串
    for(int i=0;i<l;i++){//循环l次，a.length()次也行
        ans+=(a[i]=='I')?1:-1;//I为上，D为下
        maxx=max(ans,maxx);//看现在是不是最高
    }
    if(maxx==-1)maxx=0;//要特判是不是-1
    cout<<maxx<<endl;//输出最大值
    return 0;
}

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

int main(){
int a,b; cin >> a >> b;
int ans=6-a-b;
cout<< ans << endl;

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define PB push_back
#define REP(i,a,b) for (int i = a ; i <= b ; i++)
#define REPI(i,a,b) for (int i = a ; i >= b ; i--)
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const ll OO = 1e18+7;
const int MOD = 1e9+7;
const int N = 4e2+7;

int n;
int a[N];
ll pref[N];
ll mem[N][N];

ll dp(int l,int r)
{
    ll &ret = mem[l][r];
    if (ret != -1) return ret;
    if (l==r) return 0;
    ret = OO;
    REP(i,l,r-1)
    {
        ret = min(ret,dp(l,i)+dp(i+1,r)-pref[l-1]+pref[r]);
    }
    return ret;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("teleport.in","r",stdin);
    //freopen("teleport.out","w",stdout);
    memset(mem,-1,sizeof mem);

    cin >> n;
    REP(i,1,n) {cin >> a[i];pref[i] = pref[i-1]+a[i];}
    cout << dp(1,n) << endl;
    return 0;
}


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;


int main(){
    string x;
    cin >> x;
    stack<char> stk;

    for(int i = 0; i < (ll)x.size(); i++){
        if(x[i] == 'T' && !stk.empty() && stk.top() == 'S'){
            stk.pop();
        }
        else stk.push(x[i]);
    }

    cout << stk.size() << endl;

    return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
map <int,int> mp;
int n,m,num[300004],d[300004];
int bs(int t){
	int l=-1,r=3e5+10;
	while (r>l+1){
		int mid=(l+r)/2;
		int st=lower_bound(num+1,num+1+m,mid)-num;
		int did=m+1-st;
		int wants=t-did;
		if (1ll*d[st-1]>=1ll*wants*mid) l=mid;
		else r=mid;
	}
	return l;
}
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		int x;cin>>x;mp[x]++;
	}
	for (map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
		num[++m]=it->second;
	sort (num+1,num+1+m);
	for (int i=1;i<=m;i++) d[i]=d[i-1]+num[i];
	for (int i=1;i<=n;i++) cout<<bs(i)<<"\n";
}

Measured memory_bytes: 16640
#include<iostream>
using namespace std;
int main()
{
  string s;cin>>s;
  for(int i=1;i<s.size();++i)
  {
    if(s[i]!=s[i-1])
    {
      cout<<"Yes\n";
      return 0;
    }
  }
  cout<<"No";
}

Measured memory_bytes: 3636
s = input()
data = []
cnt = 0
for i in range(len(s)-1):
    cnt += 1
    if s[i] != s[i+1]:
        if s[i] == "<" and s[i+1] == ">":
            data.append(cnt)
            data.append(-1)
        else:
            data.append(cnt)
        cnt = 0
data.append(cnt+1)

for i in range(len(data)-1):
    if data[i] == -1:
        if data[i-1] < data[i+1]:
            data[i-1] -= 1
        else:
            data[i-1] > data[i+1]
            data[i+1] -= 1

ans = 0
for i in range(len(data)):
    if data[i] != -1:
        for j in range(1, data[i]+1):
            ans += j

# print(data)
print(ans)


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

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

using namespace std;

int main(){
	string s; cin>>s;
	if(s.back()=='s') s+="es";
	else              s+="s";
	cout<<s<<'\n';
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 100 + 50;
const int mod = 1e9+7;
int n, W, w[maxn], v[maxn];
ll dp[105][100050];
int main(){
    cin >> n >> W;
    for(int i = 1; i <= n; i++) cin >> w[i] >> v[i];    
//    for(int i = w[1]; i <= W; i++) dp[]
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= W; j++){
            dp[i][j] = dp[i-1][j];
            if(j>=w[i])
                dp[i][j] = max(dp[i][j], dp[i-1][j-w[i]] + v[i]);
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}

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

int main()
{
    int n, m, k; cin>>n>>m>>k;

    vector<string> a(n);
    vector<vector<int>> v(n, vector<int>(m, -1));
    queue<pair<int, int>> q;

    for(int i=0; i<n; ++i) {
        cin>>a[i];
        for(int j=0; j<m; ++j) {
            if (a[i][j]=='S') {
                q.emplace(i, j);
                v[i][j]=0;
                break;
            }
        }
    }

    int dr[4]={-1, 0, 1, 0};
    int dc[4]={0, -1, 0, 1};
    int res=1<<30;
    while (q.size()) {
        int r, c;
        tie(r, c)=q.front();
        q.pop();
        //res=min({res, r, c, n-1-r, m-1-c});
        res=min(res, min(r, min(c, min(n-1-r, m-1-c))));
        if (res==0) break;
        if (v[r][c]==k) continue;

        for(int i=0; i<4; ++i) {
            int nr=r+dr[i];
            int nc=c+dc[i];
            if (nr<0 or nr>=n or nc<0 or nc>=m) continue;
            if (a[nr][nc]=='#') continue;
            if (~v[nr][nc]) continue;
            q.emplace(nr, nc);
            v[nr][nc]=v[r][c]+1;
        }
    }
    cout<<(res+k-1)/k+1<<endl;
}



Measured memory_bytes: 3584