akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n;
    seika s;
    cin >> n >> s;
    akari<int> dp(1000), one(10), ia(100);
    for (int i = 0; i < n; i++)
    {
        int x = s[i] - '0';
        for (int j = 0; j < 100; j++)
        {
            if (ia[j])
            {
                dp[j * 10 + x] = 1;
            }
        }
        for (int j = 0; j < 10; j++)
        {
            if (one[j])
            {
                ia[j * 10 + x] = 1;
            }
        }
        one[x] = 1;
    }
    cout << accumulate(dp.begin(), dp.end(), 0) << endl;
}

int main()
{
    solve();
    return 0;
}


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

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

	string noun;
	cin>>noun;

	if(noun[noun.size()-1]!='s')
		cout<<noun<<'s'<<endl;
	else
		cout<<noun<<"es"<<endl;

}

Measured memory_bytes: 3632
/*#include <bits/stdc++.h>
#define N 300010
using namespace std;

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n,D[N][3],F[N],ct[2][2],vis[N];
struct BIT
{
	int tree[N];
	inline void add(int x,int y)
	{
		for(;x<=n;x+=x&-x)
			tree[x]+=y;
	}	
	inline int query(int x)
	{
		int ret=0;
		for(;x;x-=x&-x)
			ret+=tree[x]; 
		return ret;
	}
}A[2];
int main()
{
	n=read(); 
	for(int i=1;i<=n;i++)
		D[i][0]=read();
	for(int i=1;i<=n;i++)
		D[i][1]=read(); 
	for(int i=1;i<=n;i++)
		D[i][2]=read();
	for(int i=1;i<=n;i++)
	{
		int x[3];
		x[0]=D[i][0];
		x[1]=D[i][1];
		x[2]=D[i][2];
		sort(x,x+3);
		if(x[0]%3!=1) 
		{
			puts("No");
			return 0;
		}
		if(fabs(x[1]-x[0])!=1||fabs(x[2]-x[1])!=1)
		{
			puts("No");
			return 0;
		}
		F[i]=(D[i][0]>D[i][1]);
	}
	for(int i=1;i<=n;i++)
	{
		int rg=(D[i][1]-2)/3+1;
		if(rg>n||rg<1||vis[rg])
		{
			puts("No");
			return 0;
		}
		vis[rg]=1;
		if((rg&1)!=(i&1))
		{
			puts("No");
			return 0;
		}
		if(F[i]!=(abs((rg-i)/2)&1))
			ct[1][i&1]++;
		ct[0][i&1]+=A[i&1].query(n)-A[i&1].query(rg);
		A[i&1].add(rg,1);
	}
	if(ct[0][1]==ct[1][0]&&ct[0][0]==ct[1][1])
		puts("Yes");
	else puts("No");
	return 0;
}*/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=100010;
namespace B{
	int c[N],n;
	inline void init(int _n){
		memset(c+1,0,(n=_n)<<2);
	}
	inline void add(int x,int v){
		for(;x<=n;c[x]+=v,x+=x&-x);
	}
	inline int sum(int x){
		int ans=0;
		for(;x;ans+=c[x],x^=x&-x);
		return ans;
	}
}
inline bool getrev(int a[],int n,int mx){
	B::init(mx);
	bool ans=0;
	for(int i=n-((n&1)^1);i>=1;i-=2){
		ans^=B::sum(a[i])&1;
		B::add(a[i],1);
	}
	return ans;
}
bool vis[N];
int a[3][N],b[N];
inline bool Main(){
	int n=ni;
	for(int i=0;i<3;i++){
		for(int j=1;j<=n;j++){
			a[i][j]=ni;
		}
	}
	memset(vis,0,sizeof(vis));
	bool revt[2]={false,false};
	for(int i=1;i<=n;i++){
		if(a[1][i]%3!=2)return false;
		b[i]=(a[1][i]+1)/3;
		if(vis[b[i]]||((i&1)!=(b[i]&1)))return false;
		vis[b[i]]=true;
		if(a[0][i]==a[1][i]-1&&a[2][i]==a[1][i]+1){
			revt[i&1]^=(((b[i]^i)>>1))&1;
		}else if(a[0][i]==a[1][i]+1&&a[2][i]==a[1][i]-1){
			revt[i&1]^=((((b[i]^i)>>1))&1)==0;
		}else return false;
	}
	revt[0]^=getrev(b,n,n);
	revt[1]^=getrev(b+1,n-1,n);
	return !revt[0]&&!revt[1];
}
int main(){
	puts(Main()?"Yes":"No");
	return 0;
}

Measured memory_bytes: 2304
import java.util.*;
public class Main{
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int r = sc.nextInt();
			int c = sc.nextInt();
			if(r == 0 && c == 0) break;
			int[][] status = new int[r][c];
			for (int i = 0; i < r; i++) {
				for (int j = 0; j < c; j++) {
					status[i][j] = sc.nextInt();
				}
			}
			int max = 0;
			for (int i = 0; i < 1 << r; i++) {
				int presum = 0;
				for (int j = 0; j < r; j++) {
					if ((i & 1 << j) != 0) {
						for (int k = 0; k < c; k++) {
							status[j][k] = (status[j][k] == 1) ? 0 : 1;
						}
					}
				}

				for (int j = 0; j < c; j++) {
					int sum = 0;
					for (int k = 0; k < r; k++) {
						status[k][j] = (status[k][j] == 1) ? 0 : 1;
					}
					for (int k = 0; k < r; k++) {
						sum += (status[k][j] == 1) ? 0 : 1;
					}
					int sum2 = 0;
					for (int k = 0; k < r; k++) {
						status[k][j] = (status[k][j] == 1) ? 0 : 1;
					}
					for (int k = 0; k < r; k++) {
						sum2 += (status[k][j] == 1) ? 0 : 1;
					}
					presum += Math.max(sum, sum2);
				}
				max = Math.max(max, presum);
				for (int j = 0; j < r; j++) {
					if ((i & 1 << j) != 0) {
						for (int k = 0; k < c; k++) {
							status[j][k] = (status[j][k] == 1) ? 0 : 1;
						}
					}
				}

			}
			System.out.println(max);
		}
	}

	
}

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


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int count = 0;
	String s = sc.next();
	char[] S  = new char[N];
	for(int i=0;i<N;i++) S[i] = s.charAt(i);

	for(int i=0;i<N-2;i++){
	    if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C')
		count++;
	}
	System.out.print(count);
    }
}


Measured memory_bytes: 21844
n,m = map(int,input().split())
list1 = [list(map(int,input().split())) for i in range(n) ]
list2 = [0]*m
for i in range(n):
    for j in range(1,list1[i][0]+1):
        list2[list1[i][j]-1] += 1
count = 0
for i in range(len(list2)):
    if list2[i] == n:
        count += 1
print(count)
    

Measured memory_bytes: 38512
#include <iostream>
#include <vector>
#define ll long long
#define PI 3.141592
#define MOD 1000000007
using namespace std;

int pow(int x, int y)
{
	if (y == 1) {
		return x;
	}
	if (y / 2) {
		return ((ll int)pow(x, y / 2) * (ll int)pow(x, y / 2) * (ll int)x) % MOD;
	} else {
		return ((ll int)pow(x, y / 2) * (ll int)pow(x, y / 2)) % MOD;
	}
}


int main()
{
	int n, k;
	cin >> n >> k;
	vector<ll int>dp(n + 1);
	ll int sig = ((ll int)n + 1LL) * (ll int)n / 2LL;
	ll int sum = 0LL;
	dp[0] = 0LL;
	for (int i = 1; i <= n; i++) {
		dp[i] = dp[i - 1] + (ll int)i;
	}

	for (int i = k; i <= n; i++) {
		sum += sig - dp[n - i] - dp[i - 1] + 1LL;
	}

	sum += 1LL;

	printf("%d", sum % MOD);

	return 0;
}



Measured memory_bytes: 4840
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 86400

struct Info{
	int start,end;
	double per_amount;
};

int N;
double L;
Info info[NUM];


bool check(double add_water){

	double Tank = L;

	for(int i = 0; i < N; i++){
		Tank -= (info[i].per_amount-add_water)*(double)(info[i].end-info[i].start); //水が増える場合あり
		Tank = min(L,Tank);
		if(Tank <= 0.0)return false;

		if(i < N-1){
			Tank += add_water*(info[i+1].start-info[i].end);
			Tank = min(Tank,L);
		}
	}

	Tank += add_water*(86400.0-(double)(info[N-1].end));
	Tank = min(L,Tank);

	double first_day = Tank;

	Tank += add_water*info[0].start;
	Tank = min(L,Tank);

	for(int i = 0; i < N; i++){
		Tank -= (info[i].per_amount-add_water)*(double)(info[i].end-info[i].start);
		Tank = min(L,Tank);
		if(Tank <= 0.0)return false;

		if(i < N-1){
			Tank += add_water*(info[i+1].start-info[i].end);
			Tank = min(Tank,L);
		}
	}

	Tank += add_water*(86400.0-(double)(info[N-1].end));
	Tank = min(L,Tank);

	return Tank >= first_day;

}


void func(){

	for(int i = 0; i < N; i++){
		scanf("%d %d %lf",&info[i].start,&info[i].end,&info[i].per_amount);
	}

	double left = 0,right = DBL_MAX, m = (left+right)/2,ans = DBL_MAX; //★★タンク容量より大きい流出量あり★★

	while(right-left > EPS){
		if(check(m)){
			ans  = m;
			right = m-EPS; //最小値を求めるので、より左へ
		}else{
			left = m+EPS;
		}
		m = (left+right)/2;
	}

	printf("%.10lf\n",ans);
}

int main(){

	while(true){
		scanf("%d %lf",&N,&L);
		if(N == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 4504
N,M = (int(_) for _ in input().split())
shops = []
NumberOfEDWillBuy = []
for i in range(N):
    price,stock = (int(_) for _ in input().split())
    shops.append((price,stock))
#map(int,input().split())はmapobjectを返す
#(int(_) for _ in input().split())はgenerator objectを返す
#iteratorしかsorted関数は使えないので、一度priceとstockにアクセスする形にしてshopsを
#generatorのlistにならないようにしている。
NumberOfEDWanted = M
sortedShops = sorted(shops,key = lambda shop:shop[0])
for shop in sortedShops:
    if NumberOfEDWanted < shop[1]:
        NumberOfEDWillBuy.append(NumberOfEDWanted)
        NumberOfEDWanted = 0
    else:
        NumberOfEDWillBuy.append(shop[1])
        NumberOfEDWanted -= shop[1]
sum = 0
for i in range(len(NumberOfEDWillBuy)):
    sum += sortedShops[i][0]*NumberOfEDWillBuy[i]
print(sum)


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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

int n, m, ans = 0;
vector<int>go[19];
bool a[19];

void dfs(int now, int cnt) {
	//cout << now << " " << cnt << endl;
	if (cnt == n) {
		ans++;
		return;
	}
	cnt++;
	a[now] = false;
	rep(i, go[now].size()) {
		if (a[go[now][i]]) {
			dfs(go[now][i], cnt);
		}
	}
	a[now] = true;
	return;
}

signed main() {
	cin >> n >> m;
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		go[x].push_back(y);
		go[y].push_back(x);
	}
	rep(i, n) a[i] = true;
	dfs(0, 1);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int d = scan.nextInt() * 2 + 1;
        System.out.println(n % d == 0 ? n / d : n / d + 1);
        scan.close();
    }
}

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

int main(){
    ll N,M; cin>>N>>M;
    map<ll,ll> mp;
    for (int i = 0; i < N; i++){
        ll K; cin>>K;
        vector<ll> A(K);
        for(ll j=0;j<K;j++){
            cin>>A[j];
            mp[A[j]]++;
        }
    }
    ll ans=0;
    for (int i = 1; i <= M; i++){
        if(mp[i]==N) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		System.out.println(c >= a && c <= b ? "Yes" : "No");
	}
}

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

using namespace std;

int main()
{
	int x, y;
	int a[8] = {1,3,5,7,8,10,12};
	int b[5] = {4,6,9,11};
	int c = 2;
	while(cin >> x >> y)
	{
		if(x == c || y == c)
		{
			cout << "No" << endl;
		}
		else
		{
			int flag1, flag2;
			for(int i=0;i<8;i++)
			{
				if(x == a[i])
				{
					flag1 = 1;
					break;				
				}
				else
					flag1 = 0;
			}
			for(int i=0;i<8;i++)
			{
				if(y == a[i])
				{
					flag2 = 1;
					break;				
				}
				else
					flag2 = 0;
			}
			int flag3, flag4;
			for(int i=0;i<5;i++)
			{
				if(x == b[i])
				{
					flag3 = 1;
					break;				
				}
				else
					flag3 = 0;
			}
			for(int i=0;i<5;i++)
			{
				if(y == b[i])
				{
					flag4 = 1;				
					break;
				}
				else
					flag4 = 0;
			}
			if((flag1 == 1 && flag2 == 1) || (flag3 == 1 && flag4 == 1))
			{
				cout << "Yes" << endl;		
			}		
			else
				cout << "No" << endl;
		}		
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
int n,a,b,c;
vector<int> l;
int dfs(int depth,int x,int y,int z){
  if(depth==n){
    if(min(min(x,y),z)>0){
      return abs(x-a)+abs(y-b)+abs(z-c)-30;
    }
    else{
      return 10000000;
    }
  }
  else{
    int p=dfs(depth+1,x,y,z);
    int q=dfs(depth+1,x+l[depth],y,z)+10;
    int r=dfs(depth+1,x,y+l[depth],z)+10;
    int s=dfs(depth+1,x,y,z+l[depth])+10;
    return min(p,min(q,min(r,s)));
  }
}

int main() {
  
  cin >> n >> a >> b >> c;
  l=vector<int>(n);
  for(int i=0;i<n;i++){
    cin >> l[i];
  }
  cout << dfs(0,0,0,0);
}
    

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,x,n) for(int i=x;i<n;i++)
#define breps(i,x,n) for(int i=x;i>=n;i--)
#define exrep(x,vec) for(auto&& x : vec);
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

/**
* ------------- ここからコード -------------
*/

int main(void) {

	ll a, b, c, d;
	ll ans = 0;
	cin >> a >> b >> c >> d;
	
	ll ans1 = a * c;
	ll ans2 = a * d;
	ll ans3 = b * c;
	ll ans4 = b * d;
	ans = max(ans1, ans2);
	ans = max(ans, ans3);
	ans = max(ans, ans4);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3632
s=input()
l=[chr(i) for i in range(97,97+26)]
if len(s)!=26:
  for i in l:
    if i not in s:
      print(s+i)
      break
else:
  for j in range(26):
    S=s[j:26]
    c=0
    for k in range(len(S)-1):
      if S[k]>S[k+1]:c+=1
    if c==len(S)-1:
      break
  if j==0:print(-1)
  else:
    for m in range(l.index(s[j-1])+1,26):
      if l[m] not in s[0:j-1]:
        x=l[m]
        break
    print(s[0:j-1]+x)

Measured memory_bytes: 3064
n = int(input())
mod = pow(10, 9) + 7
x = 0
c = []
for _ in range(n):
    y = int(input())
    if not x == y:
        c.append(y)
    x = y
m = len(c)
last = [-1] * (2 * pow(10, 5) + 5)
dp = [0] * m
dpsum = [0] * m
for i in range(m):
    if not last[c[i]] == -1:
        dp[i] = dpsum[last[c[i]]] + 1
    dpsum[i] = dp[i] + dpsum[max(i - 1, 0)]
    dpsum[i] %= mod
    last[c[i]] = i
ans = (dpsum[-1] + 1) % mod
print(ans)

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

using namespace std;


int dp[10000][100][2];
string s ;
int M =1e9+7;
int dd;
int k;
int mod(int x ,int y){
    
    return (dd+x%dd-y%dd)%dd;
}
int fun(int n , int d, int f){
    // cout<<n<<" "<<d<<" "<<f<<endl;
    if(n==k){
        if(d==0)return 1;
        return 0;
    }
    if(dp[n][d][f]!=-1)return dp[n][d][f];
     long long int ans =0;
    if(f==1){
        for(int i=0;i<10;i++){
            // cout<<d<<" "<<i<<" "<<(d-i)%dd<<endl;
            ans+=fun(n+1,mod(d,i),f);
        }
        ans%=M;
    }else{
        int x = s[n]-'0';
        ans+=fun(n+1,mod(d,x),0);
        for(int i =x-1;i>=0;i--){
            ans+=fun(n+1,mod(d,i),1);
        }
        ans%=M;
    }
    return dp[n][d][f]=ans;
}

int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>s;
    k = s.size();
    cin>>dd;
    memset(dp,-1,sizeof dp);
    cout<<(fun(0,dd,0)-1+M)%M<<endl;
    return 0;
}





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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    string o,e;
    cin >> o >> e;
    string ans;

    if ((int)o.size() == (int)e.size()){
        for (int i = 0; i < (int)o.size(); i++){
            ans += o[i];
            ans += e[i];
        }
    } else {
        for (int i = 0; i < (int)e.size(); i++){
            ans += o[i];
            ans += e[i];
        }
        ans += o[(int)o.size()-1];
    }
    cout << ans << endl;


    return 0;
}


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

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

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

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

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //cout << fixed << setprecision(6);
    string s, t;
    cin >> s;
    cin >> t;

    int ans = 0;
    rep(i, s.size()){
        if(s[i] != t[i]) ans++;
    }

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

Measured memory_bytes: 3800
from collections import deque
mirrors = ["b","p","q","d"]
ans = True
S = list(raw_input())
if len(S) % 2 == 1:
  ans = False
else:
  for i in range(len(S)/2):
    if not(3-mirrors.index(S[i]) == mirrors.index(S[-(i+1)])):
      ans = False
      break
print "Yes" if ans else "No"



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

int ans=0;
int vis[100005]={0};
int dp[100005]={0};
vector<int> v[100005];
int dfs(int src){
    if(dp[src]!=0)
    return dp[src];

    int dist=0;
    for(int i=0;i<v[src].size();i++){
       dist=max(dist,1+dfs(v[src][i]));
    }
    dp[src]=dist;
    return dp[src];

}



int main() {
    int n,m;
    cin>>n>>m;    
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        v[x].push_back(y);
    }
     for(int i=1;i<=n;i++){
            ans=max(ans, dfs(i));
     }    
    cout<<ans; 
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  bool pass = true;
  for(int i = 0; i<N; i++){
cin >> A.at(i);
  }
  for (int i = 0; i < N; i++){
if(A.at(i) % 2 == 1)continue;
    if(A.at(i) % 3 != 0 && A.at(i) % 5 != 0)
   pass = false;
  }
  if (pass){
cout << "APPROVED" << endl;
  }
else {
cout <<"DENIED" << endl;
}
}

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

int findNum(int num) {
  int result = 0;
  while(num > 0) {
    result += num % 10;
	num /= 10;
  }
  return result;
}

int main () {
  int n, a, b;
  cin >> n >> a >> b;
  int cal, result;
  for (int i = 1; i <= n; i++) {
    cal = findNum(i);
    if (a <= cal && cal <= b) {
  		result += i;
    }
  }
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll x=1e16;
	ll n; cin>>n;
	rep(i,0,5){
		ll a; cin>>a;
		chmin(x,a);
	}
	ll k=(n+x-1)/x;
	cout<<k+4<<endl;
	
	return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
//#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)
#if DEBUG
#define debug(...) //printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 1234560
#endif

int H,W,K;
int X[2],Y[2];
string M[SIZE];

struct Item{
    int h,w;
    int score;
    bool operator < (const Item& that) const {
        return score > that.score;
    }
};
int dxy[] = {1,0,-1,0,1};
int DH=1,DW=2;
void solve() {
    cin>>H>>W>>K;
    REP(i,2) {
        cin>>X[i]>>Y[i];
        X[i]--;
        Y[i]--;
    }
    REP(h,H)cin>>M[h];
    vector< vector<int> > MAP(H, vector<int>(W, INT_MAX/2));
    vector< vector<int> > DIST(H, vector<int>(W, 0));
    priority_queue<Item> que;
    que.push({X[0],Y[0],0});
    MAP[X[0]][Y[0]] = 0;
    while(que.size()) {
        auto item = que.top();
        que.pop();
        REP(i,4) {
            int dh = dxy[i], dw = dxy[i+1];
            REP1(j,K) {
                int nh = item.h + dh*j, nw = item.w + dw*j;
                if (nh<0||nw<0||nh>=H||nw>=W) break;
                if (M[nh][nw]=='@') break;
                int v = MAP[item.h][item.w]+1;
                int dist = (dh) ? dh*DH : dw*DW;
                if (MAP[nh][nw] > v) {
                    debug("%lld,%lld->%lld,%lld\n",item.h,item.w,nh,nw);
                    MAP[nh][nw] = v;
                    DIST[nh][nw] = dist;
                    if (nh==X[1]&&nw==Y[1]) {
                        cout << v << endl;
                        return;
                    }
                    que.push({nh,nw,v});
                }
                else if (v > MAP[nh][nw]) break;
            }
        }
    }
    cout << -1 << endl;
}



Measured memory_bytes: 54580
//#define _GLIBCXX_DEBUG
    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef pair<int, int> pii;
    typedef map<int, int> mii;
    typedef map<char,int> mci;
    typedef vector<int> vi;
    typedef vector<vi> vvi;
    typedef vector<ll> vll;
    typedef vector<pair<int,int>> vii;
    typedef vector<char> vc;
    typedef vector<vc> vcc;
    #define all(x) (x).begin(), (x).end()
    #define rall(x) (x).rbegin(), (x).rend()
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    #define in insert
    #define sz(v) v.size()
    #define mina(a,b) (a)=min((a),(b));
    #define maxa(a,b) (a)=max((a),(b));
    const int INF = 1e9 + 5;
    
    void solve(){
        int n; cin>>n;
        vll v(n);
        int mi=INF;
        int cnt=0;
        for(int i = 0; i < n; i++) {
            cin>>v[i];
            if(v[i]<0) cnt++;
            if(abs(v[i])<abs(mi)) mi=v[i];
        }
        ll sum=0;
        for(int i = 0; i < n; i++) sum+=abs(v[i]);
        if(cnt%2==0) cout<<sum;
        else cout<<sum-2*abs(mi);
        //cout<<sum;

    }
    int main(){
        int T=1;
        //cin>>T;
        for(int i = 0; i < T; i++) solve(); 
    }

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int k;
	int a,b;
	cin>>k;
	cin>>a>>b;
	int f=0;
	for(int i=a;i<=b;i++){
		if(i%k==0)f=1;
	}
	if(f==1)cout<<"OK"<<endl;
	else cout<<"NG"<<endl;
	return 0;
}

Measured memory_bytes: 3636
// ITP1_2_B Range

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  // 初期値
  int a, b, c; 
  cin >> a >> b >> c;
  
  // Main loop
  if (a < b && b < c){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
   
  return 0;
}


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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

int main() {
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    if (N%2) {
        cout << B[N/2] - A[N/2] + 1 << endl;
    }
    else {
        double M = (B[N/2] + B[N/2-1]) / 2.0;
        double m = (A[N/2] + A[N/2-1]) / 2.0;
        cout << (ll)((M - m + 0.5) * 2) << endl;
    }
}


Measured memory_bytes: 6296
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(b - a == c - b) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21844
import kotlin.math.max

fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main() {
    val n = readLine()?.toInt() ?: return
    val a = longList()

    val map = hashMapOf<Long, Long>()
    var t = 0L
    0.until(n).forEach { i ->
        t += a[i]
        map[t] = map.getOrDefault(t, 0) + 1
    }
    t = 0L
    var c = map.getOrDefault(0L, 0L)
    0.until(n).forEach { i ->
        t += a[i]
        val count = max(map.getOrDefault(t, 0L) - 1, 0L)
        c += count
        map[t] = count
    }
    println(c.toString())
}


Measured memory_bytes: 83200
H, W = map(int, input().split())
NO = 0

S = [["." for i in range(W + 2)] for j in range(H + 2)]

for i in range(1, H + 1):
    a = input()
    for j in range(1, W + 1):
        S[i][j] = a[j - 1]


for i in range(1, H + 1):
    for j in range(1, W + 1):
        if S[i][j] == "#":
            if S[i - 1][j] != "#" and S[i][j - 1] != "#" and S[i][j + 1] != "#" and S[i + 1][j] != "#":
                NO = 1
                break

if NO == 1:
    print("No")
else:
    print("Yes")

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

using uli = unsigned long int;
using lli = long long int;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define repa(a,i,x) for(int i=a;i<=x;i++)


int main(){
	int N;
	cin >> N;
  	int list[N];
    int cnt=0;
  
  repn(i,N-1){
  	vector<int> v;
	for(int j = 1; j * j <= i; j++) {
		if(i % j == 0) {
			v.push_back(j);
			if(j * j != i) v.push_back(i / j);
		}
	}
 	 cnt+=v.size();
  }
  
  cout<<cnt<<endl;
}

Measured memory_bytes: 3580
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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>
using pq=priority_queue<T,vector<T>,greater<T>>;

ll K;
ll A;
ll B;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> K;
    cin >> A;
    cin >> B;
    solve();
}

// 入力はすべて整数
// 1 <= A <= B <= 1000
// 1 <= K <= 1000

// ll K, ll A, ll B
// 目標の達成が可能であれば OK と、不可能であれば NG と出力せよ。
void solve(){
    B=B/K*K;
    cout<<(A<=B?"OK":"NG")<<endl;
}


Measured memory_bytes: 3616
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);

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

    vector<vector<int > > c(26, vector<int>());

    int sz_s = (int)s.size();
    for (int i = 0; i < sz_s; i++) {
        c[s[i] - 'a'].push_back(i);
    }
    
    int sz_t = (int)t.size();
    int pre = -1;
    int a;
    ll res = 0;
    for (int i = 0; i < sz_t; i++) {
        a = t[i] - 'a';

        if ((int)c[a].size() == 0) {
            res = -1;
            break;
        }

        auto it = lower_bound(c[a].begin(), c[a].end(), pre + 1);
        if (it == c[a].end()) {
            it = c[a].begin();
            res += sz_s;
        }

        res += (*it) - pre;
        pre = (*it);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1216
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var S string
	fmt.Scan(&S)
	var max, ans int
	for i := 0; i < len(S); i++ {
		str := S[i]
		if str == 'A' || str == 'C' || str == 'G' || str == 'T' {
			max++
		} else {
			max = 0
		}
		if ans < max {
			ans = max
		}
	}
	fmt.Fprintln(wtr, ans)

	_ = wtr.Flush()
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	vector<long long> a,b,c,d,e,f,g,h,cont(8);
	long long N,M,x,y,z,cnt;
	cin >> N >> M;
	for(long long i=0;i<N;i++){
		cin >> x >> y >> z;
		a.push_back(x+y+z);
		b.push_back(x+y-z);
		c.push_back(x-y+z);
		d.push_back(x-y-z);
		e.push_back(z-x-y);
		f.push_back(y+z-x);
		g.push_back((-1)*(x+y+z));
		h.push_back(y-x-z);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	sort(d.begin(),d.end());
	sort(e.begin(),e.end());
	sort(f.begin(),f.end());
	sort(g.begin(),g.end());
	sort(h.begin(),h.end());
	cnt=0;
	for(long long i=N-1;i>=0;i--){
		if(M == 0)	break;
		cont[0] += a[i];
		cont[1] += b[i];
		cont[2] += c[i];
		cont[3] += d[i];
		cont[4] += e[i];
		cont[5] += f[i];
		cont[6] += g[i];
		cont[7] += h[i];
		cnt++;
		if(cnt==M)	break;
	}
	sort(cont.begin(),cont.end());
	cout << cont[7] << endl;
}

Measured memory_bytes: 384
def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)

def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max,mod=DIV):
    fac,finv,inv = [0]*max, [0]*max, [0]*max
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod -inv[mod%i] * (mod//i)%mod
        finv[i] = finv[i-1]*inv[i]%mod
    class CONV:
        def __init__(self):
            pass
        def ncr(self,n,k):
            if(n<k):
                return 0
            if(n<0 or k<0 ):
                return 0
            return fac[n]*(finv[k]*finv[n-k]%mod)%mod
    return CONV()


def main():
    ret = set(isRaw())
    return "Yes" if len(ret) == 2 else "No"


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
double logbase(double a, double base)
{
   return log(a) / log(base);
}


int main()
{
  int N, K;
  cin >> N >> K;
  int ans = 0;
  while (N>0){
    ans++;
    N = N/K;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 256
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0]*n
dp[0] = 0

for i in range(1, n):
    cost_min = 10**12
    for j in range(1, k+1):
        if i < j:
            break
        if cost_min > abs(h[i-j] - h[i]) + dp[i-j]:
            cost_min = abs(h[i-j] - h[i]) + dp[i-j]
    dp[i] = cost_min
    
print(dp[n-1])

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


int main() {
    string S;
    cin >> S;
    S += 'K';
    int ans = 0;
    int j = 0;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] != 'A' && S[i] != 'T' && S[i] != 'G' && S[i] != 'C') {
            ans = max(ans, i - j);
            j = i+1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <cstdio>
#include <algorithm>
using namespace std;
int x[100005],n,m,a,now=1;
long long sum=0;
int main(){
  scanf("%d %d",&n,&m);
    for(int i=1;i<n;i++){
      scanf("%d",&x[i]);
    }
    for(int i=0;i<m;i++){
      scanf("%d",&a);
      if(a>0){
        for(int j=0;j<a;j++){
          sum+=x[now+j];
        }
      }else{
        for(int j=a;j<0;j++){
           sum+=x[now+j];
        }
      }
        now+=a;
    }
printf("%lld\n",sum%100000);
return 0;
}

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

int main() {
  int a,b,c;
  cin>>a>>b;
  if(b<=9) c=10*a+b;
  else if(b<=99) c=100*a+b;
  else c=1000*a+b;
  int i;
  string ans="No";
  for(i=0;i<=sqrt(c);i++) {
	if(c==i*i) ans="Yes";
  }
  cout<<ans<<endl;

}    

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

int main(){
	
	int n, i, k, j;
	
	cin>>n>>k;
	
	vector<int>dp(n,-1), h(n);
	
	for(i=0;i<n;i++){
	
	cin>>h[i];
	
       }
       
	dp[0]=0; 

	for(i=1 ; i<n ; i++){
		
		j=i-1;
		
		while(j>=0 && i-j <=k)
		{
			if(dp[i]==-1){
				dp[i]= dp[j] +abs(h[i]-h[j]);
			}
			else{
				dp[i]= min(dp[i], dp[j]+abs(h[i]-h[j]));
			} 
			
			j--;
			
		}
	
	}
	cout<<dp[n-1];

}

Measured memory_bytes: 4048
const main = input => {
    const inputs = input.trim().split("\n")
    const N = parseInt(inputs[0])
    const S = inputs[1]

    if (N % 2 !== 0) {
        console.log('No')
        return
    }

    if (S.substr(0, N / 2) === S.substr(N / 2)) {
        console.log('Yes')
    } else {
        console.log('No')
    }
}

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29508
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define FIND(c, n)      std::find((c).begin(), (c).end(), (n));
#define BSEARCH(c, n)   std::binary_search((c).begin(), (c).end(), (n))
#define LLPOW(p1,p2)    ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0; } while(0)

typedef long long ll;
typedef unsigned long long ull;

#ifdef _DEBUG
#define pf printf
#define pr(n) do { cout << #n " = " << (n) << endl; } while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#endif


int main(){

    for(int i = 1; ; i++){
        int w, n;
        cin >> w;
        if(w == 0) break;
        cin >> n;

        int dp[2][1010];
        memset(dp, -1, sizeof(dp));
        int i0 = 0, i1 = 1;
        dp[0][0] = 0;

        REP(l,n){
            int p1, w1; char dmy;
            cin >> p1 >> dmy >> w1;

            REP(j,w+1){
                if(dp[i0][j] < 0) continue;
                dp[i1][j] = MAX(dp[i1][j], dp[i0][j]);
                int j2 = j + w1;
                if(j2 <= w){
                    dp[i1][j2] = MAX(dp[i1][j2], dp[i0][j] + p1);
                }
            }
            swap(i0, i1);
            memset(dp[i1], -1, sizeof(dp[i1]));
        }

        int result_p = 0;
        int result_w = 0;
        REP(j,w+1){
            if(result_p < dp[i0][j]){
                result_p = dp[i0][j];
                result_w = j;
            }
        }
        cout << "Case " << i << ":" << endl;
        cout << result_p << endl;
        cout << result_w << endl;
    }

    return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head


const int N = 1e6+10;
char s[N];

int main() {
	scanf("%s", s+1);
	int n = strlen(s+1);
	REP(i,1,n) if (s[i]!=s[n-i+1]) {
		return puts("No"),0;
	}
	puts("Yes");
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
using namespace std;
using ll = long long;

int main()
{
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i,n){
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }


    int enable=-1;
    ll ans = 100100100100100100;
    for(int bit=0; bit < (1<<n); ++bit){
        bool e = true;
        vector<int> tmp(0);
        rep(i,n){
            if(bit & (1<<i)) tmp.emplace_back(i);
        }
        ll price=0;
        vector<ll> after(m);
        for(int i : tmp){
            price += c[i];
            rep(j,m) after[j] += a[i][j];
        }
        rep(j,m){
            if(after[j] < x) e=false;
        }
        if(e) {ans = min(ans, price); enable=0;}
    }

    if(enable == -1) cout << enable << endl;
    else cout << ans << endl; 
    return 0;
}

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

const int INF=1e9+5;
const int N=21+5;
const int mod=1e9+7;
const ll oo=1e18+5;

int n;

void add_self(int& a,int b){
	a+=b;
	if(a>=mod) a-=mod;
}

int main(){
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
	cin>>n;
	vector<vector<int>> a(n,vector<int>(n)); // dp[i] the number of ways of ways i binary
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			cin>>a[i][j];
		}
	}
	vector<int> dp(1<<n);
	dp[0]=1;
	// cout<<"Hello"<<endl;
	// return 0;
	for(int mask=0;mask<(1<<n)-1;++mask){
		int man_id=__builtin_popcount(mask);
		for(int woman=0;woman<n;++woman){
			if(a[man_id][woman]&&!(mask&(1<<woman))){
				add_self(dp[mask^(1<<woman)],dp[mask]);
			}
		}
	}
	// cout<<"Hello"<<endl;
	cout<<dp[(1<<n)-1];
	return 0;
}
		


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define ll long long
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
#define PI 3.141592653589793
using namespace std;

bool sortbysec(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 

ll maxSubArraySum(ll a[], ll size) 
{ 
    ll max_so_far = INT_MIN, max_ending_here = 0; 
  
    for (ll i = 0; i < size; i++) 
    { 
        max_ending_here = max_ending_here + a[i]; 
        if (max_so_far < max_ending_here) 
            max_so_far = max_ending_here; 
  
        if (max_ending_here < 0) 
            max_ending_here = 0; 
    } 
    return max_so_far; 
} 

ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
{
    unordered_map<ll, ll> prevSum;
    ll res = 0;
    ll currsum = 0;
    for (ll i = 0; i < n; i++)
    {
        currsum += arr[i];
        if (currsum == sum) res++;
        if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
        prevSum[currsum]++;
    }
    return res; 
} 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
ll powmp(ll x, ll y, ll p) 
{ 
    ll res = 1;     x = x % p;   
    while (y > 0) 
    {  
        if (y & 1)  res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    FAST
    long double a,b;cin>>a>>b;
    cout<<(ll)(a*b)<<endl;
}


Measured memory_bytes: 3776
n, l = map(int, input().split())
a_l = [ l+i for i in range(n) ]

if 0 in a_l:
    print(sum(a_l))
elif a_l[0] < 0 :
    print(sum(sorted(a_l, reverse=True)[1:]))
else:
    print(sum(sorted(a_l)[1:]))

Measured memory_bytes: 9044
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

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

    ll ans = 0, num_turn = 1;
    while(H > 0) {
        ans += num_turn;
        num_turn *= 2;
        H /= 2;
    }
    // 1000000000000
    // 1099511627775

    cout << ans << endl;

    return 0;
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b, c;
	cin >> a >> b >> c;
	
	cout << (a * b) / 2 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,f[1000009],lef,rig;
string s,h;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(i=1; i<=a; i++){
		cin>>c;
		if(c>=b) d++;
	}
	cout<<d;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5;
int n,m,i,nxt,a[N];
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
void write(int x){if (x>9) write(x/10);putchar(x%10+48);}
int main(){
	for (m=read(),n=read();m--;){
		int l=read()-1,r=read();
		for (i=1;i<=l;i=nxt+1){
			nxt=min(l/(l/i),r/(r/i));
			if (l/i!=r/i) a[i]++,a[nxt+1]--;
		}
		a[l+1]++;a[r+1]--;
	}
	for (i=1;i<=n;i++) write(a[i]+=a[i-1]),putchar('\n');
}

Measured memory_bytes: 1280
//ABC154 D 模範解答

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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	rep(i, n) cin >> p[i];
	rep(i, n) p[i]++;
	int mx = 0;
	int s = 0;
	queue<int> q;
	rep(i, n) {
		s += p[i];
		q.push(p[i]);
		if (q.size() > k) {
			s -= q.front(); q.pop();
		}
		if (q.size() == k) {
			mx = max(mx, s);
		}
	}
	double ans = mx;
	ans /= 2;
	printf("%.10f\n", ans);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <climits>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

#define INF (1<<29)


int main(){
	ll N, K;
	ll x[50], y[50];

	vector<int> xar(N), yar(N);
	cin >> N >>K;
	rep(i, N){
		cin >> x[i] >> y[i];
		xar.push_back(x[i]);
		yar.push_back(y[i]);
	}
	sort(xar.begin(), xar.end());
	sort(yar.begin(), yar.end());

	ll max_area = LONG_MAX;
	rep(xi, N) {
		rep(xj, N){
			rep(yi, N){
				rep(yj, N){
					int num = 0;
					ll lx = xar[xi], rx = xar[xj];
					ll by = yar[yi], uy = yar[yj];

					rep(i, N){
						if(lx <= x[i] && x[i] <= rx && by <= y[i] && y[i] <= uy){
							num++;
						}
					}

					if(num >= K && max_area> (1ll*(rx-lx)*(uy-by))){
						max_area = 1ll * (rx-lx) * (uy-by);
					}
				}
			}
		}
	}

	cout << max_area << endl;

	return 0;
}


Measured memory_bytes: 256
//package bigneer;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub

		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
//		int t=Integer.parseInt(br.readLine());
//		while(t-->0) {
//			int n=Integer.parseInt(br.readLine());
			String q[]=br.readLine().split(" ");
			int a[]=new int[3];
			for(int i=0;i<3;i++){
				a[i]=Integer.parseInt(q[i]);
			}
			int c=0,d=a[2];
			while(d<=a[1]) {
				if(d>=a[0]&&d<=a[1])
					c++;
//				System.out.println(d);
				d+=a[2];
//				d++;
			}
			System.out.println(c);
//		}
			
	}

}


Measured memory_bytes: 32904