akhauriyash/Code-Regression huggingface dataset:
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second
#define int long long

typedef long long lli;
typedef pair<int, int> pii;

const int maxn = 2e5 + 5;
const int inf = 1e9 + 9;

int n, m, k;
int a[maxn], b[maxn];

int prea[maxn], preb[maxn];

void read_input()
{
    cin >> n >> m >> k;
    for(int i = 1; i <= n; ++i)
        cin >> a[i];
    for(int i = 1; i <= m; ++i)
        cin >> b[i];
}

void solve()
{
    prea[0] = preb[0] = 0;
    for(int i = 1; i <= n; ++i)
        prea[i] = prea[i - 1] + a[i];
    for(int i = 1; i <= m; ++i)
        preb[i] = preb[i - 1] + b[i];
    int ans = 0;
    for(int i = 1; i <= n; ++i)
        if(prea[i] <= k)
        {
            int left = k - prea[i];
            int p = upper_bound(preb + 1, preb + m + 1, left) - preb - 1;
            ans = max(ans, i + p);
        }
    for(int i = 1; i <= m; ++i)
        if(preb[i] <= k)
        {
            int left = k - preb[i];
            int p = upper_bound(prea + 1, prea + n + 1, left) - prea - 1;
            ans = max(ans, i + p);
        }
    cout << ans << '\n';
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 9856
import java.util.*;

public class Main{
	public static void main(String[] args){
		List<Integer> listX = new ArrayList<Integer>();
		List<Integer> listY = new ArrayList<Integer>();
		Scanner scan = new Scanner(System.in);
		int tmpX,tmpY;
		for(;;){
			tmpX = scan.nextInt();
			tmpY = scan.nextInt();
			if((tmpX == 0) && (tmpY == 0)){
				break;
			}
			if(tmpX > tmpY){
				int small = tmpY;
				tmpY = tmpX;
				tmpX = small;
			}
			listX.add(tmpX);
			listY.add(tmpY);
		}

		if(listX.size() != 0){
			for(int i = 0; i < listX.size(); i++){
				System.out.printf("%d %d\n", listX.get(i), listY.get(i));
			}
		}
	}
}

Measured memory_bytes: 40168
#include <iostream>

using namespace std;

int main()
{
	for(int q;cin>>q;){
		long long l=0,r=0;
		while(q--){
			int p,n; char c; cin>>p>>c>>n;
			if(c=='(') l+=n;
			if(c==')') r+=n;
			cout<<(l==r?"Yes":"No")<<endl;
		}
	}
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

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

int main(){
    ll a, b;
    cin >> a >> b;
    int n = gcd(a,b);

    ll ans = a*b/n;
    cout << ans << endl;

}

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

// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp        make_pair
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second

int inf(0x3fffffff);
int mod(1000000007);
double pi(acos(-1.0));

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif

  int n, k;
  cin >> n >> k;
  vi a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  cout << accumulate(a.begin(), a.begin() + k, 0);

  return 0;
}


Measured memory_bytes: 3616
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
int read()
{
	int res=0,ch,flag=0;
	if((ch=getchar())=='-')             //判断正负
		flag=1;
	else if(ch>='0'&&ch<='9')           //得到完整的数
		res=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')
		res=res*10+ch-'0';
	return flag?-res:res;
}
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
const int N=1e6+10;
int a[N];
void solve()
{
	int ans=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++)
		if(s[i]!=t[i])
			ans++;
	cout<<ans<<endl;
}
signed main()
{
	int t=1;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 3924
import sys
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    n = ii()
    a = list(mi())
    d = deque()
    for i in range(n):
        if i%2:
            d.appendleft(a[i])
        else:
            d.append(a[i])
    print(*list(d)[::((-1)**(n%2))])


if __name__ == '__main__':
    main()


Measured memory_bytes: 107528
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;
class mint {
 private:
  ll _num,_mod;
  mint set(ll num){ 
      _num = num ;
      if(_num<0){
          if(_num>=-_mod)_num=_mod+_num;
          else _num=_mod-(-_num)%_mod;
      }
      else if(_num>=_mod) _num%=_mod;
      return *this;
  }
  ll imod()const{
    ll n=_mod-2;
    ll ans = 1,x=_num;
    while(n != 0){
        if(n&1) ans = ans*x%_mod;
        x = x*x%_mod;
        n = n >> 1;
    }
    return ans;
  }
 public:
  explicit mint(ll num=0,ll M=1000000007){
      _mod=M;
      _num=num;
      if(_num<0){
          if(_num>=-_mod)_num=_mod+_num;
          else _num=_mod-(-_num)%_mod;
      }
      else if(_num>=_mod) _num%=_mod;
  }
  mint(const mint &cp){_num=cp._num;_mod=cp._mod;}
  
  mint operator+ (const mint &x)const{ return mint(_num + x._num , _mod); }
  mint operator- (const mint &x)const{ return mint(_num - x._num , _mod);}
  mint operator* (const mint &x)const{ return mint(_num * x._num , _mod); }
  mint operator/ (const mint &x)const{ return mint(_num * x.imod() , _mod);}
  
  mint operator+=(const mint &x){ return set(_num + x._num); }
  mint operator-=(const mint &x){ return set(_num - x._num); }
  mint operator*=(const mint &x){ return set(_num * x._num); }
  mint operator/=(const mint &x){ return set(_num * x.imod());}

  mint operator= (const ll x){ return set(x); }
  mint operator+ (const ll x)const{return *this + mint(x,_mod); }
  mint operator- (const ll x)const{ return *this - mint(x,_mod); }
  mint operator* (const ll x)const{ return *this * mint(x,_mod); }
  mint operator/ (const ll x)const{ return *this/mint(x);}

  mint operator+=(const ll x){ *this = *this + x;return *this; }
  mint operator-=(const ll x){ *this = *this - x;return *this; }
  mint operator*=(const ll x){ *this = *this * x;return *this;}
  mint operator/=(const ll x){ *this = *this / x;return *this;}

  bool operator==(const mint &x)const{return _num==x._num;}
  bool operator!=(const mint &x)const{return _num!=x._num;}

  friend mint operator+(ll x,const mint &m){return mint(m._num + x , m._mod);}
  friend mint operator-(ll x,const mint &m){return mint( x - m._num , m._mod);}
  friend mint operator*(ll x,const mint &m){return mint(m._num * (x % m._mod) , m._mod);}
  friend mint operator/(ll x,const mint &m){return mint(m.imod() * (x % m._mod) , m._mod);}

  explicit operator ll() { return _num; }
  explicit operator int() { return (int)_num; }
  
  friend std::ostream& operator<<(std::ostream &os, const mint &x){ os << x._num; return os; }
  friend std::istream& operator>>(std::istream &is, mint &x){ll val; is>>val; x.set(val); return is;}
};
int main(){
    int N,K;
    int a[100];
    cin>>N>>K;
    REP(i,N) cin>>a[i];
    vector<vector<mint>> dp(N+1,vector<mint>(2*K+2,mint(0)));
    dp[N][K]=1;
    for(int i=N-1;i>=0;--i) for(int j=K;j>=0;--j){
        dp[i][j]=dp[i+1][j]+dp[i][j+1]-dp[i+1][j+a[i]+1];
    }
    cout<<dp[0][0]<<endl;
}


Measured memory_bytes: 319360
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define INF 0x3f3f3f3f
#define INFll 0x3f3f3f3f3f3f3f3f
#define y0 _lxybz_
#define y1 _ljmnzyzhhhoscartxdy_
typedef long double ld;
typedef long long ll;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
#define lo(x) ((x)&(-(x)))
#define trav(a, x) for (auto &a : x)
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
const ld Pi = 4*atan((ld)1);
template<class T> void chmin(T &a,const T&b) { a = min(a, b); }
template<class T> void chmax(T &a,const T&b) { a = max(a, b); }
namespace IO{
template<class T> inline void read(T&ret)
{
	ret=0; int f=1; char c=getchar();
	while(c<48||c>57){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	ret*=f;
}
template<class T> inline void prin(const T&ret)
{
	if(!ret){putchar(48);return;} static T o; o=ret;
	if(o<0){putchar('-');o=-o;}
	static int op[25],tt; tt=0;
	while(o){
		op[++tt]=o%10;
		o/=10;
	}
	for(int i=tt;i;--i)putchar(op[i]+48);
}
template<class T> inline void pri_(const T&ret)
{
	prin(ret);putchar(' ');
}
template<class T> inline void priE(const T&ret)
{
	prin(ret);putchar('\n');
}
}
using namespace IO;

#define N 3000050
#define MO 
char s[N];
int a[N],u,ss,n;
inline void _Sol_()
{
	scanf("%s",s+1); n=strlen(s+1);
	dF(i,n,1){
		a[n-i+1]=s[i]-48;
	}
	F(i,1,n+1){
		u=i;
		while(a[u]>=10){
			a[u+1]+=a[u]/10;
			a[u]%=10;
		}
		if(a[i]<=4){
			ss+=a[i];
			continue;
		}
		if(a[i]>=6){
			++a[i+1];
			ss+=10-a[i];
			continue;
		}
		
		if(a[i+1]<=4){
			ss+=5;
			continue;
		}
		++a[i+1];
		ss+=5;
	}
	priE(ss);
}

int main()
{
	int T=1; //read(T);
	while(T--)_Sol_();
}

Measured memory_bytes: 8448
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

using namespace std;

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	ll n;
	ll ans=0;
	set<ll>s;
	cin>>n;
	
	for(ll k=2;k*k<=n;k++)
	{
		ll n1=n;
		
		if(n%k==0)while(n1%k==0)n1/=k;
		
		if(n1%k==1)
		{
			ans++;
			s.insert(k);
		}
		
		ll div=n/k;
		
		n1=n;
		
		if(n%div==0)while(n1%div==0)n1/=div;
		
		if(n1%div==1)
		{
			ans++;
			s.insert(div);
		}
	}
	
	if(n>2)
	{
		s.insert(n);
		s.insert(n-1);
	}
	
	s.insert(n);
	cout<<s.size();
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


Measured memory_bytes: 256
H = int(input())
W = int(input())
N = int(input())

if N % H == 0:
    H_count = N // H
else:
    H_count = N // H + 1
    
if N % W == 0:
    W_count = N // W
else:
    W_count = N // W + 1


print(min(H_count, W_count))

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

string s[2];

int main() {
	cin >> s[0] >> s[1];
	if (s[0][0] == s[1][2] && s[0][1] == s[1][1] && s[0][2] == s[1][0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

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

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

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 
int main() {

    int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;

    vector<ll> A(X), B(Y), C(Z);
    REP(i, X) cin >> A.at(i);
    REP(i, Y) cin >> B.at(i);
    REP(i, Z) cin >> C.at(i);

    sort(all(A));
    sort(all(B));
    sort(all(C));
    reverse(all(A));
    reverse(all(B));
    reverse(all(C));
    
    vector<ll>ans;
    REP(i, X)REP(j, Y)REP(k, Z){
        if((i + 1) * (j + 1) * (k + 1) <= K) ans.push_back(A.at(i) + B.at(j) + C.at(k));
        else break;
    }
    sort(all(ans));
    reverse(all(ans));
    REP(i, K) print(ans.at(i));
}


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

// macros
#define int long long 
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define PB push_back
#define MP make_pair
#define bitcount __builtin_popcount
#define watch(x) cerr<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef long double ld;

// template functions
template < typename A, typename B >
ostream &operator << ( ostream& os, const pair< A, B > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "{";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename A, typename B >
ostream &operator << ( ostream & os, const map< A, B > &v ) {
    os << "[";
    typename map< A, B >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " -> " << it -> second ;
    }
    return os << "]";
}
template <typename T1, typename T2>
inline auto mini(T1 a, T2 b) { return (a < b ? a : b); }
template<typename T, typename... Args>
inline auto mini(T a, Args... args) { return mini(a, mini(args...)); }
template <typename T1, typename T2>
inline auto maxi(T1 a, T2 b) { return (a > b ? a : b); }
template<typename T, typename... Args>
inline auto maxi(T a, Args... args) { return maxi(a, maxi(args...)); }
template<typename T>
T gcd(T a, T b) { if(a==0 or b==0) return a+b; return gcd(b, a%b) ; }
template<typename T>
T lcm(T a, T b) { if(a==0 or b==0) return 0; return a/gcd(a, b)*b; }

// random number generation
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // use mt19937_64 for 64 bit

// constants
const long double eps = LDBL_EPSILON;
const int inf = 1e15;
const int modn = 1e9+7;
const int maxn = 2e5+3;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
    int n;
    cin >> n;
    n--;
    vi arr;
    while(n >= 0) {
        arr.PB(n%26);
        n /= 26;
        n--;
    }
    reverse(all(arr));
    for(int num : arr) {
        cout << (char)(num + 'a');
    }
    return 0;
}



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

int main() {
  int k, a, b;
  scanf("%d\n%d %d", &k, &a, &b);
  if((b - a) >= k || a % k > b % k || a % k == 0) cout << "OK";
  else cout << "NG";
}

Measured memory_bytes: 3612
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

S = str(input())

ans = 'Yes'

for i in range(len(S)):
    if i%2==0:
        if S[i]=='L':
            ans = 'No'
            break
    else:
        if S[i]=='R':
            ans = 'No'
            break

print(ans)


Measured memory_bytes: 38400
using System;

public class Program
{
    private int N;
    private int[] A;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        A = new int[N];

        for (int i = 0; i < N; i++)
        {
            A[i] = sc.NextInt();
        }

        if (A[0] != 0)
        {
            Console.WriteLine(-1);
            return;
        }

        long count = 0;
        

        for (int i = 1; i < N; i++)
        {
            if (A[i - 1] + 1 == A[i])
            {
                count++;
            }
            else
            {
                if (A[i] > A[i - 1] + 1)
                {
                    Console.WriteLine(-1);
                    return;
                }

                count += A[i];
            }
        }

        Console.WriteLine(count);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 15816
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
using namespace std;

int N,K;
int f[maxn];
int h[maxn];
int main(){
    // debug;
    ios;
    cin>>N>>K;
    for(int i = 1;i<=N;i++) cin>>h[i];
    memset(f,0x3f,4*N+100);
    f[1] = 0;
    for(int i = 1;i<=N;i++){
        for(int j = 1;j<=K;j++){
            if(i+j<=N) f[i+j] = min(f[i+j],f[i] + abs(h[i+j] - h[i]));
        }
    }
    cout<<f[N]<<'\n';

    return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
#define ld long double
int main(){
    int n;
    cin>>n;
    int r=0,w=0,ans=0;
    string s;
    cin>>s;
    rep(i,n){
        if(s[i]=='R')r++;
        else w++;
    }
    rep(i,r){
        if(s[i]=='W')ans++;
    }
    cout<<ans<<endl;
}


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

int main(){
    int a, b, c, x;
    int tmp, numc, ans;
    cin >> a >> b >> c >> x;

    for(int i=0; i<=a; i++){
        for(int j=0; j<=b; j++){
            tmp = x-(500*i+100*j);
            numc = tmp/50;
            if(0<=numc && numc<=c){
                ans++;
            }
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename F>
static inline constexpr decltype(auto) fix(F&& f) noexcept {
  return [f = std::forward<F>(f)](auto&&... args) {
    return f(f, std::forward<decltype(args)>(args)...);
  };
}
template<typename T>
static inline T fin() { T t; cin >> t; return std::move(t); }

int main() {
  let N = fin<i64>();
  let K = fin<i64>();
  let g = [N]() {
    vector<vector<i64>> g(N);
    for(int i = 0;i < N - 1;i++) {
      let a = fin<i64>() - 1, b = fin<i64>() - 1;
      g[a].push_back(b);
      g[b].push_back(a);
    }
    return std::move(g);
  }();

  let ans = fix([N, K, &g](auto dfs, i64 v, i64 f) -> i64 {
      const i64 MOD = 1e9 + 7;
      i64 use = K - 1 - (f != -1);
      if(K < g[v].size()) {
        return 0;
      }
      i64 res = 1;
      for(auto to: g[v]) {
        if(to ==f) continue;
        (res *= use) %= MOD;
        use--;
        (res *= dfs(dfs, to, v)) %= MOD;
      }
      return res;
  })(0, -1);

  cout << ans * K % i64(1e9 + 7) << endl;
}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    string s; cin >> s;
    REP(i, s.size()-1){
        if (s[i] != s[i+1]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

using ll = long long;

int main()
{
    int N;
    cin >> N;
    ll ans = 1LL;

    for (int i = 0; i < N; i++)
    {
        ll T;
        cin >> T;
        ans = T / __gcd(ans, T) * ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  var counter = 0;
  const s = input.split("");
  if (s[0] == "1") counter++;
  if (s[1] == "1") counter++;
  if (s[2] == "1") counter++;

  console.log(counter);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        for (int i = 0; i <= 19; i++)
            if ((a - 1) * i >= b - 1) { Console.WriteLine(i); goto exit; }
        exit:;
    }
}

Measured memory_bytes: 13140
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        N: usize,
        L: usize,
        S: [String; N],
    }
    let mut S = S;
    S.sort();
    let mut ans = String::new();
    for i in 0..N {
        ans.push_str(S[i].as_str());
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int N) : par(N) {
        rep(i, N) par[i] = -1;
    }
    
    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }
    
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (par[rx] > par[ry]) swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx;
        return;
    }
    
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

signed main() {
    int N;
    int M;
    cin >> N >> M;
    UnionFind UF(N);
    
    vector<int> A(M), B(M);
    rep(i, M) cin >> A[i] >> B[i];
    
    vector<int> ans(M);
    ans[M - 1] = N * (N - 1) / 2;
    for (int i = M - 1; i > 0; --i) {
        if (UF.same(A[i] - 1, B[i] - 1)) {
            ans[i - 1] = ans[i];
        } else {
            ans[i - 1] = ans[i] - UF.size(A[i] - 1) * UF.size(B[i] - 1);
            UF.unite(A[i] - 1, B[i] - 1);
        }
    }
    
    rep(i, M) cout << ans[i] << endl;
    return 0;
}


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

int lcm( int m, int n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	return ((m / __gcd(m, n)) * n);
}

int main() {
	int a,b,x;
	double d,d2;
	cin >> a >> b;
	x = lcm(a,b);
	d = x/a + x/b;
	d2= x;
	printf("%.10lf\n", d2/d);
	return 0;
}
 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    string s,t,u;
    int a,b;
    cin >> s >> t >> a >> b >> u;

    if ( s == u ) {
        --a;
    }
    else if ( t == u ) {
        --b;
    }
    cout << a << " " << b << endl;
}


Measured memory_bytes: 888
N=int(input())
h=list(map(int, input().split()))

# dpの最小値を変更する関数
def chmin(a, b):
    if a > b:
        return b
    else:
        return a
      
dp=[0]*N
dp[1]=abs(h[1]-h[0])

for i in range(2,N):
    tmp=chmin(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2])
    dp[i]=tmp
    
print(dp[-1])

Measured memory_bytes: 20656
#include<iostream>
using namespace std;
int main()
{
	int i, j, m, n;
	int a[101][101], b[101], sum[101] = {};
	cin >> n >> m;

	for(i=0;i<n;i++)
		for (j = 0; j < m; j++)
		{
			cin >> a[i][j];
		}
	for (j = 0; j < m; j++)
	{
		cin >> b[j];
	}
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			sum[i] += a[i][j] * b[j];
		}
		if (i == n - 1)cout << sum[i];
		else cout << sum[i] << endl;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3116
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int gcd(int a, int b) {
	if (!b)return a;
	return gcd(b, a%b);
}
int fact(int n) {
	int res = 1, i = 2;
	int p = n;
	while (i*i<=p) {
		if (n % i == 0) {
			res *= i;
			while (n%i == 0)n /= i;
			if(n!=i*i)res *= fact(n);
			break;
		}
		++i;
	}
	if (res == 1)return n;
	else return res;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int p, q;
	cin >> p >> q;
	int c = gcd(p, q);
	p /= c; q /= c;
	int i = 2;
	cout << fact(q) << endl;
	return 0;
}

Measured memory_bytes: 3160
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    if(A <= C && C <= B){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 23892
let _ = read_line()
let (t,a) = match read_line() |> Str.split (Str.regexp " ") with
| [t;a]->(int_of_string t,int_of_string a)
| _ -> assert false
let hs = read_line() |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  let (v,p,_) = List.fold_left (fun (v,p,i) h  ->
    let t = t*1000 - h*6 in
    let v1 = abs (t - a*1000) in
    (*Printf.printf "i=%d v1=%d v=%d\n" i v1 v;*)
    if v1 <= v then (v1,i,i+1) else (v,p,i+1)
  ) (50000000000,-1,1) hs in
  Printf.printf "%d\n" p


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

using namespace std;

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

	for (int i = 0; i < str.size(); i++){
		str[i] -= 3;
		if (str[i] < 'A'){
			str[i] = '[' - ('A' - str[i]);
		}
	}
		cout << str << endl;
		return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>

typedef long long ll;

int main()
{
  ll W, a, b;
  std::cin >> W >> a >> b;

  if ((b >= a && b <= a+W) || (a >= b && a <= b+W)) {
    std::cout << 0 << std::endl;
  } else {
    std::cout << std::min(std::fabs(b - (a + W)), std::fabs(a - (b + W))) << std::endl;
  }
  return 0;
}


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

int N;
ll K;

bool CL(ll x, vector<ll> A, vector<ll> F){
    for (int i = 0; i < N; ++i) {
        F[i] = x / F[i];
    }
    ll cnt = K;
    for (int i = 0; i < N; ++i) {
        if(A[i] > F[i]){
            cnt -= (A[i] - F[i]);
        }
        if(cnt < 0) return false;
    }
    return true;
}

ll min_CL(vector<ll> A, vector<ll> F){
    ll lb = -1, ub = (1LL << 62);
    while( ub-lb > 1 ){
        ll mid = (lb + ub)/2;
        if(CL(mid, A, F)){
            ub = mid;
        }else{
            lb = mid;
        }
    }
    return ub;
}

int main() {
    cin >> N >> K;
    vector<ll>A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    vector<ll>F(N);
    for (int i = 0; i < N; ++i) {
        cin >> F[i];
    }
    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<int>());
    cout << min_CL(A, F) << "\n";
    return 0;
}

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

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}
int a[55];
int b[55];
int c[55];
int d[55];

int main(void){
    int n, m;
    int min;
    int mini;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++){
        scanf("%d %d", &a[i], &b[i]);
    }
    for (int i = 0; i < m; i++){
        scanf("%d %d", &c[i], &d[i]);
    }
    for (int i = 0; i < n; i++){
        min = 1000000000;
        for (int j = m-1; j >= 0; j--){
            if (min >= abs(a[i]-c[j]) + abs(b[i]-d[j])){
                min = abs(a[i]-c[j]) + abs(b[i]-d[j]);
                mini = j+1;
            }
        }
        printf("%d\n", mini);
    }

    return 0;
    
}


Measured memory_bytes: 128
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<long double> A, B;


  return (ll)(A * B);
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 3728
n, h = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab_b = sorted(ab, key=lambda x:x[1])[::-1]
ma = max(ab[i][0] for i in range(n))
cnt = 0
for i in range(n):
    if ab_b[i][1] <= ma:
        break
    h -= ab_b[i][1]
    cnt += 1
    if h <= 0:
        print(cnt)
        exit()
print(cnt + (-h//ma)*-1)

Measured memory_bytes: 29656
import itertools
N = int(input())
ans = [0 for i in range(0,N)]
for x, y, z in itertools.product(range(1,int(N**(1/2)+1)),range(1,int(N**(1/2)+1)),range(1,int(N**(1/2)+1))):
    kai = x**2+y**2+z**2+x*y+x*z+y*z
    if 0 < kai <= N:
        ans[kai-1] += 1

print("\n".join(map(str,ans)))

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

typedef long long ll;
const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, N;
    cin >> H >> N;
    vector<int> A(N),B(N);
    for (int i=0;i<N;i++) cin >> A[i] >> B[i];
    int amin = INF;
    for (int i=0;i<N;i++) amin = min(amin, A[i]);
    vector<int> dp(H+10,INF);
    dp[0] = 0;
    for (int j=0;j<H;j++){
        for (int k=0;k<N;k++){
            int nj = min(j+A[k],H);
            dp[nj] = min(dp[nj],dp[j] + B[k]);
        }
    }
    cout << dp[H] << "\n";
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(){
	unsigned int L, R;
	cin >> L >> R;

	unsigned int ans = 1e9;
	for (int i = L; i < L + 2019 && i <= R; i++){
		for (int j = i + 1; j < L + 2019 && j <= R; j++){
			int mod = ((i % 2019) * (j % 2019)) % 2019;
			if (mod < ans){
				ans = mod;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a;
    int b;
    int c;
    int cnt = 0;
    int i;
    
    scanf("%d %d %d", &a, &b, &c);
    
    for (i = a; i <= b; i++)
    {
        if (c % i == 0){
            cnt++;
        }
    }
    printf("%d\n", cnt);
    
    return 0;
}



Measured memory_bytes: 2112
l, r = [int(i) for i in input().split()]
if r - l > 2019:
    print(0)
else:
    ans = 10 ** 9
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            ans = min(ans, i * j % 2019)
    print(ans)


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


struct Quaternion {
    int x, y, z, w;
    Quaternion *operator*(Quaternion &o) {
        Quaternion *q = new Quaternion();
        q->x = x*o.x - y*o.y - z*o.z - w*o.w;
        q->y = y*o.x + x*o.y - w*o.z + z*o.w;
        q->z = z*o.x + x*o.z + w*o.y - y*o.w;
        q->w = w*o.x - z*o.y + y*o.z + x*o.w;
        return q;
    }
};


int main() {
    int n;
    Quaternion a, b, *m;

    while (cin) {
        cin >> n;
        if (!n) break;

        while (n--) {
            cin >> a.x >> a.y >> a.z >> a.w
                >> b.x >> b.y >> b.z >> b.w;
            m = a * b;
            cout << m->x << " " << m->y << " " << m->z << " " << m->w << endl;
            delete m;
        }
    }
    return 0;
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll K, N; cin >> K >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) cin >> A.at(i);
  ll vmax = 0;
  for (ll i = 0; i < N; i++) {
    ll d = (K + A.at((i+1) % N) - A.at(i)) % K;
    vmax = max(vmax, d);
  }
  cout << K - vmax << endl;

  return 0;
}



Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val N = sc.next().toInt()
    val Y = sc.next().toInt()

    fun check(x:Int, y:Int, z:Int): Boolean {
        return when {
            z < 0 -> false
            x * 10000 + y * 5000 + z * 1000 != Y -> false
            else -> {
                println("$x $y $z")
                true
            }
        }
    }

    for (i in 0..N){
        for (j in 0..N) {
            if (check(i, j, N-i-j)) {
                return
            }
        }
    }

    println("-1 -1 -1")
}

Measured memory_bytes: 31396
#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%I64d", &x)
#define ss(s) scanf("%s", s)
#define pb push_back
#define em emplace_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define clr(x) memset(x, 0, sizeof(x))
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
const int mod = 1e9 + 7;
int epow(int base, int pow)
{
    int result = 1;
    while (pow)
    {
        if (!(pow % 2))
        {
            base = (base * base) % mod;
            pow /= 2;
        }
        else
        {
            result = (result * base) % mod;
            pow--;
        }
    }
    return result;
}
int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    si(n);
    double d = 2 * n * PI;
    cout << setprecision(24) << d << endl;
}

Measured memory_bytes: 3872
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int check(int x,int y, vvi ch) {
  int flg = 1;
  REP(i,8) {
    if(ch[x][i]==1) {
      flg=0;
      break;
    }
    if(ch[i][y]==1)  {
      flg=0;
      break;
    }
    if(x+i<8&&y+i<8) {
      if(ch[x+i][y+i]==1)  {
      flg=0;
      break;
    }
    }
    if(x-i>=0&&y+i<8) {
      if(ch[x-i][y+i]==1)  {
      flg=0;
      break;
    }
    }
    if(x+i<8&&y-i>=0) {
      if(ch[x+i][y-i]==1)  {
      flg=0;
      break;
    }
    }
    if(x-i>=0&&y-i>=0) {
      if(ch[x-i][y-i]==1)  {
      flg=0;
      break;
    }
    }
  }
  return flg;
}

int main() {
  int n;
  cin >> n;
  vvi ch1(8,vi(8,0));
  vi xx(8),yy(8);
  REP(i,8) {
    xx[i]=i;
    yy[i]=i;
  }
  int x,y;
  REP(i,n) {
    cin >> x >> y;
    ch1[x][y]=1;
    auto xi=find(ALL(xx),x);
    auto yi=find(ALL(yy),y);
    xx.erase(xi);
    yy.erase(yi);
  }
  do {
    bool flg=true;
    vvi ch2=ch1;
    REP(i,8-n) {
      int cx=xx[i],cy=yy[i];
      if(!check(cx,cy,ch2)) {
        flg=false;
        break;
      }
      ch2[cx][cy]=1;
    }
    if(flg) {
  REP(i,8) {
    REP(j,8) {
      if(ch2[i][j]==1) cout << "Q";
      else cout << ".";
    }
    cout << endl;
  }
      break;
    }
  } while(next_permutation(ALL(xx)));
  return 0;
}



Measured memory_bytes: 3152
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 105;
const ll mm = 1e+18;
int ncr(int n,int k){
    if(k>n-k) k=n-k;
    int res=1;
    rep0(i,k){
        res*=(n-i);
        res/=(i+1);
    }
    return res;
}
void solve()
{
    int n,l,r;
    cin>>n>>l>>r;
    int a[n];
    map<int,int>mp;
    rep0(i,n) {cin>>a[i];mp[a[i]]++;}
    sort(a,a+n);
    reverse(a,a+n);
    int sum=0;
    rep0(i,l-1) sum+=a[i];
    pair<int,int>mx={1,2}; 
    repp(i,l-1,r){
        sum+=a[i];
        if(sum*mx.s>mx.f*(i+1)){
            int z=__gcd(sum,i+1);
            mx={sum/z,(i+1)/z};
        }
    }
    map<int,int>mpp;
    sum=0;
    rep0(i,l-1) {mpp[a[i]]++;sum+=a[i];}
    int ans=0;
    repp(i,l-1,r){
        sum+=a[i];
        mpp[a[i]]++;
        if(sum*mx.s==mx.f*(i+1)){
            auto it=mpp.beg;
            //deb(it->f,it->s,mp);
            ans+=ncr(mp[it->f],it->s);
        }
    }
    double f=(double)(mx.f)/mx.s;
    cout<<fixed<<setprecision(10)<<f<<"\n";
    cout<<ans;
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 3868
S = input()
 
Dict = {}
 
for i in range(4):
  s = S[i]
  if s in Dict:
    Dict[s] += 1
  else:
    Dict[s]=1
    
if len(Dict)!=2:
  print("No")
else:
    List = list(Dict.values())
    if List[0]!=2 or List[1]!=2:
        print("No")
    else:
        print("Yes")


Measured memory_bytes: 3060