akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 1e5;

int n;
int val[N + 1];
struct Edge {
	int to, next;
} edge[(N << 1) + 1];
int start[N + 1], tot;
int d[N + 1], up[N + 1];

inline void addedge(int u, int v)
{
	edge[++tot] = Edge{ v, start[u] };
	start[u] = tot;
	edge[++tot] = Edge{ u, start[v] };
	start[v] = tot;
	d[u]++;
	d[v]++;
	return;
}
inline bool dfs(int u, int fa)
{
	if (d[u] == 1) {
		up[u] = val[u];
		return false;
	}
	int sum = 0, maxx = 0;
	for (int i = start[u]; i; i = edge[i].next) {
		int v = edge[i].to;
		if (v != fa) {
			if (dfs(v, u))
				return true;
			sum += up[v];
			maxx = max(maxx, up[v]);
		}
	}
	up[u] = (val[u] << 1) - sum;
	if (up[u] < 0 || up[u] > val[u] || val[u] < maxx) {
		printf("NO\n");
		return true;
	}
	return false;
}
int main()
{
	n = read();
	for (int i = 1; i <= n; i++)
		val[i] = read();
	for (int i = 1; i < n; i++) {
		int u = read(), v = read();
		addedge(u, v);
	}
	if (n == 2) {
		if (val[1] == val[2])
			printf("YES\n");
		else
			printf("NO\n");
		return 0;
	}

	for (int i = 1; i <= n; i++) {
		if (d[i] > 1) {
			if (!dfs(i, 0)) {
				if (up[i])
					printf("NO\n");
				else
					printf("YES\n");
			}
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 13156
N,W = map(int,input().split())
wv = []
sumv = 10
for i in range(N):
    wv.append(list(map(int,input().split())))
    sumv += wv[i][1]

dp = [[ 10**100 for i in range(sumv+1)] for j in range(N+1)]

dp[0][0] = 0

for i in range(N):
    for v in range(sumv):
        if v - wv[i][1] >= 0:
            dp[i+1][v] = min(dp[i][v] , dp[i][v - wv[i][1]] + wv[i][0])
        else:
            dp[i+1][v] = min(dp[i+1][v] , dp[i][v])

ans = 0
for i in range(sumv):
    if dp[N][i] <= W:
        ans = max(ans , i)
print(ans)


Measured memory_bytes: 173192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,a[200005],f[200005];ll k;
bool check(ll x){
    ll res=0;
    rep(i,1,n) {
        ll ex=x/f[i];
        res+=max(0ll,a[i]-ex);
    }
    return res<=k;
}
int main()
{
    fastio;
    cin>>n>>k;
    rep(i,1,n) cin>>a[i];
    rep(i,1,n) cin>>f[i];
    sort(a+1,a+n+1);sort(f+1,f+n+1);
    reverse(a+1,a+n+1);
    ll l=0,r=1e18;
    while(l<r){
        ll mid=(l+r)>>1;
        if(check(mid)) r=mid;
        else l=mid+1;
    }
    cout<<l;
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <sstream>
#include <iostream>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <string.h>
#include <bitset>
#define sf scanf
#define pf printf
#define lf double
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define ll long long
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define eps 1e-7
#define zero(x) (((x) > 0? (x):(-x)) < eps)
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <sstream>
#include <iostream>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <string.h>
#include <bitset>

using namespace std;
//https://codeforces.com/contest/1238/problems
//https://codeforces.com/contest/1238/submit
ll a[100000];
int main(){
    ll n;
    sld(n)
    ll sum = 0;
    for(int i = 0; i < n; i ++){
        sld(a[i])
        sum += a[i] -1;
    }
    pld(sum) pn


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#define min(a, b) a < b ? a : b
#define maxN 100000 + 16
#define inf 0x7f7f7f7f

using namespace std;

int par[maxN], mark[maxN];
int qx[maxN], qt[maxN], tt;

int find(int x)
{
	return mark[x] < tt ? x : par[x] = find(par[x]);
}

int main()
{
	int n, t, i, x, nn;
	char c[2];
	long long sum;
	while (scanf("%d%d", &n, &t) && (n || t))
	{
		for (i = 2; i <= n; i++)
		{
			scanf("%d", &par[i]);
			mark[i] = inf;
		}
		for (i = 1, nn = 0; i <= t; i++)
		{
			scanf("%s%d", c, &x);
			if (c[0] == 'M')
				mark[x] = min(mark[x], i);
			else
			{
				qx[nn] = x;
				qt[nn++] = i;
			}
		}
		sum = 0;
		while(nn--)
		{
			tt = qt[nn];
			sum += find(qx[nn]);
		}
		printf("%lld\n", sum);
	}
	return 0;
}

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

int main()
{
	long double a,b,j,c;
	int h,m;//a是时针10 40
	cin>>a>>b>>h>>m;
	j=30*h-5.5*m;//300 220
	if(j>180)j=360-j;
	//a平方+b平方-2ab*cos
	j=j*3.141592653589793/180;
	c=a*a+b*b-2*a*b*cos(j);
	c=sqrt(c);
	cout<<fixed<<setprecision(20)<<c<<endl;
	return 0;
}

Measured memory_bytes: 4136
#include<iostream>
using namespace std;
long long n,x,y,a,b,sum,pos,res,cur;
int main()
{
	cin>>n>>x>>y>>a>>b;
	sum=y-x+b*(n-1);
	if (b==0 && x==y)
	{
		cout<<"YES"<<endl;
		return 0;
	}
	if (sum<0 || b==0) 
	{
		cout<<"NO"<<endl;
		return 0;
	}
	pos=b+b;
	cur=sum/pos;
	if (sum%pos==0) cur--;
	sum=sum%pos;
	if (sum+cur*(b-a)>=a+b || sum==0)
	{
		if (cur+1>n-1) cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
		return 0;
	}
	if (a==b) 
	{
		cout<<"NO"<<endl;
		return 0;
	}
	pos=-a+b;
	res=sum/pos;
	if (sum%pos==0) res--;
	if (res+cur+1>n-1) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return 0;
}

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

const int mxn = 2e5;
vector<int> adj[mxn];
vector<bool> vis(mxn, 1);
vector<int> ans(mxn, 0), acc(mxn, 0);

void bfs(int w){
	vis[w] = 0;
	ans[w] += acc[w];
	queue<int> q;
	q.push(w);
	while(q.size()){
		int v = q.front();
		q.pop();
		for(int u : adj[v]){
			if(vis[u]){
				vis[u] = 0;
				acc[u] += acc[v];
				ans[u] += acc[u];
				q.push(u);
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n, q; cin >> n >> q;
	for(int i = 0, a, b; i < n - 1; ++i){
		cin >> a >> b; --a, --b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	for(int i = 0, a, b; i < q; ++i){
		cin >> a >> b; --a;
		acc[a] += b;
	}
	bfs(0);
	for(int i = 0; i < n; ++i){
		if(i) cout << ' ';
		cout << ans[i];
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 17248
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    string s;
    cin >> s;
    for(int i =0; i<s.size() ; i++)cout << 'x';
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int A,B,C,X,Y; cin>>A>>B>>C>>X>>Y;

    C*=2;
    
    int ans;
    if(A+B<=C){
        ans=A*X+B*Y;
    }
    else{
        if(X>=Y){
            ans=C*Y+min(A,C)*(X-Y);
        }
        else{
            ans=C*X+min(B,C)*(Y-X);
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split, n = rd[0].to!size_t, a = rd[1].to!long, b = rd[2].to!long, c = a-b;
  auto h = new long[](n);
  foreach (i; 0..n) h[i] = readln.chomp.to!long;

  auto calc(long x)
  {
    auto y = 0;
    foreach (hi; h) {
      auto g = hi - b * x;
      if (g > 0) {
        y += (g + c - 1) / c;
        if (y > x) return false;
      }
    }
    return true;
  }

  struct XR { long x; bool r; }

  auto ma = (h.reduce!max + b - 1) / b;
  auto r = iota(1L, ma+1)
    .map!(x => XR(x, calc(x)))
    .assumeSorted!"a.r < b.r"
    .equalRange(XR(0L, true))
    .front.x;

  writeln(r);
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
long long dp[100010];
long long h[100010];
const int MOD = 1000000007;

int main()
{
  int n; cin >> n;
  ll pow = 1;
  Rep(i, 1, n + 1)
  {
    pow *= i;
    pow %= MOD;
  }
  cout << pow << endl;
}

Measured memory_bytes: 256
/*<---------------------------CONCEPTS LEARNT------------------------------>

<-------------------------------------------------------------------------->
            _           __                _      _____ _____ _____ 
  ___ _   _| |__   ___ / _|_ __ ___  __ _| | __ |___  |___  |___  |
 / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ /    / /   / /   / / 
| (__| |_| | |_) |  __/  _| | |  __/ (_| |   <    / /   / /   / /  
 \___|\__,_|_.__/ \___|_| |_|  \___|\__,_|_|\_\  /_/   /_/   /_/   

*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vi;
typedef vector<pll> vpll;
typedef unordered_map <ll,ll> umap ; 
//#pragma GCC optimize "trapv"
#define loop(i,a,b) for(ll i=a ;i<b;i++)
#define For(i,n) for(int i=0;i<(ll)n;i++)
#define Rev(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define F first
#define S second
#define pb push_back
#define em emplace_back
#define all(v) (v).begin(),(v).end()
#define mems(x, y) memset(x, y, sizeof(x))
#define sz(v) (v).size()
#define mp(a,b) make_pair(a,b)
#define pf(n) cout<<n<<"\n"
#define pff(n) cout << n << " " ; 
long const M=1e9+7;
const long mxN =2e5+2 ;
const long mxNN =1e6+2 ;
ll a[mxN] ;

void solve(){
    ll n ; cin >> n ;
    map <ll,ll> m ;
    For(i,n){
        cin >> a[i] ;
        m[a[i]]++ ;
        
    }
    ll ans =0 ;
    for(auto x :m){
        ans+=x.S*(x.S-1)/2 ;
    }
    //cout << ans << endl ;
    For(i,n){
        ll c = m[a[i]] ;
        ll temp ;
        temp = ans-c*(c-1)/2 ;
        c-- ;
        temp+=c*(c-1)/2 ;
        cout << temp << endl ;
    }
    
}
int main() {
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     solve() ;
     //ll t ; cin >> t ; while(t--)solve();
	return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
   string s;
   cin>>s;
   for(int i=0;i<s.length();i++){
    if(s[i]=='1')
        s[i]='9';
    else if(s[i]=='9')
        s[i]='1';
   }
   cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define maxn 55
#define maxm 125005
#define int long long
#define INF 1e9 + 10
int n, X, D, ans, cnt, dp[maxm];
int w[maxn], val[maxn], pos[maxn];
int tot, V[maxn * maxn], W[maxn * maxn];

int read()
{
    int x = 0, k = 1;
    char c; c = getchar();
    while(c < '0' || c > '9') { if(c == '-') k = -1; c = getchar(); }
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * k;
}

struct edge
{
    int cnp, to[maxn], last[maxn], head[maxn];
    edge() { cnp = 1; }
    void add(int u, int v)
    { to[cnp] = v, last[cnp] = head[u], head[u] = cnp ++; }
}E1;

void dfs(int u)
{
    val[u] = 1;
    for(int i = E1.head[u]; i; i = E1.last[i])
    {
        int v = E1.to[i];
        dfs(v);
        w[u] += w[v]; val[u] += val[v];
    }
    cnt += val[u] * n; pos[u] = u;
}

bool cmp(int x, int y) { return val[x] * w[y] > val[y] * w[x]; }
void Get_min(int &x, int y) { x = x < y ? x : y; }

signed main()
{
    n = read(), X = read(), D = read();
    w[1] = read();
    for(int i = 2; i <= n; i ++)
    {
        w[i] = read(); int x = read();
        E1.add(x, i);
    }
    dfs(1);
    int tmp = min(n, D);
    for(int i = 1; i <= cnt; i ++) dp[i] = INF;
    for(int i = 1; i <= n; i ++)
    {
        int len = 1, lim = tmp;
        while(lim >= len)
        {
            V[++ tot] = len * val[pos[i]];
            W[tot] = len * w[pos[i]];
            lim -= len, len <<= 1;
        }
        if(lim) V[++ tot] = lim * val[pos[i]], W[tot] = lim * w[pos[i]];
    }
    for(int i = 1; i <= tot; i ++)
        for(int j = cnt; ~j; j --)
                if(j >= V[i]) Get_min(dp[j], dp[j - V[i]] + W[i]); // k件物品

	sort(pos + 1, pos + n + 1, cmp);
    int ans = 0;
    for(int i = 0; i <= cnt; i ++)
       {
        if(dp[i] > X) continue;
        int ret = i, left = X - dp[i];
        for(int j = 1; j <= n; j ++)
        {
            int tem = pos[j], used = min(max(D - n, 0LL), left / w[tem]);
            if(tem == 1) used = left / w[tem];
            left -= w[tem] * used;
            ret += val[tem] * used;
        }
        ans = max(ans, ret);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
ll MOD = 1000000007;
ll INF =1<<30;
ll dp[110][100100];

int main(){
   vector<int>a{1, 1, 1, 2, 1, 2,
    1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
   int k;
   cin >> k;
   cout << a[k-1] <<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb() push_back()
#define mod 100000007
#define elif else if
#define str string

signed main(){
  int N,M,O,P,count=0,Amax=0,imin=0,Amin=0;
  double d;
  char c;
  string S;
  cin>>S;
  rep(0,S.size()/2){
    if(S[i]!=S[S.size()-1-i])count++;
  }
  cout<<count<<endl;
}


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



int main(void){
    int d;
    cin >> d;
    string s = "Christmas";
    for(int i=d;i<25;i++){
        s += " Eve";
    }
    cout << s <<endl;
    return 0;
}






































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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

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

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

bool solve(const vvi& g,const vi& a,int u,vi& win)
{
	if(win[u]!=-1) return win[u];
	win[u]=0;
	for(int v:g[u]) if(!solve(g,a,v,win)) win[u]=1;
	return win[u];
}

int main()
{
	for(int n;cin>>n&&n;){
		vi a(n);
		rep(i,n) cin>>a[i];
		vvi g(n);
		rep(i,n-1){
			int u,v; cin>>u>>v; u--,v--;
			if(a[u]>a[v]) g[u].push_back(v);
			if(a[v]>a[u]) g[v].push_back(u);
		}
		vi win(n,-1);
		rep(i,n) solve(g,a,i,win);
		vi res;
		rep(i,n) if(win[i]) res.push_back(i);
		rep(i,res.size()) cout<<res[i]+1<<(i+1<res.size()?" ":""); cout<<endl;
	}
}


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

int main()
{
int a[3],b;
for(int S = 0; S < 3; S++){
	cin >> a[S]; 
}
sort(a,a + 3,greater<int>());
b = a[1] + a[2];
cout << b << endl;
return 0;
}

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

int main(){
    string s; cin >> s;
    
    int cnt = 0;
    if(s.size() < 2){
        cout << cnt << endl;
    }
    else{
        for(int i=0;i<s.size()-1;i++){
            if(s.at(i) == s.at(i + 1)){
                cnt++;
                if(s.at(i) == '0'){s.at(i + 1) = '1';}
                else{s.at(i + 1) = '0';}
            }
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 512
S = input()
K = input()

#A = int(l[0])


length_1 = len(S)
K = int(K)

i =int(S)
v_1 = []
#cnt = []
while i > 0:
    v_1.append( i % 10 )
    #cnt.append(1)
    i //= 10 # 必須
v_1.reverse()

length_n = 0
target_v_num = 0

while length_n < K:
    V = v_1[target_v_num]
    length_n = length_n + 1
    if V > 1:
        length_n = length_n + K
    target_v_num = target_v_num + 1


print(V)


Measured memory_bytes: 3064
import math
pi = math.pi
A, B, H, M = map(int, input().split())

# thetaの正負が少し気になるが、cosを取るだけなので問題ない
theta = 2 * pi * ((H * 60 + M) / (12 * 60) - M / 60)

# 余弦定理
ans2 = A * A + B * B - 2 * A * B * math.cos(theta)
# 平方根を取るのを忘れずに
ans = math.sqrt(ans2)

print(ans)


Measured memory_bytes: 9396
#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	long a[n];
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	int ans = 0;
	for(int i = 0;i < n;i++){
		while(a[i] % 2 == 0){
			a[i] /= 2;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  while(n>0)
  {
    if(n%10==7)
    {
      cout<<"Yes";
      break;
    }
    n=n/10;
    if(n==0)
      cout<<"No";
  }
  return 0;
}

Measured memory_bytes: 3588
def TableTennis():
    N, A, B = map(int, input().split())
    ans = 0
    if (A - B) % 2 == 0:
        ans = abs(A - B) // 2
    else:
        len_1 = A - 1
        len_2 = N - B
        ans = min(len_1, len_2) + 1 + ((abs(A - B) - 1) // 2)
    print(ans)

TableTennis()


Measured memory_bytes: 2940
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string ss;
void check(string s){
  if (s=="mew"){
    cout<<"Cat"<<endl;
    return ;
  }
  for (int i=0;i<s.length()-2;i++){
    if (s[i]=='m'&&s[i+1]=='e'&&s[i+2]=='w'){
      s[i]=' ';
      s[i+1]=' ';
      s[i+2]=' ';
    }
  }
  int l=s.length();
  for (int i=0;i<l;i++){
    if (s[i]==' '){
      for (int j=i;j<l;j++){
	s[j]=s[j+3];
      }
	s.erase(l-3,l);
      l-=3;
    }
  }
  if (s=="mew"){
    cout<<"Cat"<<endl;
    return ;
  }
  if (s.empty()||s==ss){
    cout<<"Rabbit"<<endl;
    return ;
  }
  ss=s;
  return check(s);
}
int main(){
  string s;
  cin>>s;
  check(s);
}

Measured memory_bytes: 1252
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void printArray(int[] intArray){
		for (int i = 0; i < intArray.length; i++){
			System.out.print(intArray[i]);

			if (i == intArray.length - 1){
				break;
			}
			System.out.print(" ");
		}
		System.out.println();
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
		int seriesNum = Integer.parseInt(br.readLine());
		String[] series = br.readLine().split(" ");
		int[] cardNumberResult = new int[seriesNum];

		for (int i = 0; i < seriesNum; i++){
			cardNumberResult[i] = Integer.parseInt(series[i]);
		}
		for (int i = 0; i < seriesNum; i++){
			if (i == 0){
				printArray(cardNumberResult);
			}
			
			if (i == seriesNum -1){
				break;
			}
			for (int j = i + 1; 0 < j ; j--) {

				if (cardNumberResult[j] < cardNumberResult[j - 1]){
					int tmp = cardNumberResult[j - 1];
					cardNumberResult[j - 1] = cardNumberResult[j];
					cardNumberResult[j] = tmp;
				}
				else {
					break;
				}
			}
			printArray(cardNumberResult);
		}
	}
}

Measured memory_bytes: 32300
#include<cstdio>
int main(void){int h,w,i,j;scanf("%d%d",&h,&w);while((h!=0)||(w!=0)){for(i=0;i<h;++i){for(j=0;j<w;++j){printf("%c",((j+i)%2)?'.':'#');}puts("");}puts("");scanf("%d%d",&h,&w);}return(0);}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,A,B,C; cin >> N >> A >> B >> C;
    vector<string> S(N);
    for (int i=0;i<N;++i) cin >> S[i];
    int a=-A,b=-B,c=-C;
    vector<vector<int>> minwin(3,vector<int>(N+1,0));
    for (int i=0;i<N;++i){
        for (int j=0;j<3;++j) minwin[j][i+1]=minwin[j][i];
        if (S[i]=="AB"){
            ++a,++b;
            minwin[0][i+1]=(0<a?(a+1)/2:0);
            minwin[1][i+1]=(0<b?(b+1)/2:0);
        } else if (S[i]=="BC"){
            ++b,++c;
            minwin[1][i+1]=(0<b?(b+1)/2:0);
            minwin[2][i+1]=(0<c?(c+1)/2:0);
        } else {
            ++c,++a;
            minwin[2][i+1]=(0<c?(c+1)/2:0);
            minwin[0][i+1]=(0<a?(a+1)/2:0);
        }
    }
    for (int i=0;i<=N;++i){
        int sum=0;
        for (int j=0;j<3;++j) sum+=minwin[j][i];
        if (i<sum){cout << "No" << '\n'; return 0;}
    }
    cout << "Yes" << '\n';
    a=b=c=0;
    for (int i=0;i<N;++i){
        int ma=minwin[0][i+1],mb=minwin[1][i+1],mc=minwin[2][i+1];
        int na=upper_bound(minwin[0].begin(),minwin[0].end(),a)-minwin[0].begin();
        int nb=upper_bound(minwin[1].begin(),minwin[1].end(),b)-minwin[1].begin();
        int nc=upper_bound(minwin[2].begin(),minwin[2].end(),c)-minwin[2].begin();
        char ans;
        if (S[i]=="AB"){
            if (a<ma) ans='A',++a;
            else if (b<mb) ans='B',++b;
            else if (na<nb) ans='A',++a;
            else ans='B',++b;
        } else if (S[i]=="BC"){
            if (b<mb) ans='B',++b;
            else if (c<mc) ans='C',++c;
            else if (nb<nc) ans='B',++b;
            else ans='C',++c;
        } else {
            if (c<mc) ans='C',++c;
            else if (a<ma) ans='A',++a;
            else if (nc<na) ans='C',++c;
            else ans='A',++a;
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 7948
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

;;

int main(){
  ;;
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    ;
    int cnt = 0;;
    if(s[a]!='-') {;cout << "No" << endl;; return 0;};
    for(int i = 0; i < s.size(); ++i){;;;
        if(i!=a) {;if(!(('0'<=s[i]&&s[i]<='9'))) {;cout << "No" << endl;; return 0;};}
        else {;continue;;};
    };;;
    cout << "Yes" << endl;;
}

Measured memory_bytes: 504
import java.util.Scanner;
public class Main{
 	public static void main(String[] args) {
 		Scanner stdIn=new Scanner(System.in);
 		int n=stdIn.nextInt();
 		long sum=0;
 		for(int i=1;i<n+1;i++) {
 			if(i%3!=0&&i%5!=0) {
 				sum+=i;
 			}
 		}
 		System.out.println(sum);
 	
 
 	}
 
 }


Measured memory_bytes: 35816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool used[100005]={0};
int tp[100005]={0};
vector<int> node[100005];
void dfs(int pos,int val){
  tp[pos]=val;
  val++;
  val%=2;
  for(int i=0;i<node[pos].size();i++){
    int to=node[pos][i];
    if(!used[to]){
      used[to]=true;
      dfs(to,val);
    }
  }
}
int main(){
  ll n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    node[a].push_back(b);
    node[b].push_back(a);
  }
  used[1]=true;
  dfs(1,1);
  ll t0=0,t1=0;
  for(int i=1;i<=n;i++){
    for(int j=0;j<node[i].size();j++){
      int to=node[i][j];
      if(tp[i]==tp[to]){
        ll ans=n*(n-1)/2;
        ans-=m;
        cout<<ans<<endl;
        return 0;
      }
    }
    if(tp[i]==0) t0++;
    else t1++;
  }
  cout<<t0*t1-m<<endl;
}


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

int main(){

    int X;
    cin >> X;

    int u=0;
    int n_500 = X / 500;
    int n_5 = (X-n_500*500)/5;
    u = n_500*1000+n_5*5;

    cout << u << endl;

    return 0;
}

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

using namespace std;

int main()
{
	int x, y, z[] = { -1, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 };
	cin >> x >> y;
	if (z[x] == z[y]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;
#define INF 0x3f3f3f3f
#define ESP 1e-8
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
const double PI = acos(-1.0);

const ll MOD = 1e9+7;

ll H, W, K;
#define N 105
ll dp[N][9], cnt[9], tot;

void init(){
    ll i, j;
    tot = 1;
    for(i = 1<<1; i < (1<<W); i+=2){
        bool ok = 1;
        for(j = 1; j <= W-2; ++j){
            if(i>>j & 1 && i>>(j+1) & 1){
                ok = 0;
                break;
            }
        }
        if(ok){
            tot++;
            for(j = 1; j <= W-1; ++j)
                if(i>>j & 1)
                    cnt[j]++;
        }
    }
}

ll f(ll h, ll x){
    if(x < 1 || x > W)
        return 0;
    if(dp[h][x] != -1)
        return dp[h][x];
    dp[h][x] = (((tot-cnt[x-1]-cnt[x])*f(h-1,x)%MOD
               + cnt[x-1]*f(h-1,x-1)%MOD)%MOD
               + cnt[x]*f(h-1,x+1)%MOD)%MOD;
    return dp[h][x];
}

int main(){
    // FILE *fp = freopen("out.txt", "w", stdout);
    // freopen("in.txt", "r", stdin);
    ll i;
    while(scanf("%lld%lld%lld", &H, &W, &K) != EOF){
        memset(dp, -1, sizeof(dp));
        memset(cnt, 0, sizeof(cnt));
        init();
        for(i = 1; i <= W; i++)
            dp[0][i] = 0;
        dp[0][1] = 1;
        f(H, K);
        printf("%lld\n", dp[H][K]);
    }

    // fclose(fp);
    return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define ld double
#define ll long long
#define pii pair <int, int>
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

#define PI acos(-1)
#define MOD 1000000007
#define MUL 19260817
#define EPS 1e-10
#define INF 1e9
#define LINF 1e18

template <typename T> inline void chkmin(T &x, T y) {if (y < x) x = y;}
template <typename T> inline void chkmax(T &x, T y) {if (y > x) x = y;}
template <typename T> inline T add(T x, T y) {return (x + y) % MOD;}
template <typename T> inline T mul(T x, T y) {return 1LL * x * y % MOD;}
template <typename T> inline T qp(T x, T n) {
	T ans = 1;
	do {if (n & 1) ans = mul(ans, x); x = mul(x, x);} while (n >>= 1);
	return ans;
}

#ifndef DEBUG
const int SZ = 1 << 13;
char buff[SZ], *pos = buff + SZ - 1;
#define getchar() (++ pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos)
#endif

inline ll read() {
	ll x = 0; int f = 1, c = getchar();
	for (;!isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x<<3) + (x<<1) + (c^48);
	return x * f;
}

const int N = 1 << 18;
int n, c[N], cnt[N], dp[N];

int main() {
	n = read();
	rep(i, n) c[i] = read();
	n = unique(c, c + n) - c;
	dp[0] = 1;
	rep(i, n) {
		dp[i + 1] = add(dp[i], cnt[c[i]]);
		cnt[c[i]] = add(cnt[c[i]], dp[i]);
	}
	printf("%d\n", dp[n]);
	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
	int i,j,k;
	int s=0;
	int n,a;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a;
		if(a%2==1)s++;
	}
	if(s%2==0){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 764
base = list(map(int,input().split()))
cross = list(map(int,input().split()))
counter = 0
for i in range(base[0]):
    source = list(map(int,input().split()))
    point = 0
    for j in range(base[1]):
        point = point + cross[j]*source[j]
    
    if point+base[2] >0:
        counter = counter+1

print(counter)

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  ll a, b, x;
  cin >> a >> b >> x;
  if(a == 0) cout << b/x +1 << "\n";
  else cout << b/x -(a-1)/x << "\n";
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector <ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <vector<ll>> vv;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;

#define Endl endl


/*--------------------template--------------------*/



int main() {
    cin >> s;
    cout << ((s.size() % 2 == 0 ? true : false) ^ (s[0] == s.back() ? true : false) ? "Second" : "First") << endl;
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int win(int sl, int sr, int el, int er)
{
    if(sl+sr==0) return 0;
    if(el+er==0) return 1;

    int ret=0;

    if(sl!=0)
    {
        if(el!=0)
        {
            int nel=sl+el;
            if(nel>4) nel=0;
            ret|=!win(nel,er,sl,sr);
        }
        if(er!=0)
        {
            int ner=sl+er;
            if(ner>4) ner=0;
            ret|=!win(el,ner,sl,sr);
        }
    }
    if(sr!=0)
    {
        if(el!=0)
        {
            int nel=sr+el;
            if(nel>4) nel=0;
            ret|=!win(nel,er,sl,sr);
        }
        if(er!=0)
        {
            int ner=sr+er;
            if(ner>4) ner=0;
            ret|=!win(el,ner,sl,sr);
        }
    }

    return ret;
}

int main()
{
    int li,ri,ln,rn;
    cin >>li >>ri >>ln >>rn;
    string ans="NAKAJIMA";
    if(win(li,ri,ln,rn)) ans="ISONO";
    cout << ans << endl;
    return 0;
}

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

using i64 = int64_t;

constexpr i64 MAX_N = 100005;

i64 prime[MAX_N]; // i番目の素数
bool is_prime[MAX_N + 1];   // is_prime[i]がtrueならばiは素数

// n以下の素数の数を返す
i64 sieve(i64 n) {
    i64 p = 0;
    for (i64 i = 0; i <= n; i++)
        is_prime[i] = true;
    is_prime[0] = false;
    is_prime[1] = false;
    for (i64 i = 2; i <= n; i++) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (i64 j = 2 * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return p;
}

int main(){
    int n = sieve(100000);
    int m, a, b;
    while(cin >> m >> a >> b, m > 0){
        int max_area = 0, max_p = 0, max_q = 0;
        for(int i=0, q=prime[i];i<n&&q<=m;q=prime[++i]){
            for(int j=0, p=prime[j];j<n&&p*q<=m;p=prime[++j]){
                if(b*p < a*q)continue;
                if(b*p > b*q)break;
                if(p*q > max_area){
                    max_area = p*q;
                    max_p = p;
                    max_q = q;
                }
            }
        }
        cout << max_p << " " << max_q << endl;
    }

    return 0;
}



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

using namespace std;

int main(){

	int n;
	cin>>n;
	string str;
	getline(cin,str);
	for(int i = 0; i < n; i++){
		int out=0;
		bool runnner[3];
		for(int j = 0; j < 3; j++)
			runnner[j]=false;
		int score=0;

		int sit=0;
		while(1){
			getline(cin,str);
			if(str=="HIT"){
				if(sit==0)
					sit=1;
				else if(sit==1){
					sit=3;
				}
				else if(sit==2)
					sit=5;
				else if(sit==4){
					sit=1;
					score++;
				}
				else if(sit==3)
					sit=7;
				else if(sit==5){
					sit=3;
					score++;
				}
				else if(sit==6){
					sit=5;
					score++;
				}
				else if(sit==7){
					sit=7;
					score++;
				}
			}
			else if(str=="OUT"){
				out++;
				if(out==3)
					break;
			}
			else{
				score++;
				if(sit==1){
					score++;
				}
				else if(sit==2)
					score+=1;
				else if(sit==4)
					score+=1;
				else if(sit==3)
					score+=2;
				else if(sit==5)
					score+=2;
				else if(sit==6)
					score+=2;
				else if(sit==7){
					score+=3;
				}
				sit=0;
			}
		}
		cout<<score<<endl;
	}

	return 0;
}

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

void solve(std::vector<long long> x) {
    for (ll i = 0; i < 5; i++) {
        if (x[i] == 0) {
            cout << i + 1 << endl;
            return;
        }
    }
}

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


Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
int main(){
  long r,d,a; cin >> r >> d >> a;
  vector<long> x(100);
  x.at(0) = a;
  for(int i = 1; i <= 10; i++){
    x.at(i) = r * x.at(i - 1) - d;
    cout << x.at(i) << endl;
  }
}

Measured memory_bytes: 3564
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x  = Integer.parseInt(sc.next());
    int[] a = new int[x];
    for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    for(int i = x - 1; i > 0 ; i--){
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n", a[0]);
  }
}


Measured memory_bytes: 26300
#include<iostream>
#include<algorithm>
#include<climits>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
string s;
bool C(char b){
  return (b=='A'||b=='G'||b=='C'||b=='T');
}
    
int main(){
  cin>>s;
  int cnt=0,res=0;
  rep(i,s.size()){
    if(C(s[i])){
      cnt++;
    }
    else{
      res=max(cnt,res);
      cnt=0;
    }
  }
  res=max(cnt,res);
  prin(res);

  return 0;
}


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

int main() {
    string S;
    cin >> S;
    int n = S.size();
    string ans = "AC";
    if (S[0] != 'A') ans = "WA";
    int cnt = 0;
    for (int i = 1; i < n; i++) {
        if (isupper(S[i])) {
            if (i == 1 || i == n - 1 || S[i] != 'C') {
                ans = "WA";
            }
            cnt++;
        }

    }
    if (cnt != 1) {
        ans = "WA";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int x,y,z;
    cin >> x >> y >> z;
    cout << z <<" "<< x << " " << y << endl;
    return 0;
}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  int A,B,C,D;cin>>A>>B>>C>>D;
  cout<<max(min(B,D)-max(A,C),0)<<endl;
}







Measured memory_bytes: 256
#include<stdio.h>
#define MAX 2000000

int H,st[MAX+1];

void maxHeapify(int i){
  int l,r,large,t;
  l=2*i;
  r=2*i+1;

  if(l<=H && st[l]>st[i])large=l;
  else large=i;
  if(r<=H && st[r]>st[large])large=r;

  if(large!=i){
    t=st[i];
    st[i]=st[large];
    st[large]=t;
    maxHeapify(large);
  }
}

int main(){

  int i;

  scanf("%d",&H);

  for(i=1;i<=H;i++)scanf("%d",&st[i]);

  
  for(i=(H/2);i>=1;i--)maxHeapify(i);

  for(i=1;i<=H;i++){
     printf(" %d",st[i]);
       
  }
  printf("\n");

  return 0;

}



Measured memory_bytes: 3648
"""
全探索
N<=1e10なのでa<=math.sqrt(N)まで調べればよい
"""
import math
n = int(input())
mn = 1e10
for a in range(1,int(math.sqrt(n))+1) :
    if n%a == 0 :
        b = str(n//a)
        a = str(a)
        mn = min(mn,max(len(a),len(b)))
print(mn)


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

using namespace std;

using ll = long long;

int main(){
  ll n;
  cin >> n;
  cin.ignore();
  ll max = 0;
  ll maxidx = 0;
  ll tmp = 0;
  ll secmax = 0;
  vector <ll> a;
  for (ll i = 0; i < n; i++){
    cin >> tmp;
    cin.ignore();
    a.push_back(tmp);
    if(max < tmp){
      secmax = max;
      maxidx = i;
      max = tmp;
    } else if(secmax < tmp){
      secmax = tmp;
    }
  }

  for(ll i = 0; i < n; i++){
    if(i != maxidx){
      cout << max << endl;
    } else {
      cout << secmax << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3440
use std::fmt::Debug;
use std::str::FromStr;

pub struct TokenReader {
    reader: std::io::Stdin,
    tokens: Vec<String>,
    index: usize,
}

impl TokenReader {
    pub fn new() -> Self {
        Self {
            reader: std::io::stdin(),
            tokens: Vec::new(),
            index: 0,
        }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index += 1;
        self.tokens[self.index - 1].parse().unwrap()
    }

    pub fn vector<T>(&mut self) -> Vec<T>
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index = self.tokens.len();
        self.tokens.iter().map(|tok| tok.parse().unwrap()).collect()
    }

    pub fn load_next_line(&mut self) {
        let mut line = String::new();
        self.reader.read_line(&mut line).unwrap();

        self.tokens = line.split_whitespace().map(String::from).collect();
        self.index = 0;
    }
}

fn cuts(logs: &Vec<i32>, max_len: i32) -> usize {
    logs.iter().map(|&log| {
        if log <= max_len {
            return 0;
        }

        let mut c = log / max_len;
        if (log + c) / (c + 1) > max_len {
            c += 1;
        }
        c as usize
    }).sum()
}

fn solve(k: usize, logs: &Vec<i32>) -> i32 {
    let mut res = 0;
    let mut pow = 1 << 30;

    while pow > 0 {
        let next = res + pow;
        pow >>= 1;

        if cuts(logs, next) > k {
            res = next;
        }
    }
    res + 1
}

fn main() {
    let mut reader = TokenReader::new();
    let _ = reader.next::<usize>();
    let k = reader.next();
    let logs = reader.vector();

    let res = solve(k, &logs);
    println!("{}", res);
}


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

using namespace std;
typedef long long ll;

int main(){
    int K,S; cin >> K >> S;
    int cnt=0;
    for(int i=0;i<=K;i++){
        for(int j=0;j<=K;j++){
            int z=S-i-j;
            if(0<=z && z<=K) cnt++;
            
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
a,b,c = map(int,input().split())
if max(a,b,c) == a:
    n = a*10+b+c
    print(n)

elif max(a,b,c) == b:
    n = b*10+a+c
    print(n)

else:
    n = c*10+a+b
    print(n)


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

int main(){
  ll n, k;
  cin >> n >> k;
  vector<ll> Ai(n);
  vector<ll> Fi(n);
  for(int i=0; i<n; ++i) cin >> Ai.at(i);
  for(int i=0; i<n; ++i) cin >> Fi.at(i);
  sort(Ai.begin(),Ai.end());
  reverse(Ai.begin(),Ai.end());
  sort(Fi.begin(),Fi.end());
  /*
  for(int i=0; i<n; ++i){
    cout << Ai.at(i) << " ";
  }
  cout << endl;
  for(int i=0; i<n; ++i){
    cout << Fi.at(i) << " ";
  }
  cout << endl;
  */
  ll l=-1, r=Ai.at(0)*Fi.at(Fi.size()-1)+1;
  while(l<r-1){
    ll mid= (l+r)/2;
    ll count=0;
    for(int i=0; i<n; ++i){
      if(Ai.at(i)*Fi.at(i) < mid) continue;
      else count += Ai.at(i) - mid/Fi.at(i);
    }
    //cout << l << " " << r << " " << mid << " " << count << endl;
    if(count <=k) r=mid;
    else l=mid;
  }
  cout << r << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a <<endl;
  return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>

int main(void){

  long long int n,i,sum=0;
  scanf("%lld",&n);

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



  return 0;
}

Measured memory_bytes: 1728