akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define ff first
#define ss second
#define pb push_back

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 105;

int n, m;
char mat[N][N];
int dp[N][N][2];

int f(int x, int y, int b){
  if(x >= n || y >= m) return N*N;
  if(mat[x][y] == '#' && b == 0) return N*N;
  if(mat[x][y] == '.' && b == 1) return N*N;
  if(x == n-1 && y == m-1) return 0;
  int &ans = dp[x][y][b];
  if(ans != -1) return ans;
  ans = min(f(x+1, y, b), f(x, y+1, b));
  ans = min(ans, f(x+1, y, b^1) + (b == 0));
  ans = min(ans, f(x, y+1, b^1) + (b == 0));
  return ans;
}

int main() {
  memset(dp, -1, sizeof dp);
  scanf("%d %d", &n, &m);
  for(int i = 0; i < n; i++){
    scanf("%s", mat[i]);
  }
  printf("%d\n", f(0, 0, mat[0][0] == '#') + (mat[0][0] == '#'));
  return 0;
}


Measured memory_bytes: 384
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))
# import sys
# input = sys.stdin.readline

import fractions

N,K=two_int()

A=many_int()

if K <= max(A):
    temp=A[0]
    for a in A[1:]:
        temp = fractions.gcd(temp,a)

    if fractions.gcd(temp,K)!=1 or temp==1:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE") 

else:
    print("IMPOSSIBLE")

Measured memory_bytes: 88300
import java.util.Scanner;

public class Main {
  private static Scanner sc;

  public static void main(String[] args) {
    sc = new Scanner(System.in);
    new Main().solve();
  }

  private void solve() {
    int N = sc.nextInt();
    int[] a = new int[N + 2];
    for (int i = 0; i < N; i++) {
      a[i + 1] = sc.nextInt();
    }
    int sum = 0;
    for (int i = 0; i <= N; i++) {
      sum += Math.abs(a[i] - a[i + 1]);
    }

    for (int i = 0; i < N; i++) {
      System.out.println(sum - Math.abs(a[i] - a[i + 1]) - Math.abs(a[i + 2] - a[i + 1]) + Math.abs(a[i] - a[i + 2]));
    }
  }
}


Measured memory_bytes: 65484
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
int dp[55][55][3000];//dp[i][j][k]:左右1~iまで見て待機がjペア、確定してる交点の個数がk(これから真っ先にj潰して残りは平行でペア作って奇妙さがk)
//main
signed main(){
  int N,K;cin>>N>>K;
  memset(dp,0,sizeof(dp));
  dp[0][0][0]++;
  for(int i=0;i<N;i++){
    for(int j=0;j<=i;j++){
      for(int k=0;k<2500;k++){
        dp[i+1][j+1][k+2*(j+1)]+=dp[i][j][k];//二つとも保留
        dp[i+1][j][k+2*j]+=dp[i][j][k]*2*j;//片方保留
        dp[i+1][j-1][k+2*(j-1)]+=dp[i][j][k]*j*j;//両方使う
        dp[i+1][j][k+2*j]+=dp[i][j][k];//その場でペアに

        dp[i+1][j+1][k+2*(j+1)]%=MOD;
        dp[i+1][j][k+2*j]%=MOD;
        dp[i+1][j-1][k]%=MOD;
        dp[i+1][j][k+2*(j-1)]%=MOD;
      }
    }
  }
  cout<<dp[N][0][K]<<endl;
}

/*
解説AC
http://phyllo-algo.hatenablog.com/entry/2019/07/22/224331
このコードがすごいわかりやすかった
待機している奴らを待機するタイミングで数えておけばあとはそれぞれ1ずつ増えて行くから何が待ってるかを区別することなく一斉に遷移出来るんだね
順列を一緒に並べることで一気に見方が変わった、この配置の仕方は覚えておきたい
*/


Measured memory_bytes: 71168
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
 
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int d,n;
	cin >> d >> n;
	int cnt = 0;
	int x = 100;
	if(d == 0){
		for(int i = 1;;++i){
			cnt += (i % 100 != 0);
			if(cnt == n){
				cout << i << '\n';
				return 0;
			}
		}
	}
	else if(d == 1){
		for(int i = 100;;i += 100){
			cnt += (i % 100 == 0 && i / 100 % 100 != 0);
			if(cnt == n){
				cout << i << '\n';
				return 0;
			}
		}
	}
	else{
		for(int i = 10000;;i += 10000){
			cnt += (i % 100 == 0 && i / 10000 % 100 != 0);
			if(cnt == n){
				cout << i << '\n';
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;


int main() {
	ll N,Y;
	cin >> N >> Y;
	
	for (ll i = 0; i < N + 1;i++) {
		for(ll j = 0; i + j < N + 1 ;j++) {
			if (i * 10000 + j * 5000 + (N - i - j) * 1000 == Y) {
				cout << i << " " << j << " " << (N - i - j) << endl;
				return 0;			
			}			
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	 public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 while(true){
			 String x=sc.nextLine();
			 if(x.equals("0"))break;
			 int sum=0;
			 for (char y:x.toCharArray()) {
				 sum +=Integer.parseInt(String.valueOf(y));
			 }

		 System.out.println(sum);
		 }
		 sc.close();
	 }
}



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

bool can = false;
int n;
int main()
{
    cin >> n;
    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <= 9; j++)
        {
            if (i * j == n)
            {
                can = true;
            }
            
        }
        
    }
    if (can == true)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

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

int main() {
    cout << fixed << setprecision(10);
    
    int A, B, C, K; cin >> A >> B >> C >> K;

    if (K <= A) {
        cout << K << endl;
        // return 0;
    } else if  (K <= A + B) {
        cout << A << endl;
    } else {
        cout << A - (K-A-B) << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
list1 = []
ame = A[0]
for i in range(N-1):
  list1.append(sum(A[:i+1])+sum(B[i:]))
  
if list1 == []:
  print(A[0]+B[0])
else:
  print(max(list1))

Measured memory_bytes: 9200
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

a,b = ips()

print(max(0,a-2*b))

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
 
ll findlcm(ll arr[], int n) 
{ 
   
    ll ans = arr[0]; 
  
    
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
       ll n,x,ans=1,k=0;
       cin>>n>>x;
       ll A[n];
       for(ll i=0;i<n;i++)
       {
           cin>>A[i];
           if(k+A[i]<=x)
           {
               ans++;
               k=k+A[i];
           }
           else
           {
               break;
           }
       }
       cout<<ans;
    } 
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define MAX 2005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<ll,ll>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);
#define INT_SIZE 32
using namespace std;
 
ll gcd(ll n1,ll n2){
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
int cnt[1000000];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		cnt[x]++;
	}	
	for(int i=1;i<=100000;i++)
	{
		if(cnt[i]>1)
		{
			n-=cnt[i]-1;
		}
	}
	if(n%2==0)
		n--;
	cout<<n<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    vector<ll> graph[n];
    REP(i,n){
        graph[i].clear();
    }
    REP(i,n){
        ll u;
        cin>>u;
        u--;
        graph[i].pb(u);
    }
    map<ll,ll> s;
    vector<ll> ord;
    ord.pb(0);
    stack<ll> st;
    s[0]=0;
    st.push(0);
    ll i=1;
    ll pos;
    while(1){
        ll from=st.top();
        st.pop();
        ll to=graph[from][0];
        if(s.count(to)){
            pos=s[to];
            break;
        }
        st.push(to);
        ord.pb(to);
        s[to]=i;
        i++;
    }
    vector<ll> rep(ord.begin()+pos,ord.end());
    if(k<pos){
        cout<<ord[k]+1<<endl;
    }
    else{
        k-=pos;
        k%=rep.size();
        cout<<rep[k]+1<<endl;
    }
}


Measured memory_bytes: 28476
#include <bits/stdc++.h>
#define REP(a, b) for(int a = 0; a < b; a++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define mp make_pair
#define f first
#define s second
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> LL;
typedef vector<int> vi;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const int MAXN = 305;

double DP[MAXN][MAXN][MAXN];
int n;
int A[MAXN];
int cnt[5];

double rek(int cnt1, int cnt2, int cnt3) {
	if (cnt1 < 0 || cnt2 < 0 || cnt3 < 0) return 0.0;
	if (cnt1 == 0 && cnt2 == 0 && cnt3 == 0) return 0.0;
	double &ret = DP[cnt1][cnt2][cnt3];
	//cout << cnt1 << ' ' << cnt2 << ' ' << cnt3 << ' ' << ret << ' ' << -EPS << '\n';
 	if (ret > -EPS) return ret;
	double a = double(cnt1) / n * (1 + rek(cnt1 - 1, cnt2, cnt3));
	double b = double(cnt2) / n * (1 + rek(cnt1 + 1, cnt2 - 1, cnt3));
	double c = double(cnt3) / n * (1 + rek(cnt1, cnt2 + 1, cnt3 - 1));
	double d = double(n - cnt1 - cnt2 - cnt3) / n;
	ret = double(n) / (cnt1 + cnt2 + cnt3) * (a + b + c + d);
	return ret;
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	REP(i, n) {
		cin >> A[i];
		cnt[A[i]]++;
	}
	REP(i, MAXN) REP(ii, MAXN) REP(iii, MAXN) DP[i][ii][iii] = -1.0;
	cout << fixed << setprecision(12) << rek(cnt[1], cnt[2], cnt[3]) << '\n';
}

Measured memory_bytes: 221952
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <random>
#include <cassert>
#include <limits>

using namespace std;

#define mp make_pair
#define pb push_back
#define repi(i, p, q) for (long long i = p; i < q; i++)
#define repd(i, p, q) for (long long i = p; i >= q; i--)
#define INF 2000000000
#define MOD 1000000007

typedef map<int, int> M;
typedef map<long, long> ML;
typedef map<long long, long long> MLL;
typedef pair<int, int> P;
typedef pair<long, long> PL;
typedef pair<long long, long long> PLL;
typedef int I;
typedef double D;
typedef long double LD;
typedef long L;
typedef long long LL;

int main()
{
    string a;
    cin >> a;
    int ans = 0;
    int counter = 0;
    repi(i, 0, a.length())
    {
        if (a[i] == 'A' || a[i] == 'C' || a[i] == 'T' || a[i] == 'G')
        {
            counter++;
        }
        else
        {
            ans = max(ans, counter);
            counter = 0;
        }
    }
    ans = max(ans, counter);
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    x = gete(int)

    print('Yes' if x >= 30 else 'No')


if __name__ == "__main__":
    main()

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

#define REP(i,n) for(i=0;i<n;i++)
#define ll long long

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);
int asc(const void *a, const void *b);
int desc(const void *a, const void *b);
double to_deg(double rad);
double distance(int xi, int yi, int xj, int yj);

//main function
int main() {
    int N = iin(), n;
    char s[N], t[N];
    stin(s);
    stin(t);
    REP(n,N) {
        printf("%c%c", s[n], t[n]);
    }
    printf("\n");
    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

/*
    int型の最大公約数
*/

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    int型の最小公倍数
*/

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    long long型の最大公約数
*/

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    long long型の最小公倍数
*/

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    int型の昇順用比較関数
*/

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

/*
    int型の降順用比較関数
*/

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

/*
    弧度法を度数法に
*/

double to_deg(double rad) {
    return rad * 180.0 / (atan(1.0) * 4.0);
}

double distance(int xi, int yi, int xj, int yj) {
    return hypot(xj - xi, yj - yi);
}


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

using namespace std;

int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  map<int, int> mp1, mp2;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    i % 2 ? mp1[x]++ : mp2[x]++;
  }
  int mx1 = 0, k1 = 0, mx2 = 0;
  for (auto e : mp1) {
    if (e.second > mx1) {
      mx2 = mx1;
      tie(k1, mx1) = e;
    } else {
      mx2 = max(mx2, e.second);
    }
  }
  int ans = n;
  for (auto e : mp2) {
    if (e.first == k1) {
      ans = min(ans, n - e.second - mx2);
    } else {
      ans = min(ans, n - e.second - mx1);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define int long long

void solve() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max({a * c, a * d, b * c, b * d});
}

int32_t main() {
	int t = 1;
//	cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3632
#include <bits/stdc++.h> 
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define per(i,n) for(long long i = (long long)(n-1);i >= 0;--i)
#define REP(i,s,t) for(long long i=s;i<t;i++)
#define PER(i,s,t) for(long long i=s;i>t;--i)
#define all(x) x.begin(),x.end()
#define sp(n) setprecision(n)
typedef long long ll;
using namespace std;
ll p=1000000007;
vector<ll> e(60,0),q(60);
ll f(int k){
  q[0]=k;
  REP(i,1,60){
    q[i]=(q[i-1]*q[i-1])%p;}
  ll prime=p;
  rep(i,60){
      if(prime%2==1){
          e[i]=1;
      }
      prime/=2;
  }
  e[1]=1-e[1];
  ll t=1;
  rep(i,60){if(e[i]==1){t=(t*q[i])%p;}}
  return t;}
int main(){
    int x,y;
  cin>>x>>y;
  if(-x+2*y>=0&&(-x+2*y)%3==0&&2*x-y>=0&&(2*x-y)%3==0){
    int a=(-x+2*y)/3,b=(2*x-y)/3;
    ll v=1,w=1,z=1;
    for(int i=1;i<=a+b;i++){v=v*i%p;}
    for(int i=1;i<=a;i++){w=w*i%p;}
    for(int i=1;i<=b;i++){z=z*i%p;}
    ll s=((v*f(w)%p)*f(z))%p;
    cout<<s<<endl;}
  else cout<<0<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
void countFreq(string arr[], long long n) 
{ 
    unordered_map<string, long long> mp; 
    long long count=0;
    // Traverse through array elements and 
    // count frequencies 
    for (long long i = 0; i < n; i++) 
        mp[arr[i]]++; 
  
    // Traverse through map and print frequencies 
    for (auto x : mp) 
        {
        	long long a=x.second;
        	if(x.second>1)
        	count=count+((a*(a-1))/2);
        } 
        cout<<count;
} 
int main() {
	long long n;
	cin>>n;
	string arr[n];
	for(long long i=0;i<n;i++)
	{
		string str;
		cin>>str;
		sort(str.begin(), str.end());
		arr[i]=str;
	}
	sort(arr,arr+n);
	countFreq(arr,n);
	return 0;
}


Measured memory_bytes: 11428
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a) distance((v).begin(),upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a) distance((v).begin(),lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};
#define MOD 1000000007

struct D21{
  int is,js;
  D21(int isize,int jsize){
    is = isize;
    js = jsize;
  }
  int operator()(int i,int j){
    return i*js+j;
  }
};


void Main(){
  int n;
  cin>>n;
  vvi a(n,vi(3));
  rep(i,n ) cin>>a[i];
  vvi dp(n+1,vi(3));
  dp[0][0] =0;
  dp[0][1] =0;
  dp[0][2] =0;
  rep(i,n) rep(j,3) rep(k,3) if(j!=k){
    chmax(dp[i+1][j], dp[i][k] + a[i][j]);
  }
  cout<<*max_element(rng(dp[n]))<<endl;
} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 11264
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;
int dis[101];
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	for(int i=a;i<b;i++)
		dis[i]++;
	for(int i=c;i<d;i++)
		dis[i]++;
	int ans=0;
	rep(i,100)
		if(dis[i]==2)
			ans++;
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;
struct edge{long long to,dist;};
vector<edge> G[100010];
long long d[100010];
void dfs(int s){
    for(auto v: G[s]){
        if(d[v.to]==-1){
            d[v.to] = d[s] + v.dist;
            dfs(v.to);
        }
    }
}

int main(){
    int i,n,q,k;
    cin >> n;
    for(i=0;i<n-1;i++){
        int a,b,c;
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back({b,c});
        G[b].push_back({a,c});
    }
    for(i=0;i<n;i++){
        d[i] = -1;
    }
    cin >> q >> k;
    k--;
    d[k] = 0;
    dfs(k);
    for(i=0;i<q;i++){
        int x,y;
        cin >> x >> y;
        x--; y--;
        cout << d[x] + d[y] << endl;
    }
}

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

int main(){
  int m,d;
  cin >> m >> d;
  int ans = 0;
  for(int x = 2; x<=9; x++){
    for(int y = 2; y<=9; y++){
      if(x*y <= m && 10*x + y <= d){
        ans++; 
      }
    }
  }  
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<cstdio>

main(){
  double x1,x2,x3,x4,y1,y2,y3,y4;
  int i;
  scanf("%d",&i);
  for(;i--;)
    {
      scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
	if(((x1-x2)*(y3-y4))==((x3-x4)*(y1-y2)))
	  puts("YES");
	else
	  puts("NO");
    }
  return 0;
}

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

long long N, a[202020], b, A;

int main(){
  scanf("%lld", &N);
  for(int i = 0; i < N; a[i] -= i, ++i)scanf("%lld", a + i);
  sort(a, a + N);
  b = a[N / 2];
  for(int i = 0; i < N; ++i)A += abs(a[i] - b);
  cout << A << endl;
}


Measured memory_bytes: 1792
n = int(input())
b = list(map(int, input().split())) 
a=[]
c=[]
x = 0
a.append(b[0])
for i in range(n-2):
    c.append(b[x])
    c.append(b[x+1])
    a.append(min(c))
    x=x+1
    c=[]
a.append(b[-1])
print(sum(a))

Measured memory_bytes: 3064
import math
import sys
import itertools
import queue
from fractions import gcd

import sys
sys.setrecursionlimit(10000)

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

from math import factorial
import collections

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    #mng = [][]
    sl = []
    for _ in range(N):
        tmp = sorted(sys.stdin.readline().rstrip())
        #print(''.join(tmp))
        sl.append(''.join(tmp))
    #print(sl)
    c = collections.Counter(sl)
    ans = 0
    for n in c.values():
        r = 2
        if n > 1:
            ans += factorial(n) // (factorial(n - r) * factorial(r))

    print(int(ans))


Measured memory_bytes: 21792
package main

import (
	"fmt"
)

func main() {
	var n, y int
	fmt.Scan(&n, &y)
	y /= 1000
	for i := 0; i <= n; i++ {
		ii := i * 10
		if ii > y {
			break
		}
		for j := 0; j <= n-i; j++ {
			jj := j * 5
			if ii+jj > y {
				break
			}
			k := n - i - j
			if ii+jj+k == y {
				fmt.Println(i, j, k)
				return
			}
		}
	}
	fmt.Println(-1, -1, -1)
}


Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
ll const MOD = 1e9 + 7;

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

Measured memory_bytes: 3560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class375
    {
        static void Main()
        {
            var Q = int.Parse(Console.ReadLine());
            var d = new int[100001];
            for (int i = 3; i < 100001; i++)
            {
                d[i] = d[i - 1];
                if (check(i)) d[i]++;
            }

            for (int i = 0; i < Q; i++)
            {
                var lr = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (lr[0] % 2 == 1) lr[0]--;
                if (lr[1] % 2 == 1) lr[1]++;
                Console.WriteLine(d[lr[1]]-d[lr[0]]);
            }
        }
        static bool check(int num)
        {
            if (num % 2 == 0) return false;
            for (int i = 2; i <= Math.Sqrt(num); i++)
            {
                if (num % i == 0) return false;
            }
            for (int i = 2; i <= Math.Sqrt((num+1)/2); i++)
            {
                if ((num+1) / 2 % i == 0) return false;
            }
            return true;
        }
    }
}


Measured memory_bytes: 17820
program ec12;
var
	n,m,i,j:longint;
	a:array[1..501,1..501] of longint;
	c:char;
begin
	readln(n,m);
	for i:=1 to n do
	begin 
		if i mod 2=1 then 
		begin 
			for j:=1 to m do
			a[i,j]:=1;
		end
		else
		begin 
			for j:=1 to m do
			a[i,j]:=2;
		end;
	end;
	for i:=1 to n do 
	a[i,1]:=1;
	for i:=1 to n do
	a[i,m]:=2;
	for i:=1 to n do
	begin 
		for j:=1 to m do 
		begin 
			read(c);
			if c='#' then 
			a[i,j]:=3;
		end;
		readln;
	end;
	for i:=1 to n do 
	begin 
		for j:=1 to m do 
		begin 
			if (a[i,j]=1) or (a[i,j]=3) then 
			write('#')
			else
			write('.');
		end;
		writeln;
	end;
	writeln;
	for i:=1 to n do
	begin 
		for j:=1 to m do
		begin 
			if (a[i,j]=2) or (a[i,j]=3) then 
			write('#')
			else
			write('.');
		end;
		writeln;
	end;
end. 

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

const int N = 1e5 + 5;
vector<int> g[N];

const int W = 0;
const int B = 1;
const int X = 2;

lli memo[N][3];
lli rec(int curr, int prev, int parent)
{
  lli& ret = memo[curr][parent];
  if (ret != -1) return ret;

  const lli mod = 1e9 + 7;
  
  int cnt = 0;

  lli b = 0;
  lli w = 1;
  each (next, g[curr]) {
    if (next == prev) continue;
    ++cnt;
    (w *= rec(next, curr, W)) %= mod;
    if (parent != B) {
      if (b == 0) b = 1;
      (b *= rec(next, curr, B)) %= mod;
    }
  }

  if (cnt == 0) {
    if (parent == B) return ret = 1;
    if (parent == W) return ret = 2;
    if (parent == X) return ret = 2;
  }

  return ret = (w + b) % mod;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    fill(g, g + N, vector<int>());
    for (int i = 0; i < n - 1; ++i) {
      int a, b;
      cin >> a >> b;
      --a;
      --b;
      g[a].push_back(b);
      g[b].push_back(a);
    }

    fill(&memo[0][0], &memo[N - 1][3 - 1] + 1, -1);
    cout << rec(0, -1, X) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 14976
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
#define MAX 100000
#define NIL -1

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c) {
    stack<int> S;
    S.push(r);
    color[r] = c;
    while(!S.empty()) {
        int u = S.top();
        S.pop();
        for(int i=0; i<G[u].size(); i++) {
            int v = G[u][i];
            if(color[v]==NIL) {
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void assignColor() {
    int id = 1;
    for(int i=0; i<n; i++) {
        color[i] = NIL;
    }
    for(int u=0; u<n; u++) {
        if(color[u]==NIL) {
            dfs(u, id++);
        }
    }
}

int main() {
    int s, t, m, q;

    cin >> n >> m;

    for(int i=0; i<m; i++) {
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    assignColor();

    cin >> q;

    for(int i=0; i<q; i++) {
        cin >> s >> t;
        if(color[s]==color[t])  {
            cout << "yes" << endl;
        }
        else {
            cout << "no" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 8904
#include<stdio.h>

struct Card{
  char suit;
  char value;
};

int main(){
  struct Card C1[101], C2[101],CC;
  int n, i,j,mini,flag=0;
  char ch;

  scanf("%d%c", &n, &ch);
  for ( i = 0; i < n; i++ ){
    scanf("%c%c%c", &C1[i].suit, &C1[i].value, &ch);
  }

  for(i=0;i<n;i++) C2[i]=C1[i];

  //BubbleSort
  for(i=0;i<=n-1;i++){
    for(j=n-1;j>=i+1;j--){
      if(C2[j].value < C2[j-1].value){
	CC=C2[j];
	C2[j]=C2[j-1];
	C2[j-1]=CC;
      }
    }
  }
  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%c%c",C2[i].suit,C2[i].value);
  }
  printf("\n");

  printf("Stable\n");

  //SelectionSort
  for(i=0;i<=n-1;i++){
    mini=i;
    for(j=i;j<=n-1;j++){
      if(C1[j].value < C1[mini].value){
	mini=j;
      }
    }
    CC=C1[i];
    C1[i]=C1[mini];
    C1[mini]=CC;
  }
  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%c%c",C1[i].suit,C1[i].value);
    if(!(C1[i].suit == C2[i].suit && C1[i].value == C2[i].value)) flag = 1;
  }
  printf("\n");

  if(flag == 1) printf("Not stable\n");
  else printf("Stable\n");



  return 0;
}

Measured memory_bytes: 612
#include<iostream>
#include<utility>
#include<queue>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;


using ll = long long;
int main() {
	ll a, b;
	cin >> a >> b;
	cout << min(b/2, (2 * a + b) / 4) << endl;
}

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

int main()
{
    int a, b;

    cin >> a >> b;

    int d = a/b;
    int r = a%b;
    double f = 1.0 * a / b;

    cout << d << " " << r << " " << fixed << setprecision(5) << f << endl;
}

Measured memory_bytes: 3288
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

template <typename T>
using vec = vector<T>;

template <typename T>
using vec2 = vector<vector<T>>;

template <typename T>
using vec3 = vector<vector<vector<T>>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    int n, m;
    cin >> n >> m;
    vec<string> field(n), pic(m);
    for (int i = 0; i < n; i++) {
        cin >> field[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> pic[i];
    }

    bool ans = false;

    int ro = n - m + 1;
    for (int i = 0; i < ro; i++) {
        for (int j = 0; j < ro; j++) {
            vec<string> com(m);

            for (int k = 0; k < m; k++) {
                com[k] = field[i + k].substr(j, m);
            }

            if (pic == com) {
                ans = true;
                break;
            }
        }
    }

    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main(){
  int N,L;
  cin >>N>>L;
vector<int> a(0);
  for(int i = 1; i<N+1 ;i++)
    a.push_back(i+L-1);
  
  int tsum =0;
  for(int i =0;i<N;i++)
    tsum += a.at(i);
  int ko =0;
  
  for(int i =0;;i++){
    for(int j =1;j<N+1;j++){
    if(j+L-1 ==i || j+L-1 == -i){
      cout << tsum - (j+L-1);
      ko ++;
      break;
      }
    }
    if(ko ==1)
    break;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python
from fractions import gcd

def ng(a, b, c, add):
    return 0 < (b-a)%add < (b-c)

def solve():
    a, b, c, d = map(int, input().split())
    # 自明
    if d < b or a < b:
        return 'No'
    if c > b:
        return 'Yes'
    a %= b
    if a > c:
        return 'No'

    if d-b == 0:
        return 'Yes'

    if gcd(b, d-b) < b-c:
        return 'No'
    else:
        return 'Yes'
    # if ng(a, b, c, d-b):
    #     return 'No'

    # # さんざんまわしたらアウトになる
    # t = (d-b)
    # if ng(a, b, c, :
    #     return 'No'
    
    # return 'Yes' 
    
T = int(input())
for _ in range(T):
    print(solve())

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

int main()
{
    int N;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

    bool flag = true;
    int idx = 0;
    while (idx < N - 1)
    {
        sort(A, A + N);
        int count = 0;
        for (int i = idx + 1; i < N; i++)
        {
            A[i] %= A[idx];
            if (A[i] == 0)
            {
                count++;
            }
        }
        idx += count;
    }
    sort(A, A + N);
    cout << A[N - 1] << endl;
}


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

#define FOR(i,a,b)    for (int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)   for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)      for (int i=0    ;i<(n) ;i++)
#define RREP(i,n)     for (int i=(n)-1;i>=0  ;i--)
#define EACH(i,a,b)   for (int i=(a)  ;i<=(b);i++)
#define REACH(i,a,b)  for (int i=(b)  ;i>=(a);i--)
#define ALL(a)        (a).begin(),  (a).end()
#define RALL(a)       (a).rbegin(), (a).rend()

const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const double EPS = 1e-10;

using ll = long long;
using P = pair<int,int>;
template<class T = int> using V = vector<T>;

template<class T> bool inline chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool inline chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T = int> T inline input() { T x; cin >> x; return (x); }
template<class T> void inline print(T& x) { cout << x << '\n'; }
#define debug(x) cerr << #x << ": " << x << endl;

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

  ll N = input<ll>();

  ll ans = (N - 1) * N / 2;

  print<ll>(ans);

  return 0;
}



Measured memory_bytes: 3624
//
// Created on 2020/03/22.
//

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

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    double ans;
    double L;
    cin>>L;

    double x = L/3;
    double y = L/3;
    double z = L/3;

    ans = (x*y*z);

    printf("%.10f\n",ans);
}


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

int main() {
  int n, m = 0;
  cin >> n;
  vector<int> l(n);
  for (int i = 0; i < n; i++) cin >> l[i];

  sort(l.begin(), l.end());

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (l[i] == l[j]) continue;
      for (int k = j + 1; k < n; k++) {
        if (l[i] == l[k] || l[j] == l[k]) continue;
        if (l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]) m++;
      }
    }
  }
  cout << m << endl;
}

Measured memory_bytes: 3604
import sys
A, B, C, X, Y = map(int,input().split())

minf = sys.maxsize
X1 = X
Y1 = Y


for i in range(0, max(X,Y)+1):
    price = max(0,(X1-i))*A+max(0,(Y1-i))*B+2*i*C
    if minf > price:
        minf = price


print(minf)


Measured memory_bytes: 3060
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String S = in.nextLine();
         if ((S.charAt(0) == S.charAt(1))&&(S.charAt(2)== S.charAt(1))){
          System.out.println("No");
         }
         else {System.out.println("Yes");
                }
        }
    }

Measured memory_bytes: 21844
// 15/06/20 // 4:46 PM //

#include <bits/stdc++.h>

using namespace std;

#define endl "\n"
#define pb push_back
#define int long long

const int MAXN = (3e3) + 10;
const int MOD  = (1e9) + 7;

int n, memo[2][MAXN], prefix[MAXN];
string cond;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n >> cond;	
		
	memo[1][1] = 1;
	for(int i=2; i<=n; i++){
		
		for(int k=1; k<=i; k++){
			prefix[k] = prefix[k-1] + memo[~i&1][k];
			prefix[k] %= MOD;
		}
		
		for(int j=1; j<=i; j++){
			if(cond[i-2]=='<')
				memo[i&1][j] = prefix[j-1];
			else
				memo[i&1][j] = (MOD + prefix[i] - prefix[j-1])%MOD;
		}
	}
	
	int resp = 0;
	for(int k=1; k<=n; k++){
		resp += memo[n&1][k];
		resp %= MOD;
	}
	
	cout << resp << endl;
	
	return 0;
}


Measured memory_bytes: 512
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

template<typename T>
T power(T x, long long n, const T &m){
    if(n == 0) return 1;
    if(n == 1) return x;
    T tmp = power(x, n/2, m);
    if(n%2 == 0) return tmp * tmp % m;
    else return tmp * tmp % m * x % m;
}

template<typename T>
T inverse(T x, const T &m){
    return power(x, m-2, m);
}

// どちらにしても 3 マス動く
// (X+Y)%3 == 0 が必要
// 移動の回数は (X+Y)/3 回に決まる

int X, Y;

signed main(){
    cin >> X >> Y;
    if((X+Y)%3 != 0){
        cout << 0 << endl;
        return 0;
    }
    int c = (X+Y)/3;
    if(X < c || Y < c){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;

    // c 回の中から X-c 回を選ぶ c C X-c
    for(ll i=1; i<=X-c; i++){
        ans *= c-i+1;
        ans %= MOD;
        ans *= inverse(i, MOD);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

char s[101];

int main()
{
    scanf("%s", s);
    int l=0;
    int c=0, f=0;

    while(s[++l]);

    for(int i=0; i<l; i++) {
        if(s[i]=='C') c=1;
        if(c && s[i]=='F') {
            printf("Yes");
            return 0;
        }
    }

    printf("No");

    return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<long> x(10000);
  	x[0] = n;
	for(int i = 1; i < 10000; i++) {
		if(n % 2 == 0) {
        	n /= 2; 
        } else {
        	n = 3 * n + 1;
        }
      	for(int j = 0; j < i; j++) {
        	if(n == x[j]) {
            	cout << i+1 << endl;
              	return 0;
            } 
        }
      	x[i] = n;
	}
}


Measured memory_bytes: 384
s = str(input())
n = len(s)
ans,ch = 0,0
for i in range(n):
  if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
    ch += 1
  else:
    ch = 0
  if ch >= ans:
    ans = ch
print(ans)

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

const int mxN = 1e5 + 5;
int dp[4][mxN], a[4][mxN], n;
int solve(int idx, int last) {
	int &ret = dp[last][idx];
	if(ret != -1)
		return ret;
	if(idx == n)
		return ret = a[last][idx];
	int maxi = 0;
	if(last != 1)
		maxi = max(maxi, solve(idx + 1, 1));
	if(last != 2)
		maxi = max(maxi, solve(idx + 1, 2));
	if(last != 3) 
		maxi = max(maxi, solve(idx + 1, 3));
	return ret = a[last][idx] + maxi;
}
int main() {
	cin >> n;
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= 3; ++j)
			cin >> a[j][i];
	memset(dp, -1, sizeof dp);
	cout << solve(0, 0);
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<ll>())
#define ll long long
#define rep(i, s, g) for (ll i = (s); i < (g); i++)
#define MOD 1000000007
#define vfind(v, target) find(v.begin(), v.end(), target)
#define notFound(v, target) (vfind(v, target) == v.end())
using namespace std;

ll N, K, R, S, P, ans = 0;
string T;

ll score(char c) {
	if (c == 'r') return P;
  	else if (c == 's') return R;
  	else if (c == 'p') return S;
}
int main()
{  
  cin >> N >> K >> R >> S >> P >> T;
  vector<bool> win(N, false);
  rep(i, 0, N) {
  	if (i < K || T[i] != T[i - K] || win[i - K] == false) {
    	ans += score(T[i]);
    	win[i] = true;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
/*input
6 15
6 5
5 6
6 4
6 6
3 5
7 2
*/

//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.

//code author: iamxlr8

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main() 
{
    off;
    ll N,W;
    cin>>N>>W;
    ll w[N+1],v[N+1];
    ll V=0;
    for(ll i=1;i<=N;i++)
    {
        cin>>w[i]>>v[i];
        V+=v[i];
    }
    ll dp[V+1];
    for(ll i=0;i<=V;i++)
        dp[i]=1e18L+5;
    dp[0]=0;
    for(ll i=1;i<=N;i++)
    {
        for(ll k=V;k-v[i]>=0;k--)
            dp[k]=min(dp[k],dp[k-v[i]]+w[i]);
    }
    ll ans=0;
    for(ll i=V;i>=0;i--)
    {
        if(dp[i]<=W)
        {
            ans=i;
            break;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1024
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>

using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     vi              vector<int>
#define     vll             vector<ll>
#define     sz(x)           (int)x.size()
#define     pb              push_back
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

int main() {
	int n;cin>>n;
	ll arr[n],cnt=0,sum=0;
	loop(n,i,0){
		cin>>arr[i];
		cnt+=(arr[i]<0);
		arr[i]=abs(arr[i]);
		sum+=arr[i];
	}
	if(cnt%2){
		sort(all(arr,n));
		sum-=(arr[0]*2);
	}
	cout<<sum;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
DPか再帰か
DPかな
oをxと仮定して無理だったら必須確定
でもN^2になる
とるの確定したら選択肢せばめていけば効率化？

11 3 2
ooxxxoxxxoo
xoxxxoxxxoo

ooxxxoxxxoo

oxxooxoxxo
1=1
2=1
6=2
10=3
11=3
一番遅いペースでとっておいて、それを上回っていればOK？
11=3
10=3
5 1 0
ooooo
一番速いペースと遅いペース、どっちもおさえとく

一番速いペースだけ抜いとく？
  ooxxxoxxxoo
は11111222233
お33222211111

抜いた前後C日だけ見とか
日数に余裕あったらむしろなし？
oの前後たして3になったらOK？あれ、いけそう？
*/
int main(){
  ll N,K,C,cnt=0,wait=0;
  string S;
  cin>>N>>K>>C>>S;
  vector<ll> DP1(N+10,0),DP2(N+10,0),ans(0,0);
  for(ll i=1; i<=N; i++){
    if(S[i-1]=='o' && wait==0){
      cnt++;
      wait=C;
    }
    else wait=max(0LL,wait-1);
    DP1[i]=cnt;
  }
  cnt=0,wait=0;
  for(ll i=N; i>0; i--){
    if(S[i-1]=='o' && wait==0){
      cnt++;
      wait=C;
    }
    else wait=max(0LL,wait-1);
    DP2[i]=cnt;
  }
  for(ll i=1; i<=N; i++) if(S[i-1]=='o' && DP1[i-1]+DP2[i+1]<K) ans.emplace_back(i);
  ll asz=ans.size();
  for(ll i=0; i<asz; i++) cout<<ans[i]<<endl;
}

Measured memory_bytes: 8516
#include <cstdio>
int p[]={6000,4000,3000,2000};
int main() {
	int ans=0;
	for(int i=0;i<4;i++) {
		int t,n;
		scanf("%d %d",&t,&n);
		printf("%d\n",p[t-1]*n);
	}
}

Measured memory_bytes: 1028