akhauriyash/Code-Regression huggingface dataset:
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc089_a.cpp
 * time   : Thu Apr 30 18:03:36 2020
 * quest  : A - Grouping 2
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  cout << ((n < 3) ? 0 : (n / 3)) << "\n";
  return 0;
}


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

int main()
 {
 	int n,i,f=0,g=0;
 	cin>>n;
 	int a[n];
 	for(i=0;i<n;i++)
 		cin>>a[i];
 	for(i=0;i<n;i++)
		 {
 			if(a[i]%2==0)
 				{
 					if(a[i]%3!=0)
 						{
 							if(a[i]%5!=0)
 								{
 									f=1;
 									break;
								 }
						 }	
 						
					 		
				 }
		 }
		 if(f==1)
		 	cout<<"DENIED"<<endl;
		else
			cout<<"APPROVED"<<endl;
 	return 0;
 }

Measured memory_bytes: 3600
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
			int sum=0;
		for(int j=1; j<=n; j=j+2){
			// スペース区切りの整数の入力
				int miniSum =0;
			for(int i=1; i<=j; i++){
				if(j % i == 0){
				miniSum++;
				}
			}
			if(miniSum==8){
				sum++;
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define N 220000
using namespace std;
struct node{
	int x,a;
}a[N];
int n,m,Q;
int tot;
int get(int x,int y){
	if(x==0)return y+1;
	if(y==m)return x+200000001;
	if(x==n)return m-y+400000001;
	if(y==0)return n-x+600000001;
	return 0;
}
bool cmp(node x,node y){
	return x.x<y.x;
}
int q[N];
int main(){
	scanf("%d%d%d",&n,&m,&Q);
	for(int i=1;i<=Q;i++){
		int x,y,A,B;
		scanf("%d%d%d%d",&x,&y,&A,&B);
		int L=get(x,y);
		int R=get(A,B);
		if(L==0||R==0)continue;
		tot++;
		a[tot].x=L;
		a[tot].a=i;
		tot++;
		a[tot].x=R;
		a[tot].a=i;
	}
	sort(a+1,a+1+tot,cmp);
	int tail=0;
	for(int i=1;i<=tot;i++){
		if(a[i].a==a[q[tail]].a)tail--;
		else q[++tail]=i;
	}
	if(tail==0)printf("YES\n");
	else printf("NO\n");
}

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

int main()
{
    int H, W;
    scanf("%d%d", &H, &W);
    vector<string> s(H + 1);
    for (int i = 1; i <= H; i++) {
        cin >> s[i];
    }
    for (int i = 1; i <= H; i++) {
        cout << s[i] << "\n" << s[i] << endl;
    }
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    k = II()
    print('ACL' * k)

if __name__ == '__main__':
    solve()



Measured memory_bytes: 9100
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> range(n);
    for (int i = 0; i < n; ++i) {
        int l, r;
        cin >> l >> r;
        range[i].first = l;
        range[i].second = r;
    }
    sort(range.begin(), range.end());

    auto rmin_it = range.begin();
    for (auto it = range.begin() + 1; it != range.end(); ++it) {
        if (it->second < rmin_it->second)
            rmin_it = it;
    }
    auto rmin = *rmin_it;
    range.erase(rmin_it);

    vector<int> min_r(range.size());
    min_r.back() = inf;
    for (int i = min_r.size() - 2; i >= 0; --i) {
        min_r[i] = min(range[i + 1].second, min_r[i + 1]);
    }

    int ans = -inf;
    if (rmin.first < range.back().first) {
        for (int i = 0; i < range.size() - 1; ++i) {
            ans = max(ans, max(range[i].second - range[i].first + 1, 0) + max(rmin.second - range.back().first + 1, 0));
        }

        for (int i = 0; i < range.size() - 1; ++i) {
            int lmax = max(range[i].first, rmin.first);
            ans = max(ans, max(rmin.second - lmax + 1, 0) + max(min_r[i] - range.back().first + 1, 0));
        }

        ans = max(ans, max(rmin.second - rmin.first + 1, 0) + max(min(range[0].second, min_r[0]) - range.back().first + 1,0));
    } else {
        for (int i = 0; i < range.size(); ++i) {
            ans = max(ans, max(range[i].second - range[i].first + 1, 0) + max(rmin.second - rmin.first + 1, 0));
        }
    }

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

Measured memory_bytes: 1408
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝

*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long  t,r=1,r1=0,r2=0,k=0,a,b,c=0,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<pair<long long ,long long>>u;
   // vector<tuple<string,int,
     //      int>>mp;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n;
l(i,1,n)
{
    d=d+(n-1)/i;
}
cout<<d<<endl;

}


Measured memory_bytes: 3648
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s = sc.next();
		int n = s.length();
		if(ispal(s) && ispal(s.substring(0,(n-1)/2)) && ispal(s.substring((n+3)/2-1, n))) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
	static boolean ispal(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return s.equals(sb.toString());
	}
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

}


Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define agewari(a, b) ((ll)a + ((ll)b - 1)) / b
const int MOD = 1000000007;
const long long INF = 1LL << 60;
using Graph = vector<vector<ll>>;

int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    if(a>c&&c>b)cout<<"Yes"<<endl;
    else if(a<c&&c<b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

queue<int> x[20];
int a[1 << 8];

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

	int N, M;
	cin >> N >> M;

	for(int i = 0; i < M; i++) {
		int c;
		cin >> c;
		a[c] = 1;
	}

	for(int i = 0; i < N; i++) {
		x[0].push(i);
	}

	int ans = 0;
	for(int i = 0; ; i++) {
		if(x[i].size() == 1) break;
		while(x[i].size()) {
			int x1, x2;
			x1 = x[i].front();
			x[i].pop();
			if(x[i].size() == 0) {
				x[i + 1].push(x1);
				break;
			}
			x2 = x[i].front();
			x[i].pop();
			if(!a[x1] && !a[x2]) ans++;
			if(a[x1]) {
				x[i + 1].push(x2);
			}
			else {
				x[i + 1].push(x1);
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3192
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 - 1];
    int[] b = new int[N - 1];
    for (int i = 0; i < N - 1; i++) {
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
    }
    sc.close();

    @SuppressWarnings("unchecked")
    List<int[]>[] g = new List[N + 1];
    g[0] = Collections.emptyList();
    for (int i = 0; i < N - 1; i++) {
      if (g[a[i]] == null) g[a[i]] = new ArrayList<>();
      if (g[b[i]] == null) g[b[i]] = new ArrayList<>();
      g[a[i]].add(new int[] {b[i], i});
      g[b[i]].add(new int[] {a[i], i});
    }
    int K = 0;
    for (List<int[]> e : g) K = Integer.max(K, e.size());

    int[] c = new int[N - 1];
    Deque<int[]> q = new ArrayDeque<>();
    q.addLast(new int[] {1, -1});
    while (!q.isEmpty()) {
      int[] n = q.pollFirst();
      int cno = n[0];
      int pid = n[1];

      int ec = 1;
      List<int[]> es = g[cno];
      for (int[] e : es) {
        int dno = e[0];
        int did = e[1];
        if (did == pid) continue;

        if (-1 < pid && ec == c[pid]) ec++;
        c[did] = ec++;
        q.addLast(new int[] {dno, did});
      }
    }
    StringBuilder buf = new StringBuilder();
    for (int i : c) buf.append(i).append(System.lineSeparator());

    System.out.println(K);
    System.out.println(buf);
  }
}

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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

const int N = 2e3 + 5;

int n, x, y;
int ans[N];

int main() {
	scanf("%d %d %d", &n, &x, &y);
	for (int i = 1; i < n; i++) {
		for (int j = i+1; j <= n; j++) {
			int dist;
			if (j <= x) {
				dist = j-i;
			}
			else if (j <= y) {
				if (i <= x) {
					dist = min(y-j+1, j-x) + x-i;
				}
				else {
					dist = min(j-i, i-x + y-j + 1);
				}
			}
			else {
				if (i <= x) {
					dist = j-y + x-i + 1;
				}
				else if (i <= y) {
					dist = j-y + min(y-i, i-x+1);
				}
				else {
					dist = j-i;
				}
			}
			// printf("%d %d %d\n", i, j, dist);
			ans[dist]++;
		}
	}
	for (int i = 1; i < n; i++) printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int64_t count_R = 0,count_G = 0,count_B = 0;
  vector<int> R,G,B;
  rep(i,N){
    if(S.at(i) == 'R'){
      R.push_back(i);
      count_R ++;
    }
    else if(S.at(i) == 'G'){
      G.push_back(i);
      count_G ++;
    }
    else{
      B.push_back(i);
      count_B ++;
    }
  }
  int nozoku = 0;
  rep(i,N-2){
    for(int j = i + 1;j < N-1 ;j++){
      int k = 2*j - i;
      if(k >= N){
        continue;
      }
      if(S.at(i) == S.at(j)){
        continue;
      }
      if(S.at(j) == S.at(k)){
        continue;
      }
      if(S.at(k) == S.at(i)){
        continue;
      }
      nozoku ++;
    }
  }
  cout << int64_t(count_R*count_G*count_B - nozoku) << endl;
  return 0;
}

Measured memory_bytes: 3608
package main

import "fmt"

func main() {
	var n, d, x int
	fmt.Scan(&n, &d, &x)
	sum := 0
	for i := 0; i < n; i++ {
		var v int
		fmt.Scan(&v)
		da := 1
		for {
			if d < da {
				break
			}
			sum++
			da += v
		}
	}
	fmt.Println(x + sum)
}


Measured memory_bytes: 512
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
dxdy=[(1,0),(0,1),(-1,0),(0,-1)]
def resolve():
    H,W=pin()
    maze=[input() for h in range(H)]
    
    for i in range(H):
        for j in range(W):
            if maze[i][j]=="#":
                f=0
                for head in dxdy:
                    x,y=head
                    try:k=maze[i+x][j+y]
                    except IndexError:k=None
                    if k!=None and k=="#":
                        f=1
                if f==0:
                    print("No")
                    return
    print("Yes")
            
#%%submit!
resolve()

Measured memory_bytes: 39664
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int i,j,k,n,W,w,v,ans=0;
	cin>>n>>W;
	vector <long long int> v1,v2;
	for(i=0;i<n;i++){
		cin>>w>>v;
	v1.push_back(w);
		v2.push_back(v);
	}
	long long int dp[100010];
	  for(i=0;i<=100000;i++)
		  dp[i]=1e10;
 
	dp[0]=0;
	for(i=0;i<n;i++)
		for(j=100000;j>=v2[i];j--){
		dp[j]=min(dp[j],v1[i]+dp[j-v2[i]]);
		if(dp[j]<=W)
			ans=max(ans,j);
		}
   
    	cout<<ans<<endl;
	return 0;
}



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

void dfs753(std::vector<int> &list, int N, std::string s);

int main()
{
    int N;
    int cnt = 0;
    std::cin >> N;

    // find number including only 7, 5, 3
    std::vector<int> list;
    dfs753(list, N, "");

    // find answer
    for (int i = 0; i < list.size(); i++)
    {
        int cnt3 = 0;
        int cnt5 = 0;
        int cnt7 = 0;
        int cnt_others = 0;
        std::string s;
        s = std::to_string(list[i]);

        for (int j = 0; j < s.length(); j++)
        {
            int n_target_digit = (s[j] - '0');

            if (n_target_digit == 3)
            {
                cnt3++;
            }
            else if (n_target_digit == 5)
            {
                cnt5++;
            }
            else if (n_target_digit == 7)
            {
                cnt7++;
            }
            else
            {
                cnt_others++;
            }
        }

        if (cnt3 > 0 && cnt5 > 0 && cnt7 > 0 && cnt_others == 0)
        {
            cnt++;
        }
    }

    std::cout << cnt << std::endl;

    return 0;
}

void dfs753(std::vector<int> &list, int N, std::string s)
{
    std::string s_tmp;
    int n_tmp;

    if (s.length() <= 8)
    {
        s_tmp = s + '3';
        n_tmp = std::stoi(s_tmp);
        if (n_tmp <= N)
        {
            list.push_back(n_tmp);
            dfs753(list, N, s_tmp);
        }

        s_tmp = s + '5';
        n_tmp = std::stoi(s_tmp);
        if (n_tmp <= N)
        {
            list.push_back(n_tmp);
            dfs753(list, N, s_tmp);
        }

        s_tmp = s + '7';
        n_tmp = std::stoi(s_tmp);
        if (n_tmp <= N)
        {
            list.push_back(n_tmp);
            dfs753(list, N, s_tmp);
        }
    }
};


Measured memory_bytes: 512
n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]

dp = [[0,0,0] for _ in range(n)]

for i in range(n):
    if i == 0:
        for j in range(3):
            dp[i][j] = li[i][j]
    else:
        for j in range(3):
            for k in range(3):
                if j == k:
                    continue
                dp[i][k] = max(dp[i][k], dp[i-1][j] + li[i][k])

print(max(dp[-1]))

Measured memory_bytes: 49988
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5,mod=1e9+7;
#define ll long long
ll f[N];
ll inv[N];
vector<int> adj[N];
pair<ll,ll> dp[N];
ll ans[N];
ll fp(ll b,ll p)
{
    if(p==0) return 1;
    ll t=fp(b,p/2);
    if(p%2) return t*t%mod*b%mod;
    return t*t%mod;
}
ll ncr(int n,int r)
{
    return f[n]*inv[r]%mod*inv[n-r]%mod;
}
void Merge(int u,int v)
{
    dp[v].first++;
    dp[u].second*=dp[v].second*ncr(dp[u].first+dp[v].first,dp[u].first)%mod;
    dp[u].second%=mod;
    dp[u].first+=dp[v].first%mod;
    dp[u].first%=mod;
    dp[v].first--;
}
void DeMerge(int u,int v)
{
    dp[v].first++;
    dp[u].first-=dp[v].first%mod;;
    dp[u].first=(dp[u].first+mod)%mod;
    dp[u].second=dp[u].second*fp(dp[v].second*ncr(dp[u].first+dp[v].first,dp[u].first)%mod,mod-2)%mod;
    dp[v].first--;
}
void solve(int u,int p)
{
    dp[u].first=0;
    dp[u].second=1;
    for(auto v:adj[u])
        if(v!=p)
        {
            solve(v,u);
            Merge(u,v);
        }
}
void dfs(int u,int p)
{
    ans[u]=dp[u].second;
    for(auto v:adj[u])
        if(v!=p)
        {
            DeMerge(u,v);
            Merge(v,u);
            dfs(v,u);
            DeMerge(v,u);
            Merge(u,v);
        }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    f[0]=1;
    for(int i=1;i<N;i++) f[i]=(f[i-1]*i)%mod;
    for(int i=0;i<N;i++) inv[i]=fp(f[i],mod-2);
    int n;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    solve(1,-1);
    dfs(1,-1);
    for(int i=1;i<=n;i++)
        cout<<ans[i]<<'\n';
    return 0;
}


Measured memory_bytes: 21748
s = input()
n = len(s)
last = [0] * n

# Rについて考える
prev_count = 0
for i in range(n):
  if s[i] == 'R':
    prev_count += 1
    continue
    
  # Lだったので,ここまで流れてきたRの人数を反映
  even_num = prev_count // 2 # 折返し地点までの距離が偶数の人の数
  odd_num = prev_count - even_num # 折返し地点までの距離が奇数の人の数
  last[i] += even_num
  last[i - 1] += odd_num
  prev_count = 0 # フラッシュ

# Lについて考える
prev_count = 0
for i in range(n-1, -1, -1):
  if s[i] == 'L':
    prev_count += 1
    continue
    
  # Rだったので,ここまで流れてきたLの人数を反映
  even_num = prev_count // 2 # 折返し地点までの距離が偶数の人の数
  odd_num = prev_count - even_num # 折返し地点までの距離が奇数の人の数
  last[i] += even_num
  last[i + 1] += odd_num
  prev_count = 0 # フラッシュ

print(*last)

Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
int t, N, A[3][3], B[3][3];
int main()
{
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> A[i][j];
		}
	}
	cin >> N;
	while (N--)
	{
		cin >> t;
		for (int i = 0; i < 3; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				if (A[i][j] == t)
				{
					B[i][j]++;
				}
			}
		}
	}
	if (B[0][0] && B[0][1] && B[0][2] || B[1][0] && B[1][1] && B[1][2] || B[2][0] && B[2][1] && B[2][2] || B[0][0] && B[1][0] && B[2][0] || B[0][0] && B[1][0] && B[2][0] || B[0][1] && B[1][1] && B[2][1] || B[0][2] && B[1][2] && B[2][2] || B[0][0] && B[1][1] && B[2][2] || B[2][0] && B[1][1] && B[0][2])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void){
	char n[200000];
  int sum=0;
  scanf("%s",n);

	for(int i=0;i<strlen(n);i++){
    	sum += n[i]-48;

    }

  if(sum%9==0) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 1924
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    map<int,int> m;
    rng(i,1,n){
        int x; cin >> x;
        x--;
        m[x]++;
    }
    rep(i,n){
        cout << m[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 13008
S = list(input())
S = set(S)

if len(S) == 4:
    print ('Yes')
    exit()

if 'N' in S and 'S' in S and len(S) == 2:
    print ('Yes')
    exit()

if 'E' in S and 'W' in S and len(S) == 2:
    print ('Yes')
    exit()

print ('No')

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool sqr(int n)
{
    return pow(round(sqrt(n)),2) == n;
}
int str_to_int(string a)
{
    int sum = 0;
    for(int i = 0;i < a.size();i++)
    {
        sum = sum * 10 + (a[i] - '0');
    }
    return sum;
}
int main()
{
    string a,b;
    cin >> a >> b;
    a = a + b;
    int c = str_to_int(a);
    if(sqr(c))
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner stdIn = new Scanner(System.in)) {
			Rectangle rectangle = new Rectangle();
			while (true) {
				int h = stdIn.nextInt();
				int w = stdIn.nextInt();
				if (h > 300 || w > 300) {
					throw new RuntimeException("Input Error:range 0 to 300");
				}
				if (h == 0 && w == 0) {
					break;
				}
				rectangle.setChar('#');
				rectangle.draw(h, w);
				System.out.println("");
			}
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}
}

final class Rectangle {
	private Character displayChar = '*';

	/**
	 * Set a character to draw shape
	 * @param displayChar a character
	 */
	protected void setChar(Character displayChar) {
		this.displayChar = displayChar;
	}

	/**
	 * Draw square
	 * @param height Height of square
	 * @param width Width of square
	 */
	protected void draw(int height, int width) {
		if (height < 0 || width < 0) {
			throw new RuntimeException("Input Error:Minus value input");
		}
		for (int i = 1; i <= height; i++) {
			for (int j = 1; j <= width; j++) {
				System.out.print(this.displayChar);
			}
			System.out.println("");
		}
	}
}

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

int main() {
  int A, B, T;
  cin >> A >> B >> T;
  int ans = (T/A)*B;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    long long int n,k;
    cin>>n>>k;
    long long int result=n/k;
    long long int result2=0;
    if(k%2==0)
    {
        result2+=((2*n)/k);
        result2-=result;

    }
    long long int result1=0;
    long long int r1=1,r2=1;
    for(long long int i=0;i<3;i++)
    {
        r1*=result;
        r2*=result2;
    }
    cout<<r1+r2;
    
}

Measured memory_bytes: 3600
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

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

int main()
{
	deque<bool> is_prime(50022,true);
	is_prime[0]=is_prime[1]=false;
	repi(i,2,is_prime.size()){
		if(!is_prime[i])
			continue;
		for(int j=i+i;j<(int)is_prime.size();j+=i)
			is_prime[j]=false;
	}
	for(int n;cin>>n;){
		for(int i=n-1;;i--){
			if(is_prime[i]){
				cout<<i<<" ";
				break;
			}
		}
		for(int i=n+1;;i++){
			if(is_prime[i]){
				cout<<i<<endl;
				break;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i=0; i<n; i++) {
    cin >> x[i];
  }

  vector<int> sortedx = x;
  sort(sortedx.begin(), sortedx.end());

  for (int i=0; i<n; i++) {
    if (x[i] >= sortedx[n/2]) {
      cout << sortedx[n/2-1] << endl;
    } else {
      cout << sortedx[n/2] << endl;
    }
  }

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  
  for (int i=0;i<N;i++){
    cin >> A.at(i);
  }
  
  bool check = true;
  for (int i=0;i<N;i++){
    if(A.at(i) % 2 == 0){
      if (A.at(i) % 3 != 0 && A.at(i) % 5 != 0){
        check = false;
      }
    }
  }

  
  if (check == false) {
    cout << "DENIED" << endl;
  } else {
    cout << "APPROVED" << endl;
  }
    
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair <int, int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
const int mod = 1000000007;

ll dp[100100];
int main() {
   int n,m;
   cin >> n>>m;
   int ans= (n-m)*100+1900*m;
   rep(i,m){
       ans*=2;
   }
   cout << ans <<endl;
}

Measured memory_bytes: 3592
n=int(input())
a=b=c=d=0
for i in range(n):
    s=input()
    if s=='AC':a+=1
    elif s=='WA':b+=1
    elif s=='TLE':c+=1
    else:d+=1
print('AC x',a)
print('WA x',b)
print('TLE x',c)
print('RE x',d)

Measured memory_bytes: 9212
from math import factorial
from itertools import permutations

n=int(input())
np=factorial(n)
p_list=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

ans=[]
for s,t,u in permutations(p_list,3):
  num1=(s**4)*(t**4)*(u**2)
  num2=(s**14)*(t**4)
  num3=(s**24)*(t**2)
  num4=s**74
  for z in [num1,num2,num3,num4]:
    if np%z==0:
      ans.append(z)

print(len(set(ans)))

Measured memory_bytes: 3188
N = input()
K = input()

def fact(x):
  r = 1
  while x>0:
    r *= x
    x -= 1
  return r

def comb(x, y):
  if y>x:
    return 0
  return fact(x)/fact(y)/fact(x-y)

N = str(N+1)
def f(d, k):
  if k==0:
    if d>=len(N) or int(N[d:])==0:
      return 0
    else:
      return 1
  while d<len(N) and N[d]=="0":
    d += 1
  if d>=len(N):
    return 0
  return (
    comb(len(N)-d-1, k)*9**k +
    (int(N[d])-1)*comb(len(N)-d-1, k-1)*9**(k-1) +
    f(d+1, k-1))

print f(0, K)


Measured memory_bytes: 2696
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    char s;
    cin>>s;
    if(s>='A' && s<='Z')
        cout<<"A"<<endl;
    else
        cout<<"a"<<endl;
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std; 
 
int N,K,ans = 1;
string S;
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	cin >> N >> K >> S;
 
	int cnt=0,len=0;
 
	for(int i=0;i<N;++i){
		if(S[i] =='0'){
			if(i == 0 || S[i - 1] == '1'){
				cnt++;
			}
		}
		if(cnt > K){
			while(S[len] == '1'){
				len++;
			}
			while(S[len] == '0'){
				len++;
			}
			cnt--;
		}
		ans = max(ans,i - len + 1);
	}
 
 
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int n,t[120],m,p[120],x[120];
    scanf ("%d",&n) ;
    for (int i=0; i<n; i++){
        scanf ("%d",&t[i]) ;
    }
    scanf ("%d",&m) ;
    for (int i=0; i<m; i++){
        scanf ("%d%d",&p[i],&x[i]) ;
    }
    for (int i=0; i<m; i++){
        int ans=0 ;
        for (int j=0; j<n; j++){
            if (j==p[i]-1){
                ans+=x[i] ;
            } else {
                ans+=t[j] ;
            }
        }
        printf ("%d\n",ans) ;
    }
    return 0 ;
}

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

int main() {
    int N, L;
    cin >> N >> L;
    int origin_aji = (2 * L + N - 1) * N / 2;
    if (L <= 0 && (L + N - 1) >= 0) cout << origin_aji << endl;
    else if (L < 0 && (L + N - 1) < 0) cout << origin_aji - (L + N - 1) << endl;
    else cout << origin_aji - L << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int N,M;
    int i,j,k;
    scanf("%d",&N);
    scanf("%d",&M);
    int tar[110],nam[110][110],score[110] = {0};
    for(i = 1;i <= M;i++){
        scanf("%d",&tar[i]);
    }
    for(i = 1;i <= M;i++){
        for(j = 1;j <= N;j++){
            scanf("%d",&nam[i][j]);
        }
    }
    for(i = 1;i <= M;i++){
        for(j = 1;j <= N;j++){
            if(tar[i] == nam[i][j]){
                //printf("??????%d?????????\n",j);
                score[j] += 1;
            }
            else {
                //printf("??????%d?????????\n",tar[i]);
                score[tar[i]] += 1;
            }
        }
        //printf("--------------\n");
    }
    for(i = 1;i <= N;i++){
        printf("%d\n",score[i]);
    }


    return 0;
}

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

int abc(vector<int> &a1,vector<int> &a2,int n)
{
	vector<int>a3(n);
	a3=a1;
	sort(a3.begin(),a3.end());
	int a,b;
	a=0,b=0;
	int flag1=0,flag2=0;
	do{
		if(a1==a3 && flag1==0)
		{
			flag1=1;
		}
		if(flag1==0)
		{
			a++;
		}
		if(a2==a3 && flag2==0)
		{
			flag2=1;
		}
		if(flag2==0)
		{
			b++;
		}
		if(flag1&&flag2)
			return abs(a-b);
	}while(next_permutation(a3.begin(),a3.end()));
}

int main()
{
	int n;
	cin>>n;
	vector<int> a1(n),a2(n);
	for(int i=0;i<n;++i)
		cin>>a1[i];
	for(int i=0;i<n;++i)
	{
		cin>>a2[i];
	}
	cout<<abc(a1,a2,n);
}



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

int main(){
    int k,n,a;
  	vector<int> v;
	cin >> k >> n;
    for (int i = 0; i < n ; i++) {
          cin >> a; 
          v.push_back(a);
    }
	
	sort(v.begin(), v.end());
  	v.push_back(k+v[0]);
  
    int b=0,c; 
    for (int i = 0; i < n ; i++) {
    	c += v[i+1] - v[i]; 
      	b = max(b, v[i+1] - v[i]);        
        }  
 
  	
 	cout << c - b << endl; 
    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pr pair<int,int>
#define endl "\n"
#define MOD 1000000007 // 10^9 + 7
#define sz(x) (int)(x).size()
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
#define all(c) (c).begin(), (c).end()

#define FOR(i,b) for (int i = 0; i < (b); i++)
#define FORR(i,a,b) for (int i = a; i < (b); i++)
#define FORB(i,b) for (int i = (b); i >= (0); i--)
#define FORRB(i,a,b) for (int i = (a);i>= (b); i--)
#define MAXN 3010
using namespace std;

string s,t;
int dp[MAXN][MAXN];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	//freopen("addin.txt","r",stdin);
	//freopen("addout.txt","w",stdout);	
	cin >> s >> t;
	int s1 = s.size();
	int s2 = t.size();
	for(int i = 0;i < s1;i++){
		for(int j = 0 ;j < s2 ;j++){
			if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j]+1;
			else dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
		}
	}
	if(dp[s1][s2] == 0) cout<<" "<<endl;
	else {
		string res;
		int i = s1 , j = s2;
		while(i > 0 && j > 0){
				if(s[i-1] == t[j-1]) {
					res += s[i-1];
					i--; j--;
				}
				else if(dp[i-1][j] >= dp[i][j-1]) i--;
				else j--;
		}
		reverse(all(res));
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 35584
/* Author : Harshit Jain a.k.a. iharshit009 */
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define sortrev(x)       sort(all(x), greater<int>())
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int              long long
#define ld               long double
#define endl 			 "\n";
#define mp 				 make_pair
#define pii 			 <int, int>
#define lb 				 lower_bound
#define ub				 upper_bound
#define len(a)           int((a).size())
#define prec(n)          fixed<<setprecision(n)
#define cnt(n)           __builtin_popcountll(n)
#define pi               pair<int, int>
const int mod = 1000000007;
using namespace std;
using namespace std::chrono;
// const int N = 1e5 + 5; 
// int n;
// int a[N];



int32_t main(){
auto start = high_resolution_clock::now(); // starting clock
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
t = 1;
// cin >>t;
while(t--){

int d,t,s;
cin >> d>>t>>s;
if(s*t >= d){
	cout << "Yes" << endl;
}
else{
	cout << "No" << endl;
}








}
auto stop = high_resolution_clock::now(); // stop clock
auto duration = duration_cast<microseconds>(stop - start);  // printing duration
cerr << "Time taken by function: " << duration.count() << " milliseconds" << endl; 
return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)
const ll INF=1e17;
using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  ll a,b,q,x,y;
  cin>>a>>b>>q;
  vector<ll> s,t;
  map<ll,ll> m;
  rep(i,0,a) {cin>>y; if(m.find(y)==m.end()) s.pb(y),m[y]=1;}
  m.clear();
  rep(i,0,b) {cin>>y; if(m.find(y)==m.end())t.pb(y),m[y]=1;}

  sort(all(s));
  sort(all(t));

  rep(i,0,q){
    cin>>x;
    ll ans=INF;
    ll si,tj,tj1,idx= lower_bound(all(t),x)-t.begin();

    if(idx==t.size()) tj1=INF;
    else tj1=t[idx];
    if(idx==0) tj=-INF;
    else tj=t[idx-1];
    // cout<<tj<<" "<<tj1<<endl;

    ll idx1=lower_bound(all(s),x)-s.begin(),idx2=lower_bound(all(s),x)-s.begin();
    if(idx1==s.size()) si=s[idx1-1];
    else si=s[idx1];

    if(si>=tj1) ans=min(ans,si-x);
    else if(x<=si) ans=min(ans,tj1-x),ans=min(ans,min(abs(x-tj),abs(x-si))+abs(si-tj));
    else if(si>=tj )ans=min(ans,min(abs(x-si),abs(x-tj1))+abs(si-tj1)),ans=min(ans,min(abs(x-tj),abs(x-si))+abs(si-tj));
    else ans=min(ans,abs(x-si));

      // cout<<si<<"...."<<ans<<endl;

    if(idx2==s.size()) si=s[idx2-1];
    else if(idx2>=1 )si=s[idx2-1];
    else si=s[idx2];

    if(si>=tj1) ans=min(ans,si-x);
    else if(x<=si) ans=min(ans,tj1-x),ans=min(ans,min(abs(x-tj),abs(x-si))+abs(si-tj));
    else if(si>=tj )ans=min(ans,min(abs(x-si),abs(x-tj1))+abs(si-tj1)),ans=min(ans,min(abs(x-tj),abs(x-si))+abs(si-tj));
    else ans=min(ans,abs(x-si));


    // cout<<si<<"...."<<ans<<endl;
    cout<<ans<<endl;
  }
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 11368
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int cur;
string s;
stack<double> st;

int digit(){
	return s[cur++]-'0';
}

double number(){
	double n=digit();
	while(isdigit(s[cur]))n=n*10+digit();
	return n;
}

int main(){
	while(getline(cin,s)){
		cur=0;
		while(cur<s.size()){
			if(isdigit(s[cur])){
				//double n=digit();
				//while(isdigit(s[cur]))n=n*10+digit();
				st.push(number());
			}
			else{
				char op=s[cur++];
				if(cur==s.size()||s[cur]==' '){
					double v2=st.top();st.pop();
					double v1=st.top();st.pop();
					if(op=='+')st.push(v1+v2);
					if(op=='-')st.push(v1-v2);
					if(op=='*')st.push(v1*v2);
					if(op=='/')st.push(v1/v2);
				}
				else st.push(-number());
			}
			cur++;
		}
		printf("%.6f\n",st.top());st.pop();
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e15)+1;
const ll mod = ll(1e9)+7;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans %= mod;
        ans *= power(i + 1, mod - 2);
        ans %= mod;
    }
    return ans;
}
int main(){
    vector<char> s(2 * 1e5);
    ll l = 2 * 1e5,r = 2 * 1e5;
    string S;
    cin >> S;
    rep0(i, S.size())s.push_back(S[i]);
    r += S.size() - 1;
    ll q;
    cin >> q;
    bool re = false;
    rep0(i, q){
        int t,f;
        char c;
        cin >> t;
        if(t == 1){
            re = !re;
        }else if(t == 2){
            cin >> f >> c;
            if(re){
                if(f == 1)f = 2;
                else f = 1;
            }
            if(f == 1){
                --l;
                s[l] = c;
            }else if(f == 2){
                s.push_back(c);
                ++r;
            }
        }
    }
    if(re){
        for (ll i = r; i >= l; --i)cout << s[i];
    }else{
        nfor(i, l, r + 1)cout << s[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1084
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int ans=0;
    for(int i=0;i<n;i++)
    if(s[i]!=t[i])
    ans++;
    cout<<ans;
}

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

int main(){
	string s,t;
  	cin>>s>>t;
	for(int i=0;i<s.size();++i){
    	char h=s[s.size()-1];
      	s.pop_back();
      	s.insert(s.begin(),h);
      	if(s==t){cout<<"Yes"<<endl;return 0;}
    }cout<<"No"<<endl;return 0;
}

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

int mod = 1000000007;
int64_t large = 9223372036854775807;

int main()
{
    int64_t N, K;
    cin >> N >> K;

    vector<int64_t> list(N);
    vector<int64_t> route(N + 1);
    vector<bool> arrived(N, false);

    for (int64_t i = 0; i < N; i++)
    {
        cin >> list[i];
        list[i]--; 
    }
    int64_t now = 0; //現在地
    int64_t roop, amari; //何回周期か、周期に入る前に何回動くか
    arrived[0] = true; //訪問済みかどうか
    route[0] = 0;

    for (int64_t i = 0; i < N; i++)
    {
        now = list[now];
        route[i + 1] = now;
        //訪問済み
        if(arrived[now])
        {
            for (int64_t j = 0; j <= i; j++)
                if (route[j] == now)
                {
                    amari = j;
                    roop = i - j + 1;
                }       
            break;
        }
        else
            arrived[now] = true;
    }

    if (amari + roop <= K)
        K = (K - amari) % roop + amari;

    cout << route[K] + 1;
}

Measured memory_bytes: 6428
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)

visited = None
S = None
H, W = None, None


def bfs(x, y):
    global visited
    if visited[y][x]:
        return 0
    q = []
    q.append((x, y))
    black = 0
    white = 0
    while q != []:
        x, y = q.pop()
        DIR = [(-1, 0), (1, 0), (0, 1), (0, -1)]
        for d in DIR:
            nx, ny = x + d[0], y + d[1]
            if 0 <= nx < W and 0 <= ny < H and S[y][x] != S[ny][nx] and not visited[ny][nx]:
                visited[ny][nx] = True
                if S[ny][nx] == '.':
                    white += 1
                else:
                    black += 1
                q.append((nx, ny))
    return black * white


def solve():
    global H, W
    global S
    global visited
    H, W = Scanner.map_int()
    S = Scanner.string_list(H)
    visited = [[False for _ in range(W)] for _ in range(H)]
    ans = 0
    for x in range(W):
        for y in range(H):
            ans += bfs(x, y)
    print(ans)


def main():
    # sys.stdin = open("sample.txt")
    # print('YNEOS'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 14280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int a, b, c;
		Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		System.out.println(a + b >= c ? "Yes" : "No");
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b;cin>>a>>b;
  	cout << (3*a+b)/2 << ednl;
}


Measured memory_bytes: 256