akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
using std::string;
using std::cin;
using std::cout;
using std::endl;
typedef long long ll;
using std::vector;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////



//////////////////////////////////////

int main() {
    
    string S;
    cin >> S;
    
    int n = (int) S.length();
    
    //2文字までで区切ればいい
    //...aaaの場合、...|aa|aと...|a|aa|で区切る２パターン存在
    //後者の比較不要な区切り方で終わる場合のスコアをdp2に保存
    
    vector<int> dp1(n+1), dp2(n+1);
    dp1[0] = 0;
    dp2[0] = 0;
    dp1[1] = 1;
    dp2[1] = 0;
    for (int next = 2; next <= n; next++) {
        if (S[next-1] != S[next-1-1]) {
            dp1[next] = dp1[next-1] + 1;
        }
        dp1[next] = std::max(dp1[next], dp2[next-1]+1);
        //...xyz+w: ...y|zw|
        //...aaaa+a: ...aa|a|aa
        dp2[next] = dp1[next-2] + 1;
    }
    /*
    for (int i = 1; i <= n; i++) {
        cout << i << ": " << dp1[i] << ", " << dp2[i] << endl;
    }
     */
    
    cout << std::max(dp1[n], dp2[n]) << endl;
    
    return 0;
}


Measured memory_bytes: 2180
#include <stdio.h>

#include <iostream>
#include <string>

int main()
{
	std::string S, T;
	std::cin >> S >> T;

	int64_t c = 0;
	for (size_t i = 0; i < S.length(); ++i)
	{
		if (S.at(i) != T.at(i)) {
			++c;
		}
	}
	std::cout << c << std::endl;
	return 0;
}


Measured memory_bytes: 3868
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<string>
#include<cmath>
#include<cassert>
#include<cstdint>
//#include<>
using namespace std;

typedef int64_t i64;typedef int32_t i32;
typedef int16_t i16;typedef int8_t i8;
typedef uint64_t ui64;typedef uint32_t ui32;
typedef uint16_t ui16;typedef uint8_t ui8;

typedef i64 int__;
#define rep(i,j) for(int__ i=0;i<j;i++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);i++)
#define all(v) begin(v),end(v)

const i32 INF=1<<30;//10E10

int main()
{
  while(true){
    string s;
    cin>>s;
    if(s==".")break;

    string tmp="";
    int cntr=0;
    for(auto ch : s){
      if(ch=='['||ch==']')tmp+=ch;
      else if(ch=='+')cntr++;
      else if(ch=='-')cntr--;
      else if(ch=='?'){
	cntr=0;
	tmp+='A';
      }
      else{
	int chi=ch-'A';
	while(cntr<0)cntr+=26;
	chi=(chi+cntr )% 26;
	tmp+=chi+'A';
	cntr=0;
      }
    }
    
    stack<int> stk;
    // [ ] 対応
    rep(i,tmp.size()){
      if(tmp[i]=='[')stk.push(i);
      else if(tmp[i]==']'){
	int beg=stk.top();stk.pop();
	reverse(&tmp[beg]+1,&tmp[i]);
      }
    }

    string ans="";
    for(auto ch : tmp){
      if(ch=='['||ch==']')continue;
      ans+=ch;
    }
    
    cout<<ans<<endl;
  }

  return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
using namespace std;
string s;
int ss;
int l,res,ans=1e9;
int main()
{
	cin>>s;
	int l=s.size();
	for(char i='a';i<='z';i++)
	{
		string st=s;
		for(int j=l;j>=0;j--)
		{
			ss=0;
			for(int k=0;k<j;k++)
			{
				if(st[k]==i)ss++;
				if(k+1<l && st[k+1]==i)st[k]=i;
			}
			if(ss==j)
			{
				ans=min(ans,l-j);break;
			}
		}
	}
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;
const ll MOD = 1000000007;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


ll mpow(ll x, ll n){//繰り返し二乗法 計算量O(logN)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans * x % MOD;
        x = x * x % MOD;
        n  = n >> 1;
    }
    return ans;
}

int gcd(int a, int b){
    if(a % b == 0) return b;
    else return (gcd(b, a%b));
}


int main(){
    string S;
    cin >> S;
    int n = S.length();
    int N = n / 2 - 1;
    int ans = 0;
    for(int i = 0; i <= N; i++){
        if(S[i] != S[n - i - 1]) ans++;
    }
    cout << ans << endl;
}

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

// ユークリッドで最大公約数を求める
ll gcd(ll x, ll y){
    return y ? gcd(y, x%y) : x;
}

int main(){
    ll a, b, gcdNum, lcmNum;
    cin >> a >> b;
    gcdNum = gcd(a, b);
    lcmNum = a * b /gcdNum;
    cout << lcmNum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

const int N_MAX = 100005;
int n;
ll a[N_MAX], b[N_MAX], ans; 
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    rep(i, 0, n) {
        cin >> a[i] >> b[i];
    }
    eper(i, n-1, 0) {
        a[i] += ans;
        if (a[i]%b[i]) {
            ans += b[i] - (a[i]%b[i]);
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n;
vector<P> vec, vec2;
int k;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		int mi = 0, cnt = 0;
		for (int i = 0; i < (int)s.size(); i++) {
			if (s[i] == '(')cnt++;
			else cnt--;
			mi = min(mi, cnt);
		}
		k += cnt;
		if (0 < cnt)vec.push_back(make_pair(mi, cnt));
		else vec2.push_back(make_pair(cnt - mi, cnt));
	}
	if (k != 0) {
		cout << "No" << endl;
		return 0;
	}
	sort(all(vec));
	reverse(all(vec));
	sort(all(vec2));
	reverse(all(vec2));
	for (int i = 0; i < (int)vec.size(); i++) {
		if (k + vec[i].first < 0) {
			cout << "No" << endl;
			return 0;
		}
		k += vec[i].second;
	}
	for (int i = 0; i < (int)vec2.size(); i++) {
		vec2[i].first = vec2[i].second - vec2[i].first;
		if (k + vec2[i].first < 0) {
			cout << "No" << endl;
			return 0;
		}
		k += vec2[i].second;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 18932
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

	char *str = new char[n];
	REP(i,n)
		cin >> str[i];

	int *cnt_white = new int[n+1];
	cnt_white[n] = 0;
	REPR(i, n-1){
		if(str[i] == '#')
			cnt_white[i] = cnt_white[i+1];
		else
			cnt_white[i] = cnt_white[i+1] + 1;
	}

	int *cnt_black = new int[n+1];
	cnt_black[0] = 0;
	FOR(i, 1, n+1){
		if(str[i-1] == '.')
			cnt_black[i] = cnt_black[i-1];
		else
			cnt_black[i] = cnt_black[i-1] + 1;
	}

	int res = INF;
	REP(i, n+1){
		res = min(res, cnt_white[i] + cnt_black[i]);
	}
	
	cout << res << '\n';
 
	delete[] cnt_black;
	delete[] cnt_white;
	delete[] str;
	return 0;
}

Measured memory_bytes: 2048
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
using namespace std;

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u,int k){
    while(u!=NIL && k!=u->key){
        if(k<u->key)u=u->left;
        else u=u->right;
    }
    return u;
}
void insert(int k){
    Node *y=NIL;
    Node *x=root;
    Node *z;
    
    z=(Node *)malloc(sizeof(Node));
    z->key=k;
    z->left=NIL;
    z->right=NIL;
    
    while(x!=NIL){
        y=x;
        if(z->key<x->key){
            x=x->left;
        }
        else{
            x=x->right;
        }
    }
    z->parent=y;
    if(y==NIL){
        root=z;
    }else{
        if(z->key<y->key){
            y->left=z;
        }else{
            y->right=z;
        }
    }
    
}

void preorder(Node *u){
    if (u==NIL) return;
    cout<<" "<<u->key;
    preorder(u->left);
    preorder(u->right);
}

void inorder(Node *u){
    if (u==NIL) return;
    inorder(u->left);
    cout<<" "<<u->key;
    inorder(u->right);
}

int main(){
    int n,i,x;
    string com;

    cin>>n;
    for(i=0;i<n;i++){
        cin>>com;
        if(com[0]=='f'){
            cin>>x;
            Node *t=find(root,x);
            if(t!=NIL) cout<<"yes"<<endl;
            else cout<<"no"<<endl;
        }
        else if(com=="insert"){
            cin>>x;
            insert(x);
        }else if(com=="print"){
            inorder(root);
            cout<<endl;
            preorder(root);
            cout<<endl;
        }
    }
    
}


Measured memory_bytes: 21872
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll n;
double a[55];
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	double memo = a[0];
	rep(i, n - 1) {
		memo = (memo + a[i + 1]) / 2;
	}
	cout << memo << endl;
	ggr
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll a,b;
  cin >> a >> b;
  if(a>0 && b>0)
    cout << "Positive" << endl;
  else if(a<=0 && b>=0)
    cout << "Zero" << endl;
  else{
    if((b-a+1)%2==0)
      cout << "Positive" << endl;
    else
      cout << "Negative" << endl;
  }

}


Measured memory_bytes: 256
ans = []
while True:
    m,f,r = map(int,input().split())
    x = m+f
    if m==-1 and f==-1 and r==-1:
        break
    
    if m==-1 or f==-1:
        ans.append('F')  
    elif x>=80:
        ans.append('A')
    elif x>=65 and x<80:
        ans.append('B')
    elif x>=50 and x<65 or r>=50:
        ans.append('C')
    elif x>=30 and x<50:
        ans.append('D')
    elif x<30:
        ans.append('F')
        
for i in range(len(ans)):
    print(ans[i])


Measured memory_bytes: 5600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>


using namespace std;

const int N = 100;

int n, a[N], b[N], c[N], sum;

int main () {
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	for(int i = 1; i <= n; ++i) {
		cin >> b[i];
	}
	for(int i = 1; i < n; ++i) {
		cin >> c[i];
	}
	for(int i = 1; i <= n; ++i) {
		sum += b[a[i]];
		if(a[i + 1] - a[i] == 1) sum += c[a[i]];
	}
	cout << sum;
	return 0;
}


Measured memory_bytes: 256
require 'pp'

# sumの追加
class Array
  define_method(:sum){self.inject(:+)} unless method_defined?(:sum)
end
# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end
# 入力値を文字の配列で返却する
def gets_nsp_list()
  gets.chomp.chars
end

def count_combi(n, k)
  k = n - k if 2 * k > n
  return 1 if k == 0
  ((n - k + 1)..n).inject(&:*) / ((1..k).inject(&:*))
end

N = gets_i
count_hash = Hash.new(0)
N.times do
  s = gets_nsp_list.sort.join
  count_hash[s] += 1
end
values = count_hash.values - [1]

if values.empty?
  puts 0
  exit
end

total = values.map do |c|
  count_combi(c, 2)
end.sum

puts total

Measured memory_bytes: 17916
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
const ll MOD=1000000007;
int V;
const int MAX_V=100000;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v){
    G[u].pb(v); G[v].pb(u);
}

bool dfs(int v){
    used[v]=true;
    for(int &to : G[v]){
        int w=match[to];
        if(w<0||!used[w]&&dfs(w)){
            match[v]=to;
            match[to]=v;
            return true;
        }
    }
    return false;
}

int bipartite_matching(){
    int res=0;
    memset(match, -1, sizeof(match));
    rep(v,0,V){
        if(match[v]<0){
            memset(used, 0, sizeof(used));
            if(dfs(v)){
                res++;
            }
        }
    }
    return res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>V;
    rep(i,0,V){
        int a,b;
        cin>>a>>b;
        add_edge(a-1, b-1);
    }
    int k=bipartite_matching();
    cout <<(k*2==V?"Second":"First")<<"\n";
}

Measured memory_bytes: 6272
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main()
{

    ll n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    a--; b--; c--; d--;
    bool atoc = true;
    bool btod = true;
    bool can = true;
    if(c<d){
        for(int i = a ; i < c; i++){
            if(s[i] == '#' && s[i+1] == '#'){
                atoc = false;
            }
        }
        for(int i = b; i < d; i++){
            if(s[i] == '#' && s[i+1] == '#'){
                btod = false;
            }
        }
        if(atoc == false || btod == false){
            can = false;
        }
    }else{
       for(int i = a ; i < c; i++){
            if(s[i] == '#' && s[i+1] == '#'){
                atoc = false;
            }
        }
        for(int i = b; i < d; i++){
            if(s[i] == '#' && s[i+1] == '#'){
                btod = false;
            }
        }
        if(atoc == false || btod == false){
            can = false;
        }
        bool notex = true;
        for(int i = b; i <= d; i++){
            if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
                notex = false;
            }
        }
        if(notex) can = false;
    }
    if(can){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


Measured memory_bytes: 640
h,w = map(int,input().split())
s = [input() for _ in range(h)]
dx = [-1, 0, 1, -1, 1, -1, 0, 1]
dy = [-1, -1, -1, 0, 0, 1, 1, 1]
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            print('#', end='')
        else:
            cnt = 0
            for k in range(8):
                if i+dx[k] < 0 or i+dx[k] > h-1:
                    continue
                if j+dy[k] < 0 or j+dy[k] > w-1:
                    continue
                if s[i+dx[k]][j+dy[k]] == '#':
                    cnt += 1
            print(cnt, end='')
    print()


Measured memory_bytes: 3444
// SeeAlso: https://atcoder.jp/contests/abc124/tasks/abc124_a

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <limits>

#define MAX 4

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

using namespace std;

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

    int ans = 0;

    REP(i, 2) {
        ans += max(A, B);
        if (A > B) {
            A--;
        } else {
            B--;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long int n;
	scanf("%lld", &n);
	if (n % 2 > 0)
		printf("0\n");
	else
	{
		long long int res = n / 10;
		n /= 10;
		while (n > 4)
		{
			res += n / 5;
			n /= 5;
		}
		printf("%lld\n", res);
	}
	return 0;
}

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

#define INF 1e+9
#define MAX_V 100000

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
vector<edge> G2[MAX_V];
int d[MAX_V];
int d2[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

void dijkstra2(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d2, d2+V, INF);
    d2[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d2[v] < p.first) continue;

        for (int i=0; i<G2[v].size(); ++i) {
            edge e = G2[v][i];
            if (d2[e.to] > d2[v] + e.cost) {
                d2[e.to] = d2[v] + e.cost;
                que.push(P(d2[e.to], e.to));
            }
        }
    }
}

int main(){
    int taka, ao;
    cin >> V >> taka >> ao;
    taka--; ao--;
    for(int i = 0; i < V - 1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        edge e = {b, 1};
        edge f = {a, 1};
        G[a].push_back(e);
        G[b].push_back(f);
        edge e2 = {b, 1};
        edge f2 = {a, 1};
        G2[a].push_back(e2);
        G2[b].push_back(f2);
    }
    dijkstra(taka);
    dijkstra2(ao);

    int ans = 0;

    for(int i = 0; i < V; i++){
        //cout << i << " " << d[i] << " " << d2[i] << "\n";
        if(d[i] < d2[i]){
            ans = max(ans, d2[i] - 1);
        }
    }
    ans = max(ans, d[ao]/2);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 13464
#include <iostream>
#include <vector>
#include <map>

using namespace std;


int dp[10000];
int inf = 1<<30;

int main() {
  int n, m; cin >> n >> m;
  for (int i = 0; i < (1<<n); ++i) { 
    dp[i] = inf;
  }
  dp[0] = 0;
  for (int i = 0; i < m; ++i) { 
    int a, b; cin >> a >> b;
    int mask = 0;
    for (int j = 0; j < b; ++j) {
      int c; cin >> c; --c;
      mask |= (1<<c);
    }
    for (int j = 0; j < (1<<n); ++j) { 
      dp[j|mask] = min(dp[j|mask], dp[j]+a);
    }
  }
  if (dp[(1<<n)-1] == inf) cout << -1 << endl;
  else cout << dp[(1<<n)-1] << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i, n) for(int i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(int i = 0; i < n; i += k)



int main() {
    int n;
    map<string, int> m;
    
    cin >> n;
    REP(i, n){
        string s;
        cin >> s;
        m[s]++;
    }
    cin >> n;
    REP(i, n){
        string t;
        cin >> t;
        m[t]--;
    }
    
    int ans = 0;
    for(auto x : m){
        ans = max(ans, x.second);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
def main():
    n, target = map(int, input().split())
    count = {}
    numbers = list(map(int, input().split()))
    for num in numbers:
        if num in count:
            count[num] += 1
        else:
            count[num] = 1
    count = sorted(count.values())
    print(sum(count[:-target]) if len(count) > target else 0)


if __name__ == '__main__':
    main()

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

int main() {
int n;
 cin>>n;
 vector<int> p(n),q(n);
 rep(i,n) cin>>p[i];
 rep(i,n) cin>>q[i];
  /////////////////
  vector<int> ord(n);
  rep(i,n) {
    ord[i]=i;
    ord[i]++;
  }
  int ans;
  bool pb=false,qb=false;
  int pc=0,qc=0;
  do{
    bool g=true;
    rep(i,n){
      
      if(p[i]==ord[i]){}
      else g=false;
    }
    if(g) pb=true;  
    bool w=true;
    rep(i,n){
      
      if(q[i]==ord[i]){}
      else w=false;
    }
    if(w) qb=true;
    
    if(pb) pc++;
    if(qb) qc++;
    
  }while(next_permutation(all(ord)));
  
  ans=pc-qc;
  cout<<abs(ans)<<endl;
}

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

using namespace std;
long long a[100008],dp[100009],n,k;
long long sol(int x)
{
    if (x==n-1) return 0;
    if (dp[x]!=-1) return dp[x];
    dp[x]=99999999999999;
    for (int i=1;i+x<=n-1 && i<=k;i++)
    {
        dp[x]=min(dp[x],abs(a[x]-a[x+i])+sol(x+i));
    }
   return dp[x];
}
int main()
{
    cin>>n>>k;
    memset(dp,-1,sizeof(dp));
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    cout<<sol(0);
    return 0;
}


Measured memory_bytes: 6528
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    int N; cin >> N;
    vi A(N - 1), B(N - 1);
    REP(i,N-1) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }

    vvi es(N);
    REP(i,N-1) {
        es[A[i]].push_back(B[i]);
        es[B[i]].push_back(A[i]);
    }

    queue<int> qf;
    qf.push(0);
    vb vf(N, false);
    vi df(N, INF);
    df[0] = 0;
    while(!qf.empty()) {
        int x = qf.front(); qf.pop();
        vf[x] = true;
        for(int nx : es[x]) {
            if (vf[nx]) continue;

            df[nx] = min(df[nx], df[x] + 1);
            qf.push(nx);
        }
    }

    queue<int> qs;
    qs.push(N-1);
    vb vs(N, false);
    vi ds(N, INF);
    ds[N-1] = 0;
    while(!qs.empty()) {
        int x = qs.front(); qs.pop();
        vs[x] = true;
        for(int nx : es[x]) {
            if (vs[nx]) continue;

            ds[nx] = min(ds[nx], ds[x] + 1);
            qs.push(nx);
        }
    }

    int cf = 0, cs = 0;
    REP(i,N) {
        if (df[i] <= ds[i]) cf++;
        else cs++;
    }

    string ans;
    if (cf > cs) ans = "Fennec";
    else ans = "Snuke";
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
long long int power(int a,int b)
{
    if(b==0)
        return 1;
    long long int k=power(a,b/2);
    if(b%2==0)
        return ((k%M)*(k%M))%M;
    else
        return ((k%M)*(k%M)*(a%M))%M;
}
long long int fact(long long int n)
{
    if(n==1 || n==0)
        return 1;
    else
        return ((n%M)*(fact(n-1)%M))%M;

}
int div(int n)
{  int c=0;
    for(int i=1;i<sqrt(n);i++)
    {
        if(n%i==0)
        {
          c++;
        }
    }
    c=c*2;
    if(pow(sqrt(n),2)==(sqrt(n)*sqrt(n)))
        c++;
    return  c;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     #ifndef ONLINE_JUDGE
 
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
 
   #endif
   string str;
   string s;
   cin>>str;
   for(int i=0;i<str.length();i+=2)
   {
    s+=str[i];
   }
   cout<<s;



 return 0;
}








Measured memory_bytes: 3680
package main

import (
	"fmt"
	"strings"
)

func rgb(a, b string) string {
	switch {
	case a != "R" && b != "R":
		return "R"
	case a != "G" && b != "G":
		return "G"
	case a != "B" && b != "B":
		return "B"
	}
	return ""
}

func main() {
	var n, cnt int
	var s, sk string
	fmt.Scan(&n)
	fmt.Scan(&s)
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			if s[i] == s[j] {
				continue
			}
			sk = rgb(string(s[i]), string(s[j]))
			cnt += strings.Count(string(s[j:]), sk)
			if 2*j-i < n && string(s[2*j-i]) == sk {
				cnt--
			}
		}
	}
	fmt.Println(cnt)
}


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

int main() {
  int A, B;
  cin >> A >> B;
  if (A % 2 == 0 || B % 2 == 0) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int A,B;
  cin>>A>>B;
  if(A<=9 && B<=9)cout<<A*B<<endl;
  else cout<<-1<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
	int a,s;
	cin>>a>>s;
	cout<<(a-1)*(s-1)<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N; std::cin >> N;
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    int a; std::cin >> a;
    while (a > 1 && a%2 == 0) {
      ++cnt;
      a /= 2;
    }
  }
  std::cout << cnt << std::endl;
}


Measured memory_bytes: 256
/**
*    author:  souzai32
*    created: 04.08.2020 01:42:29
**/

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

int main() {

    int n;
    cin >> n;
    vector<int> a(n),b(n);
    rep(i,n) cin >> a.at(i);
    rep(i,n) cin>> b.at(i);

    vector<int> c;
    long long point=0;
    int ans=0;
    rep(i,n){
        if(b.at(i)>a.at(i)){
            point+=b.at(i)-a.at(i);
            ans++;
        }
        else c.push_back(a.at(i)-b.at(i));
    }
    sort(c.begin(),c.end(),greater<>());
    //cout << point << endl;
    //cout << ans << endl;

    if(point>0){
        for(int i=0; i<c.size(); i++){
            point-=c.at(i);
            ans++;
            if(point<=0) break;
        }
    }
    

    if(point<=0) cout << ans << endl;
    else cout << -1 << endl;

    //cout << endl;
    //rep(i,c.size()) cout << c.at(i) << endl;

    return 0;
}

Measured memory_bytes: 4556
#include<stdio.h>
#include<stdlib.h>
int compare_int(const void *a,const void *b){
  return *(int*)a-*(int*)b;
}
int main(void){
  int a[3],i,c=1;
  scanf("%d%d%d",&a[0],&a[1],&a[2]);
  qsort(a,3,sizeof(int),compare_int);
  for(i=1;i<3;i++)
    if(a[i]!=a[i-1])
      c++;
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int ab(int x){
	if(x<0)return -x;
	return x;
}


int main(){
	int N,T,A,i;
	scanf("%d%d%d",&N,&T,&A);
	int H[N];
	for(i=0;i<N;i++)scanf("%d",&H[i]);
	T*=1000;
	A*=1000;
	int min=1000000000;
	int mini=-1;
	for(i=0;i<N;i++){
		H[i]=T-6*H[i];
		int dist=ab(A-H[i]);
		if(min>dist){
			min=dist;
			mini=i;
		}
	}
	printf("%d\n",mini+1);
	return 0;
}

Measured memory_bytes: 128
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007

class UnionFind:
    def __init__(self, n):
        # 負  : 根であることを示す。絶対値はランクを示す
        # 非負: 根でないことを示す。値は親を示す
        self.table = [-1] * n
        self.size = [1] * n
        self.group_num = n

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

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

    def get_size(self, x):
        r = self.root(x)
        return self.size[r]

    def union(self, x, y):
        r1 = self.root(x)
        r2 = self.root(y)
        if r1 == r2:
            return
        # ランクの取得
        d1 = self.table[r1]
        d2 = self.table[r2]
        if d1 <= d2:
            self.table[r2] = r1
            self.size[r1] += self.size[r2]
            if d1 == d2:
                self.table[r1] -= 1
        else:
            self.table[r1] = r2
            self.size[r2] += self.size[r1]
        self.group_num -= 1


n, m = LI()
P = LI()
uf = UnionFind(n)
for _ in range(m):
    x, y = LI()
    uf.union(x - 1, y - 1)



print(sum([bool(uf.is_same(P[i] - 1, i)) for i in range(n)]))


Measured memory_bytes: 99108
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	double d, a, ang = 90.0;
	double x = 0, y = 0;
	while(1){
		scanf("%lf,%lf", &d, &a);
		if(d == 0 && a == 0) break;
		x += d * cos(M_PI * ang / 180.0);
		y += d * sin(M_PI * ang / 180.0);
		ang -= a;
	}
	modf(x, &x);
	modf(y, &y);
	printf("%.0lf\n%.0lf\n", x, y);
	
	return 0;
}

Measured memory_bytes: 3440
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	static long bignum = 1000000000+7;

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int l = sc.nextInt();
		int r = sc.nextInt();
		int d = sc.nextInt();
		int ans = 0;
		
		for(int i =l;i<r+1;i++) {
			if(i%d==0)ans++;
		}
		System.out.println(ans);
	}

	static long yuclid(long a, long b) {
		long ans;
		if(a<b) {
			long aa = a;
			a=b;
			b=aa;
		}
		while(true) {
			if(b%a==0) {
				ans = a;
				break;
			}else {
				long aa =a;
				a= b%a;
				b=aa;
			}
		}
		return ans;
	}


	static long divn(int target, int times) {//10_9+7のあまり累乗版
		int sqtimes = (int)Math.sqrt(times);
		long ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans * target)%(bignum);
		}
		long holder = ans;
		ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans*holder)%(bignum);
		}
		for(int i=0;i<times - sqtimes*sqtimes;i++) {
			ans = (ans * target)%(bignum);
		}
		return ans;
	}

	static long div(long a) {//10_9+7のあまり
		if(a<0)a+=bignum;
		return a%(bignum);
	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


Measured memory_bytes: 35716
#include<stdio.h>
int main()
{
    long long int count=0;
    int array[100000],x,i,n;
    scanf("%d%d",&n,&x);
    for(i=0;i<n;i++)
    {
        scanf("%d",&array[i]);
    }
    for(i=0;i<n-1;i++)
    {
        if(array[i]+array[i+1]>x)
        {
            if(array[i]<=x)
            {
                count=count+array[i]+array[i+1]-x;
                array[i+1]=x-array[i];
            }
            else
            {
                count=count+array[i]+array[i+1]-x;
                array[i+1]=0;
                //array[i]=array[i]-x;
            }
        }
    }
    printf("%lld\n",count);
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

#define MAX 100005
#define NIL -1

typedef struct { int p, l, r;} Node;

Node T[MAX];
int n, D[MAX];

void print(int u) {
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if( T[u].p == NIL ) printf("root, ");
  else if( T[u].l == NIL ) printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for(i=0, c=T[u].l; c != NIL; i++, c=T[c].r) {
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void rec(int u, int p) {
  D[u] = p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main(void) {
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;
  for(i=0;i<n;i++) {
    scanf("%d %d",&v,&d);
    for(j=0;j<d;j++) {
      scanf("%d",&c);
      if(j==0) T[v].l=c;
      else T[l].r =c;
      l = c;
      T[c].p = v;
    }
  }
  for(i=0;i<n;i++) {
    if(T[i].p == NIL) r = i;
  }
  
  rec(r,0);
  
  for(i=0;i<n;i++) print(i);
  
  return 0;
}


Measured memory_bytes: 6480
#define ll long long
#define pi acos(-1.0)
#define Go "\n"
#define bye return 0
#define Afor(i,b) for(int i=0;i<b;i++)
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int R;
    cin>>R;
    cout<<fixed<<setprecision(4)<<2*pi*R<<Go;
    bye;
}


Measured memory_bytes: 3772
import sys


def input():
    return sys.stdin.readline().rstrip()



def main():
    N = int(input())

    dp = [0] * (N + 1)
    rt = int(N ** 0.5) + 1
    for i in range(1, rt):
        ii = i ** 2
        for j in range(1, i+1):
            iji = ii + j **2 + i * j

            if iji + 1 + i + j > N:
                break
            for k in range(1, j+1):
                case = iji + k**2 + i * k + j * k
                l =6
                if i == j or j == k:
                    l = 3
                    if i == k:
                        l = 1
                if case <= N:
                    dp[case] += l
                else:
                    break

    print(*dp[1:N + 1], sep="\n")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9404
// clang-format off
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr long long int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

// clang-format on
int main(){

    string s;
    cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7'){
    cout<<"Yes"<<endl;
    }else{
    cout<<"No"<<endl;}

    return 0;
}


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

Measured memory_bytes: 256
/**********************************************************************
   File hoge.cpp
   Author  harunaya
   Date   2020-04-28(Tue)
   note
**********************************************************************/

#include <bits/stdc++.h>
using namespace std;


int main() {
    int N, K;
    string S;
    cin >> N >> K;
    cin >> S;
    if (S.at(K-1) == 'A'){
        S.at(K-1) = 'a';
    }
    else if (S.at(K-1) == 'B') {
        S.at(K-1) = 'b';
    }
    else if (S.at(K-1) == 'C') {
        S.at(K-1) = 'c';
    }

    cout << S << endl;
}



Measured memory_bytes: 256
def popcount(x):
    x = (x & 0x5555555555555555) + (x >> 1  & 0x5555555555555555)
    x = (x & 0x3333333333333333) + (x >> 2  & 0x3333333333333333)
    x = (x & 0x0f0f0f0f0f0f0f0f) + (x >> 4  & 0x0f0f0f0f0f0f0f0f)
    x = (x & 0x00ff00ff00ff00ff) + (x >> 8  & 0x00ff00ff00ff00ff)
    x = (x & 0x0000ffff0000ffff) + (x >> 16 & 0x0000ffff0000ffff)
    x = (x & 0x00000000ffffffff) + (x >> 32 & 0x00000000ffffffff)
    return x
n = int(input())

testimonies = [[] * n for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        testimonies[i].append((x-1, y))

ans = 0
for bits in range(1, 1<<n):
    possible = True
    for i in range(n):
        if not bits >> i & 1:
            continue
        for x, y in testimonies[i]:
            if bits >> x & 1 != y: 
                possible = False
                break
        if not possible:
            break
    if possible:
        ans = max(ans, popcount(bits))
print(ans)

Measured memory_bytes: 73648
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef vector<int,vector<int>> vvec;
typedef long double ld;

//----***Like a Pythonista***----
#define REP(i,j,n) for (ll i=j;i<(n);i++)
#define RREP(i,n,j) for (ll i = n; j<i;i--)
#define each(i,...) for(auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(all(a)); }
template<class T> inline auto min(const T& a){ return *min_element(all(a)); }
inline ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
inline ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }

//----***定数***----
const int MOD=1000000007;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***----
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;


int X,Y,res=0;
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= MOD;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

signed main(){
  cin>>X>>Y;
  int x=0,y=0;
  while((X>0)&&(Y>0)){
    if(X>=Y){
      x++;
      X-=2;Y-=1;
    }
    else{
      y++;
      X-=1;Y-=2;
    }
  }
  if((X!=0)||(Y!=0)){
    print(0)
    return 0;
  }
  // int a = kai(x+y,x+y)%MOD;
  // int b = kai(x,x);
  // b =(mod_pow(b,MOD-2,MOD))%MOD;
  // int c = kai(y,y);
  // c =(mod_pow(c,MOD-2,MOD))%MOD;

  int ans=kai(x+y,x+y)*mod_pow(((kai(x,x)%MOD)*(kai(y,y)%MOD)%MOD),MOD-2,MOD);
  ans%=MOD;
  print((ans))

}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define ll long long
int main()
{
    ll n,i,j,k,l,m;
    cin>>n;
    map<ll,ll>mp;
    for(i=1;i<n;i++)
    {
        cin>>k;
        mp[k]++;
    }
    for(i=1;i<=n;i++)
    {
        cout<<mp[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 16132
#include<iostream>

using namespace std;

int main(void)
{
	int n,k;
	cin >> n >> k;
	int a[n];
	for(int i=1;i<=n;i++)
		cin >> a[i-1];

	cout << (n-1)/(k-1)+((n-1)%(k-1)==0 ? 0:1) << endl;
}

Measured memory_bytes: 640
def divisore(n):
  divisors=[]
  for i in range(1, int(n**0.5)+1):
    if n%i==0:
      divisors.append(i)
      if i!=n//i:
        divisors.append(n//i)
  return divisors

n=int(input())
l=divisore(n)

ans=0
for i in l:
  i-=1
  if i!=0 and n//i==n%i:
    ans+=i
print(ans)

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

int bubbleSort(int A[], int N) {
    int sw = 0;
    bool flag = 1;
    for (int i = 0; flag; i++) {
        flag = 0;
        for (int j = N-1; j >= i+1; j--) {
            if (A[j] < A[j-1]) {
                swap(A[j], A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}

int main() {
    int A[100], N, sw;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    sw = bubbleSort(A, N);

    for (int i = 0; i < N; i++){
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;

    return 0;
}


Measured memory_bytes: 3116
/* ************************************************************************
	> File Name: c.cpp
	> Author: caowushang
	> Mail: 15630929347@163.com 
	> Created Time: 2017年02月18日 星期六 20时13分28秒
 ************************************************************************/

#include<bits/stdc++.h>
using namespace std;
long long n,m;
int main()
{
	//freopen("in","r",stdin);
	//freopen("out","w",stdout);
	cin >> n >> m;
	if(m<2)
		cout << 0 << endl;
	else if(n*2>=m)
		cout << m/2 << endl;
	else
		cout << n+(m-2*n)/4 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int d;
	scanf("%d", &d);
	int c[30];
	int i;
	for (i = 0; i < 26; i++)
		scanf("%d", &c[i]);
	int j;
	int s[400][30];
	for (i = 0; i < d; i++)
		for (j = 0; j < 26; j++)
			scanf("%d", &s[i][j]);
	int t;
	int l[30];
	for (i = 0; i < 26; i++)
		l[i] = 0;
	int ans = 0;
	for (i = 0; i < d; i++)
	{
		scanf("%d", &t);
		t--;
		ans += s[i][t];
		l[t] = i + 1;
		for (j = 0; j < 26; j++)
			ans -= c[j] * (i + 1 - l[j]);
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1768
#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.at(i);
  string ans="";
  for(char i='a';i<='z';i++){
  int Min=50;
    for(int j=0;j<N;j++){
    int M=0;
      int n=A.at(j).size();
       
      for(int k=0;k<n;k++)
       if(A.at(j).at(k)==i)
         M++;
      
      if(M<Min) Min=M;
    } for(int l=0;l<Min;l++)
      ans+=i;
  
  }cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256