akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
#include<cmath>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;

struct P
{
  int s,e,cost;
  P(int s=0,int e=0,int cost=0):s(s),e(e),cost(cost){}
  bool operator < (const P& p)const
  {
    if(s!=p.s)return s < p.s;
    return e < p.e;
  } 
};

void printVP(vector<P> vec)
{
  cout << "printVP------" << endl;
  rep(i,vec.size())
    cout<< "(" << vec[i].s << "," << vec[i].e << "," << vec[i].cost << ") ";
  cout << endl;
}

void printVVI(VVI G)
{
  cout << "printVVI ------ "<< endl;
  rep(i,G.size())
    {
      rep(j,G[i].size())
	{
	  if(G[i][j] == 0)cout << "    0 ";
	  else cout << string(5-(log10(G[i][j])+1),' ') << G[i][j] << " "; 
	}
      cout << endl;
    }
  cout << endl;
}

int main()
{
  int N;
  while(cin >> N,N)
    {
      int MAX = 367;
      //dp[i][j] := テッツシツ妥」ツ?、テ」ツつ?」ツ?ョテゥツδィテ・ツアツ凝」ツ?景テヲツ猟・テ」ツつ?」ツ?ァ2テ」ツ?、テァツ崢ョテ」ツ?ョテゥツδィテ・ツアツ凝」ツ?桂テヲツ猟・テ」ツ?ョテヲツ卍づ」ツ?ョテヲツ慊?・ツ、ツァテ・ツ按ゥテァツ崢?
      VVI dp(MAX,VI(MAX,0));
      vector<P> requests(N);
      rep(i,N)
	cin >> requests[i].s >> requests[i].e >> requests[i].cost;
      sort(requests.begin(),requests.end());
      //printVP(requests);
  
      rep(k,N)
	{
	  VVI DP = dp;
	  REP(i,1,MAX)
	    {
	      REP(j,1,MAX)
		{
		  if(i == j && j == requests[k].e+1)
		    {
		      assert(requests[k].s-1 >= 0);
		      DP[i][j] = max(DP[i][j],
				     max(dp[requests[k].s][j]+requests[k].cost,
					 dp[i][requests[k].s]+requests[k].cost));
		    }
		  else if(j == requests[k].e+1)
		    {
		      assert(requests[k].s-1 >= 0);
		      DP[i][j] = max(DP[i][j],
				     dp[i][requests[k].s]+requests[k].cost);
		    }
		  else if(i == requests[k].e+1)
		    {
		      assert(requests[k].s-1 >= 0);
		      DP[i][j] = max(DP[i][j],
				     dp[requests[k].s][j]+requests[k].cost);
		    }
		  
		    DP[i][j] = max(DP[i][j],
				   max(DP[i-1][j],DP[i][j-1]));
		}
	    }
	  dp = DP;
	  //cout << "k = " << k << endl;
	  //printVVI(dp);
	}
      cout << dp[MAX-1][MAX-1] << endl;
    }
  return 0;
}

Measured memory_bytes: 2156
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w,n = list(map(int, input().split()))
from collections import defaultdict, Counter
d = defaultdict(int)
for i in range(n):
    a,b = map(int, input().split())
    for i in range(a-2, a+1):
        for j in range(b-2, b+1):
            if 1<=i<=h-2 and 1<=j<=w-2:
                d[i,j] += 1
ans = [None]*10
ans[0] = (h-2)*(w-2) - len(d)
c = Counter(d.values())
for i in range(1,10):
    if i in c:
        ans[i] = c[i]
    else:
        ans[i] = 0
write("\n".join(map(str, ans)))
    

Measured memory_bytes: 145512
#include <iostream>
#include <cstdio>
#include <iomanip>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>

#include <numeric>
#include <algorithm>
#include <functional>

#include <cctype>

#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(unsigned int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                                                  it != container.end(); ++it)

typedef long long ll;
typedef complex<double> P;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};
const double EPS = 1e-9;
const int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    while(true){
        int n;
        cin >> n;
        if(n==0) break;
        vector<int> S(n);
        rep(i,n) cin >> S[i];
        int total = accumulate(all(S),0) - *max_element(all(S)) - *min_element(all(S));
        double ave = total / (S.size()-2);
        int iave = floor(ave);
        cout << iave << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
package main

import(
	"bufio"
	"strconv"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func main() {
	sc.Split(bufio.ScanWords)

	a := nextLine()
	
	if a == "T" {
		fmt.Println("A")
	}

	if a == "A" {
		fmt.Println("T")
	}
	
	if a == "G" {
		fmt.Println("C")
	}

	if a == "C" {
		fmt.Println("G")
	}
}


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

using namespace std;

int DP[3010][3010];

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

    memset(DP,0,sizeof(DP));
    for (int i=1;i<=S.size();i++) {
        for (int j=1;j<=T.size();j++) {
            if (T[j-1]==S[i-1]) {
                DP[i][j]=DP[i-1][j-1]+1;
            }
            else {
                DP[i][j]=max(DP[i-1][j],DP[i][j-1]);
            }
        }
    }
    string ans;
    int i=S.size(),j=T.size();
    while (i>0 && j>0) {
        if (S[i-1]==T[j-1]) {
            ans.push_back(S[i-1]);
            i--;
            j--;
        }
        else if (DP[i][j-1] > DP[i-1][j]) {
            j--;
        }
        else{
            i--;
        }
    }
    for (int k=ans.size()-1;k>=0;k--) {
        cout << ans[k];
    }
    return 0;
}


Measured memory_bytes: 35712
#include <iostream>
#include <string>
#include <climits>
#include <cstring>


using namespace std;


int main(void)
{
     int N;
     string s;
     int count[50][26];

     for (int i = 0; i < 50; i++)
         for (int j = 0; j < 26; j++)
             count[i][j] = 0;

     cin >> N;
     for (int i = 0; i < N; i++) {
         cin >> s;
         for (auto it = s.begin(); it != s.end(); ++it) {
             count[i][*it - 'a']++;
         }
     }

     string ans = "";
     for (int i = 0; i < 26; i++) {
         int min = INT_MAX;
         for (int j = 0; j < N; j++) {
             if (min > count[j][i])
                 min = count[j][i];
         }
         ans += string(min, 'a' + i);
     }

     cout << ans << endl;

     return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int die[6];
int dice[6]={1,3,4,2,3,6};
void S(){
  int a[6];
  for(int i=0;i<6;i++) a[i]=die[i];
  die[0]=a[1];
  die[1]=a[5];
  die[5]=a[4];
  die[4]=a[0];
}
 
void W(){
int a[6];
 for(int i=0;i<6;i++) a[i]=die[i];
 die[0]=a[3];
 die[3]=a[5];
 die[5]=a[2];
 die[2]=a[0];
}
 
void N(){ S(),S(),S();}
void E(){W(),W(),W();}
 
 
int main(){
 
 
 
  while(1){
    int n;
    cin>>n;
    if(!n) break;
    for(int i=0;i<6;i++) die[i]=i+1;
       
    while(n--){
      string a;
      cin>> a;
      if(a=="north") N();
      if(a=="east") E();
      if(a=="south")S();
      if(a=="west")W();
    }
    cout << die[0]<<endl;
  }
  return 0;
}

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

  using namespace std;

  typedef long long ll;
  typedef vector<ll> vl;

  vl mem[205][205];
  ll visit[205][205];

  int num(string& s, ll l, ll r){
    ll ret = 0;
    for(ll i = l;i < r;i++){
      ret *= 10;
      ret += s[i]-'0';
    }
    return ret;
  }

  bool is_op(char c){
    return c == '+' || c == '-' || c == '*' || c == '/';
  }

  vl eval(string& s, ll l, ll r){
    if(visit[l][r]) return mem[l][r];
    visit[l][r] = 1;
    // cerr << l << " " << r << endl;
    vl ret = vl();
    ll cnt = 0;
    bool flag = false;
    for(ll i = l;i < r;i++){
      if(cnt == 0 && is_op(s[i])){
        vl left_vec = eval(s, l, i);
        vl right_vec = eval(s, i+1, r);
        flag = true;
        for(ll x : left_vec){
          for(ll y : right_vec){

            if(s[i] == '+') ret.push_back(x+y);
            if(s[i] == '-') ret.push_back(x-y);
            if(s[i] == '*') ret.push_back(x*y);
            if(s[i] == '/' && y != 0) ret.push_back(abs(x)/abs(y)*(x*y >= 0 ? 1 : -1));

          }
        }
      }
      if(s[i] == '(') cnt++;
      if(s[i] == ')') cnt--;
    }
    if(flag == false){
      if(s[l] == '(' && s[r-1] == ')') return mem[l][r] = eval(s, l+1, r-1);
      else return mem[l][r] = vl({num(s,l,r)});
    }
    if(ret.size() > 0){
      sort(ret.begin(),ret.end());
      ret.erase(unique(ret.begin(),ret.end()), ret.end());
    }
    return mem[l][r] = ret;
  }


  int main(){

    string s;
    while(cin >> s){
      if(s == "#") return 0;
      for(ll i = 0;i < 205;i++){
        for(ll j = 0;j < 205;j++){
          mem[i][j] = vl();
          visit[i][j] = 0;
        }
      }
      // vl res = eval(s,0,s.size());
      // for(ll x : res){
      //   cerr << x << " ";
      // }
      // cerr << endl;
      cout << eval(s,0,s.size()).size() << endl;
    }
  }



Measured memory_bytes: 4524
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
// auto mod int
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    mint sum = mint(2).pow(n);
    sum-=1;
    auto bunbo = [&](int x) {
        mint k(1);
        while (x) {
            k *= x;
            --x;
        }
        return k;
    };
    auto bunsi = [&](int y,int z) {
        mint k(1);
        rep(i, z) {
            k *= (n - i);
        }
        return k;
    };
    mint p, q;
    p = bunsi(n, a) / bunbo(a);
    q = bunsi(n, b) / bunbo(b);
    mint ans = sum - p - q;
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

char buf[110];
int main(void) {
  int n;
  scanf("%d%s", &n, buf);
  int r = 0;
  int b = 0;
  REP(i, n) {
    if(buf[i] == 'R') {
      ++r;
    } else {
      ++b;
    }
  }
  puts(r > b ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin >> n;
   cout << ((n+1000-1)/1000)*1000-n;
   return 0;
} 


Measured memory_bytes: 3636
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    int n;
    int m;
    int l;
 
   cin >> n >> m >> l;
   double a[n];
   double ans[n];
  
   //cout << n << endl;
   //cout << m << endl;
   //cout << l << endl;
  
   for(int i = 0;i<n;i++){
     double p;
     cin >>  p;
     
     a[i] = p;
     
   }
    map<double, int> mp;    
    
  
    for(int i = 0;i<n;i++){
      
     double sa = l-(m-a[i]*0.006);
      
     ans[i]=abs(sa);
      
     mp[ans[i]] = i;
      
     //cout << ans[i] << endl;
     
   }
  
  sort(ans, ans + n); 
//  cout << ans[1] << endl;
  
  cout << mp[ans[0]]+1 << endl;
  
   
  
  return 0;
}


Measured memory_bytes: 384
// failed to generate code
 
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string S;
	cin >> S;
	int ans = 0;
	for(int i = 0 ; i + 1 < S.size() ; i++)
		if( S[i] != S[i+1] ) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 512
from collections import deque
n,m,k = map(int,input().split())
friend = [set() for i in range(n)]
block = [set() for i in range(n)]

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    friend[a].add(b)
    friend[b].add(a)
for i in range(k):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    block[a].add(b)
    block[b].add(a)

stack = deque()
ans = [0] * n
visited = [0] * n

for i in range(n):
    if visited[i]:continue
    now = {i}
    visited[i] = 1
    stack.append(i)
    while stack:
        num = stack.pop()
        for j in friend[num]:
            if visited[j] == 0:
                stack.append(j)
                visited[j] = 1
                now.add(j)
    for i in now:
        ans[i] = len(now)-len(now&friend[i])-len(now&block[i])-1
for answer in ans:
    print(answer,end=" ")

Measured memory_bytes: 80700
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    ll a,c,e;
    char b,d;
    cin>>a>>b>>c>>d>>e;
    if(c<=4){
        cout<<"Heisei"<<endl;
    }else{
        cout<<"TBD"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 3e3 + 10;

int dp[2][N][4];
int a[N][N];

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int r, c, k;
	cin >> r >> c >> k;
	for(int i = 0; i < k; i++) {
		int u, v, w;
		cin >> u >> v >> w;
		a[u][v] = w;
	}
	for(int i = 1; i <= c; i++) {
		for(int l = 0; l <= 3; l++) {
			dp[0][i][l] = -inf;
		}
	}
	for(int i = 1; i <= r; i++) {
		for(int l = 1; l <= 3; l++) {
			dp[1][0][l] = -inf;
		}
		for(int j = 1; j <= c; j++) {
			for(int l = 1; l <= 3; l++) {
				dp[1][j][0] = max(dp[1][j][0], dp[0][j][l]);
			}
			for(int l = 0; l <= 3; l++) {
				dp[1][j][l] = max(dp[1][j][l], dp[1][j - 1][l]);
			}
			if(a[i][j]) {
				for(int l = 0; l <= 3; l++) {
					dp[1][j][1] = max(dp[1][j][1], dp[0][j][l] + a[i][j]);
				}
				for(int l = 1; l <= 3; l++) {
					dp[1][j][l] = max(dp[1][j][l], dp[1][j - 1][l - 1]+ a[i][j]);
				}
			}
		}
		for(int j = 1; j <= c; j++) {
			for(int l = 0; l <= 3; l++) {
				dp[0][j][l] = dp[1][j][l];
			}
		}
	}
	int ans = 0;
	for(int i = 0; i < 4; i++) {
		ans = max(ans, dp[0][c][i]);
	}
	cout << ans;

	return 0;
}

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

int main(void){
    ll n, k;
    cin >> n >> k;
    
    ll ans = 0;
    ll s = 1;
    while (s-1 < n) {
        s *= k;
        ans++;
    }
    
    cout << ans;
}


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

class dice{
public:
    int face[6];

    dice(){}

    void rollN(){
        int c = face[0];
        face[0] = face[1];
        face[1] = face[5];
        face[5] = face[4];
        face[4] = c;
    }

    void rollS(){
        int c = face[0];
        face[0] = face[4];
        face[4] = face[5];
        face[5] = face[1];
        face[1] = c;
    }

    void rollW(){
        int c = face[0];
        face[0] = face[2];
        face[2] = face[5];
        face[5] = face[3];
        face[3] = c;
    }

    void rollE(){
        int c = face[0];
        face[0] = face[3];
        face[3] = face[5];
        face[5] = face[2];
        face[2] = c;
    }

    void rollZ(){
        int c = face[1];
        face[1] = face[2];
        face[2] = face[4];
        face[4] = face[3];
        face[3] = c;
    }

};

int main() {
    dice A;
    rep(i, 6){
        cin >> A.face[i];
    }

    dice B;
    rep(i, 6){
        cin >> B.face[i];
    }

    rep(i, 6){
        rep(j, 4){
            if (A.face[0] == B.face[0] && A.face[1] == B.face[1] && A.face[2] == B.face[2] && A.face[3] == B.face[3] && A.face[4] == B.face[4] && A.face[5] == B.face[5]){
                cout << "Yes" << endl;
                return 0;
            }
            B.rollZ();
        }
        if(i % 2 == 0)B.rollS();
        else B.rollE();
    }

    cout << "No" << endl;
    return 0;

}


Measured memory_bytes: 3120
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    char[] s = scanner.next().toCharArray();

    int count = 0;
    for (int i = 1; i < N; i++) {
      if (s[i] != s[i - 1]) count++;
    }
    System.out.println(count + 1);
  }
}


Measured memory_bytes: 26824
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int cross = min(x, y);
    int na = 0, nb = 0,nc = 0;
    if (a + b <= 2 * c) {
        na = x;
        nb = y;
    }
    else {
        //かぶってるところはABを買う
        nc = 2 * cross;
        // 残りは、基本的にAを買う。ただし、ABピザがやたら安ければ、そっちを買う。
        if (a <= 2 * c) {
            na += x - cross;
        }
        else {
            nc += 2 * (x - cross);
        }
        if (b <= 2 * c) {
            nb += y - cross;
        }
        else {
            nc += 2*(y - cross);
        }
    }
    int minPrice = a * na + b * nb + c * nc;
    cout << minPrice << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,T;
  cin >> n >> T;
  int c,t;
  int mi = 1001;
  rep(i,n){
    cin >> c >> t;
    if(t<=T){
      mi = min(mi,c);
    }
  }
  if(mi==1001){
    cout<<"TLE"<<endl;
  }else{
    cout << mi << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>
#include <iterator>

using namespace std;

namespace {

}

int main()
{
	long long K, X;
	long long max(2000001);

	cin >> K >> X;

	for (long long i = X - (K - 1); i <= X + (K - 1); ++i){
		cout << i << ' ';
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3608
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	ss, _ := reader.ReadString('\n')
	ts, _ := reader.ReadString('\n')
	s := strings.Replace(ss, "\n", "", -1)
	t := strings.Replace(ts, "\n", "", -1)

	if strings.HasPrefix(t, s) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 1760
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <cassert>
#include <string>
#include <cmath>
#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) (x & -x)
using namespace std;
typedef long long ll;
const int MAX = 0x7ffffff;
int t;
string s;
void slove()
{
	int n;
	cin >> n >> s;
	ll ans = 0;
	int R = 0 ,G = 0 , B= 0;
	for(char c : s)
	{
		if(c == 'R')R++;
		if(c == 'B')B++;
		if(c == 'G')G++;
	}
	ans = (ll) R * G * B;

	for(int i = 0 ;i < n ;i ++)
	{
		for(int j = i + 1;j < n ;j ++)
		{
			if(s[i] == s[j])continue;
			int k = 2 * j - i;
			if(k >= n)continue;
			if(s[k] != s[i] && s[k] != s[j])ans--;
		}
	}
	cout << ans << endl;
}
int main()
{
	SIS;
	slove();
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main(){
	int n,s[12],o[12];
	while(cin>>n){
		if(!n)break;
		int step=-1;
		for(int i=0;i<n;++i) cin>>s[i];
		for(int f=1;f;++step){
			for(int i=0;i<n;++i) o[i]=s[i];
			for(int i=0,count=0;i<n;++i){
				count=0;
				for(int j=0;j<n;++j){
					if(o[i]==o[j])++count;
				}
				s[i]=count;
			}
			f=0;
			for(int i=0;i<n;++i) if(s[i]!=o[i])f=1;
		}
		cout<<step<<"\n";
		for(int i=0;i<n;++i) cout<<s[i]<<((i!=n-1)?" ":"\n");
	}
	return 0;
}

Measured memory_bytes: 0
import bisect
N, M, K = (int(i) for i in input().split())  
A = [int(i) for i in input().split()] 
B = [int(i) for i in input().split()] 


AA = [0]
BB = [0] 

x = 0
for a in A:
    x += a
    AA.append(x)

x = 0
for b in B:
    x += b
    BB.append(x)

tmp = 0
for i in range(N+1):
    a = AA[i]
    if bisect.bisect_right(BB,K -a)-1 >= 0:
        tmp = max( tmp ,  bisect.bisect_right(BB,K -a)-1 + i)

print(tmp)


Measured memory_bytes: 133308
#include<stdio.h>

int main()
{
  char b;
  
  scanf("%s",&b);
  
  switch(b)
  {
    case'A':printf("T");
     		break;
   	case'T':printf("A");
      		break;
    case'C':printf("G");
      		break;
    case'G':printf("C");
      		break;
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n, m;
    cin >> n >> m;
    vector<ll> x(m);

    rep(i,0,m) cin >> x[i];

    sort(x.begin(), x.end());

    vector<ll> d(m-1);
    rep(i,0,m-1)
        d[i] = x[i+1] - x[i];

    sort(d.begin(), d.end());

    ll cnt(0);        
    rep(i,0,m-n)
        cnt += d[i];

    cout << cnt << endl;

    return 0;
}


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

typedef long long ll;
const int N = 100005;

int n;
int a[10][10];
bool b[10][10];
set<int> st;

int mvx[10] = {-1, 0, 1, 1, 1, 0, -1, -1};
int mvy[10] = {-1, -1, -1, 0, 1, 1, 1, 0};

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
	
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin>>a[i][j];
		}
	}
	
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		st.insert(x);
	}
	
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			if(st.count(a[i][j]))b[i][j] = true;
		}
	}
	
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			if(!b[i][j])continue;
			for(int k=0;k<8;k++){
				if(b[i+mvx[k]][j+mvy[k]] && b[i-mvx[k]][j-mvy[k]]){
					cout<<"Yes";
					return 0;
				}
			}
		}
	}
	
	cout<<"No";
	return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N,X,Y;
  cin>>N>>X>>Y;
  map<int,int> ans;
  FOR(i,1,N+1){
    FOR(j,1,i){
      ans[min({
        abs(j-i),
        abs(j-X)+abs(i-Y)+1
      })]++;
    }
  }
  FOR(i,1,N){
    cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
using namespace std;

int main()
{
	int A1,A2,A3,A;
	cin >> A1 >> A2 >> A3;
	A=A1+A2+A3;
	if(A<=21){
		cout << "win" << endl;
	}
	else{
		cout << "bust" << endl;
	}

}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main() {
    int n,m;cin>>n>>m;
    ll a[n];
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    
    vector<ll>vec;
    pair<ll,int>p[m];
    
    rep(i,m){
        int b;
        ll c;
        cin>>b>>c;
        p[i].first = c;
        p[i].second= b;
    }
    sort(p,p+m,greater<pair<ll,int>>());

    rep(i,m){
        int cc = p[i].second;
        rep(j,cc)vec.push_back(p[i].first);
        if(vec.size()>=n)break;
    }
    
    sort(vec.begin(),vec.end(),greater<ll>());
    
    int tmp = vec.size();
    rep(i,min(n,tmp)){
        if(a[i]<vec[i])a[i]=vec[i];
    }
    
    ll ans=0;
    rep(i,n)ans+=a[i];
    cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 4724
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N;
  cin >> N;
  int res = 0;

  int xn = N / 500;
  N -= xn * 500;
  res += xn * 1000;

  xn = N/5;
  N -= xn * 5;
  res += 5 * xn;

  cout << res << endl;
}

Measured memory_bytes: 256
N = int(input())
solved = False
for h in range(1,3501):
    for n in range(1,3501):
        if 4*h*n-N*(h+n)>0 and (N*h*n)%(4*h*n-N*(h+n))==0:
            print(h,n,(N*h*n)//(4*h*n-N*(h+n)))
            solved = True
            break
    if solved:
        break

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(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 CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

pll f(pll a, pll b){
    ll cnt = a.second + b.second + 1;
    ll v = a.first + b.first;
    if(v>=10){
        cnt++;
        v = (v/10) + (v%10);
    }
    return pll(v,cnt);
}

pll mypow(pll a, ll b){
    if(b==1)return a;
    pll x = mypow(a,b/2);
    x = f(x,x);
    if(b%2==1)x = f(x,a);
    return x;
}

int main(){
    int m;
    scanf("%d",&m);
    pll x;
    REP(i,m){
        int d;
        ll c;
        scanf("%d%lld",&d,&c);
        pll y = mypow(pll(d,0), c);
        if(i==0){
            x = y;
        }else{
            x = f(x,y);
        }
    }
    printf("%lld\n",x.second);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    int n,length;
    cin>>n>>length;
    vector<string> str;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        str.push_back(s);
    }

    sort(str.begin(),str.end());
    for(auto i:str)
    cout<<i;
    cout<<endl;
}

Measured memory_bytes: 256
//
// Created on 2020/01/19.
//

//#include <bits/stdc++.h>
#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 <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;
using gragh = vector<vector<int>>;

int main() {
    int ans = 1;
    int n;
    cin>>n;
    vector<int>p(n);
    for (int i = 0; i < n; ++i) {
        cin>>p[i];
    }
    int min_v = p[0];
    for (int j = 1; j < n; ++j) {
        if (p[j]>min_v) continue;
        else if (p[j]<=min_v) {
            min_v = min(p[j],min_v);
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#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 FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
const LL MOD=1000000007ll;
const LL INF=2000000000ll;

long power(long a, long b){return b?power(a*a%MOD,b/2)*(b%2?a:1)%MOD:1;}

long perm(int N, int K){ 
    long x = 1;
	for(int i = 1; i <= K; i++){
		x = x * (N-i+1) % MOD;
    }
    return x;
}

long factorial(int N){
    return N?perm(N,N):1;
}

long comb(int N, int K){
	long x = 1, y = 1;
	for(int i = 1; i <= K; i++){
		x = x * (N-i+1) % MOD;
		y = y * i % MOD;
	}
	return x * power(y, MOD-2) % MOD;
}

long hcomb(int N, int K){
    return comb(N+K-1, N-1);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);

    int N;
    cin >> N;
    VI x(N),y(N);
    vector<vector<LD> > dist(N, vector<LD>(N));
    REP(i,N) cin >> x[i] >> y[i];

    REP(i,N) REP(j,N) dist[i][j] = sqrtl((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));

    long double sum = 0;

    VI order(N);
    REP(i,N) order[i] = i;

    do {
        REP(i,N-1){
            sum += dist[order[i]][order[i+1]];
        }
    } while(next_permutation(ALL(order)));

    cout << sum/factorial(N) << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
A=list(map(int,input().split()))
P=[i for i in range(N)]
size=[1 for i in range(N)]

def find(a):
    if a==P[a]:
        return a
    else:
        return find(P[a])
        
def union(b,c):
    B=find(b)
    C=find(c)
    if size[B]>=size[C]:
        P[C]=P[B]
        size[B]+=size[C]
    else:
        P[B]=P[C]
        size[C]+=size[B]
for i in range(M):
    x,y=map(int,input().split())
    if find(x)!=find(y):
        union(x,y)
        
p=[]
for i in range(N):
    p.append([A[i],find(P[i])])
#print(p)
p.sort()
ANS1=[]
ANS2=[]
d={}
for i in range(N):
    if p[i][1] in d:
        ANS2.append(p[i][0])
    else:
        d[p[i][1]]=1
        ANS1.append(p[i][0])
#print(ANS1,ANS2)
if (len(ANS1)+len(ANS1)-2)>N:
    print("Impossible")
elif len(ANS1)==1:
    print(0)
else:
    ANS=sum(ANS1)+sum(ANS2[:len(ANS1)-2])
    print(ANS)

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

int main(){
	ll n;
	cin >> n;
	map<string,int> mp;
	rep(i,n){
		string s;
		cin >> s;
		mp[s]++;
	}
	int mx = 0;
	for(auto p: mp){
		mx = max(mx, p.second);
	}
	vector<string> v;
	for(auto p: mp){
		if(p.second == mx) v.push_back(p.first);
	}
	sort(v.begin(),v.end());
	for(auto p: v){
		cout << p << endl;
	}
    return 0;
}



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

int main() {
  string S;
  cin >> S;
  ll K;
  cin >> K;
  int N = S.size();
  S = S + S + S;
  ll ans = 0, ans1 = 0, ans2 = 0;
  for (int i = 1; i < S.size(); i++) {
    if (S[i] == S[i - 1]) {
      ans++;
      if (N <= i && i <= 2 * N - 1) {
        ans1++;
      } else if (2 * N <= i) {
        ans2++;
      }
      i++;
    }
  }
  cout << (ans - ans1 - ans2) + ans1 * (K / 2) + ans2 * ((K - 1) / 2) << endl;
}

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

ll mod = 1e9+7;
ll dp[1<<21];

int a[21][21];
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      cin >> a[i][j];
  dp[0] = 1;
  for (int i = 1; i < 1<<n; i++) {
    int pop = 0;
    for (int j = 0; j < n; j++) pop += i>>j&1;
    for (int j = 0; j < n; j++) {
      if ((i>>j&1) && a[pop-1][j]) {
	dp[i] += dp[i^1<<j];
	if (dp[i] >= mod) dp[i] -= mod;
      }
    }
  }
  cout << dp[(1<<n)-1] << endl;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
#define ll long long
#define _for(a,b,i) for(int i=a;i<=b;i++)
#define for1(a,b,i) for(int i=a;i<b;i++)
using namespace std;
ll ma=0x80000000;
ll mi=0x7fffffff;
const ll zfc=0xffffffff;
const ll mod=1e9+7;
inline void input(ll &x)
{
    x=0;
    int f=1;
    char ch=getchar();
    while(!isdigit(ch))
	{
		if(ch=='-')f=-f;
		ch=getchar();
	}
    while(isdigit(ch))
	{
		x=x*10+(ch-'0');
		ch=getchar();
	}
    x*=f;
}
inline void output(ll x)
{
	if(x<0)
    {
        x=-x;
        putchar('-');
    }
    if(x/10>0)output(x/10);
    putchar(x%10+'0');
}
string st1;
ll z;
int main()
{
	ios::sync_with_stdio(false);
	string st="CODEFESTIVAL2016";
	cin>>st1;
	for1(0,st1.size(),i)
	if(st1[i]!=st[i])z++;
	cout<<z<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}

struct edge{int to, cost;};

class Graph
{
public:
    int V;
    vector<vector<edge>> G;

    Graph(int V): V(V){
        G = vector<vector<edge>>(V, vector<edge>(0));
    }

    void add_edge(int from, int to, int cost){
        G[from].push_back(edge({to, cost}));
    }

    void add_edge2(int v1, int v2, int cost){
        add_edge(v1, v2, cost);
        add_edge(v2, v1, cost);
    }

    void dfs(int v, int c[2], vector<bool> &used, vector<string> &S, int W){
        used[v] = true;
        if(S[v / W][v % W] == '.') c[0]++;
        else c[1]++;
        REP(k, G[v].size()) if(!used[G[v][k].to]) dfs(G[v][k].to, c, used, S, W);
    }

};

signed main(){

    int H, W; cin >> H >> W;
    vector<string> S(H); readv(S);
    Graph G(H * W);
    REP(i, H - 1) REP(j, W) if(S[i][j] != S[i + 1][j]) G.add_edge2(i * W + j, (i + 1) * W + j, 0);
    REP(i, H) REP(j, W - 1) if(S[i][j] != S[i][j + 1]) G.add_edge2(i * W + j, i * W + j + 1, 0);

    vector<bool> used(H * W, false);
    int c[2], ans = 0;
    REP(i, H * W){
        if(!used[i]){
            c[0] = 0;
            c[1] = 0;
            G.dfs(i, c, used, S, W);
            ans += c[0] * c[1];
        }
    }
    cout << ans;
    
    return 0;
}

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

int main() {
int N, M;
cin >> N >> M;
vector<int> A(2*M);
vector<int> sum(N);
  for (int l = 0; l < N; l++) {
    sum.at(l) = 0;
  }
for (int i = 0; i < 2*M; i++) {
cin >> A.at(i);
for (int p= 0; p < N; p++) {
if (A.at(i) == p+1) {
 sum.at(p)++;
}
}
}
for (int k=0; k < N; k++){
cout << sum.at(k) << endl;
}
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  string a, b, c;
  while (cin >> n >> a >> b >> c) {
    int sum = 0;
    for (int i = 0; i < n; ++i) {
      set<char> s;
      s.insert(a[i]);
      s.insert(b[i]);
      s.insert(c[i]);
      sum += (int)s.size() - 1;
    }
    cout << sum << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e2 + 10;
int rev(int t, int k)
{
	if (t < 0) t += k;
	else t -= k;
	return t;
}
vector<pair<LL, LL>> solve(int k, LL x, LL y, int o1, int o2, int o3, int o4)
{
	vector<pair<LL, LL>> ans;
	LL cx = 0, cy = 0;
	tie(x, y) = make_pair(x + y, x - y);
	if (k % 2 == 0)
	{
		if (x % 2 || y % 2) puts("-1"), exit(0);
	}
	if ((x - cx) % k)
	{
		int t = (x - cx) % k;
		if (k % 2 && t % 2 == 0)
		{
			if (t < 0) t += k;
			else t -= k;
		}
		ans.emplace_back(o2 < 0 || k % 2 == 1 ? t : rev(t, k), k * o1);
		cx += ans.back().first;
		cy += ans.back().second;
	}
	if ((y - cy) % k)
	{
		int t = (y - cy) % k;
		if (k % 2 && t % 2 == 0)
		{
			if (t < 0) t += k;
			else t -= k;
		}
		ans.emplace_back(k * o3, o4 < 0 || k % 2 == 1 ? t : rev(t, k));
		cx += ans.back().first;
		cy += ans.back().second;
	}
	int r1 = abs(x - cx) / k, r2 = abs(y - cy) / k;
	while (cx != x || cy != y)
	{
		if (k & 1) ans.emplace_back(cx < x ? k : -k, cy < y ? k : -k);
		else
		{
			if (cx != x && cy != y) ans.emplace_back(cx < x ? k : -k, cy < y ? k : -k);
			else if (cx != x) ans.emplace_back(cx < x ? k : -k, 0);
			else ans.emplace_back(0, cy < y ? k : -k);
		}
		cx += ans.back().first;
		cy += ans.back().second;
	}
	return ans;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int k;
	cin >> k;
	LL x, y;
	cin >> x >> y;

	vector<pair<LL, LL>> ans;
	for (int o1 = -1; o1 <= 1; o1 += 2)
	{
		for (int o2 = -1; o2 <= 1; o2 += 2)
		{
			for (int o3 = -1; o3 <= 1; o3 += 2)
			{
				for (int o4 = -1; o4 <= 1; o4 += 2)
				{
					auto tmp = solve(k, x, y, o1, o2, o3, o4);
					if (tmp.empty()) continue;
					if (ans.empty() || ans.size() > tmp.size())
						ans = tmp;
				}
			}

		}
	}
	printf("%d\n", ans.size());
	LL cx = 0;
	LL cy = 0;
	for (auto& p : ans)
	{
		LL x, y;
		cx += p.first;
		cy += p.second;
		tie(x, y) = make_pair((cx + cy) / 2, (cx - cy) / 2);
		printf("%lld %lld\n", x, y);
	}
	return 0;
}


Measured memory_bytes: 10648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define pb(v, a) v.push_back(a)
#define sz(s) (ll)s.size()
#define print(d) cout << fixed << setprecision(15) << d
#define pii pair<ll,ll>
#define ppii pair<ll,pii>
#define ff first
#define ss second
const ll MOD = 1000000007;
const ll MAXN = 1e6 + 5;
const ll inf = 2e18;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
tree_order_statistics_node_update> ord_set;
#define debug(x) cerr << #x << " = " << x << endl


ll power(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 


int main()
{
    fast
   ll h,a;
   cin >> h >> a;
   cout << (h/a)+(h%a!=0);

    return 0;

}










Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){
	int n,s[100],sum,m,i,f;
	cin>>n;
	sum=0;
	for(i=0;i<n;i++){
		cin>>s[i];
		sum+=s[i];
	}
	if(sum%10!=0) cout<<sum<<endl;
	else {
		sort(s,s+n-1);
		f=0;
		for(i=0;i<n;i++){
			sum-=s[i];
			if(sum%10!=0){
				cout<<sum<<endl;
				f=1;
				break;
			}
			sum+=s[i];
		}
		if(f==0) cout<<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    string s;
    cin >> s;
    int q;
    cin >> q;
    int sum = 0;
    deque<char> v;
    rep(i, 0, s.size())
        v.push_back(s[i]);
    while (q--)
    {
        int t;
        cin >> t;
        if (t == 1)
            sum++;
        else 
        {
            int f;
            char c;
            cin >> f >> c;
            if ((f == 1 && sum % 2 == 0) || (f == 2 && sum % 2 == 1))
                v.push_front(c);
            else
                v.push_back(c);
        }
    }
    if (sum % 2 == 1)
        reverse(begin(v), end(v));
    for (auto x:v)
        cout << x;
    // cout << v;
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
ll gcd(ll a,ll b){
	if(b==0)
	return a;
	return gcd(b,a%b);
}
string toBin(ll a) {
	string res = "";
	while (a) {
		res += char((a & 1) + '0');
		a >>= 1;
	}
	reverse(res.begin(), res.end());
	return res;
}
const int mod = 1e9+7;
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){
            ans = ans*base;
            ans = ans%mod;
        }
        base *= base;
        base%=mod;
        pow/=2;
    }
    return ans;
}
ll inv(ll x){
    return expo(x,mod-2);
}
bool isPal(string ss){
    int len = ss.length();
    for(int i = 0 ; i<len/2 ; i++){
	int comp = len-i-1;
	if(ss[i]!=ss[comp])
		return false;
	}
    return true;
}
double pi = 3.141592653589793238462643;
double error = 0.0000001;
/* -------Template ends here-------- */

const int M = 100001;

int main(){
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);

    string str;
    cin>>str;
    int ans = 0;

    int n = str.length();

    for(int i = 1 ; i<n ; i++){
        if(str[i] != str[i - 1])
            ans++;
    }
    cout<<ans;




















}














Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>

using namespace std;
typedef pair<int,bool> Pair;

int main(){

  int r;
	
  cin >> r;
	
  cout << (r*r)/(1*1) << endl;

  return 0;

}

Measured memory_bytes: 256
import numpy as np
N = int(input())
A = np.array(input().split(), dtype=np.int64)

X = (1 << np.arange(60, dtype=np.int64)) & A.reshape(-1,1)
B = np.sum(X != 0, axis=0)

total = 0

for i,count in enumerate(B):
  total += int(count) * int(N - count) * int(1 << i)

print(total % (10**9 + 7))

Measured memory_bytes: 176216
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	double tmp;
	
	while(cin >> tmp){
		if(tmp <= 48.0){
			cout << "light fly" << endl;
		} else if(tmp <= 51.0){
			cout << "fly" << endl;
		} else if(tmp <= 54.0){
			cout << "bantam" << endl;
		} else if(tmp <= 57.0){
			cout << "feather" << endl;
		} else if(tmp <= 60.0){
			cout << "light" << endl;
		} else if(tmp  <= 64.0){
			cout << "light welter" << endl;
		} else if(tmp <= 69.0){
			cout << "welter" << endl;
		} else if(tmp <= 75.0){
			cout << "light middle" << endl;
		} else if(tmp <= 81.0){
			cout << "middle" << endl;
		} else if(tmp <= 91.0){
			cout << "light heavy" << endl;
		} else {
			cout << "heavy" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
n = gets.to_i
edge = (n-1).times.map{gets.split.map(&:to_i)}
vert = (0..n).map{[]}

edge.each{|e|
  vert[e[0]] << e
  vert[e[1]] << e
}
q = [1,0,0]
while q[0]
  a,parent,parent_color = q.pop
  color = (parent_color==1)? 2 : 1
  vert[a].each{|e|
    b = (e[0]==a) ? e[1] : e[0]
    next if b == parent
    e[2] = color
    q << [b,a,color]
    color += 1
    color += 1 if color == parent_color
  }
end
colors = edge.map{|e|e[2]}
p colors.max
puts colors

Measured memory_bytes: 21300