akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    String in = sc.nextLine();
    String s;
    for (int i = 0; i < in.length(); i++) {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    }
    System.out.println();
  }
  public static boolean isAlphabets(String s) {
    Pattern p = Pattern.compile("^[a-zA-Z]*$");
    Matcher m = p.matcher(s);
    return m.find();
  }
  public static boolean isLower(String s) {
    return s.equals(s.toLowerCase());
  }
}

Measured memory_bytes: 23552
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

string s,t;
int i;

int main(){
    cin >> s;
    cin >> t;

    s = s + s;
    if(s.find(t) != s.npos){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n;
    cin >> n;
    VL a(n), cnt(n);
    REP(i,n){
        a[i] = in() - 1;
        cnt[a[i]]++;
    }
    ll s = 0;
    REP(i,n) s += cnt[i] * (cnt[i] - 1) / 2;
    REP(i,n){
        ll ans = s, c = cnt[a[i]];
        ans -= c * (c - 1) / 2;
        ans += (c - 1) * (c - 2) / 2;
        printf("%lld\n", ans);
    }

    return 0;
}


Measured memory_bytes: 5760
object Main extends App {
  import scala.io.StdIn._

  println(
    if (readLine.trim == "ani") "square1001" else "e869120"
  )
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def let[A](func: T ⇒ A): A = func(value)
  }
}


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

namespace TOPSIC
{
    partial class Program
    {
        static void Main(string[] args)
        {
          string ans = "YES";

            int N = int.Parse(Console.ReadLine());

            string[] inputStr = Console.ReadLine().Split(' ');
            int[] A = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(inputStr[i]);
            }

            Array.Sort(A);

            for (int i = 0; i < N - 1; i++)
            {
                if (A[i] == A[i + 1])
                {
                    ans = "NO";

                    break;
                }
            }


            Console.WriteLine(ans);


        }
    }
}

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

using namespace std;

typedef long long ll;

int main(){
  int N; cin >> N;
  vector<ll> P(N);
  vector<ll> Q(N);
  for(int i = 0; i < N; i++){
    ll x,y; cin >> x >> y;
    P[i] = x + y;
    Q[i] = x - y;
  }
  
  sort(P.begin(), P.end());
  sort(Q.begin(), Q.end());
  
  cout << max(abs(P[0] - P[N-1]), abs(Q[0] - Q[N-1]) ) << endl;
}


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	int n, tmp;
	cin >> n;
	int mi = n+10;
	int cnt = 0;

	REP(i,n) {
		cin >> tmp;
		if(tmp < mi) {
			cnt++;
			mi = tmp;
		}
	}
	cout << cnt << endl;
}



Measured memory_bytes: 256
program DISCO2020yA
integer::X,Y
integer::ans=0
read*,X,Y
if(X==1)ans=ans+300000
if(X==2)ans=ans+200000
if(X==3)ans=ans+100000
if(Y==1)ans=ans+300000
if(Y==2)ans=ans+200000
if(Y==3)ans=ans+100000
if(X==1.and.Y==1)ans=ans+400000
 print"(i0)",ans
 end

Measured memory_bytes: 768
using System;
    class Program
    {
        static void Main()
        {
            string inputString, outputString = "";
            int length;
            inputString = Console.ReadLine();
            length = inputString.Length - 1;
                while (0 <= length)
                {
                    outputString = outputString + inputString[length];
                    length--;

                }
                Console.WriteLine(outputString);
        }
    }

Measured memory_bytes: 8780
import numpy as np
A, B, C = map(int, input().split())
A, B, C = np.sort([A, B, C])
ab = B - A 
bc = C - B 
if (A%2 == 1) & (B%2 == 1) & (C%2 == 1):
  print(0)
elif (ab == 0) & (bc == 0):
  print(-1)
else:
  for k in range(30):
    if ((ab % 2) == 1) | ((bc % 2) == 1):
      print(k)
      break
    ab = int(ab/2)
    bc = int(bc/2)

Measured memory_bytes: 12396
package main

import (
	"fmt"
	"strings"
)

func main() {
	imaginedNumber := 0
	var s string
	fmt.Scan(&s)
	cols := strings.Split(s, "")

	for i := 0; i < len(cols); i++ {
		if cols[i] == "+" {
			imaginedNumber++
		} else {
			imaginedNumber--
		}
	}

	fmt.Println(imaginedNumber)
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int nax = 5005;
const ll INF = 1e18L + 5;
int A, B;
int p[nax], inv[nax];
ll dp[nax][nax];

int memo[nax];

int main() {
    int n;
    scanf("%d%d%d", &n, &A, &B);
    for(int i = 0; i < n; ++i) {
      scanf("%d", &p[i]);
      --p[i];
      inv[p[i]] = i;
    }
    for(int value = n - 1; value >= 0; --value) {
      int cnt = 0;
      for(int pos = n - 1; pos >= 0; --pos) {
        if(p[pos] >= value) {
          ++cnt;
        }
        memo[pos] = cnt;
        if(pos != n - 1) {
          debug() << imie(value) imie(pos+1) imie(dp[value][pos+1]);
        }
        ll& me = dp[value][pos];
        me = INF;
        if(inv[value] < pos) {
          me = dp[value+1][pos];
          continue;
        }
        if(p[pos] < value) {
          me = dp[value][pos+1];
          continue;
        }
        if(p[pos] == value) {
          me = dp[value+1][pos+1];
          continue;
        }
        int where = inv[value];
        assert(where > pos);
        me = min(dp[value+1][pos] + B, dp[value+1][where+1] + (ll) A * (cnt - memo[where]));
      }
    }
    printf("%lld\n", dp[0][0]);
}


Measured memory_bytes: 195840
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
int main()
{
	const clock_t begin_time = clock();
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	ll ans=(s[0]-'0')*1000+(s[1]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
	ll sum=(s[5]-'0')*10+(s[6]-'0');
	ll ss=(s[8]-'0')*10+(s[9]-'0');
	if(ans>2019)
	{
	    cout<<"TBD\n";
	    return 0;
	}
	else if(ans==2019)
	{
	    if(sum>4)
	    {
	        cout<<"TBD\n";
	        return 0;
	    }
	    else if(sum==4)
	    {
	        if(ss>30)
	        {
	            cout<<"TBD\n";
	            return 0;
	        }
	        else
	        {
	            cout<<"Heisei\n";
	            return 0;
	        }
	    }
	    else
	    {
	        cout<<"Heisei\n";
	        return 0;
	    }
	}
	else
	{
	    cout<<"Heisei\n";
	    return 0;
	}
	//cout << float( clock () - begin_time ) /  CLOCKS_PER_SEC<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int a,b;
cin>> a >> b;
bool f = false;
for(int i=a;i<=b;i++){
    if(i%n==0){
        f=true;
        break;
    }
}
if(f)
    printf("OK\n");
else
    printf("NG\n");

}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main{
	public static class Cordinate{ int x, y; }

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int data = sc.nextInt();
			if(data==0) break;
			int[] polygonal = new int[data+1];
			Cordinate[][] apexes = new Cordinate[data+1][10]; 
			for(int i=0; i<=data; i++){
				polygonal[i] = sc.nextInt();
				for(int j=0; j<polygonal[i]; j++){
					apexes[i][j] = new Cordinate();
					apexes[i][j].x = sc.nextInt();
					apexes[i][j].y = sc.nextInt();
				}
			}

			for(int i=1; i<=data; i++){
				if(polygonal[0] != polygonal[i]) continue;

				boolean tf;

				for(int k=0; k<4; k++){
					for(int j=0; j<polygonal[0]; j++){
						int temp = apexes[0][j].x;
						apexes[0][j].x = apexes[0][j].y;
						apexes[0][j].y = temp * -1;
					}

					tf = true;
					int x1 = apexes[0][0].x, y1 = apexes[0][0].y;
					int x2 = apexes[i][0].x, y2 = apexes[i][0].y;

					for (int j=0; j<polygonal[0]; j++) {
						if(apexes[0][j].x - x1 != apexes[i][j].x - x2){
							tf = false;
							break; 
						}
						if(apexes[0][j].y - y1 != apexes[i][j].y - y2){
							tf = false;
							break; 
						}
					}
					if(tf){
						System.out.println(i);
						break; 
					}

					tf = true;
					x1 = apexes[0][polygonal[0]-1].x;
					y1 = apexes[0][polygonal[0]-1].y;

					for (int j=0; j<polygonal[0]; j++) {
						if(apexes[0][polygonal[0]-1-j].x - x1 != apexes[i][j].x - x2){
							tf = false;
							break; 
						}
						if(apexes[0][polygonal[0]-1-j].y - y1 != apexes[i][j].y - y2){
							tf = false;
							break; 
						}
					}
					if(tf){
						System.out.println(i);
						break; 
					}
				}
			}

			System.out.println("+++++");
		}
	}
}

Measured memory_bytes: 37188
import numpy as np
H, W=map(int, input().split())
S=np.array([list(input()) for _ in range(H)])
INF=-1
#print(S)
def bfs(sx,sy):
  #dx, dy 四方向に対応したベクトルのリスト
  dx=[1,0,-1,0]
  dy=[0,1,0,-1]
  #P: (x, y)のキュー
  P=[]
  #d: スタートから各点までの最小距離の配列
  d=np.ones((H, W))*INF
  #スタート地点をキューに入れ、その点の距離を0にする
  P.append([sx, sy])
  d[sx,sy]=0
    
  #キューがからになるまでループ
  while len(P)>0:
    #キューの先頭を取り出す
    p=P.pop(0)
    #取り出してきた状態がゴールなら探索をやめる
    """
    if (p[0]==gx and p[1]==gy):
      break
    """
        
    #移動四方向をループ
    for i in range(4):
      #移動した後の点をnx, nyとする
      nx=p[0]+dx[i]
      ny=p[1]+dy[i]
            
      #移動が可能かどうかの判定とすでに訪れたことがあるかどうかの判定（d[nx, ny]!=INFならおtpずれたことがある）
      if 0<=nx and nx<H and 0<=ny and ny<W and S[nx, ny]!="#" and d[nx, ny]==INF:
        #移動できるならキューに入れ、その点の距離をpからの距離＋１で確定する
        P.append([nx, ny])
        d[nx, ny]=d[p[0], p[1]]+1
  """
  #print(d)
  if d[gx,gy]!=INF:
    result=d[gx, gy]
  else:
    result=0
  """
  result=d.max()
  return result
ans=0
Tlen=H*W
for sx in range(H):
  for sy in range(W):
    if S[sx,sy]=="#":
      continue
    res=bfs(sx,sy)
    ans=max(ans, res)
"""
for i in range(Tlen):
  for j in range(i,Tlen):
    sx,sy=i%H, int(i//H)
    gx,gy=j%H, int(j//H)
    
    if S[sx,sy]=="#" or S[gx,gy]=="#":
      continue
    res=bfs(sx,sy,gx,gy)
    ans=max(ans, res)
"""
"""
for sx in range(H):
  for sy in range(W):
    for gx in range(H):
      for gy in range(W):
        if S[sx,sy]=="#" or S[gx,gy]=="#":
          continue
        res=bfs(sx,sy,gx,gy)
        ans=max(ans, res)
"""
print(int(ans))

Measured memory_bytes: 12840
#include <iostream>

using namespace std;

int main()
{
          string x;
          cin>>x;
          if(x.size()<4)
          {
                    cout<<"No";
                    return 0;
          }
          if(x[0]=='Y' && x[1]=='A' &&x[2]=='K' &&x[3]=='I')
                    cout<<"Yes";
          else
                    cout<<"No";
}


Measured memory_bytes: 256
import copy
H,W,K = map(int, input().split())
C = [list(input()) for _ in range(H)]

ans = 0

for i in range(1 << H):
    D = copy.deepcopy(C)
    for ii in range(H):
        if ((i >> ii) & 1):
            # フラグが立った行を塗りつぶす
            for l in range(W):
                D[ii][l] = "."
    for j in range(1 << W):
        E = copy.deepcopy(D)
        for jj in range(W):
            if ((j >> jj) & 1):
                # フラグが立った列を塗りつぶす
                for k in range(H):
                    E[k][jj] = "."
        if K == sum(E,[]).count("#"):
            ans += 1
print(ans)


Measured memory_bytes: 9376
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string n;
	cin>>n;
	for (int i=0;i<n.length();i++){
		if (n[i]=='1'){
			n[i]='9';
		}else if (n[i]=='9'){
			n[i]='1';
		}
	}
	cout<<n<<endl;
	return 0;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()

struct pos {
    LL x;
    LL y;
};

int main() {
    LL N, M;
    cin >> N >> M;
    pos p[N];
    pos c[M];
    REP(i, N) {
        cin >> p[i].x >> p[i].y;
    }
    REP(i, M) {
        cin >> c[i].x >> c[i].y;
    }
    REP(i, N) {
        LL mx = 1e18;
        LL index = 0;
        REP(j, M) {
            LL d = abs(p[i].x - c[j].x) + abs(p[i].y - c[j].y);
            if(d < mx) {
                index = j;
                mx = d;
            }
        }
        cout << index + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*
t x

t/x
 */
long double t,x;
int main(){
  cin>>t>>x;
  cout << t/(double)x<<endl;

  return 0;
}


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

int main(){
  string text;
  cin >> text;
  
  for(int i=0;i<text.size();i++){
    
    if(i%2==0){
      if(!(text[i]=='R'||text[i]=='U'||text[i]=='D')){
        cout << "No" << endl;
        return 0;
      }
    }
     if(i%2==1){
      if(!(text[i]=='L'||text[i]=='U'||text[i]=='D')){
        cout << "No" << endl;
        return 0;
      }
       }
  }
cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(it,beg,end) for(__typeof(beg) X=beg,Y=end,it=(X>Y?X-1:X);it!=(X>Y?Y-1:Y);it+=(X>Y?-1:1))
using namespace std;
#define ll long long
#define pb emplace_back
#define mp make_pair
inline void read1(ll &n) {
	char c;n=0;ll x=1;
	while (!isdigit(c=fgetc(stdin))&&c!='-');
	if (c=='-') x=-1, c=fgetc(stdin);
	while (isdigit(c)) n=n*10+c-'0',c=fgetc(stdin);
	n*=x;
}
inline void read1(int &n) {ll x;read1(x);n=x;}
#define read2(a,b) {read1(a);read1(b);}
#define read3(a,b,c) {read1(a);read1(b);read1(c);}
#define read4(a,b,c,d) {read1(a);read1(b);read1(c);read1(d);}
// -------------------- Standard Template --------------------
inline int Min(int a,int b) {return (a<b?a:b);}
struct segt {
	int sz,arr[800005],val[400005];
	void init(int n) {
		for(sz=1;sz<=n;sz<<=1);
		for(int i=0;i<=sz;i++) val[i]=1000000000;
		for(int i=1;i<=sz+sz;i++) arr[i]=sz;
	}
	void build() {
		for(int i=0;i<sz;i++) arr[i+sz]=i;
		for(int i=sz-1;i>0;i--) {
			if (val[arr[i+i]]<val[arr[i+i+1]]) arr[i]=arr[i+i];
			else arr[i]=arr[i+i+1];
		}
	}
	int getmin(int i,int x,int y,int a,int b) {
		if (x>=a&&y<=b) return arr[i];
		if (y<=a||x>=b) return sz;
		register int m=(x+y)>>1;
		int X=getmin(i+i,x,m,a,b),Y=getmin(i+i+1,m,y,a,b);
		if (val[X]<val[Y]) return X;
		return Y;
	}
	int getmin(int a,int b) {
		return getmin(1,0,sz,a,b);
	}
}sodd,seven;
int n,p[200005];
set<pair<int,pair<int,int> > > st;
int main() {
	read1(n);
	sodd.init(n);
	seven.init(n);
	for(int i=0;i<n;i++) read1(p[i]);
	for(int i=0;i<n;i++) {
		if (i&1) {
			sodd.val[i]=p[i];
		} else {
			seven.val[i]=p[i];
		}
	}
	sodd.build();
	seven.build();
//	cerr<<sodd.val[sodd.getmin(0,n)]<<endl;
//	cerr<<seven.val[seven.getmin(0,n)]<<endl;
	st.insert({seven.val[seven.getmin(0,n)],{0,n}});
	while (n) {
		auto x=st.begin();
		st.erase(x);
		int l=x->second.first,r=x->second.second;
		int X=(l&1?sodd.getmin(l,r):seven.getmin(l,r));
		int Y=(l&1?seven.getmin(X,r):sodd.getmin(X,r));
		if (l&1) printf("%d %d ",sodd.val[X],seven.val[Y]);
		else printf("%d %d ",seven.val[X],sodd.val[Y]);
		if (l<X) {
			if (l&1) st.insert({sodd.val[sodd.getmin(l,X)],{l,X}});
			else st.insert({seven.val[seven.getmin(l,X)],{l,X}});
		}
		if (X+1<Y) {
			if ((X+1)&1) st.insert({sodd.val[sodd.getmin(X+1,Y)],{X+1,Y}});
			else st.insert({seven.val[seven.getmin(X+1,Y)],{X+1,Y}});
		}
		if (Y+1<r) {
			if ((Y+1)&1) st.insert({sodd.val[sodd.getmin(Y+1,r)],{Y+1,r}});
			else st.insert({seven.val[seven.getmin(Y+1,r)],{Y+1,r}});
		}
		n-=2;
	}
	return 0;
}


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

void solve() {
    int x;
    cin >> x;
    int n = (int)sqrt((double)2.0 * x);
    for (int i = max(0, n - 10); i <= n + 10; i++) {
        if (i * (i + 1) / 2 >= x) {
            cout << i;
            return;
        }
    }
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
    return 0;
}


Measured memory_bytes: 256
/*watch.c*/

#include <stdio.h>

int main(void)
{
    int S, h, m, s;
    scanf("%d", &S);
        h = S / 3600;
        m = (S - 3600 * h) / 60;
        s = S % 60;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	
	int X[3] = {};
	for(int i = 0 ; i < n ; i++){
		int t;
		cin >> t;
		X[t%3]++;
	}
	if( X[0] == n ){
		cout << 1 << endl;
		return 0;
	}else{
		int res = 0;
		{
			int Y[3] = {X[0],X[1],X[2]};
			if( Y[1] ){
				Y[1]--;
				int ans = Y[0] + 1;
				int now = 1;
				while(true){
					if( now == 1 ){
						if( !Y[1] ) break;
						Y[1]--;
						ans ++;
						now = 2;
					}else{
						if( !Y[2] ) break;
						Y[2]--;
						ans ++;
						now = 1;
					}
				}
				if( Y[1] or Y[2] ) ans++;
				res = max(res,ans);
			}
		}
		{
			int Y[3] = {X[0],X[1],X[2]};
			if( Y[2] ){
				Y[2]--;
				int ans = Y[0] + 1;
				int now = 2;
				while(true){
					if( now == 1 ){
						if( !Y[1] ) break;
						// cout << 1 << endl;
						Y[1]--;
						ans ++;
						now = 2;
					}else{
						if( !Y[2] )break;
						// cout << 2 << endl;
						Y[2]--;
						ans ++;
						now = 1;
					}
				}
				if( Y[1] or Y[2] ) ans++;
				res = max(res,ans);
				// cout << ans << endl;
			}
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 3064
#include <stdio.h>
#include <algorithm>

using namespace std;

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    int tmp=b*10;
    int tmp2=a*25;
    if (tmp2%2) tmp2=tmp2/2+1;else tmp2/=2;
    if (tmp2>tmp) tmp=tmp2;

    while(tmp*8/100<=a && tmp/10<=b){
        if(tmp*8/100==a && tmp/10==b){
            printf("%d\n",tmp);
            return 0;
        }
        tmp++;
    }
    printf("-1");
}


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




int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  int cur[2] = {}, pre[2] = {};
  const int INF = 2e9;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    swap(cur, pre);
    for (int j : {0, 1}) {
      cur[j] = INF;
      for (int k : {0, 1}) {
        if (pre[k] <= a) cur[j] = a;
      }
      --a;
    }
  }
  cout << (count(cur, cur + 2, INF) != 2 ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b, c; cin >> a >> b >> c;
	int k = b/a;
    cout << min( k, c ) << endl;
	return 0;
}

Measured memory_bytes: 256
N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]
INF = 10000


def dfs(lances, d, len_a, len_b, len_c):
    if d == N:
        if min(len_a, len_b, len_c) == 0:
            return INF
        else:
            return abs(A-len_a) + abs(B-len_b) + abs(C-len_c) - 30
    use_no = dfs(lances, d+1, len_a, len_b, len_c)
    use_for_a = dfs(lances, d+1, len_a + lances[d], len_b, len_c) + 10
    use_for_b = dfs(lances, d+1, len_a, len_b + lances[d], len_c) + 10
    use_for_c = dfs(lances, d+1, len_a, len_b, len_c + lances[d]) + 10
    return min(use_no, use_for_a, use_for_b, use_for_c)


print(dfs(L, 0, 0, 0, 0))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type_a,class Type_b> bool chmax(Type_a &a,const Type_b &b){if(a<b){a=b;return true;}return false;}
template<class Type_a,class Type_b> bool chmin(Type_a &a,const Type_b &b){if(a>b){a=b;return true;}return false;}
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int n,m;
	cin>>n>>m;
	
	vi s(m),c(m);
	REP(i,m) cin>>s[i]>>c[i];
	
	string ans(n,'n');
	debug(ans);
	REP(i,m){
		int p=s[i]-1;
		if(ans[p]=='n'){
			ans[p]='0'+c[i];
		}else{
			if(ans[p]-'0'==c[i]){}
			else{
				cout<<-1<<endl;
				return 0;
			}
		}
	}
	debug(ans);
	
	if(ans[0]=='0'){
		if(n==1) cout<<0<<endl;
		else cout<<-1<<endl;
		return 0;
	}
	
	if(ans[0]=='n'){
		if(n==1) ans[0]='0';
		else ans[0]='1';
	}
	
	for(int i=1;i<n;++i){
		if(ans[i]=='n') ans[i]='0';
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>

using namespace std;

#define int_ int64_t
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000003
#define PII pair<int, int>

const int N=200010;
ll n,a,b;

int main()
{
    scanf("%lld",&n);
    ll mn=INF;
    ll sum=0;
    for (ll i=1;i<=n;i++) {
        scanf("%lld%lld",&a,&b);
        sum+=a;
        if (a>b) {
            mn=min(mn,b);
        }
    }
    if (mn==INF) {
        printf("0\n");
        return 0;
    }
    printf("%lld\n",sum-mn);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
using namespace std;
static const int INF = (1 << 21);

ll int a[100001] = { 0 };

int main() {
	ll int N, K;
	cin >> N >> K;
	for (ll int i = 0;i < N;i++) {
		int j,k;
		cin >> j >>k;
		a[j] += k;
	}
	ll int i=0,j=1;
	while(i<K){
		if (a[j] == 0) j++;
		else {
			i += a[j]; a[j] = 0;
		}
	}
	cout << j << endl;
}

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

int main(){
  int N;
  cin>>N;
  set<long long> t;
  for(int i=0;i<N;i++){
    long long a,b,c;
    cin>>a>>b>>c;
    long long sum=a*a*a+b*b*b+c*c*c;
    t.insert(sum);
  }
  cout<<N-t.size()<<endl;
}

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

long MAX(vector<long> V){
long M=0;
REP(i, V.size()){ M=max(M, V[i]); }
return M;
}

int main(){
int R, C, K; cin >> R >> C >> K; int r, c, A=R+1, B=C+1; long v;
vector< vector<long> > f(A, vector<long>(B));
REP(i, K){ cin >> r >> c >> v; f[r][c]=v; }
vector< vector< vector<long> > > ans(4, vector< vector<long> >(A, vector<long>(B)));
REP(k, 4)REP(i, A)REP(j, B)ans[k][i][j]=0;
for(int i=1; i<=R; i++){ for(int j=1; j<=C; j++){
  v=f[i][j];
  if(v){ 
    ans[0][i][j]=MAX({ans[0][i-1][j], ans[1][i-1][j], ans[2][i-1][j], ans[3][i-1][j], ans[0][i][j-1]});
    ans[1][i][j]=MAX({ans[1][i][j-1], ans[0][i][j-1]+v, ans[0][i-1][j]+v, ans[1][i-1][j]+v, ans[2][i-1][j]+v, ans[3][i-1][j]+v});
    ans[2][i][j]=MAX({ans[2][i][j-1], ans[1][i][j-1]+v});
    ans[3][i][j]=MAX({ans[3][i][j-1], ans[2][i][j-1]+v});
  }
  else{ 
    ans[0][i][j]=MAX({ans[0][i-1][j], ans[1][i-1][j], ans[2][i-1][j], ans[3][i-1][j], ans[0][i][j-1]});
    ans[1][i][j]=ans[1][i][j-1]; ans[2][i][j]=ans[2][i][j-1]; ans[3][i][j]=ans[3][i][j-1];
  }
} }
cout << MAX({ans[0][R][C], ans[1][R][C], ans[2][R][C], ans[3][R][C]}) << "\n";
}

Measured memory_bytes: 425744
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int  n;
  cin >> n;
  int count = 0;
  int array_mochi[100];
  for(int i=0;i<n;i++){
    array_mochi[i] = 0;
  }
  for(int i=0;i<n;i++){
      bool flag = false;
      int mochi;
      cin >> mochi;
      for(int j=0;j<n;j++){
        if(array_mochi[j] == mochi){
          flag = true;
          break;
        }
      }
      if(flag == false){
        array_mochi[count] = mochi;
        count++;
      }
  }

  cout << count << "\n";

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

int main() {
    ll n,x;
    cin>>n;
    x=n%11;
    if(x==0)
        cout<<n/11*2<<endl;
    else if(1<=x&&x<=6)
        cout<<n/11*2+1<<endl;
    else if(6<x&&x<=10)
        cout<<n/11*2+2<<endl;
}

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

using namespace std;

#define print(s) cout << (s) << endl;
#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n) 
#define all(a) a.begin(), (a).end()
#define inf = 9876543210
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A, B, C; cin >> A>> B>> C;
    int ans = max<int>({
        10 * A + B + C,
        A + 10 * B + C,
        A + B + 10 * C,
    });
    cout << ans << endl;    
return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main() {
	int n, a, b;
  	int min, train, taxi;
  	
	scanf("%d %d %d", &n, &a, &b);
  	
  	train = n*a;
    taxi = b;
  
  	if(train<taxi){
      min = train;
    }else if(train>taxi){
      min = taxi;
    }else{
      min = taxi;
    }
  
	printf("%d\n", min);
}

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

inline int64_t F(int64_t x, int64_t k, int64_t l) {
  return -x * x + (k + 1 + l) * x;
}

// max { F(x,k,l) } を計算する。ただしxは1以上k以下の整数。
int64_t FindMaximumValue(int64_t k, int64_t l) {
  int64_t lb = 1, ub = k;
  while (ub - lb > 1) {
    int64_t mid = (ub + lb) / 2;

    if (F(mid, k, l) >= F(mid + 1, k, l)) ub = mid;
    else lb = mid;
  }
  return F(ub, k, l);
}

int64_t BinarySearch(int64_t me, int64_t other) {
  int64_t lb = 0, ub = me;
  while (ub - lb > 1) {
    int64_t mid = (ub + lb) / 2;

    if (FindMaximumValue(mid, other) < me * other) lb = mid;
    else ub = mid;
  }
  return lb;
}

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

  for (int i = 0; i < q; i++) {
    int64_t a, b;
    cin >> a >> b;

    int64_t a_bound = BinarySearch(a, b),
            b_bound = BinarySearch(b, a);
    
    // cerr << "a_bound " << a_bound << " b_bound " << b_bound << endl;
    
    cout << a_bound + b_bound + min(a - 1 - a_bound, b - 1 - b_bound) << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val k = sc.nextInt()
    val set = mutableSetOf<Int>()
    repeat(k) {
        set.add(Math.min(a + it, b))
        set.add(Math.max(b - it, a))
    }
    for (x in set.sorted()) {
        println(x)
    }
}

Measured memory_bytes: 33996
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let a = get!([isize]);
    
    if a.iter().any(|&e| e == 0) {
        println!("{}", a.into_iter().map(|e| e.abs()).sum::<isize>());
        return;
    }
    let mnum  = a.iter().filter(|&&e| e<0).count();

    if mnum % 2 == 0 {
        println!("{}", a.into_iter().map(|e| e.abs()).sum::<isize>());
    } else {
        let asum = a.iter().map(|&e| e.abs()).sum::<isize>();
        println!("{}", asum - 2*a.into_iter().map(|e| e.abs()).min().unwrap());
    }


}


Measured memory_bytes: 12540
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define ll long long
#define coYes cout << "Yes" << endl
#define coYES cout << "YES" << endl
#define coyes cout << "yes" << endl
#define coNo cout << "No" << endl
#define coNO cout << "NO" << endl
#define cono cout << "no" << endl
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
int gcd(int a, int b){ //最大公約数
    if(a%b == 0){
        return b;
    }else{
    return gcd(b, a%b);
    }
}

int main(){
    ll n,a,b,c=0,sum=0;
    cin >> n >> a >> b;
    for(int i=0;i<n/(a+b);i++){
        sum+=a+b;
        c++;
    }
    //sum-=a+b;
    //c--;
    //cout << sum << endl;
    if(n-sum>=a){
        cout << c*a+a << endl;
        return 0;
    }else if(n-sum<a){
        cout << c*a+n-sum << endl; 
        return 0;
    }
}

Measured memory_bytes: 3576
using System;
public class SoT {
    public static void Main() {
        string[] read = new string[2];
        read = Console.ReadLine().Split(' ');
        int K = int.Parse(read[0]);
        int S = int.Parse(read[1]);
        /*int X = 0;
        int Y = 0;
        int Z = 0;*/
        int N = 0;
        for (int X = 0;X <= K;X++){
            if(X==S){
                N++;
                break;
            }
            for (int Y = 0; Y <= K; Y++) {
                if (X + Y == S) {
                    N++;
                    break;
                }
                if (X + Y + K >= S) {
                    N++;
                }
            }
        }
        Console.WriteLine(N);
    }
}

Measured memory_bytes: 2648
#include <cassert>
#include <iostream>
#include <queue>
#include <vector>
#include <tuple>

constexpr int INF = 1 << 30;

template <class T> inline bool chmax(T &a, const T &b) {
  return (a < b) ? a = b, true : false;
}

int main() {
  // Input
  int H, W;
  std::cin >> H >> W;
  std::vector<std::vector<char>> A(H, std::vector<char>(W));
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      std::cin >> A[i][j];

  // Initialization
  std::vector<std::vector<int>> dp(H, std::vector<int>(W, INF));
  std::vector<std::vector<bool>> visited(H, std::vector<bool>(W, false));
  std::queue<std::pair<int, int>> que;

  // Initial condition
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      if (A[i][j] == '#') {
        visited[i][j] = true;
        dp[i][j] = 0;
        que.push({i, j});
      }

  // DP main
  while (not que.empty()) {
    int i, j;
    std::tie(i, j) = que.front();
    que.pop();
    if (i - 1 >= 0 and not visited[i - 1][j]) {
      visited[i - 1][j] = true;
      dp[i - 1][j] = dp[i][j] + 1;
      que.push({i - 1, j});
    }
    if (i + 1 < H and not visited[i + 1][j]) {
      visited[i + 1][j] = true;
      dp[i + 1][j] = dp[i][j] + 1;
      que.push({i + 1, j});
    }
    if (j - 1 >= 0 and not visited[i][j - 1]) {
      visited[i][j - 1] = true;
      dp[i][j - 1] = dp[i][j] + 1;
      que.push({i, j - 1});
    }
    if (j + 1 < W and not visited[i][j + 1]) {
      visited[i][j + 1] = true;
      dp[i][j + 1] = dp[i][j] + 1;
      que.push({i, j + 1});
    }
  }

  // Output
  int res = 0;
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      chmax(res, dp[i][j]);
  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 13584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a*b)/2 << endl;
}

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

using namespace std;

int main()
{
    map<string,int>m;
    string s;
    int i,t,j,n,z;
    cin>>t;
    for (i=1;i<=t;++i){

        cin>>n;
        if (n==0){

            cin>>s>>z;
            m[s]=z;


        }
        else if(n==1){

            cin>>s;
            cout<<m[s]<<'\n';

        }
        else{

            cin>>s;
            m[s]=0;

        }

    }

    return 0;
}



Measured memory_bytes: 27692
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int a,z;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A'){
      a=i;
      break;
    }
  }
  for(int i=s.size()-1;i>=0;i--){
    if(s[i]=='Z'){
      z=i;
      break;
    }
  }
	cout << z-a+1 << endl;
}

Measured memory_bytes: 640
<?php
  list($h, $w) = explode(" ", trim(fgets(STDIN)));

  if($h==1 || $w==1){
    echo "1";
    exit;
  }

  if($h%2!=0 && $w%2!=0){
    echo intdiv($h*$w,2)+1;
  } else{
    echo intdiv($h*$w, 2);
  }
  exit;
  

Measured memory_bytes: 4728
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
int main()
{
   long long n;
    cin >> n;
 
    vector<long long> a(n);
    long long sum = 0;
    for(long long i = 0; i < n; i++){
        cin >> a[i];
        a[i] -= i+1;
    }
 
    sort(a.begin(), a.end());
 
    long long mid = a[n/2];
 
    for(long long i = 0; i < n; i++){
       sum += abs(a[i]-mid);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4844
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> A(n+1), B(m+1);
    for (int i = 0; i < n; ++i) {
        cin >> A[i+1];
        A[i+1] += A[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> B[i+1];
        B[i+1] += B[i];
    }
    int ans = 0;
    for (int i = 0; i <= n; ++i) {
        if(A[i] <= k){
            ans = max<int>(ans, i+(upper_bound(B.begin(),B.end(), k-A[i]) - B.begin())-1);
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define repi(i,n) for(int i=0;i<(int)(n);i++)
#define repd(i,n) for(int i=(int)(n);i>=0;i--)

int main()
{
    long N,K;
    cin >> N >> K;
    vector<int> enemy(N);
    repi(i,N){
        cin >> enemy[i];
    }
    sort(all(enemy));
    reverse(all(enemy));
    long Ans = 0;
    repi(i,N){
        if(i<K){
            continue;
        }else{
            Ans += enemy.at(i);
        }
    }
    cout << Ans << endl;
    return 0;
}

Measured memory_bytes: 1024
def resolve():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    a, b = [0], [0]
    for i in range(N):
        a.append(a[i] + A[i])
    for i in range(M):
        b.append(b[i] + B[i])

    count = 0
    j = M
    for i in range(N + 1):
        if a[i] > K:
            break
        while b[j] > K - a[i]:
            j -= 1
        count = max(count, i + j)
    print(count)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 47684
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  int a;
  int b;
  int c;
  int d;
  cin >> n;
  
  a = n/1000;
  b = (n-1000*a)/100;
  c = (n-1000*a-100*b)/10;
  d = n -1000*a-100*b-10*c;
 
  if (
    ((a==b) && (b==c)) || 
     ((b==c) && (c==d))
     ){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
int dh[4] = {-1, 0, 0, 1};
int dw[4] = {0, -1, 1, 0}; 
using P = pair<int, int>;
const double pi = acos(-1.0);

int main(){
  string s;
  cin>>s;
  vector<bool>ch(26);
  string ans="abcdefghijklmnopqrstuvwxyz";
  rep(i,s.size()){
    ch[s[i]-'a']=true;
  }
  rep(i,26){
    if(!ch[i]){cout<<ans[i]<<endl;return 0;}
  }

  cout<<"None"<<endl;
    
  return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    float D, T, S;
    cin >> D >> T >> S;
    float ans = D/S;
    cout << (ans<=T? "Yes": "No") << endl;
    return 0;
}


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


bool cmp(const pair < pair<ll,ll> , pair<ll,ll> > &p1, const pair < pair<ll,ll> , pair<ll,ll> > &p2) {
    if(p1.second.first == p2.second.first) {
        return p1.second.second < p2.second.second;
    } else {
        return p1.second.first < p2.second.first;
    }
}

int main() {
    ll n, m;
    cin >> n >> m;
    vector < pair <pair <ll, ll> , pair<ll, ll> > > v;
    for (int i = 1; i <= m; ++i)
    {
        ll x, y;
        cin >> x >> y;
        v.push_back({{i, 0},{x, y}});
    }

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

    ll curr = -1, cnt = 1;

    for (int i = 0; i < v.size(); ++i)
    {
        if(curr != v[i].second.first) {
            cnt = 1;
            curr = v[i].second.first;
            ll temp = curr * 1000000;
            temp += cnt;
            v[i].first.second = temp;
        } else {
            cnt++;
            ll temp = curr * 1000000;
            temp += cnt;
            v[i].first.second = temp;
        }
    }

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

    for (int i = 0; i < v.size(); ++i)
    {
        printf("%012lld\n", v[i].first.second);
    }



    return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
int main() {
	char s[20]; cin >> s;
	if (s[0] == 'Y'&&s[1] == 'A'&&s[2] == 'K'&&s[3] == 'I')cout << "Yes\n"; else cout << "No\n";
}

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

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define REPR(i,a) for(int i = a; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

int gcd(int a, int b){ return b ? gcd(b, a % b) : a; }
template<typename A> void printsn(A a){ cout << a << endl; }
template<typename A, typename... B> void printsn(A a, B... b){ cout << a << ' '; printsn(b...); }

int main(void) {

    int A, B;

    cin >> A >> B;

    if(A < 10 && B < 10) printsn(A * B);
    else printsn(-1);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 1000005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007LL
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define vll vector<ll>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
 
ll gcd(ll n1,ll n2){
	if(n2==0)
		return n1;
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	if(exponent<0) exponent+=MOD-1;
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
ll fact[MAX],ifact[MAX];
int main()
{
	fact[0]=1;
	ifact[0]=1;
	for(int i=1;i<MAX;i++)
	{
		fact[i]=(i*1LL*fact[i-1])%MOD;
		ifact[i]=powmod(fact[i],-1);
	}
	ll ans=0;
	int n;
	cin>>n;
	ll prev=0;
	for(int i=1;i<n;i++)
	{
		if(i-1>=n-i-1)
		{
			ll temp=fact[i-1]*ifact[n-i-1];
			temp%=MOD;
			temp*=ifact[i-1-n+i+1];
			temp%=MOD;
			temp*=fact[i];
			temp%=MOD;
			temp*=fact[n-i-1];
			temp%=MOD;
			ans+=i*(temp-prev+MOD);
			prev=temp;
			//cout<<i<<" "<<temp<<endl;
			ans%=MOD;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int n,k;
	cin>>n>>k;
	int a[100];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1,cmp);
	int ans=0;
	for(int i=1;i<=k;i++)
	{
		ans+=a[i];
	}
	cout<<ans<<endl;
}

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

int main(){
    int n, k, r, s, p; cin >> n >> k >> r >> s >> p;
    string a; cin >> a;
    ll ans = 0;
    vector<int> lis(n);
    int f = 0;
    for(int i = 0; i < k; i++){
        if(a[i] == 'r'){
            ans += p;
            f = 1;
        }else if(a[i] == 's'){
            ans += r;
            f = 2;
        }else if(a[i] == 'p'){
            ans += s;
            f = 3;
        }
        lis[i] = f;
    }
    for(int i = k; i < n; i++){
        if(a[i] == 'r'){
            ans += p;
            f = 1;
            if(lis[i-k] == 1){
                f = 0;
                ans -= p;
            }
        }else if(a[i] == 's'){
            ans += r;
            f = 2;
            if(lis[i-k] == 2){
                f = 0;
                ans -= r;
            }
        }else if(a[i] == 'p'){
            ans += s;
            f = 3;
            if(lis[i-k] == 3){
                f = 0;
                ans -= s;
            }
        }
        lis[i] = f;
    }
    cout << ans << endl;
}

Measured memory_bytes: 896
list = gets.chomp!.split(' ').map{|e| e.to_i}
list.sort!

count = 0
while true
    # 全て等しかったら回数を出力して終了
    if list.uniq.size == 1
        puts count
        break
    end
    
    # 最大ー最小が2以上なら最小に2足す
    if list[2] - list[0] >= 2
        list[0] += 2
    else
        list[0] += 1
        list[1] += 1
    end
    count += 1
    list.sort!
end

Measured memory_bytes: 1788
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}


fn is_X(s: &Vec<Vec<(char, u64)>>, i: usize) -> bool{
    return s[0][i].0 == s[1][i].0;
}

fn main(){
    let n: usize = read_as_vec()[0];

    let mut s: Vec<Vec<(char, u64)>> = Vec::new();

    s.push(read_as_string().chars().zip(vec![0;n].into_iter()).collect::<Vec<(char, u64)>>());
    s.push(read_as_string().chars().zip(vec![0;n].into_iter()).collect::<Vec<(char, u64)>>());

    //init
    let mut i = 0;
    let mut ans: u64;
    let mut is_prev_x: bool;

    if is_X(&s, i){
        ans = 3;
        i += 1;
        is_prev_x = true;
    }else{
        ans = 6;
        i += 2;
        is_prev_x = false;
    }

    while i < n{
        if is_X(&s, i){
            if is_prev_x{
                ans *= 2;
            }else{
                ans *= 1;
            }
            i += 1;
            is_prev_x = true;
        }else{
            if is_prev_x{
                ans *= 2;
            }else{
                ans *= 3;
            }
            i += 2;
            is_prev_x = false;
        }
        ans %= 1_000_000_007;
    }

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


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    char  c;
    cin >> c;
    if(c == 'a' || c == 'e' || c == 'i' || c == 'u' || c == 'o'){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
}


Measured memory_bytes: 256