akhauriyash/Code-Regression huggingface dataset:
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#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 ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) 
{
	cout << *it << " = " << a;
	nl;
	err(++it, args...);
}
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
void solveforthiscase(const int & test)
{//deb(test);
cin>>n;
vll v(n+100);
for(int i=1;i<=n;i++)
{
    cin>>v[i];
}
ll ans[n+100]={0};
for(int i=n;i>=1;i--)
{
  temp=0;
  for(int j=2*i;j<=n;j+=i)
  if(ans[j])
  temp++;
  if(temp%2==v[i]%2)
  ans[i]=0;
  else
  {ans[i]=1;a++;}
  //deb(ans[i]);
}
cout<<a;
nl;
for(int i=1;i<=n;i++)
{
    if(ans[i])
    cout<<i<<' ';
}






return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
vector<pi> v[static_cast<int>(1e5 + 5)];
int fa[static_cast<int>(1e5 + 5)];
int ans[static_cast<int>(1e5 + 5)];
int tope[static_cast<int>(1e5 + 5)];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i < n; i++) {
        int x, y;
        cin >> x >> y;
        v[x].push_back(make_pair(y, i));
        fa[y] = x;
    }
    int maxx = 0;
    for (int i = 1; i < 1e5 + 5; i++) {
        int now = 1;
        for (auto j:v[i]) {
            if (tope[i] == now) {
                ans[j.second] = now + 1;
                now++;
                tope[i]++;
            } else
                ans[j.second] = now;
            maxx = max(maxx, ans[j.second]);
            tope[j.first] = now;
            now++;
        }

    }
    cout << maxx << endl;
    for (int i = 1; i < n; i++)
        cout << ans[i] << endl;
    return 0;
}


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

int main()
{
    int arr[3];
    int counter1 = 0;
    int counter2 = 0;
    for (int i = 0; i < 3; i++) {
        cin >> arr[i];
    }
    for (int i = 0; i < 3; i++) {
        if (arr[i] == 5) {
            counter1++;
        } else if (arr[i] == 7) {
            counter2++;
        }
    }
    if (counter1 == 2 && counter2 == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

  int a,b ;

  cin>> a >> b ;

  if(a>b){
    cout<< "a > b" << endl;
  } else if(a<b){
    cout<< "a < b" << endl;
  } else{
    cout<<"a == b" << endl;
  }



  return 0;
}

Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {
	public static final int MAX = 256;

	public static void main(String[] args) {
		int i = 0, k = 0;
		char ch1 = 0;
		Scanner sc = new Scanner(System.in);
		int[] chars = new int[256];
		while (sc.hasNextLine()) {
			String line = sc.nextLine();
			for (i = 0; i < line.length(); i++) {
				char ch = Character.toLowerCase(line.charAt(i));
				chars[ch]++;
			}
		}
		for (char ch = 'a'; ch <= 'z'; ch++)
			System.out.println(ch + " : " + chars[ch]);
	}
}

Measured memory_bytes: 26112
import java.util.*;
import java.io.*;

public class Main{
	static PrintWriter out=new PrintWriter(System.out);
	public static void main (String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String[] input=br.readLine().trim().split(" ");
		
		
		int a=Integer.parseInt(input[0]);
		int b=Integer.parseInt(input[1]);
		int c=Integer.parseInt(input[2]);
		int k=Integer.parseInt(input[3]);
		
		
		out.println(maxSum(a,b,c,k));
		
		out.flush();
		out.close();
	}
	public static int maxSum(int a,int b,int c,int k)
	{
	   int ans=0;
	   if(a>=k){
	       ans+=k;
	   }
	   else{
	       ans+=a;
	       k-=a;
	       if(b>=k){
	           
	       }
	       else{
	           k-=b;
	           ans-=k;
	       }
	   }
	   return ans;
	}
}

Measured memory_bytes: 25320
from itertools import combinations_with_replacement
def main():
    n,m,q=map(int,input().split())
    ABCD=[list(map(int,input().split())) for _ in range(q)]
    ans=0
    L=list(range(1,m+1))
    for Q in combinations_with_replacement(L,n):
        Q=list(sorted(Q))
        tmp=0
        for a,b,c,d in ABCD:
            if Q[b-1]-Q[a-1]==c:
                tmp+=d
        ans=max(ans,tmp)
    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 68404
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  string x,y;
  cin >> x >> y;
  if(x > y) cout << ">" << endl;
  else if(x == y) cout << "=" << endl;
  else cout << "<" << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007  PLEASE!! PLEASE!! HACK MY SOLUTION!!
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int X = in.nextInt();
            int t = in.nextInt();
            out.println(Math.max(0, X - t));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21332
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max({a * c, b * d, a * d, b * c}) << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    vector<int> a(3);
    rep(i, 3)
    {
        cin >> a[i];
    }
    SORT(a);
    cout << a[0] + a[1] + a[2] * 10 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,a;
    cin>>h>>a;
    if(h%a==0){
        cout<<h/a;
    }
    else
    {
        cout<<h/a+1<<'\n';
    }
    
    return(0);
}

Measured memory_bytes: 256
/* blog: https://misteer.hatenablog.com/entry/JSC2019-qual-D */

#include <iostream>
#include <vector>
#include <functional>

using namespace std;

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

    vector<vector<int>> ans(N, vector<int>(N, -1));

    // 頂点集合[l, r)からなるクリークにd以上を割り当てる
    function<void(int, int, int)> dfs =
        [&](int l, int r, int d) {
            if (r - l <= 1) return;

            int m = (l + r) / 2;
            // [l, m)と[m, r)に分割して完全に部グラフを構築
            for (int i = l; i < m; ++i) {
                for (int j = m; j < r; ++j) {
                    ans[i][j] = d;
                }
            }

            dfs(l, m, d + 1);
            dfs(m, r, d + 1);
        };
    dfs(0, N, 1);

    for (int v = 0; v < N; ++v) {
        for (int u = v + 1; u < N; ++u) {
            cout << ans[v][u] << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1536
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<string,int>mp;
int main()
{
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int cnt=0;
    int maxx=0;
    string s;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        int p=mp[s]++;
        p++;
        if(p>maxx)
            maxx=p;
 
    }
    map<string,int>::iterator it;
    for(it= mp.begin();it!=mp.end();it++)
    {
        if(it->second==maxx)
            cout<<it->first<<endl;
    }
 
 
}

Measured memory_bytes: 23808
s = [int(i) for i in list(input())]
strings = []
for i in range(len(s)-2):
    ans = s[i]*100 + s[i+1]*10 + s[i+2] - 753
    ans = ans if ans >= 0 else ans*-1
    strings.append(ans)
print(min(strings))


Measured memory_bytes: 3060
def prime_decomposition(n):
    prime_factors = []
    if n < 2:
        return prime_factors
    while n >= 2 and n % 2 == 0:
        prime_factors.append(2)
        n //= 2
    i = 3
    while i * i <= n:
        if n % i == 0:
            prime_factors.append(i)
            n //= i
        else:
            i += 2
    if n > 1:
        prime_factors.append(n)
    return prime_factors

n = int(input())
print(str(n)+':',*prime_decomposition(n))

Measured memory_bytes: 7756
import numpy as np
import math
s = input().split(" ")
s = [int(s[i]) for i in range(len(s))]
taxIncludedPrice = s[0]

# taxIncludedPrice = int(price * 1.08) <= price * 1.08
# price >= taxIncludedPrice / 1.08
# price * 1.08 - 1 < taxIncludedPrice
# price < (taxIncludedPrice + 1) / 1.08

minPrice = taxIncludedPrice / 1.08
maxPrice = (taxIncludedPrice + 1) / 1.08
fromPrice = math.ceil(minPrice)
toPrice = math.floor(maxPrice)


def getPrice(fromPrice, toPrice):
    for price in range(fromPrice, toPrice + 1):
        if fromPrice >= minPrice and fromPrice < maxPrice:
            return price
        elif toPrice >= minPrice and toPrice < maxPrice:
            return price
    return ":("


print(getPrice(fromPrice, toPrice))


Measured memory_bytes: 21408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
const ll MOD = 1000000007;
struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }
	int root(int x) {
		if (par[x] < 0) return x;
		return par[x] = root(par[x]);
	}
	bool issame(int x, int y) { return root(x) == root(y); }
	bool merge(int x, int y) {
		x = root(x), y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}
	int size(int x) { return -par[root(x)]; }
};
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	UnionFind tree(n);
	while (q--) {
		int a, b, c;
		scanf("%d%d", &a, &b);
		a--, b--;
		tree.merge(a, b);
	}
	int ans = 0;
	for (auto t : tree.par) ans = min(ans, t);
	ans *= -1;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
    char s[10];
    scanf("%s", s);
    int len = strlen(s);
    for (int i = 0; i < len-1; ++i) {
        if (s[i] =='A' && s[i+1] == 'C')
        {

            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 256
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

S = LS2()
A = ['A','T','C','G']
a = 0
ans = 0
for i in range(len(S)):
    if S[i] in A:
        a += 1
    else:
        ans = max(ans,a)
        a = 0

ans = max(ans,a)

print(ans)


Measured memory_bytes: 61588
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>

using namespace std;

bool v[1024][20][20][101];
char map[20][21];

typedef struct {
	int tx, ty;
	int bit;
	int time;
	int score;
} Move;

int main(void)
{
	int x, y;
	int ans;
	int n;
	int idx, plus[10], s[10], e[10];
	int dx[] = {1, 0, -1, 0, 0};
	int dy[] = {0, 1, 0, -1, 0};
	Move st;
	
	while (scanf("%d %d", &x, &y) && x){
		for (int i = 0; i < y; i++){
			for (int j = 0; j < x; j++){
				cin >> map[i][j];
				if (map[i][j] == '.'){
					map[i][j] = -1;
				}
				else if (map[i][j] == 'P'){
					map[i][j] = -1;
					st.ty = i;
					st.tx = j;
				}
				else {
					map[i][j] -= '0';
				}
			}
		}
		
		scanf("%d", &n);
		
		for (int i = 0; i < n; i++){
			scanf("%d", &idx);
			scanf("%d %d %d", &plus[idx], &s[idx], &e[idx]);
		}
		
		memset(v, 0, sizeof(v));
		st.time = st.score = st.bit = 0;
		ans = 0;
		
		queue<Move> que;
		
		v[0][st.ty][st.tx][0] = true;
		
		que.push(st);
		
		while (!que.empty()){
			Move temp = que.front();
			que.pop();
			if (temp.time > 100){
				break;
			}
			
			for (int i = 0; i < 4; i++){
				int mx = temp.tx + dx[i], my = temp.ty + dy[i];
				if (0 <= mx && mx < x && 0 <= my && my < y && ~map[my][mx]
						&& s[map[my][mx]] <= temp.time && temp.time < e[map[my][mx]]){
					if (!((temp.bit >> map[my][mx]) & 1)){
						temp.score += plus[map[my][mx]];
					}
					temp.bit |= (1 << map[my][mx]);
	
				}
			}
			
			ans = max(ans, temp.score);
			
			for (int i = 0; i < 5; i++){
				int mx = temp.tx + dx[i], my = temp.ty + dy[i];
				if (0 <= mx && mx < x && 0 <= my && my < y){
					if (map[my][mx] == -1 && v[temp.bit][my][mx][temp.time + 1] == false){
						st = temp;
						st.time++;
						st.tx = mx, st.ty = my;
						v[st.bit][st.ty][st.tx][st.time] = true;
						que.push(st);
					}
				}
			}
		}
		
		printf("%d\n", ans);
	}
		
	return (0);
}

Measured memory_bytes: 41000
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define FIFO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MOD 1000000007
#define mods 1000000009
#define modhash1 1000000009
#define modhash2 1000000007
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
int TestMillerRabin[12] = {2,3,5,7,11,13,17,19,23,29,31,37};
ll mulmod(ll a, ll b, ll p){
	ll x = 0, y = a%p;
	while(b>0){
		if(b%2==1) x = (x+y)%p;
		y = (1LL*y*2)%p;
		b = b/2;
	}
	return x%p;
}
ll fastexp(ll x, ll y, ll p){
	ll ans = 1;
	while(y > 0){
		if(y&1) ans = (1LL*ans*x)%p;
		y = y>>1;
		x = (1LL*x*x)%p;
	}
	return ans%p;
}
ll fastexpp(ll x, ll y, ll p){
	ll ans = 1;
	while(y > 0){
		if(y&1) ans = mulmod(ans,x,p);
		y = y>>1;
		x = mulmod(x,x,p);
	}
	return ans%p;
}
ll invmod(ll x, ll p){
	return fastexp(x,p-2,p)%p;
}
bool check_composite(ll n, ll a, ll d, int s){
	ll x = fastexp(a,d,n);
	if(x == 1 || x == n-1) return false;
	for(int r=1; r<s; r++){
		x = (1LL*x*x)%n;
		if(x == n-1) return false;
	}
	return true;
}
bool isPrime(ll p){
	if(p<=1) return false;
	int r = 0;
	ll d = p-1;
	while(!(d&1)){
		d >>= 1;
		r++;
	}
	for(int i=0; i<12; i++){
		int value = TestMillerRabin[i];
		if(p == value) return true;
		if(check_composite(p,value,d,r)) return false;
	}
	return true;
}

int main(){
	int n;
	cin >> n;
	int ans = (n+999)/1000;
	cout << 1000*ans-n;
	return 0;
}


Measured memory_bytes: 3508
n,q=map(int,input().split())
c=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(q)]
for i in range(q):
  l[i].append(i)
l.sort(key=lambda x:x[1])

L=[-1]*(5*10**5+1)

class Bit:
  def __init__(self,n):
    self.size=n
    self.tree=[0]*(n + 1)
    self.depth=n.bit_length()

  def sum(self,i):
    s=0
    while i>0:
      s+=self.tree[i]
      i-=i&-i
    return s

  def add(self,i,x):
    while i<=self.size:
      self.tree[i]+=x
      i+=i&-i

BIT=Bit(n+1)

ans=[0]*q
ct=0
for i in range(q):
  while ct<=l[i][1]:
    if L[c[ct-1]-1]!=-1:
      BIT.add(L[c[ct-1]-1],-1)
    L[c[ct-1]-1]=ct+1
    BIT.add(ct+1,1)
    ct+=1
  ans[l[i][2]]=BIT.sum(l[i][1]+1)-BIT.sum(l[i][0])

for i in range(q):
  print(ans[i])

Measured memory_bytes: 245224
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

		Map<Character, String> hash = new HashMap<Character, String>();
		hash.put('1', "");
		hash.put('2', "k");
		hash.put('3', "s");
		hash.put('4', "t");
		hash.put('5', "n");
		hash.put('6', "h");
		hash.put('7', "m");
		hash.put('8', "y");
		hash.put('9', "r");
		hash.put('0', "w");
		hash.put('T', "a");
		hash.put('U', "u");
		hash.put('D', "o");
		hash.put('R', "e");
		hash.put('L', "i");
		char[] cs = sc.next().toCharArray();
		for (int i = 0; i < cs.length; i++) {
			if (i % 2 == 0) {
				if (cs[i] == '0' && cs[i + 1] == 'U') {
					System.out.print("");
				} else
					System.out.print(hash.get(cs[i]));
			} else {
				if (cs[i - 1] == '0' && cs[i] == 'U') {
					System.out.print("nn");
				} else
					System.out.print(hash.get(cs[i]));
			}
		}
		System.out.print("\n");
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define INF 105

int sx,sy,tx,ty;

char side(int x)
{
    if(x==1) return 'R';
    if(x==2) return 'U';
    if(x==3) return 'L';
    if(x==4) return 'D';
}

void output(int a,int b,int c,int d)
{
    for(int i=0;i<abs(tx-sx);i++)
    {
        cout << side(a);
    }
    for(int i=0;i<abs(ty-sy);i++)
    {
        cout << side(b);
    }
    for(int i=0;i<abs(tx-sx);i++)
    {
        cout << side(c);
    }
    for(int i=0;i<abs(ty-sy);i++)
    {
        cout << side(d);
    }
    cout << side(d);
    for(int i=0;i<abs(tx-sx)+1;i++)
    {
        cout << side(a);
    }
    for(int i=0;i<abs(ty-sy)+1;i++)
    {
        cout << side(b);
    }
    cout << side(c);
    cout << side(b);
    for(int i=0;i<abs(tx-sx)+1;i++)
    {
        cout << side(c);
    }
    for(int i=0;i<abs(ty-sy)+1;i++)
    {
        cout << side(d);
    }
    cout << side(a) << endl;
}

void output2(int a,int b,int c,int d)
{
    for(int i=0;i<abs(tx-sx);i++)
    {
        cout << side(a);
    }
    cout << side(b);
    for(int i=0;i<abs(tx-sx);i++)
    {
        cout << side(c);
    }
    cout << side(d);
    cout << side(d);
    for(int i=0;i<abs(tx-sx);i++)
    {
        cout << side(a);
    }
    cout << side(b) << side(a) << side(b) << side(b);
    for(int i=0;i<abs(tx-sx)+2;i++)
    {
        cout << side(c);
    }
    cout << side(d) << side(d) << side(a) << endl;
}

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	scanf("%d%d%d%d",&sx,&sy,&tx,&ty);
	if(sx<tx && sy<ty)
	{
        output(1,2,3,4);
	}else
	if(sx<tx && sy>ty)
	{
        output(1,4,3,2);
	}else
	if(sx>tx && sy<ty)
	{
        output(3,2,1,4);
	}else
	if(sx>tx && sy>ty)
	{
        output(3,4,1,2);
	}else
	if(sx<tx && sy==ty)
	{
        output2(1,2,3,4);
	}else
	if(sx>tx && sy==ty)
	{
        output2(3,2,1,4);
	}else
	if(sx==tx && sy<ty)
	{
        sx=sy;
        tx=ty;
        output2(2,3,4,1);
	}else
	if(sx==tx && sy>ty)
	{
        sx=sy;
        tx=ty;
        output2(4,3,2,1);
	}
}


Measured memory_bytes: 256
if __name__ == "__main__":
    # 反転すれば接頭辞(prefix)が互いに異なる
    # 参考：語頭符号
    S = input()
    S = S[::-1]
    while True:
        if S == '':
            print("YES")
            break
        elif S.startswith('dreamer'[::-1]):
            S = S[7:]
        elif S.startswith('eraser'[::-1]):
            S = S[6:]
        elif S.startswith('dream'[::-1]) or S.startswith('erase'[::-1]):
            S = S[5:]
        else:
            print("NO")
            break

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

  int n,fibo[100],i;
  fibo[0] = fibo[1] = 1;

  scanf("%d",&n);

  for(i = 2; i <= n; i++) fibo[i] = fibo[i-1] + fibo[i-2];

  printf("%d\n",fibo[n]);

  return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

vector<int> alpha[30];

int main(void) {
    string s,t;
    cin>>s>>t;
    Int N = s.size();
    map<char,int> ms;

    for(int i = 0;i < s.size();i++) {
        ms[s[i]]++;
        alpha[s[i]-'a'].push_back(i+1);
    }

    for(auto it : t) {
        if(ms.find(it) == ms.end()) {
            cout<<-1<<endl;

            return 0;
        }
    }

    Int length = 0;
    for(int i = 0;i < t.size();) {
        Int prev_num = 0;
        Int num = 0;
        
        while(true) {
            int index = t[i]-'a';
            auto itr = upper_bound(alpha[index].begin(),alpha[index].end(),num);
            if(itr == alpha[index].end()) {
                length += (N-num);
                break;
            }
            num = *itr;
            length += (num-prev_num);
            prev_num = num;
            i++;
            if(i >= t.size()) {
                break;
            }
            
        }

    }
    
    cout<<length<<endl;

    return 0;
}


Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
int main()	{
    int a,b;
    cin>>a>>b;
    rep(n,1250){
        int na=n*8/100;
        int nb=n*10/100;
        if(na==a && nb==b){
        cout<<n<<endl;
        return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest105-B
#  https://beta.atcoder.jp/contests/abc087/tasks/abc105_B

def  existCheck(cakePrice,donutPrice,total):
	buyPattern = "No"
	cakeRange = range(0,(total//cakePrice)+1)
	donutRange = range(0,(total//donutPrice)+1)
	for cake in cakeRange:
		totalPrice = 0
		for donut in donutRange:
			if total-cakePrice*cake-donutPrice*donut == 0:
				buyPattern = "Yes"
				break

	answer = buyPattern
	return answer


if __name__ == '__main__':
	total = int(input())
	cakePrice = 4
	donutPrice = 7
	solution=existCheck(cakePrice,donutPrice,total)
	print(solution)

Measured memory_bytes: 3064
#![allow(unused_imports)]
use std::io;
use std::cmp::*;
use std::collections::*;
#[allow(dead_code)]
const M: i64 = 1e9 as i64 + 7;

fn read_line() -> String {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf
}
#[allow(dead_code)]
fn read<T>() -> T where T: std::str::FromStr, T::Err : std::fmt::Debug {
    read_line().trim().parse().unwrap()
}
#[allow(dead_code)]
fn readv<T>() -> Vec<T> where T: std::str::FromStr, T::Err : std::fmt::Debug {
    read_line().split(' ').map(|a| a.trim().parse().unwrap()).collect()
}

fn main() {
    let n: u32 = read();
    let mut acc = 0;
    let mut mini = 1000;
    for _ in 0..n {
        let s = read();
        if s % 10 != 0 {
            mini = min(mini, s);
        }
        acc += s;
    }
    if acc % 10 != 0 {
        println!("{}", acc);
    } else if mini != 1000 {
        println!("{}", acc - mini);
    } else {
        println!("{}", 0);
    }
}


Measured memory_bytes: 4352
N = int(input())
mem = [100 for i in range(26)]
for i in range(N):
    s = input()
    arr = [0 for i in range(26)]
    for c in s:
        ci = ord(c) - ord('a')
        arr[ci] += 1
    for i in range(26):
        mem[i] = min(mem[i], arr[i])

ans = ''
for i in range(26):
    c = chr(i + ord('a'))
    ans += c * mem[i]
print(ans)


Measured memory_bytes: 3064
n, r = map(int, input().split())
while n != 0:
        hanafuda = list(range(1,n+1))[::-1]
        for _ in range(r):
                p, c = map(int, input().split())
                hanafuda = hanafuda[p-1:p+c-1] + hanafuda[:p-1] + hanafuda[p+c-1:]
        print(hanafuda[0])
        n, r = map(int, input().split())


Measured memory_bytes: 5612
n = int(input())
l = [0] * (n+1)
l[0] = 2
l[1] = 1

if n == 1:
    ans = l[1]
else:
    for i in range(2, n+1):
        l[i] = l[i-1] + l[i-2]
    ans = l[-1]
print(ans)

Measured memory_bytes: 9032
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

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


int main(){fastio
    ll n;cin>>n;
    cout<<n*(n-1)/2<<endl;
    
    return 0;
}


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

using namespace std;
using ll =long long;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
using P = pair<int,int>;
//Write From this Line

int main()
{
	string a;
	cin >> a;
	vector<int> count(26,0);
	rep(i,a.size()){
		count[a[i]-'a']++;
	}

	ll ans = 1;
	rep(i,26){
		ll now = count[i];
		For(j,i+1,26){
			ans += now * count[j];
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200005;
int n;
ll a[N];
int cnt[N][25], num[25];
int main(){
    ll ans = 0;
    scanf("%d", &n);
    for(int i = 1; i <= n; ++i){
        scanf("%lld", &a[i]);
    }
    for(int i = 1; i <= n; ++i){
        ll x = a[i];
        for(int j = 0; j <= 20; ++j){
            if(x & (1<<j)){
                cnt[i][j]++;
            }
        }
    }
    int l = 1, r = 1;
    while(r <= n){
        while(r <= n){
            bool flag = true;
            for(int i = 0; i <= 20; ++i){
                num[i] += cnt[r][i];
                if(num[i] > 1) flag = false;
            }
             //cout << flag << " " << l << " " << r << " -:";
            //for(int i = 0; i <= 20; ++i) cout << num[i] << " ";
            //cout << endl;
            if(!flag) break;
            else{
                ans += (r - l + 1);
                r++;
            }
        }
        if(r > n) break;
        while(l <= r){
            bool flag = true;
            for(int i = 0; i <= 20; ++i){
                num[i] -= cnt[l][i];
                if(num[i] > 1) flag = false;
            }
              //cout << flag << " " << l << " " << r << " +:";
            //for(int i = 0; i <= 20; ++i) cout << num[i] << " ";
            //cout << endl;
            if(!flag){
                l++;
            }else{
                l++;
                for(int i = 0; i <= 20; ++i) num[i] -= cnt[r][i];
                break;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 21376
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;



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

  vector<ll> preb(9);
  rep(i, 9){
    preb[i] = i+1;
  }

  vector<ll> runrun = preb;
  while(runrun.size() < k){
    vector<ll> next;
    for(ll p: preb){
      ll l = p % 10;
      p *= 10;
      for(int d=-1;d<=1;d++){
        ll nl = l + d;
        if (nl < 0 or nl > 9) continue;
        nl += p;
        next.push_back(nl);
        runrun.push_back(nl);
      }
    }
    preb = next;
  }

  cout << runrun[k-1] << endl;
  return 0;
}

Measured memory_bytes: 5520
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 998244353;
#define all(v) v.begin(), v.end()

int main(){
  ll A,B,C,D;
  cin >> A >> B >> C >> D;
  vector<vector<ll>> dp(C-A+1,vector<ll>(D-B+1,0));
  dp.at(0).at(0)=1;
  rep(i,C-A+1){
    rep(j,D-B+1){
      if(i!=0&&j!=0){
        dp.at(i).at(j)=dp.at(i-1).at(j)*(B+j);
        dp.at(i).at(j)+=dp.at(i).at(j-1)*(A+i);
        dp.at(i).at(j)+=MOD;
        ll a=dp.at(i-1).at(j-1)*(A+i-1)*(B+j-1);
        a%=MOD;
        dp.at(i).at(j)-=a;
        dp.at(i).at(j)%=MOD;
      }else if(i!=0){
        dp.at(i).at(j)=dp.at(i-1).at(j)*B;
        dp.at(i).at(j)%=MOD;
      }else if(j!=0){
        dp.at(i).at(j)=dp.at(i).at(j-1)*A;
        dp.at(i).at(j)%=MOD;
      }
    }
  }
  cout << dp.at(C-A).at(D-B) << endl;
}


Measured memory_bytes: 73652
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;


int main(){
    int n; cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    sort(d.begin(), d.end());
    int ans=0;
    int a = d.size();
    for(int i=d[a/2-1]; i < d[a/2]; i++){
        ans++;
    }
    cout << ans;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<stdlib.h>
#include<queue>
#include<map>
#include<vector>
#include<cmath>
#include<fstream>
#include <set>
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
const int  MAXN =1e6+10;
const int mod = 1e9 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf= 0x3f3f3f3f;
#define eps 1e-8
#define PI 3.1415926535898
#define lowbit(x) (x&(-x))
using namespace std ;
//getline(cin,s);
//set<ll>::iterator it;
//map<int,int>::iterator it;
typedef long long ll;
int n,a[MAXN];
unordered_map<int,int>mp;
//map<int,int>mp;
//TLE了 可能思路：每个数*一个数的形式 判断所得的num 然后与n比较 
int main()
{
	scanf("%d",&n);int ans=0,max1=0;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),mp[a[i]]++,max1=max(max1,a[i]);
	for(int i=2;i<=1000000;i++)
	{
		int num=0;
		for(int j=i;j<=1000000;j+=i)
		{
			num+=mp[j];
		}
		ans=max(num,ans);
	}
	if(ans==1||mp[1]==n) printf("pairwise coprime\n");
	else if(ans<n) printf("setwise coprime\n");
	else printf("not coprime\n");
	return 0;
} 

Measured memory_bytes: 46572
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}

//vc alp(26) ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  ll X,A,B;cin>>X>>A>>B;
  cout<<(X-A)%B<<endl;
 
}







Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,m,a[N],b[N],ans,x,y;
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)a[i]=1;
	b[1]=1;
	while (m--){
		scanf("%d%d",&x,&y);
		b[y]|=b[x];
		if (a[x]==1)b[x]=0;
		a[x]--;a[y]++;
	}
	for (int i=1;i<=n;i++)
		ans+=b[i];
	printf("%d\n",ans);	
}

Measured memory_bytes: 1024
#include<cstdio>
int n,m,d,i,j,x,y,o;
const char p[]={'R','Y','G','B'};
int main(){
	scanf("%d%d%d",&n,&m,&d);
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			x=i+j+m;
			y=i-j+m;
			o=x/d%2*2+y/d%2;
			printf("%c",p[o]);
		}
		printf("\n");
	}
	//while(1);
}


Measured memory_bytes: 384
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;
const int N = 100000 + 5;

int a[N];

int main(){
    int n, x;
    memset(a, 0, sizeof(a));
    scanf("%d", &n);
    int maxn = 0;
    for(int i = 0; i < n; i++){
        scanf("%d", &x);
        a[x]++;
        if(x > maxn) maxn = x;
    }
    int ans = 0;
    for(int i = 0; i <= maxn; i++){
        if(a[i] > ans) ans = a[i];
    }
    for(int i = 0; i <= maxn; i++){
        if(a[i] + a[i+1] > ans) ans = a[i] + a[i+1];
    }
    for(int i = 0; i <= maxn; i++){
        if(a[i]+ a[i + 2] + a[i + 1] > ans) ans = a[i] + a[i+1] + a[i+2];
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 640
import java.util.*;
import java.lang.*;
import java.io.*;
 
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int ans = 0;
		if(n==m){
			System.out.println(n);
		} else if(n<m){
				System.out.println(n);
		} else System.out.println(n-1);
		// your code goes here
	}
}


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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

int N, M;
Graph G(100100, vector<int>());
vector<ll> dp(100100);

ll rec(int v) {
    if (G.at(v).empty()) return 0;
    if (dp.at(v) != 0) return dp.at(v);

    ll ret = 0;

    for (auto nv : G[v]) {
        chmax(ret, rec(nv));
    }
    return dp.at(v) = ret + 1;
}

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

    cin >> N >> M;

    REP(i, M) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
    }

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        chmax(ans, rec(i));
    }

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

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

typedef long long ll;

int main() {
	int a;
	cin >> a;
	int b = a/100;
	if (b * 111 < a) {
		cout << (b+1)*111 << endl;
	} else {
		cout << b * 111 << endl;
	}
}

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>

using namespace std;

int main() {
	string S, T;
	cin >> S;
	cin >> T;
	if (memcmp(S.c_str(),T.c_str(),S.length()) == 0) cout << "Yes"; else cout << "No";
	cout << endl;
	return 0;
}

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

int main()
{
    string s;
    cin >> s;
    

    for(int i = 0; i < s.size(); i++)
    {
        if(i % 2 == 0)
        {
            cout << s.at(i);
        }
    }

    cout << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y, int z){
    int r;
    // ユーグリッドの互除法
    while((r = x % y) != 0)  // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    int l;
    while((l = y % z) != 0){
        y =z;
        z = l;
    }
    return z;
}
int main(){
    int k;
    cin>>k;
    int sum=0;
    for(int a=1; a<=k; a++){
        for(int b=1; b<=k; b++){
            for(int c=1; c<=k; c++){
                int t=0;
                t=gcd(a,b,c);
                sum=sum+t;
            }
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<climits>

using ll = long long;
const ll INF = LONG_MAX;

int main(){
    int N;
    std::cin >> N;
    std::vector<int> slime(N);
    std::vector<ll> sum(N + 1, 0); // 累積和sum[i] : slime[i - 1]までの和
    for(int i = 0; i < N; i++){
        std::cin >> slime[i];
    }
    sum[1] = slime[0];
    for(int i = 2; i <= N; i++){
        sum[i] += sum[i - 1] + slime[i - 1];
    }

    // dp[i][j] : i ~ j番目のスライムについて合体させていったときの最小コスト
    std::vector<std::vector<ll>> dp(N, std::vector<ll>(N, INF));
    for(int i = 0; i < N; i++) dp[i][i] = 0;

    for(int offset = 1; offset < N; offset++){
        for(int l = 0; l < N; l++){
            int r = l + offset;
            if(r > N - 1) continue;

            for(int mid = l; mid < r; mid++){
                // sum[r] - sum[l - 1]は[l, r]に含まれる値の和
                dp[l][r] = std::min(dp[l][r], dp[l][mid] + dp[mid + 1][r] + sum[r + 1] - sum[l]);
            }
        }
    }    

    std::cout << dp[0][N - 1] << std::endl;
    return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String b = sc.next();
        if (b.equals("A")) {
            System.out.println("T");
        } else if (b.equals("T")) {
            System.out.println("A");
        } else if (b.equals("C")) {
            System.out.println("G");
        } else if (b.equals("G")) {
            System.out.println("C");
        }
    }
}


Measured memory_bytes: 21972
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1<<30;
	Stone[][] stones;
	int n;
	int m;
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			n= sc.nextInt();
			m =sc.nextInt();
			if( (n|m) == 0 ) break;
			stones = new Stone[n+2][];
			for(int i=1;i<=n;i++) {
				int k = sc.nextInt();
				stones[i] = new Stone[k];
				for(int j=0;j<k;j++) {
					int x = sc.nextInt();
					int d = sc.nextInt();
					stones[i][j] = new Stone(x, d);
				}
			}
			stones[0] = new Stone[stones[1].length + stones[2].length];
			for(int i=0;i<stones[1].length;i++) {
				stones[0][i] = new Stone(stones[1][i].p, stones[1][i].d);
				stones[0][i].min[0] = 0;
			}
			for(int i=0;i<stones[2].length;i++) {
				stones[0][i+stones[1].length] = new Stone(stones[2][i].p, stones[2][i].d);
				stones[0][i+stones[1].length].min[0] = 0;
			}
			stones[n+1] = new Stone[stones[n].length + stones[n-1].length];
			for(int i=0;i<stones[n].length;i++) {
				stones[n+1][i] = new Stone(stones[n][i].p, stones[n][i].d);
			}
			for(int i=0;i<stones[n-1].length;i++) {
				stones[n+1][i+stones[n].length] = new Stone(stones[n-1][i].p, stones[n-1][i].d);
			}	
						
			for(int i=1;i<n+2;i++) {
				for(int j=0;j<stones[i].length;j++) {
					for(int k=0;k<=m;k++) for(int l=0;l<stones[i-1].length;l++){
						stones[i][j].min[k] = min( stones[i][j].min[k], stones[i-1][l].min[k] 
						                      + abs( stones[i][j].p - stones[i-1][l].p)
						                      * ( stones[i][j].d + stones[i-1][l].d ) );
					}
					if( i==1 ) {
//						debug(stones[i][j].min);
						continue;
					}
					for(int k=1;k<=m;k++) for(int l=0;l<stones[i-2].length;l++){
						stones[i][j].min[k] = min( stones[i][j].min[k], stones[i-2][l].min[k-1] 
						                           + abs( stones[i][j].p - stones[i-2][l].p)
						                    	   * ( stones[i][j].d + stones[i-2][l].d ) );
					}
//					debug(stones[i][j].min);
				}
			}
			int min = INF;
			for(int j=0;j<stones[n+1].length;j++) for(int i=0;i<=m;i++) {
				min = min(min, stones[n+1][j].min[i]);
			}
			System.out.println(min);
		}
	}
	
	class Stone {
		int p;
		int d;
		int[] min;
		Stone(int p, int d) {
			this.p = p;
			this.d = d;
			min = new int[m+1];
			fill(min, INF);
		}
		
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 14000
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for i in range(N):
  A = list(map(int, input().split()))
  tmp = 0
  for j in range(M):
    tmp += A[j] * B[j]
  if tmp > -C:
    ans += 1
print(ans)

Measured memory_bytes: 9180
n,k=map(int,input().split())
p=list(map(int,input().split()))
dp=[0]*n
s=0
for i in range(n):
    p[i]=(p[i]+1)/2
    if i<=k-1:
        s+=p[i]
        if i==k-1:
            dp[i]=s
    else:
        s=s-p[i-k]+p[i]
        dp[i]=max(s,dp[i-1])
print(dp[n-1])

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

int main(){
    int n,k;
    cin>>n>>k;
    if(k==1)cout<<0;
    else cout<<(n-k);
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ok = [False] * N
nac = 0
wa = [0] * N
nwa = 0
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if ok[p]:
        continue
    else:
        if s == "AC":
            nac += 1
            ok[p] = True
            nwa += wa[p]
        else:
            wa[p] += 1
print(nac, nwa)

Measured memory_bytes: 4596
use std::cmp::max;
use std::cmp::min;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let t :Vec<i32> = s.trim().split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect();

    let (a,b,c,x,y) = (t[0], t[1], t[2], t[3], t[4]);

    let n = 2*max(x,y);
    let mut ans = i32::max_value();
    for i in 0..n+1{
        let mut tmp = i*c;
        let rem_a = max(x-i/2, 0);
        let rem_b = max(y-i/2, 0);
        tmp += a*rem_a + b*rem_b;
        ans = min(ans, tmp);
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

bool solve(const vector<vector<int>>& g, const vector<int>& A){
	const int N = g.size();
	vector<int> deg(N);
	vector<long long> rest(N);
	queue<int> qu;
	for(int i=0;i<N;i++){
		deg[i] = g[i].size();
		rest[i] = A[i];
		if(g[i].size() == 1){
			qu.push(i);
		} else {
			rest[i] *= 2;
		}
	}
	vector<int> visit(N, 0);
	while(!qu.empty()){
		int p = qu.front(); qu.pop();
		if(rest[p] > A[p]) return false;
		visit[p] = 1;
		for(auto& t : g[p]){
			if(visit[t]) continue;
			if(A[t] < rest[p]) return false;
			rest[t] -= rest[p];
			rest[p] = 0;
			if(rest[t] < 0) return false;
			--deg[t];
			if(deg[t] == 1) qu.push(t);
		}
		if(rest[p] != 0) return false;
	}
	return true;
}

int main(){
	int N;
	while(cin >> N){
		vector<int> A(N);
		for(auto& t : A) cin >> t;
		vector<vector<int>> g(N);
		for(int i=0;i<N-1;i++){
			int a, b; cin >> a >> b;
			--a; --b;
			g[a].push_back(b);
			g[b].push_back(a);
		}
		cout << (solve(g, A) ? "YES" : "NO") << endl;
	}
}


Measured memory_bytes: 7936