akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vii;
typedef vector<ll> vll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
 
ll H, n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    vll x(n), y(n), h(n);
    rep(i, 0, n) cin >> x[i] >> y[i] >> h[i];
    rep(i, 0, n) {
      if (h[i] != 0) {
        swap(h[i], h[0]);
        swap(x[i], x[0]);
        swap(y[i], y[0]);
      }
    }
    erep(xi, 0, 100) {
      erep(yi, 0, 100) {
        H = h[0] + abs(x[0] - xi) + abs(y[0] - yi);
        bool flag = true;
        rep(i, 0, n) {
          if (h[i] != max(0LL, H - abs(x[i] - xi) - abs(y[i] - yi)))
            flag = false;
        }
        if (flag) {
          cout << xi << " " << yi << " " << H << endl;
          return 0;
        }
      } 
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        
        if(y>=x*2 && y<= x*4 && y%2==0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

        sc.close();
    }
}

Measured memory_bytes: 35692
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        for (int i = 0; i < k; i++) {
            if (s.charAt(i) != '1') {
                System.out.println(s.charAt(i));
                return;
            }
        }
        System.out.println(1);
    }
}

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

int digsum(int n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    int ans = 1001001001;
    for (int i = 1; i < n; i++) {
        int su = digsum(i) + digsum(n-i);
        ans = min(su, ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define buf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double dob;
#define MAX 50010
#define M5 200009
#define M6 2000009
#define M 1000000007
#define INF 1e18
using namespace std;
typedef vector<ll> V;
typedef queue<ll > Q;
typedef stack<ll> S;
typedef pair<ll,ll> P;
#define mp make_pair
#define mt make_tuple
#define pb push_back
ll fac[M6],not_prime[M6],n,ar[M5],dp[M6],sum[M6];
string s[1009];
ll power(ll x,ll n)
{   if(n==0||x==0) return 1;
    else if(n%2 == 0) return power((x*x),n/2);
    else return (x*power((x*x),(n-1)/2));
}
void fact(){
    fac[0]=1;
    for(ll i=1;i<M6;i++) fac[i]=(i*fac[i-1])%M;
}
void sieve(){
    not_prime[1]=1; not_prime[0]=1;
    for(ll p=2;p*p<M6;p++){
        if(!not_prime[p]){
            for(ll i=p*2;i<=MAX;i+=p) not_prime[i]=1;
        }
    }
}
ll modi(ll a, ll m){
    ll m0 = m, t, q; ll x0 = 0, x1 = 1;
    if (m == 1) return 0;
    while (a > 1){  q = a / m; t = m; m = a % m, a = t;t = x0;x0 = x1 - q * x0; x1 = t;}
    if (x1 < 0) x1 += m0;return x1;
}
vector<list<ll> >g(M5);
int main(){
    buf; 
    //sieve(); 
    //fact();
    ll l,r,i,j,test,ans,m,q; string s;
    test=1;
    while(test--){
        cin>>n;
        map<ll,ll> vis;
        for(i=1;i<=n;i++) {cin>>ar[i]; vis[ar[i]-1]++; vis[ar[i]]++; vis[ar[i]+1]++;}
        ans=0;
        for(i=1;i<=n;i++) {ans=max(ans,vis[ar[i]-1]); ans=max(ans,vis[ar[i]+1]); ans=max(ans,vis[ar[i]]);}
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 13440
s = ""
while True:
    try:
        s += input()
    except:
        break
    
l = list(s.lower())
alphabet = list("abcdefghijklmnopqrstuvwxyz")
c = [l.count(alphabet[i]) for i in range(26)]
for i in range(26):
    print("{} : {}".format(alphabet[i],c[i]))

Measured memory_bytes: 7484
// g++ .cpp && ./a.out
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
 
typedef pair<int, int> p;
typedef long long ll;
 
const int mod = 1000000007;
const int inf = 1000000007;
 
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;
  ll tmp = 1000;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] < a[i + 1]) {
      ll cnt = tmp / a[i];
      tmp -= cnt * a[i];
      tmp += cnt * a[i + 1];
      //cout << tmp << endl;
    }
  }
  cout << tmp << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize(s)
using namespace std;
long long a,b,ans=65,n;
int main()
{
    cin>>a;
    for(int s=0;s<a;s++)
    {
        cin>>b;
        n=0;
        while(b%2==0)
        {
            b=b/2;
            n++;
        }
        ans=min(ans,n);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main () {
  string s;
  cin >> s;
  if(s == "RRR") cout << 3 << endl;
  else if(s == "RRS" || s == "SRR") cout << 2 << endl;
  else if(s == "SSS") cout << 0 << endl;
  else cout << 1 << endl;
  return 0;
}

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<ll> &s, ll a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


int main() {
    int n;
    cin >> n;
    vector<int> numbers(n);
    rep(i, n) cin >> numbers[i];


    int ans = numbers.front();
    for (int i = 1; i < n; i++) {
        int l = numbers[i - 1];
        int r = numbers[i];
        if (l >= r) continue;
        ans += r - l;
    }

    cout << ans << endl;


}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int a[200010];

int main() {
    ios_base::sync_with_stdio(0);
    int n, k; cin >> n >> k;
    for (int i=0;i<n;i++) cin >> a[i];
    for (int i=k;i<n;i++) {
        cout << (a[i]>a[i-k]? "Yes": "No") << endl;
    }
}


Measured memory_bytes: 4428
#include<bits/stdc++.h>
#define LL long long
using namespace std;
#define inf 0x3fffffff

int n,m,a[10];

int main()
{
    cin>>n>>m;
    int x,y;
    memset(a,-1,sizeof(a));
    int flag=0;
    for (int i=1;i<=m;i++)
    {
        cin>>x>>y;
        if (a[x]==-1) a[x]=y;
        else if (a[x]!=y) {flag=1;}
    }
    if (flag||n>1&&a[1]==0) puts("-1");
    else
    {
        if (n==1&&a[1]==-1) puts("0");
        else
        {
            if (a[1]==-1) a[1]=1;
            if (a[2]==-1) a[2]=0;
            if (a[3]==-1) a[3]=0;
            for (int i=1;i<=n;i++)
                cout<<a[i];
            cout<<endl;
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <limits>
using ll = long long;
constexpr int INF = std::numeric_limits<int>::max() / 2;
constexpr ll LNF = std::numeric_limits<ll>::max() / 2;

#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    auto callable = [=](int x, int y) { return abs(x - y) <= d; };
    cout << (callable(a, c) || (callable(a, b) && callable(b, c)) ? "Yes"
                                                                  : "No")
         << endl;

    return 0;
}


Measured memory_bytes: 768
n,x,m=map(int,raw_input().split())
i=0
v=[x]
t={x:0}
p=0 
start=0
while True: 
    i+=1
    y=(x*x)%m 
    if y in t: 
        p+=(i-t[y]) 
        start+=t[y]
        break 
    t[y]=i
    v.append(y) 
    x=y 
ans=0 

if n<(len(v)): 
    for i in range(n): 
        ans+=v[i] 
    print ans 
else: 
    for i in range(start): 
        ans+=v[i] 
    n-=(start) 
    g=n%p+start
    l=n/p 
    for i in range(start,len(v)): 
        ans+=(l*v[i]) 
        if i<g: 
            ans+=v[i] 
    print ans

    
    


Measured memory_bytes: 82068
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define go(u) for(int i = head[u], v = e[i].to; i; i=e[i].lst, v=e[i].to)
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define pb push_back
#define re(x) memset(x, 0, sizeof x)
inline int gi() {
    int x = 0,f = 1;
    char ch = getchar();
    while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
    return x * f;
}
template <typename T> inline bool Max(T &a, T b){return a < b ? a = b, 1 : 0;}
template <typename T> inline bool Min(T &a, T b){return a > b ? a = b, 1 : 0;}
const int N = 2e5 + 7;
int H, W, n, r, c;
char foo[N], bar[N];
bool solve(int R, int s, char add, char sub) {
	int l = 1, r = R;
	for(int i = n; i; --i) {
		if(bar[i] == add) --l;
		if(bar[i] == sub) ++r;
		Max(l, 1);
		Min(r, R);
		if(foo[i] == add) --r;
		if(foo[i] == sub) ++l;
		if(l > r) return 0;
	}
	return l <= s && s <= r;
}
int main() {
#ifdef fwat
#endif
	H = gi(), W = gi(), n = gi();
	r = gi(), c = gi();
	scanf("%s%s", foo + 1, bar + 1);
	puts(solve(H, r, 'D', 'U') && solve(W, c, 'R', 'L') ? "YES" : "NO");
	return 0;
}

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

int main() {
    string s, t;

    cin >> s >> t;

    string x = t;
    int ans = 0;
    for (int i = 0; x.size() <= s.size(); i++) {
        // check
        // cerr << "x: " << x << endl;
        int idx = 0;
        for (char ch : s) {
            if (idx < x.size() and ch == x[idx]) {
                idx++;
            }
        }
        if (idx != x.size()) break;

        ans++;

        long long size = x.size() * (t.size() + 1) + t.size();
        if (size > s.size()) break;

        string y = x;
        for (char ch : t) {
            y.push_back(ch);
            y += x;
        }
        x = y;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3352
#include "bits/stdc++.h"
using namespace std;

int main()
{
  string s;
  cin >> s;
  int c = s.find_last_of("C");
  int f = s.find_last_of("F");
  //cout << c << " " << f << endl;
  if(c != -1&& f != -1){
    if(c < f){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

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



ll max(ll x,ll y)
{
    if(x>y)
        return x;
    return y;
}       
ll min(ll x,ll y)
{

    if(x<y)
        return x;
    return y;
}

ll power(ll x, ll y) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
} 
     
    int main(){
    	
     
    	ll n, x, y;
    	cin >> n >> x >> y;
    	//print(n)
    	ll dp[n+1][n+1];
    	for(ll i=1;i<=n;i++){
    		for(ll j=1;j<=n;j++){
    			dp[i][j] = abs(i-j);
    		}
    	}
     
    	for(ll i=1;i<=n;i++){
    		for(ll j=1;j<=n;j++){
    			dp[i][j] = min(dp[i][j], dp[i][x]+1+dp[y][j]);
    			dp[i][j] = min(dp[i][j], dp[i][y]+1+dp[x][j]);
    		}
    	}
     
    	ll ok[n+1];
    	memset(ok, 0, sizeof(ok));
    	for(ll i=0;i<=n;i++){
    		for(ll j=1;j<i ;j++){
    			ok[dp[i][j]]++;
    		}
    	}
    	//print(n)
    	for(ll i=1;i<n;i++){
    		cout<<ok[i]<<"\n";	
    	}
    	return 0;
    }


Measured memory_bytes: 31488
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll n,m;
	ll o=0;

	cin>>n>>m;

	ll total=0;

	o=m/2;

	if(o>=n){
		m=m-2*n;
		total+=n;
	}else{
		cout<<o<<endl;
		return 0;
	}

	total+=m/4;
	cout<<total<<endl;

	return 0;
}


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

void f(int x, int y, int &ans) {
	int z = x;
	z -= y * 100;
	for (int i = 5; i > 0; i--) {
		if (z / i > y) {
			ans = 0;
			break;
		}
		y -= z / i;
		z -= i * (z / i);
		ans = 1;
	}
	return;
}

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

	int miny = x / 105;
	int maxy = x / 100;
	int ans = 0;

	for (int i = maxy; i >= miny; i--) {
		f(x, i, ans);
		if (ans == 1) break;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;

int num[108];

void decode(int l, int k[300], char s[108], char alph[56])
{	
	for(int i = 0; i < l; i++){
		if(s[i] >= 'a' && s[i] <= 'z'){
			num[i] = s[i] - 'a';
		}
		else{
			num[i] = s[i] - 'A' + 26;
		}
		if(num[i] - k[i] < 0){
			num[i] += 52 - k[i];
		}
		else{
			num[i] -= k[i];
		}
		cout << alph[num[i]];
	}
	puts("");
}


int main()
{
	int n, m, l;
	int k[300];
	char s[108];
	char alph[56];
	
	for(int i = 0; i < 26; i++){
		alph[i] = 'a' + i;
	}
	for(int i = 0; i < 26; i++){
		alph[i + 26] = 'A' + i;
	}

	
	while(scanf("%d", &n) != EOF){
		if(n == 0) break;
		for(int i = 0; i < n; i++){
			cin >> k[i];
		}
		cin >> s;
		
		m = n;
		l = strlen(s);
		while(l > m){
			for(int i = 1; i <= n; i++){
				k[m + i - 1] = k[i - 1];
			}
			m += n;
		}
		decode(l, k, s, alph);
	}
	return 0;
}	

Measured memory_bytes: 1212
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int D;
	int x, y;	
	char a, b, c;
	int p[100] = {0}, q[100] = {0};
	int i = 0;
	int s;

	cin >> D;
	cin >> x;
	while(x--){
		cin >> a >> s;
		if(a == 'D'){
			p[i] = s;
			i++;
		}
	}

	sort(p, p + i);

	cin >> y;	
	int j = 0;
	while(y--){
		cin >> b >> c >> s;
		if(b == 'D' && c == 'D'){
		       	q[j] = s;
			j++;
		}
	}

	sort(q, q + j);

	int ans = 0;

	i--;
	j--;	
	while(D){
		if(D == 1){
			if(i >= 0){
				ans += p[i];
				break;
			}
			else break;
		}
		else if(i > 0){
			if(p[i] + p[i - 1] >= q[j] || j < 0){
				ans += p[i];
				i--;
				D--;
			}
			else{
				ans += q[j];
				j--;
				D -= 2;
			}
		}
		else if(i == 0){
			if(p[i] > q[j] || j < 0){
				ans += p[i];
				i--;
				D--;
			}
			else if(j >= 0){
				ans += q[j];
				j--;
				D -= 2;
			}
		}
		else{
			if(j >= 0){
				ans += q[j];
				j--;
				D -= 2;
			}
			else break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1180
#include<stdio.h>

int main()
{
	int N, X, T;
		scanf("%d", &N);
		scanf("%d", &X);
		scanf("%d", &T);
		if(N%X==0)
		{
			printf("%d", T*(N/X));
		}
		else{
		printf("%d", T*(N/X+1));
		}

	return 0;
}

Measured memory_bytes: 1704
#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;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

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

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)



void solve() 
{
    int a[6];
    for(int i = 1; i<=5; i++)
    {
        cin>>a[i];
        if(a[i]==0)
            cout<<i;
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int tc = 1; 
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t  << ": ";
        solve();
    }
}


Measured memory_bytes: 3580
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
const double EPS = 1e-9;
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int a,b;
  cin >> a >> b;

  cout << max({a+b,2*a-1,2*b-1}) << endl;

  return 0;
}

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

typedef long long ll;
typedef vector<ll> vll;
const ll MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string a;
    unordered_map<char, int> hashMap(26);
    for (auto c : s) {
        if (hashMap.find(c) != hashMap.end()) {
            ++hashMap[c];
        } else {
            hashMap[c] = 1;
        }
    }
    int ans = -1;
    int cur = 0;
    set<char> st;
    for (int i = 1; i < n; ++i) {
        st.clear();
        cur = 0;
        a += s[i - 1];
        --hashMap[s[i - 1]];
        for (auto c : a) {
            if (st.find(c) == st.end()) {
                if (hashMap.find(c) != hashMap.end() && hashMap[c] > 0) {
                    ++cur;
                }
                st.insert(c);
            }
        }
        ans = max(cur, ans);
    }
    cout << ans << endl;
    return 0;
}

static int speedUp = []() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();


Measured memory_bytes: 256
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    g = gcd(a, b)

    return a * (b // g)


def main():
    A, B, C, D = map(int, input().split())
    c = B // C - (A - 1) // C
    d = B // D - (A - 1) // D
    tmp = lcm(C, D)
    both = B // tmp - (A - 1) // tmp
    print(B - A + 1 - c - d + both)
    return


main()


Measured memory_bytes: 3060
<?php
    fscanf(STDIN,'%d',$k);
    fscanf(STDIN,'%d %d',$a,$b);

    $ans = 'NG';
    for($index=$a;$index<=$b;++$index){
        if($index % $k === 0){
            $ans = 'OK';
            break;
        }
    }
    echo $ans.PHP_EOL;

?>

Measured memory_bytes: 16168
#include <iostream>
#include <bits/stdc++.h>
 
using namespace std;
 
 
int main() {
  
   string s;
  cin>>s;
  
  if(s.length()==2)
       cout<<s;
  
  else
  {
    reverse(s.begin(),s.end());
         cout<<s;
            }
            
    	return 0;
} 

Measured memory_bytes: 256
#include <cstdio>
#include <stack>
#include <cstring>

using namespace std;

const int N = 2e5 + 500;

stack < char > st;
char s[N];
int n;

int main(){
    scanf("%s", s);
    n = strlen(s);
    for(int i = 0;i<n;i++){
        if(!st.empty() && s[i] == 'T' && st.top() == 'S'){
            st.pop();continue;
        }
        st.push(s[i]);
    }
    printf("%d\n", st.size());
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for(int i = (int)m; i < (int)n; i++)

const vector<string> s = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
string S;

int main() {
    cin >> S;
    REP(i, s.size()) {
        if(s[i] == S) cout << 7 - i << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	int a = n % 10;
	int b = (n - a) % 100 / 10;
	int c = (n - a) / 100;
	if(a == 7 || b == 7 || c == 7){
		printf("Yes");
	}
	else {
		printf("No\n");
	}
	return 0;
}

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

int dy1[6]={0,1,1,1,0,-1},dy2[6]={-1,0,1,0,-1,-1},dx[6]={-1,-1,0,1,1,0},v[102][102],I[102][102],W,H,k=0;

void dfs(int x, int y)
{
	v[x][y]=1;
	if(x%2==0)
	{
		for(int i=0;i<=5;i++)
		{
			if(x+dx[i]>=0 && x+dx[i]<=H+1 && y+dy2[i]>=0 && y+dy2[i]<=W+1 && v[x+dx[i]][y+dy2[i]]==0)
			{
				if(I[x+dx[i]][y+dy2[i]]==0)
				{
					dfs(x+dx[i],y+dy2[i]);
				}
				else
				{
					k++;
				}
			}
		}
	}
	else
	{
		for(int i=0;i<=5;i++)
		{
			if(x+dx[i]>=0 && x+dx[i]<=H+1 && y+dy1[i]>=0 && y+dy1[i]<=W+1 && v[x+dx[i]][y+dy1[i]]==0)
			{
				if(I[x+dx[i]][y+dy1[i]]==0)
				{
					dfs(x+dx[i],y+dy1[i]);
				}
				else
				{
					k++;
				}
			}
		}
	}
	return;
}

int main()
{
	int i,j;
	
	cin >> W >> H;
	for(i=0;i<=W+1;i++)
	{
		I[0][i]=0;
		v[0][i]=0;
	}
	for(i=1;i<=H;i++)
	{
		I[i][0]=0;
		v[i][0]=0;
		for(j=1;j<=W;j++)
		{
			cin >> I[i][j];
			v[i][j]=0;
		}
		I[i][W+1]=0;
		v[i][W+1]=0;
	}
	for(i=0;i<=W+1;i++) 
	{
		I[H+1][i]=0;
		v[H+1][i]=0;
	}
	
	dfs(0,0);
	
	cout << k << endl;
	return 0;
}

Measured memory_bytes: 3332
#include<iostream>
#include<string.h>
using namespace std;

int cut(int n){
	if(n<0) return 0;
	if(n>255) return 255;
	return n;
}

		int dp[20001][256];
int main()
{
	int N,M;
	while(cin>>N>>M && N!=0){
		int book[16],signal[20000];
		memset(book,-1,sizeof(bool));
		memset(signal,-1,sizeof(signal));

		for(int i=0;i<M;i++)
			cin>>book[i];
		for(int i=0;i<N;i++)
			cin>>signal[i];


		memset(dp,-1,sizeof(dp));
		dp[0][128]=0;

		for(int i=0;i<N;i++){
			for(int j=0;j<=255;j++){
				if(dp[i][j]<0) continue;
				for(int k=0;k<M;k++){
					if(dp[i+1][cut(j+book[k])]<0)
						dp[i+1][cut(j+book[k])]=dp[i][j]+(signal[i]-cut(j+book[k]))*(signal[i]-cut(j+book[k]));
					else dp[i+1][cut(j+book[k])]=min(dp[i+1][cut(j+book[k])],dp[i][j]+(signal[i]-cut(j+book[k]))*(signal[i]-cut(j+book[k])));
					
				}
			}
		}
		int ans=100000000;

		for(int i=0;i<=255;i++){
			if(dp[N][i]>=0)
				ans=min(ans,dp[N][i]);
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define scan(a,n) for(long long int index=0;index<n;index++) cin>>a[index];
#define print(a,n) for(long long int index=0;index<n;index++) cout<<a[index]<<" ";cout<<endl;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define vli vector<long long int>
#define vlli vector<pair<long long int,long long int>>
#define vsi vector<string>
#define vci vector<char>
#define all(n) n.begin(),n.end()
#define forr(i,a,b) for(i=a;i<b;i++)
#define forrr(i,a,b) for(i=b-1;i>=a;i--)


 
int main() {
   #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ll t;
    t=1;
    while(t--){
      ll n;
      cin>>n;
      ll ans=0;
      ll x,y,z=sqrt(n),i;
      for(i=1;i<=sqrt(n);i++){
         x=n/i;
         ans+=(x-i+1)*2 -1;
         if(n%i==0) ans-=2;
      }
      if(z*z==n) ans++;
      cout<<ans;

        }
   
return 0;    
 }  

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

    typedef long long int ll;
    #define pb         push_back
    #define mp         make_pair
    #define F          first
    #define S          second
    #define fl(i,a,b)  for(ll i=a;i<b;i++)
    #define pll        pair<ll,ll>
    #define pii        pair<int,int>
    #define all(v)     v.begin(),v.end()
    #define M 1000000007
    #define tr(v, it) for(auto it = v.begin(); it != v.end(); it++)
    using namespace std;



    int main()
    {

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

          ll n,w;
          cin>>n>>w;
          ll val[n];
          ll weight[n];
          for(int i=0; i<n; i++)
          {
              cin>>weight[i]>>val[i];
          }

        ll dp[n+1][w+1];
        for(int i=0; i<=n; i++)
        {
            for(int j=0; j<=w; j++)
            {
                if(i==0 || j==0)
                    dp[i][j]=0;

                else
                {
                    if(weight[i-1]<=j)
                    dp[i][j]= max((dp[i-1][j-weight[i-1]]+val[i-1]), dp[i-1][j]);
                    else
                        dp[i][j]=dp[i-1][j];
                }
            }
        }

        cout<<dp[n][w];


       return 0;
    }


Measured memory_bytes: 82440
#include <cstdio>
#include <cctype>
typedef long long ll;

template <typename _tp> inline void read(_tp&x){
	char ch=getchar(),ob=0;x=0;
	while(ch!='-'&&!isdigit(ch))ch=getchar();if(ch=='-')ob=1,ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();if(ob)x=-x;
}

const int N = 201000;
struct Edge {int v, nxt;} a[N*4];
int head[N], Head[N], indeg[N];
int sz[N], pr[N];
bool vis[N];
int n, _;

inline void add(int x, int y, int*arr) {
	a[++_].v = y, a[_].nxt = arr[x], arr[x] = _;
}

const int p = 1e9+7;
int fac[N], ifac[N], inv[N];

int st[N], tp;
#define FID(i) for(int id=1,i;i=st[id],id<=tp;++id)

int X, Y;
int et, pt;

void bfs(int x, int las) {
	vis[st[++tp] = x] = true, ++pt;
	for(int i=head[x];i;++et,i=a[i].nxt)
		if(!vis[a[i].v]) bfs(a[i].v, x);
		else if(a[i].v != las) X = x, Y = a[i].v;
}

void tfs(int x, int las) {
	for(int i=head[x];i;i=a[i].nxt)
		if(a[i].v != las and a[i].v != X)
			pr[a[i].v] = x, tfs(a[i].v, x);
}

void dfs(int x, int las) {
	sz[x] = 1;
	for(int i=Head[x];i;i=a[i].nxt)
		if(a[i].v != las)
			dfs(a[i].v, x), sz[x] += sz[a[i].v];
}

int solve() {
	tfs(X, Y);
	pr[X] = Y;
	FID(i) Head[i] = indeg[i] = 0;
	FID(x) for(int i=head[x];i;i=a[i].nxt)
		if(a[i].v < pr[x]) add(x, a[i].v, Head), ++indeg[a[i].v];
	
	FID(i) if(!indeg[i]) dfs(i, i);
	int Ans = fac[pt];
	FID(i) Ans = (ll)Ans * inv[sz[i]]%p;
	return Ans;
}

int main() {
	read(n);
	for(int i=1,x,y;i<=(n<<1);++i) {
		read(x), read(y), y += n;
		add(x, y, head), add(y, x, head);
	}
	
	n <<= 1;
	fac[0] = fac[1] = inv[0] = inv[1] = ifac[0] = ifac[1] = 1;
	for(int i=2;i<=n;++i) {
		fac[i] = (ll)fac[i-1] * i%p;
		inv[i] = (ll)(p-p/i) * inv[p%i]%p;
		ifac[i] = (ll)ifac[i-1] * inv[i]%p;
	}
	
	int Ans = fac[n];
	for(int i=1;i<=n;++i)
		if(!vis[i]) {
			tp = pt = et = 0;
			bfs(i, i);
			Ans = (ll)Ans * ifac[pt]%p;
			if((pt << 1) != et) return puts("0"), 0;
			int res = solve();
			X ^= Y, Y ^= X, X ^= Y;
			res += solve();
			Ans = (ll)Ans * res%p;
		}
	printf("%d\n", Ans);
	return 0;
}

Measured memory_bytes: 16376
import math
n = int(input())

a = []
b = []
c = []
for _ in range(n):
	x,y,z = list(map(int,input().split()))
	a.append(x)
	b.append(y)
	c.append(z)
 
dp = [[0 for _ in range(3)] for j in range(n)]
dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]

for i in range(1,n):
	dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i]
	dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i]
	dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i]
 
print(max(dp[n-1][0], dp[n-1][1], dp[n-1][2]))

Measured memory_bytes: 40596
import math
n=int(input())
csf=[list(map(int,input().split())) for _ in range(n-1)]

for i in range(n):
    ans=0
    for j in range(i,n-1):
        c,s,f=map(lambda x:x,csf[j])
        if ans<=s: ans=s+c
        else: ans=math.ceil(ans/f)*f+c

    print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
const ll MOD = 1e9+7;
 
int main(){
	ios::sync_with_stdio(false); cin.tie(0);
 
	int n, m; cin >> n >> m;
	vi v(n);
	ll sum = 0;
	FOR(i, n){
		cin >> v[i];
		sum += v[i];
	}

	sort(all(v));
	reverse(all(v));

	int k = m;
	FOR(i, n){
		if(4*m*v[i] < sum) break;
		k--;
	}
	if(k > 0) cout << "No\n";
	else cout << "Yes\n";
 
	return 0;
}

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

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> r;
    r.push_back(a + b);
    r.push_back(a + c);
    r.push_back(b + c);
    r.push_back(a * 10 + b + c);
    r.push_back(b * 10 + c + a);
    r.push_back(c * 10 + a + b);
    sort(r.begin(), r.end());
    cout << r.back() << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>   
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main() {
int n, k;
int ans = 0;
cin >> n >> k;
vector <int> p(n);
rep(i, n) cin >> p[i];
sort(p.begin(), p.end());

rep(i, k) ans += p[i];

cout << ans << endl;


  return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1000 * 1000 * 1000 + 7;
ll mul(ll a, ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a, ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll sub(ll a, ll b)
{
	return ((a%mod)-(b%mod)+mod)%mod;
}
ll n,m;
ll a[102][102];
ll dp[102][102];
ll ch(ll x, ll y)
{
	if(dp[x][y]!=-1)
	{
		return dp[x][y];
	}
	if(x==0 && y==0)
	{
		dp[x][y]=0;
		return dp[x][y];
	}
	if(x==0)
	{
		if(a[x][y-1]==1 && a[x][y]==0)
		{
			dp[x][y]=1;
		}
		else
		{
			dp[x][y]=0;
		}
		dp[x][y]+=ch(x,y-1);
		return dp[x][y];
	}
	if(y==0)
	{
		if(a[x-1][y]==1 && a[x][y]==0)
		{
			dp[x][y]=1;
		}
		else
		{
			dp[x][y]=0;
		}
		dp[x][y]+=ch(x-1,y);
		return dp[x][y];
	}
	ll u1,u2;
	if(a[x-1][y]==1 && a[x][y]==0)
	{
		u1=1;
	}
	else
	{
		u1=0;
	}
	u1+=ch(x-1,y);;
	if(a[x][y-1]==1 && a[x][y]==0)
	{
		u2=1;
	}
	else
	{
		u2=0;
	}
	u2+=ch(x,y-1);;
	dp[x][y]=min(u1,u2);
	return dp[x][y];
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(ll i=0;i<n;i++)
	{
		string s;
		cin>>s;
		for(ll j=0;j<s.size();j++)
		{
			dp[i][j]=-1;
			if(s[j]=='.')
			{
				a[i][j]=0;
			}
			else
			{
				a[i][j]=1;
			}
		}
	}
	ll u;
	if(a[n-1][m-1]==1)
	{
		u=ch(n-1,m-1)+1;
	}
	else
	{
		u=ch(n-1,m-1);
	}
	cout<<u;
}


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

int main(){
    int N;
    cin >> N;
    int a[1000000];
    long long ans = 0;
    for(int i = 0; i < 3*N; i++){
        cin >> a[i];
    }

    sort(a,a + 3*N, greater<int>());

    for(int i = 0; i < N ; i++){
        ans += a[1 + 2*i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using  namespace  std;
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'
 
typedef long long int ll;
typedef unsigned long long int  llu;


int main()
{
	faster
	int n;
	cin>>n;
	if(n==0)cout<<1;
	else cout<<0<<nl;
	return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;
ll INF = 1e18;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
    bool flag=false;
	rep(i, n){
      cin >> a[i];
      if(a[i]==0) flag=true;
    }
    if(flag){
      cout<<0<<endl;
      return 0;
    }
	ll sum = 1;
	rep(i, n) {
		if (sum > (INF / a[i])) {
			cout << -1 << endl;
			return 0;
		}
		sum *= a[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 3996
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d= new int[100001];
		for(int i=0;i<n;i++){
			d[sc.nextInt()]++;
		}
		int o=0;
		int e=0;
		for(int i=0;i<=100000;i++){
			if(d[i]!=0){
				if(d[i]%2==0){
					e++;
				}else{
					o++;
				}
			}
		}
		int sum=o+2*(e/2);
		System.out.println(sum);
		
	}
}

Measured memory_bytes: 49228
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main() {
    int N;
    int A[1000];
    int B = 0;
    int D = 0;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int i=0;i<N;i++){
        if(A[i]%2==0){
            B++;
            if (A[i]%3==0 || A[i]%5==0){
                D++;
            }
        }
    }
    if(B == D)
        cout << "APPROVED";
    else
        cout << "DENIED";

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"
 
#define sz(a) ((int)(a).size())
#define all(v) (v).begin(), (v).end()
#define tr(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); it++)
#define pres(c, val) ((c).find(val) != (c).end())      //
#define cpres(c, val) (find(all(c), val) != (c).end()) //
 
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define forf(i, a, b) for (int i = (a); i < (b); i++)
#define forb(i, a, b) for (int i = (b); i >= (a); i--)
#define fo(i, n) forf(i, 0, n)
#define fob(i, n) forb(i, 0, n - 1)
 
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
 
const int INF = 9e18;
// const int N = 1e9 + 7;
const int N = 998244353;
 
const auto start_time = std::chrono::high_resolution_clock::now();
 
void zark() {
  #ifdef ZARK
  auto end_time = std::chrono::high_resolution_clock::now();
  std::chrono::duration<double> diff = end_time - start_time;
  cerr << "Time Taken : " << diff.count() << "s\n";
  #endif
}
 
#ifdef ZARK
#include "/home/aranjan/Desktop/CP/header.h"
#else
#define dbg(args...)
#endif
 
/* ------------------ Actual Coding Starts ------------------ */
 
bool ispow5(int n) {
  int x = pow(n, 0.2);
  return x*x*x*x*x == n;
}
 
void solve() {
  int x;
  cin >> x;
  fo(i, pow(x, 0.2)) {
    if(ispow5(x-i*i*i*i*i)) {cout << pow(x-i*i*i*i*i, 0.2) << " " << -i << endl; return;}
  }
  for(int d = 1; d*d <= x; d++) {
    int k = x/d;
    for(int b = 0; pow((b+d), 4) +pow((b+d), 3)*b + (b+d)*(b+d)*b*b + (b+d)*b*b*b + b*b*b*b <= k; b++) {
      if( pow((b+d), 4) +pow((b+d), 3)*b + (b+d)*(b+d)*b*b + (b+d)*b*b*b + b*b*b*b == k ) {cout << b+d << " " << b << endl; return;}
    }
    for(int b = 0; pow((b+k), 4) +pow((b+k), 3)*b + (b+k)*(b+k)*b*b + (b+k)*b*b*b + b*b*b*b <= d; b++) {
      if( pow((b+k), 4) +pow((b+k), 3)*b + (b+k)*(b+k)*b*b + (b+k)*b*b*b + b*b*b*b == k ) {cout << b+k << " " << b << endl; return;}
    }
  }
}
 
int32_t main() {
  fastio;
  #ifdef ZARK
  freopen("input.in", "r", stdin);
  #endif
 
  // freopen("txt.in", "r", stdin);
  // freopen("txt.out", "w", stdout);
  // cout << fixed << setprecision(35);
 
  solve();
  zark();
  return 0;
}

Measured memory_bytes: 4116
#include <iostream>
#include <queue>
#include <utility>

using namespace std;

typedef pair<int, int> P;

const int MAX_N = 400;

const int di[] = {1, 0, -1, 0};
const int dj[] = {0, 1, 0, -1};

bool color[MAX_N][MAX_N];
int H, W;

char ch[MAX_N + 1];

void input() {
    scanf("%d%d", &H, &W);
    for (int i = 0; i < H; i++) {
        scanf("%s", ch);
        for (int j = 0; j < W; j++) {
            color[i][j] = (ch[j] == '#');
        }
    }
}

bool isin_(int i, int j) {
    return i >= 0 and i < H and j >= 0 and j < W;
}

bool check_(int i, int j, int d) {
    int ni = i + di[d];
    int nj = j + dj[d];
    if (!isin_(ni, nj)) return false;
    if (color[i][j] == color[ni][nj]) return false;
    return true;
}

bool used[MAX_N][MAX_N];

long long solve() {
    long long ans = 0;
    long long b = 0, w = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (used[i][j]) continue;
            b = 0; w = 0;
            queue<P> que;
            used[i][j] = true;
            que.push(P(i, j));
            while(!que.empty()) {
                P p = que.front();
                que.pop();
                int ci = p.first, cj = p.second;
                if (color[ci][cj]) b++;
                else w++;
                for (int d = 0; d < 4; d++) {
                    if (!check_(ci, cj, d)) continue;
                    int ni = ci + di[d], nj = cj + dj[d];
                    if (used[ni][nj]) continue;
                    used[ni][nj] = true;
                    que.push(P(ni, nj));
                }
            }
            ans += b * w;
        }
    }
    return ans;
}

int main() {
    input();
    long long ans = solve();
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int min = 101;
        for (int i = 0; i < 27; i++) {
            boolean hit = false;
            int count = 0;
            int maxChain = 0;
            char target = (char) ('a' + i);
            for (char c : S.toCharArray()) {
                if (target == c) {
                    hit = true;
                    maxChain = Math.max(maxChain, count);
                    count = 0;
                } else {
                    count++;
                }
            }
            if (hit) {
                maxChain = Math.max(maxChain, count);
                min = Math.min(min, maxChain);
            }
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 35760
#include <iostream>

using namespace std;

/*
解法
正方形である性質を生かして、ベクトルで２つの点を求める
*/


int main() {

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    cout << x2 + y1 - y2 << " "
         << y2 + x2 - x1 << " "
         << x1 + y1 - y2 << " "
         << y1 + x2 - x1 << endl;

    return 0;
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

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

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n;
  cin >> n;
  string s;
  cin >> s;
  int64_t r = 0;
  int64_t g = 0;
  int64_t b = 0;
  
  for(auto c:s){
    if(c=='R') r++;
    else if (c=='G') g++;
    else if (c=='B') b++;
  }

  int64_t total;
  total = r*g*b;
  if(n<3){
    cout << total << endl;
    return 0;
  }
  for(int64_t i=1;i<=n/2;i++){
    for(int64_t j=0;j<n-i*2;j++){
      if(s[j]!=s[j+i]
         &&s[j]!=s[j+2*i]
         &&s[j+i]!=s[j+2*i]
        ){
        total--;
      }
    }
  }
  
  cout << total << endl;
  
  return 0;
}



Measured memory_bytes: 3700
n, m = gets.split.map &:to_i
A = Array.new(m){gets.to_i}

dp = Array.new(n+2,0)
dp[0] = 1
m.times do |i|
  dp[A[i]] = nil
end

0.upto(n-1) do |i|
  1.upto(2) do |j|
    if dp[i] && dp[i+j]
      dp[i+j] += dp[i]
    end
  end
  
end

  p dp[n] % 1000000007


Measured memory_bytes: 856444
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <deque>
using namespace std;
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
typedef long long ll;

int main(){
	ll q;
	string input;
	cin >> input >> q;
	deque<char> s;
	bool reverse = false;
	REP(i,input.size()){
		s.push_back(input[i]);
	}
	ll t,f;
	char c;
	REP(i,q){
		cin >> t;
		if(t==1){
			reverse = !reverse;
		}else{
			cin >> f >> c;
			if((f==2 && reverse) || (f==1 && !reverse)){
				s.push_front(c);
			}else{
				s.push_back(c);
			}
		}
	}
	
	
	REP(i,s.size()){
		if(reverse) cout << s[(ll)s.size()-1-i];
		else cout << s[i];
	}
	cout << endl;
	
	
	
	return 0;
}

Measured memory_bytes: 4016
#include <stdio.h>
#include <math.h>

int main(void){
  int n;
  float t,a;
  scanf("%d\n", &n);
  scanf("%f %f\n", &t, &a);
  float h[n];
  for(int i=0; i<n; i++)
    scanf("%f\n", &h[i]);
  float pred[n];
  for(int i=0; i<n; i++)
    pred[i] = t-h[i]*0.006;
  int answer = 0;
  for(int i=0; i<n; i++){
    if(fabsf(pred[answer]-a)>=fabsf(pred[i]-a))
      answer = i;
  }
  printf("%d", answer+1);
  return 0;
}

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

using namespace std;

struct item { // value and weight for each item
  int value; 
  int weight;
};





int main()
{
  int N, W; // no. of inputs, max weight
  cin >> N >> W;

  vector< vector<int> > grid(N, vector<int>(W+1, 0)); // table for DP
  
  
  vector<item> items(N); // array to store item properties

  for (int i = 0; i < N; ++i) {
    item cur_item;
    cin >> cur_item.value >> cur_item.weight;
    items[i] = cur_item;
  }

  for (int i = 0; i <= W; ++i) {
    grid[0][i] = (items[0].weight <= i)?items[0].value:0; //initialize first row
  }

  for(int i = 1; i < N; ++i) {
    for (int j = 1; j <= W; ++j) {
      if (items[i].weight <= j) {
	grid[i][j] = max(items[i].value + grid[i-1][j-items[i].weight], grid[i-1][j]);
      } else {
	grid[i][j] = grid[i-1][j];
      }
    }
  }

  

    cout << grid[N-1][W] << endl;
  
  return 0;
}

Measured memory_bytes: 4956
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
#define pb push_back
#define NeedForSpeed ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
#define SET(x, y) memset((x), y, sizeof(x))
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll INF64 = 1e18;

template <typename T>
string to_string(const vector<T> &v) {
  string ret = "<";
  for (auto it : v)
    ret += to_string(it) + ", ";
  ret.pop_back(); ret.pop_back();
  ret += ">";
  return ret;
}

string to_string(const string &s) {
  return '"' + s + '"';
}

string to_string(bool b) {
  return b ? "true" : "false";
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

void debug_print() { cerr << endl; }

template <typename T, typename ...U>
void debug_print(T t, U... u) {
  cerr << " " << to_string(t);
  debug_print(u...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_print(__VA_ARGS__)
const int N = 1e5 + 5;

int main() {
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  ll a = x / d;
  if (a >= k) {
    cout << x - k * d << endl;
  } else {
    if ((k - a) % 2 == 0) {
      cout << abs(x - a * d) << endl;
    } else  cout << abs(x - (a + 1) * d) << endl;
  }
  return 0;
}


Measured memory_bytes: 3620