akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__

	int N;
	cin >> N;
	VI X(N),sorted_X(N);
	REP(i,N)cin>>X[i];
	sorted_X=X;
	sort(ALL(sorted_X));
	int left=sorted_X[N/2-1];
	int right=sorted_X[N/2];
	REP(i,N){
		if(X[i]<=left)cout<<right<<endl;
		else cout<<left<<endl;
	}
	





	return 0;
}


Measured memory_bytes: 4768
#include<stdio.h>

int main() {
    int i,n,m;
    int array[10000];
    int sum = 0;
    scanf("%d %d",&n,&m);
    for(i = 0;i < m;i++) {
        scanf("%d",&array[i]);
        sum += array[i];
    }
    if(n-sum >= 0) {
        printf("%d\n",n-sum);
    } else {
        printf("-1\n");
    }

    return 0;
}

Measured memory_bytes: 1728
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N;
int A[5010];
int V[5010];
vector<int> G[5010];
int dp[5010][5010][2], temp[5010][2];

void dfs(int v, int p)
{
	for (auto n : G[v])if (p != n)dfs(n, v);

	int vs = 1;
	dp[v][0][A[v] < 0 ? 1 : 0] = A[v];

	for (auto n : G[v])if (p != n)
	{
		rep(j0, 0, vs)rep(j1, 0, V[n])rep(k0, 0, 2)rep(k1, 0, 2)
		{
			chmin(temp[j0 + j1][k0 | k1], dp[v][j0][k0] + dp[n][j1][k1]);
			if ((k1 == 0 && dp[n][j1][k1] < INF) || dp[n][j1][k1] < 0)
			{
				chmin(temp[j0 + j1 + 1][k0], dp[v][j0][k0]);
			}
		}

		vs += V[n];
		rep(j, 0, vs)rep(k, 0, 2)
		{
			dp[v][j][k] = temp[j][k];
			temp[j][k] = INF;
		}
	}

	V[v] = vs;
}

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

	cin >> N;
	rep(i, 0, N)cin >> A[i];

	int u, v;
	rep(i, 0, N - 1)
	{
		cin >> u >> v;
		u--, v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}

	rep(j, 0, N)rep(k, 0, 2)
	{
		rep(i, 0, 5010)dp[i][j][k] = INF;
		temp[j][k] = INF;
	}

	dfs(0, -1);

	int ans = N - 1;
	rep(j, 0, N)
	{
		if (dp[0][j][0] < INF)chmin(ans, j);
		if (dp[0][j][1] < 0)chmin(ans, j);
	}

	cout << ans << endl;

	return 0;
}

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

int N;

bool check_vaild(int x, int y, int x1, int y1, int delta_t) {
  int dis = abs(x1 - x) + abs(y1 - y);

  if (delta_t < dis){
    return false;
  }

  if (((delta_t - dis) % 2) == 0) {
    return true;
  } else {
    return false;
  }
  
}

int main() {
  cin >> N;

  int t, x, y;
  int t1 = 0, x1 = 0, y1 = 0;
  for(int i = 0; i < N; i++) {
    cin >> t >> x >> y;

    if (!check_vaild(x, y, x1, y1, t - t1)) {
      cout << "No" << endl;
      return 0;
    }

    x1 = x;
    y1 = y;
    t1 = t;
  }
  cout << "Yes" << endl;
  return 0;

}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	ll n;
	cin >> n;
	ll sq= sqrt(n);
	ll d=0;
	while(n%(sq-d)){
		d++;
	}
	ll a=sq-d;
	ll b=n/(sq-d);
	int ans1=0;

	while(b){
		b/=10;
		ans1++;
	}
	cout << ans1;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    vector<int> v;
    int N,x,ans=1;
    cin >> N;
    while(N--){
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    for(int i=1;i<v.size();i++){
        if(v[i-1]!=v[i])    ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int n,k,x,y;
  cin>>n>>k>>x>>y;
  long long int cost=0;
  if(n>=k)
  {
    cost+=(k*x);
    cost+=(n-k)*y;
  }
  else
  {
    cost+=(n*x);
  }
  cout<<cost;
  return 0;
}

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    freopen ("in.txt", "r", stdin);
#endif
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
  //  freopen ("in.txt", "r", stdin);

    int n,m;cin>>n>>m;
    vii a(n);
    FOR(i,n) cin>>a[i].first>>a[i].second;
    sort(a.begin(),a.end(),[](const ii x,const ii y){return x.first<y.first || (x.first==y.first && x.second>y.second);});
    int t=m-1,i=0;
    multiset<int,greater<int> > stock;
    int ret=0;
    while(i<n && t>=0){
        if (t+a[i].first<=m) stock.insert(a[i++].second);
        else{
            if (!stock.empty()){
                ret += *stock.begin();
                stock.erase(stock.begin());
            }
            --t;
        }
    }
    while(t>=0 && !stock.empty()){
        ret += *stock.begin();
        stock.erase(stock.begin());
        --t;
    }
    cout << ret;
}



Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
using ll = long long;

int f(vector<int>& dp, vector<vector<int>>& graph, int vertex){
    if(dp[vertex] != -1) return dp[vertex];
    if(graph[vertex].size() == 0){
        dp[vertex] = 0;
        return 0;
    }
    for(int i = 0;i < graph[vertex].size();i++){
        dp[vertex] = max(dp[vertex], f(dp, graph, graph[vertex][i]) + 1);
    }
    return dp[vertex];
}

int main(){
    int N,M;cin>>N>>M;
    vector<vector<int>> graph(N, vector<int>());
    for(int i = 0;i < M;i++){
        int _a,_b;cin>>_a>>_b;
        graph[_a-1].push_back(_b-1);
    }
    int res = 0;
    vector<int> dp(N,-1);
    for(int i = 0;i < N;i++){
        res = max(res, f(dp, graph, i));
    }
    cout<<res<<endl;

}

Measured memory_bytes: 8832
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		List<Work> w = new List<Work>(n);
		for(int i = 0; i < n; i++)
		{
			string[] s = Input();
			w.Add( new Work{Zikan = long.Parse(s[0]), Simekiri = long.Parse(s[1])} );
		}
		w.Sort((a,b)=>{
			if(a.Simekiri == b.Simekiri)
				return (int)(a.Zikan - b.Zikan);
			 return (int)(a.Simekiri-b.Simekiri);
		});
		//simulate
		long curtime = 0;
		for(int i = 0; i < n; i++)
		{
			Work w_ = w[i];
			curtime += w_.Zikan;
			if(curtime>w_.Simekiri)
			{
				Console.WriteLine("No");
				return;
			}
		}
		Console.WriteLine("Yes");
		
		
	}

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

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

	
}

public class Work
{
	public long Simekiri{get;set;}
	public long Zikan{get;set;}
	
	
	public override string ToString()
	{
		return string.Format("{0} {1}", Zikan, Simekiri);
	}
}



Measured memory_bytes: 26920
#include "bits/stdc++.h"
using namespace std;

int n;


int main() {
	cin >> n;
	long long int ww = 1;
	long long int way = 1;
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		if (a % 2 == 0) {
			way *= 2LL;
		}
		ww *= 3;
	}
	ww -= way;
	printf("%lld\n", ww);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
 
using namespace std;
 
int  main(int arg,char** argc)
{
  long long int n,k,sum=0;
  int min_=1e8;
  cin>>n>>k;
  priority_queue<long long int> pq;
  vector<long long int> ar(n,0);
  for(int i=0;i<n;i++)
  {
    cin>>ar[i];
    sum+=ar[i];
    pq.push(ar[i]);
  }
  for(int i=0;i<min(n,k);i++)
  {
    sum-=pq.top();
    if(!pq.empty())
    pq.pop();
  }
  cout<<sum;
    
    
    return 0;
}

Measured memory_bytes: 3956
from collections import Counter

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

cnt = Counter(A)
diff = {}
if N % 2 == 0:
    for i in range(1, N, 2):
        diff[i] = 2
else:
    for i in range(0, N, 2):
        if i == 0:
            diff[i] = 1
        else:
            diff[i] = 2
MOD = 10 ** 9 + 7
if cnt != diff:
    print(0)
    exit()
else:
    print(pow(2, N//2, MOD))

Measured memory_bytes: 22384
#!/usr/bin/python3
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    a = tuple(tuple(e for e in map(int, input().split())) for _ in range(2))
    dp = [[None] * n] * 2
    dp[0][0] = 0
    for i in range(2):
        for j in range(n):
            if i == 0:
                dp[0][j] = dp[0][max(0, j - 1)] + a[0][j]
            else:
                dp[1][j] = max(dp[0][j], dp[1][max(0, j - 1)]) + a[1][j]
    print(dp[1][n - 1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	int h, w, H, W;
	while (1)
	{
		scanf("%d %d", &H, &W);
		if (H ==0 && W == 0)
			break;
		for (h = 0; h < H; h++)
		{
			for (w = 0; w < W; w++)
			{
				if ((h + w) % 2 == 0)
				{
					putchar('#');
				} else {
					putchar('.');
				}
			}
			putchar('\n');
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 572
// In the name of Allah 
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9+7, MAX = 2e5+5;

int a,b,c;
long long m;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
	cin >> a >> b >> c;
	if (c<a or c>b)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


class AVL_like_BIT:  # 1-indexed
    def __init__(self,n):  # 1~nを要素として持ちうる。
        self.n = n
        self.tree = [0]*(self.n+1)
        self.depth = n.bit_length()

    def add(self,k):  # kを木に加える
        while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
    def delete(self,k): # kを木から削除する
        while k<=self.n:
            self.tree[k]-=1
            k += k&-k

    def sum(self,k):  # 1~kの和
        ans = 0
        while k>0:
            ans += self.tree[k]
            k -= k&-k
        return ans
    
    def lower_bound(self,k):  # k以上の最小要素
        x = self.sum(k-1)
        if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def upper_bound(self,k):  # k以下の最大要素
        x = self.sum(k)
        if x == 0:  # k以下の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def query(self,k):  # k番目の要素出力
        if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
        return p+1

a = ord('a')

n = readint()
s = [0] + [ord(x)-a for x in readstr()]
q = readint()

avl = [AVL_like_BIT(5*10**5 + 10) for i in range(26)]
for i in range(1,n+1):
    avl[s[i]].add(i)

ans = []
for i in range(q):
    j,l,r = readstrs()
    j = int(j)
    l = int(l)
    if j==1:
        avl[s[l]].delete(l)
        s[l] = ord(r)-a
        avl[s[l]].add(l)
    else:
        r = int(r)
        ans.append(0)
        for k in range(26):
            if avl[k].sum(l-1)-avl[k].sum(r):
                ans[-1]+=1

printrows(ans)








Measured memory_bytes: 144492
N = int(input())
A = list(map(int,input().split()))
lis = [0] * (N+1)
for i in range(N):
    lis[i+1] = lis[i] + A[i]
d = {}
for i in lis:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
ans = 0
for i in d:
    if d[i] > 1:
        ans += (d[i] * (d[i]-1)) // 2
print(ans)


Measured memory_bytes: 125500
import bisect
p=[]
for i in range(3,10**5+1,2):
    for j in range(3,int(i**0.5)+1,2):
        if i%j==0:
            break
    else:p.append(i)
n=[3]
for i in p:
    x=(i+1)//2
    y=bisect.bisect_left(p,x)
    if x==p[y]:n.append(i)
for _ in range(int(input())):
    l,r=map(int,input().split())
    print(bisect.bisect_right(n,r)-bisect.bisect_right(n,l-1))

Measured memory_bytes: 3712
import std.stdio;
import std.regex;

void main(){
	//auto io = new IO();
	char[][char] card;
	card['a'] = str();//io.rect!char()[0];
	card['b'] = str();
	card['c'] = str();
	
	char[char] ptr;
	ptr['a']=ptr['b']=ptr['c']=0;
	//= ["a":0,"b":0,"c":0];
	char target = 'a';
	
	foreach( i ; 0..100*100*100+10 ){
		auto now = ptr[target];
		if ( now >= card[target].length  ){
			target.toUpper().writeln();
			return;
		}
		
		ptr[target]++;
		target = card[target][now];
	}
}

char[] str(){
	char[] ret;
	foreach( elm ; readln().chomp().split() ){
		//ret ~= elm.to!char();
		ret ~= elm;
	}
	return ret;
}


import std.stdio,std.conv,std.string,std.uni;
import std.algorithm,std.array,std.math;
import std.bigint;

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

int N,M,ans=1;

int main()
{
	cin>>N>>M;
	if(N==1)
	{
		cout<<M<<endl;;
		return 0;
	}

	for(int i=2;i*i<=M;i++)
		if(M%i==0)
		{
			int tmp=M/i;
			if(tmp/N>0)
				ans=max(ans,i);
			if(i/N>0)ans=max(ans,tmp);
		}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  string s1, s2;

  cin >> s1 >> s2;

  s2.erase(--s2.end());

  if (s2 == s1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
int Salah(int x)
{
	int cnt=0;
	while(x!=0)
	{		
		cnt++;
		x/=10;
	}
	return cnt;
}
int main()
{
	int a,b;
	cin>>a>>b;
	int ab=pow(10,Salah(b))*a+b;
	if(sqrt(ab)==floor(sqrt(ab)))cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	//cout<<ab<<endl;
	return 0;
}

Measured memory_bytes: 256
// 179

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>
#include <string>
#include <cmath>

using namespace std;
using ll = long long int;
#define NUM 1000000007

int main(){
    string str;
    cin >> str;
    if(str.back() == 's') str += "es";
    else str += "s";
    cout << str << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define rep(i, n) for (int (i) = 1; i <= (n);++i)
using namespace std;

int main(){
    int A,B,C,D,ans;
    cin >> A >> B >> C >> D;
    if ((C < B && A < D) || (A < D && C < B)){
        int think[4];
        think[0] = A;
        think[1] = B;
        think[2] = C;
        think[3] = D;
        sort(think , think + 4);
        ans = think[2] - think[1];
    }else ans = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int ans = 10000;
    for(int i = 0; i <= s.size() - 3; i++)
    {
        int a = (s[i] - '0') * 100 + (s[i+1] - '0') * 10 + (s[i+2] - '0');
        ans = min(ans, abs(753 - a));
    }
    cout << ans << endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

struct Edge{
    ll dst;
    ll weight;
    Edge(ll dst, ll weight): dst(dst), weight(weight) {}
};

struct TmpDist{
    ll vertex;
    ll dist;
    TmpDist(ll vertex, ll dist): vertex(vertex), dist(dist) {}
    bool operator< (const TmpDist& right)const{
        return dist > right.dist;
    }
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
const ll INFLL = LLONG_MAX/3;

vector<ll> dijkstra(Graph &G, ll r){
    ll V = G.size();
    vector<ll> dist(V, INFLL);
    priority_queue<TmpDist> pq;
    vector<bool> check(V, false);
    TmpDist init(r, 0);
    pq.push(init);
    ll cnt = 0;
    while(!pq.empty()){
        TmpDist td = pq.top();pq.pop();
        ll now = td.vertex;
        if(!check[now]){
        	if(cnt > 0){
	            check[now] = true;
	            dist[now] = td.dist;
	        }
	        cnt++;
            for (int i=0;i<G[now].size();i++){
                if(dist[G[now][i].dst] > td.dist + G[now][i].weight){
                    TmpDist tdCandidate(G[now][i].dst, td.dist + G[now][i].weight);
                    pq.push(tdCandidate);
                }
            }
        }
    }
    return dist;
}

ll N, M;
Graph G(1010);
vector<ll> rG[1010];

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


    cin >> N >> M;
    REP(i, M){
    	ll A, B;
    	cin >> A >> B;
    	A--, B--;
    	Edge e(B, 1);
    	G[A].push_back(e);
    	rG[B].push_back(A);
    }

    vector<ll> res[1010];

    REP(i, N){
    	//dump(i)
    	auto dist = dijkstra(G, i);
    	if(dist[i]==INFLL) continue;
    	ll now = i;
    	while(1){
    		//dump(now)
    		bool ok = false;
    		res[i].push_back(now);
    		REP(t, rG[now].size()){
    			ll next = rG[now][t];
    			if(next == i){
    				ok = true;
    				break;
    			}
    			if(dist[next] == dist[now]-1){
    				now = next;
    				break;
    			}
    		}
    		if(ok) break;
    	}
    }
    ll mi = (1ll<<60);
    ll idx = -1;
    REP(i, N){
    	if(res[i].size()>0){
    		if(mi > (ll)res[i].size()){
    			mi = min(mi, (ll)res[i].size());
    			idx = i;
    		}
    	}
    }

    if(mi == (1ll<<60)){
    	cout << -1 << endl;
    }else{
    	cout << res[idx].size() << endl;
    	REP(i, res[idx].size()){
    		cout << res[idx][i]+1 << endl;
    	}
    }
    return 0;
}

Measured memory_bytes: 8448
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(int (i)=(0);(i)<(n);++i)
#define ll long long
#define INF 1000000000

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

	ll ans=0;
	int Wleft=0,Bleft=0,buf=0;

	REP(i,s.length()){
		if(s[i]==66)++Bleft;
		if(s[i]==87){
			buf = i - Wleft;
			ans += min(buf,Bleft);
			++Wleft;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
int ROW_INDEX = 1;
//[min_range, max_range]からn_ints個の整数の組をすべてとりだしcomb[組][整数]に格納する
void AllCombs_ints(int min_range, int max_range, int depth, int n_ints, int **comb){
	if(depth > 0){
		for(int x = min_range; x <= max_range; x++){
			//combの0行目を一時的な格納場所として使っている。これも気持ち悪い。
			comb[0][depth-1] = x;
			if(depth == 1){
				for(int num_i = 1; num_i <= n_ints; num_i++)
					comb[ROW_INDEX][num_i-1] = comb[0][n_ints-num_i];
				ROW_INDEX++;
			}
			AllCombs_ints(x + 1, max_range, depth - 1, n_ints, comb);
		}
	}
	if(depth == n_ints)
		ROW_INDEX = 1;
}
int Find_Rightmost_Col(int threshold, int from, int n_rows, int n_slices, int n_cols, 
						int slices[n_slices], int mat[n_rows+1][n_cols+1]){
	int current_col = from;
	int value_cell[n_slices+1];
	for(int cell_i = 0; cell_i <= n_slices; cell_i++)
		value_cell[cell_i] = 0;
	while(current_col <= n_cols){
		for(int slice_i = 0; slice_i <= n_slices; slice_i++){
			for(int row_i = (slice_i == 0 ? 1 : slices[slice_i-1] + 1); 
				row_i <= (slice_i == n_slices ? n_rows : slices[slice_i]); row_i++){
				value_cell[slice_i] += mat[row_i][current_col];
			}
			if(value_cell[slice_i] > threshold)
				return current_col - 1;
		}
		current_col++;
	}
	return current_col - 1;
}
int Factorial(int upto){
	if(upto == 0)
		return 1;
	return upto * Factorial(upto-1);
}
int main(){
	int n_rows, n_cols, nmax_white;
	scanf("%d %d %d", &n_rows, &n_cols, &nmax_white);
	int mat_choco[n_rows+1][n_cols+1];
	for(int row_i = 1; row_i <= n_rows; row_i++){
		char str[n_cols];
		scanf("%s", str);
		for(int col_i = 1; col_i <= n_cols; col_i++){
			if(str[col_i-1] == '0')
				mat_choco[row_i][col_i] = 0;
			else
				mat_choco[row_i][col_i] = 1;
		}
	}
	int ans = n_rows * n_cols;
	for(int n_slices = 0; n_slices < n_rows; n_slices++){
		int n_combs = Factorial(n_rows-1) / Factorial(n_slices) / Factorial(n_rows-1-n_slices);
		int **pt_slice;
		pt_slice = (int **) malloc(sizeof(int *) * (n_combs+1));
		for(int pt_i = 0; pt_i <= n_combs; pt_i++)
			pt_slice[pt_i] = (int *) malloc(sizeof(int) * (n_slices>0 ? n_slices : 1));
		AllCombs_ints(1, n_rows-1, n_slices, n_slices, pt_slice);
		for(int comb_i = 1; comb_i <= n_combs; comb_i++){
			int ans_temp = n_slices;
			int current_col = 1;
			while(current_col <= n_cols){
				int col_temp = current_col;
				current_col = Find_Rightmost_Col(nmax_white, current_col, n_rows, n_slices, n_cols, pt_slice[comb_i], mat_choco);
				if(col_temp > current_col){
					ans_temp = n_rows * n_cols;
					break;
				}
				ans_temp++;
				current_col++;
			}
			if(--ans_temp < ans)
				ans = ans_temp;
		}
		for(int pt_i = 0; pt_i <= n_combs; pt_i++)
			free(pt_slice[pt_i]);
		free(pt_slice);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long N;
cin>>N;
long long A;
long long r,b,g;
long long MOD=1000000007;
r=0;
b=0;
g=0;
long long ans=1;
long long num=0;
for(long long i=0;i<N;++i){
  cin>>A;
  if(r==A){
    num=1;
    //分岐パターン
    if(b==A && g!=A){
      num=2;
    }
    else if(b==A && g==A){
      num=3;
    }
    ///////////
    r+=1;
    ans*=num;
    ans=(ans+MOD)%MOD;
  }

  else if(b==A){
    if(b==A){
      num=1;
      if(g==A){
        num=2;
      }
///////////////
    b+=1;
    ans*=num;
    ans=(ans+MOD)%MOD;
    }
  }
  else if(g==A){
    g+=1;
  }
  else{
    ans=0;
  }
}

cout<<ans<<"\n";
return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

int main()
{
    string s; cin >> s;
    if ((s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) 
     || (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) 
     || (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]))
         cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll int128_t
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
// int const mod = 998244353;
int const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}

int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 5e5+5;
int const inf = 2e16;

int fact[N];
int ifact[N];

void precompute(){
    fact[0] = 1;
    for(int i=1;i<N;i++){
        fact[i] = i*(fact[i-1]);
        fact[i] %= mod;
    }
    ifact[N-1] = inverse(fact[N-1]);
    for(int i=N-2;i>=0;i--){
        ifact[i] = (i+1)*ifact[i+1];
        ifact[i] %= mod;
    }
}

int ncr(int n,int r){
    if(r == 0) return 1;
    if(n < r) return 0;
    if(n == r) return 1;
    int res = fact[n];
    res = res*ifact[r];
    res %= mod;
    res = res*ifact[n-r];
    res %= mod;
    return res;
}

void solve(){  
    int i,j;
    int n,k;
    cin>>n>>k;
    int ans = 0;
    int mn = 0;
    int mx = n;
    for(i=1;i<k;i++){
        mn += i;
        mx += (n-i);
    }

    for(i=k;i<=n+1;i++){
        ans = ans + (mx-mn+1);
        ans %= mod;
        if(ans < 0) ans += mod;
        mn += i;
        mx += (n-i);
    }
    cout<<ans<<endl;
}             


int32_t main(){
    IOS;
    int t;
    t = 1;
    precompute();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}


/*

*/

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

#define rep(i,n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar,val) memset(ar, val, sizeof(ar))
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 gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
  int n, m, c, b[20], a[20][20];
  int k = 0;
  cin >> n >> m >> c;
  rep(i, m) cin >> b[i];
  rep(i, n){
    int ans = 0;
    rep(j, m){
      cin >> a[i][j];
      ans += a[i][j] * b[j];
    }
    if(ans + c > 0) k++;
  }
  cout << k << endl;
  return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

inline void solve1(LL &n,const LL f[3],const LL t[3],const LL fl[3]){
	LL mx=n;
	FORQ(i,0,n){
		FORQ(j,0,n){
			int k=n-i-j;
			LL r=0;
			if(k<0)break;
			r+=i%f[0];
			r+=j%f[1];
			r+=k%f[2];
			r+=i/f[0]*t[0];
			r+=j/f[1]*t[1];
			r+=k/f[2]*t[2];
			mx=max(mx,r);
		}
	}

	n=mx;
}

void solve(LL &n,LL f[3],LL t[3],LL fl[3]){

}
void s2(LL &n,const LL r[2][3],const LL ig){
	int ii=0,jj=1;
	if(ig==0){
		ii=1;jj=2;
	}else if(ig==1){
		ii=0,jj=2;
	}
	if(r[0][ii]*r[1][jj]<r[0][jj]*r[1][ii]){
		swap(ii,jj);
	}
	LL mx=n;
	FORQ(i,0,n){
		int j=n-i;
		LL rr=i%r[1][ii];
		rr+=j%r[1][jj];
		rr+=i/r[1][ii]*r[0][ii];
		rr+=j/r[1][jj]*r[0][jj];
		mx=max(rr,mx);
	}
	n=mx;
}
void s1(LL &n,LL t,LL f){
	n= (n%f)+(n/f*t);
}

int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	//std::cout << std::fixed;
	//std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	LL n;
	cin>>n;
	LL r[2][3]={},f[3]={};
	cin>>r[0][0]>>r[0][1]>>r[0][2];
	cin>>r[1][0]>>r[1][1]>>r[1][2];
	FOR(i,0,3){
		if(r[0][i]<r[1][i])f[i]=1;
		else f[i]=0;
	}
	solve1(n,r[0],r[1],f);
	cerr<<"s1 end:"<<n<<endl;
	FOR(i,0,3){
		if(r[0][i]>r[1][i])f[i]=1;
		else f[i]=0;
	}
	if(f[0]+f[1]+f[2]==0){
		cout<<n<<endl;
		return 0;
	}
	if(f[0]+f[1]+f[2]==1){
		if(f[0]==1){
			s1(n,r[0][0],r[1][0]);
		}else if(f[1]==1){
			s1(n,r[0][1],r[1][1]);
		}else{
			s1(n,r[0][2],r[1][2]);

		}
	}
	if(f[0]+f[1]+f[2]==2){
		if(f[0]==0){
			s2(n,r,0);
		}else if(f[1]==0){
			s2(n,r,1);
		}else{
			s2(n,r,2);
		}
	}
	if(f[0]+f[1]+f[2]==3){
		solve1(n,r[1],r[0],f);
	}
	cout<<n<<endl;
	return 0;
}


Measured memory_bytes: 256
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_6_B&lang=jp
#partition

def partition(target_list):
    x = target_list[-1]
    i = -1

    for j in range(len(target_list))[:-1]:
        if target_list[j] <= x:
            i = i+1
            tmp = target_list[i]
            target_list[i] = target_list[j]
            target_list[j] = tmp
    tmp = target_list[-1]
    target_list[-1] = target_list[i + 1]
    target_list[i + 1] = tmp
    
    return  i + 1

def convert(l):
    return " ".join([str(n) for n in l])

if __name__ == "__main__":
    n_list = int(input())
    target_list = [int(n) for n in input().split()]

    center_index = partition(target_list)
    print(convert(target_list[:center_index]) + " ["+ str(target_list[center_index]) + "] " + convert(target_list[center_index + 1:]))

Measured memory_bytes: 18524
//#include <bits/stdc++.h>
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
//#include <bitset>
#include <iterator>
#include <tuple>
#include <utility>
#include <string>
#include <vector>
//#include <queue>
//#include <deque>
//#include <map>
//#include <unordered_map>
//#include <set>
#include <unordered_set>
//#include <stack>
using namespace std;

#define V             vector
#define PQ            priority_queue

#define pb            push_back
#define mp            make_pair
#define ins           insert
#define endl          '\n'
#define all(x)        x.begin(),x.end()
#define debug(X)      { cerr<<endl<<(#X)<<" = "<<(X)<<endl; }
//#define cerr if(0)cerr

#define mod           (1e9+7)

typedef long long ll;
typedef unsigned long long ull;


int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,a;
    unordered_set<int> s;
    bool r=1;

    cin>>n;
    while (n--) {
        cin>>a;
        if (s.count(a))
            r=0;
        else
            s.insert(a);
    }
    cout<<(r?"YES":"NO")<<endl;
}


Measured memory_bytes: 8520
#include<bits/stdc++.h>
using namespace std;
long long x;
__int128 ans=1; 
long long a[100005];
void print(__int128 x)
{
	if (!x) return ;
	if (x < 0) putchar('-'),x = -x;
	print(x / 10);
	putchar(x % 10 + '0');
}
int main()
{
	long long a;
	string b;
	cin>>a>>b;
	int x1=(b[0]-48)*100;
	int x2=(b[2]-48)*10;
	int x3=(b[3]-48);
	int x=x1+x2+x3;
//	cout<<x<<endl;
	cout<<a*x/100; 
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    double ret = 0;
    for (int i = 1; i <= n; i++) {
        double now = 1.0;
        int tmp = i;
        while (tmp < k) {
            tmp *= 2;
            now /= 2;
        }
        ret += now / n;
    }

    cout << fixed << setprecision(20) << ret << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var c, p, N int

	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		var h int
		fmt.Scan(&h)
		if p <= h {
			c += h - p
		}
		p = h
	}
	fmt.Println(c)
}

Measured memory_bytes: 512
cnt = 0
c1, c2, c3 = map(int, input().split())
try :
  for j in range(c1+1):
    for k in range(c2+1):
      for l in range(c3+1):
        if c1-j == c2-k == c3-l:
          c4, c5, c6 = map(int, input().split())
          if c4 - j == c5 -k == c6 -l:
              c7, c8, c9 = map(int, input().split())
              if c7 - j == c8 -k == c9 -l:
                cnt += 1
                break
except EOFError:
  pass
if cnt != 0:
  print("Yes")
else:
  print("No")

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

N, W = [int(x) for x in input().split()]
wv = []
for _ in range(N):
    wv.append([int(x) for x in input().split()])
w1 = wv[0][0]
dp = [[[0] * (N + 1) for _ in range(4 * N + 1)] for _ in range(N + 1)]

for i in range(1, N + 1):
    w, v = wv[i - 1]
    w -= (w1 - 1)
    for j in range(4 * N + 1):
        for k in range(1, N + 1):
            if j - w >= 0:
                dp[i][j][k] = max(dp[i - 1][j - w][k - 1] + v, dp[i - 1][j][k])
            else:
                dp[i][j][k] = dp[i - 1][j][k]
ans = 0
for i in range(N + 1):
    for j in range(4 * N + 1):
        for k in range(N + 1):
            if W - (w1 - 1) * k >= j:
                ans = max(ans, dp[i][j][k])

print(ans)


Measured memory_bytes: 79456
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,D;cin >> N >> D;
  vector<vector<int> > v(N,vector<int>(D));
  set<int> st;
  rep(i,N)rep(j,D) cin >> v[i][j];

  rep(i,1000) st.insert(i*i);

  int count = 0;
  rep(i,N){
    repp(j,i+1,N){
      int sum = 0;
      rep(k,D) sum += (v[i][k] - v[j][k]) * (v[i][k] - v[j][k]);
      if(st.count(sum)) ++count;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
string s;

int main()
{
	cin>>s;
	rep(i,s.size()-8)
	{
		cout<<s[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
	atcoder ARC094
	F Normalization
*/
#include <bits/stdc++.h>
typedef long long ll;
const ll P = 998244353;
const int N = 2e5 + 5;
inline void up(int &x, int y) { x < y ? x = y : 0; }
inline void down(int &x, int y) { x > y ? x = y : 0; }
inline int max(const int x, const int y) { return x > y ? x : y; }
inline int min(const int x, const int y) { return x < y ? x : y; }

inline void mod(ll &x) { x >= P ? x -= P : x; }

std::string str;
std::set < std::string > s;
int n;
ll dp[N][3][3][2];
inline bool all_equal(std::string str) {
	for (int i = 0; i < n; ++i)
		if (str[i] != str[0]) return false;
	return true;
}
inline void bfs(std::string str) {
	if (s.count(str)) return;
	s.insert(str);
	for (int i = 0; i < n - 1; ++i) 
		if (str[i] != str[i + 1]) {
		std::string t = str;
		if (str[i] != 'a' && str[i + 1] != 'a') t[i] = t[i + 1] = 'a';
		if (str[i] != 'b' && str[i + 1] != 'b') t[i] = t[i + 1] = 'b';
		if (str[i] != 'c' && str[i + 1] != 'c') t[i] = t[i + 1] = 'c';
		bfs(t);
	}
} 

inline ll dp_solve() {
	int s1 = 0;
	for (int i = 0; i < n; ++i) s1 += str[i] - 'a';
	s1 %= 3;
	for (int i = 0; i < 3; ++i) dp[0][i][i][0] = 1;
	for (int i = 0; i < n - 1; ++i)
		for (int s0 = 0; s0 < 3; ++s0)
			for (int now = 0; now < 3; ++now)
				for (int type = 0; type <= 1; ++type)
					for (int nxt = 0; nxt < 3; ++nxt) 
						mod(dp[i + 1][(s0 + nxt) % 3][nxt][type | (now == nxt)] += dp[i][s0][now][type]);
	ll ans = 0;
	for (int i = 0; i < 3; ++i) mod(ans += dp[n - 1][s1][i][1]);
	int ok = 0;
	for (int i = 1; i < n; ++i)
		if (str[i] == str[i - 1]) ok = 1;
	if (! ok) mod(ans += 1);
	return ans; 
}
int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(0);
    std::cin >> str;
    n = str.size();
    if (all_equal(str)) return std::cout << 1 << '\n', 0;
    if (n < 4) bfs(str), std::cout << s.size() << '\n';
    else std::cout << dp_solve() << '\n';
	return 0;
}


Measured memory_bytes: 31908
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
const ll waru=1e9;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int dp[100001][2];

int main(){
    int N;
    cin>>N;
    vector<int> t(N+1,0),x(N+1,0),y(N+1,0);
    for(int i=1;i<=N;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    bool j=true;
    for(int i=0;i<N;i++){
        int dist=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        if(dist>t[i+1]-t[i]||dist%2!=(t[i+1]-t[i])%2){
            j=false;
            break;
        }
    }
    cout<<(j?"Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 1408
//#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
using namespace std;

#define ios ios::sync_with_stdio(false)
#define ll long long
#define pa pair<int,int>
#define mk make_pair
#define sc(n) scanf("%d",&n)
#define ss(s) scanf("%s",s)
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define of(i,a,b) for(int i=a;i>=b;i--)
#define mem(a,b) memset(a,b,sizeof a)
#define uint unsigned int
#define vr vector<int>
#define pi acos(-1)

const ll inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7.;
const ll N = 1e6 + 7;

int n, m, t;
char s[N];

int main()
{
	cin >> n;
	ss(s);
	int cnt = 0;
	for (int i = 0; s[i]; i++)
	{
		if (s[i] != s[i + 1])
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 384
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
n,m = inp
t = n*100 + m*1800
p t*(2**m) 

Measured memory_bytes: 1788
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

A = input()
Ac = Counter(A)
cnt = 0
for val in Ac.values():
    cnt += val * (val - 1) // 2
print(len(A) * (len(A)-1) // 2 - cnt + 1)

Measured memory_bytes: 11316
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   double a, b, h, m;
    cin >> a >> b >> h >> m;
    double frH = h*30 + m/60 * 30;
    double frM = m * 6;
    double al = frH - frM;
    double res = sqrt(a*a + b*b - 2*a*b*cos(al/180 * PI));
    cout.precision(20);
    cout <<res;
    return 0;
}




Measured memory_bytes: 4212
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
// #define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }
  void solve()
  {
double d,t,s;
cin>>d>>t>>s;
if(d/s>t)
{
	cout<<"No";
}
else cout<<"Yes";

  }
  
  int main()
  {
ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
    #endif
int t=1;
while(t--)
{
  solve();
}

    return 0;
  }


Measured memory_bytes: 3736