akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = 1e18+7;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int n = s.size();
    rep(i,0,n){
        rep(j,0,n){
            if(i+j<n){
                string a = s.substr(0,i+1) + s.substr(i+j+1,n-i-j-1);
                if(a=="keyence"){
                    cout << "YES" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
}

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

int main() {
	ll a,b,c;
	cin>>a>>b>>c;
	ll ans=c-a+b;
	if(ans>0)
	cout<<ans;
	else
	cout<<"0";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int x,min,max,a,i ;
	long int sum;
	scanf("%d",&x);
	scanf("%d",&a);
	max=a;
	min=a;
	sum=a;
	for(i=1;i<x;i++){
		scanf("%d",&a);
		sum+=a;
		if(a<min){
			min=a;
		}
		if(a>max){
			max=a;
		}
	}
	printf("%d %d %ld\n",min,max,sum);
	return 0 ;
}

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

int main(){
  int N, M; cin >> N >> M;
  priority_queue<int> A;
  
  rep(i,N){
    int x; 
    cin >> x;
    A.push(x);
  }
  
  rep(i,M){
    int y = A.top(); A.pop();
    A.push(y/2);
  }
  
  ll ans=0;
  
  rep(i,N){
    ans += A.top(); A.pop();
  }
  
  cout << ans << endl;
}

 


Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
#define LL long int
#define ULL unsigned long int
#define MOD (long int)10e9 + 7


int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;

    return 0;
}

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

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  if (e - a <= f) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
import sys, math,os
from io import BytesIO, IOBase
#data = BytesIO(os.read(0,os.fstat(0).st_size)).readline
# from bisect import bisect_left as bl, bisect_right as br, insort
# from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
# from itertools import permutations,combinations
# from decimal import Decimal
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var): sys.stdout.write(' '.join(map(str, var)) + '\n')
def out(var): sys.stdout.write(str(var) + '\n')
#sys.setrecursionlimit(100000 + 1)
INF = 10**9
mod = 998244353

n=int(data())
l=[1]*(n+1)
for i in range(1,n):
    for j in range(2*i,n+1,i):
        l[j]+=1
ans=0
for i in range(1,n+1):
    ans+=l[i]*i
out(ans)

Measured memory_bytes: 152416
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>

using namespace std;


int main() {
    string s;
    cin >> s;
    vector<int> v(26, 0);
    for (auto c : s) {
        v[c - 'a'] += 1;
    }
    string ans;
    ans = "Yes";
    for (auto i: v) {
        if (i % 2 == 1) {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int n,dp[100002],k;
long long int h[100002];
long long int solve(long long int index)
{
    if(index==n-1)
    return 0;
    if(dp[index]!=-1)
    return dp[index];
    long long int ans=1e9;
    for(int i=index+1;i<=min(n-1,index+k);i++)
    ans=min(ans,solve(i)+abs(h[i]-h[index])); 
    return dp[index]=ans;
}
int main()
{
    long long int i,j,kk,x,y,z;
    cin>>n>>k;
    for(i=0;i<n;i++)cin>>h[i];
    for(i=0;i<=100000;i++)dp[i]=-1;
    cout<<solve(0);
    return 0;
}


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

int main(){
    int flag=0;
    double W,H,x,y;
    int ans=0;

    cin >>W>>H>>x>>y;

    if(x == W/2 && y == H/2)flag=1;

    cout <<fixed<<setprecision(16)<< (W*H/2)<<" ";
    cout << flag << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>

using ll = long long;


int main() {
    int N;
    std::cin >> N;

    std::vector<std::vector<int>> to(N), co(N);

    for (int i = 0; i < N - 1; i++) {
        int a, b, w;
        std::cin >> a >> b >> w;
        //1indexより
        a--;
        b--;
        //頂点aにつながっているのは頂点b
        to[a].emplace_back(b);
        //頂点aとつなぐコストはw
        co[a].emplace_back(w);
        to[b].emplace_back(a);
        co[b].emplace_back(w);
    }

    std::vector<int> ans(N, -1);
    std::queue<int> q;
    ans[0] = 0;
    q.push(0);

    while (!q.empty()) {
        //キューの先頭を取得
        int v = q.front(); q.pop();

        for (int i = 0; i < to[v].size(); i++) {
            int u = to[v][i];
            int w = co[v][i];

            //既に探索済み
            if (ans[u] != -1) {
                continue;
            }
            ans[u] = (ans[v] + w) % 2;
            q.push(u);
        }
    }

    for (int i = 0; i < N; i++) {
        std::cout << ans[i] << std::endl;
    }

    return 0;
}


Measured memory_bytes: 11904
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
using namespace std;
 
int main(void){
  lint N,ans=0;
  cin >> N;
  lint P[N];
  rep(i,N) cin >> P[i];
  rep(i,N) P[i]--;
  lint place[N];
  rep(i,N) place[P[i]]=i;
  set<lint> save{-1,N};
  for(int i=N-1;i>=0;i--){
    lint l1,l2,r1,r2;
    lint now=place[i];
    auto tmp=save.lower_bound(now);
    r1=*tmp;
    tmp--;
    l1=*tmp;
    if(l1==-1 && r1==N){
      save.insert(now);
      continue;
    }
    else if(l1==-1){
      tmp++,tmp++;
      r2=*tmp;
      r2-=r1;
      save.insert(now);
      ans+=(i+1)*r2*(now-l1);
    }
    else if(r1==N){
      tmp--;
      l2=*tmp;
      l2=l1-l2;
      save.insert(now);
      ans+=(i+1)*l2*(r1-now);
    }
    else{
      tmp--;
      l2=*tmp;
      l2=l1-l2;
      tmp++,tmp++,tmp++;
      r2=*tmp;
      r2-=r1;
      save.insert(now);
      ans+=(i+1)*((l2*(r1-now))+(r2*(now-l1)));
    }
  }
  cout << ans << endl;
} 

Measured memory_bytes: 6528
#include<iostream>
#include<vector>
#include<algorithm>
#define mod 1000000007
using namespace std;
typedef long long int ll;
typedef pair<ll,int> mypair;
int main(void){
	int n;
	cin>>n;
	vector<ll> a(n),b(n);
	vector<mypair> l;
	for(int i=0;i<n;i++){
		cin>>a[i];
	l.push_back(mypair(a[i],-1));
	
	}
	for(int i=0;i<n;i++){	
		cin>>b[i];
	l.push_back(mypair(b[i],1));
	
	}
	
	sort(l.begin(),l.end());
	ll ans=1;
	int f=0;
	for(int i=0;i<2*n;i++){
		int c=l[i].second;
		if(f==0){
			f+=c;
		}else if(f<0){
			if(c<0){
				f+=c;
			}else{
				ans*=-1*f;
				ans%=mod;
				f+=c;
			}
		}else{
			if(c>0){
				f+=c;
			}else{
				ans*=f;
				ans%=mod;
				f+=c;
			}
		}

	}

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

Measured memory_bytes: 7664
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>

using namespace std;

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

int my_abs_A(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int my_abs_B(long long num,long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

long long DP_min(long long a, long long b) {
    if (a > b) {
        return a;
    }
    else {
    }
}

const long long INF = 1LL << 60;

int main() {
    long long N;
    cin >> N;
    long long count = (N / 11)*2;
    long long amari = N % 11;
    if (amari == 0) {
        //count++;
    }
    else if (amari > 0 && amari <= 6) {
        count++;
    }
    else {
        count++;
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
S = gets.chomp
s = S.split('').map(&:to_i)
a = []
b = []
answer = 0
m = 0

[0, 1].repeated_permutation(S.length-1) do |bits|
    a[m] = bits 
    m += 1
end

for i in 0..(2 ** (S.length-1))-1

    b[i] = []
    b[i][0] = 0
    t = 0

    for j in 0..S.length-2

        if a[i][j] == 1

            b[i].push(j+1)

        end

    end

    b[i].push(S.length)

    for j in 0..b[i].size-2

        for k in 0..b[i][j+1] - b[i][j] - 1

            answer += s[t] * (10 ** (b[i][j+1]-b[i][j]-k-1))
            t += 1

        end

    end

end

puts answer 



Measured memory_bytes: 3836
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

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

int main() {
    long long k;
    cin >> k;

    if(k%2 == 0) {
        cout << -1 << endl;
        return 0;
    }

    long long s = 0;

    for(int i = 0; i < pow(10, 6) + 10; i++) {
        s *= 10;
        s += 7;
        s %= k;

        if(s == 0) {
            cout << i+1 << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3156
def resolve():
    '''
    code here
    '''
    N = int(input())
    heap_list = [int(item) for item in input().split()]

    for i, val in enumerate(heap_list):
        print('node {}: key = {}, '.format(i+1,val), end='')
        if (i - 1) // 2 >= 0:
            print('parent key = {}, '.format(heap_list[(i - 1) // 2]), end='')

        left_index = 2*i + 1
        if left_index < N:
            print('left key = {}, '.format(heap_list[left_index]), end='')

        right_index = 2*i + 2
        if right_index < N:
            print('right key = {}, '.format(heap_list[right_index]), end='')
        print('')


if __name__ == "__main__":
    resolve()



Measured memory_bytes: 5700
import Foundation
var a: String = readLine()!

let pattern = "[a-z]"

let regex = try? NSRegularExpression(pattern: "[a-z]", options: NSRegularExpression.Options())
if regex!.firstMatch(in: a, options: NSRegularExpression.MatchingOptions(), range: NSMakeRange(0, 1)) != nil {
    print("a")
} else {
    print("A")
}

Measured memory_bytes: 15308
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      //String[] nyu=sc.nextLine().split("");
int[] nyuone=new int[2];
int[] nyusec=new int[2];

nyuone[0]=Integer.parseInt(sc.nextLine());
nyuone[1]=Integer.parseInt(sc.nextLine());
nyusec[0]=Integer.parseInt(sc.nextLine());
nyusec[1]=Integer.parseInt(sc.nextLine());

Arrays.sort(nyuone);
Arrays.sort(nyusec);

  //   String nyu=sc.nextLine();
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
//int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu[3]);


//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

System.out.println(nyuone[0]+nyusec[0]);





	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <iomanip> 
using namespace std;
double a[51];

int main(){
	int n;
	
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	sort(a,a+n);
	double ans = (a[0]+a[1])/2;
	for(int i = 2;i < n;i++){
		ans = (ans+a[i])/2;
	}
	cout << ans;
} 

Measured memory_bytes: 256
def solve():
    s = input()
    t = input()

    len_s, len_t = len(s), len(t)
    dp = [[0] * 3001 for _ in range(3001)]
    for i in range(len_s):
        for j in range(len_t):
            if s[i] == t[j]:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

    ans = ''
    i, j = len_s, len_t
    while 0 < i and 0 < j:
        if dp[i][j] == dp[i-1][j]:
            i -= 1
        elif dp[i][j] == dp[i][j-1]:
            j -= 1
        else:
            ans += s[i-1]
            i -= 1
            j -= 1
    print(ans[::-1])


if __name__ == '__main__':
    solve()


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

int64_t MOD = 1e9+7;


int main(){
    int N, M;
    cin >> N >> M;
    bitset<100001> broken;
    for(int i=0; i<M; i++){
        int a;
        cin >> a;
        broken[a] = 1;
    }

    int64_t dp[100001] = {0};
    dp[0] = 1;
    for(int i=1; i<=N; i++){
        if(broken[i]) continue;
        if(i == 1){
            dp[i] = dp[i-1];
        }else{
            dp[i] = (dp[i-1] + dp[i-2]) % MOD;
        }
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>
#include<type_traits>

using namespace std;
using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;
constexpr ll LONGINF = 1050000000000000000;

int main() {
	int n, k; cin >> n >> k;

	int ans = k;
	for (int i = 1; i <= n - 1; i++) {
		ans *= (k - 1);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <algorithm>
    #include <cctype>
    #include <iostream>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    
    
    
    int main() {
     
     string s;
     
     while(true){
     cin >> s;
     	if(s == "-")	return 0;
     
     int m;
     cin >> m;
     string a = s;
     rep(i,m) a= a+s;
     
     int amount = 0;
     rep(i,m){
     	int b;
     	cin >> b;
     	amount += b;
     }
     
     
     cout << a.substr(amount, s.size())<< '\n';
     }
     return 0;
    }
    


Measured memory_bytes: 3228
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define int ll
#define pll pair<ll, ll> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;

void dfs(vector<int> adj[], int sv, vector<bool> &vis){
	vis[sv] = true;
	for(int i = 0; i < adj[sv].size(); i++){
		if(!vis[adj[sv][i]]){
			dfs(adj, adj[sv][i], vis);
		}
	}
}
ll power(ll x, ll y){  
	if(x == 1 || y == 0)
		return 1;
    ll res = 1;   
    x = x % mod; 
    if (x == 0) 
		return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res * x) % mod;  
        y = y >> 1; 
        x = (x * x) % mod;  
    }  
    return res;  
} 

signed main(){
	FASTIO
	int n;
	cin >> n;
	int p = 0, a, ans = 0;
	rep(i, 0, n){
		cin >> a;
		ans = (ans + p * a) % mod;
		p = (p + a) % mod;
	}
	cout << ans;
	
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
  int W, Q;
  int used[100];

  while(cin >> W >> Q, W||Q){
    fill_n( used, 100, -1);

    while(Q--){
      char c;
      cin >> c;
      if(c == 's'){
        int id, w;
        cin >> id >> w;
        int pos = 0;
        while(pos <= W - w && count( used + pos, used + pos + w, -1) != w)  pos++;
        if(pos > W - w) puts("impossible");
        else{
          for(int i = pos; i - pos < w; i++) used[i] = id;
          cout << pos << endl;
        }
      } else {
        int id;
        cin >> id;
        for(int i = 0; i < W; i++){
          if(used[i] == id) used[i] = -1;
        }
      }
    }

    puts("END");
  }
}

 

Measured memory_bytes: 1160
#include <iostream>

using namespace std;
const int MAXN = 100;
int a[MAXN];

int main() {
  int n;
  cin >> n;
  for (int i = 0 ; i < n ; i ++) {
    cin >> a[i];
  }
  long long cur_money = 1000;
  for (int i = 0 ; i + 1 < n ; i++) {
    if (a[i] < a[i+1]) {
      long long num_stocks = cur_money / a[i];
      cur_money = cur_money - num_stocks * a[i] + num_stocks * a[i+1];
    }
  }

  cout << cur_money << endl;

  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <cstdlib>
#include <ctime>
#include <queue>
using namespace std;

#define X first
#define Y second
#define N 100010
#define M 500010

typedef unsigned long long ull;
typedef long long ll;
const int INF = 1 << 30;
const int Mod = 1000000007;

int father[N];
bool vis[N];
vector<int> E[N];
vector<int> lis;

void DFS(int x)
{
	for (int i = 0; i <E[x].size(); ++i)
	{
		int y = E[x][i];
		if (y == father[x]) continue;
		father[y] = x, DFS(y);
	}
	lis.push_back(x);
}

int main()
{
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	
	int n, x, y;
	scanf("%d", &n);
	for (int i = 1; i < n; ++i)
	{
		scanf("%d %d", &x, &y);
		E[x].push_back(y);
		E[y].push_back(x);
	}
	DFS(1);
	if (n & 1) puts("First");
	else
	{
		int cnt = 0; vis[0] = true;
		for (int i = 0; i < lis.size(); ++i)
		{
			int x = lis[i];
			if (!vis[x] && !vis[father[x]]) cnt++, vis[x] = vis[father[x]] = true;
		}
		puts(cnt == n / 2? "Second":"First");
	}
	return 0;
}

Measured memory_bytes: 6908
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

ll dp[1010][1010];
const ll mod = 1e9+7;

int main() {
    int h, w; cin >> h >> w;
    vector<string> a(h);
    rep(i,h) cin >> a[i];

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;

    rep(i,h) rep(j,w) {
        if (i+1<h && a[i+1][j] == '.') (dp[i+1][j] += dp[i][j]) %= mod;
        if (j+1<w && a[i][j+1] == '.') (dp[i][j+1] += dp[i][j]) %= mod;
    }

    cout << dp[h-1][w-1] << endl;

    return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void solve() {
    ll N;
    cin >> N;
    map<char,ll> mp;
    mp['M'] = 0;
    mp['A'] = 0;
    mp['R'] = 0;
    mp['C'] = 0;
    mp['H'] = 0;
    string m = "MARCH";
    REP(_,N) {
        string s;
        cin >> s;
        if(count(ALL(m),s[0]) == 1) {
            mp[s[0]]++;
        }
    }

    ll ans = 0;
    for(auto it = mp.begin(); it != mp.end() ; it++) {
        for(auto it2 = next(it,1); it2 != mp.end() ; it2++) {
            for(auto it3 = next(it2,1); it3 != mp.end(); it3++) {
                ans += it->second*it2->second*it3->second;
            }
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    vector<int> vs(4);
    for (int i = 0; i < 3; i++)
    {
        int a, b;
        cin >> a >> b;
        vs[a - 1]++;
        vs[b - 1]++;
    }
    sort(vs.begin(), vs.end());
    if (vs[0] == 1 && vs[1] == 1 && vs[2] == 2 && vs[3] == 2)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#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;
}
void debug(istringstream&){}
template <char sep=',', class Head, class... Tail>
void debug(istringstream& iss, Head&& head, Tail&&... tail)
{
  string name;
  getline(iss, name, ',');
  cout << sep << name << "=" << head;
  debug(iss, forward<Tail>(tail)...);
}
#define DEBUG(...) \
  do{ \
    istringstream ss(#__VA_ARGS__); \
    debug<' '>(ss, __VA_ARGS__); \
    cout<<endl; \
  }while(0)


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

const int L1 = 4;
const int L2 = L1 * 4;
const int L3 = L2 * 4;
const int L4 = L3 * 4;
LL dp[110][L4];
bool ok[L4];

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

  for(int i=0;i<L4;++i){
    ok[i] = true;
    string s(4, 0);
    for(int j=0;j<4;++j){
      s[j] = '0' + (i>>(j*2)&3);
    }
    if(s.find("012") != string::npos) ok[i] = false;
    for(int j=0;j<3;++j){
      swap(s[j], s[j+1]);
      if(s.find("012") != string::npos) ok[i] = false;
      swap(s[j], s[j+1]);
    }

    // cout << s << " " << ok[i] << endl;
  }

  int N;
  cin >> N;

  if(N == 3){
    cout << 61 << endl;
    return 0;
  }

  REP(b,L4){
    dp[4][b] = ok[b];
  }

  FOR(i,4,N){
    REP(b,L4){
      if(!ok[b]) continue;
      REP(c,4){
        int nb = b / 4 + (1<<6) * c;
        if(!ok[nb]) continue;
        (dp[i+1][nb] += dp[i][b]) %= MOD;
      }
    }
  }

  LL ans = 0;
  REP(b,L4) (ans += dp[N][b]) %= MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	string S;
	int w;
	cin >> S >> w;

	rep(i, S.size()) if (i % w == 0) cout << S[i];

	cout << endl;

	Would you please return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
    int a,b,c,count = 0;
    
    cin >> a >> b >> c;
    
    for(int i = a;i <= b ;i++)
    {
        if(c % i == 0)count++;
    }
    
    cout << count <<endl;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin>>n>>s;
    int sum=0;
    for(int i=1;i<n;i++)if(s[i]=='E')sum++;
    int ans=sum;
    for(int i=1;i<n;i++){
        if(s[i]=='E')sum--;
        if(s[i-1]=='W')sum++;
        if(ans>sum)ans=sum;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 720
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    k = I()
    r = 1
    for _ in range(n):
        r = min(r*2,r+k)

    return r


print(main())




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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())

int main() {
  int r;
  cin >> r;

  cout << M_PI*2*r << endl;

}

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

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

  ll X; cin >> X;
  ll ans = 1;
  if (X < 600) {
    ans = 8;
  } else if (X < 800) {
    ans = 7;
  } else if (X < 1000) {
    ans = 6;
  } else if (X < 1200) {
    ans = 5;
  } else if (X < 1400) {
    ans = 4;
  } else if (X < 1600) {
    ans = 3;
  } else if (X < 1800) {
    ans = 2;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H==0 && W==0)break;
        
        for(int j=0;j<W;j++)printf("#");
        printf("\n");
        for(int k=0;k<H-2;k++){
            printf("#");
            for(int l=0;l<W-2;l++)printf(".");
            printf("#\n");
        }
        for(int m=0;m<W;m++)printf("#");
        printf("\n\n");
    }
}


Measured memory_bytes: 2620
#include <stdio.h>

int main(void){
    char buf[1024];

    gets(buf);
    for (char *pt=buf; *pt!='\0'; pt++){
        if ('a'<=*pt && *pt<='z'){
            *pt = *pt-'a'+'A';
        }
        printf("%c", *pt);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 908
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLL = vector<PLL>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();
const unsigned long long int ULLINF = numeric_limits<unsigned long long int>::max();

int main() {
    
    int x;
    cin >> x;
    if (x==1) cout << 0 << endl;
    else cout << 1 << endl;

}


Measured memory_bytes: 3632
{-# LANGUAGE BangPatterns #-}
import Control.Arrow (second)
import Control.Monad
import Control.Monad.Fix
import Data.Foldable (foldl')
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)
import Debug.Trace

uread :: VUM.Unbox a => Int -> VUM.IOVector a -> a
uread !i !v = accursedUnutterablePerformIO $ VUM.unsafeRead v i

uwrite :: VUM.Unbox a => Int -> a -> VUM.IOVector a -> VUM.IOVector a
uwrite !i !a !v =
  accursedUnutterablePerformIO $ VUM.unsafeWrite v i a >> return v

uswap :: VUM.Unbox a => Int -> Int -> VUM.IOVector a -> VUM.IOVector a
uswap !i !j !v =
  accursedUnutterablePerformIO $ VUM.unsafeSwap v i j >> return v

ufreeze :: VUM.Unbox a => VUM.IOVector a -> VU.Vector a
ufreeze !v = accursedUnutterablePerformIO $ VU.unsafeFreeze v

uthaw :: VUM.Unbox a => VU.Vector a -> VUM.IOVector a
uthaw !v = accursedUnutterablePerformIO $ VU.unsafeThaw v

data Pair a b = Pair !a !b
data UnionFind = UnionFind (Pair (VUM.IOVector Int) (VUM.IOVector Int))

new :: Int -> UnionFind
new !n = UnionFind $ Pair (uthaw $ VU.fromList [0 .. n - 1])
                          (accursedUnutterablePerformIO $! VUM.replicate n 1)

findUF :: UnionFind -> Int -> Int
findUF !(UnionFind (Pair elems _)) !k = fix
  ( \f (!elems, !k, !path) -> case uread k elems of
    n | n == k -> foldl' (\(!acc) !p -> uwrite p n acc) elems path `seq` n
    n          -> f (elems, n, n : path)
  )
  (elems, k, [k])

sizeUF :: UnionFind -> Int -> Int
sizeUF !uf@(UnionFind (Pair _ sizes)) !i =
  let j = findUF uf i in j `seq` uread j sizes

unionUF :: UnionFind -> Int -> Int -> UnionFind
unionUF !uf@(UnionFind (Pair elem sizes)) !i !j =
  let pi = findUF uf i
      pj = findUF uf j
      si = uread pi sizes
      sj = uread pj sizes
  in  if pi == pj
        then uf
        else
          let (t1, t2) = if si < sj then (pi, pj) else (pj, pi)
          in  UnionFind $ Pair (uwrite t1 t2 elem) (uwrite t2 (si + sj) sizes)

solve :: Int -> Int -> VU.Vector (Int, Int) -> VU.Vector Int
solve !n !m !abs = VU.init $ ufreeze $ (\(_, _, _, acc) -> acc) $ VU.foldr'
  go
  ( new n
  , m - 1
  , nC2
  , uwrite m nC2 $ accursedUnutterablePerformIO $ VUM.unsafeNew (m + 1)
  )
  abs
 where
  go (!a, !b) (!uf, !k, !prev, !acc) =
    let ga  = findUF uf a
        gb  = findUF uf b
        n1  = sizeUF uf a
        n2  = sizeUF uf b
        res = prev - (if ga == gb then 0 else n1 * n2)
    in  (unionUF uf a b, k - 1, res, uwrite k prev acc)

  nC2 = n * (n - 1) `div` 2

main = do
  let readInt = fmap (second B.tail) . B.readInt

  (n, m) <-
    (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 readInt <$> B.getLine
  abs <- VU.replicateM
    m
    (   (\vec -> (vec VU.! 0 - 1, vec VU.! 1 - 1))
    .   VU.unfoldrN 2 readInt
    <$> B.getLine
    )

  VU.mapM_ print $ solve n m abs


Measured memory_bytes: 8188
#include <bits/stdc++.h>
#define N 1000005
using namespace std;
int n,m,ar[N],sum,a,b;
char s[N];
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='S')
			a++;
		if(s[i]=='T')
		{	
			b++;
			if(a)
				a--,b--;
		}	
	}		
	printf("%d",a+b);
}


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

int main()
{
  int n;
  string a,b,c;
  cin >> n;
  cin >> a;
  cin >> b;
  cin >> c;

  int action = 0;
  for(int i = 0; i < n; ++i){
    if (a[i] == b[i] && a[i] == c[i]){
      continue;
    }
    if ( a[i] == b[i] || b[i] == c[i] || a[i] == c[i]){
      action +=1;
      continue;
    }
    action += 2;
  }
  cout << action << endl;
}


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

int main(){
  string S,T; cin >> S >> T;
  int N = (int) S.size(); int M = (int) T.size();
  vector<vector<int>> alphabet(26);
  for(int i = 0; i < N; i++){
    alphabet[S[i] - 'a'].push_back(i);}
  for(int i = 0; i < N; i++){
    alphabet[S[i] - 'a'].push_back(i+N);}
  
  ll ans = 0; int p = 0;//p以降で次の文字を見つける
  for(int i = 0; i < M; i++){
    int c = T[i] - 'a'; 
    if( alphabet[c].size() == 0){ cout << -1 << endl; return 0;}
    p = *lower_bound(alphabet[c].begin(),alphabet[c].end(),p) + 1;
    if( p >= N){ p -= N; ans += N;}
  }
  
  cout << ans + p << endl;
  return 0;}

Measured memory_bytes: 1724
// Problem : C - Maximum Volume
// Contest : AtCoder - AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db long double
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define mi map<int,int>
#define ml map<ll,ll>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define MAX 4294967295
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MAXN 15000005
#define inf 1e10
#define PI acos(-1.0)
#define int long long

db l;

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    cin>>l;
    l /= 3;
    cout<<fixed<<setprecision(12)<<l*l*l<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
using namespace std;

int main() {
  string S;
  cin >> S;
  if((S.at(2) == S.at(3)) && (S.at(4) == S.at(5))) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);

		System.out.println((Main.calc(s.nextInt(), s.nextInt())));
	}

	public static int calc(int k, int s) {
		int count = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		}
		return count;
	}
}

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

int n,a[109];
bool OK = true;

int main()
{
	cin >> n;
	for(int i = 0;i<n;i++)cin >> a[i];
	for(int i = 0;i<n;i++)
	{
		if(a[i]%2)continue;
		if(a[i]%3==0)continue;
		if(a[i]%5==0)continue;
		OK = false;
	}
	if(OK)cout << "APPROVED";
	else cout << "DENIED";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <iomanip>

using namespace std;
// for loop
#define F(i, L, R) for(int i = L; i < R; i++)
#define FE(i, L, R) for(int i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(int i = L; i > R; i--)
#define FRE(i, L, R) for(int i = L; i >= R; i--)

// data types
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

void draw(int h, int w) {
    if(h == 0 || w == 0) {cout << endl; return;}
    F(k, 0, h){
      string width = "";
      F(i, 0, w){
          width += '#';
      }
      cout << width << endl;
    }
    cout << endl;
}

int main() {
    vvi data;
    while(1) {
        int h,w;
        vi vec;
        cin >> h >> w;
        if(h == 0 && w == 0)break;
        vec.push_back(h);
        vec.push_back(w);
        data.push_back(vec);
    }

    F(i, 0, data.size()){
        draw(data[i][0], data[i][1]);
    }

    return 0;
}



Measured memory_bytes: 3172
// https://atcoder.jp/contests/dp/tasks/dp_a

#include <bits/stdc++.h>

using namespace std;

int main() {
    int N, k;
    cin >> N >> k;
    vector<int> Arr(N);
    for(auto &x: Arr)
        cin >> x;
    vector<int> dp(N+1, 1e9+5);
    dp[0] = 0;
    for(int i = 0; i < N; ++i) {
        for(auto j = i+1; j <= i+k; ++j) {
            dp[j] = min(dp[j], dp[i]+abs(Arr[i]-Arr[j]));
        }
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#import<cstdio>
int t,c[1510],i,a,j;main(){for(;~scanf("%d",c+j++););for(;c[*c*3]=i<*c;a=!printf("%d\n",a))for(j=3*i++;t=c[j+3];j+=3)a=(a<c[j+2]?c[j+2]:~-a/t*t+t)+c[j+1];}

Measured memory_bytes: 128
import sys

input=sys.stdin.buffer.readline
sys.setrecursionlimit(2*10**5)

N=int(input())
A=list(map(int,input().split()))
edge=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

if N==2:
    if A[0]==A[1]:
        print("YES")
    else:
        print("NO")
    exit()

root=0
for i in range(N):
    if len(edge[i])!=1:
        root=i
        break

def cond(L,n):
    check=0
    for i in L:
        check+=min(n,i)
    return check>=2*n

def dfs(v,pv):
    s=A[v]
    t=[]
    for nv in edge[v]:
        if nv!=pv:
            y=dfs(nv,v)
            t.append(y)
    #2*a+b=t
    #a+b=s
    T=sum(t)
    if T==0:
        if len(edge[v])==1:
            return s

    start=0
    end=T//2
    while end-start>1:
        test=(end+start)//2
        if cond(t,test):
            start=test
        else:
            end=test
    if cond(t,end):
        M=end
    else:
        M=start

    a=T-s
    b=2*s-T
    if 0>a or 0>b:
        print("NO")
        exit()
    elif a>M:
        print("NO")
        exit()
    return b

res=dfs(root,-1)
print("YES" if res==0 else "NO")


Measured memory_bytes: 234144
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    String s = sc.next();
    pw.println(
      IntStream.range(0, s.length())
        .mapToObj(i -> "x")
        .collect(Collectors.joining("")));
  }
}


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

int main()
{
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double pi=acos(-1);
    double ha=(h*60+m)*0.5;
    double ma=m*6;
    double angle=abs(ha-ma);
    printf("%.9lf",sqrt(a*a+b*b-2*a*b*cos(angle*pi/180)));
}

Measured memory_bytes: 4256
white = 0
HW = parse.(split(readline()))
H,W = HW[1], HW[2]
C = []
for i in 1:H
  s = chomp(readline())
  white += count(c -> c == '.', s)
  push!(C,s)
end 
st = [1,1]
go = [H ,W]

dx = [1,-1,0,0]
dy = [0,0,1,-1]
function BFS(graph,start,goal)
  que = []
  push!(que,start)
  dist = [[-1 for i in 1:W] for j in 1:H]
  dist[start[1]][start[2]] = 0
  while isempty(que) == false
    x,y = shift!(que)
    if [x,y] == goal
      break
    else
      for i in 1:4
        if 0 <x+dx[i] <=H && 0 <y+dy[i] <=W
          if C[x+dx[i]][y+dy[i]] != '#' && dist[x+dx[i]][y+dy[i]] == -1
            push!(que,[x+dx[i],y+dy[i]])
            dist[x+dx[i]][y+dy[i]] = dist[x][y]+1
          end
        end
      end
    end
  end
  dist[goal[1]][goal[2]]
end
if BFS(C,st,go) == -1
  print(-1)
else
  print(white - BFS(C,st,go) - 1)
end

Measured memory_bytes: 130032
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , q ;
ll L[99];
int main ( ){
cin >> n ;
L[0] = 2LL;
L[1] = 1LL ;
for ( int i = 2; i  <= 90 ; i++ ){
    L[i] += L[i-1]+L[i-2];
}
cout << L[n];
return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e6+5;
const ll mod =   1e9+7;

int main()
{  fast
string s,t;
cin>>s>>t;
int cnt=0;
for(int i=0;i<s.size();i++){
	if(s[i]!=t[i])
	cnt++;
}
cout<<cnt;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{

      ll n,i;
      cin>>n;
      string s;
      cin>>s;

      for(i=0;i<s.length();i++)
      {
          if(s[i]+n <= 'Z')
          {
              s[i]+=n;
          }
          else
          {
              ll a = s[i]+n-'Z';
              s[i]='A'+a-1;
          }
      }

      cout<<s<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct object
{
    int weight, value;
    object(){};
    int operator<(const object &O)
    {
        if (value == O.value)
        {
            return (weight < O.weight);
        }
        return (value > O.value);
    }
};

const int MAX_N = 1e3 + 5, MAX_VALUE = 55, oo = 1e9;
//int minimum_weight[MAX_N][MAX_VALUE];

int main()
{
    int no_of_objects, capacity;
    cin >> no_of_objects >> capacity;

    vector<object> O(no_of_objects + 1);
    for (int i = 1; i <= no_of_objects; i++)
    {
        cin >> O[i].weight >> O[i].value;
    }

    long long total_value = 0;
    for (int i = 1; i <= no_of_objects; i++)
    {
        total_value += O[i].value;
    }

    int answer = 0;
    vector<long long> minimum_weight(total_value + 1, -1);
    total_value = 0;
    minimum_weight[0] = 0;

    for (int i = 1; i <= no_of_objects; i++)
    {
        total_value += O[i].value;

        for (int v = total_value; v >= O[i].value; v--)
        {
            if (minimum_weight[v - O[i].value] != -1)
            {
                long long weight_required = minimum_weight[v - O[i].value] + O[i].weight;

                if (weight_required <= capacity)
                {
                    answer = max(answer, v);
                }

                if (minimum_weight[v] == -1 || minimum_weight[v] > weight_required)
                {
                    minimum_weight[v] = weight_required;
                }
            }
        }
    }

    cout << answer;

    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
  


    char s[3];
	char s2[3];   
    scanf("%s",s);
  	scanf("%s",s2);
  	int i,count;
  	count = 0;
  	for(i=0;i<3;i++){
	if(s[i] == s2[i]){
     count++; 
    }
    }
    // 出力
    printf("%d ",count);//printf("%c",s[0])//文字一つ分のみを出力

    return 0;
}

Measured memory_bytes: 128
-- some-sums.hs --- Some Sums

-- author: Seong Yong-ju <sei40kr@gmail.com>

dsum :: Int -> Int
dsum 0 = 0
dsum x = x `mod` 10 + dsum (quot x 10)

between :: Int -> Int -> Int -> Bool
between l r x
  | l <= x = x <= r
  | otherwise = False

main :: IO ()
main = do
  [n, a, b] <- map (read :: String -> Int) . words <$> getLine
  print $ sum [x | x <- [0 .. n], between a b (dsum x)]


Measured memory_bytes: 508
import sys
from collections import defaultdict


sys.setrecursionlimit(1_000_000)


def dfs(v):
    for nv, nw in g[v]:
        if visited[nv]:
            continue
        if nw % 2:
            ans[nv] = ans[v] ^ 1
        else:
            ans[nv] = ans[v]
        visited[nv] = True
        dfs(nv)


N, *UVW = map(int, open(0).read().split())
g = defaultdict(set)

ans = [0] * N
for u, v, w in zip(*[iter(UVW)] * 3):
    u -= 1
    v -= 1
    g[u].add((v, w))
    g[v].add((u, w))
visited = [False] * N
visited[0] = True
dfs(0)
print("\n".join(map(str, ans)))



Measured memory_bytes: 109260
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
int x[100000];
signed main(){
	int n;
	cin>>n;
	f(i,n)cin>>x[i];
	sort(x,x+n);
	if(x[n-1]==x[0]&&(n>=x[0]*2||n<=x[0]+1)) puts("Yes");
	else if(x[n-1]-x[0]==1&&x[0]>=lower_bound(x,x+n,x[n-1])-x&&x[n-1]<=lower_bound(x,x+n,x[n-1])-x+(n-(lower_bound(x,x+n,x[n-1])-x))/2) puts("Yes");
	else puts("No");
	return 0;
}
		


Measured memory_bytes: 1024
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


class UnionFind:
    def __init__(self, size):
        self.table = [-1 for _ in range(size)]

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

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] <= self.table[s2]:
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2
            return True
        return False

    def subsetall(self):
        a = []
        for i in range(len(self.table)):
            if self.table[i] < 0:
                a.append((i, -self.table[i]))
        return a

def main():
    n,m = LI()
    p = LI_()
    a = [LI_() for _ in range(m)]
    uf = UnionFind(n)
    for x,y in a:
        uf.union(x,y)
    r = 0
    for i in range(n):
        if uf.find(i) == uf.find(p[i]):
            r += 1

    return r



print(main())



Measured memory_bytes: 28868