akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var l = int.Parse(Console.ReadLine());
        var a = new long[l];
        for (int i = 0; i < l; i++)
        {
            a[i] = long.Parse(Console.ReadLine());
        }
        // 5 zone : zero, even, odd, even, zero
        var dp = new long[5, l];
        for (int i = 0; i < l; i++)
        {
            for (int z = 0; z < 5; z++)
            {
                long d;
                switch (z)
                {
                    case 0: // zero
                    case 4:
                        d = a[i];
                        break;
                    case 1: //even
                    case 3:
                        d = a[i] == 0 ? 2 : a[i] % 2;
                        break;
                    case 2: //odd
                    default:
                        d = (a[i] + 1) % 2;
                        break;
                }
                if (i == 0)
                {
                    dp[z, i] = d;
                }
                else
                {
                    dp[z, i] = Enumerable.Range(0, z + 1).Min(x => dp[x, i - 1]) + d;
                }
            }
            Console.Error.WriteLine($"{dp[0, i]} {dp[1, i]} {dp[2, i]} {dp[3, i]} {dp[4, i]} ");
        }

        var min = Enumerable.Range(0, 5).Min(x => dp[x, l - 1]);
        Console.WriteLine(min);
    }
}

Measured memory_bytes: 26680
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i(a); i < (b); ++i)

#define gc getchar()
struct Reader {
	template <class T> inline operator T() {
		T w; char c, p = 0;
		for(; !isdigit(c = gc); c == '-' && (p = 1));
		for(w = c & 15; isdigit(c = gc); w = w * 10 + (c & 15));
		return p ? -w : w;
	}
}rd;

template <class T> inline bool smin(T&x, const T&y) { return y < x ? x = y, 1 : 0; }
template <class T> inline bool smax(T&x, const T&y) { return x < y ? x = y, 1 : 0; }

typedef long long ll;
const int P(1e9 + 7);
int n;
ll k;
struct Mat {
	int v[50][50];
	Mat() { memset(v, 0, sizeof v); }
	inline int* operator [] (const int&i) { return v[i]; }
	inline Mat operator * (Mat &c) {
		Mat r;
		REP(k, 0, n) REP(i, 0, n) REP(j, 0, n)
			r[i][j] = (r[i][j] + 1ll * v[i][k] * c[k][j]) % P;
		return r;
	}
} g, r;
int main() {
	n = rd, k = rd;
	REP(i, 0, n) REP(j, 0, n) g[i][j] = rd;
	REP(i, 0, n) r[i][i] = 1;
	for (; k; k >>= 1, g = g * g) if(k & 1) r = r * g;
	int ans = 0;
	REP(i, 0, n) REP(j, 0, n)
		if ((ans += r[i][j]) >= P) ans -= P;
	std::cout << ans;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n";
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int32_t main()
{
	IOS;
	int a,b;
	int v,w;
	cin>>a>>v;
	
	cin>>b>>w;
	int t;
	cin>>t;
	if(w>=v)
	{
		cout<<"NO"<<endl;
	}
	else
	{
		int k=abs(a-b);
		if(t*v-t*w>=k)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	}
	
}

Measured memory_bytes: 3652
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    int a[3];
    scanf("%d %d %d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    if ((a[1]-a[0])&1) {
        printf("%d",((a[2]*2-a[1]-a[0]+1)/2)+1);
    }
    else printf("%d",(a[2]*2-a[1]-a[0])/2);
}


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

int const maxn = 60;

int N, t[maxn];
string s[maxn], X;

int main()
{
  scanf("%d", &N);
  for(int i = 0; i < N; i++) cin >> s[i] >> t[i];
  cin >> X;

  int i;
  for(i = 0; i < N; i++) if(s[i] == X) {
    i++;
    break;
  }


  int sum = 0;
  for(; i < N; i++) sum += t[i];

  printf("%d\n", sum);

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//const long long INF64 = 1'000'000'000'000'000'000ll;
#define MOD 1000000007
double pow(double a, int n){
    double ret =1;
    while(n){
        if(n%2==1)ret*=a;
        a*=a;
        n/=2;
    }
    return ret;
}
const int MAX_SIZE = 1000009; 
vector<int >isprime(MAX_SIZE , true); 
vector<int >prime; 
vector<int >SPF(MAX_SIZE); 
void manipulated_seive(int N) 
{ 
	 isprime[0] = isprime[1] = false ; 
	 for (int i=2; i<N ; i++) 
	 { 
		 if (isprime[i]) 
		 { 
			 prime.push_back(i); 
			 SPF[i] = i; 
		 } 
		 
		 for (int j=0;j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i];j++) 
		 { 
			 isprime[i*prime[j]]=false; 
			 SPF[i*prime[j]] = prime[j] ; 
		 } 
	 } 
}
int gcd(int a,int b){
	if(a==0){
		return b;
	}
	return gcd(b%a,a);
}
#undef int
int main() {
    #define int long long
    //fastio;
	int n,k,q;
	cin>>n>>k>>q;
	int arr[q];
	for(int i=0;i<q;i++){
		cin>>arr[i];
		arr[i]--;
	}
	vector<int> v(n,0);
	v[0]-=q;
	for(int i=0;i<q;i++){
		v[arr[i]]++;
		if(arr[i]<n-1){
			v[arr[i]+1]--;
		}
	}
	for(int i=0;i<n;i++){
		v[i]+=(i-1>=0)?v[i-1]:0;
		if(k+v[i]<=0){
			cout<<"No"<<endl;
		}
		else{
			cout<<"Yes"<<endl;
		}
	}
	
    return 0;
}


Measured memory_bytes: 17792
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  // const int64_t L = static_cast<int64_t>(T.length());
  vector<int64_t> A(N);
  vector<int64_t> B(N);
  vector<Pair> C(N);
  for (int64_t i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
    C[i].first = A[i] + B[i];
    C[i].second = i;
  }
  sort(C.begin(), C.end());
  reverse(C.begin(), C.end());
  int64_t result = 0;
  int64_t takahashi = 1;
  for (int64_t i = 0; i < N; ++i) {
    if (takahashi) {
      result += A[C[i].second];
    } else {
      result -= B[C[i].second];
    }
    takahashi = 1 - takahashi;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 6352
fun main(args:Array<String>):Unit{
    while(true){
        val (w, h) = readLine()!!.split(' ').map(String::toInt)
        if (w == 0 && h == 0) return
        val map = Array(h){
            readLine()!!.map { when(it){
                'W' -> Pole.White
                'B' -> Pole.Black
                else -> Pole.None
            } }.toTypedArray()
        }
        val teritory = Array(h){Array(w){Teritory()}}
        map.forEachIndexed{height, line -> line.forEachIndexed { width, pole ->
            search(teritory, map, height, width, pole)
        }}
        println("${teritory.map{line -> line.count{it.isBlackTeritory}}.sum() - map.map{it.count{it == Pole.Black}}.sum()} ${teritory.map{line -> line.count{it.isWhiteTeritory}}.sum() - map.map{it.count{it == Pole.White}}.sum()}")
    }
}
fun search(teritory:Array<Array<Teritory>>, map:Array<Array<Pole>>, h:Int, w:Int, pole:Pole):Unit{
    if (h !in teritory.indices || w !in teritory[0].indices || teritory[h][w].isAlreadyNeighbor(pole) || (map[h][w] != Pole.None && map[h][w] != pole)) return
    teritory[h][w].addExtendedNeighborhood(pole)
    search(teritory, map,h - 1, w, pole)
    search(teritory, map, h + 1, w, pole)
    search(teritory, map, h, w - 1, pole)
    search(teritory, map, h, w + 1, pole)
}
enum class Pole{
    Black, White, None
}
class Teritory{
    private var mIsWhiteNeighbor:Boolean = false
    private var mIsBlackNeighbor:Boolean = false
    fun addExtendedNeighborhood(pole:Pole):Unit{
        when(pole){
            Pole.Black -> mIsBlackNeighbor = true
            Pole.White -> mIsWhiteNeighbor = true
            else -> {}
        }
    }
    fun isAlreadyNeighbor(pole:Pole):Boolean {
        return when(pole){
            Pole.Black -> mIsBlackNeighbor
            Pole.White -> mIsWhiteNeighbor
            else -> true
        }
    }
    val isBlackTeritory:Boolean
        get() = mIsBlackNeighbor && !mIsWhiteNeighbor
    val isWhiteTeritory:Boolean
        get() = mIsWhiteNeighbor && !mIsBlackNeighbor
    val isBlackNeighbor:Boolean
        get() = mIsBlackNeighbor
    val isWhiteNeighbor:Boolean
        get() = mIsWhiteNeighbor
}


Measured memory_bytes: 38532
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

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

const int inf = 3e18;

int d1[305][305];
int d2[305][305];
int N, M, L;

signed main()
{
	scanf("%lld%lld%lld", &N, &M, &L);

	rep(i, N) rep(j, N) {
		d1[i][j] = inf;
		d2[i][j] = inf;
	}

	rep(i, N) d1[i][i] = d2[i][i] = 0;

	rep(_, M) {
		int a, b, c; scanf("%lld%lld%lld", &a, &b, &c);
		--a, --b;
		d1[a][b] = d1[b][a] = c;
	}

	rep(k, N) rep(i, N) rep(j, N) {
		d1[i][j] = min(d1[i][j], d1[i][k] + d1[k][j]);
	}

	rep(i, N) rep(j, N) {
		if (i != j and d1[i][j] <= L) {
			d2[i][j] = 1;
		}
	}

	rep(k, N) rep(i, N) rep(j, N) {
		d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
	}

	int q; cin >> q;

	rep(_, q) {
		int s, t; cin >> s >> t;
		--s, --t;
		printf("%lld\n", d2[s][t] == inf ? -1 : d2[s][t] - 1);
	}
}


Measured memory_bytes: 1920
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


A, B = MI()
for i in range(20000):
    if int(i * 0.08) == A and int(i * 0.1) == B:
        print(i)
        exit(0)
print(-1)

Measured memory_bytes: 38512
N, M = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i).sort

b_arr = []
M.times do
  b, c = gets.split(' ').map(&:to_i)
  b_arr << [b, c]
end
b_arr.sort! { |a1, a2| a2[1] <=> a1[1] }

i = 0
isBreak = false
b_arr.each do |e|
  b, c = e
  b.times do
    if a.size <= i
      isBreak = true
      break
    end

    if a[i] < c
      a[i] = c
    else
      isBreak = true
      break
    end
    i += 1
  end
  break if isBreak
end
puts a.reduce(&:+)



Measured memory_bytes: 18680
#include<iostream>
using namespace std;
int main()
{
    int x;
    for(int i=1;i<=10000;i++)
    {
        cin >> x;
        if(x!=0)
        {
            cout << "Case " << i << ": " << x << endl;
            
        }
        
    }
    return 0;
    
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define i64 long long
using namespace std;

int main() {
	// your code goes here
	long n , k;
	cin>>n>>k;
	i64 ans = 1;
	for(int i=0;i<n;i++){
		ans = min(ans*2, ans+k);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;





public class Main {

    static MyScanner in = new MyScanner();
    static   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    int N;
    static int max = 200001;
    static int [] dr = {1,-1,0,0};
    static int [] dc={0,0,-1,1};
    static boolean [][] grid;
    static int [] bishopr = {-1,1,-1,1};
    static int [] bishopc = {1,1,-1,-1};
    static long H,W,cnt;
    public static void main(String args[]) throws IOException {
            int N = in.nextInt();
            int cnt =0;
            for(int i=1;i<=N;i++){
                int k = in.nextInt();
                if(!isEven(k)&&!isEven(i)){
                    cnt++;
                }
            }
            out.println(cnt);

        out.flush();
        }
       static boolean isValid (int r, int c){
           if(r>=0&&r<H&&c>=0&&c<W){
               return true;
           }
           return false;
       }
        private static void dfs(int r, int c) {
            for(int i=0;i<4;i++){
                int nr = bishopr[i] +r;
                int nc = bishopc[i]+c;
                if(isValid(nr, nc)&&!grid[nr][nc]){
                    cnt++;
                    grid[nr][nc] = true;
                    dfs(nr, nc);
                }
            }
        }

        static boolean isEven(long a) {
            return (a&1)==0;
        }
       static  void swap (int a, int b){

        int temmp = b;
        b=a;
        a = temmp;
        }
    

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
   
        public MyScanner() {
           br = new BufferedReader(new InputStreamReader(System.in));
        }
   
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
   
        int nextInt() {
            return Integer.parseInt(next());
        }
   
        long nextLong() {
            return Long.parseLong(next());
        }
   
        double nextDouble() {
            return Double.parseDouble(next());
        }
   
        String nextLine(){
            String str = "";
        try {
           str = br.readLine();
        } catch (IOException e) {
           e.printStackTrace();
        }
        return str;
        }
  
     }
}

Measured memory_bytes: 32928
import java.io.*;

public class Main{
  public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine();
        String[] spl=s.split(" ");
        int a=Integer.parseInt(spl[0]);
        int b=Integer.parseInt(spl[1]);
 
        if(a==b) System.out.println("a == b");
        else if(a>b) System.out.println("a > b");
        else System.out.println("a < b");
    }
}

Measured memory_bytes: 24076
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll k; cin>>k;
	cout<<50<<'\n';
	ll cur=k/50;
	ll z=50-k%50;
	for(ll i=0;i<=50;i++)
	{
		if(i==z) continue;
		cout<<cur+i;
		if(i<49) cout<<' ';
		else if(i==49&&i+1!=z) cout<<' ';
	}
	cout<<'\n';
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

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

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

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

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

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

    var(i64, K);
    vector<i64> ans;
    vector<i64> buf[15];
    ans.reserve(1000010);

    rep(i, 1, 10) {
        buf[1].push_back(i);
        ans.push_back(i);
    }

    rep(len, 2, 12) {
        buf[len].reserve(buf[len - 1].size() * 3);
        for (const i64 &a : buf[len - 1]) {
            const int back = a % 10;
            for (int d = back - 1; d <= back + 1; ++d) {
                if (d < 0 || d > 9) continue;
                buf[len].push_back(a * 10 + d);
                ans.push_back(a * 10 + d);
                if (ans.size() > K) goto HOGE;
            }
        }
    }

HOGE:

    sort(all(ans));
    print(ans[K - 1]);

    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
typedef map<string,ll> mapstl;
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll cnt=0;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<3;i++){
		if(s[i]==t[i]){
			cnt++; 
		} 
	}
	cout<<cnt<<"\n";
	return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int k = sc.nextInt();
		String answer = "";

		for(int i=0; i<k; i++) {
			answer = answer + "ACL";
		}

		System.out.println(answer);
	}
}

Measured memory_bytes: 38624
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int mod = (int) 1e9 + 7;

inline int fp(long long a, int b) {
  int ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = (1ll * ans * a) % mod;
    }
    b >>= 1;
    a = (1ll * a * a) % mod;
  }
  return ans;
}

int mul(int a, int b) {
  return (1ll * a * b) % mod;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += mod;
}

inline void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}

string a;
int one, ans;

int main() {
  cin >> a;
  int n = a.size();
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == '1') {
      add(ans, mul(fp(3, n - 1 - i), fp(2, one)));
      one++;
    }
  }
  add(ans, fp(2, one));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111
	

	void solve(){
		
		
		ini(n);
		ini(n1);
		ini(x);
		int tmp  =0;
		FOR(i,n,n1+1){
			if(i%x == 0)tmp++;
		}
		out(tmp);

		


		
		


			
			
			


				
		


		
		
		
		

		


		
		
	}



	



















int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


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

using namespace std;
using ll = long long;
using vec  = vector<ll>;
using matrix = vector<vector<ll> >;

vector<ll> toY, toX;
ll n, Q, a, b, c, d, e, f, g;
ll r1, c1, r2, c2, v;

inline matrix operator*(const matrix &a, const matrix &b) {
    matrix ret = matrix{{0, 0},
                        {0, 0}};
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                ret[i][j] += a[i][k] * b[k][j];
            }
        }
    }
    return ret;
}

inline vec operator*(const matrix &a, const vec &b) {
    vec ret{0, 0};
    for (int i = 0; i < 2; i++) {
        for (int k = 0; k < 2; k++) {
            ret[i] += a[i][k] * b[k];
        }
    }
    if (ret[0] < 0) ret[0] += n + 1;
    if (ret[1] < 0) ret[1] += n + 1;
    return ret;
}


inline vec origin(vec q) {
    q[0] = toY[q[0]];
    q[1] = toX[q[1]];
    return q;
}


int main() {


    cin >> n >> Q >> a >> b >> c >> d >> e >> f >> g;
    map<vec, ll> change;
    matrix p{{1, 0},
             {0, 1}};
    toX.resize(n + 1);
    toY.resize(n + 1);
    for (ll i = 0; i <= n; ++i)
        toY[i] = toX[i] = i;

    while (Q--) {
        string s;
        cin >> s;
        if (s == "WR") {
            cin >> r1 >> c1 >> v;
            vec q{r1, c1};
            q = origin(p * q);
            change[q] = v;
        } else if (s == "CP") {
            cin >> r1 >> c1 >> r2 >> c2;
            vec q{r1, c1};
            vec r{r2, c2};
            q = origin(p * q);
            r = origin(p * r);
            if (change.find(q) == change.end())
                change[r] = (q[0] * a + q[1] * b) % c;
            else
                change[r] = change[q];
        } else if (s == "SR") {
            cin >> r1 >> r2;
            vec q{r1, 0};
            vec r{r2, 0};
            q = p * q;
            r = p * r;
            swap(toY[q[0]], toY[r[0]]);
            swap(toX[q[1]], toX[r[1]]);
        } else if (s == "SC") {
            cin >> c1 >> c2;
            vec q{0, c1};
            vec r{0, c2};
            q = p * q;
            r = p * r;
            swap(toY[q[0]], toY[r[0]]);
            swap(toX[q[1]], toX[r[1]]);
        } else if (s == "RL") {
            matrix q{{0,  1},
                     {-1, 0}};
            p = p * q;
        } else if (s == "RR") {
            matrix q{{0, -1},
                     {1, 0}};
            p = p * q;
        } else if (s == "RH") {
            matrix q{{-1, 0},
                     {0,  1}};
            p = p * q;
        } else if (s == "RV") {
            matrix q{{1, 0},
                     {0, -1}};
            p = p * q;

        }
    }

    ll h = 314159265;
    for (ll y = d; y <= e; ++y) {
        for (ll x = f; x <= g; ++x) {
            vec q{y, x};
            q = origin(p * q);
            if (change.find(q) == change.end())
                h = (31 * h + ((q[0] * a + q[1] * b) % c)) % 1000000007;
            else
                h = (31 * h + change[q]) % 1000000007;
        }
    }
    cout << h << endl;

    return 0;


}


Measured memory_bytes: 4788
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e9)
using namespace std;
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    ll l = -1, r = 1e12+5;
    while(r - l > 1){
        ll mid = (r+l)/2;
        if(N >= mid){
            if(M >= mid * 2){
                l = mid;
            }else{
                r = mid;
            }
        }else{
            if(M - (mid - N)*2 >= 2 * mid){
                l = mid;
            }else{
                r = mid;
            }
        }
    }
    print(l);
}


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

vector<int> dp(100000, INT_MAX);
int minCost(vector<int> &stones,int k, int dest){
  dp[0] = 0;
  for(int i=1;i<=k;i++){
    dp[i] = abs(stones[i] - stones[0]);
  }
  for(int i=k+1;i<=dest;i++){
    for(int j=1;j<=k;j++){
      dp[i] = min(dp[i], abs(stones[i] - stones[i-j]) + dp[i-j]);
    }
  }
  return dp[dest];
}



int main(){
  int n,k;
  cin>>n>>k;
  vector<int> vec;
  for(int i=0;i<n;i++){
    int temp;
    cin>>temp;
    vec.push_back(temp);
  }
  cout<<minCost(vec, k,vec.size()-1)<<endl;
  
}

Measured memory_bytes: 4196
from string import ascii_lowercase
S=input()
ans = float('inf')
def sim(S, s):
    c = 0
    while len(set(S)) != 1:
        tmp = ''
        for i in range(len(S) - 1):
            if S[i] == s or S[i+1] == s:
                tmp += s
            else:
                tmp += S[i]
        c += 1
        S = tmp
    return c

for s in ascii_lowercase:
    ans = min(ans, sim(S, s))
print(ans)

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int h, w;
char field[51][51];
int black, white;
int sum;

void dfs(int y, int x) {
    field[y][x] = '#';
    sum++;
    int dy[] = {1, 0, -1, 0};
    int dx[] = {0, 1, 0, -1};
    for (int i = 0; i < 4; i++) {
        int ny = y + dy[i];
        int nx = x + dx[i];
        if (ny < 0 or ny == h or nx < 0 or nx == w) continue;
        if (field[ny][nx] == '#') continue;
        if (field[ny][nx] == 'B') {
            black++;
            continue;
        }
        if (field[ny][nx] == 'W') {
            white++;
            continue;
        }
        if (field[ny][nx] == '.') {
            dfs(ny, nx);
        }
    }
}

int main() {
    vector<pair<int, int>> res;
    while (true) {
        cin >> w >> h;
        if (h == 0) break;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> field[i][j];
            }
        }
        int b_cnt = 0;
        int w_cnt = 0;
        for (int i = 0; i < h; i++) {
           for (int j = 0; j < w; j++) {
               if (field[i][j] != '.') continue;
               black = white = sum = 0;
               dfs(i, j);
               if (black > 0 and white == 0) {
                   b_cnt += sum;
               }
               else if (white > 0 and black == 0) {
                   w_cnt += sum;
               }
            }
        }
        res.emplace_back(b_cnt, w_cnt);
    }
    for (int i = 0; i < (int)res.size(); i++) {
        cout << res[i].fi << " " << res[i].se << endl;
    }
    return 0;
}



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

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
    int N, W; cin >> N >> W;
    vector<int> ws(N);
    vector<int64_t> vs(N);
    REP(i, N) cin >> ws[i] >> vs[i];

    // dp[i][w]: i番目までの品物を使える。重さの総和はw以下にする。このときの価値の総和の最大値
    vector dp(N, vector(W+1, int64_t()));
    REP(w, W+1) dp[0][w] = (w - ws[0] >= 0) ? vs[0] : 0;
    FOR(i, 1, N) REP(w, W+1) {
        dp[i][w] = dp[i-1][w];
        if (w - ws[i] >= 0) {
            dp[i][w] = max(dp[i][w], dp[i-1][w - ws[i]] + vs[i]);
        }
    }

    cout << dp[N-1][W] << '\n';
}


Measured memory_bytes: 82360
import re
A,B=map(int,input().split())
S=input()
a,b,flg=S[0:A],S[-B:],True
if S[A]!="-" or re.match(".*[^0-9].*",a) or re.match(".*[^0-9].*",b):flg=False
print("Yes" if flg else "No")  

Measured memory_bytes: 3188
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{
		string[] args;
		args = Console.ReadLine().Split(' ');
		int N = Int32.Parse(args[0]);
		int[] ABC = new int[3];
		ABC[0] = Int32.Parse(args[1]);
		ABC[1] = Int32.Parse(args[2]);
		ABC[2] = Int32.Parse(args[3]);
		
		int[] l = new int[N];
		for(int i = 0; i < N; i++)
			l[i] = Int32.Parse(Console.ReadLine());
		
		int ans = Int32.MaxValue;
		for(int mask = 0; mask < Math.Pow(4,N); mask++)
		{
			int[] numUse = new int[3];  // 0:A, 1:B, 2:C
			int[] length = new int[3];
			int tmpMask = mask;
			for(int i = 0; i < N; i++)
			{
				int toUse = tmpMask % 4;
				tmpMask /= 4;
				if(toUse == 3)
					continue;
				
				numUse[toUse]++;
				length[toUse] += l[i];
			}
			
			if(numUse[0] * numUse[1] * numUse[2] == 0)
				continue;
			
			int sum = 0;
			for(int i = 0; i < 3; i++)
			{
				sum += ((numUse[i] - 1) * 10);  //combine
				sum += Math.Abs(length[i] - ABC[i]);  //extend or shrink
			}
			
			ans = Math.Min(ans,sum);
		}
		
		Console.WriteLine(ans);
	}	
}





Measured memory_bytes: 17232
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

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

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n,m = myinput()
mod = 10**9 + 7

if m==1:
    print(1)
    exit()

# 素因数分解
def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

table = prime_decomposition(m)
# print(table)

# """nを素因数分解"""
# """2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
# print(factorization(m))
## [[2, 3], [3, 1]] 
##  24 = 2^3 * 3^1

# Combinations
def comb_mod_faster(n,k,mod):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    k = min(n-k,k)
    ans = 1
    inv = [1]*(k+1)
    if k>=1:
        ans *= (n-k+1)%mod
    for i in range(2,k+1):
        inv[i] = mod - inv[mod%i]*(mod//i)%mod
        ans = ans*(n-k+i)*inv[i]%mod
    return ans

# Repeated Combinations
def repeated_combinations(n,k,mod):
    return comb_mod_faster(n+k-1,k,mod)

f = factorization(m)

ans = 1
for i in range(len(f)):
    k = f[i][1]
    ans *= repeated_combinations(n,k,mod)
print(ans%mod)

Measured memory_bytes: 38768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 

using namespace std;
using namespace __gnu_pbds; 
#define     mod            (int)1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif


 
int main()
 
{  
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif

    IOS;

    int n;
    cin>>n;
    std::vector<int> v(n+1);
    int ans =0;
    for(int i=1; i<=n; i++)
    {
      cin>>v[i];
       if(i&1 && v[i]&1)ans++;
    }

    cout<<ans<<endl;
   
}

Measured memory_bytes: 3640
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    a, b, c, d = map(int, input().split())
    x = (a+d-1)//d
    y = (c+b-1)//b
    if x >= y:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    main()


Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n; cin>>n;
    vector <double> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    int ans1 = a[a.size()-1];
    int ans2 = a[0];
    double standard = a[a.size() -1]/2;
    //cout<<standard<<endl;
    double sa = 1e9;
    for(int i=0;i<n-1;i++){
        if(sa> abs(standard - a[i])){
            sa = abs(standard - a[i] );
            ans2 = a[i];
            //cout<<sa<<endl;
        }
    }
    cout<<ans1<<' '<< ans2 <<endl;
}


Measured memory_bytes: 1024
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int read(){
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return x*f;
}

int main(){
	int N=read(),A=read(),B=read();
	printf("%d",min(A*N,B));
}


Measured memory_bytes: 128
# coding: utf-8
from collections import defaultdict

N,M=map(int,input().split())
A=list(map(int,input().split()))

B=[0]

s=0
for a in A:
    s+=a
    B.append(s)
F=defaultdict(int)
for b in B:
    F[b%M]+=1
ans=0
for n in F.values():
    ans+=n*(n-1)//2
print(ans)

Measured memory_bytes: 16808
import copy
from itertools import product


h, w, k = map(int, input().split())
c = [list(input()) for i in range(h)]
ans = 0
for x in product((0, 1), repeat=h):
    for y in product((0, 1), repeat=w):
        b = copy.deepcopy(c)
        for i in range(h):
            if x[i] == 1:
                for tate in range(w):
                    # print(tate)
                    b[i][tate] = "S"

        for j in range(w):
            if y[j] == 1:
                for yoko in range(h):
                   # print(yoko, j)
                    b[yoko][j] = "S"
        count = 0
        for i in range(h):
            count += b[i].count("#")

        if count == k:
            ans += 1
print(ans)


Measured memory_bytes: 9344
import bisect
s = list(input())
t = input()
size = len(s)


dic = {}
for c in t:
	if c in dic:
		continue
	dic[c] = [i for i,val in enumerate(s) if val==c]
	if len(dic[c]) == 0:
		print(-1)
		exit()

pos =-1 
loop = 0
for c in t:
	l = dic[c]
	#print(c,l)
	if pos < l[-1]:
		index = bisect.bisect_right(l,pos)
		pos = l[index]
	else:
		pos = l[0]
		loop += 1
	#print("pos",pos,loop)

print(loop*size + pos+1)



Measured memory_bytes: 8012
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
static const ll mod = 1000000007;
/* ちゃんと考えて実装して問題なくACできた時嬉しいよ！！ */

int main(void){
    int n,m,k;
    cin >> n >> m >> k;
    // 反転するらしいよ(読み違え減らそ)

    int flag = 0;
    for(int i=0; i<=m; i++){
        for(int j=0; j<=n; j++){
            if(n*m - i*j - (m-i)*(n-j) == k){
                flag = 1;
            }
        }
    }

    if(flag==0) cout << "No";
    else cout << "Yes";
    return 0;
}

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

using namespace std;

double len(pair<double, double> p){
    return sqrt(p.first * p.first + p.second * p.second);
}
const double EPS=1e-6;

double dist(pair<double, double> l, pair<double, double> r){
    return sqrt((l.first - r.first) * (l.first - r.first) + (l.second - r.second) * (l.second - r.second));
}

int main(){
    int n;
    
    while(cin >> n && n > 0){
        vector<pair<double, double> > v;
        for(int i = 0; i < n; i++){
            double x, y;
            cin >> x >> y;
            v.push_back(make_pair(x, y));
        }
        int ans = 1;
        for(int i = 0; i < v.size(); i++){
            for(int j = i+1; j < v.size(); j++){
                if(dist(v[i], v[j]) <= 2){
                    pair<double, double> mid((v[i].first + v[j].first) / 2, (v[i].second + v[j].second) / 2);
                    pair<double, double> vec(mid.first - v[i].first, mid.second - v[i].second);
                    pair<double, double> center1, center2;
                    double ratio = sqrt(1 - len(vec)*len(vec)) / len(vec);
                    center1 = make_pair(mid.first - vec.second * ratio, mid.second + vec.first * ratio);
                    center2 = make_pair(mid.first + vec.second * ratio, mid.second - vec.first * ratio);
                    /*cout << mid.first << " " << mid.second << endl;
                    cout << vec.first << " " << vec.second << endl;
                    cout << dist(v[i], v[j]) << endl;
                    cout << ratio << endl;
                    cout << center1.first << " " << center1.second << endl; 
                    cout << center2.first << " " << center2.second << endl; */
                    int s = 0;
                    for(int k = 0; k < n; k++){
                        if(dist(center1, v[k]) < 1+EPS){
                            s++;
                        }
                    }  
                    if(s > ans){
                        ans = s;
                    }
                    s = 0;
                    for(int k = 0; k < v.size(); k++){
                        if(dist(center2, v[k]) < 1.0+EPS){
                            s++;
                        }
                    }  
                    if(s > ans){
                        ans = s;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i,h) cin >> s[i];

  vector<vector<int>> dp(h,vector<int>(w,100000));

  dp[0][0] = s[0][0] == '#' ? 1 : 0;
  rep(i,h)rep(j,w){
    if(i==0&&j==0) continue;
    int ci = 100000, cj = 100000;
    if(i!=0){
      ci = dp[i-1][j];
      if(s[i-1][j]=='.'&&s[i][j]=='#') ++ci;
    }
    if(j!=0){
      cj = dp[i][j-1];
      if(s[i][j-1]=='.'&&s[i][j]=='#') ++cj;
    }
    dp[i][j] = min(ci,cj);
  }
  cout << dp[h-1][w-1] << endl;
}


Measured memory_bytes: 888
#include "bits/stdc++.h"
#define int long long
#define loop(i, a, b) for(int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int MOD = 1e9 + 7, INF = 1e9;
using vi = vector <int>;
using vvi = vector <vi>;
//g++ -std==c++14
#define MAX_V (110)

signed main(){
	int H, W;
	cin >> H >> W;

	int ans = 1e18;
	rep(i, 2){
		int ri = (i ? H : W);
		int sa = (i ? W : H);
		rep(h, ri){
			int S_A = h * sa;
			int S_B = (ri - h) / 2 * sa;
			int S_C = ((ri - h) - (ri - h) / 2) * sa;

			int macs = max({S_A, S_B, S_C});
			int mini = min({S_A, S_B, S_C}); 
			
			ans = min(macs - mini, ans);
			
			S_B = (ri - h) * (sa / 2);
			S_C = (ri - h) * (sa - (sa / 2));

			macs = max({S_A, S_B, S_C});
			mini = min({S_A, S_B, S_C}); 
			
			ans = min(macs - mini, ans);
		}
	}
	cout << ans << 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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll a, b;
    cin >> a >> b;
    cout << a * b - (a + b) + 1 << endl;
    return 0; 
}

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

next_target = 1

idx = []

for i, a in enumerate(A):
    if a == next_target:
        idx.append(i)
        next_target += 1

if not idx:
    print(-1)
else:
    prev = -1
    sum_ = 0

    if idx[-1] != N - 1:
        sum_ += N - (idx[-1] + 1)

    for x in idx:
        sum_ += x - prev - 1
        prev = x

    print(sum_)


Measured memory_bytes: 26012
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {

//    	File file = new File("src/in.txt");

        //コード
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);

    	int X = sc.nextInt();
    	int Y = sc.nextInt();

    	if((Y-2*X)>=0&&(Y-2*X)%2==0&&(4*X-Y)>=0&&(4*X-Y)%2==0) {
    		System.out.println("Yes");
    	} else {
    		System.out.println("No");
    	}

    }
}

Measured memory_bytes: 27080
s = input()
if s == 'SUN':
    print(7)
if s == 'MON':
    print(6)
if s == 'TUE':
    print(5)
if s == 'WED':
    print(4)
if s == 'THU':
    print(3)
if s == 'FRI':
    print(2)
if s == 'SAT':
    print(1)


Measured memory_bytes: 2940
using System;

namespace ABC108A
{
    class Program
    {
        static void Main(string[] args)
        {
            var K = int.Parse(Console.ReadLine());
            if (K % 2 == 0)
            {
                Console.WriteLine(Math.Pow(K / 2, 2));
            }
            else
            {
                Console.WriteLine(K / 2 * (K + 1) / 2);
            }
        }
    }
}


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

const int maxn = 300 + 7;
char s[maxn][maxn];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", s[i]);
	}
	long long ans = 0;
	for (int T = 0; T < n; T++) {
		bool ok = true;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) 
				if (s[i][j] != s[(j + T) % n][(i - T + n) % n]) {
					ok = false;
					break;
				}
			if (!ok) break;
		}
		if (ok) {
			ans += n;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
s=input()
rl=[]
ll=[]
c=0
for i in range(len(s)-1):
  c+=1
  if s[i]!=s[i+1]:
    if s[i]=='<':
      rl.append(c)
    else:
      ll.append(c)
    c=0
if s[len(s)-1]=='<':
  rl.append(c+1)
else:
  ll.append(c+1)

rn=len(rl)
ln=len(ll)
ans=0
if s[0]=='<':
  for i in range(ln):
    M=max(rl[i], ll[i])
    m=min(rl[i], ll[i])
    ans+=M*(M+1)//2+m*(m-1)//2
  if rn>ln:
    ans+=rl[-1]*(rl[-1]+1)//2
else:
  rl=[0]+rl
  ans+=ll[0]*(ll[0]+1)//2
  for i in range(1, ln):
    M=max(rl[i], ll[i])
    m=min(rl[i], ll[i])
    ans+=M*(M+1)//2+m*(m-1)//2
  if rn==ln:
    ans+=rl[-1]*(rl[-1]+1)//2
print(ans)

Measured memory_bytes: 7196
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
char s[300];
int x[300]={0};
int main()
{
	cin>>s;
	for(int i=0;s[i];i++)
	{
		x[s[i]]++;
	}
	for(int i=0;i<300;i++)
		if(x[i]%2)
		{
			puts("No");
			return 0;
		}
	puts("Yes");
	return 0;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)
using namespace std;

double dp[1<<16][17];

int main() {
  int m, n;
  cin >> m >> n;
  vector<vector<double>> cats(m, vector<double>(n));
  REP(i,m)REP(j,n) {
    cin>>cats[i][j];
  }
  dp[0][n] = 1.0;
  REP(i,1<<m)FOR(j,0,n+1) {
    REP(k,m) {
      if ((i>>k)&1) continue;
      double live = 1.0;
      double sum = 0.0;
      FOR(l,j,n+1) {
        double oldlive = live;
        live *= cats[k][l];
        sum += dp[i][l] * (oldlive - live);
      }
      dp[i|(1<<k)][j] = max(dp[i|(1<<k)][j], sum);
    }
  }
  double res = 0.0;
  REP(i,1<<m) {
    res = max(res, dp[i][0]);
  }
  cout << fixed << setprecision(14) << res << endl;
  return 0;
}

Measured memory_bytes: 11972
// https://abc098.contest.atcoder.jp/tasks/abc098_a

function parse(input) {
  return input
    .trim()
    .split(" ")
    .map(number => parseInt(number, 10))
}

function f(a, b) {
  const wa = a + b
  const sa = a - b
  const seki = a * b

  var max = wa
  max = sa > max ? sa : max
  max = seki > max ? seki : max

  return max
}

module.exports = {
  parse,
  f,
}

function Main(input) {
  const arr = parse(input)
  const a = arr[0]
  const b = arr[1]

  console.log("%s", f(a, b))
}

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


Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int n;

int main()
{
    while (cin >> n)
    {
        int ans = 0;
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                for (int k = 0; k < 10; k++)
                {
                    for (int l = 0; l < 10; l++)
                    {
                        if (i + j + k + l == n)
                            ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}


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

typedef long long ll;

int main(int argc, char *argv[]) {
  ll N, D;
  cin >> N >> D;

  ll ans = 1;
  ll pos = D*2 + 1;
  while (pos < N) {
    ans++;
    pos += D*2 + 1;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ctime>
#include <unordered_map>
#include <stdlib.h>
using namespace std;
#define ll  long long int
#define mod 1000000007
#define modd 998244353
#define com(a,n) ll a[n];for(ll i=0;i<n;i++) cin>>a[i];
#define pri(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<endl;
/*__builtin_clz();
__builtin_ctz();
__builtin_popcount();*/
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    // SUN, MON, TUE, WED, THU, FRI, or SAT
    if(s=="SUN")
    cout<<"7"<<"\n";
    else if(s=="MON")
    cout<<"6"<<"\n";
    else if(s=="TUE")
    cout<<"5"<<"\n";
    else if(s=="WED")
    cout<<"4"<<"\n";
    else if(s=="THU")
    cout<<"3"<<"\n";
    else if(s=="FRI")
    cout<<"2"<<"\n";
    else if(s=="SAT")
    cout<<"1"<<"\n";
    
cerr << "\nTime elapsed: " << 1000 * clock()/CLOCKS_PER_SEC << "ms\n";
}

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

#define debug(x) cerr << #x << ": " << x << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> res(n + 1);
  for (int i = 0; i < n - 1; i++) {
    int x;
    cin >> x;
    ++res[x];
  }
  for (int i = 1; i <= n; i++)
    cout << res[i] << '\n';
  cout << '\n';
  return 0;
}

Measured memory_bytes: 3968