akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int a, b, c; cin >> a >> b >> c;
    int cnt = 0;
    while(true) {
        if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
            cout << cnt << endl;
            return;
        }
        if(cnt > 100) {
            cout << -1 << endl;
            return;
        }
        int a_ = (b + c) / 2, b_ = (a + c) / 2, c_ = (a + b) / 2;
        a = a_;
        b = b_;
        c = c_;
        cnt ++;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}


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

signed main(){
	int N,M; cin>>N>>M;
	vector<int> A(N);
	for(int i=0;i<N;i++)cin>>A[i];
	vector<pair<int,int>> CB(M);
	int Bsum=0;
	for(int i=0;i<M;i++){
		cin>>CB[i].second>>CB[i].first;
		Bsum+=CB[i].second;
	}
	sort(CB.begin(),CB.end());
	reverse(CB.begin(),CB.end());
	vector<int> D;
	int p=0,q=0;
	while(D.size()<N && D.size()<Bsum){
		D.push_back(CB[p].first);
		q++;
		if(q==CB[p].second){
			p++; q=0;
		}
	}
	sort(A.begin(),A.end());
	for(int i=0;i<(N<D.size() ? N : D.size());i++){
		if(A[i]<D[i])A[i]=D[i];
		else break;
	}
	int sum=0;
	for(int i=0;i<N;i++)sum+=A[i];
	cout<<sum<<endl;
	
}

Measured memory_bytes: 3832
#include<iostream>
using namespace std;
int main()
{
    int N,i;
    cin>>N;
    if(N<10)
    {
        i=N;
    }
    else if(N>=10 && N<=99)
    {
        i=9;
    }
    else if(N>=100 && N<=999)
    {
        i=9+(N-99);
    }
    else if(N>=1000 && N<=9999)
    {
        i=9+900;
    }
    else if(N>=10000 && N<=99999)
    {
        i=9+900+(N-9999);
    }
    else if(N==100000)
    {
        i=9+900+90000;
    }
    cout<<i<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<pair<double, double>>v(n);
	for (int i = 0;i < n;i++) {
		cin >> v[i].first >> v[i].second;
	}
	// 入力したベクトルのソート
	sort(v.begin(), v.end());

	int cnt = 1;
	double dist = 0;
	do {
		// ベクトルの順列の数だけ繰り返し
		for (int i = 0;i < n - 1;i++) {
			dist += sqrt(pow((v[i + 1].first - v[i].first), 2.0) + pow((v[i + 1].second - v[i].second), 2.0));
		}
	} while (next_permutation(v.begin(), v.end()));
	for (int i = 1;i <= n;i++) {
		cnt *= i;
	}
	cout << fixed << setprecision(10) << dist/cnt << endl;
}


Measured memory_bytes: 3848
n = int(input())
S = input()
r = []
g = []
b = []
for i, s in enumerate(S):
    if s == 'R':
        r.append(i+1)
    elif s == 'G':
        g.append(i+1)
    else:
        b.append(i+1)

lenr = len(r)
leng = len(g)
lenb = len(b)
total = lenr*leng*lenb
for i in range(0, n-2):
    for j in range(n-(i+1)*2):
        j1 = j+i+1
        j2 = j+i*2+2
        if (S[j] != S[j1]) and (S[j1] != S[j2]) and (S[j2] != S[j]):
            total -= 1
print(total)

Measured memory_bytes: 68472
n,q=list(map(int,input().split()))
name=[]
time=[]
sum=0
for i in range(n):

	na,ti=input().split()
	name.append(na)
	time.append(int(ti))
	
	
while len(name)>0:
	na=name.pop(0)
	ti=time.pop(0)
	
	if ti>q:
		sum+=q
		name.append(na)
		time.append(ti-q)
		
	else:
		sum+=ti
		print(na, sum)
		


Measured memory_bytes: 9536
#include <iostream>
#include <cstring>

using namespace std;

int c[10];
int main() {
  string s;
  cin >> s;

  string tmp = "KIHBR";

  if(s.size() > 9) {
    cout << "NO" << endl;
    return 0;
  }

  int j = 0, k = 0;

  for(int i = 0; i < s.size(); i++) {
    if(s[i] == 'A') {
      c[j]++;
      continue;
    }

    if(s[i] != tmp[k]) {
      cout << "NO" << endl;
      return 0;
    }

    j++;
    k++;
  }
  if(k != 5) {
    cout << "NO" << endl;
    return 0;
  }
  for(int i = 0; i < 6; i++) {
    if(i == 1 || i == 2) {
      if(c[i] != 0) {
	cout << "NO" << endl;
	return 0;
      }
    }
    else if(c[i] > 1) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;
}
	

  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
const int mod = 1000000007;

struct mint {
	ll x;
	mint(ll x = 0) :x(x% mod) {}
	mint operator-() const { return(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(100005);

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	mint ans = 0;
	rep(ri, 2) {
		rep(i, n) {
			mint now = comb(i, k - 1);
			if (ri == 1) now = -now;
			ans += now * a[i];
		}
		reverse(all(a));
	}
	cout << ans.x << endl;
	return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)

typedef pair<int, int> Pi;
#define fi first
#define se second

int mx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int my[] = {0, 1, 1, 1, 0, -1, -1, -1};
int W, H;
int mas[55][55];

void bfs(int sy, int sx) {
  
  queue < Pi > que;
  que.push(Pi(sy, sx));

  while(!que.empty()) {
    Pi d = que.front(); que.pop();
    int y = d.fi, x = d.se;
    Rep(i, 8) {
      int ny = y + my[i], nx = x + mx[i];
      if(ny < 0 || nx < 0 || ny >= H || nx >= W || !mas[ny][nx]) continue;
      mas[ny][nx] = 0; bfs(ny, nx);
    }
  }
}

signed main()
{  
  while(cin >> W >> H, W || H) {
    int ans = 0;
    Rep(i, H) Rep(j, W) cin >> mas[i][j];

    Rep(i, H) Rep(j, W) {
      if(mas[i][j]) {
	mas[i][j] = 0, ans++;
	bfs(i, j);
      }
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 4916
N = int(input().rstrip())
INPUT = list(map(int, input().rstrip().split(' ')))

for count in range(1000000000):
    for i in range(N):
        p, mod = divmod(INPUT[i], 2)
        if mod == 0:
            INPUT[i] = p
        else:
            break
    else:
        continue
    print(count)
    break

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  LL N, K;
  cin >> N >> K;
  VL xs(N);
  cin >> xs;
  
  LL b = find(ALL(xs), 1ll) - begin(xs);
  LL ans = 1e9;

  REP(k,K){
	LL bb = b - K + 1 + k;
	LL ee = bb + K - 1;
	mini(ans, 1 + max(0ll, (bb + K-2) / (K-1)) + max(0ll, (N - 1 - ee + K-2) / (K-1)));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
var
i,j,k,m,n,x:longint;
a,b,c,d:array[1..1000]of longint;
begin
    readln(m,n);
    for i:=1 to m do
    readln(a[i],b[i]);
    for j:=1 to n do
    readln(c[j],d[j]);
    for i:=1 to m do
    begin
        k:=maxlongint;
        for j:=1 to n do
        if abs(a[i]-c[j])+abs(b[i]-d[j])<k then
        begin k:=abs(a[i]-c[j])+abs(b[i]-d[j]);x:=j; end;
        writeln(x);
    end;
end.

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

using namespace std;

inline int read(){
	char ch=getchar();int x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}

int h[1001],l[1010];

char ch[1010][1010];

int main(){
	int n=read(),m=read();
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>ch[i][j];
		}
	} 
	for(int i=1;i<=n;i++){
		int sum=0;
		for(int j=1;j<=m;j++){
			if(ch[i][j]=='.'){
				sum++;
			}
		}
		if(sum==m) h[i]=1;
	}
	for(int j=1;j<=m;j++){
		int sum=0;
		for(int i=1;i<=n;i++){
			if(ch[i][j]=='.'){
				sum++;
			}
		}
		if(sum==n) l[j]=1;
	}
	for(int i=1;i<=n;i++){
		if(h[i]==1) continue;
		for(int j=1;j<=m;j++){
			if(l[j]==1) continue;
			cout<<ch[i][j];
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
import java.io.*;
import java.util.*;
public class Main{
   public static void main(String[] args) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   int[] kazu = new int[10];
   for(int a = 0; a <= 9; a++){
   kazu[a] = Integer.parseInt(br.readLine());
   }
   int n = 10;
   int kari;
   for(int b = 0; b <= n-2; b++){
   int x = b;
   for(int c = b+1; c <= n-1; c++){
   if(kazu[x] < kazu[c]){
   x = c;
   }
   }
   if(x != b){
   kari = kazu[x];
   kazu[x] = kazu[b];
   kazu[b] = kari;
   }
   }
   for(int d = 0; d <= 2; d++){
   System.out.println(kazu[d]);
   }
   }
}
   

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

int main() {
  int n;
  cin >> n;
  int l[n];
  for(int i = 0; i < n; i++) cin >> l[i];
  sort(l, l + n);
  int ans = 0;
  for(int i = 0; i < n; i++) {
    for(int j = i + 1; j < n; j++) {
      for(int k = j + 1; k < n; k++) {
        if(l[k] < l[i] + l[j]) ans++;
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;

#define INF (1 << 30)

int dp[1001][1001];

int main() {
	int n, m, d[1001], c[1001];
	fill(dp[0], dp[1001], INF);
	dp[0][0] = 0;

	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		cin >> d[i];
	}
	for (int i = 1; i <= m; ++i) {
		cin >> c[i];
	}

	for (int i = 0; i < m; ++i) {
		for (int j = 0; j <= n; ++j) {
			if (dp[i][j] < INF) {
				if (dp[i + 1][j] > dp[i][j]) {
					dp[i + 1][j] = dp[i][j];
				}
				if (j < n && dp[i + 1][j + 1] > dp[i][j] + c[i + 1] * d[j + 1]) {
					dp[i + 1][j + 1] = dp[i][j] + c[i + 1] * d[j + 1];
				}
			}
		}
	}

	cout << dp[m][n] << endl;

	return 0;
}

Measured memory_bytes: 6980
#include <iostream>
#include <cstdio>
#include <math.h>

using namespace std;

int main()
{
    double a, b;
    while (cin >> a >> b, a || b) {
        printf("%.9lf\n", a*a + a*2*sqrt((a*a)/4+b*b));
    }

    return 0;
}

Measured memory_bytes: 3140
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
H,n = readInts()
A = []
B = []
for i in range(n):
    a,b = readInts()
    A.append(a)
    B.append(b)
# dp[h][i] := 体力 h の時の、魔法i番目を使った時の魔力の最小値
# dp[h] でいいかもこれ
INF = float('inf')
dp = [INF] * (H+1)
dp[0] = 0
for h in range(0,H+1):
    for i in range(n):
        dp[min(h+A[i],H)] = min(dp[min(h+A[i],H)], dp[h] + B[i])

#print(dp)
print(dp[H])


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

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define verify(x) if(x >= MOD) x -= MOD;

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void print_case(int tn) {cout<<"Case #"<<tn<<": ";}

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;
/*----------------------------------------------------------------------*/

vll getDivisors(ll n) 
{ 
	vll facts;
    facts.pb(n);
    for (ll i=2; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            if (n/i == i) 
            	facts.push_back(i);     
  
            else {
            	facts.push_back(i);
            	facts.push_back(n/i);
            } 
               
        } 
    } 
    return facts;
}

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t clk = clock();

    ll n; cin>>n;
    vll d1 = getDivisors(n);
    ll res = 0;
    if(n > 2) {
        vll d2 = getDivisors(n - 1);
        res = d2.size();
    }

    // gcd ( a, a - 1) = 1. so no overlap
    for(ll d : d1) {
        ll curr = d;
        while(curr <= n && (n % curr == 0)) {
            ll tmp = n / curr;
            if(tmp % d == 1) res++;
            if(curr <= n / d) curr *= d;
            else break;
        }
    }
    cout<<res;
    cerr << endl << "Time (in ms): " << double(clock() - clk) * 1000.0 / cps << endl;
    return 0;
}

Measured memory_bytes: 384
# Aizu Problem 0028: Mode Value
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


counts = {}
while True:
    try:
        a = int(input())
    except EOFError:
        break
    counts[a] = counts.get(a, 0) + 1

for a in sorted([a for a in counts if counts[a] == max(counts.values())]):
    print(a)

Measured memory_bytes: 7688
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


template<typename T>
vector<int> compress(vector<T> &v) {
  vector<T> t = v;
  sort(t.begin(), t.end());
  t.erase(unique(t.begin(), t.end()), t.end());
	vector<int> r(v.size());
  for (int i = 0; i < v.size(); i++) {
    r[i] = lower_bound(t.begin(), t.end(), v[i]) - t.begin();
  }
	return r;
}


int main() {
  ll n; cin >> n;
  V a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];

  V aa = a;
  V bb = b;
  sort(all(aa));
  sort(all(bb));

  rep(i, n) {
    if (aa[i] > bb[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  rep(i, n-1) {
    if (aa[i+1] <= bb[i]) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  vector<P> ab(n);
  rep(i, n) {
    ab[i].first = a[i];
    ab[i].second = b[i];
  }
  sort(all(ab));

  rep(i, n) bb[i] = ab[i].second;
  bb = compress(bb);

  int s = 0;
  int cnt = 0;
  while (true) {
    s = bb[s];
    cnt++;
    if (s == 0) break;
  }
  if (cnt < n) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<int> G[114514];
typedef pair<int,int> P;
signed main(){
  int n,m;
  cin>>n>>m;
  for(int i=0,a,b;i<m;i++){
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  int q;
  cin>>q;
  int v[q],d[q],c[q];
  for(int i=0;i<q;i++){
    cin>>v[i]>>d[i]>>c[i];
    v[i]--;
  }
  int p[n];
  memset(p,-1,sizeof(p));

  bool used[11][n];
  memset(used,0,sizeof(used));

  reverse(v,v+q);
  reverse(d,d+q);
  reverse(c,c+q);
  for(int i=0;i<q;i++){
    if(used[d[i]][v[i]]) continue;
    queue<P> qu;
    qu.push(P(v[i],d[i]));
    used[d[i]][v[i]]=1;
    while(!qu.empty()){
      P pp=qu.front();qu.pop();
      int u=pp.first,di=pp.second;
      if(p[u]<0) p[u]=c[i];
      for(int k=0;k<=di;k++) used[k][u]=1;
      if(!di) continue;
      for(int j=0;j<(int)G[u].size();j++){
	if(used[di-1][G[u][j]]) continue;
	qu.push(P(G[u][j],di-1));
      }
    }
  }
  for(int i=0;i<n;i++) cout<<(p[i]<0?0:p[i])<<endl;
  return 0;
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long x;
    cin>>x;
    long long y=(x/500);
    long long ans=y*1000;
    x=x-(y*500);
    long long h=(x/5);
    ans=ans+(h*5);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int first[1000000];
int next[1000000];
int go[1000000];
int ans[1000000];
int visited[1000000];
int q[1000000];
int i,n,m,x,y,flag,re,t,l,r;

int main(){
	scanf("%d %d",&n,&m);
	for (i=1;i<=m;i++){
		scanf("%d %d",&x,&y);
		next[i]=first[x];
		first[x]=i;
		go[i]=y;
		next[i+m]=first[y];
		first[y]=i+m;
		go[i+m]=x;
	}
    l=0;r=1;
    q[1]=1;
    visited[1]=1;
    while (l<r){
    	l++;
    	re=q[l];
    	t=first[re];
    //	printf("%d\n",re);
    	while (t!=0){
    		if (visited[go[t]]==0){
    			visited[go[t]]=1;
    			r++;
    			q[r]=go[t];
    			ans[go[t]]=re;
			}
    		t=next[t];
		}
	}
    flag=0;
    for (i=2;i<=n;i++)
      if (visited[i]==0){
      	flag=1;
	  }
	if (flag==1){
		printf("No\n");
	}else{
	printf("Yes\n");
    for (i=2;i<=n;i++){
    	printf("%d\n",ans[i]);
	}
}
}


Measured memory_bytes: 6384
n=int(input())
x=[]
y=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    y.append(b)

ans=0

for i in range(n):
    for j in range(n):
        ans+=((x[i]-x[j])**2+(y[i]-y[j])**2)**0.5

print(ans/n)

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

struct Vector{
    int x;
    int y;
    Vector(int x, int y) : x(x), y(y){}
    int abs_square(){
        return x * x + y * y;
    }
};

int dot(Vector v1, Vector v2){
    return v1.x * v2.x + v1.y * v2.y;
}

int cross(Vector v1, Vector v2){
    return v1.x * v2.y - v1.y * v2.x;
}

int main(){
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int x0, y0, x1, y1, x2, y2, x3, y3;
        cin >> x0 >> y0 >> x1 >> y1;
        cin >> x2 >> y2 >> x3 >> y3;
        Vector v1 = Vector(x1 - x0, y1 - y0);
        Vector v2 = Vector(x3 - x2, y3 - y2);
        if (dot(v1, v2) == 0) {
            cout << 1 << endl;
            continue;
        }
        if (cross(v1, v2) == 0) {
            cout << 2 << endl;
            continue;
        }
        cout << 0 << endl;
    }
    return 0;
}



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

int main() {

  int W, H, x, y, r;

  std::cin >> W >> H >> x >> y >> r;

  if( 0 <= x-r && x-r <= W &&
      0 <= x+r && x+r <= W &&
      0 <= y-r && y-r <= H &&
      0 <= y+r && y+r <= H   ) {
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

void o(const vector<int>& v) {
    for(int i=0;i<v.size();i++) {
        cout << v[i];
    }
    cout << endl;
}

// if (v1 > v2) return true;
bool comp(vector<int> &v1, vector<int> &v2) {
    if (v1.size() > v2.size()) {
        return true;
    }
    if (v1.size() < v2.size()) {
        return false;
    }
    for(int i=0;i<v1.size();i++) {
        if (v1[i] > v2[i]) {
            return true;
        } else if (v1[i] < v2[i]) {
            return false;
        }
    }
    return false;
}
int main() {
    int needs[] = {0,2,5,5,4,5,6,3,7,6};
    int n, m;
    cin >> n >> m;
    vector<int> a;
    for(int i=0; i< m;i++) {
        int t;
        cin >> t;
        a.push_back(t);
    }
    vector<vector<int>> vs;
    vs.push_back(vector<int>());
    for(int i=1; i<= n;i++) {
        vector<int> max;
        for(vector<int>::iterator it = a.begin(); it != a.end(); it++) {
            int need = needs[*it];
            if (i -need < 0) {
                continue;
            }
            if (i - need > 0 && vs[i-need].size() ==0) {
                continue;
            }
            vector<int> now = vs[i - need];
            now.push_back(*it);
            vector<int> now2 = vs[i - need];
            now2.insert(now2.begin(), *it);
            if (comp(now, max)) {
                max=now;
            }
            if (comp(now2, max)) {
                max=now2;
            }
        }
        //cout << i << " ";
        //o(max);
        vs.push_back(max);
    }
    o(vs[n]);
    return 0;
}

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

using namespace std;

int main(){
  int N;
  cin>>N;
  
  vector<vector<int> > v(2,vector<int>(N,0));
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++){
      cin>>v[i][j];
    }
  }
  
  int max=0;
  for(int i=0;i<N;i++){
    int num=0; 
    for(int j=0;j<=i;j++){
      num+=v[0][j];
    }
    for(int j=i;j<N;j++){
      num+=v[1][j];
    }
    if(num>=max){
      max=num;
    }
  }
  cout<<max<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define inf 0x3fffffffffffffff
using namespace std;

int n,m;
char s[5010];
struct data
{
    int len;
    char s[10];
}a[50010];

bool cmp(data x,data y)
{
    int len=min(x.len,y.len);
    for (int i=1;i<=len;i++)
        if (x.s[i]!=y.s[i]) return x.s[i]<y.s[i];
    return x.len<y.len;
}

bool com(data x,data y)
{
    int len=min(x.len,y.len);
    if (x.len!=y.len) return false;
    for (int i=1;i<=len;i++)
        if (x.s[i]!=y.s[i]) return false;
    return true;
}

int main()
{
    scanf("%s%d",s+1,&m);
    n=strlen(s+1);
    string x;
    int p=0;
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=2*m;j++)
        {
            if (i+j-1>n) break;
            p++;a[p].len=j;
            for (int k=1;k<=j;k++)
                a[p].s[k]=s[i+k-1];
        }
    }
    sort(a+1,a+1+p,cmp);
    m--;
    if (m==0)
    {
        for (int i=1;i<=a[1].len;i++)
            putchar(a[1].s[i]);
        puts("");
        return 0;
    }
    else
    {
        for (int i=2;i<=p;i++)
            if (!com(a[i],a[i-1]))
            {
                m--;
                if (m==0)
                {
                    for (int j=1;j<=a[i].len;j++)
                        putchar(a[i].s[j]);
                    puts("");
                    return 0;
                }
            }
        
    }
    return 0;
}

Measured memory_bytes: 1024
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	long[] tmp = readln.chomp.split.map!(to!long).array;
	long a = tmp[0], b = tmp[1];
	
	string ans;
	if(b < 0){
		if((a - b) % 2) ans = "Positive"; // eg -4 .. -1
		else ans = "Negative"; // eg -3 .. -1
		}
	else if(a <= 0) ans = "Zero";
	else ans = "Positive";
	
	ans.writeln;
	}

Measured memory_bytes: 256
import java.util.*;

 class Main
 {
   public static void main(String args[])
   { 
    answer();
   }
   static void answer()
   {
     Scanner sc = new Scanner(System.in);
     
     int n = sc.nextInt();
     
     int[] a = new int[n];
     
     int[] b = new int[n];
     
     for(int i = 0;i < n; i ++)
     {
       a[i] = sc.nextInt();
       
       b[n - i - 1] = a[i];
     }
     for(int i = 0;i < n; i ++)
     {
       if(i != 0)System.out.printf(" ");
       
       System.out.print(b[i]);
     }
     System.out.println();
   }
 }
    


Measured memory_bytes: 26280
s = input()

slen = len(s)
s1 = ""
f = "0"
for i in range(slen) :
  s1 += f
  f = "1" if f=="0" else  "0"
  
  
s2 = ""
f = "1"
for i in range(slen) :
  s2 += f
  f = "1" if f=="0" else  "0"

b = int(s,2)
p1 = int(s1,2)
p2 = int(s2,2)

r1 = b^p1
r2 = b^p2

ans1 = format(r1,"b")
ans2 = format(r2,"b")

print(min(ans1.count("1"),ans2.count("1")))





Measured memory_bytes: 3572
A = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
K = int(input())

print(A[K-1])

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

using namespace std;

int main()
{
    int n,m, p{}; double t{};
    cin >> n >> m;
    int v[n];
    for(int i = 0; i < n; i++)
    {
        cin >> v[i];
        t += v[i];

    }

    for(int i = 0; i < n; i++)
    {

        if(v[i] >= t/(4*m)){
            p++;
        }
    }
    if(p >= m)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	uf := newUnionFind(n)
	lm := make(map[int]int)
	var k, l int
	for i := 0; i < n; i++ {
		fmt.Scan(&k)
		for j := 0; j < k; j++ {
			fmt.Scan(&l)
			if v, ok := lm[l]; ok {
				uf.unite(i, v)
			}
			lm[l] = i
		}
	}

	if uf.size(0) == n {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

// UnionFind .
type UnionFind struct {
	par   []int
	rank  []int
	sizes []int
}

func newUnionFind(n int) UnionFind {
	u := UnionFind{}
	u.par = make([]int, n)
	u.rank = make([]int, n)
	u.sizes = make([]int, n)
	for i := 0; i < n; i++ {
		u.par[i] = i
		u.rank[i] = 0
		u.sizes[i] = 1
	}
	return u
}

func (u UnionFind) unite(x, y int) {
	x = u.root(x)
	y = u.root(y)
	if x == y {
		return
	}

	if u.rank[x] < u.rank[y] {
		u.par[x] = y
		u.sizes[y] += u.sizes[x]
	} else {
		u.par[y] = x
		u.sizes[x] += u.sizes[y]
		if u.rank[x] == u.rank[y] {
			u.rank[x]++
		}
	}
}

func (u UnionFind) root(x int) int {
	if u.par[x] == x {
		return x
	}
	u.par[x] = u.root(u.par[x])
	return u.par[x]
}

func (u UnionFind) same(x, y int) bool {
	return u.root(x) == u.root(y)
}

func (u UnionFind) size(x int) int {
	return u.sizes[u.root(x)]
}


Measured memory_bytes: 9548
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

const int VMAX=100010;
int V,E,start,goal;
vector<pair<long long,int>> edge[VMAX];
long long dist[VMAX];
bool used[VMAX];

void dijkstra(){
    // 距離をINFで初期化
    rep(to,VMAX) dist[to]=LINF;
    // 始点は0
    dist[start]=0;
    // フラグを下げる
    rep(v,VMAX) used[v]=false;
    // 優先度付きキュー:[距離,頂点]←距離の昇順
    priority_queue<pair<long long,int>,vector<pair<long long,int>>,greater<pair<long long,int>>> q;
    // 距離0,始点
    q.push({0,start});
    // dijkstra
    while(q.size()){
        // 取り出してd=距離,v=頂点
        pair<long long,int> p=q.top(); q.pop();
        long long d=p.first,v=p.second;
        if(used[v]) continue;
        used[v]=true;
        // 頂点から出る辺すべてについて
        for(auto vv:edge[v]){
            long long cost=vv.first,to=vv.second;
            // 辺が存在して短縮できるとき
            if(d+cost<dist[to]){
                dist[to]=d+cost;
                q.push({dist[to],to});
            }
        }
    }
}

int main(){
    cin>>V;
    E=V-1;
    rep(i,E){
        int from,to,distance;
        cin>>from>>to>>distance;
        edge[from].push_back({distance,to});
        edge[to].push_back({distance,from});
    }
    int q;
    cin>>q>>start;
    dijkstra();
    rep(i,q){
        int x,y; cin>>x>>y;
        cout<<dist[x]+dist[y]<<endl;
    }
    return 0;
}


Measured memory_bytes: 11248
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int count(vector<long long>::iterator begin, vector<long long>::iterator end,
          long long val) {
  if (end == begin)
    return 0;
  auto it = lower_bound(begin, end, val);
  return end - it;
}

int main() {
  int n;
  long long l1 = 1, l2 = 2;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++)
    cin >> b[i];

  long long ans = 0;
  for (int k = 29; k >= 0; k--) {
    for (int i = 0; i < n; i++) {
      if (a[i] >= (2 << k))
        a[i] -= (2 << k);
      if (b[i] >= (2 << k))
        b[i] -= (2 << k);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    long long c = 0;
    for (int i = 0; i < n; i++) {
      if ((a[i] & (1 << k)) > 0) {
        auto en = lower_bound(b.begin(), b.end(), l1 << k);
        c += (en - b.begin()) - count(b.begin(), en, (l2 << k) - a[i]);
        c += count(en, b.end(), ((l1 << k) | (l2 << k)) - a[i]);
      } else {
        auto en = lower_bound(b.begin(), b.end(), l1 << k);
        c += count(b.begin(), en, (l1 << k) - a[i]);
        c += (b.end() - en) - count(en, b.end(), (l2 << k) - a[i]);
      }
    }
    if (c % 2 == 1)
      ans |= (l1 << k);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
using namespace std;
long long const mod = 1000000007;
long long mod_fact(int x){
    static vector<long long> fact = {1, 1};
    if(x < 0)return 0; //
    if(x < fact.size())return fact[x];
    for(int i = fact.size(); i <= x; i++){
        fact.push_back((fact[i-1] * i) % mod);
    }
    return fact[x];
}

long long mod_pow(long long a, long long b){
    long long res = 1;
    a %= mod;
    while(b > 0){
        if(b%2 == 1) res = (res * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return res;
}

long long mod_div(long long a){
    return mod_pow(a, mod-2);
}

long long mod_comb(int a, int b){
    if(b < 0 || a < b)return 0;
    if(b > a/2)return mod_comb(a, a-b);
    return (((mod_fact(a) * mod_div(mod_fact(a-b))) % mod) * mod_div(mod_fact(b))) % mod;
}

long long func(int a, int b){
    return mod_fact(a*b) * mod_pow(mod_div(mod_fact(a)), b) % mod * mod_div(mod_fact(b)) % mod;
}

vector< vector<long long> > dp;

int main(void){
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    dp.assign(2, vector<long long>());
    for(int i=0;i<2;i++){
        dp[i].assign(n+1, 0);
    }

    for(int k=c;k<=d&&k*a <= n;k++){
        dp[a%2][k*a] = mod_comb(n, k*a) * func(a, k) % mod;
    }
    dp[0][0] = dp[1][0] = 1;
    for(int i=a+1;i<=b;i++){
        int ia = i%2, ib = (i+1)%2;
        for(int j=1;j<=n;j++){
            dp[ia][j] = dp[ib][j];

            for(int k=c;k<=d && j - i*k >= 0;k++){
                dp[ia][j] += dp[ib][j - i*k] * mod_comb(n-j+i*k, i*k) % mod * func(i, k) % mod;
                dp[ia][j] %= mod;
            }
        }
    }
    cout << dp[b%2][n] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A,B,counter=0,val=1;
    cin>>A;cin>>B;
    if(A==B)
        cout<<1<<endl;
    else if(val<B)
    {
        while(1)
        {
            if(val<B)
            {
                val+=A-1;
                counter+=1;
            }
            else
                break;
        }
        cout<<counter<<endl;
    }
    else
        cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
/*
 * 2303.cc: Marathon Match
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;
const int MAX_M = 50;

typedef long long ll;

/* typedef */

struct Stat {
  double t, p;
  int i, j;
  Stat() {}
  Stat(double _t, double _p, int _i, int _j): t(_t), p(_p), i(_i), j(_j) {}
  bool operator<(const Stat &s) const { return t < s.t; }
};

typedef vector<Stat> vs;

/* global variables */

ll combs[MAX_M + 1][MAX_M + 1];
Stat rs[MAX_N][MAX_M + 1];
double psums[MAX_N][MAX_M + 2], ans[MAX_N];
int cs[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i <= m; i++) {
    combs[i][0] = combs[i][i] = 1;
    for (int j = 1; j < i; j++)
      combs[i][j] = combs[i - 1][j - 1] + combs[i - 1][j];
  }

  vs allrs;
  
  for (int i = 0; i < n; i++) {
    int pi, ti, vi;
    cin >> pi >> ti >> vi;

    double p = (double)pi / 100;
    double t0 = (double)l / vi;
    for (int j = 0; j <= m; j++) {
      double tj = t0 + ti * j;
      double pj = combs[m][j] * pow(p, j) * pow(1.0 - p, m - j);
      rs[i][j] = Stat(tj, pj, i, j);
      allrs.push_back(rs[i][j]);
    }
    psums[i][m + 1] = 0.0;
    for (int j = m; j >= 0; j--) psums[i][j] = psums[i][j + 1] + rs[i][j].p;
    //printf("%d: %lf\n", i, psums[i][0]);
  }

  sort(allrs.begin(), allrs.end());
  int rn = allrs.size();

  for (int i = 0; i < n; i++) ans[i] = 0.0, cs[i] = 0;

  for (int i = 0; i < rn; i++) {
    Stat &r = allrs[i];
    double pp = r.p;

    for (int j = 0; j < n; j++)
      if (r.i != j) {
	int cj = cs[j];
	if (cj <= m && rs[j][cj].t == r.t) cj++;
	pp *= psums[j][cj];
      }

    ans[r.i] += pp;
    cs[r.i]++;
  }

  for (int i = 0; i < n; i++) printf("%.8lf\n", ans[i]);
  return 0;
}

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

ll INF = (ll)pow(10, 16);

int main(){
  ll N, M;
  cin >> N >> M;
  vvl abc(M, vl(3));
  rep(i, M){
    cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
    abc[i][2] = -abc[i][2];
  }

  vl dist(N + 1, INF);
  dist[0] = dist[1] = 0;

  rep(i, N - 1){
    rep(j, M){
      if(dist[abc[j][0]] == INF) continue;
      
      if(dist[abc[j][1]] > dist[abc[j][0]] + abc[j][2]){
		dist[abc[j][1]] = dist[abc[j][0]] + abc[j][2];
      }
    }
  }

  ll ans = -dist[N];

  vector<bool> neg(N + 1, false);

  rep(i, N){
    rep(j, M){
      if(dist[abc[j][0]] == INF) continue;

      if(dist[abc[j][1]] > dist[abc[j][0]] + abc[j][2]){
		dist[abc[j][1]] = dist[abc[j][0]] + abc[j][2];
		neg[abc[j][1]] = true;
      }

      if(neg[abc[j][0]] == true){
		neg[abc[j][1]] = true;
      }
    }
  }

  if(neg[N])
    cout << "inf" << endl;
  else
    cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int x,a,b;
	scanf("%d %d %d",&x,&a,&b);
	if(x>a){
		a=x-a;
	}
	else{
		a=a-x;
	}
	if(x>b){
		b=x-b;
	}
	else{
		b=b-x;
	}
	if(a>b){
		printf("B\n");
	}
	else{
		printf("A\n");
	}
	return 0;
}

Measured memory_bytes: 128
s = input()
s_list = list(s)
n = len(s_list)
s_r = str(''.join(reversed(s_list)))
s_f = ''.join(s_list[:int((n-1)/2)])
s_b = ''.join(s_list[int((n+3)/2-1):])
if (s == s_r) and (s_f == s_b):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
S = input()
P =2019
ans = 0

count = [0] * P
count[0] = 1
u = 0
for i, s in enumerate(reversed(S)):
    u = (int(s) * pow(10, i, P) + u) % P
    ans += count[u]
    count[u] += 1
print(ans)

Measured memory_bytes: 9188
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long ll;
const int maxn = 100000 + 10;
 
int n, m, ecnt, h[maxn], col[maxn];
ll cnt[5];
struct enode{
  int v, n, w;
  enode() {}
  enode(int _v, int _n, int _w):v(_v), n(_n), w(_w) {}
}e[maxn << 1];
 
inline void addedge(int u, int v, int w) {
  ecnt ++; e[ecnt] = enode(v,h[u],w); h[u] = ecnt;
}
 
int flag = 0;
void dfs(int u) {
  cnt[col[u]] ++;
  for(int i = h[u];~ i;i = e[i].n) {
    if(e[i].w == 1) cnt[3] ++;
    int v = e[i].v, tmp = (col[u] + e[i].w) % 3;
    if(col[v] == -1) {
      col[v] = tmp;
      dfs(v);
    }
    else if(col[v] != tmp) flag = 1;
  }
}
 
int main() {
  scanf("%d%d", &n, &m); ecnt = 0;
  memset(h,-1,sizeof(h));
  for(int i = 1;i <= m;i ++) {
    int u, v;
    scanf("%d%d", &u, &v);
    addedge(u,v,1);
    addedge(v,u,2);
  }
  ll ans = 0;
  memset(col,-1,sizeof(col));
  for(int i = 1;i <= n;i ++) {
    if(~ col[i]) continue;
    cnt[0] = cnt[1] = cnt[2] = cnt[3] = 0;
    col[i] = 0;
    flag = 0;
    dfs(i);
    if(flag) {
      ll tmp = cnt[0] + cnt[1] + cnt[2];
      ans = ans + 1LL * tmp * tmp;
      continue;
    }
    if(cnt[0] && cnt[1] && cnt[2]) {
      ans = ans + cnt[0] * cnt[1] + cnt[1] * cnt[2] + cnt[2] * cnt[0];
      continue;
    }
    // printf("--------%lld\n", cnt[3]);
    ans = ans + cnt[3];
  }
  printf("%lld\n", ans);
  return 0;
}


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





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

    long long int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;


    cin>>x>>n;
    set <long long int> st;
    for(i=0;i<n;i++)
    {
        cin>>b;
       st.insert(b);
    }

    k=0;
    while(1)
    {
        //cout<<k<<" "<<x-k<<" "<<x+k<<"\n";
        if(st.find(x-k)==st.end())
        {
            cout<<x-k<<"\n";
            return 0;
        }
        if(st.find(x+k)==st.end())
        {
            cout<<x+k<<"\n";
            return 0;
        }

        k++;
    }



    return 0;


}


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

int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    string k, s, t; cin >> k >> s >> t;
    cout << 'A' << s[0] << 'C' << '\n';
  
    return 0;
}



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

int main() {
    int sx, sy, x, y; cin >> sx >> sy >> x >> y;
    x -= sx;
    y -= sy;
    for (int i = 0; i < y; i++) cout << "U";
    for (int i = 0; i < x; i++) cout << "R";
    for (int i = 0; i < y; i++) cout << "D";
    for (int i = 0; i <= x; i++) cout << "L";
    for (int i = 0; i <= y; i++) cout << "U";
    for (int i = 0; i <= x; i++) cout << "R";
    cout << "D";
    cout << "R";
    for (int i = 0; i <= y; i++) cout << "D";
    for (int i = 0; i <= x; i++) cout << "L";
    cout << "U";
    cout  << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
q = int(input())
ans = sum(a)
a_list = [0]*(10**5)
for i in a:
    a_list[i-1] += 1

for j in range(q):
    b,c = map(int,input().split())
    a_list[c-1] += a_list[b - 1]
    ans += (c - b) * a_list[b -1]
    a_list[b-1]=0
    print(ans)

Measured memory_bytes: 84496
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,l,r,mark[100002]={0},i;
    cin>>n;
    for (i=0;i<n;i++)
    {
        cin>>l>>r;
        mark[l]++;
        mark[r+1]--;
    }
    int ans=0;
    for (i=1;i<=100000;i++)
    {
        mark[i]+=mark[i-1];
        if (mark[i]>0)
            ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
#include<stack>
#include<algorithm>
#include<list>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;
int keta(int N){
	int n=N;
	int sum=0;
	for(;;){
		sum+=n%10;
		n=n/10;
		if(n==0)
			break;
	}
	return sum;
}
int main(){
	int N,A,B;
	int sum=0;
	scanf("%d %d %d",&N,&A,&B);
	for(int i=1;i<=N;i++){
		if(keta(i)>=A&&keta(i)<=B)
			sum+=i;
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(){
    int n;
    scanf("%d",&n);
    if(n % 10 == 7 || n / 100 == 7 || (n % 100 - n % 10) == 70){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 1736
import sys

def main():
    input = sys.stdin.readline
    MOD = 10**9 + 7
    N, M = map(int, input().split())
    A = [int(input()) for _ in range(M)]
    is_safe = [True] * (N+2)
    for a in A:
        is_safe[a+1] = False

    dp = [0] * (N+2)
    dp[1] = 1
    for i in range(2, N+2):
        if is_safe[i]:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= MOD
        else:
            dp[i] = 0

    return dp[N+1]


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


Measured memory_bytes: 8616
N = int(input())
A = list(map(int, input().split()))
ans = "APPROVED"
for i in range(N):
  if A[i] % 2 == 0:
    if (A[i] % 3 != 0) and (A[i] % 5 != 0):
      ans = "DENIED"
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void) {
    ll r, d, x1, x2;
    scanf("%lld %lld %lld", &r, &d, &x1);
    for (int i = 0; i < 10; i++) {
        printf("%lld\n", x2 = r * x1 - d);
        x1 = x2;
    }

    return 0;
}

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

int n,k,d,a,arr[101],sum;

int main(){
	cin>>n>>k;
	for(int i = 1;i <= k;i ++){
		cin>>d;
		for(int j = 1;j <= d;j++){
			cin>>a;
			arr[a]++;
		}
	}
	for(int i = 1;i <= n;i++){
		if(arr[i] == 0){
			sum++;
		}
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 3632
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {
	int A, B, C;
	cin >> A >> B >> C;

	
	long long tempA, tempB, tempC;
	int ans = 0;
	while (true) {
		if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
			break;
		}
		if (A == B && B == C) {
			ANS(-1);
			return 0;
		}
		tempA = (B + C) / 2;
		tempB = (A + C) / 2;
		tempC = (A + B) / 2;

		A = tempA;
		B = tempB;
		C = tempC;
		ans++;
	}
	ANS(ans);
	return 0;
}


Measured memory_bytes: 256
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

diffs = []
for i in range(len(X) - 1):
    left, right = X[i], X[i + 1]
    diffs.append(right - left)
costs = []
for diff in diffs:
    costs.append(min(diff * A, B))
print(sum(costs))


Measured memory_bytes: 14228
#-*- coding: utf-8 -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""
from collections import defaultdict
import sys
import math



def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    return gcd(b, a % b)

def sol(a, b, k):
    D = []
    for i in range(1, min(a, b)+1):
        if a % i == 0 and b % i == 0:
            D.append(i)
    D.reverse()
    return D[k-1]



do_submit = True
#do_submit = False
def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(int, line.split())) for line in lines]
    a, b, c = parsed_lines[0]
    return a, b, c


if not do_submit:
    a, b, c = input_parse("""
    8 12 2
    """)
    print(sol(a, b, c))
    a, b, c = input_parse("""
    100 50 4
    """)
    print(sol(a, b, c))
    a, b, c = input_parse("""
    1 1 1
    """)
    print(sol(a, b, c))
else:
    a, b, k = list(map(int, input().split()))
    print(sol(a, b, k))
    # S = []
    # for i in len(n):
    #     S.append(int(input().strip()))
    #print(sol(n, a, b, c, S))



Measured memory_bytes: 3316
N, K = map(int, input().split())

def f(x):
    return( N-x*K )

def test(x):
    return( f(x) >= 0 )

left = - 1        # return = right = (取り得る値の最小値) の可能性を排除しないために、-1 が必要
right = 10**18

while right - left > 1:             # 最終的に (right, left, mid) = (最小値, 最小値 - 1, 最小値 - 1) に収束するため、差が 1 になったときに終了すればよい
    mid = (left+right)//2
    if test(mid):
        left = mid
    else:
        right = mid
print(min(abs(N-left*K), abs(N-right*K)))

Measured memory_bytes: 61980
n,m,x,y = map(int,input().split())

lsx = list(map(int,input().split()))
lsx.append(x)
lsy = list(map(int,input().split()))
lsy.append(y)

if min(lsy) - max(lsx) > 0:
    print("No War")
else:
    print("War")


Measured memory_bytes: 38256