akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>
#include <functional>

using namespace std;
using lint = long long;
using pii = pair<int, int>;
using vec = vector<int>;
using pq = priority_queue<int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define mp(x, y) make_pair((x), (y))
#define space " "

constexpr lint MOD = 1e9 + 7;
// int A, B, C, F, H, I, J, K, L, M, N, P, Q, S, T, U, W, X, Y;
// lint A, B, F, H, I, J, K, L, M, N, P, Q, S, T, U, W, X, Y;
// int ans = 0;
// string ans;
int N, Q, T, I, L, R;
string S;
char C;
vector<set<int>> idx(26);
vector<int> ans;

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

	cin >> N >> S >> Q;
	rep(i, N) {
        idx[S[i]-'a'].insert(i);
	}
	
	rep(i, Q) {
		cin >> T;

		if (T == 1) {
			cin >> I >> C;
			I--;
            if (S[I] != C) {
			    idx[S[I]-'a'].erase(I);
                idx[C-'a'].insert(I);
                S[I] = C;
            }
		} else {
			cin >> L >> R;
			L--; R--;
			int rst = 0;
			rep(i, 26) {
				if (idx[i].empty()) {
                    continue;
                }
                auto it = idx[i].lower_bound(L);
				if (*it <= R && it != idx[i].end()) {
                    rst++;
                }
			}
			ans.push_back(rst);
		}
	}

	foreach(it, ans) {
		cout << *it << endl;
	}
	return 0;
}

Measured memory_bytes: 26524
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>



using namespace std;

int w[200005];

int main(){
	for(int i=0;i<200005;i++)w[i] = 0;
	int j;cin>>j;
	string s;
	cin>>s;
	int bb =0;
	int ww =0;
	for(int i=s.length()-1;i>=0;i--){
		if(s[i]=='.') ww++;
		w[i] = ww;
	}
	int ans = 1000000;
	for(int i=0;i<s.length();i++){
		if(s[i]== '#') bb++;
		ans = min(ans, bb+w[i+1]);
	}
	ans = min(ans,w[0]);
	cout<<ans<<endl;
	return 0;

}

Measured memory_bytes: 1412
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
int main()
{
    int n;
    scanf("%d",&n);
    int s=0;
    while(n){
        if(n%10==2) s++;
        n/=10;
    }
    printf("%d\n",s);
}


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#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 <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD = 1000000007
#define INF (1e9)
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;


int main()
{
    ll N;
    cin >> N;
    if (N % 2 == 0) print(N);
    else print(2*N);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define y second
#define x first
#define lsb(x) (x&-x)
#define pb push_back
#define y second
const int NMAX=2666; //LOL
const int MOD=1000000007; //LOL
const int SQRT=350;
using namespace std;
const int INF=1000000007;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;

LL a,b,c;
int curr[NMAX];
int currpos[NMAX];
int A[NMAX];
int Next[NMAX], Prev[NMAX];
LL n,x;
int main()
{
	//freopen("input.in", "rt", stdin);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	LL rs=0;	
	cin>>n>>x;
	for(int i=1; i<=n; ++i)
	{
		cin>>A[i];
		rs+=A[i];
	}

	for(int i=1; i<=n; ++i)
		Next[i]=i+1, Prev[i]=i-1;
	Next[n]=1;
	Prev[1]=n;
	for(int i=1; i<=n; ++i)
	{
		currpos[i]=i;
		curr[i]=A[i];
	}
	for(int i=1; i<=n-1; ++i)
	{
		LL nrs=0;
		for(int i=1; i<=n; ++i)
		{
			currpos[i]=Prev[currpos[i]];
			curr[i]=min(curr[i], A[currpos[i]]);
			nrs+=curr[i];
		}
		rs=min(rs, nrs+1LL*x*i);
	}
	cout<<rs;
	return 0;
} 








Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
struct Point{double x,y;};
Point operator -(Point a,Point b){return (Point){a.x-b.x,a.y-b.y};}
double cross(Point a,Point b){return a.x*b.y-a.y*b.x;}
double dot(Point a,Point b){return a.x*b.x+a.y*b.y;}
double norm(Point a){return a.x*a.x+a.y*a.y;}
double abs(Point a){return sqrt(norm(a));}
void read(Point &a){a.x=read(),a.y=read();}
int Clockwise(Point p0,Point p1,Point p2)
{
	Point v1=p1-p0,v2=p2-p0;
	if(cross(v1,v2)>0)return -2;
	if(cross(v1,v2)<0)return 2;
	if(dot(v1,v2)<0)return -1;
	if(norm(v1)<norm(v2))return 1;
	return 0;
}
bool intersectSS(Point p0,Point p1,Point p2,Point p3)
{
	if(Clockwise(p0,p1,p2)*Clockwise(p0,p1,p3)>0)return 0;
	if(Clockwise(p2,p3,p0)*Clockwise(p2,p3,p1)>0)return 0;
	return 1;
}
double getdistanceLP(Point p0,Point p1,Point p2)
{
	double x=fabs(cross(p1-p0,p2-p0));
	return x/abs(p1-p0);
}
double getdistanceSP(Point p0,Point p1,Point p2)
{
	if(dot(p1-p0,p2-p0)<0)return abs(p2-p0);
	if(dot(p0-p1,p2-p1)<0)return abs(p2-p1);
	return getdistanceLP(p0,p1,p2);
}
double getdistanceSS(Point p0,Point p1,Point p2,Point p3)
{
	if(intersectSS(p0,p1,p2,p3))return 0;
	return min(min(getdistanceSP(p2,p3,p0),getdistanceSP(p2,p3,p1)),
			   min(getdistanceSP(p0,p1,p2),getdistanceSP(p0,p1,p3)));
}
int main()
{
	int q=read();while(q--)
	{
		Point p0,p1,p2,p3;
		read(p0),read(p1),read(p2),read(p3);
		printf("%.10lf\n",getdistanceSS(p0,p1,p2,p3));
	}
	return 0;
}



Measured memory_bytes: 3208
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
int n;
int a[200010];
int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		int x;
		cin>>x;
		a[x]++;
	}
	for(int i=1;i<=n;i++)
	{
		cout<<a[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 4412
package main

import "fmt"
import "os"
import "math"

func main() {
	var n int

	fmt.Fscanf(os.Stdin, "%d", &n)

	vacs := make([][3]int, n+1)

	for i:=1; i<=n; i++ {
		fmt.Fscanf(os.Stdin, "%d", &vacs[i][0])
		fmt.Fscanf(os.Stdin, "%d", &vacs[i][1])
		fmt.Fscanf(os.Stdin, "%d", &vacs[i][2])
	}

	fmt.Println(maxPoints(vacs))
}

func maxPoints(vacs [][3]int) int {
	n := len(vacs)
	
	prev_dp := [3]int{}

	for i:= 1; i<n; i++ {
		dp := [3]int{}

		for j:=0; j<3; j++ {
			for k:=0; k<3; k++ {
				if k!=j {
					dp[j] = max(dp[j], prev_dp[k] + vacs[i][j])
				}
			}
		}
		prev_dp = dp
	}

	return max(prev_dp[0], prev_dp[1], prev_dp[2])
}

func max(nums ...int) int {
	m := math.MinInt64
	for _, v := range nums {
		if v > m {
			m = v
		}
	}
	return m
}


Measured memory_bytes: 5888
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
using namespace std; 
typedef long long ll;
typedef unsigned long long int ull;
// PB-DS 
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define ff first
#define ss second
#define pb push_back
#define Inf  1000000000000000000
#define inf -1000000000000000000
#define mod 1000000007

ll mulmod(ll x,ll y){
  return (x%mod*y%mod)%mod;
}
 
ll addmod(ll x,ll y){
  return (x%mod+y%mod)%mod;
}
 
long long  power(long long  x,long long  y) { 
    long long  res = 1;      
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x;  
        y = y>>1;  
        x = x*x;  
    } 
    return res; 
}

void testcases(int Case){
  int N;
  cin >> N;
  vector<int>Div;
  int x;
  unordered_map<int,int>freq;
  for(int i = 1; i <= N; i++){
    cin >> x;
    Div.pb(x);
    freq[x]++;
  }
  sort(Div.begin(),Div.end());
  int ans = 0;
  unordered_map<int,int>MAP;
  for(int i = 0 ;i < N ; i ++){
    
    if(freq[Div[i]]==1){
      bool FLAG = false;
      int TMP = Div[i];
      for(int j = 1; j*j <= TMP; j ++){
        if(TMP%j==0){
          
          if(MAP.count(TMP/j)==1||MAP.count(j)==1){
            FLAG = true;
            break;
          }
        }
      }
    
    if(!FLAG){
      ans++;
    }
    }//
    MAP[Div[i]] = 1;
  }
  cout << ans << "\n";
}

  
int main()
{
 // sieve();
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
    ll t;
    t = 1;
    //cin >> t;
    ll Case =1 ;
    while(t--)
    {
      testcases(Case++);
    }
}

Measured memory_bytes: 20520
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
vector<int> to[200005];
vector<int> memo(200005);
vector<int> ans(200005);
void dfs(int a, int now, int p = -1)
{
  ans[a] = now;
  for (auto v : to[a])
  {
    if (v == p)
      continue;
    dfs(v, now + memo[v], a);
  }
}
int main()
{
  int n, q;
  cin >> n >> q;
  rep(i, n - 1)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  vector<int> p(q), x(q);
  rep(i, q)
  {
    cin >> p[i] >> x[i];
    p[i]--;
    memo[p[i]] += x[i];
  }
  dfs(0, memo[0]);
  rep(i, n)
  {
    cout << ans[i] << endl;
  }
}

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

template<class T> inline bool chmax(T& a, const T b) {
 if (a < b) {
     a = b;
     return true;
 }
 return false;
}

int weight[110];
int value[110];
long dp[110][100010];

int main(){
 int n, w;
 scanf("%d%d", &n, &w);
 for(int i = 0; i < n; i++) {
     scanf("%d%d", &weight[i], &value[i]);
 }
 for(int i = 0; i < n; i++) {
  for(int j=0; j <= w; j++) {
      if(j - weight[i] >= 0)
          chmax(dp[i+1][j], dp[i][j-weight[i]] + value[i]);
      chmax(dp[i+1][j], dp[i][j]);
  }
 }
 printf("%ld", dp[n][w]);
}

Measured memory_bytes: 79360
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono> 
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long 
#define pa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define pv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define vll vector<ll>
#define sll set<ll>
#define spll set<pll>
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define ump unordered_map
#define ff first
#define ss second
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=2e5;
ll mod=1e9+7;
vector<vll> gp(MXN+10);
ll ans=0;
ll c=0;
vll vis(MXN+10);
void dfs(int n){
    c++;
    vis[n]=1;
    for(auto x:gp[n]) if(!vis[x]) dfs(x);
}
void solve(){
    ll n,m;
    cin>>n>>m;
    fl(i,0,n-1){
        gp[i].clear();
        vis[i]=0;
    }
    set<pair<ll,ll>> s;
    fl(i,1,m){
        ll x,y;
        cin>>x>>y;
        x--; y--;
        if(y < x) swap(x,y);
        s.insert({x,y});
    }
    for(auto x:s){
        gp[x.ff].pb(x.ss);
        gp[x.ss].pb(x.ff);
    }
    fl(i,0,n-1){
        if(!vis[i]) {
            c=0; dfs(i);
            ans=max(ans,c);
        }
    }
    cout<<ans<<nl;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); ll t=1;
    //cin>>t; //comment for single test
    while(t--) solve();
}

Measured memory_bytes: 37468
x=int(input())
bf=0

for i in range(-2*int(abs(x**0.2)),2*int(abs(x**0.2))+1):
    for j in range(-2*int(abs(x**0.2)), 2*int(abs(x**0.2))+1):
        if i**5-j**5==x:
            print(f"{i} {j}")
            bf=1
            break
    if bf==1:
        break

Measured memory_bytes: 66356
n = int(input())
list1 = []

for i in range(n):
    list1.append(list(input().split() + [str(i+1)]))
    list1[i][1] = 100 - int(list1[i][1])

list1.sort()
for i in range(len(list1)):
    print(list1[i][2])


Measured memory_bytes: 3060
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n, a;
	scanf("%d", &n);
	map<int, int> m;
	rep(i, n - 1) {
		scanf("%d", &a);
		++m[--a];
	}
	rep(i, n)printf("%d\n", m[i]);

	Please AC;
}

Measured memory_bytes: 13168
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer cout<<endl<<"answer : ";
#define maxn 100005
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0;string s;bool flag=false;
        cin>>x>>y;
        p = abs(x-y);
        if(p%2==1)
            cout<<"IMPOSSIBLE"<<endl;
        else
        {
            k = min(x,y) + p/2;
            cout<<k<<endl;
        }

    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Measured memory_bytes: 3584
#include<iostream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

typedef unsigned long long ull;
const int N_MAX = 1e6;
const ull mod = 1000000000 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    int n, m;
    cin >> n >> m;
    ull X = 0;
    ull Y = 0;
    vector<ull> x(n);
    vector<ull> y(m);
    REP(i, n) cin >> x[i];
    REP(i, m) cin >> y[i];
    REP(i, n-1){
        X += ((x[i+1] - x[i])*(n-1-i)*(i+1))%mod;
        X = X%mod;
    }
    REP(i, m-1){
        Y += ((y[i+1] - y[i])*(m-1-i)*(i+1))%mod;
        Y = Y%mod;
    }
    cout << X*Y%mod << endl;
    return 0;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> s1(n, 0), s2(n, 0);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        if (a==1) {
            s1[b-1] = 1;
        }
        if (b==n) {
            s2[a-1] = n;
        }
    }
    bool ok = false;
    rep(i, n) {
        if (s1[i]==1 && s2[i]==n) {
            ok = true;
            break;
        }
    }
    if (ok) puts("POSSIBLE");
    else puts("IMPOSSIBLE");
    return 0;
}

Measured memory_bytes: 1792
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int a[5],ans=1e9;

int main()
{
	rep(i,5) cin>>a[i];
	do
	{
		int dish=0;
		rep(i,1000)
		{
			if(i%10==0)
			{
				i+=a[dish]-1;
				dish++;
			}
			if(dish==5)
			{
				ans=min(ans,i+1);
				break;
			}
		}
	}
	while(next_permutation(a,a+5));
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>
using namespace std;

 
int main() {
    long long N,M,workD = 0;
    cin >> N >> M;
    for (int i = 0; i<M; i++) {
        long long tmp = 0;
            cin >> tmp;
        workD += tmp;
    }
    if (N<workD) {
        cout << "-1" << endl;
    } else if (!N-workD){
        cout << N-workD << endl;
    } else {
        cout << N-workD << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
_ = input()
nums = [int(n) for n in input().split()]

approved = True
for num in nums:
  if num % 2 == 0:
    if num % 3 == 0 or num % 5 == 0:
      continue
    else:
      approved = False

if approved:
  print("APPROVED")
else:
  print("DENIED")


Measured memory_bytes: 2940
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
		b[i] = nextInt()
		c[i] = nextInt()
	}

	dp := make([][3]int, n) // 0:a 1:b 2:c
	dp[0][0] = a[0]
	dp[0][1] = b[0]
	dp[0][2] = c[0]

	for i := 1; i < n; i++ {
		dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2])
		dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2])
		dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1])
	}

	//fmt.Println(dp)
	fmt.Println(max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])))

}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 8256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double ans = 0;
		for (int i = 0; i < n; i++) {
			double x = sc.nextDouble();
			String s = sc.next();
			if(s.equals("JPY")) ans += x;
			else ans += x*380000;
		}
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
#include <complex>
#include <algorithm>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(int i=a; i<int(b); i++)
#define rep(i,b) loop(i,0,b)

double const eps=1e-8;
double const inf = 1e10;
double const pi = acos(-1);

typedef complex<double> P;
inline double cross(const P& a, const P& b) {
    return imag(conj(a)*b);
}
inline double dot(const P& a, const P& b) {
    return real(conj(a)*b);
}
struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a); push_back(b);
    }
    L(){}
};
P projection(const L &l, const P &p) {
    double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}
inline double distanceLP(const L &l, const P &p) {
    return abs(p - projection(l, p));
}

int n;
P ps[128];
L es[128];

P innerCenter(P a, P b, P c){
    double la=abs(b-c), lb=abs(c-a), lc=abs(a-b);
    return (la*a+lb*b+lc*c)/(la+lb+lc);
}

enum { OUT, ON, IN };
int convex_contains(const P &p) {
    P g = (ps[0] + ps[n/3] + ps[2*n/3]) / 3.0;
    int a = 0, b = n;
    while (a+1 < b) {
        int c = (a + b) / 2;
        if (cross(ps[a]-g, ps[c]-g) > 0) {
            if (cross(ps[a]-g, p-g) > 0 && cross(ps[c]-g, p-g) < 0) b = c;
            else                                                    a = c;
        } else {
            if (cross(ps[a]-g, p-g) < 0 && cross(ps[c]-g, p-g) > 0) a = c;
            else                                                    b = c;
        }
    }
    b %= n;
    if (cross(ps[a] - p, ps[b] - p) < 0) return 0;
    if (cross(ps[a] - p, ps[b] - p) > 0) return 2;
    return 1;
}

double solve(){
    rotate(ps,ps+rand()%n,ps+n);
    ps[n]=ps[0];
    rep(i,n){
        es[i]={ps[i],ps[i+1]};
    }
    P p=innerCenter(ps[0],ps[n/3],ps[n/3*2]);

    // これがないとTLEするかも
    if(n==3)return distanceLP(es[0],p);

    double const r[]={10,1,1e-1,1e-2,1e-3,1e-4,1e-5,1e-6,1e-7};
    double static d[128];
    int near=0;
    rep(t,90000){
        rep(i,n){
            d[i]=distanceLP(es[i],p);
        }
        near=0;
        rep(i,n)if(d[i]<d[near]){
            near=i;
        }
        P h=projection(es[near],p);
        P np=p-(h-p)/d[near]*r[t/10000];
        if(convex_contains(np)==IN){
            swap(p,np);
        }
    }
    return d[near];
}

int main(){
    srand(time(0));
    while(cin>>n && n){
        rep(i,n){
            double x,y;cin>>x>>y;
            ps[i]=P(x,y);
        }
        printf("%lf\n",solve());
    }
}

Measured memory_bytes: 1268
fun main(args: Array<String>) {
    val mod = 1000000007L
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { java.lang.Long.toBinaryString(it.toLong()).reversed() }
    val sumArray = Array(100) { 0L }
    for (a in aList) {
        var i = 0
        while (true) {
            sumArray[i] += a.getOrNull(i)?.toString()?.toLong() ?: break
            i++
        }
    }
    var ans = 0L
    (0 until 100).forEach {
        ans += (((sumArray[it] * (n.toLong() - sumArray[it]))%mod)
                * (Math.pow(2.toDouble(), it.toDouble()) % mod).toLong()) % mod
        ans %= mod
    }
    println(ans)
}


Measured memory_bytes: 206280
#include <bits/stdc++.h>
using namespace std;
 
int N, M;
int WA[105000];
bool AC[105000];
 
void solve() {
    cin >> N >> M;
    int WAnum = 0;
    int ACnum = 0;
    for(int i = 1; i <= N; i++) {
        WA[i] = 0;
        AC[i] = false;
    }
    while(M--) {
        int p;
        string S;
        cin >> p >> S;
        if(AC[p]) continue;
        if(S == "AC") {
            AC[p] = true;
            ACnum++;
            WAnum += WA[p];
        } else if(S == "WA") {
            WA[p]++;
        }
    }
    cout << ACnum << " " << WAnum << endl;
    return;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define MOD 1000000007
//for(int i=0; i<n; ++i)
using namespace std;
#define all(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define ll long long

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

    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC" : "ABC") << endl;
    return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

double r;

signed main() {
    cin >> r;
    cout << setprecision(20) << r*M_PI*2 << endl;
}




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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	string S; cin >> S;
	if(S[0]==S[1] || S[1]==S[2] || S[2]==S[3]){
		cout << "Bad" << endl;
	}
	else{
		cout << "Good" << endl;
	}


	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define all(v) v.begin(),v.end()
#define PI acos(-1)
#define EPS 1e-15

int f(int n){
	int sum = 0;
	while(n){
		sum += n % 10;
		n /= 10;
	}
	
	return sum;
}

int main() {
	int n;
	cin >> n;
	if(n % f(n) == 0)
		cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  ll cost = 0;
  VI X(N);
  ll xbeg;
  cin >> xbeg;
  rep(i, N - 1) {
    ll xtemp;
    cin >> xtemp;
    cost += min((xtemp - xbeg) * A, B);
    xbeg = xtemp;
  }

  cout << cost << endl;
  return 0;
}


Measured memory_bytes: 640
MOD = 1000000007

def make_factorial_array(n)
  1.upto(n) do |i|
    $fact[i] = $fact[i - 1] * i % MOD
  end
end

n, m = gets.split.map(&:to_i)
a_size = [n, m].max
$fact = Array.new(a_size + 1, 1)
make_factorial_array(a_size)
d = (n - m).abs
if d == 0
  p $fact[n] * $fact[m] * 2 % MOD
elsif d == 1
  p $fact[n] * $fact[m] % MOD
else
  p 0
end

Measured memory_bytes: 2556
def f n,k
  res = 0
  n.times{|i|
    wk = 21*3*i + 81
    (7-2).times{|j|
      res += 1 if (wk+(3*3)*j)%11==k
    }
  }
  res
end


n,k = gets.split.map(&:to_i)

ans = f(11,k)*((n-2)/11) + f((n-2)%11,k)

p ans


Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("2020 2040");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("4 5");
            //20
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        long[] wkArr = InputList[0].Split(' ').Select(X => long.Parse(X)).ToArray();
        long L = wkArr[0];
        long R = wkArr[1];

        long Answer = long.MaxValue;
        for (long I = L; I <= Math.Min(L + 2019, R); I++) {
            for (long J = I + 1; J <= Math.Min(I + 2019, R); J++) {
                Answer = Math.Min(Answer, (I * J) % 2019);
            }
        }
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 13396
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println(min(a+b, b+c, c+a));
		sc.close();
	}
	
	static int min(int... args) {
		int min = args[0];
		for(int i = 0; i < args.length; i++) {
			if(args[i] < min) min = args[i];
		}
		return min;
	}
}


Measured memory_bytes: 23764
a,b,m=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
d=[list(map(int,input().split())) for _ in range(m)]
ans=min(A)+min(B)
for i in range(m):
    r=d[i][0]-1
    l=d[i][1]-1
    val=d[i][2]
    ans=min(ans,(A[r]+B[l]-val))



print(ans)


Measured memory_bytes: 38564
n,m=map(int, input().split())
list1=[list(map(int,input().split())) for i in range(m)]

ans=['x']*n
non=0
for i in range(m):
    if ans[list1[i][0]-1]!='x':
        if int(ans[list1[i][0]-1])==list1[i][1]:
            continue
        else:
            non=-1
            break
    else:
        ans[list1[i][0]-1]=str(list1[i][1])

if non==-1:
    print(-1)
else:
    if ans[0]=='0' and n!=1:
        print(-1)
    else:
        if 'x' in ans:
            if ans[0]=='x' and n!=1:
                ans[0]='1'
            for i in range(n):
                if ans[i]=='x':
                    ans[i]='0'
        K=''
        for i in range(n):
            K+=ans[i]
        print(int(K))

Measured memory_bytes: 38384
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int a,b;
	double x,y; 
	cin>>a>>b;
	x=12.5*a;
	y=10*b;
	int i,j,flag=0;
	if(y>=(x+12.5)||(y+10)<=x)
		cout<<"-1"<<endl;
	else 
	{
		for(i=0;i<10;y++)
	{
		if(y>=x&&y<(x+12.5))
		{
			flag=1;
			break;
		}
	}
	if(flag)cout<<y<<endl;
	else cout<<"-1"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const ll inf = 1e9+7;

int N,M;
bool flag[100010];
int box[100010];
int ans;
int main(){
    cin>>N>>M;
    flag[0]=true;
    REP(i,0,M){
        int x,y;
        cin>>x>>y;
        x--; y--;
        flag[y] |= flag[x];
        box[x]--;
        box[y]++;
        if(box[x]==-1){
            flag[x]=false;
        }
    }
    REP(i,0,N){
        ans+=flag[i];
    }
    p(ans);
    return 0;
}

Measured memory_bytes: 768
#pragma target("avx")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  
  long long a,b,c;
  cin >> a >> b >> c;
  cout << max(c-(a-b), 0ll) << endl;
  return 0;
}


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

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(){
	int q, com;
	long x;
	long L, R;
	std::multiset<long> s;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	ifs >> q;
#else
	std::cin >> q;
#endif
	
	for(int i = 0; i < q; i++){
#if INPUT_FROM_FILE
		ifs >> com >> x;
#else
		std::cin >> com >> x;
#endif
		if(com == 0){
			s.insert(x);
			std::cout << s.size() << std::endl;
		}
		else if(com == 1){
			std::cout << s.count(x) << std::endl;
		}
		else if(com == 2){
			s.erase(x);
		}
		else{
			L = x;
#if INPUT_FROM_FILE
			ifs >> R;
#else
			std::cin >> R;
#endif
			std::set<long>::iterator it = s.lower_bound(L);
			while(it != s.end() && *it <= R){
				std::cout <<  *it << std::endl;
				it++;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 12296
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <stack>
#include <unordered_set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {

  i64 N, i;
  cin >> N;

  vi colors(N-1, -1);
  vector<vector<pi>> edges(N);
  REP(0, N-1, i) {
    i64 a, b;
    cin >> a >> b;
    a--; b--;
    edges[a].pb({b,i});
    edges[b].pb({a,i});
  }

  i64 K = 0;
  stack<i64> s;
  s.push(0);
  vi visited(N, 0);
  while(!s.empty()) {
    i64 t = s.top();
    visited[t] = 1;
    s.pop();

    K = max(K, i64(edges[t].size()));
    unordered_set<i64> used, candidates;
    //cout << "v " << t << endl;
    REP(0, sz(edges[t]), i) {
      if(colors[edges[t][i].second] >= 0) {
	used.insert(colors[edges[t][i].second]);
	//cout << "u " << colors[edges[t][i].second] << endl;
      }
    }
    REP(0, sz(edges[t]), i) {
      if(used.find(i) == used.end()) {
	candidates.insert(i);
	if(candidates.size() + used.size() >= edges[t].size()) {
	  break;
	}
	//cout << "c " << i << endl;
      }
    }
    //cout << used.size() << " " << candidates.size() << endl;
    for(auto p: edges[t]) {
      i64 v = p.first;
      i64 idx = p.second;
      if(visited[v] == 0) {
	auto col = candidates.begin();
	colors[idx] = *col;
	candidates.erase(col);
	s.push(v);
      }
    }
  }

  cout << K << endl;
  REP(0, N-1, i) {
    cout << colors[i] + 1 << endl;
  }  

  return 0;
}


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

const int MAX_L=1e5+1;

vector<int>data[26];

const int INF=1e7;

int main(){
	string str;
	cin>>str;
	int ans[2]={-1,-1};
	for(int i=0;i<str.size();i++){
		data[str[i]-'a'].push_back(i+1);
		if(data[str[i]-'a'].size()>1){
			int p1=data[str[i]-'a'][data[str[i]-'a'].size()-1];
			int p2=data[str[i]-'a'][data[str[i]-'a'].size()-2];
			if(p1-p2<=2){ans[0]=p1;ans[1]=p2;break;}
		}
	}
	cout<<ans[1]<<" "<<ans[0]<<endl;
}


Measured memory_bytes: 1144
def r_poland(s):
    stack=[]
    
    for d in s:
        if d.isdigit():
            stack.append(int(d))
        elif d=="+":
            stack[-1]+=stack.pop(-2)
        elif d=="-":
            stack[-1]=stack.pop(-2)-stack[-1]
        elif d=="*":
            stack[-1]*=stack.pop(-2)

    return stack
   
s=list(input().split())

print(*r_poland(s))

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

using namespace std;

int main(){
  int N;
  string S;
  cin >> S;
  N = S.size() + 1;
  
  vector<int> a(N, 0);
  for(int i = 0; i < N - 1; i++){
    if(S[i] == '<'){
      a[i + 1] = max(a[i] + 1, a[i + 1]);
    }
  }
  
  for(int i = N - 1; i > 0; i--){
    if(S[i - 1] == '>'){
      a[i - 1] = max(a[i] + 1, a[i - 1]);
    }
  }
  
  long long sum = 0;
  for(int x : a) sum += x;
  
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 2820
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define REP(i, k, n) for(long long i=(long long)(k); i<(long long)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const ll inf = 1020304050607080910;
const int INF = 2000000000;
const ll mod = 998244353;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x,ll y){if(x>y)swap(x, y);while(x!=0){y%=x;swap(x, y);}return y;}
ll mpow(ll x,ll r){if(r==0)return 1;if(r%2==1){return x*mpow(x,r-1)%mod;}else{ll aa=mpow(x,r/2);return aa*aa%mod;}}

int main(){
	int N; cin >> N;
	int D[N][2];
	rep(i, N) cin >> D[i][0] >> D[i][1];
	for(int i=0; i<=N-3; i++){
		if((D[i][0]==D[i][1]) && (D[i+2][0]==D[i+2][1]) && (D[i+1][0]==D[i+1][1])){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// #define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;

bool m[N];
vi v[N];

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

	int n;
	cin >> n;
	for(int i = 2; i < N; i++) {
		for(int j = i; j < N; j += i) {
			v[j].pb(i);
		}
	}
	int x = 1;
	int g = 0;
	for(int i = 0; i < n; i++) {
		int cur;
		cin >> cur;
		g = __gcd(g, cur);
		for(auto it : v[cur]) {
			if(m[it]) {
				x = 0;
			}
			m[it] = 1;
		}
	}
	if(x == 1) {
		cout << "pairwise coprime";
	}
	else if(x == 0 && g == 1) {
		cout << "setwise coprime";
	}
	else {
		cout << "not coprime";
	}

	return 0;
}

Measured memory_bytes: 114984
//iejr Header files
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <cstring>
#include <sstream>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <limits.h>
#include <ctime>
#include <cctype>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

//iejr: Type defination
typedef unsigned long long int             ULLN;
typedef long long int                      LLN;
typedef vector<int>                        VI;
typedef vector<vector<int> >               VVI;
typedef vector<string>                     VS;
typedef vector<vector<string> >            VVS;


//iejr: Compile Options
//#define C11_Standard
//
#ifdef C11_Standard
    #include <unordered_set>
    #include <unordered_map>

    #define HASHSET                  unordered_set
    #define HASHMAP                  unordered_map;
#endif // C11_Standard


//iejr: Local Debug
//#define INPUT_REDIRECTION
//#define OUTPUT_REDIRECTION


//iejr: Main Function
int main()
{

#ifdef INPUT_REDIRECTION
    freopen( "in.txt", "r", stdin );
#endif // INPUT_REDIRECTION

#ifdef OUTPUT_REDIRECTION
    freopen( "out.txt", "w", stdout );
#endif // OUTPUT_REDIRECTION

    int N, A, B;
    while( cin >> N >> A >> B ){
        string buff;
        cin >> buff;
        int cnt1 = 0, cnt2 = 0;
        for( int i = 0;i < buff.length();++i ){
            char res = 0;
            if( buff[i] == 'a' ){
                if( cnt1 + cnt2 < A + B ){
                    res = 1;
                    ++cnt1;
                }
                else{
                    res = 0;
                }
            }
            else if( buff[i] == 'b' ){
                if( cnt1 + cnt2 < A + B && cnt2 < B ){
                    res = 1;
                    ++cnt2;
                }
            }

            if( res == 1 ){
                printf( "Yes\n" );
            }
            else{
                printf( "No\n" );
            }
        }
    }

#ifdef INPUT_REDIRECTION
    fclose( stdin );
#endif // INPUT_REDIRECTION

#ifdef OUTPUT_REDIRECTION
    fclose( stdout );
#endif // OUTPUT_REDIRECTION

    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1000000007
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int minhugs(string ss) {
    int n = ss.size();
    int ans = 0;
    for(int i = 0; i < n / 2; ++i) {
        if(ss[i] != ss[n - 1 - i]) {
            ++ans;
        }
    }
    return ans;
}
int main() {
    string ss;
    cin >> ss;
    cout << minhugs(ss);
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline

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

A.sort(reverse=True)
ans = []
n = sum(A)
for value in A:
    if value * 4 * M < n:
        break
    else:
        ans.append(value)

if len(ans) >= M:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int main(int argc, void **arg)
{
    char s[5], str[3] = "  ";
    int n[2] = { 0, 0 };
    int i, j;

    scanf("%s", s);

    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < 2; j++)
        {
            if( s[i] == str[j] ) {
                n[j]++;
                break;
            }
        }
        if( j != 2 ) continue;
        
        for (j = 0; j < 2; j++)
        {
            if( str[j] == ' ' ) {
                str[j] = s[i];
                break;
            }
        }
        if( j != 2 ) continue;

        puts("No");
        return 0;
    }

    if( str[1] == ' ' ) puts("No");
    else                puts("Yes");

    return 0;
}


Measured memory_bytes: 128
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                         \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

void solve(ll N, ll K, std::vector<ll> l) {
  sort(all(l));
  reverse(all(l));

  ll sum = 0;
  for (int i = 0; i < K; i++) {
    sum += l.at(i);
  }
  cout << sum << endl;

  return;
}

int main() {
  ll N;
  scanf("%lld", &N);
  ll K;
  scanf("%lld", &K);
  std::vector<ll> l(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &l[i]);
  }
  solve(N, K, std::move(l));
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
def main():
    from itertools import product
    import math

    K = int(input())

    ans = 0
    for a, b, c in product(range(1, K + 1), repeat=3):
        ans += math.gcd(math.gcd(a, b), c)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73056
#include <bits/stdc++.h>
#define maxn 100005
#define MOD 998244353
using namespace std;
#define ll long long

#define pii pair<ll, ll>
#define piii pair<ll, pii>

#define ft first
#define sd second

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}


ll power(ll a, ll b){
    if(b==0) return 1;
    ll R =1, k=a;
    for (ll j=b;j>0;j/=2){
        if (j&1) R=(R*k)%MOD;
        k=(k*k)%MOD;
    }
    return R;
}

void solve(){

    ll n, a, b;
    cin >> n >> a >> b;
    ll k = n/(a+b);
    ll m = n%(a+b);
    cout << k*a + min(a, m) << endl;

}

int main()
{


    ll t = 1;//cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256