akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define all(s0) s0.begin(),s0.end()
#define ins(s0) inserter(s0,s0.begin())
using namespace std;
ll read()
{
    char ch=getchar();
    ll x=0,f=1;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
    double pi=3.1415926;
    double n;
    cin>>n;
    printf("%.2f\n",2*n*pi);
    return 0;
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

bool vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
  }
  else { // 発見できなかったとき
    return false;
  }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<pair<int,bool>> syogen[n];
    rep(i,0,n){
        int a; cin >> a;
        rep(j,0,a){
        int x;bool y;
        cin >> x >> y;x--;
        syogen[i].push_back(make_pair(x,y));
        }
    }
    int ans =0;
    rep(bit,0,(1<<n)){
        vector<int> syoziki;
        bool ok = true;
        rep(shift,0,n){
            if(bit & (1<<shift)) syoziki.push_back(shift);
        }
        rep(i,0,syoziki.size()){
            int pt = syoziki[i];
            rep(j,0,syogen[pt].size()){
                if(syogen[pt][j].second){
                    if(!vector_finder(syoziki,syogen[pt][j].first)){
                        ok = false;
                    }
                }else{
                    if(vector_finder(syoziki,syogen[pt][j].first)){
                        ok = false;
                    }
                }
            }
        }
        if(ok) ans = max(ans,int(syoziki.size()));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int n,m,maxi=-1,mini=1e9;
    scanf("%d%d",&n,&m);
    for(int i=0; i<m; i++)
    {
        int left,right;
        scanf("%d%d",&left,&right);
        maxi=max(maxi,left);
        mini=min(mini,right);
    }
    printf("%d",maxi<=mini?mini-maxi+1:0);
    return 0;
}


Measured memory_bytes: 128
N = int(input())
ans=0
def make_divisors(n):#約数の入ったリストを返す関数
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
for i in range(1,N+1,2):
    if len(make_divisors(i))==8:
        ans+=1
print(ans)

Measured memory_bytes: 38384
{-# LANGUAGE BangPatterns, MultiWayIf #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Int
import Data.Foldable
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)
import Debug.Trace

solve :: Int -> Int -> V.Vector (Int, VU.Vector Int) -> VU.Vector Int -> Int
solve !n !m !kss !pn =
  length
    $ filter id
    $ map
        (\(!ls) -> V.all
          (\(!i, (_, !sn)) ->
            let ons = VU.length $ VU.filter id $ VU.map (ls V.!) sn
            in  ons `mod` 2 == pn VU.! i
          )
          (V.indexed kss)
        )
    $ V.replicateM n [True, False]

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  (n, m) <-
    (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 readInt <$> B.getLine
  kss <- V.replicateM m $ do
    s <- B.getLine
    let (s1, s2)     = B.span (/= ' ') s
    let Just (k1, _) = B.readInt s1
    return (k1, VU.map (\n -> n - 1) $ VU.unfoldrN k1 readInt $ B.tail s2)
  pn <- VU.unfoldrN m readInt <$> B.getLine

  print $ solve n m kss pn


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

int main(){
    int c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    int a[3] = {0, 0, 0};
    int b[3] = {0, 0, 0};
    for(int i = 0; i < 3; i++){
        b[i] = c[0][i];
    }

    for(int i = 1; i < 3; i++){
        a[i] = c[i][0] - b[0];
    }

    int flag = 0;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            if(a[i] + b[j] != c[i][j]){
                flag = 1;
                break;
            }
        }
        if(flag == 1){
            break;
        }
    }

    if(flag == 1){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int n,k;cin>>n>>k;

  string s;cin>>s;

  s[k-1] = s[k-1]+32;

  cout<<s<<endl;

 

  return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int gcd(int n, int m) {
    if(n < m) swap(n, m);
    if(n % m == 0) return m;
    return gcd(m, n % m);
}

int lcm(int n, int m) {
    return n * m / gcd(n, m);
}

int main() {
    int X; cin >> X;
    cout << lcm(X, 360) / X << endl;
    return 0;
}

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

using namespace std;

struct Vector
{
	double x;
	double y;
};

istream& operator>>(istream& stream, Vector& p)
{
	return stream >> p.x >> p.y;
}

template <typename T>
T absolute(T x)
{
	return x > 0 ? x : -x;
}

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

	while(length-- > 0)
	{
		Vector a, b;
		double ra, rb;
		cin >> a >> ra >> b >> rb;
		double dist = sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y));

		if(ra + rb < dist)
			cout << 0 << endl;
		else if(dist < absolute(ra - rb))
		{
			if(rb < ra)
				cout << 2 << endl;
			else
				cout << -2 << endl;
		}
		else
			cout << 1 << endl;
	}

	return 0;
}

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

int main(void){
    string s;
    cin >> s;
    sort(s.begin(),s.end());

    if(s[0]==s[1] && s[2]==s[3] && s[0]!=s[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char s[7],n;
	scanf("%s",s);
	if(s[0]=='S')	printf("Cloudy\n");
	else if(s[0]=='R')	printf("Sunny\n");
	else if(s[0]=='C')	printf("Rainy\n");
	return 0;
}






Measured memory_bytes: 128
fun main(args: Array<String>) {
    val day = readLine()?.toInt()
    //?.（セーフコール演算子）
    //readLineメソッドの戻り値はnull許容型（String?）である

    when {
        day == 22 -> println("Christmas Eve Eve Eve")
        day == 23 -> println("Christmas Eve Eve")
        day == 24 -> println("Christmas Eve")
        day == 25 -> println("Christmas")
    }

}

Measured memory_bytes: 34328
#include<bits/stdc++.h>
using namespace std;
long long min(long long a,long long b){return a<b?a:b;}
int main()
{
 long long n; cin>>n;
  long long  res=n+n;
  for(int i=1;i<=sqrt(n);++i)
  {
    if(n%i==0)
    {
      res=min(res,i+n/i-2);
    }
  }
  cout<<res;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const long long N=1e5+5;
int a[N],k;
ull check(ull x)
{
    for(int i=1;i<=k;i++)
    x=x/a[i]*a[i];
        return x;
}
ull minn(int x)
{
    ull L=2,R=(ull)4e18;
    while(L<=R)
    {
        ull mid=(L+R)/2;
        if(check(mid)<x) L=mid+1;
        else R=mid-1;
    }
   if(check(L)==x)
    return L;
   else
    return 0;
}
ull maxx(int x)
{
    ull L=2,R=(ull)4e18;
    while(L<=R)
    {
        ull mid=(L+R)/2;
        if(check(mid)>x) R=mid-1;
        else L=mid+1;
    }
    L--;
   if(check(L)==x)
    return L;
   else
    return 0;
}
int main()
{
    scanf("%d",&k);
    for(int i=1;i<=k;i++)
        scanf("%d",&a[i]);
    ull x=maxx(2);
    ull y=minn(2);
    if(!y)puts("-1");
    else cout<<y<<" "<<x<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
long long a[1005];
long long b[1000005];
int delet[1000005];

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i = 1; i <= n; i++) scanf("%lld",&a[i]);
    int size = 0;
    for(int i = 1; i <= n; i++){
        long long sum = 0;
        for(int j = i; j <= n; j++){
            sum += a[j];
            b[++size] = sum;
        }
    }
    long long ans = 0;
    for(int i = 41; i >= 0; i--){
        long long base = 1ll<<i;
        int cnt = 0;
        for(int j = 1; j <= size; j++){
            if(!delet[j] && (b[j]&base)) cnt++;
        }
        if(cnt>=k){
            ans += base;
            for(int j = 1; j <= size; j++){
                if(!delet[j] && !(b[j]&base)) delet[j] = 1;
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 7580
/* ex9_2
   moka223711 */

#include <stdio.h>
#include <stdlib.h>

#define SIZE 100005 // キューブの数の上限

typedef struct cube{ // キューブの色('0','1')を格納するための単方向リストを用いたスタック
    char color; // キューブの色を格納する
    struct cube *next; // 一つ上に積まれているキューブのアドレスを格納する
}cube;

void push(cube **head, char color); // キューブの色を格納するための関数
char pop(cube **head); // キューブを取り除くための関数

int main(void){
    cube *head; // スタックの先頭アドレスを表すポインタ
    char cube_color[SIZE], color, *ptr;
    int ans = 0;
    
    head = NULL; // スタックの中はまだ空なのでNULLを格納しておく
    scanf("%s", cube_color); // キューブの色の入力を受け取る
    ptr = cube_color; // キューブの色の配列の先頭アドレスをptrに格納する
    
    // まずは配列の先頭の要素をスタックに加える。次にキューブの色の配列cube_color
    // を調べていって、スタックの先頭のキューブの色と異なる色を探す。先頭の要素と同じ色の
    // キューブであればスタックに加えていくが、異なる色であったときはそのキューブをスタック
    // には加えず、同時にスタックの先頭のキューブも取り除く。今スタックの中には同じ色の
    // キューブが連続して並んでおり、隣り合うキューブを取り除いても先頭のキューブを
    // 取り除いてもスタックの中の要素はどちらも同じものになるからである。
    while(*ptr != '\0'){
        if(head == NULL)push(&head, *ptr); // スタックに最初の要素を加えるとき
        else if(head->color != *ptr){ // スタックの先頭のキューブの色と異なる色が見つかったとき
            color = pop(&head); // スタックの先頭の要素を取り除く
            ans += 2; // このときキューブは2つ分取り除いたことになるのでansに2を足す
        }
        else push(&head, *ptr); // スタックの要素がなくなったとき
        ptr++; // 配列のすべてのキューブについて調べていく
    }
    printf("%d\n", ans); // 調べ終わったらansを出力する
    return 0;
}

// スタックの先頭に要素を加えるための関数
void push(cube **head, char color){
    cube *new;
    if((new = malloc(sizeof(cube))) == NULL)exit(1); // スタックの領域を動的確保する
    new->color = color; // 加わるキューブの色を代入
    new->next = *head; // それまで先頭だったところを指すようにする
    *head = new; // newを新たにスタックの先頭の要素にする
}

// スタックの先頭の要素を削除するための関数
char pop(cube **head){ 
    char color;
    cube *garbage = *head; // スタックの先頭の要素のメモリを解放する
    if(garbage == NULL)exit(1);
    color = garbage->color; // スタックの先頭の要素の色を代入
    *head = garbage->next; // スタックの次の要素を先頭として指すようにする
    free(garbage); // メモリを解放する
    return color; // 先頭の要素に入っていた色を返す
}

Measured memory_bytes: 4880
#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e9 + 7;
void solve()
{
	int n, m;
	cin >> n >> m;
	auto isBrok = vector<bool>(n+1);	
	for(auto i = 0; i < m; ++i) {
		int x;
		cin >> x;
		isBrok[x] = true;
	}
	auto dp = vector<long long>(n+1);
	dp[0] = 1;
	for(auto i = 0; i < n; ++i)
	{
		if(i+1 <= n && !isBrok[i+1])
			dp[i+1] = (dp[i+1] + dp[i]) % MOD;
		if(i+2 <= n && !isBrok[i+2])
			dp[i+2] = (dp[i+2] + dp[i]) % MOD;
	}

	cout << dp[n] << endl;
	
}

int main()
{
	cin.sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	solve();
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,t,a[200010];
long long last=0,ans=0;
int main(){
    scanf("%lld%lld",&n,&t);
    for (long long i=1; i<=n; i++) scanf("%lld",&a[i]);
    last=min(t,a[2]);
    a[n+1]=2147483640;
    ans=last;
    for (long long i=2; i<=n; i++) {
        last=min(a[i]+t,a[i+1]);
        ans+=(last-a[i]);
    }
    if (n==1) ans=t;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <sstream>

using namespace std;

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

    cout << (a * 800) - (a / 15) * 200 << endl;
  
    return 0;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	if(a+b==15){
		cout << "+" << endl;
	}
	else if(a*b==15){
		cout << "*" << endl;
	}
	else{
		cout << "x" << endl;
	}
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mxn (int)1e5+10
using namespace std;

int ar[mxn], dp[mxn], vis[mxn];

int solve(int n) {
    if(n == 0) return 0;
    if(n == 1) return abs(ar[1] - ar[0]);

    if(vis[n] != 0)  return dp[n];

    int s1 = solve(n-1);
    int s2 = solve(n-2);

    vis[n] = 1;

    return dp[n] = min(s1 + abs(ar[n] - ar[n-1]), s2 + abs(ar[n] - ar[n-2]));
}

int main() {
    int n; cin >> n;
    for(int i=0; i<n; ++i) cin >> ar[i];
    for(int i=0; i<mxn; ++i) dp[i] = -1;

    cout << solve(n-1) << '\n';

    return 0;
}


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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

template <class T, class Op = multiplies<T>>
constexpr T power(T a, long long n, Op op = Op(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int q;
  cin >> q;
  while (q--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b, --c, --d;
    long long res = abs(c - a) + abs(d - b);
    for (int k = 0; k < 30; ++k) {
      auto w = power(3LL, k);
      auto aa = a / w, bb = b / w, cc = c / w, dd = d / w;
      if (aa == cc and bb == dd) continue;
      if (aa != cc and bb != dd) continue;
      if (bb == dd) {
        swap(a, b);
        swap(c, d);
        swap(aa, bb);
        swap(cc, dd);
      }
      if (aa % 3 != 1) continue;
      if ((bb + 1) / 3 == (dd + 1) / 3) continue;
      aa = a % w, cc = c % w;
      res = max(res, min(aa + cc + 2, 2 * w - aa - cc) + abs(d - b));
    }
    cout << res << '\n';
  }
}


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


int main(){
  int n,q;
  string s;
  cin>>n>>s>>q;
  set<int> se[26];
  rep(i,n){
    se[s[i]-'a'].insert(i);
  }
  rep(i,q){
    int t;
    cin>>t;
    if(t==1){
      int j;
      char c;
      cin>>j>>c;
      j--;
      se[s[j]-'a'].erase(j);
      se[c-'a'].insert(j);
      s[j]=c;
    }
    else{
      int l,r;
      cin>>l>>r; l--; r--;
      int ans=0;
      rep(j,26){
	if(se[j].size()>0&&se[j].lower_bound(l)!=se[j].end()
	   &&*se[j].lower_bound(l)<=r){
	  ans++;
	}
      }
      cout<<ans<<endl;
    }
  }
  return 0;
}





Measured memory_bytes: 24196
K, N=gets.split.map { |s| s.to_i }
As = gets.split.map { |s| s.to_i }
Ds = []
As.each_with_index do |a, i| 
  Ds << ( i == 0 ?  a + K - As[-1] : a - As[i-1])
end
 
puts Ds.inject(&:+)  - Ds.max

Measured memory_bytes: 17028
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int a, b, c;

int main() {
    int iter = 0;
    int maxiter = 1000;

    GI(a);
    GI(b);
    GI(c);

    while (iter < maxiter && a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
        int ta = (b + c) / 2;
        int tb = (a + c) / 2;
        int tc = (a + b) / 2;
        a = ta;
        b = tb;
        c = tc;
        iter++;
    }

    if (iter >= maxiter) {
        printf("-1\n");
    }
    else {
        printf("%d\n", iter);
    }
    
    return 0;
}

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

typedef long long ll;


ll g(ll a,ll b)
{
    if(b == 0) return a;
    return  g(b , a % b);
}

int main()
{
    ll x,y;
    cin >> x >> y;
    ll z = g(x,y);
    if(z == y)
    {
        cout << -1 << endl;
        return 0;
    }
    else
    {
        cout << x /  z * x;
    }
    return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        x: usize,
        y: usize,
    };
    if x == y {
        println!("-1");
        return;
    }
    if x % y == 0 {
        println!("-1");
        return;
    }
    for n in (x + x..).step_by(x) {
        if n % y != 0 {
            println!("{}", n);
            return;
        }
    }
}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
using namespace std;
using ll = long long;

int main(){
    ll n; cin>>n;
    rep(i,2,100000){
        if(i*i>n){
            cout<<(i-1)*(i-1)<<"\n";
            return 0;
        }
    }
}

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

#define ll long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
int main() {
    //COMint();
    int N=in();
    ll ans;ans=1;
    REP(i,N){
        ans=ans*(i+1)%MOD;
    }
    print(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  cout<<S;
  int i=S.size();
  if(S[i-1]=='s') cout<<"es"<<endl;
  else cout<<'s'<<endl;
  
  return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int64_t gc(int64_t a,int64_t b){
  if(a>b)
    return gc(b,a);
  if(a==0)
    return b;
  return gc(b%a,a);
}
int main(){
  int64_t a,b;
  cin>>a>>b;
  int64_t g=gc(a,b);
  int c=1;
  for(int64_t i=2;i*i<=g;i++){
    if(g%i==0){
      c++;
      while(g%i==0)
        g/=i;
    }
  }
  if(g!=1)
    c++;
  cout<<c<<endl;
}

Measured memory_bytes: 256
//Jay Shree Krishna
#include"bits/stdc++.h"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long int
#define inf 1e18+5
#define sr string
#define mod 1000000007
#define start int t;cin>>t;while(t--)
#define db(x) cout<<#x<<"="<<x<<"\n"
#define db2(a,b)cout<<#a<<": "<<a<<" , "<<#b<<": "<<b<< endl;
#define db3(a,b,c)cout<<#a<<": "<<a<<" , "<<#b<<": "<<b<<" , "<<#c<<": "<<c<<endl;
#define forr(i, n) for (int i = 0; i < n; i++)
#define fr(i, n) for (int i = 1; i <= n; i++)
#define rep(i,j,k) for(int i = j; i < k; i++)
#define rp(i,j,k) for(int i = j; i <=k; i++)
#define nn "\n"
#define en "\n"
#define vvi vector<vector<int>>
#define vi vector<int>
#define si set<int>
#define mlsi multiset<int>
#define vc vector<char>
#define vli vector<long long int>
#define vpii vector<pair<int,int>>
#define pii pair<int,int>
#define mii map<int,int>
#define msi map<string,int>
#define mci map<char,int>
#define mpiii map<pair<int,int>,int>
#define umii unordered_map<int,int>
#define umsi unordered_map<string,int>
#define umci unordered_map<char,int>
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sortv(x) sort(x.begin(),x.end())
#define sorta(x,n) sort(x,x+n)
#define sorted(x) is_sorted(x.begin(),x,end())
#define print_all(x) for(auto t:x) cout<<t<<" ";cout<<en;
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define go(x) for(auto &[u,v]:x)
#define in(x) cin>>x
#define in2(x,y) cin>>x>>y
#define in3(x,y,z) cin>>x>>y>>z
#define in4(x,y,z,v) cin>>x>>y>>z>>v
#define oo(x) cout<<x<<endl
#define oo2(x,y) cout<<x<<" "<<y<<endl
#define oo3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define ood(n,x) cout<<fixed<<setprecision(n)<<x<<"\n"
#define sz(x) x.size()
#define ff first
#define ss second
#define ooy cout<<"YES\n"
#define oon cout<<"NO\n" 
#define rr return
#define cc continue

using namespace std;

template<class T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
void read(vli &a,int n){
    a.resize(n);
    forr(i,n) cin>>a[i];
}

bool comp(const pair<ll, ll> &a, const pair<ll, ll> &b) {
    if (a.first == b.first) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

vector<ll> allDivisors(ll n) { 
    vector<ll> v;
    for (ll i=2; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            if (n/i == i) 
                v.pb(i);
  
            else {
                v.pb(i);
                v.pb(n/i);
            } 
        }
    }
    return v;
} 

bool fine=0;
vli a;
ll n,m;
void solve(){
    ll d,t,s;
    in3(d,t,s);
    if(t*s<d){
        cout<<"No";
        rr;
    }
    cout<<"Yes";
}

int main(){
     #ifndef ONLINE_JUDGE 
    freopen("input1.txt", "r", stdin); 
    freopen("error.txt", "w", stderr); 
   freopen("output1.txt", "w", stdout); 
    #endif
    fast; 
   if(fine){
        start{
            solve();
        }
   }
   else solve();
    return 0;
}


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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}
int n;
int a[120000];

int main() {
    int mx = 0;
    int mn = 120000;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        mx = max(mx, a[i]);
        mn = min(mn, a[i]);
    }
    if (mx > mn + 1) {
        cout << "No\n";
        return 0;
    }
    if (mx == mn) {
        if (mn * 2 <= n) {
            cout << "Yes\n";
        }
        else if (mn == n - 1) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }
    else {
        int cc = 0;
        for (int i = 0; i < n; ++i)
            if (a[i] == mn)
                ++cc;
        if (cc + 1 <= mx && 2 * (mx - cc) <= n - cc)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
    return 0;
}




Measured memory_bytes: 768
// inputに入力データ全体が入る
function Main(input) {
  var input = input.split('\n');
  const n = Number(input[0])
  const ocps = input[1].split(' ').map(ocp => Number(ocp));
  var r = 0;
  for (var i = 0; i < n; i++) {
    for (var j = i+1; j < n; j++) {
      r += ocps[i] * ocps[j]
    }
  }
  console.log(r)
}

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

Measured memory_bytes: 7372
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scan=new Scanner(System.in);
		long A=scan.nextLong();
		long B=scan.nextLong();
		long C=scan.nextLong();
		long ans=B/C-A/C;
		System.out.println(A%C==0?ans+1:ans);
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define long long long
using namespace std;
const long N=1e6,inf=1e9;
long aa[N+2];
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  long n,m;cin>>n>>m;

  long lcm=1;
  for(long i=1;i<=n;i++)
  {
    long x;cin>>x;x/=2;aa[i]=x;
    lcm=(lcm*x)/__gcd(lcm,x);
    if(lcm>m)cout<<0<<endl,exit(0);
  }
  //cout<<lcm<<endl;
  //cout<<"here"<<endl;
  for(int i=1;i<=n;i++)
  {
    if((lcm/aa[i])%2==0)cout<<0<<endl,exit(0);
  }
  cout<<((m/lcm)+1)/2<<endl;

  return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

int main()
{
    string t;
    cin >> t;
    ll n=t.length();
    
    rep(i,n){
        if(t[i]=='?'){
            t[i]='D';
        }
    }
    cout << t << endl;
    return 0;
} 


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define REV(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define ts to_string
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector <string>
#define vvs vector <vector<string>>
#define pq  priority_queue<int>
using ll = long long;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 2000000000;
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */
/*---------------------template----------------------*/
/*----------------------end--------------------------*/
/* --------------------ライブラリ--------------------*/
bool isprime(ll a)//素数判定、primeならtrue,違うならfalse
{
    if (a < 2) return false;
    else if (a == 2) return true;
    else if (a % 2 == 0) return false;
    double m = sqrt(a);
    for (int i = 3; i <= m; i += 2)
    {
        if (a % i == 0)
        {
            return false;
        }
    }
    // 素数である
    return true;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
/*---------------------臨時関数----------------------*/
/*----------------------end-------------------------*/
signed main(){
  double A,B,H,M;cin>>A>>B>>H>>M;
  //abs((30*10+0.5*40)-(6*40))
  double kakudo=abs((30*H+0.5*M)-(6*M));
  double C=cos(kakudo*pi/180);
  double ans=A*A+B*B-2*A*B*C;
  cout<<fixed<<setprecision(18)<<sqrt(ans)<<endl;
  
}


Measured memory_bytes: 4084
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,n;
    cin>>h>>n;
    ll x = 0;
    FOR(i,0,n){
        ll in;
        cin>>in;
        x += in;
    }
    if(x>=h)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <math.h>
using namespace std;


/*void solve(){
}*/
int main(){

int x1,y1,r1;
int x2,y2,r2;

cin>>x1>>y1>>r1;
cin>>x2>>y2>>r2;

double distance;


distance=sqrt( (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1) );
if(distance>r1+r2){
    cout<<"4"<<endl;
}
else if(distance==r1+r2){
    cout<<"3"<<endl;
}
else if(distance==abs(r2-r1)){
    cout<<"1"<<endl;
}
else if(distance<abs(r2-r1)){
    cout<<"0"<<endl;
}
else{
    cout<<"2"<<endl;
}
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll M;
  ll D;
  IN(M,D);

  ll ans = 0;

  FOR(m,1,M+1){
    FOR(d1,2,10){
      FOR(d10,2,10){
        if(d10*10+d1>D) continue;
        if(m==d1*d10) ans++;
      }
    }
  }

  OUT(ans);

  return 0;
}


Measured memory_bytes: 384
N=int(input())
C=str(input())

R_list=C.split("W")
numR=len(''.join(R_list))
numW=N-numR

ans=min(numW,numR)

indR=numR

CRlis=''.join(list(C)[indR:])


R_Clis=CRlis.split("W")
numCR=len(''.join(R_Clis))

if numCR<ans:
    ans=numCR
print(ans)

Measured memory_bytes: 13816
#include <iostream>
#include <algorithm>
#include <vector>

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

    int n, m;
    std::cin >> n >> m;
    std::vector<std::vector<int>> a(n, std::vector<int>(m));
    for(auto& r : a){
        for(auto& i : r){
            std::cin >> i;
        }
    }
    std::vector<int> b(m);
    for(auto& i : b){
        std::cin >> i;
    }
    for(int i=0; i<n; ++i){
        int c = 0;
        for(int j=0; j<m; ++j){
            c += a[i][j]*b[j];
        }
        std::cout << c << "\n";
    }
    return 0;
}

Measured memory_bytes: 3240
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N, M;
	
	cin >> N >> M;

	char a[N][N], b[M][M];

	rep(i, N)
	{
		cin >> a[i];
	}

	rep(i, M)
	{
		cin >> b[i];
	}

	if (M > N)
	{
		cout << "No" << endl;
		return 0;
	}

	for (int i = 0; i <= N - M; i++)
	{
		for (int j = 0; j <= N - M; j++)
		{
			int k = 0;
			for (; k < M; k++)
			{
				if (strncmp(&a[i+k][j], &b[k][0], M))
				{
					break;
				}
			}

			if (k == M)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

Vec2<bool> f(3, VecB(3, false));

bool g(ll a, ll b, ll c){
	return f[a/3][a%3] && f[b/3][b%3] && f[c/3][c%3];
}

int main(void){
	Vec2<ll> a(3, Vec(3));
	rep(i, 3){
		rep(j, 3) cin >> a[i][j];
	}
	ll n;
	cin >> n;
	rep(i, n){
		ll b;
		cin >> b;
		rep(i, 3){
			rep(j, 3) if(a[i][j] == b) f[i][j] = true;
		}
	}

	if(g(0, 1, 2) || g(3, 4, 5) || g(6, 7, 8) || g(0, 3, 6) || g(1, 4, 7) || g(2, 5, 8) || g(0, 4, 8) || g(2, 4, 6)) puts("Yes");
	else puts("No");

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
bool index(int s,int k){
  if(s>k) return true;
  else return false;
}
int main(){
   int d,n,m;
  while(cin>>d,d){
    cin >> n >> m;
    int s[n+1],k,ans = 0;
    for(int i=1;i<n;i++) cin >> s[i];
    s[0] = 0;
    s[n] = d;
    sort(s,s+n+1);
    for(int i=0;i<m;i++){
       cin >> k;
      int max = n;
      int mins = 0;
      while(max!=mins+1){
 int a = (max+mins) / 2;
 if(index(s[a],k)) max = a;
 else mins = a;
      }
      ans += min(abs(k-s[max]),abs(k-s[mins]));
     }
    cout << ans << endl;
  }
  return 0;
}

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

const int MAX_N = 59;
long long mod = 1000000007;

struct Matrix {
	long long sz;
	long long p[MAX_N][MAX_N];
};

Matrix Mul(Matrix A, Matrix B) {
	Matrix C; C.sz = A.sz;
	for (int i = 0; i < C.sz; i++) { for (int j = 0; j < C.sz; j++) C.p[i][j] = 0; }

	for (int i = 0; i < A.sz; i++) {
		for (int j = 0; j < A.sz; j++) {
			for (int k = 0; k < A.sz; k++) {
				C.p[i][j] += A.p[i][k] * B.p[k][j];
				C.p[i][j] %= mod;
			}
		}
	}
	return C;
}

Matrix Pow(Matrix A, long long B) {
	Matrix P, Q; P.sz = A.sz; Q = A;
	for (int i = 0; i < P.sz; i++) { for (int j = 0; j < A.sz; j++) P.p[i][j] = 0; }
	for (int i = 0; i < P.sz; i++) P.p[i][i] = 1;

	for (int i = 0; i < 62; i++) {
		if ((B / (1LL << i)) % 2 == 1) {
			P = Mul(P, Q);
		}
		Q = Mul(Q, Q);
	}
	return P;
}

long long N, K; Matrix A;

int main() {
	cin >> N >> K;
	A.sz = N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) cin >> A.p[i][j];
	}
	Matrix V = Pow(A, K);
	long long rem = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) rem += V.p[i][j];
	}
	rem %= mod;
	cout << rem << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	string s;
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s[i] == s[i + 1]) {
			cout << "Bad" << endl;
			exit(0);
		}
	}
	cout << "Good" << endl;
	
}

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

using namespace std;

int main()
{
  string s, t, r;
  cin >> s; cin >> t; cin >> r;
  transform (s.begin (), s.end (), s.begin (), ::toupper);
  transform (t.begin (), t.end (), t.begin (), ::toupper);
  transform (r.begin (), r.end (), r.begin (), ::toupper);
  cout << s[0] << t[0] << r[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a,b,x=1,tab[1006][1006],tabi[1000006];
int main()
{
    cin>>a>>b;
    for(int i=1; i<=a; i++)
    for(int j=1; j<=b; j++)
    cin>>tab[i][j];
    for(int i=1; i<=a; i++){
    for(int j=1; j<=b; j++){
    if(tab[i][j]%2!=0){
    if(j==b && i+1<=a){
    tab[i+1][j]++;
    tabi[x]=i;
    tabi[x+1]=j;
    tabi[x+2]=i+1;
    tabi[x+3]=j;
    x+=4;}
    else if(j<b){
    tab[i][j+1]++;
    tabi[x]=i;
    tabi[x+1]=j;
    tabi[x+2]=i;
    tabi[x+3]=j+1;
    x+=4;}}}}
    x/=4;
    cout<<x<<endl;
    for(int i=1; i<=x*4; i++){
    cout<<tabi[i];
    if(i%4!=0) cout<<" ";
    else cout<<endl;}}




Measured memory_bytes: 8192
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
void nckinit(ll n,ll md){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=md;
  }
  gya[n]=gyaku(kai[n],md);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=md;
  }
  gya[0]=1;
}
ll nck(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  ret*=gya[k];
  ret%=md;
  return ret;
}
ll npk(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n,m;cin>>n>>m;
    ll a[n];
    ll cost[m];
    fill(cost,cost+m,0);
    ll cnt[m];
    fill(cnt,cnt+m,0);
    ll cnt2[m];
    fill(cnt2,cnt2+m,0);
    rep(i,0,n){
        cin>>a[i];
        a[i]--;
        if(i>0){
            cnt[a[i-1]]++;
            ll co=a[i]-a[i-1];
            if(a[i]<a[i-1])co+=m;
            cost[a[i]]+=co;
            cnt2[a[i]]++;
        }
    }
    ll ans=0;
    ll now=0;
    rep(i,1,n){
        if(a[i]<a[i-1]){
            now++;
            ans+=1+a[i];
        }
        else{
            ans+=a[i]-a[i-1];
            if(a[i-1]==0)now++;
        }
    }
    ll mi=ans;
    rep(i,1,m){
        //cout<<ans<<" "<<now<<endl;
        now-=cnt2[i-1];
        ans-=now;
        ans+=cnt[i-1];
        ans+=cost[i-1];
        ans-=cnt2[i-1];
        mi=min(mi,ans);
        now+=cnt[i];
        //cout<<ans<<endl;
    }
    cout<<mi<<endl;
}







Measured memory_bytes: 3456
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
#include <math.h>
#include <iomanip>
#include <limits>
#include <functional>

using namespace std;
using ll = long long;
const ll res = 1000000007;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

int main() {
	string s;
	cin >> s;
	if (s == "ARC")
		cout << "ABC" << endl;
	else
		cout << "ARC" << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if (C / B + (C % B > 0) <= A / D + (A % D > 0))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int n, m;
bool ac[100000];
int pena[100000];


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

	cin >> n >> m;
	rep(i, m) {
		int p;
		string s;
		cin >> p >> s;

		p--;
		if (s == "AC") {
			ac[p] = true;
		}
		else {
			if (!ac[p])pena[p]++;
		}
	}

	int x = 0, y = 0;
	rep(i,n) {
		if (ac[i]) {
			x++;
			y += pena[i];
		}
	}
	cout << x << ' ' << y << endl;


	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x, a, b; cin >> x >> a >> b;
  	if (a >= b) puts("delicious");
  	else if (a + x >= b) puts("safe");
  	else puts("dangerous");
    return 0;
}

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

int N, arr[105];

int main() {
	cin>>N;
	for (int i = 0; i<N; i++){
		cin>>arr[i];
	}
	int ans = 2e9 + 1e8;
	for (int x = 1; x <= 100; x++){
		int res = 0;
		for (int i = 0; i<N; i++){
			res+=abs(x - arr[i])*abs(x - arr[i]);
		}
		ans = min(ans, res);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    string s;
    cin>>n>>k>>s;
    for(int i=0;i<n;i++){
        if(i==k-1) putchar(s.at(i)+32);
        else cout<<s.at(i);
    }
}

Measured memory_bytes: 256
N = int(input())
a = [0]*10050
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            v = i*i+j*j+k*k+i*j+i*k+j*k
            if v <= 10000:
                a[v-1] += 1

for i in range(N):
    print(a[i])


Measured memory_bytes: 9060
S=input()
T=input()
 
if S==T:
    ans="Yes"
else:
    ans="No"
    for _ in range(len(S)):
        rotated_S=S[len(S)-1:]+S[:len(S)-1]
        if rotated_S==T:
            ans="Yes"
            break
        else:
            S=rotated_S
print(ans)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    string s;
    cin >> n >> s;
    ll ans = 0;
    vector <map<char, int> > cnt(n + 1);
    for (int i = n - 1; i >= 0; i--) {
        cnt[i] = cnt[i + 1];
        ++cnt[i][s[i]];
    }
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (s[i] != s[j]) {
                char cur = 'R' + 'G' + 'B' - s[i] - s[j];
                ans += cnt[j + 1][cur];
                int k = j + j - i;
                if (k < n && k > j && s[k] == cur) --ans;
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 4064