akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		string[] rt = Input();
		int[] p= new int[n];
		for(int i = 0; i < n; i++)
		{
			p[i]= int.Parse(rt[i]);
		}
		int r=0;
		for(int i = 1; i< n-1;i++)
		{
			int a = p[i-1];
			int b = p[i-0];
			int c = p[i+1];
			int min = Math.Max(a, Math.Max(b, c));
			if(b==min)
				continue;
			
			if(a==min && b>= c)
			{
				r++;
			}
			else if(c==min && b >=a)
			{
				r++;
			}
		}
		Console.WriteLine(r);
	}

	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

	
}



Measured memory_bytes: 11092
h, w = map(int, input().split())
L = [str(input()) for _ in range(h)]
dp = [[float('inf')] * w for _ in range(h)]
dp[0][0] = 1 if L[0][0] =='#' else 0
for i in range(h):
    for j in range(w):
        if L[i][j] == '.':
            if i < h - 1:
                dp[i+1][j] = min(dp[i+1][j], dp[i][j] if L[i+1][j] == '.' else dp[i][j] + 1)
            if j < w - 1:
                dp[i][j+1] = min(dp[i][j+1], dp[i][j] if L[i][j+1] == '.' else dp[i][j] + 1)
        else:
            if i < h - 1:
                dp[i+1][j] = min(dp[i+1][j], dp[i][j])
            if j < w - 1:
                dp[i][j+1] = min(dp[i][j+1], dp[i][j])
print(dp[h-1][w-1])


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

cheat = []
len_ = 0
for w in range(1, 151):
    for h in range(1, w):
        cheat.append((w**2+h**2, h, w))
        len_ += 1
cheat = sorted(cheat, key=lambda x:(x[0], x[1]))

while True:
    h, w = map(int, input().split())
    if h == 0:
        break
    L = h**2 + w**2
    for i in range(len_):
        if cheat[i][0] == L:
            if cheat[i][1] > h:
                print(cheat[i][1], cheat[i][2])
                break
        elif cheat[i][0] > L:
            print(cheat[i][1], cheat[i][2])
            break



Measured memory_bytes: 7568
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

#define MAX 10000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
vector<pair<int, int> >adj[MAX];

typedef pair<int, int> pii;

void dijkstra() {
	priority_queue<pii, vector<pii>, greater<pii> >PQ; //d[id] d
	int color[MAX] = {},
		d[MAX];
	fill(d, d + MAX, INF);
	d[0] = 0;

	//?§????????????\
	PQ.push(make_pair(0, 0));
	color[0] = GRAY;

	//PQ???????´????????????°
	while (!PQ.empty()) {
		//d????????§???(-????°????)??¨??????????´????????????????
		pii f = PQ.top(); PQ.pop();

		int u = f.second;
		color[u] = BLACK;

		//????????§???????????°??????
		if (d[u] < f.first) { continue; }

		//??£??\????????????????????¨????????????
		for (int j = 0; j < adj[u].size(); j++) {
			int v = adj[u][j].first;
			if (color[v] == BLACK)continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v], v));
				color[v] = GRAY;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
	}
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int u, k; cin >> u >> k;
		for (int j = 0; j < k; j++) {
			int v, c; cin >> v >> c;
			adj[u].push_back(make_pair(v, c));
		}
	}
	dijkstra();
	return 0;
}

Measured memory_bytes: 6372
N = int(input())
S = [input()for i in range(N)]
ans = [0,0,0,0,]
ans[0] = S.count("AC")
ans[1] = S.count("WA")
ans[2] = S.count("TLE")
ans[3] = S.count("RE")

print(f"AC x {ans[0]}")
print(f"WA x {ans[1]}")
print(f"TLE x {ans[2]}")
print(f"RE x {ans[3]}")

Measured memory_bytes: 16288
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
    int q;
    cin >> q;
    map<string, int> map;
    while (q--)
    {
        int c;
        cin >> c;
        if (c == 0)
        {
            string key;
            int x;
            cin >> key >> x;
            map[key] = x;
        } else if (c == 1)
        {
            string key;
            cin >> key;
            auto it = map.find(key);
            if (it != map.end())
            {
                cout << it->second << endl;
            } else cout << 0 << endl;
        } else
        {
            string key;
            cin>>key;
            map.erase(key);
        }


    }

}


Measured memory_bytes: 27804
#include <cstdio>
#include <algorithm>

using namespace std;

struct quaple{
    int a,b,c,d;
};

int N,M,Q;
quaple input[55];
int A[11];

int calc(){
    int ans=0;
    for(int i=1;i<=Q;i++){
        auto &cur=input[i];
        if (A[cur.b]-A[cur.a]==cur.c) ans+=cur.d;
    }
    return ans;
}

int search(int cur){
    if (cur>N) return calc();
    int ans=0;
    for(int i=A[cur-1];i<=M;i++){
        A[cur]=i;
        ans=max(ans,search(cur+1));
    }
    return ans;
}

int main(){
    scanf("%d%d%d",&N,&M,&Q);
    for(int i=1;i<=Q;i++){
        auto &temp=input[i];
        scanf("%d%d%d%d",&temp.a,&temp.b,&temp.c,&temp.d);
    }
    A[0]=1;

    printf("%d\n",search(1));
    return 0;
}

Measured memory_bytes: 1732
n = int(input())
k = 0
t2 = 0
x2 = 0
y2 = 0

for i in range(n):
    t1,x1,y1 = map(int,input().split())
    t = t1 - t2
    x = abs(x1 - x2)
    y = abs(y1 - y2)
    if t < x + y or t % 2 != (x + y) %2:
        print('No')
        break
    t2 = t1
    x2 = x1
    y2 = y1
    if i == n-1:
        print('Yes')

Measured memory_bytes: 3064
# E - Knapsack 2
# W の制約が大きいとき

N,W = map(int,input().split())
weight = []
value = []
for _ in range(N):
    w,v = map(int,input().split())
    weight.append(w)
    value.append(v)
v_max = sum(value) 

INF = 10**10

# dp[i][j]: i-1 番目までの品物から価値が j を達成するように選んだときの重さの総和の最小値
dp = [[INF]*(v_max+1) for _ in range(N+1)]

# 初期条件
# 品物を一個も選ばないとき価値は 0, 重さも 0
dp[0][0] = 0

# i-1 番目の品物
for i in range(1,N+1):
    # 価値 sum_v
    for sum_v in range(v_max+1):
        # i-1 番目の品物を選ぶとき
        if (sum_v - value[i-1] >= 0):
            dp[i][sum_v] = min(dp[i][sum_v], dp[i-1][sum_v - value[i-1]] + weight[i-1])
        # v-1 番目の品物を選ばないとき
        dp[i][sum_v] = min(dp[i][sum_v],dp[i-1][sum_v])

# dp[N][sum_v] が W 以下であるような sum_v の最大値
ans = 0
for sum_v in range(v_max+1):
    if dp[N][sum_v] <= W:
        ans = sum_v
print(ans)

Measured memory_bytes: 151956
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in range(30):
    for l in range(n):
        if a[l]%2==0:
            b.append(a[l]//2)
    if len(b)==n:
        a=b
        b=[]
        cnt+=1
    else:
        break
print(cnt)

Measured memory_bytes: 9172
n = int(input())
R = []
for v in range(n):
    b = tuple(map(int, input().split(' ')))
    R.append(b)
R.sort()
B = []
for v in range(n):
    r = tuple(map(int, input().split(' ')))
    B.append(r)
B.sort()
count = 0
i = 0
while i < n:
    j = 0
    Bmax = -1
    Bind = -1
    while j < len(R) and B[i][0] > R[j][0]:
        if R[j][1] < B[i][1] and Bmax < R[j][1]:
            Bmax = R[j][1]
            Bind = j
        j += 1
    if Bmax != -1:
        del R[Bind]
        count += 1
    i += 1
print(count)

Measured memory_bytes: 3064
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int h,w,i,j,fh[100],fw[100];
	char a[100][101];
	scanf("%d %d",&h,&w);
	for(i=0;i<h;i++)	scanf("%s",a[i]);
	for(i=0;i<h;i++)	{
		fh[i]=0;
		for(j=0;j<w;j++)	{
			if(a[i][j]=='#')	{
				fh[i]=1;	break;
			}
		}
	}
	for(j=0;j<w;j++)	{
		fw[j]=0;
		for(i=0;i<h;i++)	{
			if(a[i][j]=='#')	{
				fw[j]=1;	break;
			}
		}
	}
	for(i=0;i<h;i++)	{
		if(fh[i]==1)	{
			for(j=0;j<w;j++)	{
				if(fw[j]==1)	{
					printf("%c",a[i][j]);
				}
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define per(i,a,b) for(ll i=(b)-1;i>=(a);i--)
const ll maxn=1e5+5;
ll n,m,h[maxn],a,b;
vector<ll> ady[maxn];
int main() {
    ios_base::sync_with_stdio(0);
    cin>>n>>m;
    rep(i,1,n+1) cin>>h[i];
    while(m--) {
        cin>>a>>b;
        ady[a].push_back(b);
        ady[b].push_back(a);
    }
    ll ans=0;
    rep(i,1,n+1) {
        ll good=1;
        for(ll to: ady[i]) if(h[i]<=h[to]) good=0;
        if(good) ans++;
    }
    cout<<ans<<"\n";
}

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

int main(){
  int N,M;
  cin >> N >> M;
  int A[N];
  priority_queue<int> que;
  for(int i=0;i<N;i++){
    cin >> A[i];
    que.push(A[i]);
  }
  for(int i=0;i<M;i++){
    int top_num = que.top();
    que.pop();
    que.push(top_num/2);
  }
  long long sum = 0;
  while(!que.empty()){
      sum += que.top();
      que.pop();
  }
  cout << sum << endl;
  return 0;

}


Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll x = 0;
    rep(i, n) cin >> a[i], x ^= a[i];
    rep(i, n) cout << (x ^ a[i]) << " \n"[i == n - 1];
}

Measured memory_bytes: 4840
#include <iostream>
using namespace std;
int main(){
    int n,x;
    while(1){
        int count=0;
        cin>>n>>x;
        if(n==0&&x==0){
            break;
        }else{
            for(int i=1;i<=n;i++){
                for (int j=i+1;j<=n;j++){
                    for (int k=j+1;k<=n;k++){
                        if(i+j+k==x){
                            count+=1;
                        }
                    }
                }
            }
        }cout<<count<<endl;
    }
    return 0;
}


Measured memory_bytes: 3108
# coding: utf-8
import re
import math
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
#import numpy as np
mod=int(10**9+7)
inf=int(10**20)
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r):return math.factorial(n)//math.factorial(n-r)//math.factorial(r)
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="number"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True

 

 
#main
A,B,C,D,E,F=map(int,input().split())
A*=100
B*=100
mizu=[]
satou=[]

for a in range(0,F+1,A):
    for b in range(0,F+1,B):
        mizu.append(a+b)
for a in range(0,F+1,C):
    for b in range(0,F+1,D):
        satou.append(a+b)

mizu.sort()
satou.sort()

ans=None

for a in satou:
    for b in mizu:
        s=a+b
        if(s==0):continue
        if(s>F):break
        if(a*100>E*b):continue
        if(ans==None):ans=[a,s]
        if(a*ans[1]>ans[0]*s):
            ans=[a,s]

print(ans[1],ans[0])


Measured memory_bytes: 26372
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string ans = "Three";
  for(int i = 0; i < N; i++){
    string col;
    cin >> col;
    if(col == "Y"){
      ans = "Four";
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int H,W;
int h,w;

int main(){
    cin>>H>>W>>h>>w;

    int ans=H*W-(W*h+w*H-h*w);

    cout<<ans<<endl;
}

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

void solve(){
  int n; 
  cin >> n; 
  int a[n]; 
  for(int i=0; i<n ; i++){
    cin>>a[i]; 
  }
  int dp[n]; 
  dp[0] = 0; 
  dp[1] = abs(a[1]-a[0]); 
  for(int i=2; i<n; i++){
    dp[i] = min(dp[i-1] + abs(a[i]-a[i-1]), dp[i-2] + abs(a[i]-a[i-2])); 
  }
  cout << dp[n-1]<<"\n"; 
}

int main(){
  int t=1; 
  // cin>>t; 
  while(t--){
    solve(); 
  }
 return 0;
}

Measured memory_bytes: 3916
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val s = sc.nextLine()
    println(if (s.contains("7")) "Yes" else "No")
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 35660
n,k=map(int,input().split())
l=list(map(int,input().split()))
for i in range(n):
  if l[i]==1:c=i
l=i;r=n-i-1;ans=0
if l%(k-1)==0:ans-=1
if r%(k-1)==0:ans-=1
print(ans+l//(k-1)+r//(k-1)+2)

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;


int main(void){
    ll N;
    cin >> N;
    vector<ll> a(N+1);
    for(ll i = 1; i <= N; i++){
        cin >> a.at(i);
    }
    
    vector<ll> R(N+1), L(N+1);
    for(ll i = 1; i <= N; i++){
        R.at(i) = i - a.at(i);
        L.at(i) = i + a.at(i);
    }
    
    map<ll, ll> test;
    ll ans = 0;
    for(ll i = 1; i <= N; i++){
        test[L.at(i)]++;
        if(test.count(R.at(i))) ans += test.at(R.at(i));
    }
    
    printf("%lld\n", ans);
    
    
}

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

int main(void){
  int n; cin >> n;
  string s; cin >> s;
  if(n % 2 == 1){
    cout << "No" << endl;
    return 0;
  }
  else{
    for(int i = 0; i < n/2; i++){
      if(s.at(i) != s.at(i+n/2)){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;

}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        Arrays.sort(A);
        int l = 0;
        int r = N-1;
        long ans = 0;

        // 0: low-high
        // 1: low-low
        // 2: high-low
        // 3: high-high
        int st = 0;
        int al = A[l];
        int ar = A[r];
        ans += Math.abs(al-ar);
        l++;
        r--;
        while (l <= r) {
            if (st == 0) {
                // 0: low-high
                if (A[r]-al > ar-A[l]) {
                    ans += A[r]-al;
                    al = A[r--];
                    st = 3;
                } else {
                    ans += ar-A[l];
                    ar = A[l++];
                    st = 1;
                }
            } else if (st == 1) {
                // 1: low-low
                if (A[r]-al > A[r]-ar) {
                    ans += A[r]-al;
                    al = A[r--];
                    st = 2;
                } else {
                    ans += A[r]-ar;
                    ar = A[r--];
                    st = 0;
                }
            } else if (st == 2) {
                // 2: high-low
                if (al-A[l] > A[r]-ar) {
                    ans += al-A[l];
                    al = A[l++];
                    st = 1;
                } else {
                    ans += A[r]-ar;
                    ar = A[r--];
                    st = 3;
                }
            } else {
                // 3: high-high
                if (al-A[l] > ar-A[l]) {
                    ans += al-A[l];
                    al = A[l++];
                    st = 0;
                } else {
                    ans += ar-A[l];
                    ar = A[l++];
                    st = 2;
                }
            }
        }

        System.out.println(ans);
    }
}



Measured memory_bytes: 51336
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	char c[4];
	set<char> s;
	REP(i, 3) {
		c[i] = getchar();
		s.insert(c[i]);
	}
	puts(s.size() == 1 ? "No" : "Yes");
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    
    int ans = 0;
    int count = 0;
    for(int i = 100; i >= 1; i--){
      if(A%i == 0 && B%i == 0){
        ans = i;
        count++;
      }
      if(count == K){
        break;
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>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 vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,K,ans=0LL;
  string S;
  cin>>N>>K>>S;
  
  char X='P';
  for(int i=0; i<N; ++i){
    if(X==S[i]) ans++;
    X=S[i];
  }
  
  ans+=2*K;
  chmin(ans,N-1);
  co(ans);
  return 0;
}

Measured memory_bytes: 3712
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:i32 = read();
    let a:Vec<char> = read::<String>().chars().collect();
    let b:Vec<char> = read::<String>().chars().collect();
    let c:Vec<char> = read::<String>().chars().collect();

    let mut ans:i32 = 0;
    for i in 0..n {
        let i = i as usize;
        if a[i]!=b[i] && b[i]!=c[i] && a[i]!=c[i] {
            ans += 2;
        } else if a[i]==b[i] && b[i]==c[i] {
            ans += 0;
        } else {
            ans += 1;
        }
    }

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


Measured memory_bytes: 4352
#include <cstdio>
 
int main(){
	int a;
	int b;
	scanf("%d %d",&a,&b);
	if(a<b){
	printf("a < b\n");
	}else if(a>b){
	printf("a > b\n");
	}else if(a == b){
	printf("a == b\n");
	}
	
	return 0;
}

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

int main()
{
  double a, b, n;

  cin >> a >> b >> n;

  int max = 0;
  double temp = min(b - 1, n);
  // for (double i = 0; i <= temp; i++)
  // {
  int v = floor(a * temp / b) - a * floor(temp / b);
  //   if (max < v)
  //     max = v;
  // }
  cout << v << endl;
}

Measured memory_bytes: 3724
from bisect import bisect
def inpl(): return list(map(int, input().split()))
MOD = 10**9 + 7
N, M = inpl()
A = sorted(inpl())
B = sorted(inpl())


A_set = set(A)
B_set = set(B)

ans = 1

if len(A_set) != N or len(B_set) != M:
    ans = 0

for x in range(N*M, 0, -1):
    if (x in A_set) and (x in B_set):
        tmp = 1
    elif x in A_set:
        tmp = max(M - bisect(B, x), 0)%MOD
    elif x in B_set:
        tmp = max(N - bisect(A, x), 0)%MOD
    else:
        a = bisect(A, x)
        b = bisect(B, x)
        tmp = max(x - N*b - M*a + a*b, 0)%MOD
    ans = (tmp*ans)%MOD

print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (int i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define int long long
using namespace std;
using ll = long long;
using II = pair<int, int>; using VII = vector<II>; using VVII = vector<VII>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, const pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, const map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
constexpr int MOD = 1e9 + 7;

signed main() {
  int n; cin >> n;
  VI h(n + 2);
  REP (i, n) cin >> h[i];
  VI dp(n + 2, 1e15);
  dp[0] = 0;
  REP (i, n) {
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
  }
  cout << dp[n - 1] << endl;
}


Measured memory_bytes: 1792
#include <iostream>

int main()
{
    int a, b, c;
    int N{};
    std::cin >> a >> b >> c;
    while (true)
    {
        if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1)
        {
            std::cout << N << std::endl;
            break;
        }
        else if (a == b && b == c)
        {
            std::cout << -1 << std::endl;
            break;
        }
        else
        {
            int ta{a}, tb{b}, tc{c};
            a = (tb + tc) / 2;
            b = (tc + ta) / 2;
            c = (ta + tb) / 2;
            ++N;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<iomanip>

#define ll long long

using namespace std;

int main(void) {
	int N;
	cin >> N;
	ll F[100][10];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 10; j++) cin >> F[i][j];

	}
	ll P[100][11];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= 10; j++) cin >> P[i][j];
	}
	ll ans = -1145148108931919;
	for (int n = 1; n < 1024; n++) {
		int nn = n;
		ll f[10];
		for (int i = 0; i < 10; i++) {
			f[i] = nn % 2;
			nn /= 2;
		}
		ll a = 0;
		for (int i = 0; i < N; i++) {
			int c = 0;
			for (int j = 0; j < 10; j++) {
				if (F[i][j] && f[j]) c++;
			}
			a += P[i][c];
		}
		//if (a > ans) cout << n << " " << a << endl;
		ans = max(ans, a);
	}
	cout << ans << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define vi vector<int>
#define ppi pair<int,pi>
#define ld long double
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << end
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define f(i, begin, end) for (__typeof(end) i = (begin); i != (end) ; i += 1 - 2 * ((begin) > (end)))
#define nl cout<<"\n";
#define endl "\n"
#define par(a,n) f(i,0,n) cout<<a[i]<<" "; nl
//void prt(int x) {cerr << x;}
#define vv(n,m) vector <vector <int> > v(n, vector <int> (m));

#define er(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... brgs>
void err(istream_iterator<string> it, T a, brgs... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);	
}
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef pair<int,int> pii;
typedef vector<pii> vpii;
const int mod = 1000000007;
const int N = 3e5;

int kadane(int*a, int n);
bool isPrime(int n);
int mpow(int a, int b);

int knapsack(int w[], int v[],int s, int W, int n,int**dp){
    // er(s,W);
    // nl
    if(s==n) return 0;
    if(W<=0) return 0;
    if(dp[s][W]>-1) return dp[s][W];
    int ans;
    if(W-w[s]>=0)
    ans= max(knapsack(w,v,s+1,W-w[s],n,dp)+v[s], knapsack(w,v,s+1,W,n,dp));
    else ans= knapsack(w,v,s+1,W,n,dp);
    dp[s][W]=ans;
    return ans;
}

void solve(){
  int n,W;
  cin>>n>>W;
  int w[n],v[n];
  f(i,0,n) cin>>w[i]>>v[i];
  int **dp=new int*[n+1];
  f(i,00,n+1) dp[i]=new int[W+1];
    f(i,0,n+1) f(j,0,W+1) dp[i][j]=-1;
  cout<<knapsack(w,v,0,W,n,dp)<<endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // int t;
    // cin>>t;
    // while(t--)
    solve();
        
}

int mpow(int a, int b){ /* pow(a, b) % m */
  int m=mod;
  int x=1;
  while (b>0){
    if (b&1){
      x=(x * a) % m;
    }
    a=(a*a) % m; /* compute the next power of 2 */
    b>>=1; /* this is equivalent to b = floor(b / 2) */
  }
  return x;
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; 
} 

int kadane(int*a, int n){
    int max_so_far = INT_MIN, max_ending_here = 0;
    f(i,0,n){
        max_ending_here+=a[i];
        max_so_far = max(max_so_far, max_ending_here);
        if(max_ending_here<0) max_ending_here=0;
    }
    return max_so_far;
}

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

using namespace std;

int main(){
	vector<int> RailRoad, out;
	int buf;

	// 入力の終わりまで読み込み
	while(cin >> buf){
		if(buf == 0){
			buf = RailRoad[((int)RailRoad.size() - 1)];
			out.push_back(buf);
			RailRoad.pop_back();
		}else{
			RailRoad.push_back(buf);
		}
	}

	// イテレータの初期化
	for(vector<int>::iterator it = out.begin();it != out.end();++it){
		cout << *it << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
n=gets.to_i
a=[]
n.times{
  a<<gets.split
}
c=[]
flag=false
check=0
while b=a.shift do
  flag=false
  case b[0]
  when "insert"
    c<<b[1]
  when "delete"
    c.each_with_index{|x,i|
      if b[1]==x
        check=i
        flag=true
      end
    }
    c.delete_at(check) if flag
  when "deleteFirst"
    c.pop
  when "deleteLast"
    c.shift
  end
end
puts c.reverse.join(" ")


Measured memory_bytes: 299192
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpii = vector<pll>;

int main(){
  ll L;
  cin >> L;

  double vol = (double)(L*L*L) / 27.0;

  cout << fixed << setprecision(10) << vol << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int L, R, d;
    cin >> L >> R >> d;
    cout << R/d - (L-1)/d << endl;
}


Measured memory_bytes: 3616
N = int(input())

def check(k):
    h3 = h5 = h7 = False
    while k:
        d = k%10
        h3 |= d == 3
        h5 |= d == 5
        h7 |= d == 7
        k //= 10
    return h3 and h5 and h7

ans = 0
stack = [3,5,7]
while stack:
    k = stack.pop()
    if k > N:
        continue
    if check(k):
        ans += 1
    stack.extend([k*10+3, k*10+5, k*10+7])

print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
                solve();
	}

    private static void solve() {
    	Scanner sc = new Scanner(System.in);
    	char[] sCode = sc.next().toCharArray();

    	boolean isExistSameCode = false;
    	for(int i = 0; i < 3; i++)
    	{
    		if(sCode[i] == sCode[i+1]) {
    			isExistSameCode = true;
    			break;
    		}
    	}

    	if(isExistSameCode)
    	{
    		System.out.print("Bad");
    	}
    	else System.out.print("Good");
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

struct edge{int to,cost;};
vector<int> G[100005];
 
long long int n,m,k,i,j=1;
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1,};

std::vector<int> tree[100010];
double wei,sio,noudo;
int d1[100005],dn[100005];
char s[105];
int kazu=0,v=0;
int a=0,b=100;
int hidari=0,migi=0;

int main(){
	cin>>n;
	cin>>s;
	for(i=0;i<n;i++){
		if(s[i]=='('){
			a++;
		}else{
			a--;
		}
		b=min(a,b);
	}
	if(b==1)b=0;
	hidari = -b;
	a = a-b;
	migi = a;
	for(i=0;i<hidari;i++){
		cout<<"(";
	}
	for(i=0;i<n;i++){
		cout<<s[i];
	}
	for(i=0;i<migi;i++){
		cout<<")";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

const ll mod = static_cast<ll>(1e9) + 7;

int main()
{
    ll N;
    cin >> N;

    vector<ll> A(N);
    for (auto& a : A) { cin >> a; }

    vector<ll> B(N);
    fill(B.begin(), B.end(), 0);

    ll M = 0;

    for (ll i=N;i>=1;--i)
    {
        for (ll j=i;j<=N;j+=i) { B[i - 1] += B[j - 1]; }
        B[i - 1] += A[i - 1];

        B[i - 1] %= 2;
        M += B[i - 1];
    }

    cout << M << endl;

    if (M != 0)
    {
        for (ll i=0;i<N;++i)
        {
            if (B[i]) { cout << i + 1 << " "; }
        }

        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
const int N = 1e5 + 5;

int n;
map <vector <int>, int> cnt;


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

    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        string s;
        cin >> s;
        vector <int> v(26, 0);
        for(int j = 0; j < (int)s.size(); j++)
            v[s[j] - 'a']++;
        cnt[v]++;
    }

    ll ans = 0;
    for(auto it: cnt)
        ans += 1LL * it.second * (it.second - 1);
    ans /= 2;
    cout << ans << endl;


    return 0;
}


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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    int m;
    cin >> n >> m;
    vector<int> a(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < m; i++) {
        if (a[i] % 2 == 1) {
            swap(a[i], a[0]);
        }
    }
    for (int i = 1; i < m; i++) {
        if (a[i] % 2 == 1) {
            swap(a[i], a[m - 1]);
        }
    }
    for (int i = 1; i < m - 1; i++) {
        if (a[i] % 2 == 1) {
            cout << "Impossible\n";
            return 0;
        }
    }
    vector<int> b = a;
    b[0]--;
    if (a[0] % 2 == 0 || m == 1) {
        b.push_back(1);
    } else {
        b.back()++;
    }
    vector<int> bb;
    for (int x : b)
        if (x > 0) bb.push_back(x);
    b = bb;
    for (int x : a) {
        cout << x << " ";
    }
    cout << "\n";
    cout << b.size() << "\n";
    for (int x : b) {
        cout << x << " ";
    }

    return 0;
}

Measured memory_bytes: 256
from collections import Counter 
n = int(input())
a = list(map(int, input().split()))
s = set(a)
c = Counter(a)
t = [0] * (10**6 + 1)
for i in s:
    for j in range(i, 10**6+1, i):
        t[j] += 1

ans = len([1 for i in s if t[i] == 1 and c[i] == 1])
print(ans)



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

int main() {
	int n;
	cin>>n;
	vector<int> a(n);
	int mx=1;
	long long ans=0;
	for(int i=0;i<n;i++)
	{
	    cin>>a[i];
	    if(i==0)
	        mx=a[i];
	    else
	    {
	        if(mx<a[i])
	            mx=a[i];
	        else
	        {
	            ans+=(a[i]-mx);
	        }
	    }
	}
	cout<<-1*ans<<endl;
}


Measured memory_bytes: 4044
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
int main()
{
    int i;
  string s,t,ans;
  cin>>s;
  cin>>t;
  ans="";
  for(i=0;i<t.length()-1;i++)
  {
    ans+=string(1,t[i]);
  }
  if(ans==s)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3632
num_ver, num_edge = map(int,input().split())
# 隣接行列
graph_mat = [[0]*num_ver for _ in range(num_ver)]

for i in range(num_edge):
    start, goal = map(int,input().split())
    start -= 1
    goal -= 1
    graph_mat[start][goal] = 1
    graph_mat[goal][start] = 1

visited = [0] * num_ver

def dfs(now, depth):
    if visited[now]:
        return 0
    if depth == num_ver - 1:
        return 1
    
    visited[now] = 1
    num_path = 0

    for ver in range(num_ver):
        if graph_mat[now][ver]:
            num_path += dfs(ver, depth + 1)
    
    # 別の一筆書きの道として探索されることを考慮、もちろん頂点1についてはこれは意味ない
    visited[now] = 0

    return num_path
print(dfs(0,0))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>

int n,game[200][3],res[200];

int main(){
	std::cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			std::cin>>game[i][j];
		}
	}
	for(int i=0;i<3;i++){
		for(int j=0;j<n;j++){
			int count=0;
			for(int k=0;k<n;k++){
				if(game[j][i]==game[k][i])count++;
			}
			if(count==1)res[j]+=game[j][i];
		}
	}
	for(int i=0;i<n;i++)std::cout<<res[i]<<std::endl;
	return 0;
}

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

using namespace std;

// input
int h,a;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> a;

  int ans = 0;
  while(true) {
    if(h <= 0) break;
    h -= a;
    ans += 1;
  }
  cout << ans;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
D = list(map(str,map(int,input().split())))

n = N
while True:
    s = str(n)
    S = set(list(s))
    for c in S:
        if c in D:
            break
    else:
        break
    n += 1
print(n)

Measured memory_bytes: 41324
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main() {
  string s;
  cin >> s;
 
  set<string> v;
 
  string x = "";
  string prev = "";
  int ans = 0;
  rep(i,s.size()) {
    x.push_back(s[i]);
    if (x == prev) continue;
    prev = x;
    x = "";
    ans++;
  }
 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr int MOD = 1000000007;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

VL prime_decomposition(ll n) {
	ll i = 2;
	VL table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace_back(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace_back(n);
		return table;
	}
}

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

	cout << ((m==100)?101:m);
	REP(i, n) {
		cout << "00";
	}
	cout << endl;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc053/tasks/abc053_b

s = input()
n = len(s)
for i in range(n):
    if s[i] == 'A':
        start = i
        break
for i in range(n - 1, -1, -1):
    if s[i] == 'Z':
        end = i
        break
print(end + 1 - start)




Measured memory_bytes: 3516
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
//using
using namespace std;
/*using vi = vector<int>;
using vs = vector<string>;
using vc = vector<char>;*/
//define
#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
//グローバル変数宣言
int a=0,b=0,c=0,d=0,n=0;

//int sa(int n,int p){if(n>=p)return n-p;else return p-n;}

signed main(){
    cin>>a>>b>>c;
    vector<vector<int> > x(a, vector<int>(b));
    vector<int>y(b);
    rep(i,b)cin>>y[i];
    rep(i,a)rep(j,b)cin>>x.at(i).at(j);
    rep(i,a)
    {
        d=c;
        rep(j,b)d+=x[i][j]*y[j];
        if(d>0)n++;
    }
    print(n);
}

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

bool isPalindrome(string a) {
    for(int r = 0; r < a.size() / 2; r++) {
        if(a[r] != a[a.size() - r - 1]) return(false);
    }
    return(true);
}

int main(void) {
    string check;
    int sum = 0;
    while(cin >> check) {
        sum += isPalindrome(check);
    }
    cout << sum << endl;
    return(0);
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
 
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define asd(i,n,N) for(int i=n;i< N;++i)
#define rap(i,n,N) for(int i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>> " << #x << " -> " << x << endl
#define mems(x,y) memset(x,y,sizeof x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define plll pair<pll,ll>
#define piii pair<pii,int>
#define piiii pair<pii,pii>
#define psi pair<string,int>
//#define endl '\n'
const int MAX = 1e6+5;
const ll MAX2 = 11;
const ll MOD = 1000000007;
const ll MOD2 = 1000005329;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 555;

ll n,x,y,d,ans;

int main(){
//	cout<<fixed<<setprecision(10);
//	freopen("input.txt", "r", stdin);
//	freopen("astar.out","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n>>d; d*=d;
    rep(i,1,n){
    	cin>>x>>y;
    	if(x*x+y*y<=d)++ans;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
#include <cassert>
#include <bit>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
using Edge=pair<int,ll>;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// g++ -o a a.cpp -Wall -lm -std=c++17

int main(){
    int n;cin>>n;
    int c[4];
    memset(c,0,sizeof(c));
    rep(i,n){
        string s;cin>>s;
        if(s=="AC")c[0]++;
        else if(s=="WA")c[1]++;
        else if(s=="TLE")c[2]++;
        else c[3]++;
    }
    cout<<"AC x "<<c[0]<<endl;
    cout<<"WA x "<<c[1]<<endl;
    cout<<"TLE x "<<c[2]<<endl;
    cout<<"RE x "<<c[3]<<endl;
}

Measured memory_bytes: 3624