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

int main()
{
    long long int n,i,ans=0;
    scanf("%lld",&n);

    for(i=1; i<=n; i++)
    {
        if(i%3!=0 && i%5!=0)
            ans+=i;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 3836
X,N = map(int,input().split())
P = list(map(int,input().split()))
if P == []:
  print(X)
  exit()
for n in range(101):
  if X - n not in P:
    ans = X - n
    break
  if X + n not in P:
    ans = X + n
    break

print(ans)

Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n, x, y;
  cin >> n >> x >> y;
  vector<int> G[n];
  vector<vector<int>> dist(n,vector<int>(n,-1));// dist[i][j]:=iからjへの距離
  x--, y--;
  G[x].pb(y);
  G[y].pb(x);
  rep(i, n - 1) {
    G[i].pb(i + 1);
    G[i + 1].pb(i);
  }
  rep(st,n){
    dist[st][st] = 0;
    queue<int> q;
    q.push(st);
    while(!q.empty()){
      int p = q.front();
      q.pop();
      for(auto nx : G[p]){
        if (dist[st][nx] != -1) continue;
        dist[st][nx] = dist[st][p] + 1;
        q.push(nx);
      }
    }
  }
  vector<int> ans(n,0);
  rep(i, n) rep(j, n) ans[dist[i][j]]++;
  for (int i = 1; i < n; i++){
    cout << ans[i]/2 << endl;
  } 
  return 0;
}

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

using namespace std;

int main()
{
	// 入力
	int N;
	cin >> N;
	// ペアを利用した配列の宣言
	vector<pair<pair<string, int>, int>> Shop(N);
	for (int i = 0; i < N; i++)
	{
		string S;
		int P;
		cin >> S >> P;
		
		//Shop[i].first.first = S;
		//Shop[i].first.second = P;
		//Shop[i].first.second *= -1;
		//Shop[i].second = i + 1;
		
		// 点数が高い順に並べるために得点を負の値にする
		Shop[i] = make_pair(make_pair(S, -P), i+1);
	}
	
	// 辞書順にソート
	sort(Shop.begin(), Shop.end());
	
	// 出力
	for (int i = 0; i < N; i++)
	{
		cout << Shop[i].second << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var tmp = line[0].split(" ");
	var A = Number(tmp[0]);
	var B = Number(tmp[1]);
	var X = Number(tmp[2]);
	if(0 <= X - A && X - A <= B) console.log("YES");
	else console.log("NO");

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 23092
#include <iostream>

using namespace std;
int main() {
	int i = 0;
	int j = 0;
	int totalmoney = 0;
	int flag = 0; 
	int now = 0;
	cin>>totalmoney;
	for(i=0;i<30;i++)
	{
		for(j=0;j<=15;j++)
		{
			now = (i*4)+(7*j);
			if(now == totalmoney)
			{
				flag = 1;
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  string S;
  cin>>N>>S;
  int ans=0;
  for(int i=1;i<N;i++){
    for(int j=0;j<N;j++){
      int res=0;
      int m=j;
      while(j<N&&j+i<N&&S[j]==S[i+j]&&j<i+m){
        res++;
        j++;
      }
      ans=max(res,ans);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
 	cin >> n;
 	string s;
 	cin >> s;
 	if (n%2==0){
 		if (s.substr(0,n/2)==s.substr(n/2, n/2)) cout << "Yes";
 		else cout << "No";
 	}
 	else{
 		cout << "No";
 	}
}

Measured memory_bytes: 256
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;


int main(){
int N;
cin >> N;
vector<int> a(N);
for(int i = 0; i < N; i++){
cin >> a[i] ;
}
int Alice = 0;
int Bob = 0;
sort(a.begin(),a.end(),greater<int>());
for(int i = 0; i < N; i = i + 2){
Alice += a[i];
}
for(int i = 1; i < N; i = i + 2){
    Bob += a[i];
}
cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
const int N = 301, M = 7 + 1e9;
int n, t, a[4];
double e[N][N][N];
int main()
{
	cin >> n;
	f(i, 0, n){
		cin >> t;
		++ a[t];
	}
	e[0][0][0] = 0;
	f(i, 0, n+1){
		f(j, 0, n+1){
			f(k, 0, n+1){
				if(i+j+k>n)
					break;
				if(i==0&&j==0&&k==0)
					continue;
				double p0 = 1.00*(n-(i+j+k)) / n, p1 = 1.00*k / n, p2 = 1.00*j / n, p3 = 1.00*i / n;
				//bernoulli
				//e[i][j][k] = ( p3 * (e[i-1][j][k]+1) + p2 * (e[i][j-1][k]+1) + p1 * (e[i][j][k-1]+1) +1*p0 ) / (1-p0);
				e[i][j][k] = 1*p0;
				if( i-1 >= 0 )
					e[i][j][k] += p3 *( e[i-1][j+1][k] + 1 );
				if( j-1 >= 0 )
					e[i][j][k] += p2 *( e[i][j-1][k+1] + 1 );
				if( k-1 >= 0 )
					e[i][j][k] += p1 *( e[i][j][k-1] + 1);

				e[i][j][k] /= 1 - p0;
			}
		}
	}
	cout << setprecision(10) << fixed;
	cout << e[a[3]][a[2]][a[1]];

}

Measured memory_bytes: 213248
#include <bits/stdc++.h>
#define INT long long
#define P 998244353
using namespace std;
INT n, m, a, b, dp[100010];
vector<INT> v, w;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    if( n < 1000 ) cout<<"ABC"<<endl;
    else cout<<"ABD"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int H, W, N;
	cin >> H >> W >> N;
	VI A(N);
	int co[10000];
	REP(i, 10000)
		co[i] = i + 1;
	REP(i, N)
		cin >> A[i];
	int ans[100][100];
	int k = 1, cnt = 0;

	for (int i = 0; i < H; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < W; j++) {
				ans[i][j] = co[cnt];
				if (k == A[cnt]) {
					k = 0;
					cnt++;
				}
				k++;
			}
		}

		if (i % 2 == 1) {
			for (int j = W-1; j >= 0; j--) {
				ans[i][j] = co[cnt];
				if (k == A[cnt]) {
					k = 0;
					cnt++;
				}
				k++;
			}
		}
	}
	REP(i, H) {
		cout << ans[i][0];
		FOR(j,1, W) {
			cout << " " << ans[i][j];
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 512
#include<stdio.h>
#define MAXH 22
#define MAXW 24

int bfs(int mat[MAXH][MAXW],int visited[MAXH][MAXW],int ph,int pw,int* ans){
	int vector[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
	int i;
	visited[ph][pw]=1;
	(*ans)++;
	for(i=0;i<4;i++){
		int nh=ph+vector[i][0];
		int nw=pw+vector[i][1];
		if(mat[nh][nw]=='.'&&visited[nh][nw]==0){
			bfs(mat,visited,nh,nw,ans);
		}
	}
	return 0;
}
int input(int mat[MAXH][MAXW],int h,int w,int* sh,int* sw){
	int i,j;
	for(i=1;i<h+1;i++){
		for(j=1;j<w+1;j++){
			int c;
			while(c=getchar()){
				if(c!='\n'){
					mat[i][j]=c;
					if(c=='@'){
						*sh=i;
						*sw=j;
					}
					break;
				}
			}
		}
	}
	return 0;
}
int main(){
	int w,h;
	int sh,sw;
	int ans=0;
	int mat[MAXH][MAXW],visited[MAXH][MAXW];
	int i,j,k;
	while(1){
		scanf("%d %d",&w,&h);
		if(w==0&&h==0){
			break;
		}
		ans=0;
		for(i=0;i<MAXH;i++){
			for(j=0;j<MAXW;j++){
				mat[i][j]='#';
				visited[i][j]=0;
			}
		}
		input(mat,h,w,&sh,&sw);
		bfs(mat,visited,sh,sw,&ans);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
import std.stdio;
import std.typecons;
import std.algorithm;
import std.conv;
import std.math;
import std.string;
import std.array;

// 最大抱合を求める問題
// グラハムスキャンを用いて解く
// アルゴリズム: http://en.wikipedia.org/wiki/Graham_scan

struct Point {
  double x, y;
  double dot(Point a) {return x * a.x + y * a.y;}
  double cross(Point a) {return x * a.y - y * a.x;}
  Point opBinary(string s)(Point p) if (s == "+") {p.x += x; p.y += y; return p;}
  Point opBinary(string s)(Point p) if (s == "-") {
    p.x = x - p.x;
    p.y = y - p.y;
    return p;
  }
}

// CCW, 3 点の外積を求める
// X1 x X2 == 0  ... X1, X2 は並行
// X1 x X2 > 0   ... X1, X2 は反時計周り
// X1 x X2 < 0   ... X1, X2 は時計周り
// (-1) * (BA x BC) = (-1) * (X1 - X2) x (X3 - X2)

// ccw > 0 ... 時計周り, ccw < 0 反時計周り
double ccw(Point p1, Point p2, Point p3) {
  return - (p1.x - p2.x) * (p3.y - p1.y) + (p1.y - p2.y) * (p3.x - p1.x);
}

// 最大抱合を求める
Point[] max_convex_full(Point[] points) {
  Point[] res = new Point[](points.length * 2);
  sort!((a, b) {
      if (a.x != b.x)  return a.x < b.x;
      return a.y < b.y;
    })(points);
  uint k = 0;
  // 下部の凸部
  for(int i = 0; i < points.length; i++) {
    while(k >= 2 && ccw(res[k - 2], res[k - 1], points[i]) <= 0) k--;
    res[k++] = points[i];
  }
  // 上部の凸部
  for(int i = cast(int)points.length - 2, t = k + 1; i >= 0; i--) {
    while(k >= t && ccw(res[k - 2], res[k - 1], points[i]) <= 0) k--;
    res[k++] = points[i];
  }
  res.length = k - 1;
  return res;
}

void main() {
  while(true) {
    int n = readln.chomp.to!(int);
    if (n == 0) break;
    Point[] points;
    foreach(t; 0..n) {
      auto line = readln.chomp.split(",").map!(to!(double)).array;
      points ~= Point(line[0], line[1]);
    }
    (points.length - points.max_convex_full.length).writeln;
  }
}

Measured memory_bytes: 1128
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
//bitset<maxx/2>vis;
//bitset<maxx>pr;
//int mobi[maxx+10];
//vector<ll>prime;
//void sieve(){
//    ll x=maxx/2, y=sqrt(maxx)/2;
//    for(ll i=1;i<=y;i++){
//        if(vis[i]==0){
//            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
//                vis[j]=1;
//        }
//    }
//    prime.push_back(2);
//    for(ll i=3;i<maxx;i+=2)
//        if(vis[i/2]==0)
//        prime.push_back(i);
//}
//void generate_mobius()
//{
//    for(int i=0;i<maxx;i++)mobi[i]=1;
//    for(int i=2;i<maxx;i++){
//        if(!pr[i]){
//            mobi[i]*=-1;
//            for(int j=i+i;j<maxx;j+=i){
//                pr[j]=1;
//                mobi[j]*=(j%(i*i)?-1:0);
//            }
//        }
//    }
//}
//bool isprime(ll a)
//{
//    if(a==1)return false;
//    if(a==2)return true;
//    if(a%2==0)return false;
//    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++)
//        if(a%prime[i]==0)return false;
//    return true;
//}
/* Calculate ( a*b ) %c */
inline ll mulmod(ll a, ll b, ll c) {
    ll ret = 0 , cur = a % c ;
    while(b) { if(b%2) ret=(ret+cur)%c; cur=(cur<<1)%c; b=b>>1; }
    return ret%c;
}
//Calculate (b^p)%m || modular inverse: b^-1 = bigmod(b, m-2, m)
inline ll bigmod(ll b, ll p, ll m){
    ll ret = 1, cur = b % m;
    while(p) { if(p&1) ret=(ret*cur)%m; cur=(cur*cur)%m; p=p>>1; }
    return ret;
}
inline ll modulo(ll a,ll b,ll c) { //Same as big mod, use for numbers over 1e10
    ll ret = 1 , cur = a%c ;
    while(b) { if(b%2) ret=mulmod(ret,cur,c); cur=mulmod(cur,cur,c); b=b>>1; }
    return ret%c ;
}
inline ll power(ll b, ll p){
    ll ret = 1, cur = b;
    while(p) { if(p&1) ret=(ret*cur); cur=(cur*cur); p=p>>1; }
    return ret;
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
void Dufaux()
{
    string s;
    cin>>s;
    string ans="";
    for(int i=0;i<s.size();i++){

        if(s[i]=='0')ans+=s[i];
        else if(s[i]=='1')ans+=s[i];
        else{
            if(ans.size()==0){
                continue;
            }
            ans.pop_back();
        }
    }
    cout<<ans<<endl;
}
int main()
{
    FastIO;
	///sieve();
	///generate_mobius();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

//---------------------------

ll dp[55][55][2510];

int main(){
    ll n,a;
    cin >> n >> a;
    VL x(n);
    rep(i,n){
        cin >> x[i];
    }
    
    // ll dp[55][55][2510];

    rep(i,n)rep(j,n+1)rep(k,2510) dp[i][j][k] = 0;

    rep(i,n) dp[i][0][0] = 1;
    dp[0][1][x[0]] = 1;

    rep2(i,1,n)rep2(j,1,n+1)rep(k,2510){
        if(k >= x[i]){
            dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]];
        }else{
            dp[i][j][k] = dp[i-1][j][k];
        }
    }

    ll ans = 0;
    rep2(j,1,n+1){
        ans += dp[n-1][j][a*j];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 55424
import java.util.Scanner;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		if (C == 0){
			System.out.println("YES");
			return;
		}

		int gcd = gcd(A, B);

		System.out.println(C % gcd == 0 ? "YES" : "NO");
	}

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

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 22996
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let (n, a, b) = Scanf.sscanf (read_line ()) "%d %d %d" @@ fun n a b -> (n, a, b)
let xs = read_line () |> split_string ~pattern:" " |> List.map int_of_string |> Array.of_list

let xs = Array.init (n - 1) (fun i -> xs.(i + 1) - xs.(i))

let () =
  Printf.printf "%d\n" @@ Array.fold_left (fun sum i ->
    sum + (min (a * i) b)
  ) 0 xs

Measured memory_bytes: 20588
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

ll dp[2010][2010];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    vp a(n);
    rep(i,n) {
        cin >> a[i].first;
        a[i].second = i;
    }
    auto f = [](P p,int i) {
        return (ll)p.first*abs(i-p.second);
    };
    sort(rall(a));
    rep(i,n+1) rep(j,n-i+1) {
        if(i > 0) chmax(dp[i][j],dp[i-1][j]+f(a[i+j-1],i-1));
        if(j > 0) chmax(dp[i][j],dp[i][j-1]+f(a[i+j-1],n-j));
    }
    ll ans = 0;
    rep(i,n+1) chmax(ans,dp[i][n-i]);
    cout << ans << endl;
}


Measured memory_bytes: 26288
n = int(input())
alist = list(map(int, input().split()))
acounter = 0
bcounter = 0
num = 0
for i in range(n):
    num += alist[i]
    if i % 2 == 0:
        if num <= 0:
            acounter += abs(num) + 1
            num = 1
    else:
        if num >= 0:
            acounter += num + 1
            num = -1

num = 0
for i in range(n):
    num += alist[i]
    if i % 2 != 0:
        if num <= 0:
            bcounter += abs(num) + 1
            num = 1
    else:
        if num >= 0:
            bcounter += num + 1
            num = -1

print(min(acounter, bcounter))


Measured memory_bytes: 14468
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    int a[n],flag=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    for(int i=0;i<n;i++)
    {
        if(a[i]%2==0)
        {
            if(a[i]%3==0||a[i]%5==0);
            else
            {
                printf("DENIED");
                return 0;
            }
        }
    }
    printf("APPROVED");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;
typedef pair<long long, long long> pll;
// scanf("%d %d %d %d", &w, &b, &d, &s); %lld
// printf("%d\n", points);
// const double PI = acos(-1);

int main()
{
    #ifdef LOCAL
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    #else
        fastIO;
    #endif
        int n;
        double ans;
        cin >> n;
        ans = (n/3.0);
        ans = ans*ans*ans;
        cout << fixed << setprecision(9) << ans << endl;
        return 0;
}


Measured memory_bytes: 3752
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	int W, H, N;
	cin >> W >> H >> N;
	int l = 0, r = W;
	int d = 0, u = H;
	for (int i = 0; i < N; i++) {
		int x, y, a;
		cin >> x >> y >> a;
		if (a == 1) l = max(l,x);
		else if (a == 2) r = min(r, x);
		else if (a == 3) d = max(d, y);
		else u = min(u, y);
	}
	cout << max(r - l, 0)*max(u - d, 0) << endl;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: HonestOrDishonest
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  char a, b;
  cin >> a >> b;

  printf("%c\n", (a == b) ? 'H' : 'D');
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    ll a[N], b[N], c[N];
    ll dp[N + 1][3]{};
    for (int i = 0; i < N; i++) {
        cin >> a[i] >> b[i] >> c[i];
    } 
    for (int i = 0; i < N; i++) {
        dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a[i];
        dp[i + 1][1] = max(dp[i][0], dp[i][2]) + b[i];
        dp[i + 1][2] = max(dp[i][0], dp[i][1]) + c[i];
    }
    cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << "\n";
    return 0;
}

Measured memory_bytes: 4992
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::mem::{swap};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]
fn main() {
    input!{
        n: usize,
        plus: [String; n],
        m: usize,
        minus: [String; m],
    }
    let mut m = i32::MIN;
    for string in &plus {
        let p = plus.iter().filter(|s| s == &string).count() as i32 - minus.iter().filter(|s| s == &string).count() as i32;
        m = max(m, p);
    }
    println!("{}", max(0, m));
}



Measured memory_bytes: 4352
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N = inp()
a = inlist()
res = "Yes"
for i in range(N-1):
    if a[i] < a[i+1]:
        a[i+1] -= 1
for i in range(N-1):
    if a[i+1] < a[i]:
        res = "No"
        break
print(res)


Measured memory_bytes: 14832
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class FSugoroku {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n, m; cin >> n >> m;
      string s; cin >> s;
      reverse(all(s));
      vector<int> dp(n+1, INT_MAX/2);
      dp[0] = 0;
      int now = 1;
      for(int i=1; i<n+1; i++) {
        if (s[i] == '1') continue;
        if (i <= dp[now-1] + m) {
          dp[now] = i;
        } else if (dp[now] < i && i <= dp[now] + m) {
          now++;
          dp[now] = i;
        }
      }

      debug(now, dp[now]);
      if (dp[now] != n) {
        cout << -1 << endl;
        return;
      }

      for(int i=now; i>0; i--) {
        cout << dp[i] - dp[i-1] << ' ';
      }
      cout << endl;
    }
};

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

Measured memory_bytes: 1104
/*
 *
 * Author: r3gz3n
 * 3b 13 12 9 56 4e
 * 6 56 a a 5f f
 * 6 56 47 18 56 d
 * 13 46 14 1f 13 27
 * 52 52 a 5a 47 1
 * 1d 13 b 1b 49 17
 *
 */

#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;

template <class T=int> using order_statistics = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
const int MAX = 1e5 + 5;
int dp[MAX], a[MAX];

int main(int argc, char* argv[]) {
    if(argc == 2 or argc == 3) freopen(argv[1], "r", stdin);
    if(argc == 3) freopen(argv[2], "w", stdout);
    int n, k;
    cin >> n >> k;
    for (int i = 0;i < n;++i) cin >> a[i], dp[i] = 1e9;
    dp[0] = 0;
    for (int i = 1;i < n;++i) {
        for (int j = 1;j <= k;++j) {
            if (i - j >= 0)
                dp[i] = min(dp[i], dp[i-j] + abs(a[i] - a[i-j]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main()
{
	int n;
	cin >> n;
	vector<ll> v(n + 1, 1);
	vector<int> vec;
	vec.push_back(2);
	for (int i = 3; i <= n; i++)
	{
		bool cc = true;
		for (int j = 2; j <= sqrt((double)i); j++)
		{
			if (i%j == 0)
			{
				cc = false;
				break;
			}
		}
		if (cc)
			vec.push_back(i);
	}

	for (int i = 1; i <= n; i++)
	{
		int p = i;
		for (int j = 0; j < vec.size(); j++)
		{
			while (p%vec[j] == 0)
			{
				p /= vec[j];
				v[vec[j]]++;
			}
		}
	}
	ll brojac = 1;
	for (int i = 0; i <= n; i++)
	{
		brojac = (brojac*v[i]) % 1000000007;
	}
	cout << brojac % 1000000007 << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LONG_LONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
int i,n;
ll a[3*nmax],l[3*nmax],r[3*nmax],ans=-llinf;
multiset<ll>s;
int main()
{
	//freopen("sol.in","r",stdin);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=3*n;i++)cin>>a[i];
	for(i=1;i<=3*n;i++)
	{
		s.in(a[i]);
		l[i]=l[i-1]+a[i];
		if(s.size()>n)
		{
			l[i]-=(*s.begin());
			s.erase(s.begin());
		}
	}
	s.clear();
	for(i=3*n;i>=1;i--)
	{
		s.in(-a[i]);
		r[i]=r[i+1]+a[i];
		if(s.size()>n)
		{
			r[i]+=(*s.begin());
			s.er(s.begin());
		}
	}
	for(i=n;i<=2*n;i++)ans=max(ans,l[i]-r[i+1]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    int a[n];
    REP(i,n){
        cin >> a[i];
    }
    ll ans = 0;
    int right = 0, now = 0, sum = 0;
    for(int left = 0; left < n; left++){
        while(right < n && int(now ^ a[right]) == sum + a[right]){
            now ^= a[right];
            sum += a[right];
            right++;
        }
        ans += right - left;
        now ^= a[left];
        sum -= a[left];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
constexpr int mod = 1e9 + 7;

int main() {
  long long w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << fixed << setprecision(9);
  cout << w * h / 2.0 << ' ' << int(2 * x == w && 2 * y == h) << endl;
}


Measured memory_bytes: 256
n = int(input())
B = list(map(int, input().split()))
ANS = [-1 for _ in range(n)]

def findlast(str):
    for i in range(len(str))[::-1]:
        if str[i] == i+1:
            return i
    else:
        return -1

ok = True
for i in range(n)[::-1]:
    j = findlast(B)
    if j > -1:
        ANS[i] = B[j]
        B = B[:j] + B[j+1:]
    else:
        ok = False
if ok:
    for i in ANS:
        print(i)
else:
    print(-1)



Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 12345
using namespace std;
int n,A[N],a,b;
bool vis;
bool cmp(int a,int b) {
	return a > b;
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	sort(A,A+n,cmp);
	for(int i=0;i<n;i++)
	{
		if(!vis) a += A[i],vis=true;
		else b += A[i],vis=false;
	}
	printf("%d",a-b);
	return 0;
}

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

int main(void){
    int n, x, t;
    cin >> n >> x >> t;

    int m = (n%x==0)?(n/x):((n/x)+1);
    int ans = t*m;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define fst first
#define snd second
#define mp make_pair
#define squ(x) ((LL)(x) * (x))
#define debug(...) fprintf(stderr, __VA_ARGS__)

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

template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }

template<typename T> inline T read() {
	T sum = 0, fg = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') fg = -1;
	for (; isdigit(c); c = getchar()) sum = (sum << 3) + (sum << 1) + (c ^ 0x30);
	return fg * sum;
}

const int maxn = 600 + 10;
const int mod = 1e9 + 7;

inline void Add (int &a, int b) { if ((a += b) >= mod) a -= mod; }
//inline void Add(int &x, int y) { y += (y < 0 ? mod : 0), x += y, x -= (x >= mod ? mod : 0); }

int n, K, g[maxn], cnt[maxn], p[maxn], dp[maxn][maxn];

int main() {
#ifdef xunzhen
	freopen("chords.in", "r", stdin);
	freopen("chords.out", "w", stdout);
#endif

	n = read<int>() << 1, K = read<int>();
	g[0] = 1;
	for (int i = 1; i <= n; i++) {
		if (!(i & 1)) {
			if (i == 2) g[i] = 1;
			else g[i] = (LL) g[i - 2] * (i - 1) % mod;
		}
		cnt[i] = 1;
	}
	for (int i = 1; i <= K; i++) {
		int x = read<int>(), y = read<int>();
		cnt[x] = 0, cnt[y] = 0, p[x] = y, p[y] = x;
	}
	for (int i = 1; i <= n; i++) cnt[i] += cnt[i - 1];

//	for (int i = 1; i <= n; i++) printf("%d%c", g[i], i < n ? ' ' : '\n');

	int ans = 0;
	for (int i = 1; i <= n; i++)
		for (int j = i; j <= n; j++) {
			if ((j - i + 1) & 1) continue;
			bool GG = 0;
			for (int k = i; k <= j; k++)
				if (p[k] && (p[k] < i || p[k] > j)) { GG = 1; break; }
			if (GG) continue;
			dp[i][j] = g[cnt[j] - cnt[i - 1]];
			for (int k = i; k < j; k++) Add(dp[i][j], mod - 1LL * dp[i][k] * g[cnt[j] - cnt[k]] % mod);
//			printf("%d %d | %d %d | %lld %d\n", i, j, dp[i][j], cnt[i - 1] + (cnt[n] - cnt[j]), (LL) dp[i][j] * g[cnt[i - 1] + (cnt[n] - cnt[j])] % mod, ans);
			Add(ans, (LL) dp[i][j] * g[cnt[i - 1] + (cnt[n] - cnt[j])] % mod);
		}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1664
main = do
    abcd <- getLine

    let [a,b,c,d] = [read [x] :: Int | x <- abcd]
    let binary = [[x,y,z] | x <- [0,1], y <- [0,1], z <- [0,1]]
    let [x,y,z] = head (dropWhile (\bi -> f [a,b,c,d] bi /= 7) binary)

    putStrLn $ show a ++ op x ++ show b ++ op y ++ show c ++ op z ++ show d ++ "=7"


f [a,b,c,d] [x,y,z] = a + b * (-1)^x + c * (-1)^y + d * (-1)^z

op 0 = "+"
op 1 = "-"

Measured memory_bytes: 3936
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>
#include <cmath>

#define BP 1000000007

using namespace std;

typedef unsigned long long ull;
typedef unsigned long ul;
typedef long long ll;
typedef unsigned int ui;

typedef vector<ull> vull;
typedef vector<ll> vll;
typedef vector<ui> vui;
typedef vector<long> vl;
typedef vector<int> vi;
typedef vector<vl> vvl;
typedef vector<vi> vvi;

typedef pair<ull, ull> pull;
typedef pair<ll, ll> pll;
typedef pair<ui, ui> pui;
typedef pair<long, long> pl;
typedef pair<int, int> pi;

typedef vector<pair<long, long> > vpl;
typedef vector<pair<int, int> > vpi;

typedef queue<long> ql;
typedef queue<int> qi;

template <class T>
void printv(vector<T> vc) {
    for (auto e: vc) cout << e << " ";
    cout << endl;
}

template <class T>
void printvv(vector<T> vvc) { 
    for (auto vc: vvc) {
        for (auto e: vc) cout << e << " ";
        cout << endl;
    }
}

template <class T>
void printvp(vector<pair<T, T> > vp) {
    for (auto pT: vp) cout << pT.first << " " << pT.second << endl;
}

int main() {
    string a,b,c;
    cin >> a >> b >> c;
    cout << a[0] << b[1] << c[2] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

vector<int> A;
int N, M, V, P;


int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	
	cin >> N >> M >> V >> P;
	A.resize(N);
	FOR (i, N)
		cin >> A[i];
	sort(all(A));
	reverse(all(A));
	
//	for (auto &v : A)
//		cout << v << " ";
//	cout << endl;
	
	int ret = 0;
	LL sum = 0LL;
	int cc = 0;
	FOR (i, SZ(A)) {
		if (i < P - 1) {
			ret++;
			continue;
		}
		
		LL remain = V - P;
		int right = N - i - 1;
		remain -= right;
		remain = max(0LL, remain);
		
		//cout << "A[i] = " << A[i] << "; remain = " << remain << "; remain*M+sum = " << remain * M + sum << endl;
		
		if (!cc || ((remain * M + sum) <= 1LL * cc * (A[i] + M) && A[P - 1] <= A[i] + M))
			ret++;
		
		sum += A[i];
		cc++;
	}
	
	cout << ret << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <set>
#include <string>

int main() {

  int A;
  int B;
  int C;

  std::cin >> A >> B >> C;

  std::multiset<int> mst;
  mst.insert(A);
  mst.insert(B);
  mst.insert(C);

  int d = 0;
  int e = 0;
  int f = 0;

  int count = 0;
  for (auto tmp : mst) {
    if (count == 0) {
      d = tmp;
      count++;
    } else if (count == 1) {
      e = tmp;
      count++;
    } else {
      f = tmp;
      count++;
    }
  }
  std::string str = std::to_string(f) + std::to_string(e);
  std::cout << std::stoi(str) + d << std::endl;
  return 0;
}

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

using namespace std;

int main(){ 
  int N; cin >> N;
  vector<int> X(N);vector<int> Y(N);
   for(int i = 0; i < N; i++){ cin >> X[i] ; Y[i] = X[i]; }
  
  sort(Y.begin(),Y.end());
  
  int y = Y[N/2];
  for(int i = 0; i < N; i++){
    if( X[i] < Y[N/2]){cout << Y[N/2];}
    else{cout << Y[N/2 - 1];}  cout << endl;}return 0;}
    

Measured memory_bytes: 3712
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

//vector<ll> a;

int main()
{
	ll x,a;
	cin >> x >> a;
	if (x < a) {
		cout << "0" << endl;
	}
	else {
		cout << "10" << endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 3572
import itertools
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
n_lis = [i + 1 for i in range(n)]
n_per = [i for i in itertools.permutations(n_lis)]
print(abs(n_per.index(p) - n_per.index(q)))

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

// A - Study Scheduling
int change(int T) {
    if (T < 0) {
        return 60 + T;
    }
    return T;
}

int main() {
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;

    int S3, H3, M3;
    S3 = M2 - (K % 60);
    M3 = change(S3);
    if (S3 < 0) {
        H3 = H2 - (K / 60) - 1;
    } else {
        H3 = H2 - (K / 60);
    }

    /*
    cout << ceil(K / 60) << endl;
    cout << (K % 60) << endl;
    cout << H3 << endl;
    cout << M3 << endl;

    cout << ((H3 - H1) * 60) << endl;
    cout << change(M3 - M1) << endl;
    */
   int S = M3 - M1;
   int result = (H3 - H1);
   if (S < 0) {
       result--;
    }
    result *= 60;
    result += change(S);
    // cout << ((H3 - H1) * 60) + change(S);
    cout << result;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

long long int result[50][(1 << 17)] = {};

int main()
{
	int n, x, y, z;
	cin >> n >> x >> y >> z;
	result[0][0] = 1;
	long long int ng = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));
	long long int mask = (1 << 17) - 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < (1 << 17); j++){
			for(int k = 1; k <= 10; k++){
				long long int next = ((j << k) | (1 << (k - 1))) & mask;
				// cout << j << " " << k << " " << next << endl;
				if((next & ng) != ng) result[i + 1][next] = (result[i + 1][next] + result[i][j]) % mod;
			}
		}
	}
	long long int ans = 1;
	for(int i = 0; i < n; i++){
		ans = (ans * 10) % mod;
	}
	for(int i = 0; i < (1 << 17); i++){
		if(i != ng) ans = (ans - result[n][i] + mod) % mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 42240
package main

import (
	"fmt"
)

func main() {
	var S string;
	fmt.Scan(&S);
	l := len(S)
	ans := 0
	for i := 0; i < l; i++ {
		var ii int;
		for j := i; j < l; j++ {
			ii = j;
			if (S[j] != 'A' && S[j] != 'C' && S[j] != 'G' && S[j] != 'T') {
				break;
			}
			if (ans < j-i+1) {
				ans = j - i + 1;
			}
		}
		i = ii;
	}
	fmt.Println(ans);
}

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

using ll = long long;

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> l(n), r(n);
    vector<bool> ok(m);
    for(int i = 0; i < m; ++i) {
        int a, b; cin >> a >> b;
        l[a - 1].push_back(i);
        r[b - 1].push_back(i);
    }

    int ans = 0;
    vector<int> now;
    for(int i = 0; i < n; ++i) {
        for(auto idx : r[i]) {
            if(ok[idx]) continue;
            ok[idx] = true;
            ans += now.size() > 0;
            for(auto j : now) ok[j] = true;
            now.clear();
        }
        now.insert(end(now), begin(l[i]), end(l[i]));
    }

    cout << ans << endl;
}


Measured memory_bytes: 10624
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	nl := ""
	sss := make([][]string, h)
	for i := range sss {
		sss[i] = make([]string, w)
		for j := range sss[i] {
			fmt.Scanf("%1s", &sss[i][j])
		}
		fmt.Scanf("%1s", &nl)
	}
	_ = nl

	for i, ss := range sss {
		for j, s := range ss {
			if s == "#" {
				flag := false
				if i > 0 { // 上
					if sss[i-1][j] == "#" {
						flag = true
					}
				}
				if i < h-1 { // 下
					if sss[i+1][j] == "#" {
						flag = true
					}
				}
				if j > 0 { // 左
					if sss[i][j-1] == "#" {
						flag = true
					}
				}
				if j < w-1 { // 右
					if sss[i][j+1] == "#" {
						flag = true
					}
				}

				if flag == false {
					fmt.Println("No")
					return
				}
			}
		}
	}

	fmt.Println("Yes")

}


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

int N, W;
vector<int> values, weights;

const int MAX_W = 10010;
const int MAX_N = 110;
int memo[MAX_W][MAX_N];

int solve(int w_acc, int i)
{
  if (w_acc > W || i > N)
    return INT_MIN;
  if (w_acc == W || i == N)
    return 0;
  if (memo[w_acc][i] != -1)
    return memo[w_acc][i];

  return memo[w_acc][i] = max(
    solve(w_acc + weights[i], i+1) + values[i],
    solve(w_acc, i+1)
  );
}

int main()
{
  cin >> N >> W;
  values = vector<int>(N);
  weights = vector<int>(N);
  for (int i = 0; i < N; i++)
    cin >> values[i] >> weights[i];

  memset(memo, -1, sizeof(memo));
  cout << solve(0, 0) << endl;

  return EXIT_SUCCESS;
}




Measured memory_bytes: 7464
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<sstream>
#include<map>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll MOD =  1000000007;
const ll INF =  1LL << 60;
ll n, m, x, y,z,w,h, sum= 1, ans = 0;
vector<vector<bool>> b(310,vector<bool>(310,0));
bool f = 1;
bool fb[310]; // 列に＃があるかどうか
int main() {
    cin >> h >> w >> m;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    vector<vector<int>> a(h, vector<int>(w, 0));
    rep(i, h) {
        rep(j, w) {
            if (s[i][j] == '#') {
                a[i][j] = sum;
                sum++; // #の部分に番号を付ける
            }
        }
    }
    rep(i, h) {
        req(j, w -1) {
            if (a[i][j] == 0) a[i][j] = a[i][j - 1]; 
          // 横に沿って付ける（右向き）
        }
    }rep(i, h) {
        rrep(j, w - 1)if (a[i][j] == 0) a[i][j] = a[i][j + 1];
      // 左向き
    }
    rep(i, w) {
        req(j, h - 1) {// 縦に沿う下
            if (a[j][i] == 0) a[j][i] = a[j - 1][i];
        }
    }rep(i, w) {
        rrep(j, h - 1) {
            if (a[j][i] == 0) a[j][i] = a[j + 1][i];
        }
    }
    rep(i, h) {
        rep(j, w) cout << a[i][j] << " ";
        cout << endl;
    }
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#define rep(i, n) for (int i = 0; i < (n); i++)
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	double r;
	cin >> r;
	cout << fixed << setprecision(10) << r * r * 3.14159265358979 << " " << 2.0 * r * 3.14159265358979 << endl;
	return 0;
}


Measured memory_bytes: 3252
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.close();

		if (N % 2 == 0) {
			System.out.println(String.format("%.8f", 0.5));
		} else {
			double ans = Math.ceil(N / 2.0) / N;
			System.out.println(String.format("%.8f", ans));
		}
	}
}


Measured memory_bytes: 25300
def main():
    import sys
    
    s = sys.stdin.readline().strip()
    
    output = ""
    for i in range(len(s)):
        if s[i] == "B":
            output = output[:len(output)-1]
        else:
            output += s[i]
            
    print(output)
        
if __name__ == "__main__":
    main()

Measured memory_bytes: 38256
#include<stdio.h>
#include<string.h>
#define LEN 1000000

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head=1, tail=1, n;

void enqueue(P x){
  strcpy(Q[tail].name,x.name);
  Q[tail].t = x.t;
  if( tail + 1 == LEN )tail = 0;
  else tail++;

}

P dequeue(){
  P x;
  x = Q[head];
  if( head + 1 == LEN )head = 0;
  else head++;
  return x;
}


int main(){
  int elaps = 0, ans=0;
  int i, q, c=0, p_count=0;
  P u;

  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    if( strlen(Q[i].name) > 10 ){
      printf("%s\n", Q[i].name);
      p_count++;
      break;
    }
    scanf("%d", &Q[i].t);
    enqueue(Q[i]);
  }
  
  while(1){
    c++;
    if( n == p_count )break;
    if( Q[c].t - q > 0 ){
      ans += q;
      Q[c].t -= q;
      enqueue(Q[c]);
    }    
    else{
      ans += Q[c].t;
      printf("%s %d\n", Q[c].name, ans);
      p_count++;
      Q[c] = dequeue();
    }
  }

  return 0;
}

Measured memory_bytes: 21516
#include <iostream>
using namespace std;
int main(){
  int n;
  char str[100000] = {0};
  cin >> n;
  cin >> str;
  for(int i = 0; str[i] != 0 && str[i] != '\n'; i++){
    str[i] += n;
    if(str[i] > 'Z') str[i] -= 26;
  }
  cout << str << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  vector<int> a(4);
  rep(i,4) cin >> a[i];
  sort(all(a));
  if (a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;

int main() {
    int k, x;
    cin >> k >> x;

    for(int i = x - (k-1); i <= x + (k-1); i++) {
        cout << i << " ";
    }

    return 0;
}


Measured memory_bytes: 256