akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <queue>
#include <stack>
#include <deque>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

void yes(){
	cout<<"YES";
	exit(0);
}

void no(){
	cout<<"NO";
	exit(0);
}

const int sz = 5e5 + 7; 
// int arr;
long long int arr[sz];
int dp[sz];
// int d1[size];
// int dn[size];
pair<int, long long int> dl[sz], dr[sz];
// int special_nodes[size];
// bool visited[size];
// vector<int> graph[size];

// void bfs(int u, int *arr) {
// 	queue<int> q;
// 	memset(visited, 0, sizeof(visited));
// 	q.push(u);
// 	visited[u] = true;
// 	while(!q.empty()) {
// 		int t = q.front();
// 		q.pop();
// 		for(int x: graph[t]){
// 			if(!visited[x]) {
// 				visited[x] = true;
// 				arr[x] = arr[t] + 1;
// 				q.push(x);
// 			}
// 		}
// 	}
// }
int k;

long long int solve(int i, int n) {
	if(i > n) return INT_MAX;
	if(i== n) return 0;
	if(dp[i] != -1) return dp[i];
	long long int ans = INT_MAX;
	for(int x=1;x<=k;x++){
		if(x+i <=n ) ans = min(ans, solve(x+i, n) + abs(arr[i+x] - arr[i]));
	}
	dp[i] = ans;
	return ans;
}

int main() {
	int n;
	cin>>n>>k;
	for(int x=1;x<=n;x++){
		cin>>arr[x];
	}
	for(int x=0;x<sz;x++) dp[x] = -1;
	// dp[]	
	cout<<solve(1, n);
}


Measured memory_bytes: 14120
import java.io.*;

class Main{
	public static void main(String args[]){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int num[] = new int[10];
		for(int i=0;i<10;i++){
			try{
				num[i] = Integer.parseInt(reader.readLine());
			}
			catch(IOException e){
				
			}
		}
		for(int i=0;i<10;i++){
			for(int k=0;k<10-1;k++){
				if(num[k]<num[k+1]){
					int tmp = num[k];
					num[k] = num[k+1];
					num[k+1] = tmp;
				}
			}
		}
		
		for(int i=0;i<3;i++){
			System.out.println(num[i]);
		}
	}
}

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

int gcd(int a,int b){
  if(a%b > 0) return gcd(b,a%b);
  else return b;
}

int main(){ 
  int N;
  cin >>N;
  int ans;
  cin >>ans;
  for(int i=1;i<N;i++){
    int x;
    cin >>x;
    ans = min(ans,gcd(ans,x));
  }
  cout << ans << endl;
}

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

int main() {
	int n, x;
	cin >> n >> x;
	vector<int> m(n);
	for (int i = 0; i < n; ++i) {
		cin >> m[i];
		x -= m[i];
	}
	sort(m.begin(), m.end());
	int count = n;
	while (x - m[0] >= 0) {
		x -= m[0];
		count++;
	}
	cout << count;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N;
}
//=============================
void func(){}
//=============================
bool judge(int n){
    int tmp=0;
    for(;n;++tmp){
        n /= 10;
    }
    return tmp%2;
}
void solve()
{
    // せいのせいすう
    int ans = 0;
    rep(i,N+1){
        if(i==0)continue;
        if (judge(i)){
            ans++;
        }
    }
    cout<<ans<<endl;
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
int main(){
	int N; SCD(N);
	vector<ll> A,B;
	REP(i,N){
		ll a,b;
		SCLLD2(a,b);
		A.PB(a);
		B.PB(b);
	}

	vector<PLL> U;
	REP(i,N){
		U.PB(MP(A[i] + B[i] , i));
	}

	ll ans = 0;
	sort(ALL(U));
	reverse(ALL(U));

	REP(i,N){
		ll value = U[i].first;
		ll num = U[i].second;

		if (i%2 == 0) ans += A[num];
		else ans -= B[num];
	}

	PRINTLLD(ans);
}

Measured memory_bytes: 5100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  a--; b--; c--; d--;
  string s; cin >> s;
  if(s[a]=='#' || s[b]=='#' || s[c]=='#' || s[d]=='#') {
    cout << "No" << "\n";
    return 0;
  }
  bool ok = true;
  for(int i=a; i<c; i++) {
    if(s[i]=='#' && s[i+1]=='#') ok = false;
  }
  for(int i=b; i<d; i++) {
    if(s[i]=='#' && s[i+1]=='#') ok = false;
  }
  if(d < c) {
    bool ok2 = false;
    for(int i=b; i<=d; i++) {
      if(i>0 && s[i-1]=='.' && s[i]=='.' && i<n-1 && s[i+1]=='.') ok2 = true;
    }
    ok &= ok2;
  }
  cout << (ok ? "Yes" : "No") << "\n";
  return 0;
}


Measured memory_bytes: 3704
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
bool isprime(int n) { //素数判定
    if(n==1)return false;
    if(n==2)return true;
    for(int i = 2;i<=sqrt(n);i++) {
        if(n%i==0) return false;
    }
    return true;
}
/* ----------------------end----------------------- */
#pragma endregion
int countdiv(int n) {
    int count=0;
    rep1(i, n) if(n%i==0)count++;
    return count;
}
signed main() {
    int n;cin >> n;
    int cnt=0;
    rep1(i, n) if(i&1&&countdiv(i)==8) cnt++;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<62;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,m;

int main(){
	cin>>n>>m;
	vvl dp,DP;
	dp=DP=vvl(n+1,vl(n+1));
	dp[1][0]=1;
	for(int i=0;i<m;i++){
		for(int j=1;j<=n;j++){
			DP[j][0]=0;
			for(int k=1;k<=j;k++) (DP[j][0]+=dp[k][j-k]*k)%=mod;
		}
		for(int j=1;j<=n;j++) for(int k=1;k<=n;k++){
			DP[j][k]=(dp[j][k]*k+dp[j][k-1]*(n-j-k+1))%mod;
		}
		dp=DP;
	}
	cout<<dp[n][0]<<endl;
}

Measured memory_bytes: 1664
import itertools

N, M = map(int, input().split())
E = [[] for _ in range(N)]

for _ in range(M):
	ta, tb = map(int, input().split())
	E[ta-1].append(tb-1)
	E[tb-1].append(ta-1)

ans = 0

for p in itertools.permutations(range(1,N)):
	p = [0] + list(p)
	cond = 1
	for i in range(N-1):
		if p[i+1] not in E[p[i]]:
			cond = 0
	if cond:
		ans += 1


print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    int ans = 0;
    //500 , 1000, 5000, 10000
    int t = n /10000;
    ans += t * 10000;
    n -= t * 10000;
    t = n /5000;
    ans += t * 5000;
    n -= t * 5000;
    t = n /1000;
    ans += t * 1000;
    n -= t * 1000;
    t = n /500;
    ans += t * 500;
    n -= t * 500;
    cout << ans << endl;
    
}





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

const ll mod = 1e9 + 7;
const ll nmax = 2005;
ll facts[nmax];

void calc_fact() {
  facts[0] = 1;
  for (ll i = 1; i < nmax; i++) {
    facts[i] = facts[i - 1] * i % mod;
  }
}

ll powmod(ll a, ll b) {
  ll ans = 1;
  while (b) {
    if (b % 2) {
      ans *= a;
      ans %= mod;
    }
    a *= a;
    a %= mod;
    b /= 2;
  }
  return ans;
}

ll comb(ll a, ll b) {
  return facts[a] * powmod(facts[b], mod - 2) % mod
                  * powmod(facts[a - b], mod - 2) % mod;
}

int main() {
  ll n, k;
  cin >> n >> k;

  calc_fact();

  for (ll i = 1; i <= k; i++) {
    if (n - k + 1 >= i) {
      cout << comb(n - k + 1, i) * comb(k - 1, i - 1) % mod << endl;
    } else {
      cout << 0 << endl;
    }
  }
 
  return 0;
}


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

typedef long long ll;
static const int INF = 1e9+7;

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

    ll ans;

    if(H*W % 2 == 0) ans = H*W/2;
    else ans = H*W/2+1;

    if(H == 1 || W == 1){
        ans = 1;
    }

    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

struct State {
    int x_;
    int y_;
    int t_;

    State(int x, int y, int t) {
        x_ = x;
        y_ = y;
        t_ = t;
    }
};

int main (int argc, char *argv[]) {
    int n, t;
    int dx[6] = {1, 1, 0, -1, -1, 0};
    int dy[6] = {0, 1, 1, 0, -1, -1};
    while (cin>>t>>n, t||n) {
        int sx, sy;
        bool ob[200][200] = {false};
        bool visited[200][200] = {false};
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            int x, y;
            cin>>x>>y;
            ob[x+100][y+100] = true;
        }
        cin>>sx>>sy;
        queue<State> que;
        que.push(State(sx, sy, 0));
        visited[sx+100][sy+100] = true;
        while (!que.empty()) {
            State s = que.front();
            que.pop();
            for (int i = 0; i < 6; ++i) {
                int nx = s.x_ + dx[i];
                int ny = s.y_ + dy[i];
                if (!visited[nx+100][ny+100] && !ob[nx+100][ny+100] && s.t_ < t) {
                    que.push(State(nx, ny, s.t_ + 1));
                    // printf("(%d, %d)\n", nx, ny);
                    visited[nx+100][ny+100] = true;
                    ans++;
                }
            }
        }
        cout<<ans + 1<<endl;
    }
    return 0;
}


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

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    int tmp;
    while (y) {
        tmp = y;
        y = x % y;
        x = tmp;
    }

    return x;
}

int n, k;
vector<int> a;

int main() {
    cin >> n >> k;
    a.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    sort(a.begin(), a.end(), greater<int>());

    if (k > a[0]) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    int g = a[0];
    for (int i = 1; i < n; ++i) {
        g = gcd(g, a[i]);
    }

    if (k % g == 0 && k <= a[0]) {
        cout << "POSSIBLE" << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i < n;i++) {
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int sum_alice = 0;
  int sum_bob = 0;
  for(int i = 0;i < n;i++) {
    if(i % 2 == 0) {
      sum_alice += a.at(i);
    }else {
      sum_bob += a.at(i);
    }
  }
  cout << sum_alice - sum_bob << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

int main()

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

    string s;

    cin >> s;

    for (int i = 1; i < 4; i++) {

        if (s[i] == s[i-1]) {

            cout << "Bad";
            return 0;
        }
    }

    cout << "Good";

    return 0;
}


Measured memory_bytes: 256
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val (N, P) = rd.readIntArray()
    val A = rd.readIntArray()
    val AMAX = 100
    val dp = Array(N+2){LongArray(AMAX*(N+2)){0} }

    dp[0][0] = 1L
    for (i in 0 until N) {
        for (j in 0 until AMAX*N+1) {
            dp[i+1][j+A[i]] += dp[i][j]
            dp[i+1][j] += dp[i][j]
        }
    }

    var ans = 0L
    for (j in P until AMAX*N+1 step 2) {
        ans += dp[N][j]
    }
    println(ans)
}


//val rd = debug.Reader("agc", "017", "a", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!!
    } catch (e: Exception) { throw e }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 40560
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
using namespace std;
typedef long long ll;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
void division(ll n,ll &M,VI &a){
    M*=2;
    while(a[0]%2==0){
    rep(i,n){
        if(a[i]%2!=0)return;
        a[i]/=2;
    }
    M/=2;
    }
}
int main(){
    ll n,m;cin>>n>>m;
    VI a(n);rep(i,n)cin>>a[i];
    ll l=a[0];
    rep(i,n)l=lcm(l,a[i]);
    division(n,m,a);
    rep(i,n)if(a[i]%2==0){cout<<0<<endl;return 0;}
    ll mini=a[0];
    rep(i,n)mini=lcm(mini,a[i]);
    if(m<mini){cout<<0<<endl;return 0;}
    cout<<(m/mini+1)/2<<endl;
    
}


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

  int a[6] = {0};
void dice(char g) {
if (g == 'S')
{
  int tem;
  tem = a[1];
  a[1] = a[0];
  a[0] = a[4];
  a[4] = a[5];
  a[5] = tem;
}
if (g == 'E')
{
  int tem;
  tem = a[2];
  a[2] = a[0];
  a[0] = a[3];
  a[3] = a[5];
  a[5] = tem;
}
if (g == 'N')
{
  int tem;
  tem = a[4];
  a[4] = a[0];
  a[0] = a[1];
  a[1] = a[5];
  a[5] = tem;
}
if (g == 'W')
{
  int tem;
  tem = a[3];
  a[3] = a[0];
  a[0] = a[2];
  a[2] = a[5];
  a[5] = tem;
}
}

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

  for (int i = 0; i < 6; i++) {
    cin >> a[i];
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int u, f;
    cin >> u >> f;
    for (int i = 0; i < n; i++) {
      if (u == a[5]) {
        dice('N');
        dice('N');
      }
      if (u == a[1]) {
        dice('N');
      }
      if (u == a[2]) {
        dice('W');
      }
      if (u == a[3]) {
        dice('E');
      }
      if (u == a[5]) {
        dice('S');
      }
      while (f != a[1]) {
        dice('N');
        dice('W');
        dice('S');
      }
    }
  cout << a[2] << endl;
  }
}



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

int main() {
    string S;
    bool flg = true;
    cin >> S;
    for(int i = 0; i < S.length(); i++) {
        if(i % 2) {
            if(S[i] == 'R') {
                flg = false;
            }
        } else {
            if(S[i] == 'L') {
                flg = false;
            }
        }
        if(flg == false) break;
    }
    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main(){
	
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	
	multiset<int> st;
	rep(i,n){
		if(!st.empty()){
			auto itr = st.lower_bound(a[i]);
			if(itr != st.begin()) st.erase(--itr);
		}
		st.insert(a[i]);
	}
	
	cout << st.size() << endl;
	return 0;
}


Measured memory_bytes: 5376
#include <stdio.h>
#include <math.h>
#define EPS 0.0000000002
#define MAX 1010001000

typedef struct point{
    double x, y;
}point;

typedef struct line{
    point st, en;
}line;

double norm(point a);
double norm2(point a);
double distans(point a, point b);
point sum_vector(point a, point b);
point diff_vector(point a, point b);
point minus_vector(point a);
double dot(point a, point b);
double prod(point a, point b);

point reflection(line a, point p);
point projection(line a, point p);
int ccw(line a, point p);

point reflection(line a, point p)
{
    //直線aについて点pと線対称な点を返す
    return sum_vector(projection(a, p), diff_vector(projection(a, p), p));
}

point projection(line a, point p)
{
    //直線ab上に点pから垂線を下ろしたときの点h//
    point h;
    double k = dot(diff_vector(a.st, p), diff_vector(a.st, a.en))
                / dot(diff_vector(a.en, a.st), diff_vector(a.en, a.st));
    h.x = k * (a.en.x - a.st.x) + a.st.x;
    h.y = k * (a.en.y - a.st.y) + a.st.y;
    return h;
}

double norm(point a)
{
    //原点からの距離
    return sqrt((a.x * a.x) + (a.y * a.y));
}

double norm2(point a)
{
    //原点からの距離の二乗
    return (a.x * a.x) + (a.y * a.y);
}

double distans(point a, point b)
{
    //二点間の距離
    point tmp = sum_vector(b, minus_vector(a));
    return norm(tmp);
}

point sum_vector(point a, point b)
{
    //ベクトルの和
    a.x += b.x;
    a.y += b.y;
    return a;
}

point diff_vector(point a, point b)
{
    //ベクトルの差
    a.x -= b.x;
    a.y -= b.y;
    return a;
}

point minus_vector(point a)
{
    //逆ベクトル
    a.x *= -1;
    a.y *= -1;
    return a;
}

double dot(point a, point b)
{
    //内積
    return (a.x * b.x) + (a.y * b.y);
}

double prod(point a, point b)
{
    //外積
    return (a.x * b.y) - (b.x * a.y);
}

int ccw(line a, point p)
{
    //counter clockwise == 1
    //clockwise == 2
    //online back == 3
    //online front == 4
    //on segment == 5
    int cls = prod(diff_vector(a.en, a.st), diff_vector(p, a.st));
    if (cls > 0) {
        return 1;
    } else if (cls < 0) {
        return 2;
    } else if (dot(diff_vector(a.en, a.st), diff_vector(p, a.st)) < 0) {
        return 3;
    } else if (norm(diff_vector(a.st, a.en)) < norm(diff_vector(a.st, p))) {
        return 4;
    } else {
        return 5;
    }
}

int parallel(line a, line b)
{
    //並行で1,そうでなくて0
    if (!prod(diff_vector(a.en, a.st), diff_vector(b.en, b.st))) {
        return 1;
    } else {
        return 0;
    }
}

int orthogonal(line a, line b)
{
    //直行で1,そうでなくて0
    if (!dot(diff_vector(a.en, a.st), diff_vector(b.en, b.st))) {
        return 1;
    } else {
        return 0;
    }
}

///////////////////////////////////////

int main(void)
{
    line a, b;
    int n, i;

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf"
                , &a.st.x, &a.st.y, &a.en.x, &a.en.y
                , &b.st.x, &b.st.y, &b.en.x, &b.en.y);
        if (parallel(a, b)) {
            puts("2");
        } else {
            printf("%d\n",orthogonal(a, b));
        }
    }
    return 0;
}

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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int x,k=1,sum=0;
    cin>>x;
    sum=x;
    while(sum%360!=0){
        sum+=x;
        k+=1;
    }
    cout<<k;
    return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>

int main(void){
	
	int a, b;
	int wa;
	int count = 0;
	
	while(scanf("%d %d", &a, &b) != EOF){
	wa = a + b;
		count = 0;
		do{
			wa = wa / 10;
			count++;
		}while(wa != 0);
	printf("%d\n", count);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int num[100005];
	string a,b;
	cin>>a>>b;
	int len=a.size();
	memset(num,-1,sizeof(num));
	for(int i=0;i<len;i++)
	{
		if(num[a[i]]==-1)
		{
			num[a[i]]=b[i];
		}
		else
		{
			if(num[a[i]]!=b[i])
			{
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	memset(num,-1,sizeof(num));
	for(int i=0;i<len;i++)
	{
		if(num[b[i]]==-1)
		{
			num[b[i]]=a[i];
		}
		else
		{
			if(num[b[i]]!=a[i])
			{
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;

static const double EPS = 1e-8;

int tx[] = {0,1,1,1,0,-1,-1,-1};
int ty[] = {-1,-1,0,1,1,1,0,-1};


int gSum=0;

string shrink(const string& stage,int x1,int y1,int x2,int y2){
	string res="";

	for(int i=0;i<stage.size();i++){

		if( i % 4 == x1 && i / 4 == y1) continue;
		if( i % 4 == x2 && i / 4 == y2) continue;
		res.push_back(stage[i]);
	}

	res.push_back('-');
	res.push_back('-');
	return res;
}

void dfs(const string& stage,map<string,char>& visited,int count){
	for(int y=0;y<5;y++){
		for(int x=0;x<4;x++){
			char c = stage[y*4+x];
			if(c=='-') continue;
			for(int i=0;i<8;i++){
				int dx = x + tx[i];
				int dy = y + ty[i];
				if(dx < 0 || dx >= 4 || dy < 0 || dy >= 5) continue;
				if(stage[dy*4+dx] == '-') continue;
				if(c == stage[dy*4+dx]){
					string next = shrink(stage,x,y,dx,dy);
					if(visited.find(next) != visited.end()) continue;
					if(visited.find(next) != visited.end() && visited[next] >= count+1) continue;
					visited[next] = count+1;
					dfs(next,visited,count+1);
					gSum = max(count+1,gSum);
				}
			}
		}
	}
}

int main(){
	int n;
	string stage;
	while(~scanf("%d",&n)){
		for(int i=0;i<n;i++){
			gSum = 0;
			stage="";
			for(int y=0;y<5;y++){
				for(int x=0;x<4;x++){
					string str;
					cin >> str;
					stage += str;
				}
			}

			map<string,char> visited;

			dfs(stage,visited,0);		
			printf("%d\n",20-gSum*2);
		}
	}

}

Measured memory_bytes: 1024
#include <iostream>

int main()
{
    int n;
    std::cin >> n;
    long lucas{}, prev[2]{2, 1};
    if (n == 1)
    {
        lucas = 1;
    }
    else
    {
        for (auto i = 1; i < n; ++i)
        {
            lucas = prev[0] + prev[1];
            prev[0] = prev[1];
            prev[1] = lucas;
        }
    }
    std::cout << lucas << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

static int map[10];
static int valid[3] = {3, 5, 7};
int traverse(int64_t cur, int64_t limit) {
    if(cur > limit) return 0;
    int ans = 0;
    int i;
    int flag = 1;
    for(i = 0; i < 3; i++) {
        int d = valid[i];
        if(!map[d]) flag = 0;
        map[d]++;
        ans += traverse(cur*10 + d, limit);
        map[d]--;
    }
    return ans + flag;
}

int main(void) {
    int num = get_int();
    int ans = traverse(0, num);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

#define MAXN 200000

int n;

int input() {
        if (scanf("%d", &n) < 0) return 0;
        return 1;
}

void init() {
}

int solve() {
        for (int i=1; i<=n; i++) {
                if (i*108/100==n) return i;
        }
        return -1;
}

void output(int ans) {
        if (ans<0) printf(":(\n");
        else printf("%d\n", ans);
}

void cleanup() {
}

int main() {
        //int ca; scanf("%d", &ca);
        while (input()) {
                init();
                output(solve());
                cleanup();
                //break;
        }
}



Measured memory_bytes: 128
#include<iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
  int N,M;
  cin >> N >> M;
  vector<ll> X(M);
  vector<ll> koma(N);
  for (auto &x: X) {
    cin >> x;
  }
  if (N >= M) {
    cout << 0;
    return 0;
  }
  sort(X.begin(), X.end());
  //for (auto x:X){
  //  cout << x << "," << endl;
  //}
  //vector<int> sa(M-1);
  vector<int> sa;
  int sum_sa = 0;
  for (int i=0; i < M-1; i++){
    sa.push_back(X[i+1] -X[i]);
      //sa[i] = X[i+1] -X[i];
    //cout << "sa:" << sa[i];
    sum_sa += sa[i];
    //cout << "sa:" << sa[i];
  }
  sort(sa.begin(), sa.end());
  for (int i = 0; i < N -1;i++ ) {
    //cout << "sa[i]:"<< sa[i];
    //cout << "sa[M -1-i]" << sa[M -1 -1-i];
    sum_sa -= sa[M -1-1-i];
  }
  cout << sum_sa;
}


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

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


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll a;
    string b;
    cin>>a>>b;
    b=b.erase(1,1);
    ll c=stoi(b);
    cout<<a*c/100<<endl;
    
    
    return 0;
}

Measured memory_bytes: 3604
from collections import deque
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
import bisect
def isprime(n):
  if n <= 1:
    return False
  else:
    for i in range(2,(int(n**0.5)+2)):
      if n%i == 0:
        return False
    return True

def solve():
  n = int(input())
  a = sorted([int(input()) for _ in range(n)])+[10**9 + 1]
  b = sorted([int(input()) for _ in range(n)])+[10**9 + 1]
  mod = 10**9+7
  ans = 1
  if n == 1:
    print(1)
  else:
    na,nb = 0,0
    for i in range(2*n):
      if na>nb and a[na]>b[nb]:
        ans *= na-nb
        ans %= mod
      elif na<nb and a[na]<b[nb]:
        ans *= nb-na
        ans %= mod
      
      if a[na] < b[nb]:na += 1
      else:nb += 1
  print(ans)
      
    
solve()

Measured memory_bytes: 12428
import java.util.Scanner;
import java.util.regex.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner cd = new Scanner(System.in);
		int a = cd.nextInt();
		int b = cd.nextInt();
		String s = cd.next();
		if(s.matches("[0-9]{"+a+"}-[0-9]{"+b+"}")) {
			System.out.println("Yes");
		}else System.out.println("No");
	}

}


Measured memory_bytes: 22992
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

template <class T>void Sort(vector<T> & a) { sort(a.begin(), a.end()); }
template <class T>void ReSort(vector<T>& a) { sort(a.rbegin(), a.rend()); }
template <class T>void Reverse(vector<T>& a) { reverse(a.begin(), a.end()); }
template <class T>void Unique(vector<T>& a) { a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T>T Sum(vector<T> a, T init = 0) { return accumulate(a.begin(), a.end(), init); }

//INPUT//
void CINPUT() {}
template<class H, class ...T> void CINPUT(H&& h, T&& ...t) { cin >> h; CINPUT(forward<T>(t)...); }
#define in(...) int __VA_ARGS__; CINPUT(__VA_ARGS__);
#define In(T,...) T __VA_ARGS__; CINPUT(__VA_ARGS__);
#define Vin(T,name,n) int n; cin>>n; vector<T> name(n); rep(i,n)cin>>name[i];
#define VIn(T,name,n) vector<T> name(n); rep(i,n)cin>>name[i];

//OUTPUT//
void print() { cout << endl; }
template <class H> void print(H&& h) { cout << h << endl; }
template <class H, class... T> void print(H&& h, T&& ... t) { cout << h << " "; print(forward<T>(t)...); }
template<class T>void out(T n) { cout << n << endl; }
template<class T>void out(vector<T> a, string sep = " ", string end = "\n") { for (int i = 0; i < (int)a.size(); ++i)cout << a[i] << (i == (int)a.size() - 1 ? end : sep); }
void yes(bool f) { puts(f ? "yes" : "no"); }
void Yes(bool f) { puts(f ? "Yes" : "No"); }
void YES(bool f) { puts(f ? "YES" : "NO"); }
void poss(bool f) { puts(f ? "possible" : "impossible"); }
void Poss(bool f) { puts(f ? "Possible" : "Impossible"); }
void POSS(bool f) { puts(f ? "POSSIBLE" : "IMPOSSIBLE"); }

int main() {
	In(string, s);
	out(s.substr(0, sz(s) - 8));
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
	int B[100] = { 0 }, A[101] = { 0 }, i = 1, N, C = 0;
	scanf("%d", &N);
	while (i < N) {
		scanf("%d", B + i);
		i++;
	}
	i = 1;
	A[1] = B[1];
	while (i < N) {
		if (B[i] > B[i + 1])
			A[i + 1] = B[i + 1];
		else A[i + 1] = B[i];
		i++;

	}
	A[N] = B[N - 1];
	for (i = 1; i < N+1; i++) {
		C =C+ A[i];
	}
	printf("%d", C);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  int n,a[1005];
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  int q;
  cin>>q;
  while(q--)
  {
    int b,m,e;
    cin>>b>>m>>e;
    rotate(a+b,a+m,a+e);
  }
  for(int i=0;i<n-1;i++)
  {
    cout<<a[i]<<" ";
  }
  cout<<a[n-1]<<endl;
}



Measured memory_bytes: 3168
from collections import Counter
import numpy as np


def part(s, t):
    a = np.linspace(s, t, 1e5, endpoint=False)
    for i, v in Counter(np.argmax(np.dot(pts, [np.sin(a), np.cos(a)]), axis=0)).items():
        ans[i] += v


n = int(input())
pts = [list(map(int, input().split())) for _ in range(n)]
ans = np.zeros(n)
part(0, np.pi)
part(np.pi, 2 * np.pi)
ans /= 2e5
print('\n'.join(map(str, ans)))


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

#define int long long

using namespace std;

const int mod = 998244353;
const int N = 300005;

int fact[N], inv_fact[N];

int binPow (int x, int y) {
    int ans = 1;
    while (y) {
        if (y & 1) ans = (ans * x) % mod;

        x = (x * x) % mod;
        y /= 2;
    }

    return ans;
}

int C (int n, int k) {
    if (k > n) return 0;
    if (k < 0) return 0;

    int ans = 1;
    ans *= fact[n]; ans %= mod;
    ans *= inv_fact[k]; ans %= mod;
    ans *= inv_fact[n - k]; ans %= mod;

    return ans;
}

signed main(){
    int n, a, b, k;
    scanf("%lld %lld %lld %lld", &n, &a, &b, &k);

    fact[0] = inv_fact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = (i * fact[i - 1]) % mod;
        inv_fact[i] = binPow(fact[i], mod - 2);
    }

    int ans = 0;
    for (int i = 0; i <= n && a * i <= k; i++) {
        if ((k - a * i) % b == 0) {
            int j = (k - a * i) / b;
            ans = ans + C(n, i) * C(n, j);
            ans %= mod;
        }
    }

    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
using namespace std;
int main() 
{
	string a;
	cin>>a;
	char ch;
	ch=toupper(a[0]);
	cout<<ch;
	cin>>a;
	ch=toupper(a[0]);
	cout<<ch;
	cin>>a;
	ch=toupper(a[0]);
	cout<<ch;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;
vector<int> adj[10001];

int assigned[10001];

int input[10000];
int input_cur;

int N;

void dfs(int idx, int parent)
{
	for (auto &next : adj[idx])
	{
		if (next == parent) continue;
		dfs(next, idx);
	}
	assigned[idx] = input[input_cur++];
}

int main()
{
	scanf("%d", &N);

	for (int i = 0; i < N - 1; ++i)
	{
		int from, to;

		scanf("%d %d", &from, &to);
		adj[from].push_back(to);
		adj[to].push_back(from);
	}

	for (int i = 0; i < N; ++i) scanf("%d", &input[i]);
	sort(input, input + N);

	int sum = 0;

	for (int i = 0; i < N - 1; ++i) sum += input[i];
	
	dfs(1, 0);

	printf("%d\n", sum);
	for (int i = 1; i <= N; ++i) printf("%d ", assigned[i]);
	printf("\n");

	return 0;
}

Measured memory_bytes: 1408
(set! *unchecked-math* true)
(defn input []
  (vector
    (->> (clojure.string/split (read-line) #"\s")
      (map #(Integer/parseInt %)))
    (apply vector (read-line))
    (apply vector (read-line))))

(defn gcd [A B]
  (.gcd (BigInteger. (str A)) (BigInteger. (str B))))

(defn lcm [a b]
  (quot (* (bigint a) (bigint b)) (gcd a b)))

(defn first-inner [N S L]
  (zipmap (range 0 L (quot L N)) S))

(defn second-inner [M T L X]
  (let [Number (quot L M)]
    (loop [t T i 0]
      (if (empty? t)
        true
        (if-let [v (find X i)]
          (if (not= (v 1) (first t))
            false
            (recur (rest t) (unchecked-add-int i Number)))
          (recur (rest t) (unchecked-add-int i Number)))))))


(defn TwoAbbreviation [[[N M] S T]]
  (let [L (lcm N M)]
    (if (->> (first-inner N S L) (second-inner M T L))
      (str L)
      -1)))

(->> (input)
  TwoAbbreviation
  println)


Measured memory_bytes: 95724
#include <stdio.h>
#include <stdlib.h>
 
int main(){
  long long k;
  long n,q;
  scanf("%ld %lld %ld",&n,&k,&q);
  int *point;
  int i;
  point = (int*)malloc(n*sizeof(int));
  for(i=0;i<n;i++){
    point[i]=0;
  }
  int Ai;
  for(i=0;i<q;i++){
    scanf("%d",&Ai);
    point[Ai-1]++;
  }
  for(i=0;i<n;i++){
    long long a = k - q + point[i];
    if(a > 0){
      puts("Yes");
    }else{
      puts("No");
    }
  }
  free(point);
  return 0;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int N;
    cin >> N;

    if (N == 3) { cout << "2 5 63\n"; return 0; }

    vi even, odd;
    for (int v = 1; v <= 30000; v++) {
        if (v % 6 == 3) odd.push_back(v);
        if ((v % 6) % 2 == 0) even.push_back(v);
    }

    vi res;

    reverse(all(odd));

    if (N <= odd.size()) {
        if (N&1) {
            res.push_back(even[even.size() - 1]);
            res.push_back(even[even.size() - 2]);
            res.push_back(even[even.size() - 3]);
            N -= 3;
        } else {
            res.push_back(even[even.size() - 2]);
            res.push_back(even[even.size() - 3]);
            N -= 2;
        }
        for (int i = 0; i < N; i++)
            res.push_back(odd[i]);
    } else {
        res = odd;

        int use_even = N - odd.size();
        for (int i = 0; i < use_even; i++) {
            res.push_back(even[i + (use_even % 3 == 1 ? 2 : 0)]);
        }
    }

    ll sum = 0;
    int g = 0;
    for (int v : res) {
        sum += v;
        g = __gcd(g, v);
        cout << v << " ";
    }
    cout << endl;

    assert(g == 1);
    assert(sum % 6 == 0);

    return 0;
}



Measured memory_bytes: 640
mod = 998244353

n=int(input())

t = list(map(int,input().split()))

tree = [0]*n

for i in t:
    tree[i] += 1

if tree[0] != 1 or t[0] != 0:
    ans = 0
else:
    ans = 1
    for i in range(1,n):
        ans = (ans*pow(tree[i-1],tree[i],mod))%mod
print(ans)


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

ll n, m;
bool dfs(vector<vector<ll>> &A, ll now, int cnt) {
  if (cnt > 2) return false;
  bool res = false;
  for (int i = 0; i < A[now].size(); i++) {
    if (cnt == 2 && A[now][i] == n - 1) return true;
    if (dfs(A, A[now][i], cnt + 1)) {
      res = true;
      break;
    }
  }

  return res;
}

int main() {
  cin >> n >> m;
  vector<vector<ll>> A(n);
  for (int i = 0; i < m; i++) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    A[a].push_back(b);
  }

  cout << (dfs(A, 0, 1) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

Measured memory_bytes: 8960
//
//  main.cpp
//  aoj0118
//
//  Created by Wenfeng G on 7/31/19.
//  Copyright © 2019 Wenfeng G. All rights reserved.
//

#include <iostream>

int m, n, res;
char mat[102][102];

void dfs(char p, int x, int y) {
    if (x < 0 || x >= m || y < 0 || y >= n || mat[x][y] != p) {
        return;
    }
    mat[x][y] = '.';
    dfs(p, x-1, y);
    dfs(p, x+1, y);
    dfs(p, x, y-1);
    dfs(p, x, y+1);
}

void solve() {
    res = 0;
    for (int i = 0; i < m; i++) {
        std::cin >> mat[i];
    }
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
            if (mat[i][j] == '.') {
                continue;
            }
            dfs(mat[i][j], i, j);
            res++;
        }
    }
}

int main() {
    while (std::cin >> m >> n && m > 0 && n > 0) {
        solve();
        std::cout << res << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3312
x = int(input())
if x >= 400 and x <= 599:
    print(8)
elif x >= 600 and x <= 799:
    print(7)
elif x >= 800 and x <= 999:
    print(6)
elif x >= 1000 and x <= 1199:
    print(5)
elif x >= 1200 and x <= 1399:
    print(4)
elif x >= 1400 and x <= 1599:
    print(3)
elif x >= 1600 and x <= 1799:
    print(2)
elif x >= 1800 and x <= 1999:
    print(1)


Measured memory_bytes: 9192
N = 100001
pr = [True]*(N+1)
c = [0]*(N+1)
pr[0] = pr[1] = False
for i in range(2,N) :
    if pr[i]:
        for j in range(i+i,N,i):
            pr[j] = False

for i in range(3,N,2):
    if pr[i] and pr[(i+1)//2]:
        c[i]+=1
for i in range(3,N):
    c[i]+=c[i-1]
Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    print(c[r]-c[l-1])

Measured memory_bytes: 7156
import collections


def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans = 0
    c = [-a[i]-i for i in range(n)]
    # print(c)
    c = collections.Counter(c)
    for i in range(n):
        ans += c[a[i]-i]

    #
    # print(c)
    # c = collections.Counter(a[0])
    # for i in range(n-1):
    #     for j in range(i,n):
    #         if j-i == a[i]+a[j]:
    #             # print(i+1,j+1)
    #             ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 42704
#include<stdio.h>
int main(void){
	int dice[3][4]=
	{{0,1,0,0},
	 {4,2,3,5},
	 {0,6,0,0}};
	char ch[100];
	int i,pos=0,work;
	
	scanf("%d %d %d %d %d %d",&dice[0][1],\
	&dice[1][1],&dice[1][2],&dice[1][0],&dice[1][3],&dice[2][1]);
	
	scanf("%s",&ch);
	for(i=0;i<100;i++){
		if(ch[i]=='\0')break;
		pos++;
	}
	for(i=0;i<pos;i++){
		work=0;
		switch(ch[i]){
			case 'E':
					work=dice[1][2];
					dice[1][2]=dice[0][1];
					dice[0][1]=dice[1][0];
					dice[1][0]=dice[2][1];
					dice[2][1]=work;
					break;
					
			case 'N':
					work=dice[0][1];
					dice[0][1]=dice[1][1];
					dice[1][1]=dice[2][1];
					dice[2][1]=dice[1][3];
					dice[1][3]=work;
					break;
					
			case 'S':
					work=dice[0][1];
					dice[0][1]=dice[1][3];
					dice[1][3]=dice[2][1];
					dice[2][1]=dice[1][1];
					dice[1][1]=work;
					break;
					
			case 'W':
					work=dice[1][2];
					dice[1][2]=dice[2][1];
					dice[2][1]=dice[1][0];
					dice[1][0]=dice[0][1];
					dice[0][1]=work;
					break;
		}
	}
	printf("%d\n",dice[0][1]);
	
	
	return 0;
}


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

using namespace std;

int main()
{
	int n,d;
	cin>>n>>d;

	int count=0;
	for(int i=0;i<n;i++)
	{
		double x,y;
		cin>>x>>y;

		double s=sqrt(x*x+y*y);

		if(s<=d)
			count++;
	}

	cout<<count;
	return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define numarr 12
using namespace std;

int main() {
	int A,B, ans;
	cin >> A >> B;
	if (B%A)
		ans = B - A;
	else ans = A + B;
		cout << ans << endl;
}

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


int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  while(1){

    
    c -= b;
     if(c<=0){
      cout << "Yes" << endl;
      break;
    }

    a -= d;

    if(a<=0) {
      cout << "No" << endl;
      break;
    }  
   
  }

  return 0;
}


Measured memory_bytes: 3644
#include <iostream>

 

using namespace std;

 

int main() 
{
    int a, b, c;
    
    cin >> a >> b >> c;
    if (a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if(a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if(b <= a && a <= c)
        cout << b << " " << a << " " << c << endl;
    else if(b <= c && c <= a)
        cout << b << " " << c << " " << a << endl;
    else if(c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;
    else
        cout << c << " " << b << " " << a << endl;
}


Measured memory_bytes: 3116