akhauriyash/Code-Regression huggingface dataset:
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
 */
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);
        B81 solver = new B81();
        solver.solve(1, in, out);
        out.close();
    }

    static class B81 {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int a = s.nextInt();
            boolean bool = false;
            for (int i = 1; i < 10; i++) {
                if (a % i == 0 && a / i < 10) {
                    bool = true;
                    break;
                }
            }

            out.println(bool ? "Yes" : "No");
        }

    }

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

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

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

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

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

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

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

        }

    }
}



Measured memory_bytes: 22484
// skip until line 65
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define DumpArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
struct Vec{
    double v[2];
    string to_s(){
        return "("+to_string(v[0])+","+to_string(v[1])+")";
    }
    double& operator[](int t){
        return v[t];
    }
    Vec operator+(Vec t) {
        return {v[0]+t[0],v[1]+t[1]};
    }
    Vec& operator+=(Vec t) {
        v[0]+=t[0];v[1]+=t[1];
        return *this;
    }
    Vec operator-(Vec t) {
        return {v[0]-t[0],v[1]-t[1]};
    }
    Vec& operator-=(Vec t) {
        v[0]-=t[0];v[1]-=t[1];
        return *this;
    }
    Vec operator*(double t) {
        return {v[0]*t,v[1]*t};
    }
    Vec& operator*=(double t) {
        v[0]*=t;v[1]*=t;
        return *this;
    }
    double operator*(Vec t) {
        return v[0]*t[0]+v[1]*t[1];
    }
    Vec operator-(){
        return {-v[0],-v[1]};
    }
    static Vec Z;
};
Vec Vec::Z={0,0};
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
int main() {
    ll A,B,C,K;
    cin >> A >> B >> C >> K;
    if (A>=K) {
        cout << K << endl;
    } else {
        cout << A - max(0ll,(K-(A+B)) )<<endl;
    }
}


Measured memory_bytes: 3628
#include<cstdio>
#include<iostream>
using namespace std;
char a[100][100];
int main(){
int n,m;
cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>a[i][j];
			}
	}	
	for(int i=1;i<=n;i++){
		int tot=0;
		for(int j=1;j<=m;j++){
			if(a[i][j]=='.')
			tot++;
			if(tot==m){
				for(int k=1;k<=m;k++)
				a[i][k]='*';
			}
		}
	}
	for(int j=1;j<=m;j++){
		int ytot=0;
		for(int i=1;i<=n;i++){
			if(a[i][j]=='.'||a[i][j]=='*')
			ytot++;
			if(ytot==n){
				for(int k=1;k<=n;k++)
				a[k][j]='*';
			}
		}
	}
	for(int i=1;i<=n;i++){
		int flag=0;
		for(int j=1;j<=m;j++){
			if(a[i][j]!='*'){
				flag=1;
			printf("%c",a[i][j]);	
			}
		}
		if(!flag)
		continue;
		printf("\n");
	}
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = 0;
    rep(i,n) {
        while(i+1 < n && a[i]==a[i+1]) ++i;
        if(i+1 < n && a[i] < a[i+1]) {
            while(i+1 < n && a[i] <= a[i+1]) ++i;
        }
        else if(i+1 < n && a[i] > a[i+1]) {
            while(i+1 < n &&  a[i] >= a[i+1]) ++i;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}   

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

using namespace std;

int main(){
	int n, x;
	vector <int> A, B;
	scanf("%d", &n);
	for(int i = 0; i < n; ++i){
		scanf("%d", &x);
		A.push_back(x);
		B.push_back(x);
	}
	sort(A.begin(), A.end());
	int a = A[(n / 2) - 1];
	int b = A[n / 2];
	for(int i = 0; i < n; ++i){
		if(B[i] <= a) printf("%d\n", b);
		else printf("%d\n", a);
	}
	return 0;
}


Measured memory_bytes: 3948
import math

N, H = map(int, input().split())
katana = {i: list(map(int, input().split())) for i in range(N)}

# 振り攻撃最大
max_i, (max_a, max_b) = max(katana.items(), key=lambda x: x[1][0])

ans = 0
for i, (_, b) in sorted(katana.items(), key=lambda x: x[1][1], reverse=True):
    if i == max_i:
        continue
    if H <= max_b or H <= max_a:
        break
    if b < max_a:
        break
    H -= b
    ans += 1

if max_a < max_b and H > 0:
    H -= max_b
    ans += 1
if H > 0:
    ans += math.ceil(H / max_a)

print(ans)


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

int main(void){
    long d, n;
    cin >> d >> n;
    long a = d==0 ? 1 : (d==1 ? 100 : 10000);
    a *= n==100 ? 101 : n;
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256
let () =
  let open Queue in
  let (que : (string * int) Queue.t) = create () in
  let (n, q) = Scanf.scanf "%d %d\n" (fun n q -> (n, q)) in
  for _ = 0 to n - 1 do
    add (Scanf.scanf "%s %d\n" (fun s t -> (s, t))) que
  done;
  let cnt = ref 0 in
  while not (is_empty que) do
    let (s, t) = take que in
    let rest = t - q in
    if rest > 0 then begin
      add (s, rest) que;
      cnt := !cnt + q;
    end else begin
      let x = !cnt + t in
      Printf.printf "%s %d\n" s x;
      cnt := x;
    end
  done

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

using namespace std;
using ll = long long;

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

ll lmin(ll a,ll b){return a>b?b:a;}
ll lmax(ll a,ll b){return a>b?a:b;}

// Sorting
void insertionSort(int n,int*a,int g=1){for(int i=g;i<n;++i){int v=a[i],j=i-g;while(j>=0&&a[j]>v){a[j+g]=a[j];j-=g;}a[j+g]=v;}}
void shellSort(int n,int*a){vector<int>G;for(int h=1;;){if(h>n)break;G.push_back(h);h=3*h+1;}for(int i=G.size()-1;i>=0;--i)insertionSort(n,a,G[i]);}
int bubbleSort(int n,int*a){int s=0,j;bool f=1;for(int i=0;f;++i){f=0;for(j=n-1;j>=i+1;--j){if(a[j]<a[j-1]){swap(a[j],a[j-1]);f=1;s++;}}}return s;}
int selectionSort(int n,int*a){int s=0,j,m;for(int i=0;i<n-1;++i){m=i;for(j=i;j<n;++j)if(a[j]<a[m])m=j;swap(a[i],a[m]);if(i!=m)++s;}return s;}

// Searching
int binarySearch(int n,int*a,int k){int m,l=0,r=n;while(l<r){m=l+(r-l)/2;if(k<a[m])r=m;else if(a[m]<k)l=m+1;else return m;}return-1;}

// Mathematics
int gcd(int a,int b){!b?a:gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}

// Visualization
void printArray(int n,int*a){for(int i=0;i<n;++i)printf(i>0?" %d":"%d",a[i]);printf("\n");}

int main(){
	int n, ans=0;
	string s;
	cin >> n >> s;
	
	for(int i = 0; i < s.size()-2; ++i){
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=200001;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(b-a==c-b)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

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

int main() {
    int N; cin>>N;
    vector<ll>a(N);
    ll sum =0;
    rep(i,N){
        cin>>a[i];
        sum+=a[i];
    }
    ll x=0;
    ll mn =1e10;
    rep(i,N-1){
        x+=a[i];
        mn =min(mn,abs(2*x-sum));
    }
    cout<<mn<<endl;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAX_N = 100005, INF = 0x3f3f3f3f;
typedef pair<int, int> pii;

class Edge {
public:
  int nxt, to;
} e[MAX_N << 1];

int head[MAX_N], cnt;
void addedge(int u, int v) {
  e[++cnt] = (Edge){head[u], v}, head[u] = cnt;
  e[++cnt] = (Edge){head[v], u}, head[v] = cnt;
}

int rt, P[MAX_N];
bool flag;
pii intv[MAX_N];

void dfs(int u, int v, int d) {
  if (P[u] != INF) 
    if (((P[u] & 1) ^ d) != (P[rt] & 1)) flag = 0;
  
  int L = -INF, R = INF;

  for (int i = head[u]; i; i = e[i].nxt) 
    if (e[i].to != v) {
      dfs(e[i].to, u, d ^ 1);
      L = max(L, intv[e[i].to].first - 1);
      R = min(R, intv[e[i].to].second + 1);
    }
  if (L > R) flag = 0;
  if (P[u] != INF) {
    if (L > P[u] || R < P[u]) flag = 0;
    intv[u] = make_pair(P[u], P[u]);
  } else {
    intv[u] = make_pair(L, R);
  }
}

void dfs2(int u, int v) {
  for (int i = head[u]; i; i = e[i].nxt)
    if (e[i].to != v) {
      if (P[e[i].to] != INF) {
	dfs2(e[i].to, u);
      } else {
	if (P[u] - 1 >= intv[e[i].to].first && P[u] - 1 <= intv[e[i].to].second)
	  P[e[i].to] = P[u] - 1, dfs2(e[i].to, u);
	else
	  P[e[i].to] = P[u] + 1, dfs2(e[i].to, u);
      }
    }
}

int main() {
  int N, K;
  
  scanf("%d", &N);

  for (int i = 1, u, v; i < N; ++i) {
    scanf("%d%d", &u, &v);
    addedge(u, v);
  }

  scanf("%d", &K);
  
  memset(P, 0x3f, sizeof P);
  for (int i = 1, v, p; i <= K; ++i) {
    scanf("%d%d", &v, &p);
    P[v] = p, rt = v;
  }
  
  flag = 1;
  dfs(rt, 0, 0);

  if (!flag) {
    puts("No");
    return 0;
  }

  puts("Yes");

  dfs2(rt, 0);

  for (int i = 1; i <= N; ++i)
    printf("%d\n", P[i]);
  
  return 0;
}


Measured memory_bytes: 11776
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  int n=len(s);
  set<char> cnt;
  rep(i,n) cnt.insert(s[i]);
  if(n==len(cnt)) cout<<"yes"<<endl;
  else cout<<"no"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >

int power(int a,int b,int p)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    fast;
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b && b==c)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        String S = scan.next();
        scan.close();
        
        boolean isTrue = true;

        if(S.charAt(2)!=S.charAt(3)) isTrue = false;
        else if(S.charAt(4)!=S.charAt(5)) isTrue = false; 
        
        if(isTrue) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 22608
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


template<class T> vector<T> SlideMin(vector<T>& vec, const int& width){
    vector<T> res(vec.size());
    deque<T> deq;
    for(int i = 0; i < vec.size(); ++i) {
        while(deq.size() && vec[deq.back()]>=vec[i]) deq.pop_back();
        deq.push_back(i);
        res[i] = vec[deq.front()];
        if(i+1>=width && deq.front()==i+1-width) deq.pop_front();
    }
    return res;
}

template<class T> vector<T> SlideMax(vector<T>& vec, const int& width){
    vector<T> res(vec.size());
    deque<T> deq;
    for(int i = 0; i < vec.size(); ++i) {
        while(deq.size() && vec[deq.back()]<=vec[i]) deq.pop_back();
        deq.push_back(i);
        res[i] = vec[deq.front()];
        if(i+1>=width && deq.front()==i+1-width) deq.pop_front();
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> P(N), B(N), C(N);
    REP(i,N) cin >> P[i];
    auto mi = SlideMin(P, K);
    auto ma = SlideMax(P, K);
    B[0] = 1;
    for(int i=1;i<N;i++){
        if(P[i-1] < P[i]) B[i] = B[i-1] + 1;
        else B[i] = 1;
    }
    iota(C.begin(), C.end(), 0);
    REP(i,K-1) C[i] = -1;
    for(int i=K-1;i<N;i++) if(B[i] >= K) C[i] = 0;
    for(int i=K;i<N;i++){
        if(C[i] == 0) continue;
        if(P[i-K] == mi[i-1] && P[i] == ma[i]) C[i] = C[i-1];
    }
    set<int> st;
    REP(i,N){
        //cout << C[i] << " ";
        if(C[i] != -1) st.insert(C[i]);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  string x;
  cin>>x;
  int ans=0;
  if(x[0]=='1')ans +=1;
  if(x[1]=='1')ans +=1;
  if(x[2]=='1')ans +=1;
  
  cout<<ans<<endl;
}


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

#define pb push_back
#define mp make_pair
#define inside sl<=l&&r<=sr
#define outside r<sl||sr<l
#define INF 1000000009
#define mod 1000000007
using namespace std;
typedef long long ll;

string s;
int d;

ll dp[102][10005][2];

int main(){
	//freopen("stl.gir", "r", stdin);
	
	cin >> s >> d;
	for (int i = 0; i < s.size(); i++) s[i] -= '0';
	for (int i = s.size(); i >= 0; i--){
		for (int sum = 0; sum < d; sum++){
			if (i == s.size()){
				if (sum == 0) dp[sum][i][0] = dp[sum][i][1] = 1;
				else dp[sum][i][0] = dp[sum][i][1] = 0;
			} else {
				// free
				dp[sum][i][1] = 0;
				for (int k = 0; k < 10; k++){
					dp[sum][i][1] += dp[(sum+k)%d][i+1][1];
					dp[sum][i][1] %= mod;
				}
				
				// free degil
				dp[sum][i][0] = 0;
				//cout << "top: " << sum << ", " << i << ", " << 0 << endl;
				for (int k = 0; k < s[i]; k++){
					//cout << "ekle: " << "dp[" << (sum+k)%d << ", " << i+1 << ", " << 1 << ": " << dp[(sum+k)%d][i+1][1] << endl;
 					dp[sum][i][0] += dp[(sum+k)%d][i+1][1];
					dp[sum][i][0] %= mod;
				}
				//cout << "ekle: " << "dp[" << (sum+s[i])%d << ", " << i+1 << ", " << 0 << ": "<<  dp[(sum+s[i])%d][i+1][0] << endl;
				dp[sum][i][0] += dp[(sum+s[i])%d][i+1][0];
				dp[sum][i][0] %= mod;
			}
		}
	}
	
	ll ans = dp[0][0][0]-1;
	ans = ((ans%mod)+mod)%mod;
	cout << ans << endl;
	
}

Measured memory_bytes: 15872
import java.util.Scanner;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
 
        int h = stdIn.nextInt();
        int a = stdIn.nextInt();
        //int c = stdIn.nextInt();
        //int x = stdIn.nextInt();
        //int num[] = new int[];
        //String s = stdIn.next();
        //String t = stdIn.next();
        //char c[] = s.toCharArray();
        
        //c[0] += 1;
        //int sum = 0;
        //boolean flag = true;
        //for(int i = 0; i < s.length(); i++){
        //}
        
        if(h % a == 0){
            System.out.println(h / a);
        }else{
            System.out.println(h / a + 1);
        }
        
 
        //System.out.println();
        //System.out.print();
 
        stdIn.close();
    }
}

Measured memory_bytes: 22868
#include <stdio.h>

int main(){
    
    char in[1234];
    
    scanf("%s",in);
    
    for(int i =0;in[i]!='\0';i++){
        if(in[i]<='C') in[i] +=23;
        else in[i]-=3;
    }
    
    printf("%s\n",in);
    
    return 0;
}

Measured memory_bytes: 2620
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int a,b,k;
    cin>>a>>b>>k;
    for(int i=0;i<k;i++){
        if(i&1){
            if(b&1)b--;
            b/=2;
            a+=b;
        }else{
            if(a&1)a--;
            a/=2;
            b+=a;
        }
    }
    cout<<a<<" "<<b<<endl;
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

pub fn bit_search(v: &[i32], c: &[i32]) -> i32 {
    let n = v.len();
    let mut res = 0;
    let mut b: i32 = 1;
    while b < (1i32 << n) {
        let mut val = 0;
        let mut cst = 0;
        for i in 0..n {
            if b & (1 << i) != 0 {
                val += v[i];
                cst += c[i];
            }
        }
        res = std::cmp::max(res, val - cst);
        b += 1;
    }
    res
}

fn main() {
    input! {
        n: usize,
        v: [i32;n],
        c: [i32;n],
    }
    println!("{}", bit_search(&v, &c));
}


Measured memory_bytes: 4352
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
h = list(map(int, input().split()))

max_count = 0
tmp_count = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        tmp_count += 1
    else:
        if max_count < tmp_count:
            max_count = tmp_count
        tmp_count = 0

if max_count < tmp_count:
    max_count = tmp_count

print(max_count)


Measured memory_bytes: 15020
#include <iostream>
#include <string>
using namespace std;
using ll = long long;

int main()
{
    int k, i;
    string s;

    cin >> k >> s;

    if (s.length() <= k)
    {
        cout << s;
    }
    else
    {
        cout << s.substr(0, k) + "...";
    }
}

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

int main(){
    int m, d;
    cin >> m >> d;
    int ans = 0;
    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= d; j++){
            int d1 = j%10, d10 = j/10;
            if(d1 >= 2 && d10 >= 2 && d1*d10 == i)  ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod=1337;
int main()
{
    ll n;
    cin>>n;
    vector<ll>v(n);
    map<ll,ll>mp;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        mp[v[i]+i+1]++;
    }
    ll cnt=0;
   /* for(id:mp)
    {
        cout<<id.first<<" ";
    }*/
    for(int i=0;i<n;i++)
    {
        ll x=i-v[i]+1;
      //  cout<<x<<"\n";
        if(mp.find(x)!=mp.end())
        {
           // cout<<mp[x]<<" "<<i+1<<"\n";
            cnt+=mp[x];
        }
    }
    cout<<cnt<<" ";
}


Measured memory_bytes: 17176
#include <bits/stdc++.h>
using namespace std;
int main() {
  int w,a,b;
  cin >> w >> a >> b;
  if (a+w < b) {
    cout << b-(a+w) << endl;
  } else if (a > b+w) {
    cout << a-(b+w) << endl;
  } else {
    cout << 0 << endl;
  }
}

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

struct task
{
    int A;
    int B;
};

bool cmpB(const task &a, const task &b)
{
    return a.B < b.B;
}

int main()
{
    int N;
    cin >> N;
    vector<task> t(N);
    for (int i = 0; i < N; i++)
    {
        cin >> t[i].A >> t[i].B;
    }
    sort(t.begin(), t.end(), cmpB);
    ull sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += t[i].A;
        if(sum>t[i].B){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  bool bo[11];
  for(int i=0;i<11;i++)bo[i]=false;
  int d[k];for(int i=0;i<k;i++){
    cin>>d[i];
    bo[d[i]]=true;
  }
  for(int i=n;;i++){
    int a[5];
    int m=i;
    for(int j=0;j<5;j++)a[j]=10;
    for(int j=0;j<5;j++){
      if(m==0)break;
      a[j]=m%10;
      m/=10;
    }
    int c=0;
    for(int j=0;j<5;j++){
      if(bo[a[j]])c=1;
    }
    if(c==0){
      cout<<i<<endl;
      return 0;
    }
  }
}
  

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

using namespace std;

typedef long long ll;

struct Node
{
    int x, y;
    bool is_used;
    Node() {};
    Node(int _x, int _y) : x(_x), y(_y), is_used(false) {};
};

bool xasc(const Node& left, const Node& right) {
        return left.x < right.x;
}
bool ydsc(const Node& left, const Node& right) {
        return left.y > right.y;
}

Node R[101];
Node B[101];

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

    for (int i = 0; i < N; ++i)
    {
        int x,y;
        cin >> x >> y;
        R[i] = Node(x, y);
    }
    sort(R, R+N, ydsc);

    for (int j = 0; j < N; ++j)
    {
        int x,y;
        cin >> x >> y;
        B[j] = Node(x, y);
    }
    sort(B, B+N, xasc);

    int ans1 = 0;
    for (int i = 0; i < N; ++i)
    {
        Node& b = B[i];
        for (int j = 0; j < N; ++j)
        {
            Node& r = R[j];
            if (!r.is_used && r.x < b.x && r.y < b.y)
            {
                ++ans1;
                r.is_used = true;
                break;
            }
        }
    }

    cout << ans1 << endl;

    return 0;
}

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

int main(){
  int h,w;
  cin >> h >> w;

  for (int j_1 = 0; j_1 < w + 2; j_1 ++) cout << "#";
  cout << endl;

  for (int i = 0; i < h; i ++){
    string a;
    cin >> a;
    cout << "#" << a << "#" << endl;
  }

  for (int j_2= 0; j_2 < w + 2; j_2 ++) cout << "#";
  cout << endl;

}



Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxn = 1e5+5;
VI G1[maxn], G2[maxn]; map<PII,int> W;
int size[maxn], dist[maxn], res[maxn], dp[maxn][2];

int dfs0(const int u, const int p)
{
    size[u] = 1;
    dist[u] = (dist[p] + W[PII(p,u)]) % 2;
    FOR_ALL(v,G1[u]) if (*v != p) {
        size[u] += dfs0(*v,u);
        G2[u].push_back(*v);
    }
    return size[u];
}

int dfs1(const int u, const int p, const int c)
{
    int& ans = dp[u][c];
    if (-1 == ans) {
        ans = 0;
        if (!dist[u]) {
            ans = 1; res[u] = 1;
            FOR_ALL(v,G2[u])
                ans &= dfs1(*v,u,1);
        }
        if (!ans) {
            if (c || !W[PII(u,p)]) {
                ans = 1; res[u] = 0;
                FOR_ALL(v,G2[u])
                    ans &= dfs1(*v,u,0);
            }
        }
    }
    return ans;
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n) {
        FOR(i,1,n+1)
            G1[i].clear(), G2[i].clear();
        FOR(_,0,n-1) {
            int u,v,w; cin >> u >> v >> w;
            w %= 2;
            G1[u].push_back(v);
            G1[v].push_back(u);
            W[PII(u,v)] = W[PII(v,u)] = w;
        }
        memset(dp,-1,sizeof(dp));
        dist[1] = 0;
        dfs0(1,1);
        res[1] = 1;
        FOR_ALL(v,G2[1])
            dfs1(*v,1,1);
        FOR(i,1,n+1)
            cout << res[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 30720
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define H_MAX 50
#define W_MAX 50

int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int H,W;

namespace patch {
  template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
}

int main() {
  string s;
  cin >> s;
  long long k;
  cin >> k;
  char c = '1';
  int count = 0;

  for(int i=0; i<s.length(); i++) {
    if(s[i] == '1') {
      count++;
      continue;
    }
    else  {
      c = s[i];
      break;
    }
  }

  if(k <= count)
    cout << 1 << endl;
  else
    cout << c << endl;

  return 0;
}
 


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

const int N = 200006;

int a[N];
int b[N];

int aa[N],bb[N];

int n;

int cal(int L,int R)
{
    if (L>R) return 0;
    return upper_bound(bb+1,bb+n+1,R) - lower_bound(bb+1,bb+n+1,L);
}

int main ()
{
    //int n;
    scanf("%d",&n);
    for (int i=1;n>=i;i++)
    {
        scanf("%d",&a[i]);
    }
    for (int i=1;n>=i;i++)
    {
        scanf("%d",&b[i]);
    }
    int ans=0;
    for (int k=0;30>k;k++)
    {
        for (int i=1;n>=i;i++)
        {
            aa[i] = (a[i]&((1<<(k+1))-1));
            bb[i] = (b[i]&((1<<(k+1))-1));
        }
        sort(bb+1,bb+n+1);
        long long num=0;
        for (int i=1;n>=i;i++)
        {
            int L1 = (1<<k),R1 = (1<<(k+1))-1;
            int L2 = L1 + (1<<(k+1)),R2 = R1 + (1<<(k+1));
            num += cal(L1-aa[i],R1-aa[i]) + cal(L2-aa[i],R2-aa[i]);
            //cout << "i = " << i << " , num = " << num << endl;
        }
        //cout<< "k = " <<k<< " , num = " << num<<endl;
        ans |= (num&1)*(1<<(k));
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 3328
#include<stdio.h>
int main(){
  int n,i,v,u,j,k;
  int G[100][100];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      G[i][j] = 0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&v);
    for(j=0;j<v;j++){
      scanf("%d",&k);
      G[u-1][k-1] = 1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",G[i][j]);
      if(j < n-1)printf(" ");
    }
    puts("");
  }

  return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int k; cin >> k;
  if (k%2) COUT(k/2*(k/2+1));
  else COUT(pow(k/2,2));
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <cstring>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(){
    int l;
    cin >> l;
    double x = 0.0;
    x = (double)l / 3;
    
    printf("%lf", x*x*x);
    
    
    return 0;
    
}


Measured memory_bytes: 3728
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

ll fact[200001], rfact[200001];

ll perm(ll n, ll r){
    return (fact[n] * rfact[r]) % MOD;
}

ll comb(ll n, ll r){
    return (perm(n, r) * rfact[n-r]) % MOD;
}

void init(ll n){
    fact[0] = fact[1] = 1;
    rfact[0] = rfact[1] = 1;
    for(int i=2;i<=n;++i) {
        fact[i] = (fact[i-1] * (ll)i) % MOD;
        rfact[i] = 1;
        ll k = MOD-2;
        ll a = fact[i];
        while(k > 0){
            if(k & 1){
                rfact[i] *= a;
                rfact[i] %= MOD;
            }
            a *= a;
            a %= MOD;
            k  >>= 1;
        }
    }
}

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    ll n,m,k;
    cin >> n >> m >> k;

    init(n*m);

    ll ans_x = 0;
    for(ll l=1;l<n;++l) {
        ans_x += l * (n-l) * m * m;
    }
    ll ans_y = 0;
    for(ll l=1;l<m;++l) {
        ans_y += l * (m-l) * n * n;
    }

    ll c = comb(n*m-2, k-2);
    cout << (c * ((ans_x+ans_y)%MOD))%MOD << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define per(i, a, b) for (int i = (a); i >= int(b); i--)
using namespace std;

const int lim = 1.5e5;
vector<string> res;
char str[100];

void smaller(int x, int y, int z) {
	sprintf(str, "< %d %d %d", x, y, z);
	res.push_back(string(str));
}

void addition(int x, int y, int z) {
	sprintf(str, "+ %d %d %d", x, y, z);
	res.push_back(string(str));
}

void calc(int x, int n) {
	smaller(n + 30, x, n + 30);
	rep(i, 1, 30 - 1) addition(n + 30 + (i - 1), n + 30 + (i - 1), n + 30 + i);
	rep(i, 1, 30 - 1) addition(n + 60 + (i - 1), n + 30 + (i - 1), n + 60 + i);
	int m = n + 90;
	per(i, 30 - 1, 0) {
		smaller(n + 60 + i, x, m);
		addition(n + i, m, n + i);
		rep(j, 0, i - 1) addition(m, m, m);
		addition(3, 3, m + 2);
		per(j, 30 - 1, 0) {
			addition(x, n + 30, m + 1);
			addition(m + 2, n + 30 + j, m + 3);
			addition(m + 3, m, m + 3);
			smaller(m + 3, m + 1, m + 4);
			rep(k, 0, j - 1) addition(m + 4, m + 4, m + 4);
			addition(m + 2, m + 4, m + 2);
		}
		addition(3, m + 2, x);
	}
}

void work(int n, int m, int K) {
	rep(i, 0, 30 - 1) addition(4, i + n, 4);
	rep(i, 0, 30 - 1) addition(4, i + m, 4);
	smaller(3, 4, 4);
	rep(i, 0, 30 - 1) rep(j, 0, 30 - 1) {
		addition(i + n, j + m, 5);
		smaller(4, 5, 5);
		addition(K + i + j, 5, K + i + j);
	}
	rep(i, 0, 60 - 2) {
		rep(k, 0, i - 1) addition(K + i, K + i, K + i);
		addition(2, K + i, 2);
	}
}

int main() {
	calc(0, 5e4);
	calc(1, 1e5);
	work(5e4, 1e5, 1.5e5);
	printf("%d\n", int(res.size()));
	rep(i, 0, res.size() - 1) printf("%s\n", res[i].c_str());
	return 0;
}

Measured memory_bytes: 6172
s = input()
n = len(s)

# 1秒後にどこにいるか
pos = [0] * n
for i in range(n):
    if s[i] == "L":
        pos[i] = i - 1
    else:
        pos[i] = i + 1

# 2秒後どこにいるか
pos = [pos[pos[i]] for i in range(n)]
# 4秒後どこにいるか
pos = [pos[pos[i]] for i in range(n)]
# 8秒後どこにいるか
pos = [pos[pos[i]] for i in range(n)]
# ...これを繰り返す
for _ in range(1, 20):
    pos = [pos[pos[i]] for i in range(n)]

ans = [0] * n
for i in range(n):
    ans[pos[i]] += 1
print(*ans)

Measured memory_bytes: 113200
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

    vector<string> w(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i];
    }

    bool flag = true;
    for (int i = 1; i < n && flag; i++) {
        if (w[i][0] != w[i - 1][w[i - 1].size() - 1]) {
            flag = false;
        }

        for (int j = 0; j < i && flag; j++) {
            if (w[i] == w[j]) {
                flag = false;
            }
        }
    }

    cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    
    ans = 0
    for i in range(n):
        if i == 0:
            l1 = 0
            l2 = 1
        elif i == 1:
            l1 = 2
            l2 = 1
        else:
            l1 = l2
            l2 = ans
        ans = l1 + l2

    print(ans)


if __name__ == '__main__':
    main()

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

int main(){
    int X, Y, Z;
    cin >> X >> Y >> Z;

    int ans = 0;

    while(true){
        if(ans * Y + (ans + 1) * Z > X ){
            break;
        }
        ans++;
    }

    cout << ans - 1 << endl;

} 

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

using namespace std;

long long gcd(long long x,long long y){
	if(x%y==0) return y;
  else return gcd(y,x%y);
}

int main(){
    long long A,B,C,D; cin>>A>>B>>C>>D;
  A--;
  long long tmp=C*D/gcd(C,D);
	long long BT=B-B/C-B/D+B/tmp;
	long long AT=A-A/C-A/D+A/tmp;

  printf("%lld",BT-AT);
    return 0;
}

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

using namespace std;
typedef long long ll;
ll N, K;
const ll MOD = 1000000007;
map<ll, ll> mp;

vector<ll> divs(ll m){
    vector<ll> ans;
    for(ll i = 1; i*i <= m; i++){
        if(m%i == 0) {
            ans.push_back(i);
            if(i*i != m) ans.push_back(m/i);
        }
    }
    sort(ans.begin(), ans.end());
    return ans;
}

template <typename T>
T pow(T a, ll n) {
	T ans = 1;
	T tmp = a;
	for (int i = 0; i <= 60; i++) {
		ll m = (ll)1 << i;
		if (m & n) {
		ans *= tmp;
		ans %= MOD;
		}
		tmp *= tmp;
		tmp %= MOD;
	}
	return ans;
}

ll calc(ll m){
    return pow<ll>(K, (m+1)/2);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N >> K;
    vector<ll> v = divs(N); 
    ll ans = 0;
    for(int i : v){
        ll tmp = calc(i);
        for(int j : v){
            if(j < i && i%j == 0){
                tmp -= mp[j];
                tmp += MOD;
                tmp %= MOD;
            }
            mp[i] = tmp;
        }
        // cout << i << ' ' << mp[i] << endl;
        if(i%2 == 1) ans += (mp[i]*i)%MOD;
        else ans += (mp[i]*i/2)%MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

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

int a[100005];

int main()
{

    int n,q;
    string s;

    cin>>n>>q>>s;

    for(int i=1;i<n;i++)
    {
        if(s[i]=='C' && s[i-1]=='A') a[i+1]=a[i]+1;
        else a[i+1]=a[i];
    }

    for(int i=0;i<q;i++)
    {
        int c,b,ans=0;

        cin>>c>>b;
        ans=a[b]-a[c];
        cout<<ans<<endl;
    }

    return 0;

}


Measured memory_bytes: 1408
import Control.Monad
import Control.Monad.State

type Stat = (Int, Int, Int)

main :: IO ()
main = do
  n <- readLn
  ass <- replicateM n readInts
  putStr $ solve ass

readInts :: IO [Int]
readInts = map read . words <$> getLine

solve :: [[Int]] -> String
solve ass = evalState (solve' ass) (0, 0, 0)

solve' :: [[Int]] -> State Stat String
solve' [] = return "Yes"
solve' ([t, x, y]:ass) = do
  (_t, _x, _y) <- get
  let d = sum $ map abs $ [x - _x, y - _y]
  if d <= t - _t && even (t - _t - d) 
    then put (t, x, y) >> solve' ass
    else return "No"





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

//初見×
//bit全探索について理解すること
int main()
{
    cin >> H >> W >> K;
    vector<string> s(H);
    rep(i, H) cin >> s[i];
    int ans = 0;
    rep(is, 1 << H) rep(js, 1 << W)
    {
        int cnt = 0;
        rep(i, H) rep(j, W)
        {
            if ((is >> i) & 1)
                continue;
            if ((js >> j) & 1)
                continue;
            if (s[i][j] == '#')
                cnt++;
        }
        if (cnt == K)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  string a,b;cin>>a>>b;
  if(a==b){
    cout("EQUAL");
    return 0;
  }
  int n=a.size();
  int m=b.size();
  if(n>m){
    cout("GREATER");
  }else if(n<m){
    cout("LESS");
  }else{
    rep(i,n){
      if(a[i]==b[i])continue;
      if(a[i]>b[i]){
        cout("GREATER");
        break;
      }else{
        cout("LESS");
        break;
      }
    }
  }
  
  return 0;
}

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

typedef long long ll;

const int N = 1e2 + 10, K = 1e5 + 10;
ll a[N], dp[K];

int main()
{
	ll n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	for (ll kk = 0; kk < a[1]; kk++) dp[kk] = 2;
	for (ll kk = a[1]; kk <= k; kk++)
	{
		int f = 0;
		for (int i = 1; i <= n; i++)
		{
			if (a[i] > kk) break;
			if (dp[kk - a[i]] == 2)
			{
				f = 1;
				break;
			}
		}
		if (f) dp[kk] = 1;
		else dp[kk] = 2;
	}
	if (dp[k] == 1) cout << "First";
	else cout << "Second";
}


Measured memory_bytes: 4440
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
const int maxx=100100;
vector<int> A[maxx];
int color[maxx];
int c=1;

void dfs(int u){
	if(color[u]!=-1) return ;
	color[u]=c;
	int si=A[u].size();
	for(int i=0;i<si;i++){
		if(color[A[u][i]]==-1){
			dfs(A[u][i]);
		}
	}
	return ;
}

int main(){
	int n,q,a,b;// why i should put the dim n in main but not global
	cin>>n>>q;
	for(int i=0;i<=maxx;i++) color[i]=-1;
	for(int i=1;i<=q;i++){
		cin>>a>>b;
		A[a].push_back(b);
		A[b].push_back(a);
	}
	for(int i=0;i<n;i++){
		dfs(i);
		c++;

	}
//	for(int i=0;i<n;i++){
//		cout<<i<<" "<<color[i]<<endl;
//	}
	
	cin>>q;
	for(int i=1;i<=q;i++){
		cin>>a>>b;
		if(color[a]==color[b]) cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;
}


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

int n, a = -1, b = -1, c, d;

int main () {
	scanf("%d", &n);
	for (int i = 1, j; i <= n; ++i) {
		scanf("%d", &j);
		if (~a && a == j) ++c;
		else if (~b && b == j) ++d;
		else if (a == -1) a = j, c = 1;
		else if (b == -1) b = j, d = 1;
		else return puts("No"), 0;
	}
	if (a > b) a ^= b ^= a ^= b, c ^= d ^= c ^= d;
	if (a == -1) {
		if (b == n - 1) return puts("Yes"), 0;
		a = b - 1;
	}
	if (a != b - 1) return puts("No"), 0;
	if ((a + 1 - c) * 2 > d || (a + 1 - c) <= 0) return puts("No"), 0;
	return puts("Yes"), 0;
}

Measured memory_bytes: 384
import java.util.*;

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

        int firstR = -1;
        int cntW = 0;
        int cntR = 0;
        char thisChar = ' ';
        for (int i = 0; i < N; i ++){
            thisChar = Cz.charAt(i);
            if (thisChar == 'R'){
                cntR++;
            }
//
//            if (firstR == -1){
//                if (thisChar == 'W') cntW++;
//            } else {
//                if (thisChar == 'R') cntR++;
//            }
//            if ((firstR == -1) && (Cz.charAt(i) == 'R')){
//                firstR = i;
//            }
        }

        int leftR = 0;
        if (cntR == 0){
            System.out.println("0");
            System.exit(0);
        }
        for (int i = 0; i < cntR; i++){
            thisChar = Cz.charAt(i);
//            System.out.println("thisChar "+i+" "+thisChar);
            if (thisChar == 'R'){
                leftR++;
            }
        }
//        System.out.println(cntR);
//        System.out.println(leftR);
        System.out.println(cntR - leftR);


//        if (cntW <= cntR){
//            System.out.println(cntR + 1 - 1);
//        } else {
//            System.out.println(cntR + 1);
//        }

    }
}

Measured memory_bytes: 40772