akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int t = sc.nextInt();
		for(int k=0;k<t;k++){
			if(k!=0) System.out.println();
			
			int h = sc.nextInt();
			int w = sc.nextInt();
			char[][] map = new char[h][w];
			for(int i=0;i<h;i++) map[i] = sc.next().toCharArray();
			int n = sc.nextInt();
			char[] s = new char[n];
			s = sc.next().toCharArray();
			
			
			int x = 0;
			int y = 0;
			int d = 0;
			boolean flag = false;
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					if(map[i][j]=='^'){
						d = 0;
						flag = true;
					}else if(map[i][j]=='>'){
						d = 1;
						flag = true;
					}else if(map[i][j]=='v'){
						d = 2;				
						flag = true;
					}else if(map[i][j]=='<'){
						d = 3;
						flag = true;
					}
					if(flag==true){
						map[i][j] = '.';
						y = i;
						x = j;
						i = h;
						j = w;
					}
				}
			}
			
			for(int i=0;i<n;i++){
				if(s[i]=='U'){
					d = 0;
					if(y>0 && map[y-1][x]=='.') y--;
				}else if(s[i]=='R'){
					d = 1;
					if(x<w-1 && map[y][x+1]=='.') x++;
				}else if(s[i]=='D'){
					d = 2;
					if(y<h-1 && map[y+1][x]=='.') y++;
				}else if(s[i]=='L'){
					d = 3;
					if(x>0 && map[y][x-1]=='.') x--;
				}else{
					if(d==0){
						for(int j=y;j>=0;j--){
							if(map[j][x]=='#') break;
							if(map[j][x]=='*'){
								map[j][x]='.';
								break;
							}
						}
					}else if(d==1){
						for(int j=x;j<w;j++){
							if(map[y][j]=='#') break;
							if(map[y][j]=='*'){
								map[y][j]='.';
								break;
							}
						}
					}else if(d==2){
						for(int j=y;j<h;j++){
							if(map[j][x]=='#') break;
							if(map[j][x]=='*'){
								map[j][x]='.';
								break;
							}
						}
					}else if(d==3){
						for(int j=x;j>=0;j--){
							if(map[y][j]=='#') break;
							if(map[y][j]=='*'){
								map[y][j]='.';
								break;
							}
						}
					}
				}
			}
			if(d==0) map[y][x] = '^';
			else if(d==1) map[y][x] = '>';
			else if(d==2) map[y][x] = 'v';
			else if(d==3) map[y][x] = '<';
			
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					System.out.print(map[i][j]);
				}
				System.out.println();
			}
			
		}
	}	
}

Measured memory_bytes: 28968
//secreterror
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0;i<n;i++)
#define rev(i, n) for(ll i=n-1;i>=0;i--)
#define forr(i, x, y) for(ll i=x;i<y;i++)
#define f first
#define s second
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vpii vector<pair<int,int>>

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

    vector<ll>weigh(n,0);
    vector<ll>val(n);

    vector<ll>dp(w+1,0);//max val for w=i

    rep(i,n){
        cin>>weigh[i]>>val[i];

        for(int already=w-weigh[i];already>=0;already--){
            dp[already+weigh[i]]=max(dp[already+weigh[i]],dp[already]+val[i]);
        }


    }
    ll ans=0;
    for(int i=0;i<=w;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main() 
{
	int cnt=0,i;
	char n[15];

	for(i=0;i<15;i++){
		cin >> n[i];
	} 	
	for(i=0;i<15;i++){
		if(n[i] != 'x' && n[i] != 'o'){
			n[i]='o';
		}
	} 
	for(i=0;i<15;i++){
		if(n[i] == 'o'){
			cnt++;
		}
	} 

	cout << (cnt>=8 ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 1000000007;

int main()
{
    // 整数の入力
    double L;
    cin >> L;
    cout << fixed << setprecision(12) << (L/3) * (L/3)* (L/3) << endl;
   return 0;
}

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

int main(){
    using namespace std;
    size_t N, X;
    cin >> N >> X;
    size_t D{0}, ans{1};
    for(size_t i = 0, L; i < N; ++i){
        cin >> L;
        ans += (D += L) <= X;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int N;
  cin>>N;
  if (N%2==1)
    cout << setprecision(9) << ((double)(N/2)+1)/N << endl;
  else
    cout << 0.5 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n,k;cin >> n >>k;
    vl x(n),y(n);rep(i,n)cin >> x[i] >>y[i];
    ll ans=INF;
    rep(i,n){
        rep(j,n){
            rep(o,n){
                rep(p,n){
                    ll a=x[i],b=x[j],c=y[o],d=y[p];
                    if(a>=b||c>=d)continue;
                    ll cnt=0;
                    rep(l,n){
                        if(a<=x[l]&&x[l]<=b&&c<=y[l]&&y[l]<=d)cnt++;
                    }
                    if(cnt>=k)chmin(ans,(b-a)*(d-c));
                }
            }
        }
    }
    cout <<ans <<endl;
}

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

#define pb push_back
#define mp make_pair

using namespace std;

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

int main() {
	int n;
	cin >> n;
	
	vi cards;
	for (int i = 0; i < n; ++i) {
		int k;
		cin >> k;
		cards.pb(k);
	}
	
	sort(cards.begin(), cards.end(), greater<int>());
	
	int res = 0;
	for (int i = 0; i < n; ++i) {
		if (i % 2 == 0) {
			res += cards.at(i);
		} else {
			res -= cards.at(i);
		}
	}
	
	cout << res << endl;
  return 0;
}

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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i + 1 < n; i++) {
        if (s[i] == s[i + 1]) {
            cout << i + 1 << ' ' << i + 2 << '\n';
            return 0; 
        }
    }
    for (int i = 0; i + 2 < n; i++) {
        if (s[i] == s[i + 2]) {
            cout << i + 1 << ' ' << i + 3 << '\n';
            return 0; 
        }
    }
    cout << -1 << ' ' << -1 << '\n';
    return 0;
} 

Measured memory_bytes: 512
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};



int main(){
    int N,M;cin >> N >> M;
    vector<vector<Edge>> Edges(N);
    vector<int> deg(N, 0);//入力字数
    for(int a = 0;a < M;a++){
        int b,c;cin >> b  >> c;
        deg[c]++;
     //   b--;
     //   c--;
        Edges.at(b).push_back(Edge(b,c));
    }
    queue<int> S;
    vector<int> L;
    for(int a = 0;a < N;a++){
        if(deg[a]==0)S.push(a);
    }
    vector<bool> flag(N,true);
    while(!S.empty()){
        int n = S.front();S.pop();
        L.push_back(n);
        for(auto e : Edges.at(n)){
            deg[e.to]--;
            if(deg[e.to] == 0)S.push(e.to);
        }
        flag.at(n)=false;
    }
    
    for(int a = 0;a < N;a++){
        if(flag.at(a)){
            cout<<"DAGではない"<<endl;
            return 0;
        }
    }
    
    for(int a = 0;a < L.size();a++){
        COUT(L.at(a));
    }
}



Measured memory_bytes: 4140
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
	for (const auto &e : mp) os << "[" << e << "] ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T = lint>
struct Edge {
	int to;
	T cost;
	Edge() {}
	Edge(int to, T cost) : to(to), cost(cost) {}
	bool operator>(const Edge &r) const { return this->cost > r.cost; }
};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, Q;
	cin >> N >> Q;

	int u, v;
	vector<vector<Edge<int>>> edges(N);
	for (int i = 0; i < N - 1; i++) {
		cin >> u >> v;
		u--, v--;
		edges[u].emplace_back(v, 1);
		edges[v].emplace_back(u, 1);
	}

	vector<int> ans(N + 1);
	for (int i = 0; i < Q; i++) {
		int p, q;
		cin >> p >> q; 
		p--;
		ans[p] += q;
	}

	DMP(ans);

	vector<int> visted(N);
	auto dfs = [&](auto &&f, int now) -> void {
		visted[now] = 1;
		for (const auto &e : edges[now]) {
			if (!visted[e.to]) {
				ans[e.to] += ans[now];
				f(f,e.to);
			}
		}
	};

	dfs(dfs, 0);

	for (int i = 0; i < N; i++) {
		cout << ans[i] << "\n";
	}

	return 0;
}

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

#define int long long

using namespace std;

int u[200001];

 main () {
	int n;
	int m;
	cin >> n >> m;
	for (int i = 1;i <= m;i ++) {
		int x, y;
		cin >> x >> y;
		u[x] ++;
		u[y] ++;
	}         
	for (int i = 1;i <= n;i ++) {
		if (u[i] % 2) {
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
	return 0;
}

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

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 1000000007
//#define mod 1e18
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii map<int,int>
#define mll map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi  first

#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}
int arr[N*10],a[N*10];
vector<int> v;

void seive(){
	int n = N*10;
	sort(all(v));
	for(int i:v){
		if(arr[i]>0){
			arr[i]++;
			continue;
		}
		
		for(int j = 1;i*j<n;j++){
			arr[i*j]++;
		}
	}
}

int main(){
	boost;
	int n;
	cin>>n;
	v = vector<int>(n);
	for(int i = 0;i<n;i++){
		cin>>v[i];
	}
	
	seive();
	int ans = 0;
	for(int i = 0;i<n;i++){
		if(arr[v[i]]==1){
			//cout<<v[i]<<endl;;
			ans++;
		}
	}
	
	cout<<ans;
	return 0;
}

//int main(){
	//boost;
	
	//int x,n;
	//cin>>x>>n;
	//int ans = x,m = inf;
	//int arr[105];
	//memset(arr,0,sizeof(arr));
	//for(int i = 0;i<n;i++){
		//int a;
		//cin>>a;
		//arr[a]++;
	//}
	
	//for(int i = 0;i<105;i++){
		//if(arr[i]>0){
			//continue;
		//}
		
		//if(m>abs(x-i)){
			//m = abs(x-i);
			//ans = i;
		//}
	//}
	
	//cout<<ans;
	//return 0;
//}



Measured memory_bytes: 7956
// F - Minimum Bounding Box
#include <bits/stdc++.h>

using namespace std;

#define	EPS	1e-9

int n;
vector<pair<long long, long long> > p, m;

double func(double t)
{
	double minx = 1e18, miny = 1e18, maxx = -1e18, maxy = -1e18;
	for (int i = 0; i < n; i++) {
		double x = p[i].first + t * m[i].first, y = p[i].second + t * m[i].second;
		minx = min(minx, x); maxx = max(maxx, x);
		miny = min(miny, y); maxy = max(maxy, y);
	}
	return (maxx - minx) * (maxy - miny);
}

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	cin >> n;
	for (int i = 0; i < n; i++) {
		long long x, y;
		string s;
		cin >> x >> y >> s;
		p.resize(n), m.resize(n);
		p[i] = make_pair(x, y);
		if (s[0] == 'R')      m[i] = make_pair(1, 0);
		else if (s[0] == 'L') m[i] = make_pair(-1, 0);
		else if (s[0] == 'U') m[i] = make_pair(0, 1);
		else if (s[0] == 'D') m[i] = make_pair(0, -1);
	}

	double l = 0, r = 1e9;
	for (int k = 0; k < 300; k++) {
		double m1 = l + (r - l) / 3, m2 = r - (r - l) / 3;
		if (func(m1) > func(m2)) l = m1;
		else r = m2;
	}
	double ans = func((l + r) / 2);

	cout << fixed << setprecision(15) << ans << endl;

	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

bool comp(pair<ll, ll> a, pair<ll, ll> b){
	if(a.fi < b.fi) return 1;
	return a.se > b.se;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

	ll n, m, lm, rm;
	cin>>n>>m;
	cin>>lm>>rm;
	m--;
	while(m--)
	{
		ll a, b;
		cin>>a>>b;
		lm = max(lm, a);
		rm = min(rm,b);
	}
	if(rm>=lm)
		cout<<rm-lm+1;
	else
		cout<<0;

	cout<<"\n";

	return 0;
}


Measured memory_bytes: 256
while True:
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)
    def lcm(a, b):
        return a*b/gcd(a, b)

    try:
        a, b = map(int, input().split())
    except EOFError:
        break
    print(str(gcd(b, a%b)) + " " + str(int(lcm(a, b))))


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long i,j,k;
    long long n;
    long long ga,gb,sa,sb,ba,bb;
    std::cin >> n;
    std::cin >> ga>>sa>>ba;
    std::cin >> gb>>sb>>bb;
    long long ans=0;
    long long m;
    if(ga<=gb&&sa<=sb&&ba<=bb){
        for (i=0;i<=n/ga;i++){
            for (j=0;j<=(n-i*ga)/sa;j++){
                    m=i*(gb-ga)+j*(sb-sa)+((n-i*ga-j*sa)/ba)*(bb-ba);
                    if (m>ans) ans=m;
            }
        }
        ans+=n;
    }
    else if(ga>=gb&&sa>=sb&&ba>=bb){
        int g=ga,s=sa,b=ba;
        ga=gb;sa=sb;ba=bb;gb=g;sb=s;bb=b;
        for (i=0;i<=n/ga;i++){
            for (j=0;j<=(n-i*ga)/sa;j++){
                    m=i*(gb-ga)+j*(sb-sa)+((n-i*ga-j*sa)/ba)*(bb-ba);
                    if (m>ans) ans=m;
            }
        }
        ans+=n;
    }
    else if(ga>=gb&&sa>=sb&&ba<=bb){
        n+=(bb-ba)*(n/ba);
        for (i=0;i<=n/gb;i++){
                m=i*(ga-gb)+((n-i*gb)/sb)*(sa-sb);
                if (m>ans) ans=m;
         }
        ans+=n;
    }
    else if(ga>=gb&&sa<=sb&&ba>=bb){
        n+=(sb-sa)*(n/sa);
        for (i=0;i<=n/gb;i++){
                m=i*(ga-gb)+((n-i*gb)/bb)*(ba-bb);
                if (m>ans) ans=m;
         }
        ans+=n;
    }
    else if(ga<=gb&&sa>=sb&&ba>=bb){
        n+=(gb-ga)*(n/ga);
        for (i=0;i<=n/sb;i++){
                m=i*(sa-sb)+((n-i*sb)/bb)*(ba-bb);
                if (m>ans) ans=m;
         }
        ans+=n;
    }
    else if(ga>=gb&&sa<=sb&&ba<=bb){
        for (i=0;i<=n/sa;i++){
                m=i*(sb-sa)+((n-i*sa)/ba)*(bb-ba);
                if (m>ans) ans=m;
         }
        n+=ans;
        n+=(ga-gb)*(n/gb);
        ans=n;
    }
    else if(ga<=gb&&sa>=sb&&ba<=bb){
        for (i=0;i<=n/ga;i++){
                m=i*(gb-ga)+((n-i*ga)/ba)*(bb-ba);
                if (m>ans) ans=m;
         }
        n+=ans;
        n+=(sa-sb)*(n/sb);
        ans=n;
    }
    else if(ga<=gb&&sa<=sb&&ba>=bb){
        for (i=0;i<=n/ga;i++){
                m=i*(gb-ga)+((n-i*ga)/sa)*(sb-sa);
                if (m>ans) ans=m;
         }
        n+=ans;
        n+=(ba-bb)*(n/bb);
        ans=n;
    }
    std::cout << ans << std::endl;
   
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	ll N,x;
	cin>>N>>x;
	vll a;
	for(int i=0;i<N;i++){
		ll c;
		cin>>c;
		a.pb(c);
	}
	ll ans=INFLL;
	ll b[SIZE]={};
	for(int i=0;i<SIZE;i++)
		b[i]=INFLL;
	for(int i=0;i<=N;i++){
		ll sum=x*(ll)i;
		for(int j=0;j<N;j++){
			b[j]=min(b[j],a[(j+N-i)%N]);
			sum+=b[j];
		}
		//cout<<sum<<endl;
		ans=min(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}

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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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

    ll n;
    cin >> n;
    vl a(n + 1), b(n);
    rep(i, n + 1) cin >> a[i];
    rep(i, n) cin >> b[i];

    ll ans = 0;
    rep(i, n) {
        if (a[i] - b[i] >= 0) {
            ans += b[i];
        } else {
            ans += min(a[i] + a[i + 1], b[i]);
            a[i + 1] = max(0LL, a[i + 1] + a[i] - b[i]);
        }
    }

    out(ans);
}


Measured memory_bytes: 1792
N, K = list(map(int,input().split()))
S = input()
ls = list(S)
if ls[K-1] == 'A':
  ls[K-1] = 'a'
elif ls[K-1] == 'B':
  ls[K-1] = 'b'
elif ls[K-1] == 'C':
  ls[K-1] = 'c'
print(''.join(ls))

Measured memory_bytes: 3060
n,m,x,y = map(int,input().split())

xl = list(map(int,input().split()))
yl = list(map(int,input().split()))

if y-x < 0:
    print('War')
    exit()

z = [i for i in range(x+1,y+1)]
#print(z)

flag = 0

for i in z:
    if max(xl) + 1 <= i and i <= min(yl):
        flag=1

if flag ==1:
    print('No War')
else:
    print('War')

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<array>
#include<deque>
#include<queue>
#include<map>
#include<cmath>
#include<stdio.h>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::array;
using std::queue;
using std::deque;
using std::priority_queue;
using std::multimap;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;
using std::sin;
using std::cos;
using std::log;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;
#define MOD 1000000007;
#define PI 3.141592653589793;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N, A, B, C, D;
string S;
int rc, bl;
bool bf, rf;
pair<int, int> rA, rB;
bool turn = false;
string ans = "Yes";

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

	cin >> N >> A >> B >> C >> D;
	cin >> S;
	rc = 0;bl = 0;
	rA.first = A-1;rB.first = B-1;
	rA.second = C-1;rB.second = D-1;
	for(int i = 0; i < N; i++){
		if(S[i] == '#'){
			if(rc == 0){rc = i;rf=true;}
			if(bf){//
				if( (i-bl >= 3) && (rB.first <= bl+1) && (rB.second >= i-2) ){
					turn = true;
					dbugf("TURN");
				}
				bl = 0;bf=false;
			}
		}else if(S[i] == '.'){
			if(bl==0) {bl = i;bf=true;}
			if(rf){//
				if(i-rc>=2){
					if(rA.first < rc){ rA.second = min(rc-1, rA.second);dbugf("RCA");}
					if(rB.first < rc){ rB.second = min(rc-1, rB.second);dbugf("RCB");}
				}
				rc = 0;rf=false;
			}
		}
	}
	if(bf){//
		dbug(rB.first)dbug(rB.second)dbug(bl)
		if( (N-bl >= 3) && (rB.first <= bl+1) && (rB.second <= N-2) ){
			turn = true;
		}
		bl = 0;
	}
	if(rf){//
		if(N-rc>=2){
			if(rA.first < rc) rA.second = min(rc-1, rA.second);
			if(rB.first < rc) rB.second = min(rc-1, rB.second);
		}
		rc = 0;
	}

	if(rA.second < C-1) {ans = "No";dbugf("Aou");}
	if(rB.second < D-1) {ans = "No";dbugf("Bou");}
	if(C > D && !turn) {ans = "No";dbugf("cnT");}

	cout << ans;
	return 0;
}


Measured memory_bytes: 592
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const ll INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A, ll x = 10){cout << fixed << setprecision(x) << A << endl;}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

void solve(){
  int sum = 0;
  for(int i = 0; i < 3; i++){
    int a;
    cin >> a;
    sum += a;
  }
  if(sum >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
#define INF 1000000007
#define MOD 1000000007

#define ARRAY_MAX 1005


int main(){

    ll n;

    string s;
    cin >> s;
    int ans = 0;
    REP(i,s.length()){
        if(s[i] == '2'){
            ans++;
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <utility>
using namespace std;

void trace(int a[], int n)
{
    for (int i = 0; i < n - 1; i++)
        cout << a[i] << " ";
    cout << a[n - 1] << "\n";
}

void swap(int *x, int *y)
{
    int tmp = *x;
    *x = *y;
    *y = tmp;
}

void SelectionSort(int a[], int n)
{
    bool flag = true;
    int count = 0;
    int minj;
    for (int i = 0; i < n; i++)
    {
        minj = i;
        for (int j = i; j < n; j++)
        {
            if (a[j] < a[minj])
                minj = j;
        }
        if (i != minj)
        {
            swap(&a[i], &a[minj]);
            count++;
        }
    }
    trace(a, n);
    cout << count << "\n";
}

int main(void)
{
    int n;
    cin >> n;

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

    SelectionSort(a, n);

    return 0;
}



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

int main() {
	long long n,i,j,k,sum=0,count=0;
	cin>>n;
	long long a[n],dp[n];
	for(i=0;i<n;i++)
	cin>>a[i];
	dp[0]=0; 
	dp[1]=abs(a[0]-a[1]);
	
    for(i=2;i<n;i++)
    {
	    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
	 cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1792
#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;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int r; cin >> r;
    Out(r * r);

    return 0;
}


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

int main() {
    int n, l;
    cin >> n >> l;
    string s[100];
    for (int i=0; i<n; i++) {
        cin >> s[i]; 
    }
    
    sort(s, s+n);
    
    for (int i=0; i<n; i++) {
        cout << s[i];;
    }
}

Measured memory_bytes: 256
// Brijesh Panara (201601074)
// DAIICT (India)
#include <bits/stdc++.h>
#include <time.h>
using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<ll,vector<ll>,greater<ll> > 
#define maxQueue priority_queue<ll,vector<ll>,less<ll> > 

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define FILL(a,b) memset((a),(b),sizeof((a)))

#define deb1(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

#define MOD 1000000007
#define NAX 200005
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

void FAST()
{
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    //srand(time(NULL));
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);    

}

int main()
{
    FAST();

    ll n;
    cin>>n;

    string str1,str2,str3;
    cin>>str1>>str2>>str3;

    ll cnt=  0;
    FOR(i,0,n)
    {
        set<char> s;
        s.insert(str1[i]);
        s.insert(str2[i]);
        s.insert(str3[i]);

        if(s.size()==1)
            cnt+=0;
        else if(s.size()==2)
            cnt+=1;
        else if(s.size()==3)
            cnt+=2;
    }

    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <cstdint>
#include <numeric>
#define INF 1000000000
#define LLINF 2000000000000000
#define MOD 1000000007
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
// #define int long long

signed main(){
  int a,b,c,d,e;
  cin >> a >>b>>c>>d>>e;
  int x = a*60+b;
  int y = c*60+d;
  cout << max(y-x-e,0) << endl;  
}


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

int main(){
    int N,sum;
    int mochi[101] = {};
    sum = 0;

    cin >> N;

    rep(i,N){
        int a;
        cin >> a;
        mochi[a] = 1;
    }
    rep(i,101){
        sum += mochi[i];
    }
    cout << sum << endl;

}

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

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

//少数点表示
//cout <<std::fixed << std::setprecision(14)

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n;
    cin >> n;
    vector<int> x(n);
    int maxX=1;
    int minX=100;
    rep(i,n){
        cin >> x[i];
        maxX=max(maxX,x[i]);
        minX=min(minX,x[i]);
    }
    vector<int> dp(101,0);
    int minHp=inf+1;
    rep(i,100){
        int hp=0;
        rep(j,n){
            hp=pow((x[j]-i),2);
            dp[i]+=hp;
        }
        //cout << dp[i]<<endl;
    }
    rep(i,100) minHp=min(minHp,dp[i]);
    cout << minHp << endl;

}

Measured memory_bytes: 256
package main


import (
	"fmt"
)

func main() {
	var a,b,c,d int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Scan(&d)

	count := 0
	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				total := 500 * i + 100 * j + 50 * k
				if total == d {
					count++
				}
			}
		}
	}

	fmt.Println(count)
}

Measured memory_bytes: 512
using System;

class ABC_136_A
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int A = int.Parse(input[0]);
        int B = int.Parse(input[1]);
        int C = int.Parse(input[2]);

        Console.WriteLine(Math.Max(0,C-(A-B)));
    }
}

Measured memory_bytes: 11092
#include<stdio.h>
int main(){
    
    long n,i,sum=0;
    long a[1000000];
    scanf("%ld",&n);
    
    for(i=0;i<=n;i++){
        if(i%3==0 || i%5==0 || i%15==0){
            a[i]=0;
        }else{
            a[i]=i;
        }
    }
    for(i=0;i<=n;i++){
        sum+=a[i];
    }
    printf("%ld",sum);
    
    return 0;
}


Measured memory_bytes: 9460
use std::io::{self, BufRead, BufWriter, Write};
use std::ops::Div;

fn solve<R, W>(reader: R, mut writer: W)
where
    R: BufRead,
    W: Write,
{
    let mut lines = reader.lines();
    let a_line = lines.next().unwrap().unwrap();
    let mut splited = a_line.trim().split_whitespace();
    let a: i64 = splited.next().unwrap().parse().unwrap();
    let b: i64 = splited.next().unwrap().parse().unwrap();

    let g = gcd(a, b);
    let ans = fact(g) + 1;

    writeln!(&mut writer, "{}", ans).unwrap();
}

fn gcd(x: i64, y: i64) -> i64 {
    let mut x = x;
    let mut y = y;
    while y != 0 {
        let t = y;
        y = x % y;
        x = t;
    }
    x
}

fn fact(mut n: i64) -> i64 {
    let s = (n as f64).sqrt() as usize;
    let mut result: i64 = 0;

    for i in 2..s + 1 {
        if n % i as i64 == 0 {
            loop {
                n = n.div(i as i64);
                if n % i as i64 != 0 {
                    break
                }
            };
            result += 1;
        }
    }

    if n > s as i64 {
        result += 1;
    }

    result
}

fn main() {
    let stdio = io::stdin();
    let input = stdio.lock();

    let stdout = io::stdout();
    let output = BufWriter::new(stdout.lock());

    solve(input, output);
}

#[cfg(test)]
mod tests {
    use super::*;

    const TESTS: &'static [(&'static [u8], &'static [u8])] = &[
        (
            br"12 18", br"3
",
        ),
        (
            br"420 660", br"4
",
        ),
        (
            br"1 2019", br"1
",
        ),
    ];

    #[test]
    fn test_d() {
        for &(input, expected) in TESTS {
            let mut output = Vec::new();
            solve(input, &mut output);
            let expected_str = String::from_utf8(expected.to_vec()).unwrap();
            let output_str = String::from_utf8(output).unwrap();
            assert_eq!(expected_str, output_str);
        }
    }
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int min = 1000000;
    int max = -1000000;
    long sum = 0;
    for(int i = 0; i < n; i++) {
      int a = sc.nextInt();
      sum += a;
      if(a < min) {
        min = a;
      }
      if(a > max) {
        max = a;
      }
    }
    System.out.println(min + " " + max + " " + sum);
  }
}



Measured memory_bytes: 42136
#include <bits/stdc++.h>
#define range(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, b) for (int i = 0; i < (b); i++)
#define ranger(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define repr(i, b) for (int i = (b)-1; i >= 0; i--)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
	rep(i, v.size()) { os << v[i] << (i == v.size() - 1 ? "" : " "); }
	return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S>& p) {
	os << '(' << p.first << ',' << p.second << ')';
	return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (T& x : v) { is >> x; }
	return is;
}

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

	vector<int> a = {100, 101, 102, 103, 104, 105};

	int dp[101000] = {};
	dp[0] = 1;
	rep(i, x) {
		if (dp[i] == 0) continue;
		rep(j, a.size()) { dp[i + a[j]] = 1; }
	}
	cout << dp[x] << endl;
}


Measured memory_bytes: 1024
<?php
$n = int();
$aArray = ints();
$bArray = ints();

$left = $aArray[0];
$total = 0;
$left = 0;
for($i = 0; $i < $n; $i++){
  $kill = @min($aArray[$i], $bArray[$i]);
  $aArray[$i]-=$kill;
  $bArray[$i]-=$kill;
  $total+=$kill;

  $kill = @min($aArray[$i+1], $bArray[$i]);
  $aArray[$i+1]-=$kill;
  $bArray[$i]-=$kill;
  $total+=$kill;
}
echo $total;

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}

Measured memory_bytes: 20976
N=int(input())
A=list(map(int,input().split()))
AS=[0]*N
ans=[]
div=N//2
div
j=1
for i in reversed(range(N)):
    if i+1 <= div:
        j=N//div
        div=N//(j+1)
    at=0
    for jt in range(j):
        at+=AS[(i+1)*(jt+1)-1]
    if at%2!=A[i]:
        ans.append(i+1)
        AS[i]=1

ans.reverse()
print(len(ans))
for i in ans:print(str(i)+' ',end="")


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

typedef long long LL;
const int Mod = 1000000007;
const int MN = 1 << 16 | 7;

inline int qPow(int b, int e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

int Fac[MN], iFac[MN];
void Init(int N) {
	Fac[0] = 1;
	for (int i = 1; i <= N; ++i) Fac[i] = (LL)Fac[i - 1] * i % Mod;
	iFac[N] = qPow(Fac[N], Mod - 2);
	for (int i = N; i >= 1; --i) iFac[i - 1] = (LL)iFac[i] * i % Mod;
}
inline int Binom(int N, int M) {
	if (N < 0 || M < 0 || M > N) return 0;
	return (LL)Fac[N] * iFac[M] % Mod * iFac[N - M] % Mod;
}

int N, M, U, A[17];
int f[MN], g[MN], Ans;

int main() {
	scanf("%d%d", &N, &M);
	U = (1 << N) - 1, Init(1 << N);
	for (int i = 1; i <= M; ++i) scanf("%d", &A[i]);
	f[0] = 1;
	for (int i = M; i >= 1; --i) {
		for (int S = 0; S <= U; ++S) g[S] = f[S];
		for (int S = 0; S <= U; ++S)
			for (int j = 0; j < N; ++j) if (~S >> j & 1)
				g[S ^ 1 << j] = (g[S ^ 1 << j] - (LL)f[S] * Binom((1 << N) - A[i] - S, (1 << j) - 1)) % Mod;
		std::swap(f, g);
	}
	for (int S = 0; S <= U; ++S) {
		int num = (LL)f[S] * Fac[S ^ U] % Mod;
		for (int j = 0; j < N; ++j) if (~S >> j & 1)
			num = (LL)num * iFac[1 << j] % Mod;
		Ans = (Ans + num) % Mod;
	}
	for (int j = 0; j < N; ++j) Ans = 2ll * Ans * Fac[1 << j] % Mod;
	printf("%d\n", (Ans + Mod) % Mod);
	return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <string.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(void){
	int h, w;
	int can_paint_sharp = 0;
	int sharp_cnt = 0;
	int nx, ny;
	cin >> h >> w;
	char v[h][w];
	REP(i, h){
		REP(j, w){
			cin >> v[i][j];
			if(v[i][j] == '#'){
				sharp_cnt += 1;
			}
		}
	}

	REP(i, h){
		REP(j, w){
			int nx = i;
			int ny = j;
			REP(p, 4){
				int tx = nx + dx[p];
				int ty = ny + dy[p];
				if(v[nx][ny] == '#' && v[tx][ty] == '#'){
					can_paint_sharp += 1;
					break;
				}
			}
		}
	}
	if(can_paint_sharp >= sharp_cnt) cout << "Yes" << "\n";
	else cout << "No" << "\n";


}


Measured memory_bytes: 888
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

int main(){
  int n, m;
  while(cin >> n >> m, n){
    vector<int> K(n);
    vector<vector<long long>> X(n), D(n);
    vector<vector<vector<long long>>> dp(n);
    long long INF = 1e18;

    for(int i = 0; i < n; ++i){
      cin >> K[i];
      for(int j = 0; j < K[i]; ++j){
        int x, d;
        cin >> x >> d;
        X[i].emplace_back(x);
        D[i].emplace_back(d);
        dp[i].emplace_back(m+1,INF);
      }
    }

    for(int i = 0; i < K[0]; ++i){
      dp[0][i][0] = 0;
    }
    if(m){
      for(int i = 0; i < K[1]; ++i){
        dp[1][i][1] = 0;
      }
    }

    for(int i = 0; i < n-1; ++i){
      for(int j = 0; j < K[i]; ++j){
        long long x = X[i][j], d = D[i][j];
        for(int k = 0; k <= m; ++k){
          if(dp[i][j][k] >= INF)
            continue;

          for(int l = 0; l < K[i+1]; ++l)
            dp[i+1][l][k] = min(dp[i+1][l][k], dp[i][j][k]+(d+D[i+1][l])*abs(X[i+1][l]-x));

          if(k < m and i+2 < n){
            for(int l = 0; l < K[i+2]; ++l)
              dp[i+2][l][k+1] = min(dp[i+2][l][k+1], dp[i][j][k]+(d+D[i+2][l])*abs(X[i+2][l]-x));
          }
        }
      }
    }
    
    long long ans = INF;
    for(int i = n-2; i < n; ++i){
      for(int j = 0; j < K[i]; ++j){
        for(int k = 0; k <= m; ++k){
          if(i == n-2 and k == m) continue;
          ans = min(ans,dp[i][j][k]);
        }
      }
    }
    
    cout << ans << endl;
  }
}



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

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

    vector<int64_t> a(n);
    for (auto& e : a) cin >> e;

    int64_t ans = 0;

    for (int64_t i = 50, b = 1ll << i, ka = 0; i >= 0; i--, b >>= 1) {
        int64_t tmp = 0;
        for (auto& e : a) tmp += e & b;

        if (ka + b > k || tmp > n * b - tmp) {
            ans += tmp;
        } else {
            ans += n * b - tmp;
            ka += b;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String S = scn.next();
        char [] A = new char[S.length()];
        
        for(int i=0;i<S.length();i++){
        A[i] = S.charAt(i);
        }
        
        if(A[0] == A[1] && A[1] == A[2]){
            System.out.println("No");
        }
        
        else{
            System.out.println("Yes");
        }
        
    }
}

Measured memory_bytes: 21716
package main

import (
	"fmt"
)

func main() {
	var a, b, t int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&t)

	var ret int
	i := a
	for float64(i) < float64(t)+0.5 {
		ret += b
		i += a
	}

	fmt.Println(ret)
}


Measured memory_bytes: 512
#include <stdio.h>
int main(){

  int n,team[100]={0},num[100],rank[100],ta,tb,sa,sb,i,j;
  int blank;
  
  scanf("%d",&n);

  for(i = 0; i < (n*n-n)/2; i++){

    scanf("%d %d %d %d",&ta,&tb,&sa,&sb);

    if(sa > sb) team[ta-1] += 3; 
    else if(sa < sb) team[tb-1] += 3;
    else{

      team[ta-1]++;
      team[tb-1]++;

    }

  }

  for(i = 0; i < n; i++) num[i]=i;

  for(i = 0; i < n-1; i++){

    for(j = 0; j < n-1; j++){

      if(team[j] < team[j+1]){

        blank=team[j];
        team[j]=team[j+1];
        team[j+1]=blank;

        blank=num[j];
        num[j]=num[j+1];
        num[j+1]=blank;
        
      }

    }

  }

  // for(i = 0; i < n; i++) printf("%d\n",num[i]);

  rank[0]=1;
  for(i = 1; i < n; i++){

    rank[i]=i+1;
    if(team[i] == team[i-1]) rank[i]=rank[i-1];

  }

  //for(i = 0; i < n; i++) printf("%d\n",rank[i]);
  
  for(i = 0; i < n-1; i++){

    for(j = 0; j < n-1; j++){

      if(num[j] > num[j+1]){

        blank=num[j];
        num[j]=num[j+1];
        num[j+1]=blank;

        blank=rank[j];
        rank[j]=rank[j+1];
        rank[j+1]=blank;
        
      }

    }

  }
  //for(i = 0; i < n; i++) printf("%d\n",num[i]);
  for(i = 0; i < n; i++) printf("%d\n",rank[i]);

  return 0;

}
  
      

Measured memory_bytes: 2732
#include<stdio.h>
int main(){
  long long i,n,d[31]={1,1,2};
  for(i=3;i<31;i++)d[i]=d[i-1]+d[i-2]+d[i-3];
  while(scanf("%lld",&n),n)printf("%lld\n",(d[n]-10)/3650+1);
  return 0;
}

Measured memory_bytes: 600
d = {1:"a", 2:"c", 3:"a", 4:"b", 5:"a", 6:"b", 7:"a", 8:"a", 9:"b", 10:"a", 11:"b", 12:"a"}
x, y = map(int, input().split())
if (d[x] == d[y]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<stdio.h>

int main()
{
  int  a, b;

  scanf("%d %d", &a, &b);

  if(a == b){
    printf("Draw\n");
  }else if( a == 1){
    printf("Alice\n");
  }else if( b == 1){
    printf("Bob\n");
  }else if( a > b){
    printf("Alice\n");
  }else {
    printf("Bob\n");
  }

  return 0;
}

Measured memory_bytes: 128