akhauriyash/Code-Regression huggingface dataset:
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char>{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

#[allow(dead_code)]
fn read_int() -> i64{
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String{
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n:i64) -> Vec<String>{
    let mut xs = Vec::new();

    for _i in 0..n{
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n:i64) -> Vec<i64>{
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start:i64,end:i64,step:i64) -> Vec<i64>{
    let mut ret = Vec::new();
    let mut i = start;

    while i < end{
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS : [i64; 4] = [0,0,1,-1];
#[allow(dead_code)]
const DYS : [i64; 4]  = [1,-1,0,0];
#[allow(dead_code)]
const INF : i64 = 999999999;
#[allow(dead_code)]
const N_PRIME : i64 = 1000000007;

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

fn main(){
    let n = read_int() as usize;
    let inputs = read_ints();
    let (a,b) = (inputs[0],inputs[1]);
    let xs = read_ints();

    let mut p0 = 0;
    let mut p1 = 0;
    let mut p2 = 0;

    for p in xs{
        if p <= a{
            p0+=1;
        }else if p <= b{
            p1 += 1;
        }else {
            p2 += 1;
        }
    }

    println!("{}",cmp::min(p0,cmp::min(p1,p2)));
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(24);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;

ll n, m, x, k, a , b;
string s, t;

// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>a>>b;
	cout<<a*b;
}

int main() {
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    set<int> s;
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        s.insert(a);
    }
    cout << size(s) << endl;
}

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

const int MAX_N = 100000;

typedef struct {
  int parent, child, sibling;
} node;

int N;
node nodes[MAX_N];

void printChild(int id) {
  cout << ", [" << id;
  while (id != -1) {
    id = nodes[id].sibling;
    if (id == -1) break;
    cout << ", ";
    cout << id;
  }
  cout << ']';
}

int depth(int id) {
  int depth = 0;
  while (nodes[id].parent != -1) {
    id = nodes[id].parent;
    depth++;
  }
  return depth;
}

string type(int id) {
  if (nodes[id].parent == -1) return "root";
  else if (nodes[id].child == -1) return "leaf";
  else return "internal node";
}

void solve() {
  for (int i = 0; i < N; i++) {
    cout << "node " << i
         << ": parent = " << nodes[i].parent
         << ", depth = " << depth(i)
         << ", " << type(i);
    if (nodes[i].child == -1) cout << ", []";
    else printChild(nodes[i].child);

    cout << endl;
  }
}

int main() {
  int children[MAX_N];
  cin >> N;

  for (int i = 0; i < N; i++)
    nodes[i].parent = nodes[i].child = nodes[i].sibling = -1;

  for (int i = 0; i < N; i++) {
    int id; cin >> id;
    int degree_num; cin >> degree_num;
    for (int j = 0; j < degree_num; j++) {
      cin >> children[j];
      if (j == 0) nodes[id].child = children[j];
      if (j > 0) nodes[children[j-1]].sibling = children[j];
      nodes[children[j]].parent = id;
    }
  }
  solve();
}

Measured memory_bytes: 2764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            bool flag = false;
            string[] str = Console.ReadLine().Split(' ');
            int N, M, buf;
            N = int.Parse(str[0]);
            M = int.Parse(str[1]);
            string[] map = new string[N];
            string[] check = new string[M];
            for (int a = 0; a < N; a++)
            {
                map[a] = Console.ReadLine();
            }
            for (int a = 0; a < M; a++)
            {
                check[a] = Console.ReadLine();
            }

            for (int a = 0; a < N - M + 1; a++)
            {
                buf = map[a].IndexOf(check[0]);
                if (buf != -1)
                {
                    flag = true;
                    for(int b = 0; b < M; b++)
                    {
                        if (map[a + b].IndexOf(check[b], buf) != buf)
                        {
                            flag = false;
                            break;
                        }
                    }
                }
                if (flag == true) break;
            }

            if (flag == true) Console.WriteLine("Yes");
            else Console.WriteLine("No");

        }
    }
}

Measured memory_bytes: 13280
#include<iostream>

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

int main(){
	int n;
	int m[101];
	int x[101][10], y[101][10];
	int xtmp,ytmp;
	int ans[101];

	while(std::cin >> n && n){
		std::cin >> m[0];
		int count[101];

		rep(j,m[0]) {
			std::cin >> x[0][j] >> y[0][j];
		}
		rep(i,n){
			std::cin >> m[i+1];
			m[i+1+n] = m[i+1];
			rep(j,m[i+1]){
				std::cin >> x[i+1][j] >> y[i+1][j];
				x[i+1+n][m[i+1]-1-j] = x[i+1][j];
				y[i+1+n][m[i+1]-1-j] = y[i+1][j];
			}
		}
		rep(i,2*n+1){
			ans[i] = 0;
			count[i] = 0;
			int xdif =0 - x[i][0];
			int ydif =0 - y[i][0];
			rep(j,m[i]){
				x[i][j] += xdif;
				y[i][j] += ydif;
			}
		}
		rep(i,2*n){
			if(m[0] != m[i+1])continue;
			rep(k,4){
				rep(j,m[i+1]){
					if (k == 0) {
						xtmp = -y[i + 1][j];
						ytmp = x[i + 1][j];
					}
					if (k == 1) {
						xtmp = -x[i + 1][j];
						ytmp = -y[i + 1][j];
					}
					if (k == 2) {
						xtmp = y[i + 1][j];
						ytmp = -x[i + 1][j];
					}
					if (k == 3) {
						xtmp = x[i + 1][j];
						ytmp = y[i + 1][j];
					}
					if(xtmp == x[0][j] && ytmp == y[0][j]){
						count[i+1]++;
						if(count[i+1] == m[i+1])ans[i+1] = 1;
					}
					else{
						count[i+1] = 0;
						break;
					}
				}
				if(ans[i+1] == 1)break;
			}
		}
		rep(i,n){
			if(ans[i+1+n] == 1){
				ans[i+1] = 1;
			}
		}
		rep(i,n){
			if(ans[i+1] == 1){
				std::cout << i+1 << std::endl;
			}
		}
		std::cout << "+++++" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 0
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=int(1e5);
int n,m,fpos;
int pos[N+5];
int main(){
	scanf("%d%d",&n,&m);
	fpos=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&pos[i]);
		if(pos[i]<0) fpos=i;
	}
	int ans=(1<<30);
	for(int i=max(fpos-m+1,0);i+m-1<n && i<=fpos+1;i++)
		ans=min(ans,pos[i+m-1]-pos[i]+min(abs(pos[i]),abs(pos[i+m-1])));
	printf("%d\n",ans);
	return 0;
}

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

int main(){
    string s;   cin>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='1')s[i]='9';
        else if(s[i]=='9')s[i]='1';
    }

    cout<<s<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n,c) v.clear(),v.resize(n,c)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll n,i;
	cin>>n;
	for(i=1;i<=9;i++) if(n%i==0&&n/i<=9) return cout<<"Yes\n",0;
	cout<<"No\n";
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REP1(i, n) for (int i = 1; i <= n; i++)
static const int inf = 1 << 30;
static const int MAX = 100000;
int main(void) {
  int N;
  int A[MAX];
  cin >> N;
  int sum = 0;
  A[0] = A[N + 1] = 0;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    sum += abs(A[i] - A[i - 1]);
  }
  sum += abs(A[N + 1] - A[N]);
  REP1(i, N) {
    cout << sum - abs(A[i] - A[i - 1]) - abs(A[i] - A[i + 1]) +
                abs(A[i + 1] - A[i - 1])
         << endl;
  }
}

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

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

    int n;
    cin >> n;
    string s;
    cin >> s;

    int ans = 0;
    for(int i = 0; i < 1000; i++){
        vector<int> A = {i / 100, (i % 100) / 10, (i % 100) % 10};
        int idx = 0;
        for(int j = 0; j < n; j++){
            if(s[j] == ('0' + A[idx])){
                idx++;
                if(idx == 3) break;
            }
        }
        ans += (idx == 3);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
/**
 * @author      : omgursocute
 * @created     : 2020-02-23 23:03 (UTC+7)	
 * @task        : C
 */

#include <bits/stdc++.h>

using namespace std;

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int n;
	cin >> n;
	vector<int> a(n);
	for(int &x: a) cin >> x;

	int ans = INT_MAX;
	for(int p = 1; p <= 100; p++) {
		int sum = 0;
		for(int x: a) sum += (x - p) * (x - p);
		ans = min(ans, sum);
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 233333;
int n,a[N],b[N];map<int,int>Map;int cnt,fa[N];bool vis[N];
void ins(int x){if(!Map.count(x))Map[x]=++cnt;}
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
bool gg(){
	Vi c,d;rep(i,0,n)c.pb(a[i]),d.pb(b[i]);
	sort(c.begin(),c.end());sort(d.begin(),d.end());
	return c!=d;
}
int main() {
	read(n);rep(i,1,n)read(a[i]),a[0]^=a[i];
	rep(i,1,n)read(b[i]),b[0]^=b[i];
	if(gg()){puts("-1");return 0;}
	bool same=1;rep(i,1,n)same&=a[i]==b[i];if(same){puts("0");return 0;}
	rep(i,0,n)ins(a[i]),ins(b[i]);
	rep(i,1,n*2+5)fa[i]=i;
	int res=-2;
	rep(i,0,n)if(a[i]!=b[i]||i==0){
		int x=find(Map[a[i]]),y=find(Map[b[i]]);
		res++;fa[x]=y;vis[y]=1;
	}
	rep(i,1,cnt)if(find(i)==i&&vis[i])res++;
	cout<<res;
	return 0;
}


Measured memory_bytes: 8164
/**
 * Created by hiramekun at 20:47 on 2019-11-24.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string s;
    cin >> s;
    ll ans = 0;
    if (s == "SUN") ans = 7;
    else if (s == "MON") ans = 6;
    else if (s == "TUE") ans = 5;
    else if (s == "WED") ans = 4;
    else if (s == "THU") ans = 3;
    else if (s == "FRI") ans = 2;
    else if (s == "SAT") ans = 1;
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
from bisect import *
N, A, B, C, D = map(int, input().split())
P = [A + (N-1-i)*D - C*i for i in reversed(range(N))]
Q = [A + (N-1-i)*C - D*i for i in reversed(range(N))]
j = bisect_left(P,B)
if j < N and B >= Q[j]:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 117312
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		long ans = 0;
		int[] a = new int[n];
		for(int i = 0; i < n; i++) a[i] = sc.nextInt();
		for(int i = 0; i < n; i++) {
			if(i == n - 1) ans += t;
			else ans += Math.min(t, a[i + 1] - a[i]);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 62352
#include <iostream>	
#include <vector>	
	
int main(){	
	int a, b;
	std::cin >> a >> b;
	
	std::vector<int> answers;
	answers.push_back(a + a - 1);
	answers.push_back(a + b);
	answers.push_back(b + b - 1);
	
	std::cout << *max_element(answers.begin(), answers.end()) << std::endl;
	
	return 0;
}	


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

int main() {
    vi pri;
    for (int i = 2; i < 55555; i++) {
        bool isPrime = true;
        for (int j = 2; j <= sqrt(i); j++) {
            if (i % j == 0) {
                isPrime = false;
                break;
            }
        }
        if (isPrime && (i % 5 == 1)) {
            pri.push_back(i);
        }
    }

    int N;
    cin >> N;
    rep(i, N) {
        cout << pri[i];
        if (i != N - 1) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3536
import itertools
N = int(input())
ans = 0

for i in range(3, len(str(N))+1):
    for ptn in itertools.product((3,5,7), repeat=i):
        if (3 not in ptn) or (5 not in ptn) or (7 not in ptn):
            continue
        a = int("".join(list(map(str, ptn))))
        if a <= N:
            ans += 1
print(ans)

Measured memory_bytes: 42860
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;



int main()
{
    int h, w, n;
    cin >> h >> w >> n;
    int sx, sy;
    cin >> sy >> sx;
    string s, t;
    cin >> s >> t;
    int migi = sx, hidari = sx, ue = sy, shita = sy;
    rep(i,n){
        if (s[i]=='R'){
            migi++;
            if (migi>w){
                cout << "NO" << endl;
                return 0;
            }
        }
        if (s[i]=='L'){
            hidari--;
            if (hidari<1){
                cout << "NO" << endl;
                return 0;
            }
        }
        if (s[i]=='U'){
            ue--;
            if (ue<1){
                cout << "NO" << endl;
                return 0;
            }
        }
        if (s[i]=='D'){
            shita++;
            if (shita>h){
                cout << "NO" << endl;
                return 0;
            }
        }
        if (t[i]=='R'){
            hidari = min(hidari + 1, w);
        }
        if (t[i]=='L'){
            migi = max(migi - 1, 1);
        }
        if (t[i]=='U'){
            shita = max(shita - 1, 1);
        }
        if (t[i]=='D'){
            ue = min(ue + 1, h);
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 776
n, q = list(map(int, input().split()))
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b= list(map(int, input().split()))
    tree[a-1].append(b-1)
s = [0] * n
for i in range(q):
    p, x = list(map(int, input().split()))
    s[p-1] += x

queue = [0]

while(len(queue) != 0):
    n = queue.pop()
    for i in range(len(tree[n])):
        s[tree[n][i]] += s[n]
        queue.append(tree[n][i])
# def f(n):
#     global s
#     for i in range(len(tree[n])):
#         s[tree[n][i]] += s[n]
#         f(tree[n][i])
#
# f(0)

print(" ".join(list(map(str, s))))


Measured memory_bytes: 71472
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define SIZE 1000100
#define rep(i, a, b) for (long long i = a; i <= b; ++i)
#define int long long
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
const int mod = 998244353;
int n, inv[SIZE] = { 0,1 }, cnt[SIZE], tp, maxx = 0, ans[SIZE], res = 0;
signed main() {
	io(); cin >> n;
	rep(i, 1, n) {
		cin >> tp;
		cnt[tp]++;
		maxx = max(maxx, tp);
	}
	rep(i, 2, maxx) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	for (int i = maxx; i; --i) {	//求出gcd为i的所有pair的乘积之和
		int s1 = 0, s2 = 0;
		for (int j = i; j <= maxx; j += i) {
			s1 = (s1 + cnt[j] * j % mod) % mod;
			s2 = (s2 + cnt[j] * j % mod * j % mod) % mod;
		}
		ans[i] = (s1 * s1 % mod - s2 + mod) % mod;
		// s1 - s2 的作用是使得gcd为j的pair对数为 cnt * (cnt - 1)
		for (int j = i + i; j <= maxx; j += i) {
			ans[i] = (ans[i] - ans[j] + mod) % mod;
			//去重，删除gcd为ik (k > 1)的pair
		}
	}
	rep(i, 1, maxx) {	//计算 ans[i] / i % mod
		res = (res + ans[i] * inv[i] % mod) % mod;
	}
	cout << res * inv[2] % mod; //res / 2
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int mod=998244353;
const int N=3e5+5;
const int inf=1e9+7;
ll da[N];
char mp[11][1005];
int bo[11][1005];
int bo1[11];
int main()
{

    int h,w,k,p,q,s,x;
    scanf("%d%d%d",&h,&w,&k);
    for(int i=0; i<h; i++){
        scanf("%s",mp[i]);
    }
    int ans=inf;
    for(int i=0;i<(1<<(h-1));i++){
        //memset(bo,0,sizeof(bo));
        int top=0,tmp=0,f=0;
        for(int p=0;p<w;p++)
            bo[top][p]=mp[0][p]-'0';
        for(int j=0;j<h-1;j++){
            if((i>>j)&1){
                top++;
                for(int p=0;p<w;p++)
                    bo[top][p]=mp[j+1][p]-'0';
            }else
                for(int p=0;p<w;p++)
                    bo[top][p]+=mp[j+1][p]-'0';
            if(top>ans){f=1;break;}
        }
        if(f)continue;
        for(int p=0;p<=top;p++){
            for(int j=0;j<w;j++)
                if(bo[p][j]>k){f=1;break;}
            if(f)break;
        }
        if(f)continue;
        memset(bo1,0,sizeof(bo1));
        for(int p=0;p<w;p++){
            for(int t=0;t<=top;t++)
            {
                bo1[t]+=bo[t][p];
                if(bo1[t]>k){
                    tmp++;
                    memset(bo1,0,sizeof(bo1));
                    p--;
                    break;
                }
            }
            if((tmp+top)>ans){break;f=1;}
        }
        if(f)continue;
        //cout<<tmp<<" "<<top<<endl;
        ans=min(ans,tmp+top);
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

int main() {
  int n;
  while(cin >> n, n) {
    vector<pair<long long, string> > v;
    string l;
    long long p,a,b,c,d,e,f,s,m,efficiency;
    for (int i = 0; i < n; i++) {
      cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
      efficiency = (f * m * s - p) * (1LL << 32LL) / (a + b + c + (d + e) * m);
      v.push_back(make_pair(-efficiency, l));
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++) cout << v[i].second << endl;
    cout << "#" << endl;
  }
  return 0;
}

Measured memory_bytes: 1228
S = input()
seq = [1]
pos = []
for i,(a,b) in enumerate(zip(S,S[1:])):
    if a+b == 'RL':
        pos.append(i)
    if a==b:
        seq[-1] += 1
    else:
        seq.append(1)

ans = [0] * len(S)
for r,l,p in zip(seq[::2],seq[1::2],pos):
    ans[p] = ans[p+1] = (r+l)//2
    if (r+l)%2:
        if r > l:
            ans[p] += 1
        else:
            ans[p+1] += 1
        if max(r,l)%2==0:
            ans[p],ans[p+1] = ans[p+1],ans[p]
print(*ans)

Measured memory_bytes: 85044
using System;
class Program
 {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
            string s = "";
   			for (var i = 0; i < str.Length; i++) {
              s += str[i][0];
            }
            Console.WriteLine(s);
        }
 }

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, a) for (int i = 0; i < (int)(a); i++)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
typedef long long ll;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.first>>v.second;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.first<<","<<v.second;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const vector<T>&a){ll res(0);for(auto&&x:a)res+=x;return res;}

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template <typename Head> void dump(Head &&head) {
  cerr << head;
  dump();
}
template <typename Head, typename... Tail>
void dump(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  dump(forward<Tail>(tail)...);
}
#define debug(...)                                                               \
  do {                                                                         \
    cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = ";                        \
    dump(__VA_ARGS__);                                                         \
  } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template <typename T> struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template <typename T> using Matrix = vector<vector<T>>;

const ll LINF = 1LL << 60;
const int INF = 1001001001;

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


int main()
{
  int n,q; scanf("%d %d", &n, &q);
  fenwick_tree<ll> ft(n);

  rep(i, n) {
    int a; scanf("%d", &a);
    ft.add(i, a);
  }

  vector<ll> ans;
  while (q--) {
    int t; scanf("%d" ,&t);
    if (t == 0) {
      int p, x; scanf("%d %d", &p, &x);
      ft.add(p, x);
    } else {
      int l, r; scanf("%d %d", &l, &r);
      ans.push_back(ft.sum(l, r));
    }
  }
  for (auto v:ans) printf("%lld\n", v);

  return 0;
}


Measured memory_bytes: 10236
#include<bits/stdc++.h>
#define N 105
#define x real()
#define y imag()
using namespace std;
typedef complex<double> point;
int H,R,U,M,S,ans[N];
double du,dm,ds,w,a;
point h[N],u[N],m[N],s[N];

int ccw(point p0,point p1,point p2){
  point temp;
  p1-=p0;
  p2-=p0;
  temp=p1;
  p1*=conj(temp);
  p2*=conj(temp);
  if(abs(temp)==0) return 0;
  p1/=abs(temp);
  if(p2.imag()>0) return 1;
  if(p2.imag()<0) return -1;
  p2/=abs(temp);
  if(p2.real()<0) return -2;
  if(p1.real()<p2.real()) return -2;
  return 0;
}

bool check2(double d,point A,point B){
  point p1=point(a,0),p2=point(a,0),pw=point(cos(w*M_PI/180),sin(w*M_PI/180));
  point e1=point(cos(d*M_PI/360),sin(d*M_PI/360));
  point e2=point(cos(d*M_PI/360),-sin(d*M_PI/360));
  p1=B+p1*pw*e1;
  p2=B+p2*pw*e2;
  if(abs(A-B)>a)return true;
  int r1=ccw(B,p1,A),r2=ccw(B,p2,A);
  if((r1==0||r1==-1)&&(r2==0||r2==1))return false;
  return true;
}

void check(){
  for(int i=0;i<H;i++){
    if(check2(du,h[i],point(0,0)))continue;
    bool f=true;
    for(int j=0;j<U;j++)f&=check2(du,h[i],u[j]);
    for(int j=0;j<M;j++)f&=check2(dm,h[i],m[j]);
    for(int j=0;j<S;j++)f&=check2(ds,h[i],s[j]);
    if(f)ans[i]++;
  }
}

int main(){
  while(1){
    cin>>H>>R;
    if(!H&&!R)break;
    memset(ans,0,sizeof(ans));
    for(int i=0;i<H;i++)cin>>h[i].x>>h[i].y;
    cin>>U>>M>>S>>du>>dm>>ds;
    for(int i=0;i<U;i++)cin>>u[i].x>>u[i].y;
    for(int i=0;i<M;i++)cin>>m[i].x>>m[i].y;
    for(int i=0;i<S;i++)cin>>s[i].x>>s[i].y;
    for(int i=0;i<R;i++)cin>>w>>a,check();
    int maxans=0;
    for(int i=0;i<H;i++)maxans=max(maxans,ans[i]);
    if(!maxans)cout<<"NA"<<endl;
    else{
      int f=0;
      for(int i=0;i<H;i++)
	if(maxans==ans[i]){
	  if(f)cout<<' ';
	  cout<<i+1;
	  f=1;
	}
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include <cmath>

using namespace std;
int main(){
	int n, t = 0, x = 0, y = 0, flag = 0;
	cin >> n;
	for (int i = 0, tt, tx, ty; i<n; i++){
		cin >> tt >> tx >> ty;
		if ((abs(tx - x) + abs(ty - y)) % 2 != (tt - t) % 2 || abs(tx - x) + abs(ty - y)>(tt - t))
			flag = 1;
		t = tt, x = tx, y = ty;
	}
	if (!flag)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define f first
#define ss second
#define mp make_pair
#define pb push_back
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5+2;
int a[N], b[N], c[N];
signed main()
{
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.tie(0);
    int n,i,j,k;
    std::cin >> n;
    for(i=0; i<n; i++) std::cin >> a[i];
    int st = 0;
    for(i=0; i<n; i++) st ^= a[i];
    for(i=0; i<n; i++) b[i] = st^a[i];
    for(i=0; i<n; i++) std::cout << b[i] << " "; std::cout << "\n";
    return 0;
}


Measured memory_bytes: 6740
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int rev(int x){
    int res = 0;
    while(x){
	res += x%10;
	x/=10;
	res*=10;
    }
    return res / 10;
}

int prime(int x){
    for(int i = 2;i * i <= x;i++){
	if(x % i == 0)return 0;
    }
    return 1;
}

string tim(string a, int b){
    string res = "";
    while(b--)res+=a;
    return res;
}

int main(){
    int a, b;
    cin >> a >> b;
    if(b < 0){
	if(a == 1)cout << 11 << endl;
	else cout << tim("9", (a+a)) << endl;
	return 0;
    }
    int p = 1;
    for(int i = 0;i < a;i++)p *= 10;
    p--;
    int l = (p + 1) / 10;
    for(int i = p;i >= l;i--){
	int x = i * l * 100 + b * l * 10 + rev(i);
	if(prime(x)){
	    cout << x << endl;
	    return 0;
	}
    }
    cout <<tim("9",a) << b << tim("9",a) << endl;
    return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
int a[3];
scanf("%d %d %d",&a[0],&a[1],&a[2]);
sort(a,a+3);
int ans=a[0]*a[1]/2;
printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    int ans = 0;

    rep(i,s.size() - 2){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')ans++;
    }

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


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

int main(){

    int x;
    long i, k;

    cin >> x;
    for(i=0; i<9990; i++){
        for(k=0; k<9990; k++){
            if(i*i*i*i*i - k*k*k*k*k == x){
                cout <<  i << " " << k << endl;
                return 0;
            }
            if(i*i*i*i*i + k*k*k*k*k == x){
                cout <<  i << " " << -k << endl;
                return 0;
            }
            if(-i*i*i*i*i - k*k*k*k*k == x){
                cout <<  -i << " " << k << endl;
                return 0;
            }
            if(-i*i*i*i*i + k*k*k*k*k == x){
                cout <<  -i << " " << -k << endl;
                return 0;
            }
        }
    }

}

Measured memory_bytes: 3672
#include <stdio.h>
int main(void)
{
	int a,b;
	char op;
	scanf("%d\n%c\n%d",&a,&op,&b);
	if(op=='+'){
		printf("%d\n",a+b);
	}else{
		printf("%d\n",a-b);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
    int k,n;
    cin>>k>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    int dis0=k-a[n-1]+a[0];
    int res;
    for(int i=1;i<n;i++){
        res=a[i]-a[i-1];
        if(res>dis0)
            dis0=res;
    }
    cout<<k-dis0;
    return 0;
}


Measured memory_bytes: 1024
n = int(input())
arr = list(map(int,input().split()))

i = 0
count_set = {0}
count = 0

while i < n-1:
    if arr[i] >= arr[i+1]:
        count += 1
        if i == n-2:
            count_set.add(count)
    else:
        count_set.add(count)
        count = 0
    i += 1
    
print(max(count_set))

Measured memory_bytes: 14252
import java.util.*;

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

        int L = sc.nextInt();
        int R = sc.nextInt();

        int min = 2019;
        if( (R-L) >= 2019)
            min = 0;
        else  {
            for(int i = 0; i <= (R-L+-1); i++){
                for(int j = i+1; j <= (R-L); j++){
                    int mod_i = (L+i) % 2019;
                    int mod_j = (L+j) % 2019;
                    int mod_ij = (mod_i * mod_j) % 2019;
                    if(mod_ij < min)
                        min = mod_ij;
                }
            }
        }
        System.out.println(min);
        sc.close();
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    string s;
    cin >> s;
    string res;
    for (auto ss : s) {
        if (ss == 'B') {
            if (res.size() > 0) res.pop_back();
        } else {
            res.push_back(ss);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll x,ll y){
    ll r;
    while((r=x%y) !=0){
        x=y;
        y=r;
    }
    return y;
}

ll lcm(ll x, ll y){
    x /= gcd(x,y);
    y /=gcd(x,y);
    return (x*y);
}

int main(){
    int n;
    cin >> n;
    str s,t,A;
    cin >>s >> t;
    for(int i=0;i<n;i++){
        A+=s.substr(i,1)+t.substr(i,1);
    }
    cout << A << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <set>
#include <map>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

#define INF 1000000009
#define MAX_V 500000
typedef pair<int, int> p;
struct edge{int to, cost;};
std::vector<std::vector<edge> > G(MAX_V);
priority_queue<p, std::vector<p>, greater<p> > que; //class, inner, compair
std::vector<int> d(MAX_V+1, INF);
void dijkstra(int start){
  d[start]=0;
  que.push(p(0, start));
  while(!que.empty()){
    p p_now=que.top(); que.pop();
    int v = p_now.second;
    if(d[v]<p_now.first) continue;
    for(int i=0;i<G[v].size();i++){
      edge e = G[v][i];
      if(d[e.to]>d[v]+e.cost){
        d[e.to]=d[v]+e.cost;
        que.push(p(d[e.to], e.to));
      }
    }
  }
}

int main(int argc, char const *argv[]) {
  int N, M, x, y;
  std::cin >> N >> M;
  for(int i=0;i<M;i++){
    std::cin >> x >> y;
    for(int j=0;j<3;j++){
      if((y+(j+1)*N) > 3*N) G[x+j*N].push_back(edge{y,1});
      else G[x+j*N].push_back(edge{y+(j+1)*N,1});
    }
  }
  int S, T;
  std::cin >> S >> T;
  dijkstra(S);
  std::cout << (d[T]==INF?-1:d[T]/3) << '\n';
  return 0;
}


Measured memory_bytes: 24960
#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
int n,p,a[51];
ll f[51][51][2501],ans;
int main(){
	scanf("%d%d",&n,&p);
	for (int i=1; i<=n; i++) scanf("%d",&a[i]);
	f[0][0][0]=1;
	for (int i=1; i<=n; i++)
		for (int j=0; j<=i; j++){
			for (int k=0; k<=2500; k++){
				f[i][j][k]+=f[i-1][j][k];
				if (j>=1&&k>=a[i])
				f[i][j][k]+=f[i-1][j-1][k-a[i]];
			}
		}
	for (int i=1; i<=n; i++)
		ans+=f[n][i][i*p];
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 49152
import "dart:io";
import "dart:math";

main(List<String> args) {
  final int N = int.parse(stdin.readLineSync());
  List<int> A =
      stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();

  int ans = A.reduce(max);
  for (var x in A) {
    int count = 0;
    while (x % 2 == 0) {
      x ~/= 2;
      ++count;
    }
    ans = min(ans, count);
  }
  print(ans);
}

Measured memory_bytes: 13176
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int main(){
	int n,m;
	cin>>n>>m;
	
	set<int> posx;
	
	vector<pii> v(n);
	rep(i,n){
		int x,y;
		cin>>x>>y;
		v[i] = pii(x,y);
		posx.insert(x);
	}
	
	map<int,int> zip,unzip;
	
	int c=0;
	for(auto &e:posx){
		zip[e] = c;
		unzip[c] = e;
		c++;
	}
	
	vector<vector<int>> r(posx.size());
	
	rep(i,v.size()){
		r[zip[v[i].first]].pb(v[i].second);
	}
	
	rep(i,r.size()-1){
		rep(j,r[i].size()){
			r[i+1].pb(r[i][j]);
		}
	}
	rep(i,r.size())sort(all(r[i]));
	
	
	rep(i,m){
		int x1,y1,x2,y2;
		cin>>x1>>y1>>x2>>y2;
		
		auto left = posx.lower_bound(x1);
		auto right = posx.upper_bound(x2);
		
		int sub=0,add=0;
		
		if(left==posx.begin())sub=0;
		else{
			left--;
			vector<int> &t = r[zip[*left]];
			
			sub = (lower_bound(all(t),y1)-t.begin()) - (upper_bound(all(t),y2)-t.begin());
		}
		
		if(right==posx.begin())add=0;
		else{
			right--;
			vector<int> &t = r[zip[*right]];
			add = (lower_bound(all(t),y1)-t.begin()) - (upper_bound(all(t),y2)-t.begin());
		}
		cout<<sub-add<<endl;
	}
}

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

VAL euclid(VAL a, VAL b) {
  if ( a < b ) {
    swap(a, b);
  }
  if ( a % b == 0 ) {
    return b;
  }
  return euclid(b, a % b);
}

map<VAL, VAL> prime_factor(VAL n) {
  map<VAL, VAL> ret;
  for(VAL i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main() {
  VAL A, B;
  cin >> A >> B;
  VAL gcd = euclid(A, B);
//  cout << gcd << endl;
  if ( gcd == 1 ) {
    cout << 1 << endl;
  }
  else {
    map<VAL,VAL> factor_map = prime_factor(gcd);
    int ans = 1;  //「1」を数える
    ans += factor_map.size();
    cout << ans << endl;
  }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,a;
    cin>>x>>a;
    if(x<a){
        cout<<0<<endl;

    }else{
        cout<<10<<endl;

    }
    return  0;
}


Measured memory_bytes: 256
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
import random
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    K = int(input())
    print("ACL" * K)


if __name__ == "__main__":
    main()


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

typedef long long ll;

using namespace std;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    cout << min({a * b * (c % 2), b * c * (a % 2), c * a * (b % 2)}) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1e9+7;
const int INF=1001001001;

int main() {
  int H,W;
  cin>>H>>W;
  vector<string>s(H);
  for(int i=0;i<H;i++){
    cin>>s[i];
  }
  int cnt=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s[i][j]=='#'){
        cnt++;
      }
    }
  }
  vector<int>dx={0,0,1,-1};
  vector<int>dy={-1,1,0,0};
  queue<pair<int,int>>q;
  vector<vector<int>>dis(H,vector<int>(W,-1));
  dis[0][0]=1;
  q.push(make_pair(0,0));
  while(!q.empty()){
    auto p=q.front();q.pop();
    int y=p.first,x=p.second;
    for(int i=0;i<4;i++){
      int h=y+dy[i],w=x+dx[i];
      if(h<0||h>=H||w<0||w>=W){continue;}
      if(s[h][w]=='#'){continue;}
      if(dis[h][w]!=-1){continue;}
      dis[h][w]=dis[y][x]+1;
      q.push(make_pair(h,w));
    }
  }
  if(dis[H-1][W-1]==-1){cout<<-1<<endl;}
  else{cout<<H*W-dis[H-1][W-1]-cnt<<endl;}
  return 0;  
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

const int MAX_S = 3010, MAX_T = 3010;
int dp[MAX_S][MAX_T] = {};

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    string s,t; cin >> s >> t;
    //memset(dp,0,sizeof(dp));
    int slen = s.length();
    int tlen = t.length();
    REP(i,slen+1) dp[0][i] = 0;
    REP(i,tlen+1) dp[i][0] = 0;
    FOR(i,1,slen+1){
        FOR(j,1,tlen+1){
            if(s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }else{
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    
    string ans = "";
    int ni = slen, nj = tlen;
    while(ni > 0 && nj > 0){
        //if(dp[ni][nj] == dp[ni-1][nj-1] + 1){
        //    ans += s[ni-1];
        //    ni--;
        //    nj--;
        //}else{
        //    if(dp[ni][nj] == dp[ni-1][nj]){
        //        ni--;
        //    }else{
        //        nj--;
        //    }
        //}
        if(dp[ni][nj] == dp[ni-1][nj]){
            ni--;
        }else if(dp[ni][nj] == dp[ni][nj-1]){
            nj--;
        }else{
            ans += s[ni-1];
            ni--; nj--;
        }
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;


}


Measured memory_bytes: 35584