akhauriyash/Code-Regression huggingface dataset:
c = [[int(i) for i in input().split()] for _ in range(3)]

if c[0][0] + c[1][1] != c[0][1] + c[1][0] :
    print('No')
    exit()
if c[0][1] + c[1][2] != c[0][2] + c[1][1] :
    print('No')
    exit()
if c[1][0] + c[2][1] != c[2][0] + c[1][1] :
    print('No')
    exit()
if c[1][1] + c[2][2] != c[2][1] + c[1][2] :
    print('No')
    exit()

print('Yes')

Measured memory_bytes: 3064
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.charAt(0) != 'A'){
            System.out.println("WA");
        }else{
            int n = 0;
            for(int i = 2; i < s.length()-1; i++){
                if(s.charAt(i) == 'C'){
                    n++;
                }
            }
            if (n != 1) {
                System.out.println("WA");
            }else{
                int m = 0;
                for(int i = 1; i < s.length(); i++){
                    if(Character.isUpperCase(s.charAt(i))){
                        m++;
                    }
                }
                if (m != 1) {
                    System.out.println("WA");
                }else{
                    System.out.println("AC");
                }
            }
        }
    }
}

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

#define int long long
//#define uint __int128_t

#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int N;
int a[22][22];
int dp[22][(1<<22)];


signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    cin>>N;
    rep(i,0,N)rep(j,0,N)cin>>a[i][j];
    
    dp[0][0]=1;
    rep(i,0,N){
        rep(j,0,(1<<N)){
            if(dp[i][j]==0)continue;
            rep(k,0,N){
                if((1<<k)&j)continue;
                if(a[i][k]==0)continue;
                (dp[i+1][j|(1<<k)]+=dp[i][j])%=MOD;
            }
        }
    }
    cout<<dp[N][(1<<N)-1]<<endl;
    //rep(i,0,N)rep(j,0,(1<<N))cout<<i+1<<" "<<j<<" "<<dp[i+1][j]<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}


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

int main(){
	int n;cin >> n;
	bool flg=false;
	for(int i=0;i<n;++i){
		char c;
		cin >> c;
		if(c=='Y') flg=true;
	}
	if(flg) cout << "Four" << endl;
	else cout << "Three" << endl;
}

Measured memory_bytes: 256
L, R = map(int, input().split())
min_mod = L*R
if R-L > 2019:
    print(0)
else:
    for i in range(L, R):
        for j in range(i+1, R+1):
            min_mod = min(min_mod, (i*j) % 2019)
    print(min_mod)

Measured memory_bytes: 2940
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
        int b = sc.nextInt();
        
        if((a*b)%2==0)System.out.print("No");
        else System.out.print("Yes");
	}
}

Measured memory_bytes: 20948
n = int(input())
ans = 0
def cou(n):
  d = 0
  for i in range(1,n+1):
    if n % i == 0:
      d += 1
  return(d)
for j in range(1,n+1,2):
  if cou(j) == 8:
    ans += 1
print(ans)
  
  



Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
int X[3];

int main(){
	for(int i=0; i<3; i++) cin >> X[i];
	sort(X, X+3);

	int ans = 0;
	while(X[0]+2<=X[1]){
		ans += 1;
		X[0] += 2;
	}
	while(X[1]+1<=X[2]){
		ans += 1;
		X[0] += 1;
		X[1] += 1;
	}
	if(X[0]<X[1]){
		ans += 2;
	}
	cout << ans << endl;


	return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	
    vector<int> data(n);
    for(int i=0; i < n+1; i++) {
        cin >> data[i];
    }

    ll total = 0;
    for(int i=0; i < n; i++) {
        int num;
        cin >> num;

        int del = min(num, data[i]);
        data[i] -= del;
        num -= del;
        total += del;

        del = min(num, data[i+1]);
        data[i+1] -= del;
        total += del;
    }

    cout << total;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int A[n + 1], B[n + 1];
    for(int i = 0; i < n; i++) cin >> A[i] >> B[i];
    ll a = 1, b = 1;
    for(int i = 0; i < n; i++)
    {
        ll tmp1 = (a % A[i] ? a / A[i] + 1 : a / A[i]);
        ll tmp2 = (b % B[i] ? b / B[i] + 1 : b / B[i]);
        ll n = max(tmp1, tmp2);
        a = A[i] * n;
        b = B[i] * n;
    }
    cout << a + b << endl;
	return 0;
}



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

int main() {
    ll N;
    cin >> N;
    vector<ll> S(N);
    for (ll i = 0; i < N; i++) {
        cin >> S[i];
    }

    auto isOK = [N](ll x) {
        return 0 <= x && x < N;
    };

    ll ans = 0;
    for (ll C = 1; C < N; C++) {
        vector<bool> visit(N, false);
        ll l = 0, r = N - 1;
        ll score = 0;
        while (true) {
            l += C;
            r -= C;
            if (!isOK(l) || !isOK(r) || visit[l] || visit[r] || l == r || r < C) {
                break;
            }
            visit[l] = visit[r] = true;
            score += S[l] + S[r];
            ans = max(ans, score);
        }
    }

    cout << ans << endl;
}

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

using namespace std;

int smaller(int a,int b){
    if(a<b)return a;
    else return b;
}

int main(){
    int N;
    cin >> N;
    vector<int> h(N+2);
    for(int i=0;i<N;i++){
        cin >> h[i];
    }
    vector<int> dp(N+2);
    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]);
    int i = 2;
    while(true){
        dp[i] = smaller(abs(h[i-1]-h[i])+dp[i-1],abs(h[i-2]-h[i])+dp[i-2]);
        i++;
        if(i>=N)break;
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int mod=1e9+7;

int main() {
 int N,M;
 cin>>N>>M;
 if(abs(N-M)>=2){cout<<0<<endl;}
 else{
    int64_t r=1,l=1;
    for(int i=1;i<=N;i++){
      (r*=i)%=mod;
    }
    for(int i=1;i<=M;i++){
      (l*=i)%=mod;
    }
    if(abs(N-M)==0){
      cout<<2*r*l%mod<<endl;
    }
    else{cout<<r*l%mod<<endl;}
 }
 return 0;  
}

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

int main(){
	using ll = long long;
	ll a, b, c;
	cin >> a >> b >> c;
	if(a == b && b == c && (a & 1)){
		cout << 0 << endl;
		return 0;
	}else if(a == b && b == c){
		cout << -1 << endl;
		return 0;
	}
	ll ans = 0;
	while(!(a & 1) && !(b & 1) && !(c & 1)){
		ll aa = b / 2 + c / 2, bb = a / 2 + c / 2, cc = a / 2 + b / 2;
		a = aa;
		b = bb;
		c = cc;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <climits>
#define INF (LLONG_MAX>>2)
using namespace std;

typedef long long ll;

const int nlimit=1005;
int n, m;
int a[nlimit*2], b[nlimit*2];
ll c[nlimit*2];

void solve();
int main(){
  cin >> n >> m;
  ll tempc;
  for(int i=1; i<=m; i++){
    cin >> a[i] >> b[i] >> tempc;
    c[i] = -tempc;
  }

  solve();

  return 0;
}

void solve(){
  ll dist[n];
  for(int i=1; i<=n; i++) dist[i] = INF;
  dist[1] = 0;

  for(int i=1; i<=n-1; i++){
    for(int j=1; j<=m; j++){
      if(dist[a[j]]!=INF && (dist[b[j]] > dist[a[j]] + c[j])){
        dist[b[j]] = dist[a[j]] + c[j];
      }
    }
  }

  bool isNeg[n+1];
  for(int i=1; i<=n; i++) isNeg[i] = false;

  for(int i=1; i<=n; i++){
    for(int j=1; j<=m; j++){
      if(dist[a[j]]!=INF && (dist[b[j]] > dist[a[j]] + c[j])){
        isNeg[b[j]] = true;
      }

      if(isNeg[a[j]]) isNeg[b[j]] = true;
    }
  }

  cout << ((isNeg[n])? "inf": to_string(-dist[n])) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  for(int i=1;i<=9;i++)
  {
    for(int j=1;j<=9;j++)
    {
      if((i*j)==n)
      {cout<<"Yes\n";return 0;}
    }
  }
  cout<<"No\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD=1e9+7;
ll INF=1e18;
int main(){
  int n,m;
  cin>>n>>m;
  ll dis[110][110],dist[110][110];
  for(int i=0; i<n;  i++){
    for(int j=0; j<n; j++){
      if(i==j){dis[i][j]=0;}
      else {dis[i][j]=INF;}
    }
  }
  int a[m+1],b[m+1],c[m+1];
  for(int i=0; i<m; i++){
    cin>>a[i]>>b[i]>>c[i];
    a[i]--,b[i]--;
    dis[a[i]][b[i]]=c[i];
    dis[b[i]][a[i]]=c[i];
  }
  ll ans=0;
  if(n-1==m){
      cout<<0<<endl;
  }
  else{
  	for(int k=0; k<n; k++){
    	for(int i=0; i<n; i++){
      		for(int j=0; j<n; j++){
        		dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
      		}
    	}
  	}
  	for(int i=0; i<m; i++){
    	if(dis[a[i]][b[i]]!=c[i]){ans++;}
  	}
    cout<<ans<<endl;
  }
}
      	
    
      

Measured memory_bytes: 384
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        for(int X=0; X<50000; X++) {
            int tmp = X * 108 / 100;
//            System.out.println(String.format("%d, %d", X, tmp));
            if(N==tmp) {
                System.out.println(String.format("%d", X));
                return;
            }
        }
        System.out.println(String.format(":("));
    }
}


Measured memory_bytes: 23764
#include <iostream>
using namespace std;
int main(){
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << x2+y1-y2 <<" "<< y2-x1+x2 << " "<<x1+y1-y2 << " "<< y1-x1+x2;
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
readline = sys.stdin.readline

K = int(readline())

inf = 10**9+7
dist = [inf]*(K+1)
dist[K] = 0
Q = deque([K])
used = [False]*(K+1)
while Q:
    vn = Q.pop()
    if used[vn]:
        continue
    used[vn] = True
    vf = (vn*10)%K
    if vn%K and not used[vf]:
        dist[vf] = min(dist[vf], dist[vn])
        Q.append(vf)
    vf = (vn+1)%K
    if not used[(vn+1)%K]:
        dist[vf] = min(dist[vf], 1+dist[vn])
        Q.appendleft(vf)
print(dist[0])        


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

int cc[10010] = {};
int isprime[10010];

int main() {
    isprime[0] = isprime[1] = 1;
    for(int i = 4; i<=10000; i+=2) isprime[i] = 1;
    for(int i=3; i*i<=10000; i+=2)
        if(isprime[i] == 0)
            for(int j=2; i*j<=10000; ++j)
                isprime[i*j] = 1;

    int x = 2;
    cc[2] = 1;
    for(int j=3; x <= 10000; j+=2) {
        if(isprime[j]) continue;
        x += j;
        cc[x]++;
    }

    for(int i=3; i<=10000; i+=2) {
        if(isprime[i]) continue;
        int x = i;
        cc[i]++;
        for(int j=i+1; j <= 10000 && x <= 10000; ++j) {
            if(isprime[j]) continue;
            x += j;
            if(x >= 10000) break;
            cc[x]++;
        }
    }
    int n;
    while(cin>>n, n) {
        cout<<cc[n]<<endl;
    }
}

Measured memory_bytes: 0
package main

import "fmt"

func main() {
	var S, H, C, D [13]int
	var spades string
	var n, card int
	fmt.Scan(&n)
	for i := 0; i < n; i++{		
		fmt.Scan(&spades, &card)
		switch spades {
		case "S":
			S[card - 1] = card
		case "H":
			H[card - 1] = card
		case "C":
			C[card - 1] = card
		case "D":
			D[card - 1] = card
		}		
	}
	
	for i, v := range S {
		if v == 0 {
			fmt.Printf("S %d\n", i + 1)
		}
	}
	for i, v := range H {
		if v == 0 {
			fmt.Printf("H %d\n", i + 1)
		}
	}
	for i, v := range C {
		if v == 0 {
			fmt.Printf("C %d\n", i + 1)
		}
	}
	for i, v := range D {
		if v == 0 {
			fmt.Printf("D %d\n", i + 1)
		}
	}
}


Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<algorithm>

#define ll long long
#define dl double
#define mod 1000000007
#define sz 1005
#define szz 150

using namespace std;

int main()
{
    ll r,g;

    scanf("%lld %lld",&r,&g);

    printf("%lld\n",(2*g)-r);

    return (0);
}


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

int main()
{
    long long n,k;
    std::map<long long,long long> mp;
    std::cin>>n>>k;
    for(long long i=0;i<n;i++){
        long long a,b;
        std::cin>>a>>b;
        mp[a] += b;
    }
    long long res;
    long long cnt = 0;
    for(auto i : mp){
        cnt += i.second;
        if(cnt>=k){
            res = i.first;
            break;
        }
    }
    std::cout<<res<<std::endl;
}

Measured memory_bytes: 4224
import sys
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    A, B, C = map(int, input().strip().split())
    rems = set()
    for i in range(0, 101):
        v = (A * i) % B
        if v == C:
            print("YES")
            return
        if v in rems:
            print("NO")
            return
        rems.add(v)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.Scanner;

//YAML
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		String[] ps = sc.nextLine().split("\\.");
		char[][] s = new char[15000][];
		int n = 0;
		while(sc.hasNext()){
			s[n++] = sc.nextLine().toCharArray();
		}
		int now = 0, indent = 0;
		for(int i=1;i<ps.length;i++){
			boolean find = false;
			while(now < n){
				int cnt = 0, idx = 0;
				while(s[now][idx]==' '){
					cnt++; idx++;
				}
				if(cnt < indent){
					System.out.println("no such property"); return;
				}
				else if(cnt==indent){
					String name = "";
					while(s[now][idx]!=':'){
						name+=s[now][idx++];
					}
					if(ps[i].equals(name)){
						if(i==ps.length-1){
							if(idx==s[now].length-1){
								System.out.println("object"); return;
							}
							idx+=2;
							String res = "";
							while(idx < s[now].length)res+=s[now][idx++];
							System.out.println("string \"" + res +"\"");
							return;
						}
						if(now==n-1){
							System.out.println("no such property"); return;
						}
						indent = 0;
						while(s[now+1][indent]==' ')indent++;
						find = true;
						now++; break;
					}
					else now++;
				}
				else now++;
			}
			if(!find){
				System.out.println("no such property"); return;
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define pil pair<int,long long>
#define ll long long
#define el '\n'

using namespace std;

const int N = 1e6 + 10;
const int INF = 1e9;

int n;
vector <pii> v; // minimum-prefix, surplus;
vector <pii> tempv;
pii last = mp(INF, INF);
int cur;
int sisa;

stack <int> st[N];
pii t[4 * N]; // max-surplus, pos

pii proc(string s){
    pii ret = mp(0, 0);
    for (auto c : s){
        if (c == '('){
            ret.fi++;
        } else{
            ret.fi--;
        }
        ret.se = min(ret.fi, ret.se);
    }
    return ret;
}

void build(int v, int tl, int tr){
    if (tl == tr){
        t[v] = mp(st[tl].top(), tl);
        return;
    }
    int tm = (tl + tr) / 2;
    build(v * 2, tl, tm);
    build(v * 2 + 1, tm + 1 , tr);
    if (t[v * 2].fi >= t[v * 2 + 1].fi){
        t[v] = t[v * 2];
    } else{
        t[v] = t[v * 2 + 1];
    }
}

void update(int v, int tl, int tr, int pos){
    if (pos < tl || tr < pos) return;
    else if (tl == tr){
        st[tl].pop();
        t[v] = mp(st[tl].top(), tl);
        return;
    }
    int tm = (tl + tr) / 2;
    update(v * 2, tl, tm, pos);
    update(v * 2 + 1, tm + 1, tr, pos);
    if (t[v * 2].fi >= t[v * 2 + 1].fi){
        t[v] = t[v * 2];
    } else{
        t[v] = t[v * 2 + 1];
    }
}

pii query(int v, int tl, int tr, int l, int r){
    if (l > r) return mp(-INF, -1);
    else if (l <= tl && tr <= r){
        return t[v];
    }
    int tm = (tl + tr) / 2;
    pii temp1 = query(v * 2, tl, tm, l, min(tm, r));
    pii temp2 = query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);
    if (temp1.fi >= temp2.fi){
        return temp1;
    } else{
        return temp2;
    }
}

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

    cin >> n;
    for (int i=1;i<=n;i++){
        string s;
        cin >> s;
        pii temp = proc(s);
        if (s[s.length() - 1] == ')' && temp.fi <= temp.se){
            if (last.fi > temp.fi){
                last = temp;
            }
        }
        tempv.pb(temp);
    }
    bool ambil = 0;
    for (auto x : tempv){
        if (x != last || ambil){
            v.pb(mp(-x.se, x.fi));
        } else{
            ambil = 1;
        }
    }
    sisa = (int) v.size();
    sort(v.begin(), v.end());
    for (int i=0;i<N;i++){
        st[i].push(-INF);
    }
    for (auto x : v){
        st[x.fi].push(x.se);
    }
    build(1, 0, N - 1);

    while (sisa){
        pii temp = query(1, 0, N - 1, 0, cur);

        if (temp.fi + cur >= 0){
            cur += temp.fi;
            sisa--;
            update(1, 0, N - 1, temp.se);
        } else{
            break;
        }
    }
    if (sisa){
        cout << "No" << el;
    } else{
        if (cur + last.fi == 0){
            cout << "Yes" << el;
        } else{
            cout << "No" << el;
        }
    }

    return 0;
}

Measured memory_bytes: 711296
S = input()
left = S[:2]
right = S[2:]

month = [str(m).zfill(2) for m in range(1, 13)]
year = [str(y).zfill(2) for y in range(0, 100)]

if (left in year and right in year) and (left in month and right in month):
    print("AMBIGUOUS")
elif left in month and right in year:
    print("MMYY")
elif left in year and right in month:
    print("YYMM")
else:
    print("NA")


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

int main(void){
    using namespace  std;
    string S;
    cin >> S;
    int count = 0;
    for (int i = 0; i < S.length()/2;i++){
        if(S[i] != S[S.length()-i-1])
            count++;
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;++i)
#define MOD (int) 1e9+7
#define INF (int) 2e9

int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i, n){
        cin >> a[i];
    }
    double s = 0;
    rep(i, n){
        s += (double)1 /a[i];
    }

    // cout << n << endl;
    printf("%.20lf\n", 1/s);
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        boolean first=true;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            int i=0;
            while ((line = br.readLine()) != null) {
            	if(line.equals("0")){
            		break;
            	}else{
            		i++;
            		System.out.println("Case "+i+": "+line);
            	}
            }
        }
    }
}

Measured memory_bytes: 31784
/* ex5_3
   seira3 */

#include<stdio.h>

int arrayIn(int obj,int size, int arr[]){ //objがarr内にあるかどうかを判別する関数,あれば1なければ0を返す
    int count = 0;
    for(int i = 0; i < size; i++){
        if(arr[i]==obj){
            count++;
            break;
        }
    }
    return count;
}

int main(void){
    int row, line, count, countRow, countLine; //変数宣言
    scanf("%d %d",&row,&line); //rowとlineに入力
    count = 0; //初期化
    countRow = 0; //初期化
    countLine = 0; //初期化
    char square[row][line]; //元の迷路の配列を宣言
    int whiteRow[row], whiteLine[line]; //行,列全て'.'の番号を記憶する配列
    for(int i = 0; i < row; i++){ //squareに入力
        for(int j = 0; j < line; j++){
            scanf(" %c",&square[i][j]);
        }
    }
    for(int i = 0; i < row; i++){ //全て-1に初期化(0で初期化すると0番目が全て'.'なときに区別がつかなくなる)
        whiteRow[i] = -1;
    }
    for(int i = 0; i < line; i++){ //全て-1に初期化(0で初期化すると0番目が全て'.'なときに区別がつかなくなる)
        whiteLine[i] = -1;
    }
    for(int i = 0; i < row; i++){ //何行目に全て'.'なのかを探してwhiteRowに格納する
        count = 0;
        for(int j = 0; j < line; j++){
            if (square[i][j] == '.'){
                count++;
            }
        }
        if(count == line){
            whiteRow[countRow] = i;
            countRow++;
        }
    }
    for(int i = 0; i < line; i++){ //何列目に全て'.'なのかを探してwhiteLineに格納する
        count = 0;
        for(int j = 0; j < row; j++){
            if (square[j][i] == '.'){
                count++;
            }
        }
        if(count == row){
            whiteLine[countLine] = i;
            countLine++;
        }
    }
    for(int i = 0; i < row; i++){ //答えを出力する
        for(int j = 0; j < line; j++){
            if(arrayIn(i,row,whiteRow) == 0 && arrayIn(j,line,whiteLine) == 0){ //もし全て'.'の行,列に属していなかったら
                printf("%c",square[i][j]);
            }
        }
        if(arrayIn(i,row,whiteRow) == 0){ //行が全て'.'でなければ改行
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
  int A,B;
  cin>>A>>B;
  if (A<=8&&B<=8) puts("Yay!");
  else puts(":(");
  //system("pause");
  return 0;
}


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

int main(){
    int d;
    cin >> d;
    vector<int> c(26);
    for(int i = 0; i < 26; i++) cin >> c[i];
    vector<vector<int>> s(d+1, vector<int>(26));
    for(int i = 1; i <= d; i++){
        for(int j = 0; j < 26; j++) cin >> s[i][j];
    }
    vector<int> t(d+1);
    vector<int> last(26, 0);
    for(int i = 1; i <= d; i++){
        cin >> t[i];
        t[i]--;
    }

    int ans = 0;
    for(int i = 1; i <= d; i++){
        ans += s[i][t[i]];
        last[t[i]] = i;
        for(int j = 0; j < 26; j++){
            ans -= c[j] * (i - last[j]);
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std ;
typedef long long int ll ;


int main(){
	ios;
	int n;
	string s;
	cin>>n>>s;
	
	for(int i=0; i<s.size(); i++){
		if(s[i]+n>'Z'){
			cout<<char(s[i]+n-26);
		}
		else 
			cout<<char(s[i]+n);
	} 

	return 0;
}



Measured memory_bytes: 256
# URL
#
# 与えられる配列はすでに完全二分木を表す二分ヒープ
# 配列を1オリジンとし、ノードのidxをiとしたとき、そのノードの親はi//2、2*i, 2*i+1。
# これを実装するだけ。(この関係性はP232の図10.2を見れば自明)

N = int(input())
heap = list(map(int, input().split()))

for i, a in enumerate(heap, start=1):  # 1オリジンにするためのstart=1
    print(f'node {i}: key = {a}, ', end='')
    # 親存在するときだけ出力する。
    if i//2 != 0:
        # heapは実際には0オリジンなので-1して調節する
        print(f'parent key = {heap[i//2 -1 ]}, ', end='')
    # 左子が存在するときだけ出力する
    if 2 * i <= N:
        print(f'left key = {heap[2*i - 1]}, ', end='')
    # 右子
    if 2 * i + 1 <= N:
        print(f'right key = {heap[2*i]}, ', end='')
    print()



Measured memory_bytes: 5688
x, y, z, k = gets.chomp.split(' ').map(&:to_i)
a = gets.chomp.split(' ').map(&:to_i).sort.reverse.slice(0...k)
b = gets.chomp.split(' ').map(&:to_i).sort.reverse.slice(0...k)
c = gets.chomp.split(' ').map(&:to_i).sort.reverse.slice(0...k)
ab = []
(0...[x, k].min).each do |i|
  (0...[y, k].min).each do |j|
    ab << a[i] + b[j]
  end
end
ab = ab.sort.reverse.slice(0...k)
abc = []
(0...[x * y, k].min).each do |i|
  (0...[z, k].min).each do |j|
    abc << ab[i] + c[j]
  end
end
abc = abc.sort.reverse.slice(0...k)
abc.each { |i| puts i }

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

int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  if (s.size() > k) s = s.erase(k) + "...";
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;

#define all(A) (A).begin(), (A).end()
#define II(A) int (A); scanf("%d",&(A));
#define DBG if(1)
#define NDBG if(0)

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

int main(){
	ll a, b;
	scanf("%lld%lld",&a,&b);
	if(a*b <= 0){
		puts("Zero");
		return 0;
	}
	if(a>0) puts("Positive");
	else if((b-a+1)&1) puts("Negative");
	else puts("Positive");
	return 0;
} 


Measured memory_bytes: 128
//
//  main.cpp
//  129d
//
//  Created by Dong Truong on 6/11/19.
//  Copyright © 2019 Dong Truong. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <fstream>

using namespace std;
#define maxn 2001

int n,m,a[maxn][maxn],l[maxn][maxn],r[maxn][maxn],u[maxn][maxn],d[maxn][maxn];

void nhap()
{
    cin>>n>>m;
    for (int i=1;i<=n;++i)
    {
        string s;
        cin>>s;
        for (int j=1;j<=m;++j)
            if (s[j-1]=='#') a[i][j]=0;
            else a[i][j]=1;
    }
}
void pre()
{
    for (int i=1;i<=n;++i)
        for (int j=1;j<=m;++j)
            if (a[i][j]==0)
            {
                u[i][j]=0;r[i][j]=0;
            }
            else
            {
                u[i][j]=u[i-1][j]+1;
                r[i][j]=r[i][j-1]+1;
            }
}
void pre2()
{
    int kq=0;
    for (int i=n;i>=1;--i)
        for (int j=m;j>=1;--j)
            if (a[i][j]==0)
            {
                d[i][j]=0;l[i][j]=0;
            }
            else
            {
                d[i][j]=d[i+1][j]+1;
                l[i][j]=l[i][j+1]+1;
                kq=max(kq,l[i][j]+d[i][j]+u[i][j]+r[i][j]-3);
            }
    cout<<kq;
}
int main(int argc, const char * argv[]) {
    //freopen("a.inp","r",stdin);
    nhap();
    pre();
    pre2();
    return 0;
}


Measured memory_bytes: 78592
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;
typedef long long int ll;

bool comp(ll x, ll y){
	ll x1=x, y1=y;
	ll d1=0, d2=0;
	while(x1>0){
		d1+=(x1%10);
		x1/=10;
	}
	while(y1>0){
		d2+=(y1%10);
		y1/=10;		
	}
	if(x*d2!=y*d1){
		return x*d2<y*d1;
	}else{
		return x<y;
	}
}

int main()
{
	int k;
	scanf("%d", &k);
	vector<ll> v;
	ll p10=1;
	set<ll> st;
	for(ll d=1; d<=12; d++){
		for(ll i=1; i<10000; i++){
			st.insert((i+1)*p10-1);
		}
		p10*=10;
	}
	for(auto itr=st.begin(); itr!=st.end(); itr++){
		v.push_back(*itr);
	}
	bool e[200000]={};
  	ll m=v.back();
	for(int i=v.size()-2; i>=0; i--){
		if(!comp(v[i], m)){
          e[i]=1;
        }else{
          m=v[i];
        }
	}
	int t=0, i0=0;
	while(t<k){
		if(e[i0]==1){
			i0++;
			continue;
		}else{
			printf("%lld\n", v[i0]);
          i0++;
          t++;
        }
    }
	return 0;
}

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

int main(){
	int h,w;
  	cin >> h >> w;
  	vector<string> a(h);
	for(int i = 0; i< h; i++)
    	cin >> a[i];
  	int tmp;
	for(int i = 0; i< h; i++) {
		for(int j = 0; j< w; j++) {
    		if(a[i][j] == '.') {
            	tmp = 0;
              	for(int ii = max(0,i-1) ; ii <= min(h-1, i+1); ii++) {
                	for(int jj = max(0,j-1) ; jj <= min(w-1, j+1); jj++) {
                      	if(a[ii][jj] == '#') {
                          tmp++;
                        }
                    }
                }
              	a[i][j] = (char)(tmp+'0');
            }
        }
    }
  	for(int i = 0; i< h; i++) {
		cout << a[i] << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
bool used[5];
long long int dp[105][25];
int main(void){
	int N,want,hoge;
	vector<int> nums;
	cin>>N;
	nums.push_back(0);
	for(int i=0;i<N-1;i++){
		cin>>hoge;
		nums.push_back(hoge);
	}
	cin>>want;
	for(int i=0;i<=20;i++){
		if(i!=0)dp[0][i]=0;
		else dp[0][0]=1;
	}
	for(int i=1;i<N;i++){
		for(int j=0;j<=20;j++){
			if(j-nums[i]>=0)
			dp[i][j]+=dp[i-1][j-nums[i]];
			if(j+nums[i]<=20)
			dp[i][j]+=dp[i-1][j+nums[i]];
		}
	}
	if(nums[1]!=0)
	cout<<dp[N-1][want]<<endl;
	else
	cout<<dp[N-1][want]/2<<endl;
	
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	for(int i = 1; i <= 50000; i++){
		int q = 27 * i / 25; 
		if(q == N){
			cout << i << endl; return 0; 
		}
	}
	cout << ":(" << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define forr(i,a,n) for (int i = (a); i < (n); ++i)
#define rforr(i,a,n) for (int i = (a); i > (n); --i)
#define ALL(x) x.begin(),x.end()
#define LEN(X) ((int)(X).size())
#define CASET int _T; cin >> _T; forr(caset,0,_T)
//#define int long long





int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n,m; cin >> n >> m;
    int tot = 0;
    forr(i,0,m) {
        int x; cin >> x;
        tot += x;
    }
    tot = n - tot;
    if (tot < 0) cout << -1 << '\n';
    else cout << tot << '\n';

    return 0;       
}

Measured memory_bytes: 3648
import sys,math,collections,itertools
input = sys.stdin.readline

N,M,R=list(map(int,input().split()))
r=list(map(int,input().split()))
ABC = [[float('inf')]*(N+1) for _ in range(N+1)]
#条件のうち、重複経路は最短のみ残す
for _ in range(M):
    a,b,c = map(int,input().split())
    if ABC[a][b]>c:
        ABC[a][b]=c
        ABC[b][a]=c

#各頂点間の最小距離 Warshall-Floyd
dist = [[float('inf')]*(N+1) for _ in range(N+1)]
for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            ABC[i][j] = min(ABC[i][j],ABC[i][k] + ABC[k][j])

rotate = itertools.permutations(r)
ans = float('inf')
for rot in rotate:
    tmp = 0
    flag = 0
    for i in range(len(rot)-1):
        tmp +=ABC[rot[i]][rot[i+1]]
        if tmp>ans:
            flag = 1
            break
    if flag==0:
        ans = min(ans,tmp)
print(ans)


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

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

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	cout << fixed << setprecision(10);
	ld a,b,h,m;
	cin >> a >> b >> h >> m;

	ld deg = abs(h*5*6 + m*0.5 - m*6);
	ld rad = deg * PI / 180;
	ld c = a*a + b*b - 2*a*b*cos(rad);
	cerr << deg << endl;

	cout << sqrt(c) << endl;
	return 0;
}

Measured memory_bytes: 4184
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
   
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

const int INF=1e9;

struct edge{
	int to, cap, rev;
};

int n;
vector<int> g[502];
bool used[502];
int c[502][502];

void add_edge(int from, int to, int cap){
	g[from].push_back(to);
	g[to].push_back(from);
	c[from][to]+=cap;
}

int dfs(int v, int t, int f){
	if(v==t) return f;
	used[v]=1;
	for(int i=0; i<g[v].size(); i++){
		int y=g[v][i];
		if(!used[y] && c[v][y]>0){
			int d=dfs(y, t, min(f, c[v][y]));
			if(d>0){
				c[v][y]-=d;
				c[y][v]+=d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){
	int flow=0;
	while(1){
		fill(used, used+n, 0);
		int f=dfs(s, t, INF);
		if(f==0) return flow;
		flow+=f;
	}
}
	
int main()
{
	int e, q;
	cin>>n>>e>>q;
	for(int i=0; i<e; i++){
		int f, t;
		cin>>f>>t;
		f--; t--;
		add_edge(f, t, 1);
		add_edge(t, f, 1);
	}
	int flow=max_flow(0, n-1);
	for(int i=0; i<q; i++){
		int m, a, b;
		cin>>m>>a>>b;
		a--; b--;
		if(m==1){
			add_edge(a, b, 1);
			add_edge(b, a, 1);
          fill(used, used+n, 0);
			int f=dfs(0, n-1, 1);
			flow+=f;
			cout<<flow<<endl;
		}else{
			if(c[a][b]>0 && c[b][a]>0){
				c[a][b]--; c[b][a]--;
				cout<<flow<<endl;
			}else if(c[a][b]==0){
				c[b][a]=0;
              fill(used, used+n, 0);
				if(dfs(a, b, 1)>0){
					cout<<flow<<endl;
				}else{
                  fill(used, used+n, 0);
					dfs(a, 0, 1);
                  fill(used, used+n, 0);
					dfs(n-1, b, 1);
					flow--;
					cout<<flow<<endl;
				}
			}else{
				c[a][b]=0;
              fill(used, used+n, 0);
				if(dfs(b, a, 1)){
					cout<<flow<<endl;
				}else{
                  fill(used, used+n, 0);
					dfs(b, 0, 1);
                  fill(used, used+n, 0);
					dfs(n-1, a, 1);
					flow--;
					cout<<flow<<endl;
				}
			}
		}
	}
    return 0;
}


Measured memory_bytes: 4456
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string c;
	int cnt=0;
    cin>>c;
    int l=c.size();
    for(int i=0;i<l;i++) 
	{
		if(c[i]=='2') 
		{
			cnt++;
		}
	}
    cout<<cnt;
    return 0;
} 

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;

#define fi          first
#define se          second
#define pb          push_back
#define INF         INT_MAX
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define dbg(x)      cout<<#x"="<<x<<endl
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     upper_bound(all(x),y)-x.begin()
#define lb(x,y)     lower_bound(all(x),y)-x.begin()
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)

string s;
ll x,y;
Vector a,b;
vector< vector<bool> > dp1(2, vector<bool>(20011,false));
vector< vector<bool> > dp2(2, vector<bool>(20011,false));

int main(){
  cin >> s>> x >> y;
  s += "T";
  ll crt = 0,sum = 0;
  each(itr,s){
    if(itr == 'T'){
      if(crt == 0)a.pb(sum);
      else b.pb(sum);
      sum = 0;
      crt = 1 - crt;
    }else{
      sum++;
    }
  }

  crt = 0;
  ll nxt = 1;
  dp1[crt][10000] = true;
  rep(i,a.size()){
    dp1[nxt] = vector<bool>(20011,false);
    rep(j,20001){
      if(!dp1[crt][j])continue;
      if(i == 0){
        if(j+a[i] <= 20000)dp1[nxt][j+a[i]] = true;
      }else{
        if(j+a[i] <= 20000)dp1[nxt][j+a[i]] = true;
        if(j-a[i] >= 0)dp1[nxt][j-a[i]] = true;
      }
    }
    swap(crt,nxt);
  }

  if(!dp1[crt][x+10000]){
    cout << "No" << endl;
    return 0;
  }

  crt = 0;
  nxt = 1;
  dp2[crt][10000] = true;
  rep(i,b.size()){
    dp2[nxt] = vector<bool>(20011,false);
    rep(j,20001){
      if(!dp2[crt][j])continue;
      if(j+b[i] <= 20000)dp2[nxt][j+b[i]] = true;
      if(j-b[i] >= 0)dp2[nxt][j-b[i]] = true;
    }
    swap(crt,nxt);
  }

  if(!dp2[crt][y+10000]){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}


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

#include <string>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <math.h>

int main()
{
	uint64_t a;
	cin >> a;

	double hen = (double)a / 3.00;

	printf( "%f", hen * hen * hen );
		
	return 0;
}

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

int main(){
  std::vector<int> v(26,0);
  string s,t;
  cin>>s>>t;
  int N=s.size();
  int out=0;
  for(int i=0;i<N;i++){
    if(1){
      if(v[s[i]-97]==0){v[s[i]-97]=t[i];continue;}
      else{
        if(v[s[i]-97]==t[i])continue;
        else out++;
      }
    }
  }
  std::vector<int> w(26,0);
  for(int i=0;i<26;i++){
    if(v[i])w[v[i]-97]++;
    if(w[v[i]-97]>=2)out++;
    //cout<<i<<" "<<out<<endl;
  }
  //cout<<out<<endl;
  if(out)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */
ll n;
vector<ll> a;
bool is_OK(ll lim, ll k) {
  ll ttl = 0;
  REP(i, n) {
    ttl+=(ll)ceil((double)a[i]/lim)-1;
  }
  return k >= ttl;
}

ll binary_search(ll k) {
  ll ng = 0;
  ll ok = a.back() + 1;

  while (abs(ng - ok) > 1) {
    ll mid = (ok + ng) / 2;
    if (is_OK(mid, k))
      ok = mid;
    else
      ng = mid;
  }
  return ok;
}

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

  REP(i, n) {
    ll tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  sort(ALL(a));
  cout << binary_search(k) << endl;

  return 0;
}


Measured memory_bytes: 5324
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > > 
#define pii pair<int,int> 
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define SZ(x) ((int)x.size())
using namespace std;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
const int BufferSize=1<<16;
char buffer[BufferSize],*Bufferhead,*Buffertail;
bool Terminal;
inline char Getchar(){
	if(Bufferhead==Buffertail){
		int l=fread(buffer,1,BufferSize,stdin);
		if(!l){Terminal=1;return 0;}
		Buffertail=(Bufferhead=buffer)+l;
	}
	return *Bufferhead++;
}
template<class T>inline bool read(T &x){
	x=0;char c=Getchar(),rev=0;
	while(c<'0'||c>'9'){rev|=c=='-';c=Getchar();if(Terminal)return 0;}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
	if(c=='.'){
		c=Getchar();double t=0.1;
		while(c>='0'&&c<='9') x=x+(c-'0')*t,c=Getchar(),t=t/10;
	}
	x=rev?-x:x;
	return 1;
}
template<class T1,class T2> inline bool read(T1 &x,T2 &y){return read(x)&read(y);}
template<class T1,class T2,class T3> inline bool read(T1 &x,T2 &y,T3 &z){return read(x)&read(y)&read(z);}
template<class T1,class T2,class T3,class T4> inline bool read(T1 &x,T2 &y,T3 &z,T4 &w){return read(x)&read(y)&read(z)&read(w);}
inline bool reads(char *x){
	char c=Getchar();
	while(c<33||c>126){c=Getchar();if(Terminal)return 0;}
	while(c>=33&&c<=126) (*x++)=c,c=Getchar();
	*x=0;return 1;
}
template<class T>inline void print(T x,const char c='\n'){
	if(!x){putchar('0');putchar(c);return;}
	if(x<0) putchar('-'),x=-x;
	int m=0,a[20];
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');
	putchar(c);
}
//--------------------------------head---------------------------------------------

const int inf=0x3f3f3f3f;
const int N=2005,M=100005,mod=1e9+7;
template<class T,class S> inline void ch(T &x,const S y){x=(x+y)%mod;}
inline int exp(int x,int y,const int mod=::mod){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int tot=0,num[55][55];
vi a[N];

int main(){
	int k=37+1,n=k*(k-1)+1;
	printf("%d %d\n",n,k);
	k--;
	for(int i=0,cnt=k+1;i<k;i++){
		tot++;a[tot].pb(1);
		for(int j=0;j<k;j++)
			num[i][j]=++cnt,a[tot].pb(cnt);
	}
	for(int i=0;i<k;i++)
		for(int j=0;j<k;j++){
			tot++;a[tot].pb(i+2);
			for(int c=0;c<k;c++)
				a[tot].pb(num[c][(c*i+j)%k]);
		}
	for(int i=1;i<=k+1;i++)
		a[n].pb(i);
//	debug(n);
	for(int i=1;i<=n;i++){
		for(int j=0;j<=k;j++)
			printf("%d ",a[i][j]);
		puts("");
	}
	return 0;
}

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>n;

	cin>>s1;

	map<char,int>mp,mp2;

	f(i,0,n-1){
        mp.clear();
        mp2.clear();
        count=0;
        f(j,0,i){
            mp[s1[j]]++;
        }
        f(k,i+1,n-1){
            mp2[s1[k]]++;
        }
        for(auto it=mp.bb;it!=mp.ee;it++){
            if(mp2[it->fi]) count++;
        }
        maxi=max(count,maxi);
	}

	cout<<maxi<<endl;

}


Measured memory_bytes: 3660
mod = 10**9+7
h, w, a, b = map(int, input().split())

n = h+w-2

ans = 0
fac = [1]*(n+1)
inv = [1]*(n+1)

for i in range(1, n+1):
    fac[i] = i*fac[i-1] % mod

for i in range(1, n+1):
    inv[i] = pow(fac[i], mod-2, mod)

def func(x, y):
    m = fac[x+y]*inv[x]*inv[y]%mod
    return m

for x in range(b, w):
    ans += func(x, h-a-1)*func(w-1-x, a-1)
    ans %= mod

print(ans)


Measured memory_bytes: 18868
// C - Otoshidama
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N,Y; cin>>N>>Y;
	Y /= 1000;
	int zs = max(0, ((N*5-Y)+4-1)/4);//round up
	int ze = max(0, (N*10-Y)/9);//round down
	rp(z, zs, ze+1){
		int y = max(0, ((N*10-Y-z*9)+5-1)/5);//round up
		int x = max(0, N - y - z);
		if(x*10 + y*5 + z == Y){
			printf("%d %d %d\n", x, y, z);
			return 0;
		}
	}
	puts("-1 -1 -1");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++)

int main() {
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    cout << fixed << setprecision(11);
    double h; //時針の回転角
    double m; //分針の回転角
    double pi = 3.141592653589;
    h = 30*H + M/2;
    m = 6*M;
    double ans = sqrt(A*A+B*B-2*A*B*cos(((60*H-11*M)*pi)/360));
    cout << ans << endl;
}

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

int main(){
    string cubo;
    cin >> cubo;
    char aux;
    int umn=0;
    int zeron=0;
    for(int i=0; i < cubo.length();i++){
        aux = cubo[i];
        if(aux == '1'){
            umn++;
        }
        else if(aux == '0'){
            zeron++;
        }
    }
    if(umn > zeron){
        cout << zeron*2 << endl;
    }
    else{
        cout <<umn*2 <<endl;
    }

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define alpha_size 26

const int N = 100 + 11;
int n, l;
string s[N];


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    
     
    cin >> n >> l;
    for (int i = 0; i < n; i++)
      cin >> s[i];
    sort(s, s + n);
    string ret;
    for (int i = 0; i < n; i++)
      ret += s[i];
    cout << ret << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val x = readInteger()
    val ans= if (x >= 30) "Yes" else "No"
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 34220