akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    string s; cin >> s;
    int n = s.length();

    function<bool(char, string)> check = [](char c, string s) {
        each(i, s)if (i != c)return false;
        return true;
    };
    function<int(char)> solve = [=](char c) {
        string ate = s;
        int ret = 0;
        while (!check(c, ate)) {
            string t = "";
            FOR(i, 0, ate.length() - 1) {
                if (ate[i] == c || ate[i + 1] == c)t += c;
                else t += ate[i];
            }
            ate = t;
            ++ret;
        }
        return ret;
    };

    int ans = INF;
    FOR(i, 0, 26)chmin(ans, solve(char('a' + i)));
    cout << ans << "\n";
}


Measured memory_bytes: 256
<?php
  $n = trim(fgets(STDIN));
  $x = explode(" ",trim(fgets(STDIN)));
  $mean = round(array_sum($x)/$n);
  $total = 0;
  for($i=0; $i<$n; $i++){
    $dis = $x[$i] - $mean;
    $total += $dis*$dis;
  }
  echo $total."\n";

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
const double PI  = 3.1415926535897932384626433832795028841971;
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int x[4];

int main(){
	string str;
	cin >> str;
	rep(i,str.size()){
		if(str[i]=='N')x[0]++;
		if(str[i]=='W')x[1]++;
		if(str[i]=='S')x[2]++;
		if(str[i]=='E')x[3]++;
	}
		if((x[0] > 0 && x[2] == 0)||
			(x[2] > 0 && x[0] == 0) ||
			(x[1] > 0 && x[3] == 0) ||
			(x[1] == 0 && x[3] > 0)){
				cout << "No" << endl;
		}
		else cout << "Yes" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>

using namespace std;

//float getSquare(float x1, float y1, float x2, float y2, float x3, float y3)
//{
//    float xAB, yAB;
//    float xBC, yBC;
//
//    xAB = x2 - x1;
//    yAB = y2 - y1;
//
//    xBC = x3 - x2;
//    yBC = y3 - y2;
//    
//    return fabs((xAB * yBC - yAB * xBC) / 2.0f); //square of tri-angle
//    
//}
//
//void isIn()
//{
//    float x1, y1;
//    float x2, y2;
//    float x3, y3;
//    float xp, yp;
//    
//    float sABC, sABP, sACP, sBCP;
//    
//    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
//    {
//        sABC = getSquare(x1, y1, x2, y2, x3, y3);
//        sABP = getSquare(x1, y1, x2, y2, xp, yp);
//        sBCP = getSquare(x2, y2, x3, y3, xp, yp);
//        sACP = getSquare(x1, y1, x3, y3, xp, yp);
//        
//        if((sABC > 0) && (sBCP > 0) && (sACP > 0))
//        {
//            if (sABC == sABP + sACP + sBCP) //if p is including triangle this should be worked
//            {
//                cout<<"YES"<<endl;
//            }
//            else if (sABC < sABP + sACP + sBCP)
//            {
//                cout<<"NO"<<endl;
//            }
//        }
//    }
//    
//    return;
//}

void isIn()
{
    float x1, y1;
    float x2, y2;
    float x3, y3;
    float xp, yp;
    
    float a, b, c;
    
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
    {
        a = (x3 - x2) * (yp - y2) - (y3 - y2) * (xp - x2);
        b = (x1 - x3) * (yp - y3) - (y1 - y3) * (xp - x3);
        c = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1);
        
        if((a >= 0 && b  >= 0 && c >= 0) || (a <= 0 && b <= 0 && c <= 0))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
}

int main()
{
    isIn();
    return 0;
}

Measured memory_bytes: 1216
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(A: int, B: int, K: int):
    return f'{max(A-K,0)} {max(B-max(0,K-A),0)}'


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    print(f'{solve(A, B, K)}')


if __name__ == '__main__':
    main()


Measured memory_bytes: 74976
# https://atcoder.jp/contests/abc154/tasks/abc154_e


def digit(N, M):
    """
    :param N: 0 <= n <= N の整数 (※ 下限が 1 の場合は返り値を -= 1 等する)
    :param M: 状態数（例: 0<= (0の個数) <= M）

    dp[0][i][*]: 上からi桁目までが N と一致
    dp[1][i][*]: 上からi桁目までで N である事が確定
    dp[*][*][j]: 状態 j の個数（今回は j = (0 の個数) ）
    """
    def f(j,k):
        """状態 j からの繊維。 i+1 桁目の数( = j)に依存"""
        return min2(j + (k != 0), M - 1)

    L = len(N)
    dp = [[[0] * M for i in range(L + 1)] for j in range(2)]

    dp[0][0][0] = 1
    for i in range(L):
        for j in range(M):
            for k in range(10):
                if k < N[i]:
                    dp[1][i+1][f(j, k)] += dp[0][i][j] + dp[1][i][j]
                elif k == N[i]:
                    dp[0][i+1][f(j, k)] += dp[0][i][j]
                    dp[1][i+1][f(j, k)] += dp[1][i][j]
                else:
                    dp[1][i+1][f(j, k)] += dp[1][i][j]

    return dp[0][L][K] + dp[1][L][K]

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

N = list(map(int, input().strip()))     # 整数を桁毎のリストとして読み込む
K = int(input())
M = K + 2                               # 状態数

def min2(x,y):
    return x if x < y else y

print(digit(N, M))

Measured memory_bytes: 74024
//https://atcoder.jp/contests/abc135/submissions/8228613
//↑参考にさせて頂いた提出

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <cstring>
#include <iomanip>

using namespace std;

typedef long long ll;

const ll INF=1e13+7;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

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

int main(){
    int N;
    ll count=0;
    int A[1000000];
    int B[1000000];
    cin>>N;
    for(int i=0;i<N+1;i++){
        cin>>A[i];
    }
    for(int i=0;i<N;i++){
        cin>>B[i];
    }
    for(int i=0;i<N;i++){
        if(A[i]>=B[i]){
            count+=B[i];
        }else if(A[i]+A[i+1]>=B[i]){
            count+=B[i];
            A[i+1]-=B[i]-A[i];
        }else{
            count+=A[i]+A[i+1];
            A[i+1]=0;
        }
    }
    cout<<count<<endl;
    return 0;
}

//a=97,z=122


Measured memory_bytes: 4736
#ifndef TEMPLATE_HPP
#define TEMPLATE_HPP
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())
using namespace std;
using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename U> vector<U> make_vector(T&& n, U&& val) { return vector<U>(forward<T>(n), forward<U>(val)); }
template <typename T, typename... Args> decltype(auto) make_vector(T&& n, Args&&... args) { return vector<decltype(make_vector(forward<Args>(args)...))>(forward<T>(n), make_vector(forward<Args>(args)...)); }
const int INF = 1001001001;
const i64 LINF = 1001001001001001001ll;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
#endif

void solve() {
  string s;
  cin >> s;
  int ans = 0;
  int cnt = 0;
  rep(i, sz(s)) {
    if (s[i] == 'R') {
      cnt += 1;
      amax(ans, cnt);
    } else {
      cnt = 0;
    }
  }
  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(16);
  cerr << fixed << setprecision(16);
  solve();
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
class ARangeFlipFindRoute {
public:
	void solve(std::istream& in, std::ostream& out) {
        int H = 0;
        int W = 0;
        in >> H >> W;
        vector<vector<bool>> field(H + 1, vector<bool>(W + 1, true)); // true: 白
        for (int i = 1; i <= H; ++i) {
            for (int j = 1; j <= W; ++j) {
                char input;
                in >> input;
                field[i][j] = input == '.';
            }
        }

        vector<vector<int>> cost(H + 1, vector<int>(W + 1, 10000)); // true: 白
        cost[1][1] = field[1][1] ? 0 : 1;
        for (int d = 2; d <= H + W - 1; ++d) {
            if (H > W) {
                int r = d;
                int c = 1;
                while (r >= 1) {
                    if (0 < r && r <= H && 0 < c && c <= W) {
                        if (field[r][c]) {
                            cost[r][c] = min(cost[r - 1][c], cost[r][c - 1]);
                        } else {
                            const int leftCost = field[r][c - 1] ? cost[r][c - 1] + 1 : cost[r][c - 1];
                            const int upCost = field[r - 1][c] ? cost[r - 1][c] + 1 : cost[r - 1][c];
                            cost[r][c] = min(leftCost, upCost);
                        }
                    }
                    --r;
                    ++c;
                }
            } else {
                int r = 1;
                int c = d;
                while (c >= 1) {
                    if (0 < r && r <= H && 0 < c && c <= W) {
                        if (field[r][c]) {
                            cost[r][c] = min(cost[r - 1][c], cost[r][c - 1]);
                        } else {
                            const int leftCost = field[r][c - 1] ? cost[r][c - 1] + 1 : cost[r][c - 1];
                            const int upCost = field[r - 1][c] ? cost[r - 1][c] + 1 : cost[r - 1][c];
                            cost[r][c] = min(leftCost, upCost);
                        }
                    }
                    ++r;
                    --c;
                }
            }
        }
        out << cost[H][W] << endl;
	}
};


int main() {
	ARangeFlipFindRoute solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
  
typedef struct{
  double x;
  double y; 
}xx;
 
void fanc(int n,xx p1,xx p2){  
  xx a,b,c;
  if (n==0) return ;
  a.x=(2.0*p1.x+1.0*p2.x)/3.0;
  a.y=(2.0*p1.y+1.0*p2.y)/3.0;
  b.x=(1.0*p1.x+2.0*p2.x)/3.0;
  b.y=(1.0*p1.y+2.0*p2.y)/3.0;
  c.x=(b.x-a.x)*(cos(M_PI/3.0))-(b.y-a.y)*(sin(M_PI/3.0))+a.x;
  c.y=(b.x-a.x)*(sin(M_PI/3.0))+(b.y-a.y)*(cos(M_PI/3.0))+a.y;
  fanc(n-1,p1,a);
  printf("%lf %lf\n",a.x,a.y); 
  fanc(n-1,a,c);
  printf("%lf %lf\n",c.x,c.y);
  fanc(n-1,c,b);
  printf("%lf %lf\n",b.x,b.y);
  fanc(n-1,b,p2);
}
int main( ){
  xx p1,p2;
  int n;
  p1.x=0.0;
  p1.y=0.0;
  p2.x=100.0;
  p2.y=0.0;
  scanf("%d",&n); 
  printf("%lf %lf\n",p1.x,p1.y);
  fanc(n,p1,p2);
  printf("%lf %lf\n",p2.x,p2.y); 
  return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;


lli mod197 = 1000000007LL;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

lli countC['z' - 'a' + 1] = {};

int main(void) {

	lli N;

	string str;

	cin >> N >> str;

	for (int i = 0; i < N; i++) {
		countC[str[i] - 'a']++;
	}

	lli ans = 1;

	for (int i = 0; i <= 'z' - 'a'; i++) {
		ans *= (countC[i] + 1);
		ans %= mod197;
	}

	COUT(ans - 1);

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#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 REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}



signed main(){
  int n; cin>>n;
  VI a(n), b(n); rep(i,n) cin>>a[i]>>b[i];
  VI c(n), d(n); rep(i,n) cin>>c[i]>>d[i];
  vector<PII> ab(n); rep(i,n) ab[i] = make_pair(a[i],b[i]);
  vector<PII> cd(n); rep(i,n) cd[i] = make_pair(c[i],d[i]);
  sort(ALL(ab)); sort(ALL(cd));
  VI used(n,false);
  int ans = 0;

  rep(i,n){
    PII next = cd[i];
    int index = -1, maxval = -INF;
    rep(j,n){
      if(!used[j] && ab[j].first<next.first && ab[j].second<next.second && maxval<ab[j].second){
        index = j; maxval = max(maxval, ab[j].second);
      }
    }
    if(index != -1){
      ans++; used[index] = true;
    }
  }
  cout << ans << endl;


  return 0;
}


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

typedef pair<int,int> P;

int dp[3000][3000];
vector<P> jw[3000];

int stoi(string s){
  int res = 0,k = 1;
  for(int i=(int)s.size()-1;i>=0;i--){
    res += (s[i]-'0') * k;
    k *= 10;
  }
  return res;
}

int main(){
  int w,h;

  while(cin >> w >> h , w||h){
    int gy,gx;
    int m = 0;
    for(int i=0;i<3000;i++)jw[i].clear(); 

    string tmp;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin >> tmp;
	if(tmp == ".")continue;
	if(tmp == "S")jw[0].push_back(P(i,j));
	else if(tmp == "G"){gy = i; gx = j;}
	else {
	  int num = stoi(tmp);
	  jw[num].push_back(P(i,j));
	  m = max(m,num);
	}
      }
    }

    m++;
    jw[m].push_back(P(gy,gx));

    for(int i=0;i<=m;i++){
      for(int j=0;j<(int)jw[i].size();j++){
	dp[i][j] = 10000000;
      }
    }
    dp[0][0] = 0;

    for(int i=0;i<m;i++){
      for(int j=0;j<(int)jw[i].size();j++){
	for(int k=0;k<(int)jw[i+1].size();k++){
	  int dis = abs(jw[i][j].first - jw[i+1][k].first);
	  dis += abs(jw[i][j].second - jw[i+1][k].second);
	  dp[i+1][k] = min(dp[i+1][k],dp[i][j] + dis);
	}
      }
    }

    cout << dp[m][0] << endl;
  }
}

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

int main(){
    string s;   cin>>s;
    int minX=1000;
    for(int i=0;i<s.length()-2;i++){
        int x = (s[i]-'0')*100 + (s[i+1]-'0')*10 + (s[i+2]-'0');
        //cout<<x<<endl;
        minX=min(minX,abs(753-x));
    }

    cout<<minX<<endl;


    return 0;
}


Measured memory_bytes: 256
#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 TRACE(x) cerr << #x << " " << x << endl
#define eb emplace_back
#define _ << " " <<
typedef long long ll;
typedef std::pair<int, int> ii;
#define X first
#define Y second
#define double long double
typedef double db;
using namespace std;

const int MaxN = 200100;
const int Mod = 1e9 + 7;

int N;
int a[MaxN], p[MaxN];

void solve() {

  int maxcnt = 0;
  int cnt = 0;
  FOR(i, 1, N + 1){

    if (cnt == 0){
      cnt++;
    }
    else{
      if (p[i] > p[i - 1]) cnt++;
      else{
        if (cnt > maxcnt) maxcnt = cnt;
        cnt = 1;
      }
    }
  }
  if (cnt > maxcnt) maxcnt = cnt;

  cout << N - maxcnt << endl;
}

void load() {
  scanf("%d", &N);
  REP(i, N){
    scanf("%d", a + i);
    p[a[i]] = i + 1;
  }
}

int main(){
//  ios_base::sync_with_stdio(false);
  load();	
  solve();
  return 0;
}



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

int sumDigits(int num){
    int sum = 0;

    while(num > 0){
        sum += num % 10;
        num /= 10;
    }
    return sum;
}

int main()
{
    int N, A, B;
    std::cin >> N >> A >> B;

    int sum = 0;

    for (int i = 1; i <= N; i++){
        int num = sumDigits(i);

        if (A <= num && num <= B){
            sum += i;
        }
    }

    std::cout << sum << std::endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;

class main{
    static void Main(string[] args){
        var n = int.Parse(Console.ReadLine());
        while(n--!=0){
            var str = Console.ReadLine();
            Regex A = new Regex(@"^>'(?<first>=+)#(?<second>=+)~$");
            Regex B = new Regex(@"^>\^[Q=]+~~$");
            if(A.IsMatch(str)){
                var m = A.Match(str);
                if(m.Groups["first"].Length==m.Groups["second"].Length)
                    Console.WriteLine("A");
                else Console.WriteLine("NA");
            }else if(B.IsMatch(str)){
                Console.WriteLine("B");
            }else{
                Console.WriteLine("NA");
            }
        }
    }
}

Measured memory_bytes: 7632
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll LL_MAX=LLONG_MAX;

struct In{
    template<typename T>
    operator T(){
        T x;
        cin >> x;
        return x;
    }
};
In in;

template <typename T,typename U>
void forin(T* x,U n){
    for (U i=0;i<n;i++) cin >> x[i];
}

template <typename T>
int div1(T x) {
    return x%1000000007;
}

template <typename T>
void out(T x){
    cout << x << endl;
}

template <typename T>
T gcd(T x,T y){
    if (y == 0) return x;
    return gcd(y,x%y);
}

template <typename T>
T lcm(T x,T y){
    return x*y/gcd(x,y);
}

int main(){
    ll h=in;
    int t=log2(h)+1;
    out((ll)(pow(2,t)-1));
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
using namespace std;
int main(){
    double pai = 3.141592653589;
    double r,S,R;
    
    cin >> r;
    
    S = 1.0000*r*r*pai;
    
    R = 1.0000*2*r*pai;
    
    printf("%f %f", S, R);
}


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

using namespace std;

#define ll long long int
#define get(a) ll a; cin >> a;
#define show(a) cout << a << endl;
#define full(p) p.begin(), p.end()
#define len(a) (ll)(a.size())
#define pb push_back

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout<<fixed;
	////////////////////////////////
	string a  , b;
	cin >> a >> b;

	if(len(a) >= len(b))
	{
		if(a > b)
			cout << "GREATER" << endl;
		else if(a == b)
			cout << "EQUAL" << endl;
		else if(a < b)
			cout << "LESS" << endl;

	}
	else
		cout << "LESS" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a, b,out;
	char op;
	while (true){
		cin >> a >> op >> b;
		switch (op){
		case '+':
			out = a + b;
			break;
		case '-':
			out = a - b;
			break;
		case '*':
			out = a*b;
			break;
		case '/':
			out = a / b;
			break;
		}
		if (op == '?'){
			break;
		}
		cout << out << endl;
	}
}


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

typedef struct P {
	int x, y;
	bool ok;
	bool operator==(P other) {
		return x == other.x && y == other.y;
	}
	P operator+=(P other) {
		x += other.x;
		y += other.y;
		return{ x + other.x,y + other.y };
	}
}P;
typedef struct D {
	char d;
	int l;
}D;

int n, m;
P loc, p[20];
D o;

P get_e(D a) {
	P e = { 0,0 };
	switch (a.d) {
	case 'W':e = { -1,0 }; break;
	case 'N':e = { 0,1 }; break;
	case 'E':e = { 1,0 }; break;
	case 'S':e = { 0,-1 }; break;
	default:break;
	}
	return e;
}

int find() {
	for (int i = 0; i < n; i++) {
		if (loc == p[i]) {
			p[i].ok = true;
		}
	}
	return 0;
}

int move(D a) {
	P e = get_e(a);
	for (int i = 0; i < a.l; i++) {
		loc += e;
		find();
	}
	return 0;
}

bool check() {
	for (int i = 0; i < n; i++) {
		if (!p[i].ok)
			return false;
	}
	return true;
}

int main(){
	while (cin >> n && n != 0) {
		loc = { 10,10,false };
		for (int i = 0; i < n; i++) {
			cin >> p[i].x >> p[i].y;
			p[i].ok = false;
		}
		cin >> m;
		for (int i = 0; i < m; i++) {
			cin >> o.d >> o.l;
			move(o);
		}
		if (check()) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define pii pair<int,int>
#define pll pair<ll, ll>
#define forn(i, a, b) for(int i = a; i <= b; i++)
#define ford(i, a, b) for(int i = a; i >= b; i--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007

ll a[500];
ll ds[405][405];

ll dp(int s, int e){
	if(s >= e) return 0;
	ll &ans = ds[s][e];
	if(ans != -1) return ans;
	ll ls = 0;
	ll rs = 0;
	forn(i, s, e){
		rs += a[i];
	}
	ans = 1e18;
	forn(i, s, e - 1){
		ls += a[i];
		rs -= a[i];
		ans = min(ans, ls + rs + dp(s, i) + dp(i + 1, e));
	}
	return ans;
}

int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	forn(i, 0, n - 1){
		cin >> a[i];
	}	
	memset(ds, -1, sizeof(ds));
	cout << dp(0, n - 1) << "\n";
	return 0;
}

Measured memory_bytes: 1664
K, N = (int(x) for x in input().split())
A = list(map(int, input().split()))
dif=[]
mmax=0
for i in range(N-1):
  dif.append(A[i+1]-A[i])
#print(len(dif))
#print(len(A))
dif.append(K-A[N-1]+A[0])
#print(dif)
for i in range(N):
  mmax=max(mmax, dif[i])
print(K-mmax)

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

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

ll lcm(ll a,ll b){
    return (a*b/gcd(a,b));
}

int MAX_N=1e9;

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    set<int> s;
    rep(i,n){
        int a; cin >>a;
        if(s.count(a)) s.erase(a);
        else s.insert(a);
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


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

    double A, B, H, M;
    cin >> A >> B >> H >> M;

    double PI = acos(-1);
    
    double rad1 = PI*(H+M/60)/6;
    //cout << rad1 << endl;
    double rad2 = PI*M/30;
    //cout << "r2: " << rad2 << endl;

    double rad = abs(rad1-rad2);
    //rad = min(2*PI-rad,rad);
    //cout << rad << endl;

    //cout << "angle: " << rad/PI * 180 << endl;

    double cosC = cos(rad);
    //cout << "C: " << cosC << endl;	
    double ans = A*A + B*B - 2*A*B*cosC;
    ans =  sqrt(ans);
    printf("%.20lf",ans);

}

Measured memory_bytes: 4164
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;
using pii = pair<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
Int printX(Int r, Int D, Int X, int count){
    if(count == 10){
        return 0;
    }
    Int nextX = r*X - D;
    cout<< nextX <<endl;
    printX(r,D,nextX,count+1);

}

int myPow(int x, int p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    return x * myPow(x, p-1);
}

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

    vector<double> A = vector<double>(N);
    rep(i,N){
        cin >> A[i];
    }


    double tmp = 0.0;
    rep(i,N){
        tmp+= 1/A[i];
    }


    cout << setprecision(10) << 1/tmp << endl;



    return 0;
}


Measured memory_bytes: 256
stdin.ReadLine()
|> fun x -> x.Split(' ')
|> Array.map int
|> fun x -> x.[0], x.[1], x.[2], x.[3]
|> fun (a, b, c, d) -> (max a c), (min b d)
|> fun (s, e) -> e - s
|> max 0
|> printfn "%d"


Measured memory_bytes: 13916
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
for _ in range(N):
    b = int(input())
    for j in range(3):
        for i in range(3):
            if A[i][j] == b:
                A[i][j] = 0

for j in range(3):
    if sum([A[i][j] for i in range(3)]) == 0:
        print('Yes')
        exit()

for i in range(3):
    if sum([A[i][j] for j in range(3)]) == 0:
        print('Yes')
        exit()

if sum([A[i][i] for i in range(3)]) == 0:
    print('Yes')
    exit()

if sum([A[i][j] for i, j in [[2, 0], [1, 1], [0, 2]]]) == 0:
    print('Yes')
    exit()

print('No')


Measured memory_bytes: 38384
//21
#include<iostream>
#include<queue>

using namespace std;

struct S{
  int a;
  double t;
  bool operator<(S a)const{
    return t>a.t;
  }
};

int main(){
  for(int n;cin>>n,n;){
    int a[101]={};
    for(int i=1;i<=n;i++){
      cin>>a[i];
    }
    int r;
    double b,v,e,f;
    cin>>b>>r>>v>>e>>f;
    S is={0,0};
    priority_queue<S> que;
    que.push(is);
    bool p[101]={};
    for(;;){
      S c=que.top();
      if(c.a==n)break;
      que.pop();
      if(p[c.a]++)continue;
      int cp=a[c.a];
      double t=c.t;
      for(int np=c.a+1;np<=n;np++){
	while(cp!=a[np]){
	  int x=cp-a[c.a];
	  t+=(x>=r)?1/(v-e*(x-r)):1/(v-f*(r-x));
	  cp++;
	}
	S n={np,t+b};
	que.push(n);
      }
    }
    cout<<fixed<<que.top().t-b<<endl;
  }
  return 0;
}

Measured memory_bytes: 1420
import java.io.PrintWriter

val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    func()
    pw.flush()
}
fun println(value: Any) { pw.println(value) }

//ABC129_A
fun func() {
    val (P, Q, R) = listOfInt()
    val t0 = P + Q
    val t1 = Q + R
    val t2 = R + P
    var ans = Math.min(Math.min(t0, t1), t2)
    println("${ans}")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) } //{ it.toInt() }


Measured memory_bytes: 36052
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz");
char s[30][30];
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> h >> w;
  rep(i, h) rep(j, w) cin >> s[i][j];
  rep(i, h) {
    rep(j, w) {
      if (s[i][j] == '#') continue;
      ll min_cost[h + 10][w + 10];
      rep(ii, h) rep(jj, w) min_cost[ii][jj] = LINF;
      queue<P> qu;
      qu.push({i, j});
      min_cost[i][j] = 0;

      while (!qu.empty()) {
        auto p = qu.front();
        qu.pop();
        rep(z, 4) {
          int nx = p.se + dx[z], ny = p.fi + dy[z];
          if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
          if (s[ny][nx] == '#') continue;
          if (min_cost[p.fi][p.se] + 1 >= min_cost[ny][nx]) continue;
          min_cost[ny][nx] = min_cost[p.fi][p.se] + 1;
          qu.push({ny, nx});
        }
      }
      cnt = 0;
      rep(ii, h) {
        rep(jj, w) {
          if (min_cost[ii][jj] == LINF) continue;
          cnt = max(cnt, min_cost[ii][jj]);
        }
      }
      ans = max(ans, cnt);
    }
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void no() {
    cout << "No" << '\n';
}
void yes() {
    cout << "Yes" << '\n';
}
ll gcd(ll a, ll b) {
    while (a > 0 && b > 0) {
        if (a < b) swap(a, b);
        a %= b;
    }
    return a + b;
}
void solve() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if (b > a) {
        no();
        return;
    }
    if (c >= b) {
        if (d >= b) {
            yes();
        }
        else no();
        return;
    }
    if (b > d) {
        no();
        return;
    }
    ll x = a % b;
    ll p = gcd(d, b);
    if (x > c) {
        no();
        return ;
    }
    ll t = (c + 1 - x + p - 1) / p;
    if (x + t * p < b) {
        no();
    }
    else yes();
}
int main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    srand(time(0));
    int tst;
    cin >> tst;
    while (tst--) solve();
    return 0;
}


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

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

  string s;
  cin >> s;
  string t = "";
  for (int i = 0; i < s.size(); i++) t += "x";
  cout << t << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {

  string s;
  cin >> s;
  
  int n = s.size()-1;
  for(int i = 0; i < (s.size() /2); i++) {
    if(s.at(i) == s.at(n)) {
      n--;
      continue;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  n = s.size();
  int b = (n-1) /2;
  for(int i = 0; i < b/2; i++) {
    if(s.at(i) == s.at(b-1)) {
      b--;
      continue;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  n = s.size();
  b = (n+3) /2;
  for(int i = b; i < n/2; i++) {
    if(s.at(i) == s.at(n-1)) {
      n--;
      continue;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 1010000
ll MOD=1e9+7;

ll int inv[N],comb[N],prd[N],invprd[N];
void calc_inv(){
    inv[1]=1;
    rep2(i,2,N-1){
        inv[i]=((-(MOD/i)*inv[MOD%i])%MOD+MOD)%MOD;
    }
    return;
}
void calc_comb(ll int n){
    comb[0]=1;
    rep2(i,1,n){
        comb[i]=comb[i-1]*(n+1-i)*inv[i]%MOD;
    }
    return;
}
void calc_product(){
    prd[0]=prd[1]=1;
    invprd[0]=invprd[1]=1;
    rep2(i,2,N-1){
        prd[i]=i*prd[i-1]%MOD;
        invprd[i]=inv[i]*invprd[i-1]%MOD;
    }
    return ;
}
ll cmb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return prd[a]*invprd[b]%MOD*invprd[a-b]%MOD;
}
ll modpow(ll x,ll n){
    if(n==0) return 1;
    ll res=modpow(x*x%MOD,n/2);
    if(n&1) res=res*x%MOD;
    return res;
}
main(){
    int n;cin>>n;
    ll a=in(),b=in(),c=in();
    ll ans=0;
    calc_inv();calc_product();
    if(b%2){
        cout<<0;return 0;
    }
    else{
        for(ll d=0;d<=c;d+=3){
            for(ll e=0;e<=c;e++){
                ll A=a-e;
                ll B=b/2;
                ll C=e;
                ll D=d/3;
                ll cr=c-d-e;
                if(cr<0)continue;
                n=A+B+C+D;
                ll tmp=cmb(cr+B-1,B-1);
                if(B==0&&cr==0)tmp=1;
                tmp=(tmp*cmb(n,A)%MOD*cmb(n-A,B)%MOD*cmb(n-A-B,C)%MOD*cmb(n-A-B-C,D))%MOD;
                ans=(ans+tmp)%MOD; 
                //cout<<d<<" "<<e<<" "<<ans<<endl;
            }
        }
        cout<<ans<<endl;
    }
}

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

template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}

__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << '\n';
}


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

typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back

const int maxn = 1000005;
int main() {
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    vector<vector<char>> a(n+1, vector<char>(m+1));
    vector<vector<int>> dis(n+1, vector<int>(m+1));
    ii jj dis[i][j]=1e9;
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    ii jj cin>>a[i][j];
    //auto get = [&](int x,int y) {return (x-1)*m+y;};
    queue<pair<int,int>> q;
    q.push({sx, sy});
    dis[sx][sy] = 0;
    int dir1[4] = {-1, 1, 0, 0};
    int dir2[4] = {0, 0, -1, 1};
    while(!q.empty()) {
        auto p = q.front(); q.pop();
        int d = dis[p.first][p.second];
//        cout<<p.first<<" "<<p.second<<" "<<d<<endl;
        if(p.first == tx && p.second == ty) return cout << d << endl, 0;
        for(int i=0;i<4;++i) {
            int x=p.first,y=p.second;
            for(int j=1;j<=k;++j) {
                x+=dir1[i],y+=dir2[i];
                if(x<=0||y<=0||x>n||y>m||dis[x][y]<=d||a[x][y]=='@') break;
                if(dis[x][y]>d+1) {
                    dis[x][y]=d+1;
                    q.push({x,y});
                }
            }
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 16956
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N,K=rl()
ans = 0
ans += (N//K)**3
if K%2==0:
    ans += ((N+K//2)//K)**3

print(ans)

Measured memory_bytes: 3064
using System;
class Program
 {
        static void Main(string[] args)
        {
          ulong input =ulong.Parse(Console.ReadLine());
          ulong sum = 0;
          if(input%2==1){
          	input = 0;
          }
          for(int i=1;i<27;i++){
            ulong n = (ulong)System.Math.Pow(5,i)*2;
            decimal p = input/n;
            sum += (ulong)System.Math.Floor(p);
          }
          Console.WriteLine(sum);
        }
 }

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n,m;
    cin >> n >> m;
    if(n <= m){
        cout << "Yes" << endl;
    }else{
        cout <<"No" << endl;
    }


    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N, M; cin >> N >> M;
		vector<pair<ULL, UL>> A(N);
		rep(i, N) cin >> A[i].first >> A[i].second;
		sort(A.begin(), A.end());
		ULL ans = 0;
		UL p = 0;
		rep(i, M) {
			if (A[p].second == 0) p++;
			ans += A[p].first;
			A[p].second--;
		}
		cout << ans << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 1792
/*input
5 5
4 2 3 4 5
4 1 3 4 5
4 1 2 4 5
4 1 2 3 5
4 1 2 3 4
*/
#include<bits/stdc++.h>
using namespace std;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int fast_ex(int a,int n,int m){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= fast_ex(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int n,m;
int freq[1000];


void solve(){
	cin >> n >> m;
	REP(i,n){
		int x;cin >> x;
		REP(j,x){
			int b;cin >> b;freq[b]++;
		}
	}
	int ans = 0;
	RE(i,m)ans += (freq[i] == n);debug(ans);
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;//cin >> t;
  WL(t)solve();
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		// practice contest

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		String s = sc.next();
		if (a >= 3200) {
			System.out.println(s);
		}
		if (a < 3200) {
			System.out.println("red");
		}
	}
}

Measured memory_bytes: 21844
/*
 * <formula> ::= 0 | 1 | 2 | P | Q | R |
 *    -<formula> | (<formula>*<formula>) | (<formula>+<formula>)
 */
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max
using namespace std;

int table_seki[3][3];
int table_wa[3][3];
int P,Q,R;

int formula(string& s, int& i);
int main();

int formula(string& s, int& i)
{
	int left=0, right=0;	
	char ope=0;

	switch(s[i])
	{
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case 'P': return P;
		case 'Q': return Q;
		case 'R': return R;
		case '-':
			i++;
			left = formula(s,i);
			if (left == 0) { return 2; }
			else if (left == 2) { return 0; }
			else { return 1; }
		case '(':
			i++;
			left = formula(s,i);
			i++;
			ope = s[i];
			i++;
			right = formula(s,i);
			i++; //)
			if (ope == '*') {
				return table_seki[left][right];
			}
			else {
				return table_wa[left][right];
			}
		defalt:
			return 0; //起こることは本来ない．扱う字句または構文のミス
	}
	return 0; //起こることはないはず
}

int main() {
	//積集合
	table_seki[0][0] = 0; //y,x
	table_seki[1][0] = 0; //y,x
	table_seki[2][0] = 0; //y,x
	table_seki[0][1] = 0; //y,x
	table_seki[1][1] = 1; //y,x
	table_seki[2][1] = 1; //y,x
	table_seki[0][2] = 0; //y,x
	table_seki[1][2] = 1; //y,x
	table_seki[2][2] = 2; //y,x

	//和集合
	table_wa[0][0] = 0; //y,x
	table_wa[1][0] = 1; //y,x
	table_wa[2][0] = 2; //y,x
	table_wa[0][1] = 1; //y,x
	table_wa[1][1] = 1; //y,x
	table_wa[2][1] = 2; //y,x
	table_wa[0][2] = 2; //y,x
	table_wa[1][2] = 2; //y,x
	table_wa[2][2] = 2; //y,x

	string line;
	vector<int> binary;
	binary.push_back(0);
	binary.push_back(1);
	binary.push_back(2);
	int pattern_cnt = 0;

	while(true) {
		cin >> line;
		pattern_cnt = 0;
		if (line[0] == '.') { break; }

		rep(p,3) {
			rep(q,3) {
				rep(r,3) {
					P=p; Q=q; R=r;
					int i = 0;
					int result = formula(line,i);

					if (result == 2) { pattern_cnt++; }
				}
			}
		}
		cout << pattern_cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

int main(){
	int n, m; cin >> n >> m;
	cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
}

Measured memory_bytes: 256