akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<string>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n;
double dp[310][310][310];

double rec(int i, int j, int k) {
  if (dp[i][j][k] >= 0) return dp[i][j][k];
  if (i == 0 && j == 0 && k == 0) return 0;
  double res = 0;
  if (i > 0) res += rec(i-1,j,k)*i;
  if (j > 0) res += rec(i+1,j-1,k)*j;
  if (k > 0) res += rec(i,j+1,k-1)*k;
  res += n;
  res *= 1.0/(i+j+k);
  return dp[i][j][k] = res;
}

int main () {
  cin >> n;
  int one = 0, two = 0, three = 0;
  rep(i,n) {
    int a;
    cin >> a;
    if (a == 1) one++;
    else if (a == 2) two++;
    else three++;
  }
  memset(dp, -1, sizeof(dp));
  cout << fixed << setprecision(10) << rec(one,two,three) << endl;
  return 0;
}

Measured memory_bytes: 233088
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    // エントリポイント
    public static void main(String args[]) {
        doLogic();
    }

    // 定数
    private static final int TOP = 0;
    private static final int NORTH = 1;
    private static final int EAST = 2;
    private static final int SOUTH = 3;
    private static final int WEST = 4;

    // フィールド
    private static int sum = 1;
    private static int[] dice = new int[5]; // TOP, NORTH, EAST, SOUTH, WEST を保持

    /**
     * サイコロに対するコマンドを実行する。
     *
     * @param command コマンド
     */
    private static void doCommand(String command) {
        int tmp = 0;
        if ("Right".equals(command)) {
            tmp = dice[4];
            for (int j = 3; j >= 1; j--) {
                dice[j + 1] = dice[j];
            }
            dice[1] = tmp;

        } else if ("Left".equals(command)) {
            tmp = dice[1];
            for (int j = 1; j <= 3; j++) {
                dice[j] = dice[j + 1];
            }
            dice[4] = tmp;

        } else if ("North".equals(command)) {
            dice[NORTH] = dice[TOP];
            dice[TOP] = dice[SOUTH];
            dice[SOUTH] = 7 - dice[NORTH];

        } else if ("South".equals(command)) {
            dice[SOUTH] = dice[TOP];
            dice[TOP] = dice[NORTH];
            dice[NORTH] = 7 - dice[SOUTH];

        } else if ("East".equals(command)) {
            dice[EAST] = dice[TOP];
            dice[TOP] = dice[WEST];
            dice[WEST] = 7 - dice[EAST];

        } else if ("West".equals(command)) {
            dice[WEST] = dice[TOP];
            dice[TOP] = dice[EAST];
            dice[EAST] = 7 - dice[WEST];
        }
    }

    /**
     * 標準入力を1行読む（例外処理を切り出し）
     *
     * @param reader 入力ストリーム
     * @return 1行分のデータ
     */
    private static String readLine(BufferedReader reader) {
        String line = null;
        try {
            line = reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException();
        }
        return line;
    }

    /**
     * メインロジック
     *
     */
    private static void doLogic() {

        // 標準入力のストリームを作成する
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        String input = null;
        while (true) {
            input = readLine(reader);
            int loop = Integer.parseInt(input);

            // 終了判定を行う
            if (loop == 0) {
                break;
            }

            // 初期化する
            sum = 1;
            dice[0] = 1;
            dice[1] = 5;
            dice[2] = 3;
            dice[3] = 2;
            dice[4] = 4;

            // 指定された数だけコマンドを実行する
            for (int i = 0; i < loop; i++) {
                String command = readLine(reader);
                doCommand(command);
                sum += dice[0];
            }
            System.out.println(sum);

        }
    }
}

Measured memory_bytes: 21852
(n), *l,  = [list(s.split()) for s in open(0)]

sum_m = 0
for x, y in l:
    # print(x)
    # print(y)
    x = float(x)
    if y == 'JPY':
        sum_m += x
    if y == 'BTC':
        sum_m += (x * 380000.0)
        
print(sum_m)

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 210000

int hoge[MAX], fuga[MAX];
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	
	int N, a = 0, b = 0, c = 0, d = 0;
	int ans = INF;
	string s;
	
	cin>>N;
	
	cin>>s;
	
	for(int i = N-1; i >= 0; i--){
		hoge[i] += hoge[i+1];
		fuga[i] += fuga[i+1];
		if(s[i] == '.') hoge[i]++;
		if(s[i] == '#') fuga[i]++;
		// if(s[i] == '.')cout<<" --- "<<endl;
		// cout<<i<<" "<<hoge[i]<<endl;
	}
	for(int i = 0; i <= N; i++){
		ans = min(b+hoge[i],ans);
		
		// cout<<b<<" "<<hoge[i]<<endl;
		if(i != N &&s[i] == '.') a++;
		if(i != N &&s[i] == '#') b++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3732
from collections import Counter
import sys
from functools import reduce
N = int(input())
A = [int(_) for _ in input().split()]

if set(A) == {0}:
    print('Yes')
    sys.exit()

counter = Counter(A)

if len(counter) and len(set(counter.values())) == 1:
    if reduce(lambda x, y: x ^ y, counter.keys()) == 0:
        print('Yes')
        sys.exit()

if len(counter) == 2:  
    if 0 in counter.keys():
        if counter[0] == len(A) // 3:
            print('Yes')
            sys.exit()
print('No')

Measured memory_bytes: 14716
#include <stdio.h>

int main()
  {
    int x,y,a;

    scanf("%d %d",&x,&y);

    if(x>=y)
    {
      while(y != 0)
        {
          a=x%y;
          x=y;
          y=a;
        }
        printf("%d\n",x);
    }

    else
    {
      while(x != 0)
        {
          a=y%x;
          y=x;
          x=a;
        }
        printf("%d\n",y);

    }

    return 0;
  }



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,n,h) for(int i = n; i < h; ++i)
#define rep3(l,n,h) for(int l = n; l <= h; ++l)
typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;


int  main(void) {
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h.at(i);
    sort(h.begin(),h.end());
    int ans = 1e9;
    rep(i,n-k+1) ans = min(ans,h[i+k-1]-h[i]);
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define YESNO(i) puts((i)?"YES":"NO");
#define YesNo(i) puts((i)?"Yes":"No");
#define yesno(i) puts((i)?"yes":"no");
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;cin>>x;x-=400;
  ll ans=8-(x/200);
  print(ans);
  return 0;
}

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

int main() {
  int n;
  cin>>n;
  for (int i=1; i<=n; i++) {
    int a = i * 1.08;
    if (a == n) {
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<":("<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    long long ans = -1;
    long long x = 0;
    for(int i=0; i<n; ++i){
        long long d, c;
        cin >> d >> c;
        ans += c;
        x += d * c;
    }
    ans += (x - 1) / 9;
    cout << ans << endl;

    return 0;
}


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

int main()
{
    int num[3];
    for(int i=0;i<3;i++) cin>>num[i];
    sort(num,num+3);
    int Sum=0;
    for(int i=1;i<3;i++) Sum+=num[i]-num[i-1];
    cout<<Sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

#define mkp make_pair
#define eb emplace_back
#define sz(s) (int)(s.size())
 
vector < pair <int, int> > res;

main (){
	clog << "Ready\n";
	
	int n, k;
	cin >> n >> k;
	for (int i = 2; i <= n; ++ i) {
		#define eb emplace_back
		res.eb(mkp(1, i));
	}
	
	k -= (n - 1) * (n - 2) / 2;
	for (int i = 2; i <= n; ++ i) {
		for (int j = i + 1; j <= n; ++ j) {
			if (k < 0) {
				res.eb(mkp(i, j));
				++k;
			}
		}
	}
	
	if (k != 0)
		return cout << -1, 0;
		
	cout << sz(res) << '\n';
	for (auto to : res)
		cout << to.first << " " << to.second << '\n';
	
	cerr << '\n';
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<set>
using namespace std;

int main(){
    long long N;
    cin >> N;
    string S;
    set<string> setyo;
    for(long long i=1; i<=N; i++){
        cin >> S;
        setyo.insert(S);
    }
    cout << setyo.size() << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 19224
n1,n2,n3 = map(int,input().split(" "))

list1 = [list(map(int,input().split(" "))) for _ in range(n1)]
list2 = [list(map(int,input().split(" "))) for _ in range(n2)]

mat = [[0 for _ in range(n3)] for _ in range(n1)]

for i in range(n1):
	for j in range(n3):
		mat[i][j]= str(sum(list1[i][k] * list2[k][j] for k in range(n2)))

for m in mat:
	print(*m)



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

int main() {
	int a, b;
	cin >> a >> b;
	if (a > b) cout << "a > b" << endl;
	else if (a < b) cout << "a < b" << endl;
	else if (a == b) cout << "a == b" << endl;



	

	return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

#define pb push_back
#define ri(x) scanf("%d",&x)
#define rii(x,y) ri(x),ri(y)
#define ms(obj,val) memset(obj,val,sizeof(obj))
#define ms2(obj,val,sz) memset(obj,val,sizeof(obj[0])*sz)
#define FOR(i,f,t) for(int i=f;i<(int)t;i++)
#define FORR(i,f,t) for(int i=f;i>(int)t;i--)
#define f first
#define s second

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

const int MAXN=300;

int N;
ll ans=0;
int A[MAXN][MAXN];

int main() {
	ri(N);
	FOR(i,0,N) FOR(j,0,N) ri(A[i][j]);
	FOR(v,0,N) FOR(u,0,N) {
		bool good = true;
		bool possible = true;
		FOR(w,0,N) if(A[v][w] + A[w][u] <  A[v][u]) possible = false;
		FOR(w,0,N) if(w != v && w != u && A[v][w] + A[w][u] == A[v][u]) good = false;
		if(!possible) {
			printf("-1\n");
			return 0;
		}
		if(good) ans += A[v][u];
	}
	printf("%lld\n",ans / 2);
}


Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
#define nitro ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define pb push_back
#define int long long
#define F first
#define S second
using namespace std;

const int m=998244353;

signed main() {
	// your code goes here
	nitro;
	int t=1;
	//cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    int x,y,c=0,m=0;
	    while(n--)
	    {
	        cin>>x>>y;
	        if(x==y){
	        c++;
	        m=max(m,c);}
	        else
	        {
	            m=max(m,c);
	            c=0;
	        }
	    }
	    if(m>=3)
	    cout<<"Yes";
	    else
	    cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 3608
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
ans = 0
max = n
(1...n).each do |i|
  while(i*max >= n)
    max -= 1
  end
  ans += max
end
p ans

Measured memory_bytes: 14528
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int n,a[100010];
int gcd(int x,int y)
{
	if (!y)
	{
		return x;
	}
	else
	{
		return gcd(y,x%y);
	}
}
bool nim()
{
	long long s=0;
	bool f=false;
	int cnt=0;
	for (int i=1;i<=n;i++)
	{
		s+=a[i]-1;
		if (a[i]==1)
		{
			f=true;
		}
		if (a[i]&1)
		{
			cnt++;
		}
	}
	if (f)
	{
		return s%2;
	}
	if ((n-cnt)%2)
	{
		return true;
	}
	if (cnt==1)
	{
		for (int i=1;i<=n;i++)
		{
			if (a[i]&1)
			{
				a[i]--;
				break;
			}
		}
		int g=a[1];
		for (int i=2;i<=n;i++)
		{
			g=gcd(g,a[i]);
		}
		for (int i=1;i<=n;i++)
		{
			a[i]/=g;
		}
		return !(nim());
	}
	return false;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	if (nim())
	{
		puts("First");
	}
	else
	{
		puts("Second");
	}
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>

#define loop(i, num)  for (int i = 0; i < num; i++)

using namespace std;

int n;

vector<int> dist;

deque<int> todo;

int main() {
    
    cin >> n;
    
    dist.resize(n);
    
    loop (i, n) {
        
        dist[i] = 1e9 + 7;
        
    }
    
    dist[1] = 1;
    
    todo.push_back(1);
    
    while (todo.size()) {
        
        int tmp = todo.front();
        
        todo.pop_front();
        
        if (dist[(10 * tmp) % n] > dist[tmp]) {
            
            dist[(10 * tmp) % n] = dist[tmp];
            
            todo.push_front((10 * tmp) % n);
            
        }
        
        if (dist[(tmp + 1) % n] > dist[tmp] + 1) {
            
            dist[(tmp + 1) % n] = dist[tmp] + 1;
            
            todo.push_back((tmp + 1) % n);
            
        }
        
    }
    
    cout << dist[0] << endl;
    
    return 0;
    
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>

using namespace std;

int main(){
	int N;
	while(cin >> N){
		int a, b; cin >> a >> b;
		const int base = a - b;
		deque<int> dq;
		for(int i=0;i<=1000000;i++) dq.push_back(i);
		int sum = 0;
		for(int i=2;i<N-1;i++){
			int v; cin >> v;
			sum += v;
			for(int j=0;j<v;j++) dq.push_front(dq[2*j+1]);
		}
		int Q; cin >> Q;
		for(int i=0;i<Q;i++){
			int v; cin >> v;
			if(v >= sum){
				cout << (v-sum+base) << endl;
			} else {
				cout << (dq[v]+base) << endl;
			}
		}
	}
}


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

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main() {
  int n;
  string s;
  cin>>n>>s;
  int ans = 0;
  for(int i = 0; i < 1000; i++){
    string t;
    if(i < 10){t = "00" + to_string(i);}
    else if(i < 100){t = "0" + to_string(i);}
    else{t = to_string(i);}
    int res = 0;
    for(int j = 0; j < n; j++){
      if(s[j] == t[0] && res == 0){res = 1; continue;}
      else if(s[j] == t[1] && res == 1){res = 2; continue;}
      else if(s[j] == t[2] && res == 2){res = 0; ans++; break;}      
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    int n, count=0, divisor=0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        if (i%2 != 0) {
            for (int j = 1; j <= i; j++) {
                if (i%j == 0) {
                    divisor++;
                }
            }
            if (divisor >=8) {
                count++;
            }
            divisor = 0;

        }

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



    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0;i<s.size();i++){
        int count = 0;
        for(int j=i;j<s.size();j++){
            if(s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T'){
                count++;
            }else{
                break;
            }
        }
        if(count > ans){
            ans = count;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  rep(i, n) cin >> h.at(i);
  vector<bool> chk(n, false);
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    if(h.at(a) <= h.at(b)) chk.at(a) = true;
    if(h.at(b) <= h.at(a)) chk.at(b) = true;
  }
  int ans = 0;
  rep(i, n){
    if(chk.at(i) == false) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3772
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
  string s;
  cin >> s;
  mint a=0;
  mint ab=0;
  mint abc=0;
  mint all=1;
  rep(i,s.size()){
    if(s[i]=='A'){
      a+=all;
    }else if(s[i]=='B'){
      ab+=a;
    }else if(s[i]=='C'){
      abc+=ab;
    }else{
      abc=abc*3+ab;
      ab=ab*3+a;
      a=a*3+all;
      all*=3;
    }
  }
  cout << abc << endl;
}

Measured memory_bytes: 3260
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N, W := sc.nextInt(), sc.nextInt()
	w := make([]int, N)
	v := make([]int, N)
	for i := 0; i < N; i++ {
		w[i] = sc.nextInt()
		v[i] = sc.nextInt()
	}
	base := w[0]
	for i := 0; i < N; i++ {
		w[i] -= base
	}
	// dp[i][j][k]: i個目までからj個選んで重さをk以下にする時の最大価値
	var dp [101][101][301]int
	dp[0][0][0] = 0
	for i := 1; i <= N; i++ {
		for j := 1; j <= N; j++ {
			for k := 0; k <= 300; k++ {
				if w[i-1] <= k {
					dp[i][j][k] = max(dp[i-1][j][k], dp[i-1][j-1][k-w[i-1]]+v[i-1])
				} else {
					dp[i][j][k] = dp[i-1][j][k]
				}
			}
		}
	}
	ans := 0
	for i := 1; i <= N; i++ {
		rest := W - (base * i)
		if rest >= 0 {
			ans = max(ans, dp[N][i][min(rest, 300)])
		}
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 25344
# 全部+ min
# 全部- max
# +=混在 ・・真ん中？ → 0を含む場合は、 dont careかも！
def b
    n, l = gets.chomp.split(/\s/).map{|x| x.to_i}

    ifzero = false
    total = 0
    flaver = l
    apples = Array.new(n)
    apples.each_with_index do |apple,i|
        apples[i] = flaver
        ifzero = true if flaver == 0
        total += flaver
        flaver += 1
    end

#    p apples
    if ifzero
        p total
    else
        min = apples.min
        if min > 0
            p total-min
        else
            p total-apples.max
        end
    end
end

b

Measured memory_bytes: 1916
import java.util.Scanner;

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

        int[] b = new int[m];
        for (int i = 0; i < m; i++) {
            b[i] = sc.nextInt();
        }

        int cor = 0;
        for (int i = 0; i < n; i++) {
            int tmp = 0;
            for (int j = 0; j < m; j++) {
                int a = sc.nextInt();
//                System.out.println(a*b[j]);
                tmp += (a * b[j]);
            }
            tmp += c;
            if (0 < tmp) cor++;
        }
        System.out.println(cor);
    }
}


Measured memory_bytes: 22356
s = input()
n = len(s)

key = []
count = 1
for i in range(n-1):
  if s[i] != s[i+1]:
    key.append(count)
    count = 1
  else:
    count += 1
key.append(count)

sum_key = sum(key)
ans = 10000000
for i in range(len(key)):
    if i != 0:
        key[i] += key[i-1]
    ans = min(ans, max(key[i], n-key[i]))
  

print(ans)

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

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	double m;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	cin >> n;
	while (n >= 0) {
		n -= 3;
		ans++;
	}
	cout << ans-1;
}

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

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static void Main(string[] args)
        {
            int N = ReadInt();
            string S = Read();
            Console.WriteLine(N % 2 == 0 && S.Substring(0, N / 2) == S.Substring(N / 2) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;

int main(){
  int N,K;cin>>N>>K;
  string S;cin >>S;

  vi zero_endpts;
  vi one_endpts;
  

  for (int i=0;i<N;++i){
    if(i==N-1){
      if(S[i]=='0'){zero_endpts.push_back(i+1);}
      else{one_endpts.push_back(i+1);}
    }
    else{
      if(S[i]=='0'&&S[i+1]=='1'){zero_endpts.push_back(i+1);}
      else if (S[i]=='1'&&S[i+1]=='0'){one_endpts.push_back(i+1);}
    }
  }

  int ans=0;

  int M=zero_endpts.size();
  int L=one_endpts.size();

  if(M<=K){ans=N;}
  else if(L==0){ans=N;}
  else{
    if(S[0]=='0'){
      int best_score=one_endpts[K-1];
      for(int i=K;i<M;++i){
        if(zero_endpts[i]!=N){
          best_score=max(best_score,one_endpts[i]-zero_endpts[i-K]);
        }
        else{
          best_score=max(best_score, zero_endpts[i]-zero_endpts[i-K]);
        }
      }
      ans =best_score;
    }

    else{
      int best_score;
      if(L>=K+1){best_score=one_endpts[K];}
      else{best_score=N;}
      
      for (int i=K;i<M;++i){
        if(zero_endpts[i]!=N){
          best_score=max(best_score,one_endpts[i+1]-zero_endpts[i-K]);
        }
        else{
          best_score=max(best_score, zero_endpts[i]-zero_endpts[i-K]);
        }
      }
      ans=best_score;
    }

  }
  

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

Measured memory_bytes: 1020
x, y = map(int,input().split())
M = 1000000007

if (x + y) % 3 != 0:
    print(0)
    exit()

if max(x,y) / min(x,y) > 2:
    print(0)
    exit()

n = (x + y) // 3
xn = (2*x - y) // 3
yn = n - xn

fac = [1] * (n+1)
finv = [1] * (n+1)
inv = [1] * (n+1)
def com_init(n):
    for i in range(2, n+1):
        fac[i] = fac[i - 1] * i % M
        inv[i] = M- inv[M % i] * (M // i) % M
        finv[i] = finv[i - 1] * inv[i] % M
com_init(n)
def solve(n, k):
    return fac[n] * (finv[k] * finv[n - k] % M) % M

ans = solve(n, yn)
print(ans)

Measured memory_bytes: 84084
<?php

fscanf(STDIN, "%d %d %d", $N, $A, $B);

if ($A > $B) {
    echo "0\n";
    exit;
}

if ($N == 1) {
    if ($A != $B) {
        echo "0\n";
        exit;
    }
}

$mmin = $A * ($N - 1) + $B;
$mmax = $A + $B * ($N -1);

echo ($mmax - $mmin + 1) . PHP_EOL;


Measured memory_bytes: 4728
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI acos(-1)
#define sz 100010
#define RUN_FAST ios::sync_with_stdio(false);
using namespace std;

int main()
{
    int n, i, j, sum, ans, tmp, up;
    scanf("%d", &n);
    int arr[n];
    for (i=0; i<n; i++) scanf("%d", &arr[i]);

    sort(arr, arr+n);
    up=arr[n-1];
    up++;
    ans=1000000000;
    for (i=arr[0]; i<up; i++) {
        sum=0;
        for (j=0; j<n; j++) {
            tmp=arr[j]-i;
            sum+=tmp*tmp;
        }
        ans=min(ans, sum);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <cmath>
#include <stdint.h>
#include <iomanip>
#include <vector>
#include <queue>
using namespace std;
 
#define int long long
#define INF 1001001001

int arr[200001];
 
int nChoosek( int n, int k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i;
    }
    return result;
}

int choose2(int n){
	
	return n*(n-1)/2;
}

int32_t main() {
	
 	int A,B;
 	
 	cin >> A >>B;
 	
 	int res = -1;
 	for(int i=0; i<=INT_MAX; i++){
 		
 		int ans = floor(i*0.08);
 		int ans2 = floor(i*0.1);
 		
 		if(ans == A && ans2 == B){
 			res = i;
 			break;
		 }
		 else if( ans > A && ans2 > B){
 			break;
		 }
	 }
    
    
 	cout << res << endl;
 	
}

Measured memory_bytes: 3228
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#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 gg(x) getInt(&x)
using namespace std;
typedef long long ll;
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
ll n;
ll a[maxn];
ll b[maxn];
ll c[maxn];
ll dp[maxn][5];

int main()
{
    gbtb;
    cin>>n;
    repd(i,1,n)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[1][1]=a[1];
    dp[1][2]=b[1];
    dp[1][3]=c[1];
    repd(i,2,n)
    {
        dp[i][1]+=max(dp[i-1][2],dp[i-1][3])+a[i];
        dp[i][2]+=max(dp[i-1][1],dp[i-1][3])+b[i];
        dp[i][3]+=max(dp[i-1][1],dp[i-1][2])+c[i];
    }
    cout<<max(dp[n][3],max(dp[n][1],dp[n][2]));
    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: 14592
#include <bits/stdc++.h>

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	ll ans = 0, march[5] = {}, N;
	
	cin >> N;

	for(int i=0; i<N; i++){
		string S;
		cin >> S;
		if(S[0] == 'M')
			march[0]++;
		else if(S[0] == 'A')
			march[1]++;
		else if(S[0] == 'R')
			march[2]++;
		else if(S[0] == 'C')
			march[3]++;
		else if(S[0] == 'H')
			march[4]++;
	}
	
	ans += march[0] * march[1] * march[2];
	ans += march[0] * march[1] * march[3];
	ans += march[0] * march[1] * march[4];
	ans += march[0] * march[2] * march[3];
	ans += march[0] * march[2] * march[4];
	ans += march[0] * march[3] * march[4];
	ans += march[1] * march[2] * march[3];
	ans += march[1] * march[2] * march[4];
	ans += march[1] * march[3] * march[4];
	ans += march[2] * march[3] * march[4];
	
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int d = scan.nextInt();
		scan.close();

		int l1, l2, l3;
		if(a - c >= 0) {
			l1 = a - c;
		}else {
			l1 = c - a;
		}
		if(b - c > 0) {
			l2 = b - c;
		}else {
			l2 = c - b;
		}
		if(a - b > 0) {
			l3 = a - b;
		}else {
			l3 = b - a;
		}
		if(l1 <= d) {
			System.out.println("Yes");
		}else {
			if(l2 <= d && l3 <= d) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main()
{
    string s;
    while(cin>>s)
    {
        int n1=0,n2=0,n3=0;
        for(int i=0;i<3;i++)
        {
            if(s[i]=='a')
                n1++;
            else if(s[i]=='b')
                n2++;
            else if(s[i]=='c')
                n3++;
        }
        if(n1*n2*n3!=0)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int n;
int arr[200001];
int dp[200001];
int pos[200001];
int main() {
    scanf("%d", &n);
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        scanf("%d", arr + i);
        if (arr[i] != 1 && pos[arr[i] - 1]) {
            dp[i] = dp[pos[arr[i] - 1]] + 1;
        }
        else dp[i] = 1;
        pos[arr[i]] = i;
        ans = max(ans, dp[i]);
    }
    printf("%d\n", n - ans);
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <iomanip>
#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 = uint32_t;
using namespace std;

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

int main() {
    int n, l;
    while(cin >> n >> l, n){
        array<int, 150> a{}, b{};
        for (int i = 0; i < n; ++i) {
            char c; int d;
            cin >> c >> d;
            if(c == 'L') a[d] = i+1;
            else b[d] = i+1;
        }
        int last = 0, t = 0;
        while(true){
            if (max(*max_element(a.begin(),a.end()), *max_element(b.begin(),b.end())) == 0) break;
            for (int i = l; i > 0; --i) {
                b[i] = b[i-1];
            }
            for (int i = 0; i < l; ++i) {
                a[i] = a[i+1];
            }
            if(b[l] > 0) last = b[l];
            if(a[0] > 0) last = a[0];

            for (int i = 1; i < l; ++i) {
                if(a[i] > 0 && b[i] > 0) swap(a[i], b[i]);
            }
            t++;
        }
        printf("%d %d\n", t-1, last);
    }
    return 0;
}


Measured memory_bytes: 3136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		long sum = 0;

		while(true){
			sum = 0;
			String str = br.readLine();
			if(str.length() >= 1){
				if(str.equals("0")){
					break;
				}
				for(int i = 0; i < str.length(); i++){
					sum += Integer.parseInt(String.valueOf(str.charAt(i)));
				}
			}
			System.out.println(sum);
		}
	}
}

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

vector<int> adj[int(1e5)];
vector<int> dp(int(1e5), -1);
vector<bool> start(int(1e5), true);
int dfs(int node) {
  if (dp[node] != -1) {
    return dp[node];
  }
  dp[node] = 0;
  for (int i = 0; i < adj[node].size(); i++) {
    dp[node] = max(dp[node], 1 + dfs(adj[node][i]));
  }
  return dp[node];
}

int main() {
  int n, m; cin >> n >> m;
  int x, y;
  while (m--) {
    cin >> x >> y;
    adj[--x].push_back(--y);
    start[y] = false;
  }
  int answer = 0;
  for (int i = 0; i < n; i++) {
    if (start[i]) {
      answer = max(answer, dfs(i));
    }
  }
  cout << answer;
}

Measured memory_bytes: 10752
N = int(input())
A = list(map(int,input().split()))

L={}
R={}
for i in range(1,len(A)+1):
  L[str(i+A[i-1])] = L.get(str(i+A[i-1]),0)+1
  R[str(i-A[i-1])] = R.get(str(i-A[i-1]),0)+1

ans = 0
for i in range(1,N+1):
  if str(i) in L and str(i) in R:
    ans += L[str(i)] * R[str(i)]

print(ans)


Measured memory_bytes: 67656
s = gets.chomp
if s == "hi"
  puts "Yes"
elsif s == "hihi"
  puts "Yes"
elsif s == "hihihi"
  puts "Yes"
elsif s == "hihihihi"
  puts "Yes"
elsif s == "hihihihihi"
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 1788
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;
//using Graph = vector<vector<int>>;

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<string, int> P;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#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 SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define REP(i,n)  for(int i=0; i<(n); i++)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/

//int Counter(int x)
/*int factorial(int n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}*/
int factorial(int n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}
LL sum(LL a, LL b){
    LL cnt=0;
    cnt=(b-a+1)*(a+b)/2;
    return cnt;
}
/*LL yaku(int x){
    vector<pair<LL, LL> a=[];
    LL xh;
    if(x==1){
        pair<LL, LL> tmp;
        tmp=MP(1,1);
        return tmp;
    }
    else{
        FOR(i, 1, x/2+1){
            if(x%i==0){
                a.append(MP(i,x/i));
            }
        }
    }
    return a;

}*/
LL cul(int a, int b){
    LL f = pow(a,4)+pow(a,3)*b+pow(a,2)*pow(b,2)+a*pow(b,3)+pow(b,4);
    return f;
} 
int main(){
    int x, y, r, w, h;
    cin >> w >> h >> x >> y >> r;
    bool f = true;
    if(x-r<0||x+r>w||y-r<0||y+r>h) f=false;
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}
    





Measured memory_bytes: 3104
import java.util.*;

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

    while(T-- > 0){
      String s = sc.nextLine().replaceAll("Hoshino", "Hoshina");
      System.out.println(s);
    }
  }
}

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

typedef long long ll;

int main() {
    string S, ans = "Yes\n";
    cin >> S;
    int N = S.size();
    rep(i, (N - 1) / 2) {
        if (S[i] != S[N - 1 - i]) ans = "No\n";
    }
    rep(i, (N - 1) / 4) {
        if (S[i] != S[(N - 1) / 2 - 1 - i]) ans = "No\n";
    }
    cout << ans;
}

Measured memory_bytes: 256
read N
read W

sum=$(echo $W | tr ' ' '\n' | awk '{sum+=$1} END {print sum}')

acc=0
ans=''
for x in $W
do
    acc=$(($acc+$x))
    rest=$(($sum-$acc))
    if [ $acc -gt $rest ]; then
        V=$(($acc-$rest))
    else
        V=$(($rest-$acc))
    fi
    ans=$(echo $ans $V)
done

echo $ans | tr ' ' '\n' | sort -n | head -n1

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;

#define pb push_back

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define vin(v, n) for (int i = 0; i < (ll)(n); i++) cin >> (v)[i];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int x,n;
    cin>>x>>n;
    int xi=x,xd=x;
    int flagi=0,flagd=0;
    vll v(n);
    vin(v, n);
    do{
        flagi=0;
        flagd=0;
        for(int i=0; i<n; i++){
            if(v[i]==xi){
                xi++;
                flagi=1;
                break;
            }
        }
        for(int i=0; i<n; i++){
            if(v[i]==xd){
                xd--;
                flagd=1;
                break;
            }
        }
    }while(flagi && flagd);
    if(xi-x>=x-xd&&flagd==0)
        cout<<xd<<endl;
    else if(n!=0 && flagi==0)
        cout<<xi<<endl;
}


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

int main(){
  int N;
  cin >>N;
  vector<int> a(N);
  int i;
  
  for(i=0;i<N;i++){
    cin >>a.at(i);
  }
  sort(a.begin(),a.end(),greater<int>());
  int sum=1;
  for(i=1;i<N;i++){
    if(a.at(i)<a.at(i-1)){
     sum+=1 ;
    } 
      
  }
    cout <<sum <<endl;
}
    
    
    
  

Measured memory_bytes: 256
main(x,y,z,e,m){for(;scanf("%d",&e),e;printf("%d\n",m))for(m=e,z=0;z*z*z<=e;z++)for(y=0;y*y+z*z*z<=e;y++)if(x=e-z*z*z-y*y,m>x+y+z)m=x+y+z;exit(0);}

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

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	vector<string> ans(100);
	for (int i = 0; i < 50; i++)
		ans[i].resize(100, '#');
	for (int i = 50; i < 100; i++)
		ans[i].resize(100, '.');
	int x = 0, y = 0;
	for (int i = 0; i < a - 1; i++)
	{
		ans[y][x] = '.';
		x += 2;
		if (99 < x)
		{
			y += 2;
			x = 0;
		}
	}
	x = 0, y = 51;
	for (int i = 0; i < b - 1; i++)
	{
		ans[y][x] = '#';
		x += 2;
		if (99 < x)
		{
			y += 2;
			x = 0;
		}
	}
	cout << 100 << " " << 100 << endl;
	for (int i = 0; i < 100; i++)
		cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 256