akhauriyash/Code-Regression huggingface dataset:
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;
 
bool isp[mx];
 
void sv(){
 
	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}
 
ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
    ll n,a[mx], i, j;
    cin>>n;
    double an= 0.0;
    for(i=0; i< n; i++){
        cin>>a[i];
        an+= (1.0/a[i]);
    }
    an= 1.0/an;
    cout<<an;

    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;

	char buf[L], *S , *T, c;

	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}

	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}

	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	char B[45], *outs=B+40, *outr=B+40;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;

		if(!a)*--outs = '0';
		else
			while(a)
				*--outs = (a % 10) + 48, a /= 10;

		if(x)
			*--outs = x;

		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
//using i128 = __int128_t;
//using u128 = __uint128_t;
using i128 = i64;
using u128 = u64;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

ll exgcd(ll a, ll b, ll &x, ll &y)
{
	if (b == 0)
	{
		x = 1;
		y = 0;
		return a;
	}
	ll px, py;
	ll d = exgcd(b, a%b, px, py);
	x = py;
	y = px-a/b*py;
	return d;
}

template<class T>
inline void freshmin(T &a, const T &b)
{
	if (a > b) a = b;
}

template<class T>
inline void freshmax(T &a, const T &b)
{
	if (a < b) a = b;
}

const int MOD = 1000000007;
const int MAXN = 100010;

int n;
int a[MAXN];

int main()
{
	
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	puts(e-a <= k ? "Yay!" : ":(");
	
	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]
B = [int(input()) for _ in range(m)]
C = [0 for _ in range(n)]
for i in range(n):
    for j in range(m):
        C[i] += A[i][j] * B[j]
for c in C:
    print(c)



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

int main() {
  int n; cin >> n;
  vector<int> vec(n);
  vector<int> dis(110, 0);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < n; i++) {
    dis.at(vec.at(i)) = 1;
  }
  int ans = 0;
  for (int i = 0; i < 101; i++) {
    ans += dis.at(i);
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
<?php

// define('DEBUG', true);
define('DEBUG', false);

$ans = 0;

fscanf(STDIN, "%d", $N);
$A = explode(" ", trim(fgets(STDIN)));
$B = explode(" ", trim(fgets(STDIN)));
$C = explode(" ", trim(fgets(STDIN)));

$sumA = array();
$sumB = array();
$sumC = array();

foreach ($A as $v) {
    $sumA[$v]++;
}
foreach ($B as $v) {
    $sumB[$v]++;
}
foreach ($C as $v) {
    $sumC[$v]++;
}

// var_dump($sumA);
// var_dump($sumB);
// var_dump($sumC);

ksort($sumA);
ksort($sumB);
krsort($sumC);

// var_dump($sumA);
// var_dump($sumB);
// var_dump($sumC);
// exit;

$tmp = 0;
foreach ($sumA as $k => $v) {
    $tmp += $v;
    $sumA[$k] = $tmp;
}
$tmp = 0;
foreach ($sumC as $k => $v) {
    $tmp += $v;
    $sumC[$k] = $tmp;
}

if (DEBUG) var_dump($sumA);
if (DEBUG) var_dump($sumB);
ksort($sumC);
if (DEBUG) var_dump($sumC);


$keyA = array_keys($sumA);
$keyB = array_keys($sumB);
$keyC = array_keys($sumC);

$curA = 0;
$curC = 0;
foreach ($sumB as $k => $v) {
    if (DEBUG) echo "B:{$k} {$v}\n";

    if ($keyA[$curA] >= $k) {
        $mulA = 0;
    } else {
        while (count($keyA) > $curA+1 && $keyA[$curA+1] < $k) {
            if ($curA > count($keyA)) {
                break;
            }
            $curA++;
        }
        $mulA = $sumA[$keyA[$curA]];
    }
    if (DEBUG) echo " A:{$keyA[$curA]} {$sumA[$keyA[$curA]]} mulA:{$mulA}\n";

    $mulC = $sumC[$keyC[$curC]];
    while ($keyC[$curC] <= $k) {
        $curC++;
        if ($curC > count($keyC)) {
            $mulC = 0;
            break;
        }
        $mulC = $sumC[$keyC[$curC]];
    }
    if (DEBUG) echo " C:{$keyC[$curC]} {$sumC[$keyC[$curC]]} mulC:{$mulC}\n";

    $ans += $v * $mulA * $mulC;
}

echo $ans . PHP_EOL;

exit;


foreach ($keyA as $idxA => $A) {
    foreach ($keyB as $idxB => $B) {
        echo "{$keyA[$idxA]} >= {$keyB[$idxB]}\n"; 
        if ($keyA[$idxA] >= $keyB[$idxB]) continue;
        foreach ($keyC as $idxC => $C) {
            echo "{$keyB[$idxB]} >= {$keyC[$idxC]}\n"; 
            if ($keyB[$idxB] >= $keyC[$idxC]) continue;
            echo "{$keyA[$idxA]}[{$sumA[$keyA[$idxA]]}] {$keyB[$idxB]}[{$sumB[$keyB[$idxB]]}] {$keyC[$idxC]}[{$sumC[$keyC[$idxC]]}]\n";
        }
    }
}


exit("END\n");

fscanf(STDIN, "%s", $c);
$a = array();
foreach (range(1, 4) as $x) $a[$x] = substr_count($c, $x);
echo max($a), " ", min($a), "\n";


Measured memory_bytes: 53996
#include<bits/stdc++.h>
using namespace std;
struct RMQ{
  static const int MAX_N = 1 << 17;
  int n,dat[2*MAX_N-1];
  RMQ(){}
  RMQ(int n_){init(n_);}
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    for(int i=0;i<2*n-1;i++) dat[i]=INT_MAX;
  }
  void update(int k,int a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }
  int query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return INT_MAX;
    if(a<=l&&r<=b) return dat[k];
    else{
      int vl=query(a,b,k*2+1,l,(l+r)/2);
      int vr=query(a,b,k*2+2,(l+r)/2,r);
      return min(vl,vr);
    }
  }
  int query(int a,int b){
    return query(a,b,0,0,n);
  }
};
int main(){
  int n,q;
  cin>>n>>q;
  RMQ rmq(n);
  for(int i=0;i<q;i++){
    int c,x,y;
    cin>>c>>x>>y;
    if(c) cout<<rmq.query(x,y+1)<<endl;
    else rmq.update(x,y);
  }
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> Ps(n);
  int count = 0;
  
  for (int i = 0; i < n; i++)
    cin >> Ps.at(i);
  
  for (int i = 1; i < n - 1; i++) {
    if (Ps.at(i-1) < Ps.at(i) && Ps.at(i) < Ps.at(i+1))
      count++;
    else if (Ps.at(i-1) > Ps.at(i) && Ps.at(i) > Ps.at(i+1))
      count++;
  }
    
  cout << count << endl;
}

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

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

int main() {
  int N;
  cin >> N;
  vector<int64> A(N);
  cin >> A;
  int64 sum = accumulate(A.begin(), A.end(), 0LL) / 2;
  int64 all_plus_b0 = 0;
  for (int i = 0; i < N; i += 2) {
    all_plus_b0 += A[i];
  }
  int64 A0 = all_plus_b0 - sum;
  cout << A0 * 2 << ' ';
  int64 prev = A0;
  for (int i = 0; i < N - 2; i++) {
    int64 tmp = A[i] - prev;
    cout << tmp * 2 << ' ';
    prev = tmp;
  }
  cout << (A.back() - A0) * 2 << endl;
  return 0;
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
LL fac[SIZE],inv[SIZE];
LL mypow(LL x,LL y){
    LL res=1;
    while(y){
        if(y&1)res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}
LL CC(int x,int y){
    if(y<0||y>x)return 0;
    return fac[x]*inv[y]%MOD*inv[x-y]%MOD;
}
void build(){
    assert(MOD>=SIZE);
    fac[0]=1;
    REPP(i,1,SIZE)fac[i]=fac[i-1]*i%MOD;
    inv[SIZE-1]=mypow(fac[SIZE-1],MOD-2);
    for(int i=SIZE-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%MOD;
}
LL dp[5001][5001];
void ADD(LL& x,LL v){x=(x+v)%MOD;}
int main(){
    build();
    DRI(N);
    DRIII(A,B,C);
    if(B%2)return 0*puts("0");
    MS1(dp);
    LL base=CC(A+B/2,A),an=0;
    if(B){
        REP(i,C+1)REP(j,C-i+1){
            if((C-i-j)%3)continue;
            ADD(an,CC(A,i)*CC(A+B/2+(C-i-j)/3,(C-i-j)/3)%MOD*CC(B/2+j-1,j));
        }
    }
    else{
        REP(i,C+1){
            int j=0;
            if((C-i-j)%3)continue;
            ADD(an,CC(A,i)*CC(A+B/2+(C-i-j)/3,(C-i-j)/3));
        }
    }
    cout<<an*base%MOD<<endl;
    return 0;
}


Measured memory_bytes: 211328
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<bitset>
#include<complex>
#include<cmath>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
int A,B;
int n=100;
char mp[105][105];
int main()
{
	read(A);
	read(B);
	for(int i=0;i<n;i++)
		for(int j=0;j<(n/2);j++)
			mp[i][j]='.';
	for(int i=0;i<n;i++)
		for(int j=0;j<(n/2);j++)
			mp[i][j+(n/2)]='#';
	A--;
	B--;
	for(int i=0;i<n;i++)
		for(int j=0;j<(n/2);j++)
		{
			if(B==0)	break;
			if((i&1) || (j&1))	continue;
			B--;
			mp[i][j]='#';
		}
	for(int i=0;i<n;i++)
		for(int j=(n/2)+2;j<n;j++)
		{
			if(A==0)	break;
			if((i&1) || (j&1))	continue;
			A--;
			mp[i][j]='.';
		}
	cout<<n<<' '<<n<<endl;
	for(int i=0;i<n;i++)
		cout<<mp[i]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>

#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>

#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	if (s.size() == 4 && s[0] == s[1] && s[2] == s[3] && s[1] != s[2])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;	


}














Measured memory_bytes: 256
n = int(input())
A = [int(i) for i in input().split()]

l = -1
r = 10 ** 9 + 1

def f(m):
    C = A[:]
    C[0] -= m // 2
    C[-1] -= m // 2
    for i in range(n - 1):
        C[i + 1] -= C[i]
        C[i] = 0
        if C[i + 1] < 0:
            return i % 2 == 1
    if C[-1] == 0:
        return True
    return False
    
while abs(r - l) > 1:
    m = (l + r) // 2
    if f(m * 2):
        r = m
    else:
        l = m

C = A[:]
C[0] -= r
C[-1] -= r
ans = [r * 2]
for i in range(n - 1):
    ans.append(2 * C[i])
    C[i + 1] -= C[i]

print(*ans)

Measured memory_bytes: 83812
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

    REP(i, s.size()) {
        s[i] = s[i] + n;
        if (s[i] > 'Z') s[i] -= 26;
    }

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
//#define rep(i, n) for(int (i) = 0, TmP = (n); (i) < (int)TmP ; ++(i))
//rep(i, v.size()) v[i]=i;
//#define int long long
#define asort(v, n) sort((v), (v + n)) //Using array
#define vsort(v) sort((v).begin(), (v).end()) // Using vector
#define vint vector<int>p

using namespace std;

signed main(){
  int K, X;
  cin >> K >> X;
  if(500 * K >= X)cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int n;
    cin >> n;
    vector<int> a(100005);
    int x;

    for (int i = 0; i < n; i++){
        cin >> x;
        a[x+2]++;
        a[x+1]++;
        a[x]++;
    }

    cout << *max_element(all(a)) << endl;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int x, y, b, p;
		cin >> x >> y >> b >> p;
		int pay, ifpay;
		if (b >= 5 && p >= 2) {
			pay = (x*b + y * p)*0.8;
			cout << pay << endl;
			continue;
		}
		else
			pay = x * b + y * p;

		if (b < 5 && p < 2)
			ifpay = (x * 5 + y * 2)*0.8;
		if (b < 5 && p >= 2)
			ifpay = (x * 5 + y * p)*0.8;
		if (b >= 5 && p < 2)
			ifpay = (x*b + y * 2)*0.8;
		if (pay < ifpay)
			cout << pay << endl;
		else
			cout << ifpay << endl;
	}
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
int frog(vector<int> A,int k)
{
  int n=A.size();
  if(n<=1)
    return 0;
  if(n==2)
    return abs(A[0]-A[1]);
  int dp[n];
  memset(dp,0,sizeof(dp));
  dp[n-1]=0;
  dp[n-2]=abs(A[n-1]-A[n-2]);
  for(int i=n-3;i>=0;i--)
  {
    int mini=INT_MAX;
    for(int j=1;j<=k && i+j<n;j++)
    {
      mini=min(mini,abs(A[i]-A[i+j])+dp[i+j]);
    }
    dp[i]=mini;
  }
   return dp[0];
}
int main()
{
  int N,k;
  cin>>N>>k;
  vector<int> A(N);
  for(int i=0;i<N;i++)
    cin>>A[i];
  cout<<frog(A,k);
  return 0;
}

Measured memory_bytes: 1536
(let ((h (read))
      (w (read)))
  (princ 
    (if (or (= h 1)
            (= w 1))
        1
        (if (or (evenp h)
                (evenp w))
            (/ (* w h) 2)
            (+ (/ (- (* w h) 1) 2) 1)))))

Measured memory_bytes: 12640
#include <iostream>

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		if (x >= k) ans++;
	}
	cout << ans << "\n";
	return 0;
}

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

#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, str;
	cin >> s;

	int len = s.length();
	str = s[0] + to_string(len-2) + s[len - 1];
	cout << str << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
int H, W, D, Q;
vector<vector<int>> A;
vector<pair<int, int>> lr;




//サブ関数
//入力
void input()
{
	cin >> H >> W >> D;
	
	REP(i, H) {
		int tmp;
		vector<int> tmpv;
		REP(j, W) {
			cin >> tmp;
			tmp--;
			tmpv.push_back(tmp);
		}
		A.push_back(tmpv);
	}
	cin >> Q;
	int l, r;
	REP(i, Q) {
		cin >> l >> r;
		l--; r--;
		lr.push_back(make_pair(l, r));
	}
}


//計算
void calc()
{
	//数値　i のある場所
	vector<pair<int, int>> place(H*W);
	REP(i, H)REP(j, W) {
		place[A[i][j]] = make_pair(i, j);
	}

	//飛ぶ場合のコスト
	vector<vector<int>> imos;

	//mod D の各グループに対して
	REP(i, D) {
		vector<int> tmpv(1, 0);
		for (int j = i + D; j < H*W; j += D) {
			int score = 0;
			score += abs(place[j].first - place[j - D].first);
			score += abs(place[j].second - place[j - D].second);
			tmpv.push_back(score);
		}
		REP(i, (int)tmpv.size() - 1) {
			tmpv[i + 1] += tmpv[i];
		}
		imos.push_back(tmpv);
	}
	/*
	cout << "imos" << endl;
	for (auto row : imos) {
		for (auto col : row) {
			cout << col << " ";
		}
		cout << endl;
	}
	cout << " ... " << endl;
	*/
	for (auto num : lr) {
		int group = num.first%D;
		int l = num.first / D;
		int r = num.second / D;
		cout << imos[group][r] - imos[group][l] << endl;
	}
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 8304
import math
if __name__ == "__main__":
    N, K = map(int, input().split())
    if N == 0:
        ret = 0
        print(int(ret))
        exit(0)
    ret = N - N // K * K
    while ret > abs(ret-K):
        ret = abs(ret-K)
    print(int(ret))

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

const long long int INF=1000*1000*1000*1000*1000*100+3;
long long int un,deux,quatre,huit,quantite,litre=INF,doubleLitre=INF,prix;

void dfsUn(int restant,int total){
	if(restant<=0){
		if(restant==0 && total<litre) litre=total;
		return;
	}
	dfsUn(restant-1,total+un);
	dfsUn(restant-2,total+deux);
	dfsUn(restant-4,total+quatre);
	dfsUn(restant-8,total+huit);
}
void dfsDeux(int restant,int total){
	if(restant<=0){
		if(restant==0 && total<doubleLitre) doubleLitre=total;
		return;
	}
	dfsDeux(restant-1,total+un);
	dfsDeux(restant-2,total+deux);
	dfsDeux(restant-4,total+quatre);
	dfsDeux(restant-8,total+huit);
}

int main(){
	cin >> un >> deux >> quatre >> huit >> quantite;
	quantite*=4;
	
	dfsUn(4,0);
	dfsDeux(8,0);
	
	if(quantite%8==0) prix= (quantite/8)*doubleLitre;
	else prix=(quantite/8)*doubleLitre+litre;
	
	cout << prix << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
//const ll MOD = 1000000007ll;
const ll MOD = 998244353ll;
const dou pi=3.141592653589793;
//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう

int main(){
    int x,t;
    std::cin >> x>>t;
    std::cout << max(0,x-t) << std::endl;
}

Measured memory_bytes: 256
import math
s = int(input())
n = s//3
ans = 0
if n == 0:
    print(0)
else:
    for i in range(n):
        res = s-(3*(i+1))
        fact1 = math.factorial(res+i)
        if res == 0:
            fact2 = 1
        else:
            fact2 = math.factorial(res)
        if i == 0:
            fact3 = 1
        else:
            fact3 = math.factorial(i)
        ans += fact1//(fact2*fact3)
    print(ans % (10**9 + 7))

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

    typedef long long int ll;
    #define pb         push_back
    #define mp         make_pair
    #define F          first
    #define S          second
    #define fl(i,a,b)  for(ll i=a;i<b;i++)
    #define pll        pair<ll,ll>
    #define pii        pair<int,int>
    #define all(v)     v.begin(),v.end()
    #define M 1000000007
    #define tr(v, it) for(auto it = v.begin(); it != v.end(); it++)
    using namespace std;



    int main()
    {

        ios_base::sync_with_stdio(false);
    	cin.tie(NULL);

          string s,t;
          cin>>s>>t;
          int dp[s.length()+1][t.length()+1];

          for(int i=0; i<=s.length(); i++)
          {
              for(int j=0; j<=t.length(); j++)
              {
                  if(i==0 || j==0)
                    {
                        dp[i][j]=0;

                    }
                  else
                  {
                        if(s[i-1]==t[j-1])
                            {
                                dp[i][j] = dp[i-1][j-1]+1;

                            }
                        else
                        {
                            dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
                        }
                  }

              }
          }

          int i=s.length();
          int j=t.length();
          string ans="";
          while(i>0 && j>0)
          {
              if(s[i-1]==t[j-1])
              {
                  ans+=s[i-1];
                  i--;
                  j--;
              }
              else
              {
                  if(dp[i-1][j]>=dp[i][j-1])
                    i--;
                  else
                    j--;
              }
          }

          for(i=ans.length()-1; i>=0; i--)
            cout<<ans[i];

       return 0;
    }


Measured memory_bytes: 38804
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
 
using namespace std;

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

  int n;
  cin>>n;
  int c[25], v[25], sum = 0;
  rep(i,n){
    cin >> v[i];
  }
  rep(i,n){
    cin >> c[i];
  }
  rep(i,n){
    if ( v[i] > c[i] ) {
      sum += (v[i] - c[i]);
    }
  }
  cout << sum << '\n';
  return 0;
}


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

const int MAXN = 1000 * 1000 + 10;
const long long INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 10;

long long dp[3005][3005];
bool which[3005][3005];

vector <char> ans;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //cout << fixed << setprecision(10);


    string s, t;
    cin >> s >> t;


    if(s[0] == t[0]) dp[0][0] = 1;

    for(int i = 1; i < t.size(); i++){
        dp[0][i] = dp[0][i - 1];

        if(s[0] == t[i]) dp[0][i] = 1;
    }

    for(int i = 1; i < s.size(); i++){

        dp[i][0] = dp[i - 1][0];
        if(s[i] == t[0]) dp[i][0] = 1;

        for(int j = 1; j < t.size(); j++){
            dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
            if(dp[i][j] == dp[i][j - 1]) which[i][j] = true;

            if(s[i] == t[j]) dp[i][j] = dp[i - 1][j - 1] + 1;
            //cerr << "dp i: " << i << " j: " << j << " dp : " << dp[i][j] << endl;
        }
    }

//truetruetrue
//falsefalsefalse

    int i = s.size() - 1, j = t.size() - 1;

    while(j != 0 and i != 0){

        //cerr << "i: " << i << " j: " << j << endl;

        if(s[i] == t[j]){
            ans.push_back(s[i]);
            i--;
            j--;
        }
        else{
            if(which[i][j]){
                j--;
            }
            else{
                i--;
            }
        }
    }

    if(j == 0){
        for(int k = 0; k <= i; k++){
            if(t[0] == s[k]){
                ans.push_back(t[0]);
                break;
            }
        }
    }
    else{
        for(int k = 0; k <= j; k++){
            if(s[0] == t[k]){
                ans.push_back(s[0]);
                break;
            }
        }
    }

    //cerr << dp[s.size() - 1][t.size() - 1] << endl;

    for(int i = ans.size() - 1; i >= 0; i--) cout << ans[i];

    cout << endl;

    return 0;
}



Measured memory_bytes: 82848
import fractions
a, b, c, d = map(int, input().split())

lcm = (c * d) // fractions.gcd(c, d)

total = b - (b//c + b//d - b//lcm)
total_del = a-1 -((a-1)//c + (a-1)//d - (a-1)//lcm)

print(total - total_del)

Measured memory_bytes: 5048
A, B, M = gets.split.map &:to_i
a = gets.split.map { |i| i.to_i }
b = gets.split.map { |i| i.to_i }
discount = []
M.times do
  discount << gets.split.map { |i| i.to_i - 1 }
end

ans = a.min + b.min
discount.each do |arr|
  temp = a[arr[0]] + b[arr[1]] - arr[2] - 1
  ans = temp if temp < ans
end

puts ans

Measured memory_bytes: 28876
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t

// the resulting sequence after putting N cards looks like a valley, where 1 is the bottom number
// and the sequence that we have to construct is made of two decreasing sequences
// let dp[i][j] = # ways to construct the two chains, where the first i positions is determined, and the minimum is j
// a0         a_n-1
// 	a1      ...
//   a2    a_k+1
//    a3  a_k
//     ...
//      1

const ll mod=1e9+7;
const int N=2005;
int n,k;
ll dp[N][N];

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>k;
	dp[0][0]=1;
	for(int i=0;i<k;++i){
		ll sum=0;
		for(int j=1;j<=n;++j){
			(sum+=dp[i][j-1])%=mod;
			(dp[i+1][j]+=sum)%=mod;
			if(j>i&&j!=n) (dp[i+1][j]+=dp[i][j])%=mod;
		}
	}
	ll res=dp[k][n];
	for(int i=0;i<n-k-1;++i)
		res=res*2LL%mod;
	cout<<res<<'\n';
}



Measured memory_bytes: 34888
using System;
using System.Linq;
using System.Collections.Generic;




namespace ConsoleApplication1 {

    

    class ClassMain {



        public static void Main(String[] args) {
           //string line;

           for (int i = 0; i < 7; i++) {
               int[] ints = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
               Console.WriteLine(ints[0] - ints[1]);
           }
           /*while ((line = Console.ReadLine()) != null) {
                int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                int n = ints[0];
                //int n = int.Parse(line);                
                if (n == 0) { break; }
                int m = ints[1];

                Console.WriteLine(n - m);
                int k = 6;
                while (k-- > 0) {
                    ints = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                    n = ints[0];
                    m = ints[1];
                    Console.WriteLine(n - m);
                }
                break;
                
 

            }*/
        }

    }

    


}

Measured memory_bytes: 5916
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

template <typename T>
class UnionFind{
    public:
        int n;
        vector<T> p, rank;

        UnionFind(int n)
            : n(n), p(n+1, -1), rank(n+1) {}

        int find(int v){
            if(p[v] == -1){
                return v;
            }
            p[v] = find(p[v]);
            return p[v];
        }

        bool unite(int u, int v){
            u = find(u);
            v = find(v);

            if(u == v){
                return false;
            }

            if(rank[u] < rank[v]){
                swap(u, v);
            }

            if(rank[u] == rank[v]){
                rank[u]++;
            }

            p[v] = u;
            return true;
        }

        bool same(int u, int v){
            u = find(u);
            v = find(v);
            return u == v;
        }
};

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

    int n;
    cin >> n;
    UnionFind<int> uf(200000);
    rep(i, n){
        int a, b;
        cin >> a >> b;
        uf.unite(a, b + 100000);
    }

    map<int, int> x, y;
    for(int i = 1; i <= 100000; i++){
        x[uf.find(i)]++;
    }
    for(int i = 100001; i <= 200000; i++){
        y[uf.find(i)]++;
    }

    int ans = 0;
    for(P p : x){
        ans += p.second * y[p.first];
    }
    cout << ans - n << endl;

    return 0;
}


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

int main() {
	
	int N;
	cin >> N;
	vector<int> w(N);
	int sum = 0;
	vector<int> s(N);

	for (int i = 0; i < N; i++) {
		cin >> w.at(i);
		sum += w.at(i);
		if (i == 0) s.at(i) = w.at(i);
		else s.at(i) = w.at(i) + s.at(i - 1);
	}

	int ans=10000;
	int tmp = 10000;
	for (int i = 0; i < N; i++) {
		tmp = abs(sum - 2 * s.at(i));
		if (tmp < ans)ans = tmp;

	}
	cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();

		StringBuilder answer = new StringBuilder();

		for (int i = 0; i < line.length(); i++) {
			String s = line.substring(i, i + 1);
			char cs = line.charAt(i);
			if (Character.isUpperCase(cs)) {
				answer.append(s.toLowerCase());
			} else {
				answer.append(s.toUpperCase());
			}

		}

		System.out.println(answer);

	}
}

Measured memory_bytes: 26396
//Robs Code

/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <iomanip>

/***********MACROS***************/
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define pii pair<int,int>

using namespace std;

const int N = 1e5 + 1;
int n,m,i,j,k,l,x,y,z,cnt[3],sum[3];

/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	string s1,s2;
	cin >> s1 >> s2;
	n = s1.length();
	int cnt = 0;
	for(int i =0 ;i < n;i++){
		if(s1[i]!= s2[i]){
			cnt++;
		}
	}
	cout << cnt << "\n";
}
//.........

Measured memory_bytes: 3768
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
string s, rs, s1, s2, ts;

//使用する関数
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 (a > b) { a = b; return 1; }
	return 0;
}



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

	cin >> s;
	rs = s;
	reverse(All(rs));

	s1 = s.substr(0, (s.length() - 1) / 2);
	s2 = s.substr((s.length() + 1) / 2, (s.length() - 1) / 2);

	reverse(All(s1));
	reverse(All(s2));

	ts = s1 + s[(s.length() - 1) / 2] + s2;
	if (s == ts && s==rs) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

struct Sieve{
  int n;
  vector<int> f,primes;
  Sieve(int n=1):n(n),f(n+1){
    f[0] = f[1] = -1;
    for(ll i = 2; i<=n;++i){
      if(f[i]) continue; //素数でない場合continue
      primes.push_back(i);
      f[i] = i;
      for(ll j=i*i;j<=n;j+=i){
        if(!f[j]) f[j]=i;
      }
    }
  }
  bool isPrime(int x){
    return f[x]==x;
  }
  vector<int> factorList(int x){
    vector<int> res;
    while(x != 1){
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x){
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1,P(fl[0],0));
    for (int p:fl){
      if(res.back().first == p){
        res.back().second++;
      }else{
        res.emplace_back(p,1);
      }
    }
    return res;
  }
};


int main(){
    int n;
    cin >> n;
    vector<int> freq(101,0);
    Sieve s(101);
    for(int i=2; i<=n; ++i){
        vector<P> f;
        f = s.factor(i);
        for(auto fa:f){
            freq[fa.first]+=fa.second;
        }
    }

    int num2=0; int num4=0; int num14=0; int num24=0; int num74=0;
    rep(i,101){
        //cout << i << ":" << freq[i] << endl;
        if(freq[i]>=2) num2++;
        if(freq[i]>=4) num4++;
        if(freq[i]>=14) num14++;
        if(freq[i]>=24) num24++;
        if(freq[i]>=74) num74++;
    }

    /*
    cout << num2 << endl;
    cout << num4 << endl;
    cout << num14 << endl;
    cout << num24 << endl;
    cout << num74 << endl;
    */
   
    int res=0;
    res+=num74;
    res+=num24*(num2-1);
    res+=num14*(num4-1);
    res+=num4*(num4-1)*(num2-2)/2;

    cout << res << endl;
}

Measured memory_bytes: 256
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let n = line.trim().parse::<i32>().ok().unwrap();
    if n >= 30 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2108
#include <stdio.h>


int main(void){
	int sx,sy,tx,ty;
	int i,j;

	scanf("%d %d %d %d", &sx, &sy, &tx, &ty);

	for(i=0; i<ty-sy; i++){
		printf("U");
	}
	for(i=0; i<tx-sx; i++){
		printf("R");
	}
	for(i=0; i<ty-sy; i++){
		printf("D");
	}
	for(i=0; i<tx-sx; i++){
		printf("L");
	}
	printf("L");
		for(i=0; i<=ty-sy; i++){
			printf("U");
		}
		for(i=0; i<=tx-sx; i++){
			printf("R");
		}
	printf("D");

	printf("R");
		for(i=0; i<=ty-sy; i++){
			printf("D");
		}
		for(i=0; i<=tx-sx; i++){
			printf("L");
		}
	printf("U");

return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, start, end) for(int i = start; i < (int)(end); ++i)

int main(){
    double l;
    cin >> l;
    double ans = l/3 * l/3 * l/3;
    cout << std::fixed << std::setprecision(15) << ans << endl;
    return 0;
}

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

int main() {
  
  string S;
  cin >> S;
  
  if (S == "a" || S == "i" || S == "u" || 
      S == "e" || S == "o") {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 20
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define ll long long
#define SIZE N
using namespace std;
int dp[N][10],k;
int rec(int in, int dig){
    if(in ==0)dp[in][dig]= 1;
    if(dp[in][dig]!=-1)return dp[in][dig];
    int ans = 0;
    for(int i=0;i<10;i++){
        if(abs(i-dig)<=1)ans += rec(in-1,i);
    }
    dp[in][dig] = ans;
    return dp[in][dig];
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>k;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<10;i++)rec(N-1,i);
    int sum = 0;
    int len = 0; 
    for(int i=0;i<N;i++){
      	int tmp = sum;
        for(int j=1;j<10;j++){
            sum += dp[i][j];
            if(sum>=k){
              	k -= tmp;
                len = i+1 ; break;
            }
        //  cout<<sum<<" "<<i<<" "<<j<<"\n";
        }
        if(len)break;
    }
 // cout<<sum<<" "<<len<<"\n";
    int ans = 0;
  int pr = -1;
    for(int i=len-1;i>=0;i--){
      int st = 0;
      if(i==len-1)st = 1;
        for(int j = st;j<10;j++){
           if(pr==-1||abs(pr-j)<=1){
            if(dp[i][j]>=k){
                ans*=10;
                ans += j;
              pr = j;
              break;
            }
          k -= dp[i][j];
           }
        }
    }
    cout<<ans;
        return 0;
}


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

using namespace std;

typedef long long ll;

constexpr int MAXN = 1000000, MAXF = 2 * MAXN + 2, MOD = 1000000007;

int fac[MAXF + 2], inv[MAXF + 2];

int mpow(int b, int e) {
	int res = 1;
	while(e) {
		if(e & 1) res = (ll)res * b % MOD;
		b = (ll)b * b % MOD;
		e >>= 1;
	}
	return res;
}

int comb(int n, int k) {
	return (ll)fac[n] * inv[k] % MOD * inv[n - k] % MOD;
}

int reduce(int x) {
	return x >= MOD ? x - MOD : x;
}

int psa(int x, int y) {
	return reduce(comb(x + y + 2, x + 1) + MOD - 1);
}

int rect(int x1, int y1, int x2, int y2) {
	--x1; --y1;
	return ((ll)psa(x2, y2) - psa(x1, y2) - psa(x2, y1) + psa(x1, y1) + 2ll * MOD) % MOD;
}

int main() {
	fac[0] = 1;
	for(int i = 1; i <= MAXF; i++)
		fac[i] = (ll)fac[i - 1] * i % MOD;
	inv[MAXF] = mpow(fac[MAXF], MOD - 2);
	for(int i = MAXF - 1; i > 0; i--)
		inv[i] = (ll)(i + 1) * inv[i + 1] % MOD;
	int r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	int ans = rect(c1, r1, c2, r2);
	cout << ans << '\n';
}


Measured memory_bytes: 15872
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b;
	cin>>a>>b;
	cout<<a*(a-1)/2+b*(b-1)/2<<endl;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int V = 1e5 + 100;
const int W_MAX = 1e9 + 5;
int n, we, w[N], v[N];
int dp[V];

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

	cin >> n >> we;

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

	for (int j = 0; j < V; j++) {
		dp[j] = W_MAX;
	}

	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = V - 1; j >= 0; j--) {
			if (dp[j] == W_MAX) continue;
			dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
		}
	}

	int ans = 0 ;
	for (int i = V - 1; i > 0; i--) {
		if (dp[i] > we) continue;
		ans = i;
		break;
	}

	cout << ans << '\n';

	return 0;
}


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

typedef long long ll;

int main(){
  ll n,k;
  cin >> n >> k;
  ll a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  ll sum[n];
  sum[0]=a[0]%k;
  for(int i=1;i<n;i++){
    sum[i]=sum[i-1]+a[i];
    sum[i]%=k;
  }
  sort(sum,sum+n);
  ll ans=0;
  ll count=0;
  ll now=sum[0];
  for(int i=0;i<n;i++){
    if(sum[i]==now){
      count++;
    }
    else{
      if(now==0){
        count++;
      }
      ans=(ans+count*(count-1)/2);
      count=1;
      now=sum[i];
    }
  }
  if(now==0){
    count++;
  }
  ans=(ans+count*(count-1)/2);
  cout << ans << endl;
}

Measured memory_bytes: 1792
N, total = map(int, input().strip().split(" "))
bills = [-1, -1, -1]

for i in range(int(total/10000)+1):

    x = total - 10000*i

    for j in range(int(x/5000)+1):

        y = x-5000*j

        k = N - i -j

        if y-1000*k == 0:
    
            bills = [i, j, k]
            break

print(" ".join(map(str, bills)))

Measured memory_bytes: 3188
from itertools import product

n, m = map(int, input().split())
xyz = [list(map(int, input().split())) for _ in range(n)]
ans = 0

for e in product([1, -1], [1, -1], [1, -1]):
    xyz.sort(key=lambda v: (v[0] * e[0]) + (v[1] * e[1]) + (v[2] * e[2]))
    tmp = xyz[:m]
    ans = max(ans, abs(sum([e[0] for e in tmp])) + abs(sum([e[1] for e in tmp])) + abs(sum([e[2] for e in tmp])))
print(ans)


Measured memory_bytes: 40432
import java.util.Scanner;

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

		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int x = stdIn.nextInt();
		int back = 0;
		int go = 0;
		int[] a = new int[m];
		int i;
		for(i = 0; i < m; i++){
			a[i] = stdIn.nextInt();
			if(a[i] < x)
				back++;
			if(x < a[i])
				go++;
                }
		if(back < go)
			System.out.println(back);
		else
			System.out.println(go);
        }
}

Measured memory_bytes: 21588
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e16
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


int main() {

	string s;
	int n, q;
	int c[100000] = { 0 };
	vector<int> ans;
	vector<pair<int, int>> p;
	cin >> n >> q;
	cin >> s;

	rep(i, q) {
		int a, b; cin >> a >> b;
		a--; b--;
		p.push_back(pair<int, int>(a, b));
	}
	int cnt = 0;
	rep(i,s.size()) {
		c[i] = cnt;
		if (s[i] == 'A'&&s[i + 1] == 'C') {
			c[i + 1] = cnt + 1;
			cnt++;
			i = i + 1;
		}
	}

	rep(i, q) {
		cout << c[p[i].second] - c[p[i].first] << endl;
	}

	return 0;
}

Measured memory_bytes: 2292