akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long N;
  cin>>N;
  vector<long long> a(N);
  bool possible=false;
  for(long long i=0;i<N;i++){
    cin>>a.at(i);
    if(a.at(i)==1){possible=true;}
  }
  long long ans;
  if(possible==false){ans=-1;}
  else{//1は必ずある
    long long K=1;
    for(long long i=0;i<N;i++){
      if(a.at(i)==K){
        K++;
      }
    }
    ans=N-K+1;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 1792
class UnionFindTree():

    def __init__(self, n):
        #木全体の要素数
        self.n  = n
        #root[x]<0ならそのノードが根でありその値が木の要素数
        self.root = [-1] * (n+1)
        #ランク
        self.rank = [1] * (n+1)

    def find_root(self,x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]

    def unite(self,x,y):
        x = self.find_root(x)
        y = self.find_root(y)
        if x == y:
            return
        elif self.rank[x] > self.rank[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def is_same(self,x,y):
        return self.find_root(x) == self.find_root(y)

    def count_node(self,x):
        return -1 * self.root[self.find_root(x)]
v, e = map(int, input().split())
edges = []
for _ in range(e):
    s, t, w = map(int, input().split())
    edges.append((w, s, t))

#edgesは予めsortする
edges.sort()

def kuruskal(n, edges):
    uft = UnionFindTree(n)
    res = 0
    for e in edges:
        w, s, t = e
        if not uft.is_same(s, t):
            res += w
            uft.unite(s, t)
    return res

print(kuruskal(v, edges))


Measured memory_bytes: 23188
// 235816VL
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <deque>
#include <string>
#include <list>
#include <algorithm>
#include <cmath>
#include <fstream>
#include <map>
#include <set>
#include <sstream>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef unsigned long long int lli;
#define FOR(i, p, n) for(int i(p); i < n; i++)
#define ALL(a) (a.begin()),(a.end())
#define sqrt(x) sqrt(1.0*(x))
#define pow(x,n) pow(1.0*(x),n)
#define UN(x) (x).resize(unique(ALL((x))) - (x).begin()
bool solve(){
	int x, y;
	cin >> x >> y;
	if (x % y == 0) {
		cout << "-1";
	}
	else {
		cout << x;
	}
	return 0;
}
int main()
{
	solve();
///	while (!solve());
	return 0;
}


Measured memory_bytes: 256
//#include <iostream>
//#include <math.h>
//using namespace std;
// 
//int main(){
//	int N;
//	int arr[8][2]={0,};
//	int sum=0;
//	double average=0;
//
//	cin >> N;
//
//	for(int i=0;i<N;i++){
//		for(int j=0; j<2; j++){
//			cin >> arr[i][j];
//		}
//	}
//
//	for(int i=0;i<N-1;i++){
//		for(int j=i+1; j<N; j++){
//			cin >> arr[i][j];
//		}
//	}
//
//
//	return 0;
//}

#include <iostream>
#include <string>
using namespace std;

int main(){
	int N;
	string S;

	cin >> N;
	cin >> S;

	int result=0;
	for(int i=0;i<S.size();i++){
		result = int(S[i]+N%26);
		if(result > 90){
			result -= 26;
		}
		cout << char(result);
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef DBP
#define deb(...) fprintf(stderr,__VA_ARGS__)
#else
#define deb(...) 0
#endif
#define fore(x,a,b) for(int x=a, qwerty=b; x<qwerty; x++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define pb push_back
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fst first
#define snd second
#define mset(a,v) memset((a),(v),sizeof(a))
using namespace std;
typedef long long ll;

const int N=105;
int n, A[N];

int main(){FIN;
    cin >> n;
    fore(x,0,n)cin>>A[x];
    int ans=0, val=10000;
    fore(x,0,n-1){
        if(A[x]==A[x+1])ans++,A[x+1]=val--;
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 256
#include<stdio.h>

void scan(int[],int);
int search(int,int);

int s[100000];
int t[50000];

int main(){

  int n=0,q=0,c=0;

  scanf("%d",&n);
  scan(s,n);
 
  scanf("%d",&q);
  scan(t,q);

  c=search(n,q);
 
  printf("%d\n",c);

  return 0;
}

void scan(int a[],int m){

  int i;
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
  }
}

int search(int n,int q){

  int i=0,c=0;
  int left=0;
  int right=n;
  int mid=0;

  for(i=0;i<q;i++){
    left=0;
    right=n;
    while(left<=right){
      mid = (left + right) / 2;
      if(s[mid]==t[i]){
	c++;
	break;
      } 
      if(s[mid] < t[i]){
	left = mid + 1;
      } else {
	right = mid - 1;
      }
    }
  }
  return c;
  
}

Measured memory_bytes: 1184
x=list(map(int,input().split()))
y=list(map(int,input().split()))
z=list(map(int,input().split()))
A=[x,y,z]
X=[A[0][0],A[1][0],A[2][0]]
Y=[A[0][1],A[1][1],A[2][1]]
Z=[A[0][2],A[1][2],A[2][2]]
P=[A[0][0],A[1][1],A[2][2]]
Q=[A[0][2],A[1][1],A[2][0]]
B=[]
for i in range(int(input())):
    B.append(int(input()))
C=[x,y,z,X,Y,Z,P,Q]
for c in C:
    if set(c)<=set(B):
        print("Yes")
        break
else:
    print("No")

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cctype>
using namespace std;

char s[100007];
int you[27];
int main()
{
	scanf("%s",s);
	int n=strlen(s);
	for(int i=0;i<n;i++)
		you[s[i]-'a']=1;
	for(int i=0;i<26;i++)
		if(!you[i])
			return printf("%c\n",i+'a'),0;
	printf("None\n");
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
using namespace std;
int main(){

    int n;
    cin>>n;
    int F[n];
    double ave;
    for(int i=0;i<n;i++){
        cin>>F[i];
        ave+=F[i];
    }
    ave=ave/n;
    double min=abs(F[0]-ave);
    int minp=0;
    for(int i=1;i<n;i++){
        double u=abs(F[i]-ave);
        if(u<min){
            min=u;
            minp=i;
        }
    }

    cout<<minp<<endl;

return 0;
}

Measured memory_bytes: 256
MOD = 998244353
n = int(input())
x = input()

div = []
i = 1
while i*i <= n:
	if n%i == 0:
		if i%2 == 1:
			div.append(i)
		if i != n//i and (n//i) % 2 == 1:
			div.append(n//i)
	i += 1
div.sort(reverse=True)

ans = dict()

for d in div:
	l = n//d
	blocks = [int(x[i:i+l], 2) for i in range(0, n, l)]
	res = blocks[0]
	same = True
	tmp = blocks[0]
	for i, y in enumerate(blocks[1:]):
		tmp = ((1<<l)-1) ^ tmp
		if tmp < y:
			break
		elif tmp > y:
			same = False
			break
	ans[d] = (res + same) % MOD
	for dd in div:
		if dd == d:
			break
		elif dd % d == 0:
			ans[d] -= ans[dd]
			ans[d] %= MOD

print(sum([(2*n) // k * v for k, v in ans.items()]) % MOD)

Measured memory_bytes: 6760
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(int, N, K);
    vector<int> a(N);
    read(a);

    const auto needCutCnt = [&](i64 L) {
        i64 cnt = 0;
        for (const i64 e : a) {
            cnt += (e + L - 1) / L - 1;
        }
        return cnt;
    };

    needCutCnt(4);

    i64 ok = int(1e9) + 10;
    i64 ng = 0;

    while (ok - ng > 1) {
        const i64 mid = (ok + ng) / 2;
        if (needCutCnt(mid) <= K) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    print(ok);

    return 0;
}


Measured memory_bytes: 3952
import heapq
N,M = map(int,input().split())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
z = [0 for i in range(N)]
ap = [0 for i in range(N)]
xn = [0 for i in range(N)]
yn = [0 for i in range(N)]
zn = [0 for i in range(N)]
xp = [0 for i in range(N)]
yp = [0 for i in range(N)]
zp = [0 for i in range(N)]
an = [0 for i in range(N)]
for i in range(N):
	x[i],y[i],z[i] = map(int,input().split())
	ap[i] =  x[i]+y[i]+z[i]
	xn[i] = -x[i]+y[i]+z[i]
	yn[i] =  x[i]-y[i]+z[i]
	zn[i] =  x[i]+y[i]-z[i]
	xp[i] =  x[i]-y[i]-z[i]
	yp[i] = -x[i]+y[i]-z[i]
	zp[i] = -x[i]-y[i]+z[i]
	an[i] = -x[i]-y[i]-z[i]

Ap = sum(heapq.nlargest(M,ap))
Xn = sum(heapq.nlargest(M,xn))
Yn = sum(heapq.nlargest(M,yn))
Zn = sum(heapq.nlargest(M,zn))
Xp = sum(heapq.nlargest(M,xp))
Yp = sum(heapq.nlargest(M,yp))
Zp = sum(heapq.nlargest(M,zp))
An = sum(heapq.nlargest(M,an))

print(max([Ap,Xn,Yn,Zn,Xp,Yp,Zp,An]))

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, ar[N][3], dp[N][3];

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);
	
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> ar[i][0] >> ar[i][1] >> ar[i][2];

	for(int i = 1; i <= n; i++)
		for(int j = 0; j < 3; j++)
			for(int k = 0; k < 3; k++)
				if(j != k)
					dp[i][j] = max(dp[i][j], dp[i - 1][k] + ar[i][j]);
	cout << *max_element(dp[n], dp[n] + 3);
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> pippi;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-8;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    if(k<0)return 0;
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}


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


Measured memory_bytes: 3636
n,m = map(int,input().split())
edge = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

from collections import deque
que = deque([])
dist= [-1]*n
dist[0] = 0
que.append(0)
par = [-1] * n
while len(que)>0:
    node = que.popleft()
    for next_node in edge[node]:
        if dist[next_node] != -1:
            continue 
        dist[next_node] = dist[node] + 1
        par[next_node] = node  + 1
        que.append(next_node)
if -1 in dist:
    print("No")
else:
    print("Yes")
    print(*par[1:],sep = "\n")

Measured memory_bytes: 39300
ad,ao,bd,bo=map(float,input().split())
aTurn=int(ad/bo)+0.5
bTurn=int(bd/ao)
if ad%bo==0:
  aTurn -= 1
if bd%ao==0:
  bTurn -= 1
  
if aTurn>bTurn:
  print("Yes")
else:
  print("No")

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

int main()
{
  int N;
  cin >> N;
  // string w;
  map<string,int> mp;
  rep(i,N) {
    string w;
    cin >> w;
    sort(w.begin(),w.end());
    mp[w]++;
  }
  ll ans=0;
  for(auto& p : mp){
    int count = p.second;
    ans +=(ll)count * (count-1)/2;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;

int main(){
    long long int n,sum = 0;
    map<string,int>m;
    map<string,long long int>m2;
    cin >> n;

    for(int i = 0;i < n;i++){
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        if(m.find(s) == m.end()){
            m[s] = 1;
            m2[s] = 0;
        }else {
            m[s]++;
            m2[s]+=m[s]-1;
        }
    }

    for(auto &i:m2){
        sum += i.second;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 22144
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;
const int dx[] = {0, 0, -1, 1};
const int dy[] = {1, -1, 0, 0};
int H, W;
vector<string> S(50);
vector<vector<int>> G(50, vector<int>(50, INF));

void dfs(int x, int y){
  REP(i, 4){
      int xd = x+dx[i];
      int yd = y+dy[i];
      if(xd < 0 || W <= xd || yd < 0 || H <= yd) continue;
      if(S[yd][xd] == '#') continue;
      if(G[y][x]+1 >= G[yd][xd]) continue;
      G[yd][xd] = G[y][x]+1;
      dfs(xd, yd);
  }
}

int main(void){
  cin >> H >> W;
  REP(i, H) cin >> S[i];

  G[0][0] = 1;
  dfs(0, 0);
  if(G[H-1][W-1] == INF){
    cout << -1 << endl;
    return 0;
  }
  int ans = H*W - G[H-1][W-1];
  REP(i, H) REP(j, W) if(S[i][j] == '#') ans--;
  cout << ans << endl;
  return 0;
}

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

int main() {
  int H, W, M;
  cin >> H >> W >> M;

  unordered_map<int, unordered_set<int> > targets;
  unordered_map<int, int> hcounts;
  unordered_map<int, int> wcounts;

  unordered_set<int> maxh;
  int hcount = 0;
  unordered_set<int> maxw;
  int wcount = 0;

  rep(i, M) {
    int h, w;
    cin >> h >> w;
    targets[h].insert(w);
    hcounts[h]++;
    if (hcounts[h] >= hcount) {
      if (hcounts[h] > hcount) {
        maxh.clear();
        hcount = hcounts[h];
      }
      maxh.insert(h);
    }
    wcounts[w]++;
    if (wcounts[w] >= wcount) {
      if (wcounts[w] > wcount) {
        maxw.clear();
        wcount = wcounts[w];
      }
      maxw.insert(w);
    }
  }

  int res = hcount + wcount;

  for (auto h : maxh) {
    for (auto w : maxw) {
      if (targets[h].find(w) == targets[h].end()) {
        cout << res << endl;
        return 0;
      }
    }
  }

  cout << --res << endl;

  return 0;
}


Measured memory_bytes: 103424
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 1e9;
using namespace std;

class UnionFind
{
private:
  int par[110000];
  int rnk[110000];
  
  int root(int x){
    if(par[x]==x) return x;
    else {
      // contraction of the tree to the root
      return par[x] = root(par[x]);
    }
  }
  
public:

  UnionFind(int n){
    rep(i,n) {
      par[i] = i;
      rnk[i] = 0;
    }
  }
  
  void unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x==y)  return;
    if(rnk[x] < rnk[y]){
      par[x] = y;
    }
    else {
      par[y] = x;
      if(rnk[x]==rnk[y]) rnk[x]++;
    }
  }

  bool same(int x, int y){
    return root(x) == root(y);
  }
};
int main()
{
  int N, M;
  int p[110000];
  int res=0;
  cin >> N >> M;

  UnionFind uft(N);

  rep(i,N) {
    cin >> p[i];
    p[i]--;
  }

  rep(i,M) {
    int x, y;
    cin >> x >> y;
    x--;y--;
    uft.unite(x, y);
  }

  rep(i,N){
    //printf("testing from:%d to:%d (%d)\n", i, p[i], res);
    if(p[i]==i) {
      res++;
      continue;
    }
    if(uft.same(i, p[i])) res++;
  }
  
  cout << res << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
	string A, B, C;
	cin >> A >> B >> C;
	if (A[A.length() - 1] == B[0] && B[B.length() - 1] == C[0]) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for (int i = 0; i < N - 1; i++)
  {
    int a1[26] = {};
    int a2[26] = {};
    for (int j = 0; j <= i; j++)
      a1[S[j] - 'a']++;
    for (int j = i + 1; j < N; j++)
      a2[S[j] - 'a']++;
    int count = 0;
    for (int j = 0; j < 26; j++)
    {
      if (0 < a1[j] && 0 < a2[j])
        count++;
    }
    if (ans < count)
      ans = count;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int arr[101];
int main(){
	
	int a,b,c; cin>>a>>b>>c;
	
	arr[a]++;
	arr[b]++;
	arr[c]++;
	int cc = 0;
	for(auto xx : arr){
		if(xx) cc++;
	}
	cout<<cc<<"\n";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var S = Read();
            Println(S.Count(x => x == 'o') + (15 - S.Length) >= 8 ? "YES" : "NO");
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


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


struct S {
  string s;

  S(string s) : s(s) {}
  bool operator <(const S &other) const {
    for (int i = 0; i < min(s.size(), other.s.size()); i++) {
      if (s[i] != other.s[i]) {
        return s[i] > other.s[i];
      }
    }
    return s.size() > other.s.size();
  }
};

int main() {
  string s;
  int K;
  cin >> s >> K;
  priority_queue<S> q;
  for (int i = 0; i < 26; i++) {
    string s = "";
    s += (char)('a' + i);
    q.emplace(s);
  }

  int p = 0;
  while (q.size()) {
    S t = q.top();
    q.pop();
    for (int i = 0; i < s.size(); i++) {
      string ss = s.substr(i, t.s.size());
      if (ss == t.s) {
        p += 1;
        if (p == K) {
          cout << ss << endl;
          return 0;
        }
        for (int i = 0; i < 26; i++) {
          q.emplace(ss + (char)('a' + i));
        }
        break;
      }
    }
  }
}


Measured memory_bytes: 256
from math import ceil
t1,t2 = map(int,input().split())
a1,a2 = map(int,input().split())
b1,b2 = map(int,input().split())
a1 -= b1
a2 -= b2

if t1*a1 + t2*a2 == 0:
    print("infinity")
    exit()
if a1*a2 > 0:
    print(0)
    exit()
a1 *= t1
a2 *= t2
if (a1 > 0 and a1+a2>0) or (a1<0 and a1+a2<0):
    print(0)
    exit()

if a1 > 0:
    x = -a1/(a1+a2)
    n = ceil(x)
    if n == x:
        print(2*n)
    else:
        print(2*n-1)
if a2 > 0:
    x = a1 / (-(a1 + a2))
    n = ceil(x)
    if n == int(x):
        print(2 * n)
    else:
        print(2 * n - 1)

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

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl

struct UnionFind{
    vector<ll> parent;
    UnionFind(){
    }

    void initialize(ll sz){
        parent.resize(sz);
        reset();
    }

    void reset(){
        FOR(i, 0, parent.size()){
            parent[i] = i;
        }
    }

    void unite(ll a, ll b){
        if(a>b){
            swap(a, b);
        }
        ll rootA = findRoot(a);
        ll rootB = findRoot(b);
        if(rootA>rootB){
            swap(rootA, rootB);
        }
        if(rootA==rootB){
            return;
        }else{
            // 小さい方を親にする
            parent[rootB] = rootA;
        }
    }

    ll findRoot(ll a){
        if(parent[a]==a){
            return a;
        }else{
            return parent[a] = findRoot(parent[a]);
        }
    }

    map<ll, vector<ll> > getGroups(){
        map<ll, vector<ll> > G;
        FOR(i, 0, parent.size()){
            ll r = findRoot(i);
            G[r].push_back(i);
        }
        return G;
    }

    bool is_same_group(ll a, ll b){
        ll rootA = findRoot(a);
        ll rootB = findRoot(b);
        if(rootA==rootB){
            return true;
        }else{
            return false;
        }
    }
};

const int N_MAX = 100010;

vector<vector<ll> > G;

// 出次数
ll out[N_MAX];

ll parent[N_MAX];
UnionFind uf;
vector<pair<ll, ll> > Ans;

// 葉まで行って出次数見て、張る
void dfs(ll i, ll prev){
    for(ll to : G[i]){
        if(prev==to) continue;
        parent[to] = i;
        dfs(to, i);
    }

    ll p = parent[i];
    
    if(i==0) return;

    if(out[i]%2==1){
        // iから出す
        // i->p
        out[i]++;
        Ans.push_back(make_pair(i, p));
    }else{
        // p->i
        out[p]++;
        Ans.push_back(make_pair(p, i));
    }
}

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

    // input
    ll N, M;
    cin >> N >> M;

    if(M%2==1){
        p(-1);
        return 0;
    }

    vector<ll> A(M);
    vector<ll> B(M);
    FOR(i, 0, M){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }

    uf.initialize(N);

    G.resize(N);
    // make spanning tree
    FOR(i, 0, M){
        ll a = A[i];
        ll b = B[i];
        if(uf.is_same_group(a, b)){
            // 適当に方向づけ
            // a -> b
            out[a]++;
            Ans.push_back(make_pair(a, b));
        }else{
            // 辺をはる
            G[a].push_back(b);
            G[b].push_back(a);
            uf.unite(a, b);
        }
    }

    dfs(0, -1);

    for(auto pa : Ans){
        p2(pa.first + 1, pa.second + 1);
    }
    
    return 0;
}

Measured memory_bytes: 17776
#include <bits/stdc++.h>
using namespace std;
int a[2001][2002];
int n;
int to(int x,int y)
{
    if (x>y)swap(x,y);
    return x*n+y;
}
pair<int,int> from(int x)
{
    return {x/n,x%n};
}
int in[2000006];
bool vis[2000006];
vector<int> cur;
vector<pair<int,int> > ret;
vector<int> vec;
queue<int> q;
vector<int> adj[2000000];
set<int> s;
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    scanf("%d",&n);
    for (int i=0;i<n;i++)
    {
        for (int j=1;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            a[i][j]--;
            s.insert(to(i,a[i][j]));
            if (j>1)
                adj[to(i,a[i][j-1])].push_back(to(i,a[i][j])),in[to(i,a[i][j])]++;
        }
    }
    for (auto x:s)vec.push_back(x);
    for (int i=0;i<vec.size();i++)
    {
        if (in[vec[i]]==0)q.push(vec[i]);
    }
    for (int i=0;i<vec.size();i++)
    {
        if (q.empty())
        {
            printf("-1\n");
            return 0;
        }
        int v = q.front();q.pop();
        ret.push_back(from(v));
        for (auto u:adj[v])
        {
            in[u]--;
            if (in[u]==0)q.push(u);
        }
    }
    int num=1;
    for (int i=0;i<ret.size();i++)
    {
        int v = ret[i].first, u = ret[i].second;
        if (vis[u]||vis[v])
        {
            num++;
            for (auto x:cur)vis[x]=0;
            cur.clear();
        }
        vis[u]=1,vis[v]=1;
        cur.push_back(u);
        cur.push_back(v);
    }
    printf("%d\n",num);
}


Measured memory_bytes: 110576
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<string> A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  string T;
  cin>>T;
  int n=1,m=1;
  for(int i=0;i<N;i++){
    string s=A[i],t=A[i];
    for(int j=0;j<A[i].size();j++)
      if(A[i][j]=='?')s[j]='z',t[j]='a';
    if(s<T)n++;
    if(t<=T)m++;
  }
  for(int i=n;i<=m;i++){
    cout<<i;
    if(i==m)cout<<endl;
    else cout<<' ';
  }
}

Measured memory_bytes: 3536
import java.util.Scanner;

public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		//C
		int N = sc.nextInt();
		if(N == 0)
			System.out.println("0");
		else{
			StringBuilder ans = new StringBuilder();
			long div = 1;
			while(N != 0){
				//System.out.println(N+"::"+ans+"::"+N%(div*2));
				if(N % (div * 2) == 0){
					ans.append(0);
				}else{
					ans.append(1);
					N -= div;
				}
				div *= -2;
			}
			System.out.println(ans.reverse());
		}
	}
}

Measured memory_bytes: 23764
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())

        
    n = ii()
    tree = [[] for _ in range(n+1)]    # 頂点 i (1-index) が隣接頂点 j と距離 d_j, k と 距離 d_k の時、tree[i] = [(j, d_j), (k, d_k)] と記録される
    for _ in range(n-1):
        u, v, w = mi()
        tree[u].append((v, w))
        tree[v].append((u, w))
    color = [None] * (n+1)
    root = 1
    def dfs(u=root, prev=-1, evenp=True):
        color[u] = evenp
        # print(u)
        for v, d in tree[u]:
            if v == prev:
                continue
            if d % 2 == 0:
                dfs(v, prev=u, evenp=evenp)
            else:
                dfs(v, prev=u, evenp=not evenp)
    dfs()
    for vertex_color in color[1:]:
        print('1') if vertex_color else print('0')





if __name__ == "__main__":
    main()

Measured memory_bytes: 90288
#include <iostream>
#include <vector>
#include <algorithm>
int main(int argc, char const *argv[]) {
    long N,K;std::cin >> N >> K;
    typedef std::pair<long, long> pair;
    std::vector<pair> v;
    long a,b;
    for (size_t i = 0; i < N; i++) {
        std::cin >> a >> b;
        v.push_back(pair(a,b));
    }
    std::sort(v.begin(),v.end());
    long s=0;
    for (size_t i = 0; i < v.size(); i++) {
        if (s+v[i].second < K) {
            s+=v[i].second;
        }else{
            std::cout << v[i].first << '\n';
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=205,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<string> S(N);
    for(int i=0;i<N;i++) cin>>S[i];
    
    bool ok=false;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(S[i][j]=='#'){
                ok=true;
            }
        }
    }
    
    if(!ok){
        cout<<-1<<endl;
        return 0;
    }
    
    for(int i=0;i<N;i++){
        bool flag=true;
        for(int j=0;j<N;j++){
            if(S[i][j]=='.') flag=false;
        }
        if(flag){
            int ans=0;
            for(int j=0;j<N;j++){
                int cnt=0;
                for(int i=0;i<N;i++){
                    if(S[i][j]=='.') cnt++;
                }
                if(cnt) ans++;
            }
            cout<<ans<<endl;
            return 0;
        }
    }
    
    int ans=INF;
    
    for(int i=0;i<N;i++){
        int cnt=0;
        for(int k=0;k<N;k++){
            if(S[k][i]=='#') cnt++;
        }
        if(cnt){
            cnt=0;
        }else cnt=1;
        
        for(int j=0;j<N;j++){
            if(S[i][j]=='.') cnt++;
        }
        ans=min(ans,cnt);
    }
    
    for(int j=0;j<N;j++){
        int cnt=0;
        for(int i=0;i<N;i++){
            if(S[i][j]=='.') cnt++;
        }
        if(cnt) ans++;
    }
    
    cout<<ans<<endl;
}



Measured memory_bytes: 512
N=int(input())
T,A = (int(i) for i in input().split())
H = [int(i) for i in input().split()]

def getdiff(A,T,H):
    return (A-(T-H*0.006))**2

min = 0
for i in range(len(H)):
    if getdiff(A,T,H[min])>getdiff(A,T,H[i]):
        min = i
print(min+1)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string x, y;
	cin >> x;
	cin >> y;
	for (int i = 0; i < x.size(); i++){
		cout << x[i];
		if (i==y.size()){
			break;
		}
		cout << y[i];
		getchar();
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
#include <iostream>  
using namespace __gnu_pbds;  
using namespace std;
#define ll long long
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update>  ordered_set;
using namespace std;
 
#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (long long i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)
#define foreach(it,ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define fillinf(ar, n) fr(i,0,(n)) ar[i] = INF
#define debug(x) cout<<#x<<": "<<x<<endl
#define arr1d(a,n) cout << #a << " : "; fr(_,1,n) cout << a[_] << ' '; cout << endl;
#define arr1d0(a,n) cout << #a << " : "; rep(_,n) cout << a[_] << ' '; cout << endl;
#define arr2d(a,n,m) cout << #a << " :" << endl; fr(_,1,n) {fr(__,1,m) cout << a[_][__] << ' '; cout << endl;}
#define arr2d0(a,n,m) cout << #a << " :" << endl; rep(_,n) {rep(__,m) cout << a[_][__] << ' '; cout << endl;}


#define ull unsigned long long
#define ld long double
#define ui unsigned int
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define y0 yyyyyy0
auto clk=clock();
#define y1 yyyyyy1
#define setb __builtin_popcount
#define BIT(n) (1<<(n))
#define SQR(x) ((x) * (x))
#define CUBE(x) ((x) * (x) * (x))
#define LSOne(S) (S) & (-S)
inline bool EQ(double a, double b) {return fabs(a - b) < 1e-9;}
 
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;


 
inline int two(int n) {return 1 << n;}
inline int isOnBit(int n, int b) {return (n >> b) & 1;}
inline void onBit(int & n, int b) {n |= two(b);}
inline void offBit(int & n, int b) {n &= ~two(b);}
inline int lastBit(int n) {return n & (-n);}
inline int cntBit(int n) {int res = 0; while(n && ++res) n -= n &(-n); return res;}
 
#define INP "test.inp"
#define OUT "test.out"
 
#define PI 3.1415926535897932385
#define INF 10000000000000000ll
#define EPS 1e-7
#define MAXN 100000
#define MOD 998244353
#define dec decr
#define endl '\n'
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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


    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    int var1=0;
    int var2=abs(v[0]-v[1]);
    for(int i=2;i<n;i++){
        int temp1=var1;
        int temp2=var2;
        var2=min(temp2+abs(v[i]-v[i-1]),temp1+abs(v[i]-v[i-2]));
        var1=temp2;
    }
    cout<<var2;
    return 0;
}   

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;
const int N = 1100000, inf = 1e9;

int n, f[N][2];
char s[N];

template <class T>
inline void read(T &x) {
	x = 0;
	char ch = getchar(), w = 0;
	while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
	while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	x = w ? -x : x;
	return;
}

int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1), f[0][1] = 1;
	for (R int i = 1; i <= n; ++i) {
		int w = s[i] - '0';
		f[i][1] = min(f[i - 1][0] + w + 1, f[i - 1][1] + 9 - w);
		f[i][0] = min(f[i - 1][0] + w, f[i - 1][1] + 10 - w);
	}
	cout << f[n][0] << endl;
	return 0;
}

Measured memory_bytes: 9088
#include <stdio.h>
#include <string.h>
#include <vector>
#define lc cur << 1, l, mid
#define rc cur << 1 | 1, mid + 1, r
int n, b[200005], dp[200005], cnt, M[200005 << 2], q, x, y;
std::vector<int> v[200005];
void modify(int cur, int l, int r, int pos, int num) {
	M[cur] = std::min(M[cur], num);
	if (l == r) return;
	int mid = l + r >> 1;
	if (pos <= mid) modify(lc, pos, num);
	else modify(rc, pos, num);
}
int query(int cur, int l, int r, int L, int R) {
	if (L <= l && R >= r) return M[cur];
	int mid = l + r >> 1, ans = 0x3f3f3f3f;
	if (L <= mid) ans = std::min(ans, query(lc, L, R));
	if (R > mid) ans = std::min(ans, query(rc, L, R));
	return ans;
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &b[i]), cnt += b[i] == 0;
	scanf("%d", &q);
	for (int i = 1; i <= q; i++) scanf("%d%d", &x, &y), v[x].push_back(y);
	memset(M, 0x3f, sizeof M); memset(dp, 0x3f, sizeof dp);
	dp[0] = 0; modify(1, 0, n, 0, 0);
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < v[i].size(); j++) {
			int t = query(1, 0, n, i - 1, v[i][j]);
			if (t < dp[v[i][j]]) modify(1, 0, n, v[i][j], dp[v[i][j]] = t);
		}
		modify(1, 0, n, i, dp[i] = std::min(dp[i], dp[i - 1] + (b[i] ? 1 : -1)));
	}
	printf("%d\n", dp[n] + cnt);
	return 0;
}

Measured memory_bytes: 13568
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
#define ll long long
typedef unsigned long long ull;
typedef long double ld;

#define pii         pair<ll ,ll >
#define vi          vector<ll >
#define vii         vector<pii>
#define mi          map<ll ,ll >
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define pb          push_back
#define hell        0.000000000001
#define rep(i,a,b)  for(ll int i=a;i<b;i++)
#define take        rep(i,0,n) cin>>v[i];
#define MAXN        1000005


#define allr(c) (c).rbegin(),(c).rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}



void solve()
{
	ld d,t,s;
	cin>>d>>t>>s;
	ld z=d/s;
	if(t-z>=0)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}
int main()
    {
    	ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
      
        ll t;
        
        t=1;
        
    
 //   cin>>t;
        while(t--)
        solve();
    }

Measured memory_bytes: 3732
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  int count = 0;
  REP(i, n) count += a[i];
  sort(a.rbegin(), a.rend());
  int MN = (count+(4*m)-1) / (4*m);
  REP(i, m) {
    if(a[i] < MN) {
      cout << "No" << endl;
      return 0;
    }
  } 
  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,A[3];
	int l[10];
	int ans=INF;
	scan(N);
	rep(i,3) scan(A[i]);
	rep(i,N){
		scan(l[i]);
	}
	sort(l,l+N);
	int N3th=1; rep(i,N) N3th*=3;
	rep(bit,N3th){
		int nowbit=bit;
		vint haizoku[3];
		rep(i,N){
			haizoku[nowbit%3].push_back(l[i]);
			nowbit/=3;
		}
		if((haizoku[0].size()&&haizoku[1].size()&&haizoku[2].size())==0) continue;
		int pt=0;
		rep(i,3){
			/*printf("haizoku:%d  ",i);
			rep(j,haizoku[i].size()){
				printf("%d ",haizoku[i][j]);
			}
			printf("\n  ");*/
			int saizu=haizoku[i].size();
			int twopow=(1<<saizu);
			vpint tunagi;
			rep1(bit2,twopow-1){
				int nowl=0,kosu=0;
				rep(j,saizu){
					if((bit2>>j)&1) nowl+=haizoku[i][j],kosu++;
				}
				tunagi.push_back(mp(nowl,(kosu-1)*10));
			}
			int mincost=INF;
			rep(k,tunagi.size()){
				mincost=min(mincost,abs(A[i]-tunagi[k].first)+tunagi[k].second);
			}
			pt+=mincost;
			//prin(mincost);
		}
		ans=min(ans,pt);
		//printf("bit:%d  cost:%d\n\n",bit,pt);
	}
	prin(ans);
	return 0;
}


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

int main() {
    int N;
    cin >> N;
    ll sum = 0;
    vector<ll> A(N), B(N + 1,0), count(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        B[A[i]]++;
    }

    for (int i = 1; i <= N; i++) {
        if (B[i] > 1) sum += B[i] * (B[i] - 1) / 2;
    }

    for (int i = 0; i < N; i++) {
        count[i] = sum - B[A[i]] + 1;
    }

    for (int i = 0; i < N; i++) cout << count[i] << endl;
}


Measured memory_bytes: 7296
#include <cstdint>
#include <iostream>

using namespace std;
#define MOD (1000000000 + 7)

int32_t main()
{
  uint32_t N;
  cin >> N;

  long long power = 1;
  for (uint32_t i = 1; i <= N; i++) {
    power *= i;
    power %= MOD;
  }

  cout << power << endl;

  return 0;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

template<typename T> inline void _tostr(const T t, string& s){ostringstream o;o<<t;s=o.str();}
template<typename T> inline void _toint(const string s, T& n){istringstream i(s);n;i>>n;}

int a, L;
//char to[10];
string to;
int m, M;

int main()
{
  while(cin >> to >> L, L){
    map<string, int> hm;
    int cnt = 1;
    while(hm[to] < 1){
      hm[to] = cnt++;
      rep(i, to.size()-L) to += '0';
      sort(ALL(to));
      _toint(to, m);
      reverse(ALL(to));
      _toint(to, M);
      a = M - m;
      _tostr(a, to);
    }
    cout << hm[to] - 1 << ' ' << to << ' ' << cnt - hm[to] << endl;
  }

  return 0;
}

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

int main()
{
  string s;
  cin >> s;
  int cnt=0;
  
  for(int i =0 ;i < s.size()/2;i ++)
    if(s[i]!= s[s.size()-1-i])
      	cnt++;
  cout<< cnt;
	
	return 0;
}


Measured memory_bytes: 256