akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

void cc(ll a,map<ll,bool>& ap,map<ll,ll>& nm,vector<ll>& c){
    if(!ap[a]){
        ap[a]=1;
        nm[a]=c.size();
        c.pb(a);
    }
}

ll n;
const ll INF=1e9+1;
vector<ll> dat(2400010,INF);

void init(ll n_){
    n=1;
    while(n<n_) n*=2;

}

void ud(ll be,ll en,ll t,ll k=0,ll l=0,ll r=n){
    if(en<=l||r<=be) return;
    if(be<=l&&r<=en){
        dat[k]=t;
        return;
    }
    ud(be,en,t,k*2+1,l,(l+r)/2);
    ud(be,en,t,k*2+2,(l+r)/2,r);
    return;
}

ll gt_sub(ll k){
    if(k==0) return dat[k];
    return min(dat[k],gt_sub((k-1)/2));
}

ll gt(ll i){
    return gt_sub(i+n-1);
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N=0,M,q,A,B,C;
    map<ll,bool> ap;map<ll,ll> nm;vector<ll> c,a;
    cin>>M>>q;
    vector<ll> d(q);
    vector<pair<ll,pair<ll,ll>>> xst;
    fr(i,M){
        cin>>A>>B>>C;
        if(B<C) continue;
        if(A<C) A=C;
        xst.emplace_back(C,mp(A,B));
        a.pb(xst[N].ft);
        if(A>C) a.pb(A-C);
        a.pb(B-C);
        N++;
    }
    sort(xst.begin(),xst.end(),greater<pair<ll,pair<ll,ll>>>());
    fr(i,q){
        cin>>d[i];
        a.pb(d[i]);
    }
    a.pb(0);
    sort(a.begin(),a.end());
    fr(i,a.size()) cc(a[i],ap,nm,c);
    init(a.size()+1);
    fr(i,N){
        ud(nm[-(xst[i].ft-xst[i].sd.ft)],nm[-(xst[i].ft-xst[i].sd.sd)],xst[i].ft);
        //fr(i,c.size()) cout<<gt(i)<<" ";
        //cout<<endl;
    }
    fr(i,q){
        ll ans=gt(nm[d[i]]);
        if(ans==INF) cout<<-1<<endl;
        else cout<<ans<<endl;
    }
}

Measured memory_bytes: 95360
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

alias Edge = Tuple!(int, "from", int, "to", int, "cost");

void main() {
    int L;
    scan(L);

    auto N = bitlen(L);
    Edge[] es;
    foreach (i ; 0 .. N - 1) {
        es ~= Edge(i, i + 1, 0);
        es ~= Edge(i, i + 1, 1 << (N - 2 - i));
    }

    foreach (i ; 0 .. N - 1) {
        if (L & (1 << i)) {
            auto mask = (1 << (i + 1)) - 1;
            mask = ~mask;
            auto c = L & mask;
            es ~= Edge(0, N - 1 - i, c);
        }
    }

    auto M = es.length;

    writefln("%s %s", N, M);
    es.each!(e => writefln("%s %s %s", e.from + 1, e.to + 1, e.cost));
}

int bitlen(int x) {
    return x > 0 ? bitlen(x >> 1) + 1 : 0;
}




void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
p = list(map(int,input().split()))
num = [(i+1) for i in p]
ans = sum(num[:k])
ch = ans
for i in range(n-k):
    ch += num[i+k] - num[i]
    ans = max(ans, ch)
print(ans/2)

Measured memory_bytes: 32376
function main(input) {
    const args = input.split('\n');
    const N = args[0];

    var money = [];

    var ans = 0;

    for(var i = 1; i <= N; i++) {
        money = args[i].split(' ');
        if(money[1] === 'JPY') {
            ans += parseFloat(money[0], 10);
        } else {
            ans += (parseFloat(money[0], 10) * 380000);
        }
    }

    console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

#define ll long long
#define fr first
#define se second
#define pb push_back

using namespace std;

const long long N = 1e5 + 7;

ll res, n, m, cnt, ans , a , b , sum , mx = -1e9 , mn, c , d;
int main()
{
    cin >> a;
    cin >> n >> m;
    for( int i = n;i <= m;i ++ ){
        if( i % a == 0 )
            return cout << "OK" , 0;
    }
    cout << "NG"; 
 }


Measured memory_bytes: 3608
a=list(map(int, input().split()))  #リスト入力

from itertools import permutations, combinations,combinations_with_replacement,product
#a=[2,4,7]
c = list(permutations(a))

i = c[0]
first = int(str(i[0])+str(i[1]))
#print(first)
x = first+i[2]
#print(x)

maxnum = 0
for i in c:
    first = int(str(i[0])+str(i[1]))
    after = i[2]
    x = first + after

    if x > maxnum:
        maxnum = x

print(maxnum)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
    using namespace std;
    #define rep(i, n) for (int i = 0; i < (int)(n); i++)
     
    int main() {
      int N,x,t;
      cin >> N;
      t = N;
      
      while ( t > 0 ) {
        x += t % 10;
        t /= 10;

        }
      if ( N % x == 0 ) {
        cout << "Yes" << endl;
      }
      else {
        cout << "No" << endl;
      }
      
    }

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int Ntw,Btw,Ctw=0,i,j;
  scanf("%d",&Ntw);
  int Atw[Ntw];
  for(i=0;i<Ntw;i++){
    scanf("%d",&Atw[i]);
  }
  i=0;
  while(i<Ntw){
    for(j=Ntw-1;j>i;j--){
      if(Atw[j]<Atw[j-1]){
	Btw=Atw[j];
	Atw[j]=Atw[j-1];
	Atw[j-1]=Btw;
	Ctw++;
      }
    }
    i++;
  }
  for(i=0;i<Ntw;i++){
    if(i>0)printf(" ");
    printf("%d",Atw[i]);
  }
  printf("\n%d\n",Ctw);
  return 0;
}



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

int main(void)
{
    using namespace std;
    int a, b;
    char op;

    int i = 0;
    while(true) {
        scanf("%d %c %d", &a, &op, &b);
        if (op == '?'){
            break;
        } else if (op == '+') {
            printf("%d\n", a + b);
        } else if (op == '-') {
            printf("%d\n", a - b);
        } else if (op == '/') {
            printf("%d\n", a / b);
        } else if (op == '*') {
            printf("%d\n", a * b);
        } else {
            printf("error\n");
        }
        i++;
        if (i > 100000000) {
            break;
        }
    }

}


Measured memory_bytes: 3196
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

using namespace std;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define INF 9223372036854775807
#define MOD 1000000007
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, temp = 0;
string s;
bool flag;

//-------------------------------------------------------------------------------

#define MAX 111111

vector<pll> edge[MAX];
ll stt[MAX];
queue<ll> que;
ll point[MAX];

ll bfs(ll start) {
  que.push(start);
  stt[start] = 1;
  point[start] = 0;

  while (!que.empty()) {
	temp = que.front();
	que.pop();

	FOR(i, 0, edge[temp].size()) {
	  ll k = edge[temp][i].first;
	  if (stt[k] == 0) {
		que.push(k);
		stt[k] = 1;
	  }
	  if (point[k] == INF) {
		point[k] = point[temp] + edge[temp][i].second;
	  }
	  else {
		if (point[temp] + edge[temp][i].second != point[k]) return 1;
	  }
	}
  }

  return 0;
}

int main(void) {
  ll a, b, c;
  cin >> n >> m;
  FOR(i, 0, m) {
	cin >> a >> b >> c;
	a--;
	b--;
	edge[a].push_back(make_pair(b, c));
	edge[b].push_back(make_pair(a, (-1)*c));
  }

  FOR(i, 0, n) {
	point[i] = INF;
  }

  a = 0;
  FOR(i, 0, n) {
	if (point[i] == INF) a = bfs(i);
	if (a == 1) {
	  cout << "No" << endl;
	  return 0;
	}
  }

  cout << "Yes" << endl;

  return 0;
}

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

int main()
{
	int n;

	cin >> n;

	while (n > 0) {
		for (int i = 0; i < n; i++) {
			int pm, pe, pj;

			cin >> pm >> pe >> pj;

			if(pm == 100 || pe == 100 || pj == 100 || pm + pe >= 180 || pm + pe + pj >= 240)
				cout << "A" << endl;
			else if (pm + pe + pj >= 210 || (pm + pe + pj >= 150 && (pm >= 80 || pe >= 80)))
				cout << "B" << endl;
			else
				cout << "C" << endl;
		}
		
		cin >> n;
	}
	
	return 0;
}



Measured memory_bytes: 3084
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n=Integer.parseInt(st.nextToken()), w=Integer.parseInt(st.nextToken());
		long[][]dp=new long[n][w+1];
		int[]ws=new int[n];
		long[]vs=new long[n];
		for(int i=0;i<n;i++){
			st=new StringTokenizer(br.readLine());
			ws[i]=Integer.parseInt(st.nextToken());
			vs[i]=Long.parseLong(st.nextToken());
		}
		dp[0][ws[0]]=vs[0];
		for(int i=1;i<n;i++){
			for(int j=0;j<=w;j++){
				dp[i][j]=dp[i-1][j];
				if(j-ws[i]>-1)dp[i][j]=Math.max(dp[i][j], vs[i]+dp[i-1][j-ws[i]]);
			}
		}
		long max=0;
		for(int i=0;i<=w;i++)max=Math.max(max,dp[n-1][i]);
		System.out.println(max);
	}
}


Measured memory_bytes: 128340
#include <bits/stdc++.h>
using namespace std;
#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 fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define viii vector <pair<ll,pair<ll,ll> > >
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<endl
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 999999999999999999
#define sp << " " <<
#define endl "\n"
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);
#define sz size()
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
void solve(){
ll k;
cin>>k;
string s,a;
cin>>s;
if(s.length()<=k){
    cout<<s<<endl;
    return;
}
else{
    a+=s.substr(0,k);
    a+="...";
    cout<<a<<endl;

}

}
int main()
{   fast;
    ll t=1;
   // cin>>t;
    fr(zz,1,t+1){
    solve();
    }
}


Measured memory_bytes: 3656
n, m, x = [int(i) for i in input().split()]

c = [0 for _ in range(n)]
A = [0 for _ in range(n)]
for i in range(n):
	line = [int(j) for j in input().split()]
	c[i] = line[0]
	A[i] = line[1:]

ans = 100111000010

for s in range(1<<n):
	alg = [0 for _ in range(m)]
	cost = 0
	judge = True
	for i in range(n):
		if s>>i&1:
			cost += c[i]
			for j in range(m):
				alg[j] += A[i][j]

	for j in range(m):
		if alg[j] < x:
			judge = False
	
	if judge:
		ans = min(cost, ans)

if not judge:
	print(-1)
else:
	print(ans)



Measured memory_bytes: 9228
#ABC161-E Yutori
"""
左から貪欲に「x回目に働くのはi日目以降」を求め、
右から同じように「x回目に働くのはi日目以前」を求める。
iが一致する場所があれば、そこは必ず働く必要がある。

入力例4では、それぞれ以下のようになる
左：1   2     3    4
　　ooxxoxoxxxoxoxxo
右： 1    2   3    4

よって、11番目の要素と16番目の要素が一致するため答えはこの2つ
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,k,c = map(int,readline().split())
s = readline().rstrip().decode('utf-8')

left = [0]*n
right = [-1]*n

i = 0
count = 1
while True:
    if count > k or i >= n:
        break
    if s[i] == "o":
        left[i] = count
        count += 1
        i += c
    i += 1

i = n-1
count = k
while True:
    if count <= 0 or i < 0:
        break
    if s[i] == "o":
        right[i] = count
        count -= 1
        i -= c
    i -= 1

for i in range(n):
    if left[i] == right[i]:
        print(i+1)

Measured memory_bytes: 51000
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
using namespace std;

int main() {
  int N;
  cin>>N;
  
  vector<int> d(N);
  for(int i=0;i<N;++i){
    cin>>d[i];
  }
  
  sort(d.begin(),d.end());
  if(d[N/2-1]!=d[N/2])
    cout<<d[N/2]-d[N/2-1]<<endl;
  else
    cout<<0<<endl;
  
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] occupied = new int[100010];
        int count = 0;
        
        for (int i = 0; i < n; i++) {
            String[] line = br.readLine().split(" ");
            for (int j = Integer.parseInt(line[0]); j <= Integer.parseInt(line[1]); j++) {
                occupied[j] = 1;
            }
        }
        
        for (int seat : occupied) {
            if (seat == 1) count++;
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 22612
#include <iostream>
using namespace std;
int main(){
  char c;
  cin >> c;
  if(c == 'A') cout << 'T' << endl;
  else if(c == 'T') cout << 'A' << endl;
  else if(c == 'C') cout << 'G' << endl;
  else if(c == 'G') cout << 'C' << endl;
}

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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  rep(i,n) {
    cin >> c[i];
    rep(j,m) {
      cin >> a[i][j];
    }
  }
  int ans = cimax;
  rep(i,1<<n) {
    vector<int> us(m, 0);
    int total = 0;
    rep(j,n) {
      if ((1<<j)&i) {
        rep(k,m) {
          us[k] += a[j][k];
        }
        total += c[j];
      }
    }
    bool judge = true;
    rep(j,m) {
      if (us[j] < x) judge = false;
    }
    if (judge) ans = min(ans, total);
  }
  if (ans == cimax) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}

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

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

  if ( (N % 500) == 0) {
    cout << "Yes" << endl;
  }
  else if ( (N % 500 - A) <= 0) {
    cout << "Yes" << endl;
  }
    else {
      cout << "No" << endl;
    }
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,x,ans;
  cin>>n>>x;
  vector<int> v(n),w(n);
  rep(i,n) cin>>v[i];
  rep(i,n) w[i]=abs(v[i]-x);
  ans=w[0];
  rep(i,n){
    ans=gcd(ans,w[i]);
  }
  cout<<ans<<endl;
}
///////////////////////////

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

int main() {
    int n, m;
    cin >> n >> m;
    int p;
    string s;
    vector<int>v(n, 0);
    int c = 0, w = 0;
    rep(i, m) {
        cin >> p >> s;
        p--;
        if (v[p] != -1) {
            if (s == "AC") {
                w += v[p];
                c++;
                v[p] = -1;
            }else{
                v[p]++;
            }
        }
    }

    cout << c << ' ';
    cout << w << endl;
    return 0;
}


Measured memory_bytes: 3720
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,m;


vector<ll> a;
vector<P> b;

void solve(){
    cin >> n >> m;
    a.resize(n,0);
    b.resize(n,P(0,0));
    rep(i,n){
        int x,y;
        cin >> x >> y;
        b[i]=P(x,y);
    }
    stable_sort(b.begin(),b.end());
    rep(i,n){
        //cout << b[i].first << " " << b[i].second << endl;
    }
    int s,k=0;
    ll ans=0;
    priority_queue<int> que;
    Rep(i,1,m+1){
        
        while (b[k].first<=i){
            que.push(b[k].second);
            //cout << "a" << b[i].second << endl;
            k+=1;
        }
        if (que.empty()) continue;
        s=que.top();que.pop();
        //cout << s << endl;
        ans+=s;
    }
    cout << ans << endl;


}

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

Measured memory_bytes: 2800
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};



int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    vector<int> a(5);
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
    lint ans = LINF;
    lint time;
    do {
        time = 0;
        for (int i=0; i<5; ++i){
            if(i == 0){
                time += a[0];
            }
            else {
                if(time % 10 == 0){
                    time += a[i];
                }
                else {
                    time += 10 - time % 10;
                    time += a[i];
                }
            }
        }
        ans = min(ans, time);
    } while(next_permutation(ALL(a)));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    Map<Integer, Set<Integer>> map = new HashMap<>();
    int[] sign;

    Queue<Integer> que = new ArrayDeque<>();

    private void run() {
        int n = sc.nextInt();
        int m = sc.nextInt();

        sign = new int[n];
        Arrays.fill(sign, -1);

        for (int i = 0; i < n; i++) {
            map.put(i, new HashSet<Integer>());
        }

        for (int i = 0; i < m; i++) {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;

            map.get(a).add(b);
            map.get(b).add(a);
        }

        que.add(0);

        while (!que.isEmpty()) {
            int i = que.poll();
            for (int next : map.get(i)) {
                // 道標がなかったらつける
                if (sign[next] == -1) {
                    sign[next] = i;
                    que.add(next);
                }
            }
        }

        for (int i = 1; i < n; i++) {
            // たどり着けないものが残っていればNo
            if (sign[i] == -1) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        for (int i = 1; i < n; i++) {
            System.out.println(sign[i] + 1);
        }
    }
}



Measured memory_bytes: 101864
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int dist[101010],par[101010];
vector<int> v[101010],inv[101010];

void dfs(int x,int p){
    par[x]=p;
    for(auto to:v[x]){
        if(to==p)continue;
        if(dist[to]==dist[x]+1){
            dfs(to,x);
        }
    }
}

int main(){
    int n,m;
    cin>>n>>m;
    rep(i,n-1+m){
        int x,y;
        cin>>x>>y;
        v[x].push_back(y);
        inv[y].push_back(x);
    }
    queue<int> que;
    vector<int> sz(n+5);
    int root;
    rep(i,n){
        sz[i+1]=inv[i+1].size();
        if(inv[i+1].empty()){
            que.push(i+1);
            root=i+1;
        }
    }
    while(!que.empty()){
        int x = que.front();que.pop();
        for(auto& to: v[x]){
            dist[to]=max(dist[x]+1, dist[to]);
            if(--sz[to] == 0)que.push(to);
        }
    }
    dfs(root,0);
    rep(i,n){
        cout<<par[i+1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 17664
#include <bits/stdc++.h>
using namespace std;
#define sc scanf
#define pr printf
 
int main(){
    int maxi = 0;
    int atual = 0;
    char ch;
    while(ch = getchar(), ch != EOF) {
        if (ch == 'A' || ch == 'T' || ch == 'G' || ch == 'C') atual++;
        else {
            maxi = max(maxi, atual);
            atual = 0;
        }
    }
 	pr("%d\n", maxi);
 	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
int main(){
  ll N;
  cin>>N;
  ll res=0;
  vector<ll>data(N);
  for(ll i=0;i<N;i++)cin>>data[i];
  for(ll d=0;d<60;d++){
    ll zero=0,one=0;
    for(ll i=0;i<N;i++){
      if(data[i]>>d&1)one++;
      else zero++;
    }
    ll tmp=(1LL<<d)%MOD;
    ll ans=(zero*one)%MOD*tmp%MOD;
    res=(res+ans)%MOD;
  }
  while(res<0)res+=MOD;
  res=res%MOD;
  cout<<res<<endl;
}

Measured memory_bytes: 5580
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	int pasta[3], juice[2];

	for (int i = 0; i < 3; i++){
		cin >> pasta[i];
	}

	for (int j = 0; j < 2; j++){
		cin >> juice[j];
	}

	sort(pasta, pasta + 3);
	sort(juice, juice + 2);

	pasta[0] = pasta[0] + juice[0] - 50;

	cout << pasta[0] << endl;
}

Measured memory_bytes: 3056
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int N, T;
	cin >> N >> T;
	vector<int> c(N);
	vector<int> t(N);
	for (int i = 0; i < N; i++)
	{
		cin >> c[i] >> t[i];
	}

	int MAX = 1 << 30; //2 の 30乗
	//答えには十分に大きな値を入れておくと良い。
	int ans = MAX;

	for (int i = 0; i < N; i++)
	{
		if (t[i] <= T) {
			ans = min(ans, c[i]);
		}
	}

	if (ans < MAX) {
		//解が見つかっているのでそのまま解を出力
		cout << ans << endl;
	}
	else {
		cout << "TLE" << endl;
	}

}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    int m=1000000007;
    int n;cin>>n;
    long long int sum=0;
    long long int A[n];
    long long int ans=0;
    for(int i=0;i<n;i++){
    	long long int x;
    	cin>>x;
    	x=x%m;
    	long long int p=(sum*x)%m;
    	ans=(ans+p)%m;
    	sum=(sum+x)%m;
	}
	cout<<ans;
    
return 0;
}


Measured memory_bytes: 3656
ans = True
S = input()
i = 0
while i < len(S):
  if S[i] == "L":
    ans = False
  i += 2
j = 1
while j < len(S):
  if S[j] == "R":
    ans = False
  j += 2
if ans:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
N, K = map(int, input().split())
x = [int(i) for i in input().split()]
ans = 10**9
for l in range(N-K+1):
  r = l + K - 1
  tmp = x[r]-x[l]
  if x[r] < 0:
    tmp += abs(x[r])
  elif x[l] < 0 and 0 <= x[r]:
    tmp += min(abs(x[l]), x[r])
  else:
    tmp += x[l]
  ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 14568
#include<stdio.h>
int main(void)
{
    int n,i=0,k,flag=0;
    char s[100];
    while((s[i]=getchar())!='\n')
        i++;
    s[i]='\0';
    n=i;
    i=0;
    k=n-1;
    while(i<k){
        if(s[i]!=s[k])
            break;
        i++;
        k--;
    }
    if(i<k)
        flag=1;
    i=0;
    k=(n-1)/2-1;
    while(i<k){
        if(s[i]!=s[k])
            break;
        i++;
        k--;
    }
    if(i<k)
        flag=1;
    if(flag==0)
        printf("Yes");
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

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

	int n;
	cin >> n;
	vector<int> x(n), y(n), c(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
		c[i] = i;
	}

	double sum = 0.0;
	int cnt = 0;
	do {
		for (int i = 0; i < n - 1; i++) {
			int x2 = pow(x[c[i]] - x[c[i + 1]], 2);
			int y2 = pow(y[c[i]] - y[c[i + 1]], 2);
			sum += sqrt(x2 + y2);
		}
		cnt++;
	} while (next_permutation(c.begin(), c.end()));

	out(sum / cnt);

	return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
#print(A)

ans = []
for i in range(H):
  for j in range(W-1):
    if A[i][j] % 2 == 1:
      A[i][j] -= 1
      A[i][j+1] += 1
      ans.append([i+1,j+1,i+1,j+2])
for i in range(H-1):
  if A[i][W-1] % 2 == 1:
    A[i][W-1] -= 1
    A[i+1][W-1] += 1
    ans.append([i+1,W,i+2,W])
print(len(ans))
for a in ans:
  print(*a)


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

void trace(vector<int> A){
    for (int i = 0; i < A.size(); i++){
        cout << A.at(i);
        if (i != A.size() - 1) cout << " ";
    }
    cout << endl;
}

void insertionSort(vector<int> &A){
    int j,v;
    for(int i = 1; i < A.size(); ++i){
        v = A.at(i);
        j = i - 1;
        while((j >= 0) && (A.at(j) > v)){
            A.at(j+1) = A.at(j);
            j--;
        }
        A.at(j+1) = v;
        trace(A);
    }
}

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A.at(i);

    trace(A);
    insertionSort(A);

    return 0;
}




Measured memory_bytes: 3128
s=input()

outsum=0

for i in range(2**(len(s)-1)):
	temps = s
	mojisum = 0
    
	for j in range(len(s)-1):
		mojisum += 1
		if (i >> j) & 1 :
			outsum += int(temps[-mojisum:])
			temps = temps[:-mojisum]
			mojisum = 0
	outsum += int(temps)

print(outsum)

Measured memory_bytes: 3060
//hinagata.cpp
//作成日
//更新日
//目的
//手段
/*includes*/
#include <bits/stdc++.h>
/*namespace*/
using namespace std;
using ll= long long;
/*define macro*/
#define REP(i,n) for(ll i=0;i<(n);i++)
#define REPi(i,a,b) for(ll i=(a);i<(b);i++)
#define REPRi(i,a,b) for(ll i=(a);i>(b);i--)
#define ALL(x) (x).begin(),(x).end()

int main(){
    string S;
    cin>>S;
    vector<int> N(4);
    REP(i,4){
        N[i]=S[i]-'0';
    }
    //input
    REP(i,1<<3){
        int val=N[0];
        REP(j,3){
            if(i&(1<<j)){
                val+=N[j+1];
            }else{
                val-=N[j+1];
            }
        }
        if(val==7){
            cout<<N[0];
            REP(j,3){
                if(i&(1<<j)){
                    cout<<"+";
                }else{
                    cout<<"-";
                }
                cout<<N[j+1];
            }
            cout<<"=7"<<endl;
            return 0;
        }

    }
}

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

int main(){
    string s,t;
    cin>>s;
    for(int i=0; i<s.size(); i++) {
        if(s[i] == '0') t += '0';
        else if(s[i] == '1') t += '1';
        else if(t.size()>0) t.pop_back();
    }
    cout<<t<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//#define _debug
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back
//#define _online_judge

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, //data type
        null_type, //
        less<int>, //
        rb_tree_tag, //red-black tree
        tree_order_statistics_node_update> new_data_set;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = static_cast<const int>(1e6 + 5);
const int MOD = 1000000007;


int main (){
	FASTIO
#ifdef _online_judge
	freopen("input.txt" , "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

    int n;
    cin >> n;
    int arr[n];
    FOR(i,0,n) cin >> arr[i];
    int ans=0;
    FORd(i,n-1,-1){
        bool flag = true;
        FORd(j,i-1,-1){
            if(arr[j] > arr[i]){
                flag = false;
                break;
            }
        }
        if(flag) ans++;
    }
    cout << ans;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
listA = [int(_) for _ in input().split()]
listA_plus = [-1 for i in range(N)]
listA_minus = [-1 for i in range(N)]
for i in range(N):
    listA_plus[i] = listA[i] + 1
    listA_minus[i] = listA[i] - 1  
list_all = listA + listA_plus + listA_minus
count = Counter(list_all)
top = count.most_common(1)
print(top[0][1])

Measured memory_bytes: 30016
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int h,w,n;
  cin>>h>>w>>n;
  cout<<(n+max(h,w)-1)/max(h,w)<<endl;
  return 0;
}


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

int main(void)
{
    int A,B;
    int array[5];
    int count = 0;
    int a,b,c,d;

    scanf("%d%d\n",&A,&B);

    for(int i = A; i <= B; i++)
    {
        array[0] = i % 10;
        a = i / 10;
        array[1] = a % 10;
        b = a / 10;
        array[2] = b % 10;
        c = b / 10;
        array[3] = c % 10;
        d = c / 10;
        array[4] = d;
        if(array[0] == array[4] && array[1] == array[3]) {
            count = count + 1;
        }
     }

    printf("%d\n",count);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int M;
int K[10];
int S[10][10];
int P[10];
int arr[10];
int main(){
  int i, j, k, mask, res=0;
  rd(N);
  rd(M);
  for(i=0;i<M;i++){
    rd(K[i]);
    for(j=0;j<K[i];j++){
      rd(k);
      S[k-1][i] = 1;
    }
  }
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<M;Lj4PdHRW++){
      rd(P[Lj4PdHRW]);
    }
  }
  for(mask=0;mask<1<<N;mask++){
    for(i=0;i<M;i++){
      arr[i] = P[i];
    }
    for(i=0;i<N;i++){
      if(mask & 1<<i){
        for(j=0;j<M;j++){
          if(S[i][j]){
            arr[j] ^= 1;
          }
        }
      }
    }
    {
      int KL2GvlyY, Q5VJL1cS;
      if(M==0){
        Q5VJL1cS = 0;
      }
      else{
        Q5VJL1cS = arr[0];
        for(KL2GvlyY=1;KL2GvlyY<M;KL2GvlyY++){
          Q5VJL1cS += arr[KL2GvlyY];
        }
      }
      k =Q5VJL1cS;
    }
    if(k==0){
      res++;
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190526-1

// --- original code ---
// int N, M;
// int K[10], S[10][10];
// int P[10];
// 
// int arr[10];
// {
//   int i, j, k, mask;
//   int res = 0;
// 
//   rd(N,M);
//   rep(i,M){
//     rd(K[i]);
//     rep(j,K[i]){
//       rd(k);
//       S[k-1][i] = 1;
//     }
//   }
//   rd(P(M));
// 
//   rep(mask, 1<<N){
//     rep(i,M) arr[i] = P[i];
//     rep(i,N) if(mask & 1<<i){
//       rep(j,M) if(S[i][j]) arr[j] ^= 1;
//     }
//     k = sum(arr(M));
//     if(k==0) res++;
//   }
//   wt(res);
// }


Measured memory_bytes: 256
const fs = require('fs')
const main = (input) => {
    const inputs = input.split("\n");
    const N = Number(inputs[0]);
    const S = inputs[1];
    if (N % 2 !== 0) {
        console.log("No");
    } else {
        console.log(S.slice(0, N/2) === S.slice(N/2, S.length) ? "Yes": "No");
    }
}
main(fs.readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 21192
#include<bits/stdc++.h>
#define F first
#define S second
#define INF 1e9
using namespace std;
typedef pair<int,int> P;
int w,h;
int mp[31][31];
bool mpj[31][31][4];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int bfs(int y,int x){
    mp[y][x]=1;
    
    queue<P> que;
    que.push(make_pair(y,x));
    while(!que.empty()){
        P p = que.front();
        que.pop();
        for(int i=0;i<4;i++){
            int nx = p.S + dx[i], ny = p.F + dy[i];
            if(nx < 0 || nx > w-1 || ny < 0 || ny > h-1 || mpj[p.F][p.S][i]==false) continue;
            if(mp[ny][nx]>mp[p.F][p.S]+1){
                mp[ny][nx]=mp[p.F][p.S]+1;
                que.push(make_pair(ny,nx));
            }
        }
    }
    
    if(mp[h-1][w-1]==INF) return 0;
    else return mp[h-1][w-1];
    
}
int main(){
    while(cin>>w>>h,w || h){
        
        for(int i=0;i<h;i++)
            for(int j=0;j<w;j++)
                for(int k=0;k<4;k++) mpj[i][j][k]=true;
        
        for(int i=0;i<h;i++)
            for(int j=0;j<w;j++) mp[i][j]=INF;
        
        int kabe;
        for(int i=0;i<h;i++){
            for(int j=0;j<w-1;j++){
                cin>>kabe;
                if(kabe){
                    mpj[i][j][0]=false;
                    mpj[i][j+1][2]=false;
                }
            }
            if(i!=h-1){
                for(int j=0;j<w;j++){
                    cin>>kabe;
                    if(kabe){
                        mpj[i][j][1]=false;
                        mpj[i+1][j][3]=false;
                    }
                }
            }
        }
        
        cout<<bfs(0,0)<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int tmp,n,i,j;
	scanf("%d",&n);
	string s;
	cin>>s;
	int ans=0;
	for(i=1;i<n;i++)
	{
		tmp=0;
		for(char c='a';c<='z';c++)
		{
			bool left=false,right=false;			
			for(j=0;j<i;j++)
				if(s[j]==c)
					left=true;
			for(j=i;j<n;j++)
				if(s[j]==c)
					right=true;
			if(left&&right)
				tmp++;
		}
		
		if(ans<tmp)
			ans=tmp;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int ans = 0;
    int i=0;
    while(ans<c){
        
        i++;
        ans += a;
        if(i%7==0)ans+=b;
        
    }
    cout<<i<<endl;
}


Measured memory_bytes: 3124
N, M = map(int, input().split())
P = list(map(int, input().split()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def same(self, x, y):
        return self.find(x) == self.find(y)

unionfind = UnionFind(N + 1)

for _ in range(M):
    x, y = map(int, input().split())
    unionfind.union(P[x - 1], P[y - 1])

ans = 0
idx = []
for i in range(N):
    if P[i] == (i + 1):
        ans += 1
    else:
        idx.append(i)
for i in idx:
    if unionfind.same(P[i], i + 1):
        ans += 1
print(ans)

Measured memory_bytes: 89836
#include<stdio.h>

int main(void){
    int n;
    int i, max, count = 1;

    scanf("%d", &n);
    int high[n];

    for(i = 0;i < n;i++){
        scanf("%d", &high[i]);
    }
    max = high[0];
    for(i = 1;i < n;i++){
        if(max == high[i]){
            count++;
        }
        else if(max < high[i]){
            count++;
            max = high[i];
        }
    }
    printf("%d\n", count);

    return 0;
}

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

int main() {
 string S,T;
 cin >> S >> T;
 
 for(int i=0;i < S.size();i++){
 
 	if( S.at(i) != T.at(i) ){
    cout << "No" << endl;
    break;
    }
    
    else if( S.at(i) == T.at(i) ){
    	
        if( i < S.size() - 1){
        continue;
        }
        
        else if( i == S.size() - 1){
        cout << "Yes" << endl;
        }
        
    }
    
 }
 
 
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, n) for (int i = 1; i <= n; i++)

typedef struct{
    int to, len;
} edge;
int n, ans[100100];
vector<edge> G[100100];
bool flg[100100];
void nya(int n){
    flg[n] = true;
    for(auto i : G[n]){
        if(!flg[i.to]){
            ans[i.to] = ans[n] ^ i.len;
            nya(i.to);
        }
    }
}
int main(){
    cin >> n;
    rep(i, n)if(i){
        int u, v, w;
        cin >> u >> v >> w;
        u--; v--;
        edge tmp;
        tmp.to = v; tmp.len = w&1;
        G[u].push_back(tmp);
        tmp.to = u;
        G[v].push_back(tmp);
    }
    ans[0] = 0;
    nya(0);
    rep(i, n)cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 11400
#include <stdio.h>

int n;
long long int memo[87] = {0};

long long int func(int m){
  if (m == 0) {
    return 2;
  }
  if (m == 1) {
    return 1;
  }
  if (memo[m] > 0) {
    return memo[m];
  }
  memo[m-1] = func(m-1);
  memo[m-2] = func(m-2);
  return memo[m-1] + memo[m-2];
}

int main(void){

  scanf("%d", &n);

  printf("%lld\n", func(n));

  return 0;
}


Measured memory_bytes: 128
/*
“Being happy doesn't mean that everything is perfect. It means
that you decided to look beyond the imperfections.”
*/

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

#define int int64_t
#define pr(x) cout << x << endl;
#define vi vector<int>
#define vii vector< vector<int> >
#define mp make_pair
#define ii pair<int,int>
#define fr(i,x,n) for(i = x ; i< n ; i++)
#define f(i,n) for(i = 0 ; i< n ; i++)
#define ff first
#define ss second
#define pb push_back
#define SIZE 200001
#define mod 1000000007
#define int_max 1e12
void solve();
 
int power(int a, int b)
{
    if(b==0) return 1;
    else if(b&1) return a*power(a*a,b/2);
    else return power(a*a, b/2);
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}
int fact(int n)
{
    int i, k=1;
    fr(i, 2, n+1) k*=i;
    return k;
}

int  j=1, n, t, dot=0, i, k, a, x, y,z,c, toko;

void solve()
{
    // cin >> t;while(t--)
    {
       string s;
       cin >> s;
       f(i,s.length())
       {
           if((i+1)&1 and s[i]=='L'){cout << "No";exit(0);}
           if((i+1)%2==0 and s[i]=='R'){cout << "No";exit(0);}
       }

       cout << "Yes";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int K;cin>>K;
    int a=(K+1)/2,b=K/2;
    cout<<a*b<<endl;
}


Measured memory_bytes: 256
<>=~$";($\+=($_[$_-1]-$_[-$_])*$.)%=$%=1e9+7,$.=$.*$_%$%*($i[$j]=($%/++$j|0)*-$i[$%%$j]%$%||1)%$%for$'..(@_=sort{$a-$b}glob`dd`);print

Measured memory_bytes: 31920
#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 = 2e5 + 10;
class BIT
{
public:
	int a[N];
	void add(int x, int val)
	{
		while (x < N)
		{
			a[x] += val;
			x += x & -x;
		}
	}
	int sum(int x)
	{
		int ret = 0;
		while (x)
		{
			ret += a[x];
			x -= x & -x;
		}
		return ret;
	}
} b;
vector<int> v[N];
vector<pair<int, int>> qr[N];
int ans[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m, q;
	scanf("%d%d%d", &n, &m, &q);
	while (m--)
	{
		int l, r;
		scanf("%d%d", &l, &r);
		v[r].push_back(l);
	}
	for (int i = 1; i <= q; i++)
	{
		int l, r;
		scanf("%d%d", &l, &r);
		qr[r].emplace_back(l, i);
	}
	for (int i = 1; i <= n; i++)
	{
		for (auto& x : v[i])
		{
			b.add(x, 1);
		}
		for (auto& p : qr[i])
		{
			int x, pos;
			tie(x, pos) = p;
			ans[pos] = b.sum(i) - b.sum(x - 1);
		}
	}
	for (int i = 1; i <= q; i++)
		printf("%d\n", ans[i]);
	return 0;
}


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

using namespace std;

int k,n,m;
char s[6000],hoge[10];
vector<string> x;

int main(void) {
    cin >> s >> k;

    for (n=1 ; n<=k ; n++) {
        for (m=0 ; s[m+n-1] != 0 ; m++) {
            strncpy(hoge,s+m,n);
            hoge[k] = 0;
            x.push_back(hoge);
        }
    }
    sort(x.begin(), x.end());
    unique(x.begin(), x.end());

    cout << x[k-1] << "\n";

}

Measured memory_bytes: 1660
n = int(input())
s = input()
white = [0 for _ in range(n+1)]
black = [0 for _ in range(n+1)]
for i in range(1, n+1):
	if s[i-1] == "#":
		white[i] = white[i-1] + 1
	else:
		white[i] = white[i-1]
for i in range(n-1, -1, -1):
	if s[i] == ".":
		black[i] = black[i+1] + 1
	else:
		black[i] = black[i+1]
print(min([b+w for b, w in zip(black, white)]))

Measured memory_bytes: 20968
from math import sqrt

N, D = map(int, input().split())
points = [list(map(int, input().split())) for i in range(N)]

counter = 0
for i in range(N):
    for j in range(i+1, N):
        dist = 0
        for it in range(D):
            dist += (points[i][it]-points[j][it])**2
        dist = sqrt(dist)

        if dist.is_integer() == True:
            counter += 1

print(counter)


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

int main(void){
  int a,b,c,num,count;
  cin >> a >> b >> c;
  count = 0;
  for (num = a; num >= a and num <= b; num++){
    if (c % num == 0){
      count = count + 1;
    }
  }
  cout << count << endl;
  return 0;
}



Measured memory_bytes: 3116
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a, b;
    double c;
    
    scanf("%d %d", &a, &b);
    
    c = (double)a / (double)b;
    
    printf("%d %d %f\n", a/b, a % b, c);
    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
#ifdef DEBUG
#define display(x) cerr << #x << " = " << (x) << endl;
#define displaya(a, st, n)\
	{cerr << #a << " = {";\
	for(int qwq = (st); qwq <= (n); ++qwq) {\
		if(qwq == (st)) cerr << ((a)[qwq]);\
		else cerr << ", " << ((a)[qwq]);\
	} cerr << "}" << endl;}
#define displayv(v) displaya(v, 0, (int)(v).size() - 1)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define display(x) ;
#define displaya(a, st, n) ;
#define displayv(v) ;
#define eprintf(...) if(0) fprintf(stderr, "...")
#endif
template<typename T> bool chmin(T &a, const T &b) { return a > b ? a = b, true : false; }
template<typename T> bool chmax(T &a, const T &b) { return a < b ? a = b, true : false; }
template<typename A, typename B>
ostream& operator << (ostream& out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}

LL solve() {
	LL n, a, b, c, d;
	cin >> n;
	cin >> a >> b >> c >> d;
	LL ans = (a + d) * 100;

	map<LL, LL> f;
	f[n] = 0;
	auto push = [&](LL v, LL c) {
		if(f.count(v)) chmin(f[v], c);
		else f[v] = c;
	};
	while(f.size()) {
		LL v = f.rbegin()->first, cost = f.rbegin()->second;
//		eprintf("%lld: %lld\n", v, cost);
		f.erase(v);
		if(v == 0) break;
		if((LL)1e15 / d >= v) chmin(ans, v * d + cost);
		push(v / 2, v % 2 * d + a + cost);
		if(v % 2 > 0 && v > 1)
			push(v / 2 + 1, (2 - v % 2) * d + a + cost);
		push(v / 3, v % 3 * d + b + cost);
		if(v % 3 > 0 && v > 1)
			push(v / 3 + 1, (3 - v % 3) * d + b + cost);
		push(v / 5, v % 5 * d + c + cost);
		if(v % 5 > 0 && v > 1)
			push(v / 5 + 1, (5 - v % 5) * d + c + cost);
	}
	return ans;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#endif
	int T; cin >> T;
	while(T--) cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 3684