akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			double a = scan.nextDouble();
			double b = scan.nextDouble();
			double x = scan.nextDouble();
			
			if(x<=a*a*b/2.0) {
			
				double radi = Math.atan(a*b*b/(2*x));
				double kakudo = Math.toDegrees(radi);
				System.out.println(kakudo);
				
			}else {
				
				double ans = 2*(a*a*b-x)/(a*a*a);
				
				double radi = Math.atan(ans);
				double kakudo = Math.toDegrees(radi);
				System.out.println(kakudo);
				
			}
			
			
			
			
		}
	}
}


Measured memory_bytes: 22612
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


istringstream ss;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n1;
    cin >> n1;

    string n = to_string(n1);

    int sum = 0;

    rep(i,n.size()){

        int num = n[i] - '0';
        sum += num;
    }

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


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

int main(){
  int n;cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  deque<int> d;
  int ans = 0;
  for(int i = 0;i < n;i++){
    int temp = a[i];
    int p = lower_bound(d.begin(),d.end(),temp) - d.begin();
    if(p == 0) d.push_front(temp);
    else d[p-1] = temp;
  }
  cout << d.size() << endl;
}

Measured memory_bytes: 4044
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, a, q, b, c, cnt[100009];
long long sum;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		cnt[a]++;
		sum += a;
	}
	cin >> q;
	while (q--) {
		cin >> b >> c;
		sum += cnt[b] * 1LL * (c - b);
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout << sum << E;
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 4044
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		sc.close();
		HashSet<String> set = new HashSet<>();
		int cnt=0;
		for (i = 0; i < s.length-1; i++) {
			if(s[i]==s[i+1]) {
				i+=2;
				cnt++;
			}
		}
//		out.println(set.toString());
		out.println(s.length-cnt);
	}
}


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

int main() {
    int x, kyuu;
    cin >> x;

    if (400 <= x && x <= 599) kyuu = 8;
    if (600 <= x && x <= 799) kyuu = 7;
    if (800 <= x && x <= 999) kyuu = 6;
    if (1000 <= x && x <= 1199) kyuu = 5;
    if (1200 <= x && x <= 1399) kyuu = 4;
    if (1400 <= x && x <= 1599) kyuu = 3;
    if (1600 <= x && x <= 1799) kyuu = 2;
    if (1800 <= x && x <= 1999) kyuu = 1;

    cout << kyuu;
}

Measured memory_bytes: 3632
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))

a = b = c = 0
for p in P:
    if p <= A:
        a += 1
    elif p <= B:
        b += 1
    else:
        c += 1
print(min(a,b,c))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
int main() 
{
    int N,res=0;
    cin >> N;
    int d[N];
    rep(i,N){
        cin >> d[i];
    }

    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            res += d[i]*d[j];
        }
    }

    cout << res;

}

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

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;

void dfs(vector<int> A){
    if (A.size() == n+1){
        int now = 0;
        rep(i, q){
            if(A[b[i]] - A[a[i]] == c[i]) now += d[i];
        }
        ans = max(ans, now);
        return;
    }

    A.push_back(A.back());
    while(A.back() <= m){
        dfs(A);
        A.back()++;
    }
}

int main() {
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i, q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1,1));
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    ll n,l;
    cin >> n >> l;
    ll a,b,ans=INF;
    cin >> a;
    rep(i,n-1){
        cin >> b;
        if (a+b>=l) {ans=i+1;break;}
        a=b; 
    }
    if (ans==INF) cout << "Impossible" << endl;
    else {
        cout << "Possible" << endl;
        rep(i,n){
            if (i+1==ans) break;
            cout << i+1 << endl;
        }
        rep(i,n){
            if (n-i-1==ans) break;
            cout << n-i-1 << endl;
        }
        cout << ans << endl;
    }
}

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

#define MOD 1e9+7;

int main(){
    int n,m;
    cin>>n>>m;
    char a[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    vector<vector<int>>dp(n,vector<int>(m,0));
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(i==0 && j==0){continue;}
            if(a[i][j]=='#'){continue;}
            if(j==0){
                if(a[i-1][j] =='.'){
                    dp[i][j]=(dp[i][j]+dp[i-1][j])%1000000007;
                    dp[i][j]%=1000000007;
                }
            }
            if(i==0){
                if(a[i][j-1] =='.'){
                   dp[i][j]=(dp[i][j]+dp[i][j-1])%1000000007;
                   dp[i][j]%=1000000007;
                }
            }
            else{
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
                dp[i][j]%=1000000007;
            }
            
        }
    }
    cout<<dp[n-1][m-1];
    return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    bool can=true;

    for(int i=n-2;i>=0;i--){
        
        if(h[i+1]+1<h[i]){
            can=false;
        }
        else if(h[i+1]+1==h[i]){
            h[i]=h[i]-1;
        }
    }
    if(can) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a; i <= b; ++ i) 
const int N = 2005, mo = 1e9 + 7 ; 
using namespace std ;

int n, k, f[N][N] ;

inline void upd(int &x, int y) {
	x = (x + y) % mo ;
}

int main() {
	scanf("%d%d", &n, &k) ;
	f[0][n + 1] = 1 ;
	rep(i, 1, k) {
		int sum = f[i - 1][n + 1] ; 
		for (int j = n; j >= 1; -- j) {
			upd(f[i][j], sum) ;
			upd(sum, f[i - 1][j]) ;
			if (i <= n - j + 1) upd(f[i][j], f[i - 1][j]) ;
		}
	}
	int ans = 0 ;
	rep(i, 2, n + 1) upd(ans, f[k - 1][i]) ;
	rep(i, 1, n - k - 1) ans = ans * 2 % mo ;
	printf("%d\n", ans) ;
	return 0 ;
}

Measured memory_bytes: 15872
#include <iostream>
#include <string>

using namespace std;
int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b)
  {
    if (a == c)
    {
      cout << "1" << endl;
    }
    else
    {
      cout << "2" << endl;
    }
  }
  else if (a == c)
  {
    cout << "2" << endl;
  }
  else if (b == c)
  {
    cout << "2" << endl;
  }
  else
  {
    cout << "3" << endl;
  }
  
  return 0;
}


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

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

  int cnt1 = 0;
  int cnt2 = 0;
  string ans;

  int ss = input.size();
  if (ss >= 1 && ss <= 10) {
  	for (int i = 0; i < ss; i++) {
		switch (input.at(i)) {
			case 'A':
				cnt1++;
				break;
			case 'C':
				cnt1++;
				break;
			case 'G':
				cnt1++;
				break;
			case 'T':
				cnt1++;
				break;
			default:
				cnt2 = max(cnt1, cnt2);
				cnt1 = 0;
				break;
 		}
	}
  }
  cnt2 = max(cnt1, cnt2);
  cout << cnt2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
using namespace std;

 int main(){

	int N,data[301];
	bool** table = new bool*[301];
	int** dp = new int*[301];
	for(int i = 0; i <= 300; i++){
		table[i] = new bool[151];
		dp[i] = new int[301];
	}

	bool FLG;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		if(N <= 1){
			printf("0\n");
			continue;
		}

		for(int i = 0; i <= N; i++){
			for(int k = 0; k <= N/2; k++)table[i][k] = false;
			for(int k = 0; k <= N; k++){
				dp[i][k] = 0;
			}
		}

		for(int i = 1; i <= N; i++)scanf("%d",&data[i]);

		for(int i = 1; i <= N-1; i++){
			if(abs(data[i+1]-data[i]) <= 1){
				table[i][1] = true;
				dp[i][i+1] = 2;
			}else{
				dp[i][i+1] = 0;
			}
		}

		for(int length = 3; length <= N; length += 1){
			for(int left = 1; left+length -1 <= N; left++){

				if(length%2 == 0){ //??????????\???°?????´???
					FLG = false;

					if(table[left+1][(length-2)/2] == true && abs(data[left] - data[left+length-1]) <= 1)FLG = true;

					if(!FLG){
						for(int i = 2; i <= length-2; i += 2){
							if(table[left][i/2] == true && table[left+i][(length-i)/2] == true){
								FLG = true;
								break;
							}
						}
					}
					if(FLG){
						table[left][length/2] = true;
						dp[left][left+length-1] = length;
					}else{
						for(int i = left; i <= left+length-2;i++){
							dp[left][left+length-1] = max(dp[left][left+length-1],dp[left][i]+dp[i+1][left+length-1]);
						}
					}
				}else{
					for(int i = left; i <= left+length-2;i++){
						dp[left][left+length-1] = max(dp[left][left+length-1],dp[left][i]+dp[i+1][left+length-1]);
					}
				}
			}
		}

		if(N%2 == 0)printf("%d\n",dp[1][N]);
		else{
			printf("%d\n",max(dp[1][N-1],dp[2][N]));
		}
	}

	return 0;
}

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

const int MOD = 1e9 + 7;
const int MAX_N = 1e6;

long long fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long PERM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return (fac[n] * finv[n-k]) % MOD;
}

int main() {
    COMBinit();
    ll N, M; cin >> N >> M;
    ll ans = 0;
    for (int i = 0; i <= N; i++) {
        ll t = (((((PERM(M,i) * PERM(M-i,N-i)) % MOD) * PERM(M-i,N-i)) % MOD) * COMB(N, i)) % MOD;
        t *= (i % 2 == 0) ? 1 : -1;
        ans += t;
        ans = (MOD + ans) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 27084
#include <bits/stdc++.h>
#define SLAY ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PI 3.141592653589793238
#define ll long long
#define pii pair<int , int>
#define pll pair<long long , long long>
#define INPUT freopen("input.txt", "r", stdin);
using namespace std;

ll solve(int i , int left , vector< vector<ll> >&dp ,vector<pll>& v ){

	if(i>=v.size())return 0;
	
	ll& ret =dp[i][left];
	
	if(~ret)return ret;
	
	if(left - v[i].first>=0){	
		ret = max(solve(i+1 , left , dp , v) , v[i].second + solve(i+1 , left - v[i].first , dp , v));
	}else{
		ret = solve(i+1 , left , dp , v) ;
	}
	
	return ret;

}

int main(){
	SLAY
	int _=1;
	// cin>>_;
	while(_--){
		ll n,m,x , y,a,b,k,ans=0, mx=LLONG_MIN, mn=LLONG_MAX;
		string str;
		cin>>n>>m;
		vector<pll> v(n);
		for(int i = 0 ; i<n ;i++){
			cin>>v[i].first>>v[i].second;
		}
		
		vector< vector<ll> > dp(n+1 , vector<ll>(m+1 , -1));
		
		for(int i = n-1 ; i>=0 ; i-- ){
			for(int j = 0 ; j <= m ; j++){
				solve(i , j , dp , v);
			}
		}
		cout<<solve(0, m , dp , v);
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 83088
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        for (int j = i; j <= N; j+=i) {
            ans += j;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int n;cin>>n;
	if(n%10==9||n/10==9)cout<<"Yes"<<endl;
	else cout << "No" << endl;
	
	return 0;
}

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

using namespace std;

class Solution {
public:
	/* time: O(1), space: O(1) */
	bool stationAndBus(const string& s) {
		return (s != "AAA") && (s != "BBB");
	}
};

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

	Solution sol;
	const bool ans = sol.stationAndBus(s);
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
numbers = gets.to_i
first = Array.new(3){
    Array.new(10){
        0
    }
}
second = Array.new(3){
    Array.new(10){
        0
    }
}
third = Array.new(3){
    Array.new(10){
        0
    }
}
fourth = Array.new(3){
    Array.new(10){
        0
    }
}

numbers.times do
    b,f,r,v = gets.split(' ').map(&:to_i)
    first[f-1][r-1] += v if b == 1
    second[f-1][r-1] += v if b == 2
    third[f-1][r-1] += v if b == 3
    fourth[f-1][r-1] += v if b == 4
end

first.each do |n|
    puts " " + n.join(' ') 
end
puts "#" *20
second.each do |n|
    puts " " +n.join(' ') 
end
puts "#" *20
third.each do |n|
    puts " " + n.join(' ') 
end
puts "#" *20
fourth.each do |n|
    puts " " + n.join(' ') 
end


Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
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; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;

int main(){
  string s;
  cin >> s;
  int N = s.size();
  vi lr(N,0);

  rep(i,N){
    if(s.at(i) == 'R'){
      i++;
      int res=1;
      while(s.at(i) == 'R'){
        res++;
        i++;
      }
      if(res%2!=0){
        lr.at(i-1)+=res/2+1;
        lr.at(i)+=res/2;
      }else{
        lr.at(i)+=res/2;
        lr.at(i-1)+=res/2;
      }
    }
  }

  for(int i = N-1;i>=0;i--){
    if(s.at(i) == 'L'){
      i--;
      int res=1;
      while(s.at(i) == 'L'){
        res++;
        i--;
      }
      if(res%2!=0){
        lr.at(i+1)+=res/2+1;
        lr.at(i)+=res/2;
      }else{
        lr.at(i)+=res/2;
        lr.at(i+1)+=res/2;
      }
    }
  }

  rep(i,N){
    cout << lr.at(i) << ' ';
  }

  cout << endl;

}


Measured memory_bytes: 1024
#[allow(unused_imports)]
use proconio::{
    fastout, input,
};

#[fastout]
fn main() {
    input! {
        x: i32,
        n: usize,
        p: [i32; n],
    }
    if let Some(ans) = (0 ..= 101).filter(|&s| p.iter().all(|&t| s != t)).min_by_key(|&s| (s - x).abs()) {
        println!("{}", ans);
    }
}


Measured memory_bytes: 2176
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import collections as cl
import functools as ft


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


n = LI()
a = sorted(LI())

print(a[-1] - a[0])


Measured memory_bytes: 7368
#include <iostream>

using namespace std;

int main(void){
	int s; cin >> s;
	int first = s / 100;
	int second = s % 100;
	if(0 < first && first <= 12){
		if(0 < second && second <= 12) cout << "AMBIGUOUS";
		else cout << "MMYY";
	} else{
		if(0 < second && second <= 12) cout << "YYMM";
		else cout << "NA";
	}
}

Measured memory_bytes: 256
/*input
2
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int intlog(ll x)
{
	int cnt = 0;
	for(ll k = 1; k <= x; k *= 2) cnt++;
	return cnt - 1;
}

ll fast_expo(ll base, ll index)
{
    ll ret = 1;
    while(index > 0)
    {
        if(index & 1) ret *= base;
        base *= base;
        index >>= 1;
    }
    return ret;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   	ll h; cin >> h;
   	cout << fast_expo(2, intlog(h) + 1) - 1;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# B - Sum of Three Integers
K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if z >= 0 and z <= K:
            count += 1

# 出力
print(count)


Measured memory_bytes: 2940
import java.util.*;

class Main {
    static String REV(String A) {
		//String src = "HELLO";
		StringBuffer sb = new StringBuffer(A);
		String REV_S = sb.reverse().toString();
		//System.out.println(""+REV_S);
        return REV_S;
    }

    public static void main (String[] args){
        Scanner stdIn = new Scanner(System.in);
        String S = stdIn.next();
        String S_REV = REV(S);
        int S_N = S.length();

        int cnt = 0;
        for(int i = 0; i<S_N/2; i++){
            if(S.charAt(i) != S_REV.charAt(i)) cnt++;
        }
        System.out.print(cnt);




    }
}



Measured memory_bytes: 21972
#include <iostream>
using namespace std;
int main(){
	int N, A, B;
	cin>>N>>A>>B;
	if(A*N==B){
		cout<<B;
	}
	else if(A*N>B){
		cout<<B;
	}
	else{
		cout<<A*N;
	}
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] S =sc.next().split("");
		int cnt=0;

		for(int i=0;i<S.length;i++) {
			if((i+1)%2==0) {
				if(S[i].matches("[LUD]")) {
					cnt++;
				}
			}else {
				if(S[i].matches("[RUD]")) {
					cnt++;
				}
			}
		}
		System.out.println(cnt==S.length?"Yes":"No");
	}
}


Measured memory_bytes: 21972
s = input()
n = len(s) -1
ans=0

for i in range(2 ** n):
  l = s[0]
  for j in range(n):
    if (i >> j) & 1:
      l += "+"
    l += s[j+1]
  ans += sum(map(int,l.split("+")))
print(ans)

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

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

    int a[n];
    for(int i = 0; i < n; i++)  cin >> a[i];

    int ans = 0, cnt = 1;
    for(int i = 1; i < n; i++){
        if(a[i] == a[i-1])  cnt++;
        else{
            ans += cnt/2;
            cnt = 1;
        }
    }

    ans += cnt/2;

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

Measured memory_bytes: 768
from collections import deque

s = deque(input())
q = int(input())

flg = 1
for _ in range(q):
    t = input()
    if t == "1":
        flg = not flg
    elif t[0] == "2":
        f = t[2]
        if f == "1":
            c = t[4]
            if flg:
                s.appendleft(c)
            else:
                s.append(c)
        elif f == "2":
            c = t[4]
            if flg:
                s.append(c)
            else:
                s.appendleft(c)

if flg:
    print(''.join(s))
else:
    print(''.join(reversed(s)))


Measured memory_bytes: 8692
#include <iostream>

using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(n*a,b) <<endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

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

  vector<int> *v[3];
  for (auto &p: v) {
    p = new vector<int>(0);
    p->reserve(n);
  }

  for (auto i = 0; i != n; ++i) {
    switch (str[i]) {
      case 'R':
        v[0]->push_back(i);
        break;
      case 'G':
        v[1]->push_back(i);
        break;
      case 'B':
        v[2]->push_back(i);
        break;
    }
  }

  sort(begin(v),end(v),
       [](auto p1, auto p2){
         return p1->size() < p2->size();
       });
  
  ll cnt = accumulate(begin(v),end(v),1ll,
                      [](auto acc, auto x){
                        return acc * x->size();});
  auto b = cbegin(*v[2]);
  auto e = cend(*v[2]);
  for(auto i: *v[0]) {
    for(auto j: *v[1]) {
      if(binary_search(b,e,2*i-j)) --cnt;
      if(binary_search(b,e,2*j-i)) --cnt;
      if((i+j)%2 == 0 && binary_search(b,e,(i+j)/2)) --cnt;
    }
  }

  cout << cnt << endl;
  for (auto &p: v) { delete p; }
  return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin>>n;
    int total=100;
    double sum=0;
    for(int i=0;i<n;i++){
       sum=total*1.05;
       if((sum==(int)sum)) total=(int)sum;
       else total=(int)sum + 1; 
    }
    cout<<total<<"000"<< endl;
    return 0;
}

Measured memory_bytes: 1164
L = int(input())
a=[int(input()) for i in range(L)]
if L == 1:
    print(0)
    exit()
    
rightsum = [0]*(L+1)
leftsum = [0]*(L+1)
for i in range(1,L+1):
    rightsum[i] = rightsum[i-1]+a[i-1]
    leftsum[L-i] = leftsum[L+1-i]+a[L-i]
leftsum=leftsum[::-1]

Reright = [0]
Goright = [0]
for i in range(L):
    res = Reright[-1] 
    if a[i] == 0:
        Reright.append(min(rightsum[i+1],2+Reright[-1]))
        Goright.append(min(rightsum[i+1],1+min(Goright[-1],res)))
    else:
        Reright.append(min(rightsum[i+1],a[i]%2+Reright[-1]))
        Goright.append(min(rightsum[i+1],(a[i]+1)%2+min(Goright[-1],res)))
Releft = [0]
Goleft = [0]

for i in range(L):
    res = Releft[-1]
    if a[L-1-i]==0:
        Releft.append(min(leftsum[i+1],2+Releft[-1]))
        Goleft.append(min(leftsum[i+1],1+min(Goleft[-1],res)))
    else:
        Releft.append(min(leftsum[i+1],a[L-1-i]%2+Releft[-1]))
        Goleft.append(min(leftsum[i+1],(a[L-1-i]+1)%2+min(Goleft[-1],res)))



cand = []
for i in range(L+1):
    p1 = Reright[i]
    p2 = min(Reright[i],Goright[i])
    q1 = Releft[L-i]
    q2 = min(Releft[L-i],Goleft[L-i])
    cand.append(min(p1+q2,p2+q1))
    
print(min(cand))
    

Measured memory_bytes: 72192
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int [][]L = new int [n][2];
		
		for(int i = 0 ; i < n ;i++) {
			int a = Integer.parseInt(sc.next());
			int k = Integer.parseInt(sc.next());
			L[i][0] = a - k;
			L[i][1] = a + k;
		}
		
		Arrays.sort(L,(x,y) -> Integer.compare(x[1],y[1]));
		
		long now = L[0][1];
		int cnt = 1;
		boolean exsit = true;
		int j = 1;
		
	f:	while(exsit){
			
			for(int i = j ; i < n ;i++) {
				if(now <= L[i][0]) {
					now = L[i][1];
					j = i;
					cnt++;
					continue f;
				}
			}
			exsit = false;
		}
		
		System.out.println(cnt);
	}

}


Measured memory_bytes: 64100
N, K = [int(_) for _ in input().split()]
R, S, P = [int(_) for _ in input().split()]
T = input()

sum = 0
flag = [0 for i in range(N)]
countP, countR, countS = 0, 0, 0

for i in range(K):
    if T[i]=='r':
        countP += 1

    elif T[i]=='s':
        countR += 1

    elif T[i]=='p':
        countS += 1
for i in range(K,N):
    if T[i]=='r':
        if T[i-K]!='r':
            countP += 1
        else:
            if flag[i-K] == 1:
                countP += 1
                flag[i] = 0
            else:
                flag[i] = 1

    if T[i]=='s':
        if T[i-K]!='s':
            countR += 1
        else:
            if flag[i-K] == 1:
                countR += 1
                flag[i] = 0
            else:
                flag[i] = 1

    if T[i]=='p':
        if T[i-K]!='p':
            countS += 1
        else:
            if flag[i-K] == 1:
                countS += 1
                flag[i] = 0
            else:
                flag[i] = 1

sum = countR * R+ countP * P + countS * S
print(sum)

Measured memory_bytes: 4212
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    string s;
    cin >> s;
    if(s[0]==s[1] ||s[1]==s[2] || s[2]==s[3] ){
        cout << "Bad" << endl;
    }
    else{
        cout << "Good" << endl;
    }

    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pair<int,int> a, pair<int,int> b) {
	return a < b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	int n, d;
	cin >> n >> d;
	vector<vector<int>>a(n, vector<int>(d));
	rep(i, n) {
		rep(j, d) {
			cin >> a[i][j];
		}
	}
	int ans = 0;
	rep(i, n) {
		rep(j, n) {
			if (j <= i)continue;
			int tmp = 0;
			rep(k, d) {
				tmp += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
			}
			if ((int)sqrt(tmp) * (int)sqrt(tmp) == tmp) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long N, M;
	cin >> N >> M;
	if (M != 0) {
		vector<long long>A(M);
		for (long long i = 0; i < M; i++) {
			cin >> A.at(i);
		}
		vector<long long>Number_of_ways(N + 1);
		int fall = 0;
		Number_of_ways.at(0) = 1;
		for (long long i = 1; i <= N; i++) {
			if (i == A.at(fall)) {
				Number_of_ways.at(i) = 0;
				if (fall < M - 1) fall++;
			}
			else {
				if (i == 1) {
					Number_of_ways.at(i) = Number_of_ways.at(i - 1) % 1000000007;
				}
				else {
					Number_of_ways.at(i) = (Number_of_ways.at(i - 1) + Number_of_ways.at(i - 2)) % 1000000007;
				}
			}
		}
		cout << Number_of_ways.at(N) << endl;
	}
	else {
		vector<long long>Number_of_ways(N + 1);
		int fall = 0;
		Number_of_ways.at(0) = 1;
		for (long long i = 1; i <= N; i++) {
				if (i == 1) {
					Number_of_ways.at(i) = Number_of_ways.at(i - 1) % 1000000007;
				}
				else {
					Number_of_ways.at(i) = (Number_of_ways.at(i - 1) + Number_of_ways.at(i - 2)) % 1000000007;
				}
		}
		cout << Number_of_ways.at(N) << endl;
	}
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
using namespace std;

const int MAX = 1000000;
const int MOD = 1000000007;

const double PI = acos(-1);
const double Rad2Deg = 180.0 / PI;
const double Deg2Rad = PI / 180.0;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

string date[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

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

    for (int i = 0; i < 7; i++) {
        if (S == date[i]) {
            cout << 7 - i << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int mod = 1e9+7;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ull llrand() {ull r = 0;for(int i = 0; i < 5; ++i){r = (r << 15)|(rand() & 0x7FFF);}return r & 0xFFFFFFFFFFFFFFFFULL;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/*---------------------------------------------------------------------------------------------------------------------*/

const int M = 100001;


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



    ll a , b , c , d , n;

    cin >> a >> b >> c >> d >> n;

    ll mm = 1e19*1LL;

    mm = min(mm , 4*a);
    mm = min(mm , 2*b);

    mm = min(mm , c);


    double here = (d*1.0)/2;
    if(here < (mm*1.0)){
        if(n%2 == 0){
            ll ans = (n/2)*d;
            cout<<ans;
            return 0;
        }
        else{
            ll ans = ((n - 1)/2)*d + mm*1LL;
            cout<<ans;
            return 0;
        }
    }
    else{
        cout<<n*mm;
    }


















}














Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  string a,b,c;
  cin>>n>>a>>b>>c;
  int ans=0;
  rep(i,n) {
    if(a[i]==b[i]&&b[i]==c[i]) {
      ans+=0;
    } else if(a[i]==b[i]||b[i]==c[i]||c[i]==a[i]) {
      ans+=1;
    } else {
      ans+=2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;




#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   200007
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/




int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans = -1e18;
    ans = max(ans,a*c);
    ans = max(ans,a*d);
    ans = max(ans,b*c);
    ans = max(ans,b*d);
    cout<<ans<<endl;
    //main();
    return 0;
}





















Measured memory_bytes: 3616
import math

A, B, H, M = map(int, input().split())

degreeL = (30 * H + 0.5 * M)*math.pi/180

degreeS = M * 6 * math.pi/180


d = abs(degreeL - degreeS)

degree = min (d, 360- d)

if degree == 90:
    length = math.sqrt(A**2 + B**2)
elif degree == 180:
    length == A + B
else:
    length = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(degree))
print(length)

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

#define len(x)  (int((x).size()))
#define append push_back
#define pp make_pair
#define ff(a, b)    for (int a = 0; a < int(b); ++a)
#define kk(n)    ff(k, n)
#define xx(n)    ff(x, n)
#define yy(n)    ff(y, n)
#define ii(n)    ff(i, n)
#define fff(a, b, c) for (int a = int(b); a < int(c); ++a)
#define kkk(a, b) fff(k, a, b)
#define xxx(a, b) fff(x, a, b)
#define yyy(a, b) fff(y, a, b)
#define iii(a, b) fff(i, a, b)
#define bb begin()
#define ee end()
#define uu first
#define vv second
#define all(x)  (x).bb, (x).ee
#define ite(v)   decltype((v).bb)
#define fe(i, v) for(ite(v) i = (v).bb; i != (v).ee; ++i)
#define err(...)    { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#define zz(array, byte)   memset(array, byte, sizeof(array));

using LL = long long;
using DD = long double;
using pii = pair<int, int>;



const LL  INFLL  = 0x7f7f7f7f7f7f7f7fLL;
const int INFint = 0x7f7f7f7f;  //Works with memset(..).
double PI = acos(-1);
 
     

LL nbelow(double area, int N) {
    //Longest chord spans i steps along circumference.
    LL rr = 0;
    iii (1, N / 2 + 1) {
        int start = i;
        int finish = (N - i) / 2;
        if (start > finish)
            continue;
        double base = 2*sin((PI*i)/N);
        double height = 2*area/base;
        double x = height - cos((PI*i)/N);
        if (x < 1) {
            double angle = acos(x);
            double arc = PI - (PI*i)/N - angle;
            finish = min(finish, int(arc * N / (2*PI)));
        }
        if (finish < start)
            continue;
        //Don't count finish, count start only once.
        if (finish > start) {
            LL total = 2*(finish - start - 1) + 1;
            rr += total * LL(N);
        }
        if (finish == (N - i - finish)) {
            if (finish == i) {
                rr += N / 3;
            } else {
                rr += N;
            }
        } else {
            if (finish == start)
                rr += N;
            else
                rr += 2*N;
        } 
    }

    //printf("For %g we have %d\n", area, int(rr));
    return rr;
}



int main() {
    //ios_base::sync_with_stdio(false);     cin.tie(NULL);
    //cout << '\n';
    cout.precision(16);
    

    LL N, K;
    cin >> N >> K;

    double low = 0;
    double high = 10;
    while (high - low > 1e-12) {
        double mid = 0.5*(low + high);
        if (nbelow(mid, int(N)) >= K)
            high = mid;
        else
            low = mid;
    }

    cout << high << '\n';
    

    return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

typedef pair<int,int> P;
typedef long long ll;

const int INF = 1e9;


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

	int n,m,Q; cin >> n >> m >> Q;
	
	int rui[501][501] = {};
	int l[m],r[m];
	for(int i=0;i<m;i++){
		cin >> l[i] >> r[i];
		rui[l[i]][r[i]]++;
	}
	for(int i=0;i<501;i++){
		for(int j=1;j<501;j++){
		rui[i][j] += rui[i][j-1];
		}
	}
	for(int i=0;i<501;i++){
		for(int j=1;j<501;j++){
		rui[j][i] += rui[j-1][i];
		}
	}

	int p,q;
	for(int i=0;i<Q;i++){
		cin >> p >> q;
		cout << rui[q][q]-rui[p-1][q]-rui[q][p-1]+rui[p-1][p-1] << "\n";
	}
	return 0;
}

Measured memory_bytes: 3456
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        public struct Card
        {
            public char c;
            public int d;
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        static void SolveA(string[] args)
        {
            //int n =int.Parse(Console.ReadLine());
            int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '),  int.Parse);
            int a = arr[0];
            int b = arr[1];
            string result = null;
            if( a + b == 15)
            {
                result = "+";
            }else if( a * b == 15)
            {
                result = "*";
            }else
            {
                result = "x";
            }
            Console.WriteLine(result);
        }
    }

}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int main() {
  double R;
  double pi = M_PI;
  cin >> R;
  double ans = 2 * R * pi;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3744
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

    double T, A;
    cin >> T >> A;

    vector<double> H(N);
    rep(i, N) cin >> H[i];

    vector<double> X(N);

    rep(i, N) X[i] = T - H[i] * 0.006;

    double m = 1000;

    int j=0;

    rep(i, N) {
        if (abs(X[i] - A) < m) {
            m = abs(X[i] - A);
            j = i;
        }
    }

    cout << j + 1 << endl;

}

Measured memory_bytes: 256
a[5][1<<18],b[2],x,y,i,j;main(n){scanf("%d",&n);for(;i<3;++i)for(j=0;j<n;++j){scanf("%d",&a[i+2][j]);--a[i+2][j];}for(j=0;j<n;++j){if(a[2][j]/3-a[3][j]/3||a[3][j]/3-a[4][j]/3||a[4][j]/3-a[2][j]/3||a[3][j]%3-1||a[3][j]/3-j&1){b[0]=1;break;}x=y=a[3][j]/3+1;while(x){b[j&1]-=a[j&1][x]%2;x-=x&-x;}b[j&1]+=j/2;while(y<2e5){++a[j&1][y];y+=y&-y;}if(a[2][j]%3)++b[1-j%2];}puts(b[0]&1|b[1]&1?"No":"Yes");}

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

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

  int base = 1;
  for (int i = 0; i < D; i++) {
    base *= 100;
  }
  
  int ans = 0;
  int count = 0;
  while (count < N) {
    ans += base;
    if (ans % (base * 100) != 0) {
      count++;
    }
  }

  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  string s, t;
  cin >> s >> t;
  cout << t << s << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	long n, k;

	unsigned long long m, l;

	scanf("%ld%ld", &n, &k);

	m = l = 0;
	int thuong;
	for (long i = 1; i <= n; i++) {
		thuong = i % k;
		if (thuong == 0) m++;
		if (k % 2 == 0 && thuong == k / 2) l++;
	}

	printf("%llu", m*m*m + l*l*l);

}

Measured memory_bytes: 256
N = int(input())
t = [[0] * 10 for _ in range(10)]

for i in range(1, N+1):
    x = i % 10
    y = i
    while y // 10:
        y //= 10
    if x == 0 or y == 0:
        continue
    t[x][y] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += t[i][j] * t[j][i]
print(ans)

Measured memory_bytes: 3064