akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FOR(i, N) for (long i = 0; i < (N); i++)

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

    if (S == "Sunny") {
        cout << "Cloudy"
             << "\n";
    } else if (S == "Cloudy") {
        cout << "Rainy"
             << "\n";
    } else {
        cout << "Sunny"
             << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int long long
 
#define pii pair<int, int>
 
#define x1 x1228
#define y1 y1228
 
#define left left228
#define right right228

#define tm tm228
 
#define pb push_back
#define eb emplace_back
 
#define mp make_pair                                                                
                                                                                                                                        
#define ff first                                                                  
#define ss second   
 
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << ": " << x << endl; 
#define TIME (ld)clock()/CLOCKS_PER_SEC
 
using namespace std;
typedef long long ll; 
typedef long double ld; 
                                                                                                   
const int maxn = 3e5 + 7, mod = 1e9 + 7, MAXN = 1e6 + 7;
const double eps = 1e-9;
const ll INF = 1e18, inf = 1e15;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int w, h; 
int p[maxn]; 
int q[maxn]; 
void solve() {
    cin >> w >> h;
    vector<pii> tet; 
    for (int i = 0; i < w; ++i) {
        cin >> p[i]; 
        tet.eb(p[i], -1);  
    } 
    for (int i = 0; i < h; ++i) {
        cin >> q[i]; 
        tet.eb(q[i], 1);  
    } 
    sort(all(tet)); 
    int row = 0; 
    int col = 0; 
    int ans = 0; 
    for (auto v : tet) {
        if (v.ss == -1) {
            ans += (h - row + 1) * v.ff; 
            ++col; 
        } else {
            ans += (w - col + 1) * v.ff; 
            ++row; 
        }
//        cout << v.ff << " " << v.ss << " " << ans << '\n'; 
    } 
    cout << ans; 
}                                
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    int t = 1; 
    for (int i = 0; i < t; ++i) {              
        solve();
    }
    return 0;
} 

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

using std::min;
using std::max;

const int MAXN=100111;
const int INF=1034567890;

int N;

struct Vert{
	int FE;
	int Size, Val;
} V[MAXN];

struct Edge{
	int y, c, next;
} E[MAXN<<1];

int Ecnt;

void addE(int a, int b, int c){
	++Ecnt;
	E[Ecnt].y=b;E[Ecnt].c=c;E[Ecnt].next=V[a].FE;V[a].FE=Ecnt;
}

void getSize(int at, int f=0){
	V[at].Size=1;
	for(int k=V[at].FE, to;k;k=E[k].next){
		to=E[k].y;
		if(to==f)	continue;
		getSize(to, at);
		V[at].Size+=V[to].Size;
	}
}

void getVal(int at, int f=0){
	V[at].Val=N-V[at].Size;
	for(int k=V[at].FE, to;k;k=E[k].next){
		to=E[k].y;
		if(to==f)	continue;
		getVal(to, at);
		V[at].Val=max(V[at].Val, V[to].Size);
	}
}

int getG(int at, int f=0){
	int ret=at;
	for(int k=V[at].FE, to;k;k=E[k].next){
		to=E[k].y;
		if(to==f)	continue;
		to=getG(to, at);
		if(V[to].Val<V[ret].Val)	ret=to;
	}
	return ret;
}

long long Calc(bool &v){
	long long ret=0LL;
	for(int i=1, s;i<=Ecnt;i+=2){
		s=min(V[E[i].y].Size, V[E[i+1].y].Size);
		ret+=2LL*min(s, N-s)*E[i].c;
		if(s==N-s)	{ret-=(long long)(E[i].c);v=true;}
	}
	return ret;
}

int main(){
	
	scanf("%d", &N);
	
	for(int i=1, a, b, c;i<N;++i){
		scanf("%d%d%d", &a, &b, &c);
		addE(a, b, c);addE(b, a, c);
	}
	
	int at=1;
	getSize(at);getVal(at);at=getG(at);
	
	bool v=false;
	long long Ans=Calc(v);
	if(!v){
		int m=INF;
		for(int k=V[at].FE;k;k=E[k].next)	m=min(m, E[k].c);
		Ans-=(long long)m;
	}
	
	printf("%lld\n", Ans);
	
	return 0;
}

Measured memory_bytes: 7680
import sys
N=int(input())
S=[]
for i in range(N):
    S.append(input()[0])
    
Count=[]
Count.append(S.count("M"))
Count.append(S.count("A"))
Count.append(S.count("R"))
Count.append(S.count("C"))
Count.append(S.count("H"))

Zero=Count.count(0)
if(Zero>=3):print(0)
elif(Zero==2):
    Count.remove(0)
    Count.remove(0)
    pat=1
    for i in Count:pat*=i
    print(pat)
elif(Zero==1):
    Count.remove(0)
    patA=1
    for i in Count:patA*=i
    pat=0
    for i in Count:pat+=patA//i
    print(pat)
elif(Zero==0):
    patA=1
    for i in Count:patA*=i
    pat=0
    for i in range(5):
        for j in range(5):
            if(i==j):continue
            else:
                pat+=patA//Count[i]//Count[j]
    print(pat//2)

Measured memory_bytes: 4016
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int main(){
	
	
	string S,T;
	int i,T_len,S_len;
	cin >> S>>T;
	T_len=T.size();
	S_len=S.size();
	if (T_len = S_len+1){
		for (i=0;i<S.size();i++){
			if (S[i]==T[i]){
				
				if (i==S_len-1){
					cout<<"Yes";
				}
				else{
					
					continue;
					
				}		
			}
			else{
					cout <<"No";
					break;
				}		
		}	
	}
	else{
		cout <<"No";
	}
	return 0;
	
}

Measured memory_bytes: 3132
s = input()
r = [0 for x in range(len(s))]
l = [0 for x in range(len(s))]

# 寄せる
def funcA(x):
    for a in range(1, len(x)):
        if x[a - 1] > 0 and x[a] > 0:
            x[a] = x[a] + x[a - 1]
            x[a - 1] = 0
    return x
# 展開
def funcB(x):
    y = [0 for a in range(len(x))]
    for a in range(0, len(x) - 1):
        if x[a] > 0:
            if x[a] % 2 == 0:
                y[a] = x[a] // 2
                y[a + 1] = y[a]
            else:
                y[a] = (x[a] - 1) // 2 + 1
                y[a + 1] = y[a] - 1
    return y

for x in range(len(s)):
    if s[x] == 'R':
        r[x] = 1
    else:
        l[x] = 1
# print("r: {}".format(r))
# print("l: {}".format(l))
r = funcB(funcA(r))
l.reverse()
l = funcB(funcA(l))
l.reverse()
#print("r: {}".format(r))
#print("l: {}".format(l))
ans = ''
for x in range(len(s)):
    ans = ans + str(r[x] + l[x]) + ' '
print(ans)

Measured memory_bytes: 5632
N = int(input())

# dp[i] i円引き出すのに必要な手数
dp = [101010] * 201010
money = [1]
t = 6
q = 9
while t <= N:
    money.append(t)
    t*=6
while q <= N:
    money.append(q)
    q*=9

for m in money:
    dp[m] = 1

for i in range(1,N):
    for m in money:
        dp[i+m] = min(dp[i+m], dp[i]+1)

print(dp[N])

Measured memory_bytes: 72836
import java.io.*;
import java.util.*;
public class Main {
 
  public static void main(String[] args) { 
        solve();
      out.close();
  }

  private static void solve() {
      int h = sc.nextInt();
      int w = sc.nextInt();
      int sx = sc.nextInt() - 1;      
      int sy = sc.nextInt() - 1;
      int tx = sc.nextInt() - 1;
      int ty = sc.nextInt() - 1;

      char[][] grid = new char[h][w];
      int[][] dp = new int[h][w];
      for(int i = 0; i < h; i++) {
        grid[i] = sc.next().toCharArray();
        Arrays.fill(dp[i], 1_000_000_000);
      }

      dp[sx][sy] = 0;
      int[] rows = new int[]{-1, 1, 0, 0};
      int[] cols = new int[]{0, 0, -1, 1};

      ArrayDeque<int[]> queue = new ArrayDeque<>();
      queue.offer(new int[]{sx, sy});

      while(queue.size() > 0) {
        int[] pos = queue.poll();
        int curX = pos[0];
        int curY = pos[1];

        for(int j = 0; j < 4; j++) {
          int next_x = curX + rows[j];
          int next_y = curY + cols[j];
          if(!isValid(grid, next_x, next_y)) continue;
          if(dp[next_x][next_y] > dp[curX][curY]) {
               dp[next_x][next_y] = dp[curX][curY];
               queue.addFirst(new int[]{next_x, next_y});
          }
        }

        for(int i = curX-2; i <= curX+2; i++) {
          for(int j = curY-2; j <= curY+2; j++) {
            if(!isValid(grid, i, j)) continue;
            if(dp[i][j] > dp[curX][curY] + 1) {
               dp[i][j] = dp[curX][curY] + 1;
               queue.addLast(new int[]{i, j});
            }
          }
        }
      }
      out.println(dp[tx][ty] >= 1_000_000_000 ? -1 : dp[tx][ty]);
  }

  private static boolean isValid(char[][] grid, int row, int col) {
    if(row < 0 || row >= grid.length || col < 0 || col >= grid[row].length || grid[row][col] == '#')
      return false;
 
    return true;
  }

  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
 
  public static FastScanner sc = new FastScanner();

  static class FastScanner {
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      StringTokenizer st=new StringTokenizer("");
      String next() {
        while (!st.hasMoreTokens())
          try {
            st=new StringTokenizer(br.readLine());
          } catch (IOException e) {
            e.printStackTrace();
          }
        return st.nextToken();
      }
      
      int nextInt() {
        return Integer.parseInt(next());
      }
      int[] readArray(int n) {
        int[] a=new int[n];
        for (int i=0; i<n; i++) a[i]=nextInt();
        return a;
      }
      long nextLong() {
        return Long.parseLong(next());
      }
  }

}


Measured memory_bytes: 59160
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
#define F first
#define S second

using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
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; }
template<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

ll d[210][210], n, m;    
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    int R;
    cin >> n >> m >> R;
    vii r(R);
    rep(i, 0, R) {
      cin >> r[i];
      r[i]--;
    }
    sort(ALL(r));
    rep(i, 0, n) rep(j, 0, n) {
      d[i][j] = (i == j ? 0 : inf);
    }
    rep(i, 0, m) {
      ll a, b, c;
      cin >> a >> b >> c;
      a--, b--;
      d[a][b] = d[b][a] = c;
    }
    rep(k, 0, n) rep(i, 0, n) rep(j, 0, n) {
      d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }

    ll ans = inf;
    do {
      ll sum = 0, t = r[0];
      rep(i, 1, R) {
        if (d[t][r[i]] >= inf) {
          sum = inf;
          break;
        }
        sum += d[t][r[i]];
        t = r[i];
      }
      ans = min(ans, sum);
    } while (next_permutation(ALL(r)));
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll x, a, b;
  cin >> x >> a >> b;
  if (a >= b) cout << "delicious" << endl;
  else if (b - a <= x) cout << "safe" << endl;
  else cout << "dangerous" << endl;
}

Measured memory_bytes: 256
s=input()
n=len(s)
sum=0
for i in range(1<<n-1):
  t=0
  for j in range(n-1):
    if i & (1<<j):
      sum += int("".join(s[t:j+1]))
      t = j+1 
  sum += int(''.join(s[t:]))
print(sum)

Measured memory_bytes: 3060
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int V = 6;

bool solve(string &s){
  int v[V][2];
  v[0][0] = 1; v[0][1] = 2;
  v[1][0] = -1; v[1][1] = 3;
  v[2][0] = 1; v[2][1] = -1;
  v[3][0] = 4; v[3][1] = 5;
  v[3][0] = 4; v[3][1] = 5;
  v[4][0] = 5; v[4][1] = 2;
  v[5][0] = 2; v[5][1] = 1;
  int n = 0;
  REP(i, s.length()){
    if(v[n][s[i] - '0'] == -1) return false;
    n = v[n][s[i] - '0'];
  }
  return (n == 5 ? true : false);
}

int main() {
  string s;
  while(cin >>s && s != "#") cout <<(solve(s) ? "Yes" : "No") <<endl;
  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define REPA(x, v) for(auto&& x:v)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(v.rbegin(),v.rend())
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    ll N,W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    REP(i, N) cin >> w[i] >> v[i];

    vector<vector<ll>> x(4, vector<ll>(1, 0));
    REP(i, N) x[w[i]-w[0]].pb(v[i]);

    RSORT(x[0]);RSORT(x[1]);RSORT(x[2]);RSORT(x[3]);

    ll ans = 0;
    ll v0,v1,v2,v3;
    REP(i, x[0].size()){
        v0 = 0;
        REP(iv, i) v0 += x[0][iv];
        REP(j, x[1].size()){
            v1 = 0;
            REP(jv, j) v1 += x[1][jv];
            REP(k, x[2].size()){
                v2 = 0;
                REP(kv, k) v2 += x[2][kv];
                REP(m, x[3].size()){
                    v3 = 0;
                    REP(mv, m) v3 += x[3][mv];
                    if(i*w[0]+j*(w[0]+1)+k*(w[0]+2)+m*(w[0]+3) <= W) chmax(ans, v0+v1+v2+v3);
                }
            }
        }
    }

    pr(ans);
}

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

int main() {
  vector<bool> p(1e5, true);
  for (int i = 2; i < 1e5; i++) {
    if (p[i]) {
      for (int j = 2 * i; j < 1e5; j += i) {
        p[j] = false;
      }
    }
  }
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 11; a.size() < n && i < 1e5; i += 10) {
    if (p[i]) {
      a.push_back(i);
    }
  }
  for (auto e : a) {
    cout << e << " ";
  }
  cout << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int main() {
  string str;
  while (cin >> str) {
    char ans = '0';
    int pos = 0;
    int depth = 0;
    int maxDepth = -1;
    char prev = '0';
    while (pos < (int)str.size()) {
      int now = str[pos];
      if (now == 'c') {
        pos += 7;
      } else {
        assert(now == 'e');
        pos += 3;
      }
      if (prev == now) { depth = 0; }
      if (depth > maxDepth) {
        maxDepth = depth;
        ans = now;
      }
      prev = now;
      depth++;
    }
    puts(ans == 'c' ? "chicken" : "egg");
  }
}

Measured memory_bytes: 0
#define PROB LongMansionDiv1

#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
#define rep(i, l, r) for (int i = l; i<r;i++)
#define all(b) b.begin() , b.end()
#define mp(a, b) make_pair(a,b)
#define pb(a) push_back(a)
#define vi vector<int>
#define vd vector<double>
#define vs vector<string>
#define vii vector<pair<int,int>>
#define vvi vector<vector<int>>
#define ii pair<int,int>
#define turnOff(k, i) (k&(~(1<<(i-1))))
#define isOn(k, i) (k&&(1<<i-1)?true:false)
#define pll pair<long long int , long long int>
#define ull unsigned long long int
#define ll  long long int
#define add(a, b) ((a+b)%MOD)
#define sub(a, b) ((a-b+MOD)%MOD)
#define mul(a, b) ((1ll*a*b)%MOD)
#ifdef  DEBUG
#define MAXN 1005
#else
#define MAXN 200020
#endif
#define MAXLG 20
#define endl '\n'
#define PI 3.141592653589793238
#define MOD (1000000007)
#define INF (2000000000)
#define EPS (0.00000001)
#define treap treapNode

struct query {int l,r,k,i;};
const int sqr = 600;
vector<query> qs[sqr];
int closest[MAXN][26];
int pos[26] ;

class PROB {
public:
     
};
int aaa[MAXN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#ifdef DEBUG
    freopen("input", "r", stdin);
#endif
    PROB temp;
    string s;
    cin>>s;
    s = " "+s;
    for (int i=s.length()-1;i>=0;i--) {
        rep (j,0,26) closest[i][j] = pos[j];
        if(i!=0)
        pos[s[i]-'a'] = i;
    }
    int n = s.length();
    ii dp[n];
    //first = nextPos
    //second length
    dp[n-1].first = 0;
    dp[n-1].second = 0;

    for (int k=n-2;k>=0;k--) {
        int lenOfMin = INF;

        for (int c=0;c<26;c++) {
            if (closest[k][c]==0) {
                dp[k].first = 0;
                dp[k].second = 0;
                break;
            } else {
                int pos = closest[k][c];
                if (dp[pos].second +1 < lenOfMin) {
                    lenOfMin = 1+dp[pos].second;
                    dp[k].first = pos;
                    dp[k].second = dp[pos].second+1;
                }
            };
        }
    }
    int curr = 0;
    while (true) {
        if (dp[curr].first == 0) {
            for (int c=0;c<26;c++) {
                if (closest[curr][c]==0) {
                    char f = 'a'+c;
                    cout<<(f)<<endl;
                    return 0;
                }
            }
            } else {
            cout<<s[dp[curr].first];
            curr = dp[curr].first;
        }
    }

}
















Measured memory_bytes: 22480
import java.util.*;

public class Main {
	  public static void main(String args[]){
      	Scanner scan = new Scanner(System.in);
            
        int X = scan.nextInt();
        int t = scan.nextInt();
        int cnt;
        
        if(X-t < 0)cnt = 0;
        else cnt = X-t;
            
        System.out.println(cnt);
	  }
}

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

int	main() {
	int N;
	cin >>N;
	vector<long> x;
	long X;
	for (int i=0; i<=N; i++) {
		cin >>X;
		x.push_back(X);
	}
	sort(x.begin(), x.end());
	// Change to diffs
	reverse(x.begin(), x.end());
	for (int j=0; j<x.size()-1; j++) {
		x.at(j)-=x.at(j+1);
	}
	// Delete minimun one
	x.pop_back();
	sort(x.begin(), x.end());
	while (x.size()>1) {
		for (int j=1; j<x.size(); j++) {
			x.at(j)%=x.front();
		}
		sort(x.begin(), x.end());
		x.erase(unique(x.begin(), x.end()), x.end());
		// Delete 0 at front
		if (0==x.front()) {
			reverse(x.begin(), x.end());
			x.pop_back();
			reverse(x.begin(), x.end());
		}
	}
	cout <<x.at(0) <<endl;
	return 0;
}



Measured memory_bytes: 1400
n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y and n-i-j>=0:
            print(i, j, (n-i-j))
            exit()
print(-1, -1, -1)

Measured memory_bytes: 3060
# coding:utf-8

a = int(input())
n = list(map(int, input().split()))

ind = n.index(min(n))
POT = n.pop(ind)
for i in range(0, len(n)):
    ind = n.index(min(n))
    POT = (POT + n.pop(ind)) / 2

print(POT)


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    char X, Y;
    cin >> X >> Y;
    if (X == Y)
        cout << "=" << endl;
    else if (X < Y)
        cout << "<" << endl;
    else
        cout << ">" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> r,g,b;
  for(int i=0;i<n;i++){
    switch(s[i]){
      case 'R':
        r.push_back(i);
        break;
      case 'G':
        g.push_back(i);
        break;
      case 'B':
        b.push_back(i);
        break;
    }
  }
  long long int cnt = 0;
  for(int i=0;i<n-2;i++){
    switch(s[i]){
      case 'R':
        cnt += g.size() * b.size();
        r.erase(r.begin());
        break;
      case 'G':
        cnt += r.size() * b.size();
        g.erase(g.begin());
        break;
      case 'B':
        cnt += r.size() * g.size();
        b.erase(b.begin());
        break;
    }
    for(int j=1;i+2*j<n;j++){
      if(s[i]!=s[i+j]&&s[i+j]!=s[i+2*j]&&s[i+2*j]!=s[i]) cnt--;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
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; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt = 1;
	while (kkt--) {
		ll N; scanf("%lld", &N);
		map<pair<ll, ll>, ll> mp;
		for (int i = 0; i < N; i++) {
			ll x, y, w; scanf("%lld %lld %lld", &x, &y, &w);
			mp[{x, y}] += w;
		}
		ll res = 0;
		for (auto p : mp) {
			{
				ll x = p.first.first;
				ll y = p.first.second;
				ll sum = 0;
				sum += p.second;
				if (mp.find({ x + 1, y }) != mp.end()) sum += mp[{x + 1, y}];
				if (mp.find({ x + 1, y + 1 }) != mp.end()) sum += mp[{x + 1, y + 1}];
				if (mp.find({ x,y + 1 }) != mp.end()) sum += mp[{x, y + 1}];
				chmax(res, sum);
			}

			{
				ll x = p.first.first;
				ll y = p.first.second;
				ll sum = 0;
				sum += p.second;
				if (mp.find({ x + 1, y }) != mp.end()) sum += mp[{x + 1, y}];
				if (mp.find({ x + 1, y - 1 }) != mp.end()) sum += mp[{x + 1, y - 1}];
				if (mp.find({ x,y - 1 }) != mp.end()) sum += mp[{x, y - 1}];
				chmax(res, sum);
			}

			{
				ll x = p.first.first;
				ll y = p.first.second;
				ll sum = 0;
				sum += p.second;
				if (mp.find({ x - 1, y }) != mp.end()) sum += mp[{x - 1, y}];
				if (mp.find({ x - 1, y - 1 }) != mp.end()) sum += mp[{x - 1, y - 1}];
				if (mp.find({ x,y - 1 }) != mp.end()) sum += mp[{x, y - 1}];
				chmax(res, sum);
			}

			{
				ll x = p.first.first;
				ll y = p.first.second;
				ll sum = 0;
				sum += p.second;
				if (mp.find({ x - 1, y }) != mp.end()) sum += mp[{x - 1, y}];
				if (mp.find({ x - 1, y + 1 }) != mp.end()) sum += mp[{x - 1, y + 1}];
				if (mp.find({ x,y + 1 }) != mp.end()) sum += mp[{x, y + 1}];
				chmax(res, sum);
			}

		}

		cout << res << " / 1" << endl;
	}
	return 0;

}



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

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

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

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

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

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

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

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

fn main(){
    input!{
        x: u64
    }
    print!("{}", x/500*1000 + (x % 500)/5*5);
}


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

MOD = 10**9+7

xx = [x[i + 1] - x[i] for i in range(n - 1)]
yy = [y[i + 1] - y[i] for i in range(m - 1)]

print(sum(xx[i] * (i + 1) * (n - 1 - i) for i in range(n - 1)) *
      sum(yy[i] * (i + 1) * (m - 1 - i) for i in range(m - 1)) % MOD)

Measured memory_bytes: 25040
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N;
    cin >> N;
    int B[N - 1];
    for (int i = 0; i < N - 1; i++) cin >> B[i];

    int ans = 0;

    for (int i = 0; i < N; i++) {
        int A = 0;
        if (i == 0) A = B[0];
        else if (i == N - 1) A = B[N - 2];
        else A = min(B[i], B[i - 1]);
        ans += A;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
 class ProgramB
    {
        static void Main(string[] args)
        {
            
            //入力
            string input = Console.ReadLine();
            int n = int.Parse(input);

            string[] input_st = Console.ReadLine().Split(' ');
            string s = input_st[0];
            string t = input_st[1];

            
            for(int i = 0;i < n;i++)
            {
                Console.Write(s[i]);
                Console.Write(t[i]);
            }
            
                
        }
    }

Measured memory_bytes: 11092
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<utility>
#include<queue>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main()
{
	ll  i, j, k, l, m, sum, flag, N,  M, K, H, W, B;
	sum = 0;
	flag = 0;
	cin >> N >> M;
	REP1(i, M/N+1,1 ) {
		if (M%i == 0) {
			break;
		}
	}
	output(i);
	
}













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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	int a[100010];
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n;i++)
	{
		if(a[i]==a[i+1])
		{
			a[i]=0;
			a[i+1]=0;
		}
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]!=0)
		{
			cnt++;
		}
	}
	cout <<cnt <<endl;
} 

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y;cin >> x >> y;
  int ans=0;
  if(x==1&&y==1){
    cout << 1000000 << endl;
    return 0;
  }
  if(x<=3){
    ans+=(4-x)*100000;
  }
  if(y<=3){
    ans+=(4-y)*100000;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
main :: IO ()
main = getLine >>= print . solve 

solve :: String -> Int 
solve xs = checks len len 1 xs
    where
        len = length xs

checks :: Int -> Int -> Int -> String -> Int
checks acc len i (x : y : zs)
    | x /= y = checks (min acc . max i $ len - i) len (i + 1) $ y : zs
    | otherwise = checks acc len (i + 1) $ y : zs
checks acc _ _ _ = acc


Measured memory_bytes: 7164
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <set>
#include <iostream>
#include <map>
#include <algorithm>
const double PI = acos(-1.0);
const double EPS = 1e-9;
using namespace std;

const int maxn = 1e5 + 5;
const int INF = 0x3f3f3f3f;
#define LL long long

LL a[maxn], b[maxn];

int main()
{
	LL n;
	while (scanf("%lld", &n) != EOF)
	{
		LL sum = 0;
		for (int i = 0; i < n; i++)
		{
			scanf("%lld", &a[i]);
			sum += a[i];
		}
		for (int i = 0; i < n - 1; i++) b[i] = a[i + 1] - a[i];
		b[n - 1] = a[0] - a[n - 1];
		LL t = n*(n + 1) / 2;
		if (sum%t)
		{
			puts("NO");
			continue;
		}
		sum /= t;
		LL cnt = 0;
		bool ok = true;
		for (int i = 0; i < n; i++)
		{
			if ( (sum - b[i]) % n || sum - b[i] < 0)
			{
				ok = false;
				break;
			}
			cnt += (sum - b[i]) / n;
		}
		if (!ok)
		{
			puts("NO");
			continue;
		}
		if (cnt == sum)
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}

Measured memory_bytes: 1792
S = gets.chomp
A = S.chars.map{ |c| c == "?" ? nil : c.to_i }
#$stderr.puts S, S.size, A.size
Mod = 10**9 + 7
dp0 = Array.new(13, 0)
dp0[0] = 1
deca = 1
a09 = (0..9).to_a
A.reverse_each{ |a|
  dp1 = Array.new(13, 0)
  (a ? [a] : a09).each{ |a|
    b = deca * a
    (0...13).each{ |i| dp1[(i + b) % 13] += dp0[i] }
  }
  deca = deca * 10 % 13
  dp0 = dp1.map{ |v| v % Mod }
}
#p dp0
p dp0[5]


Measured memory_bytes: 17916
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(int i=(max);i>=(min);i--)
const int  MOD=1e9+7;
const int  INF=2000000000;
const int INF2=  10000000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INF2){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}

int EintN(int array[],const int num){
    for(int i=0;i<num;i++){printf("%d ",array[i]);}
    br;
    return 0;
}
int EintNN(const int heighth,const int width,int array[heighth][width]){
    FOR(i, 0, heighth){
        FOR(k, 0, width){
            {printf("%d ",array[i][k]);}
        }
        br;
    }
    br;
    return 0;
}
int E(string str,const int num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}


int test(){
    return 0;
}

int Ap(){
    int ans;ans=0;
    
    return 0;
}

int Bp(){
    int ans;ans=0;
    
    return 0;
}

int Cp(){
    int ans;ans=0;
    double W,H,x,y;
    cin>>W>>H>>x>>y;
    cout<<W*H/2<<" "<<(x==W/2 and y==H/2)<<endl;
    return 0;
}

int Dp(){
    int ans;ans=0;
    
    return 0;
}

signed main(){
    //test();
    //Ap();
    //Bp();
    Cp();
    //Dp();
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}




int main(){
  int D;
  long long G;
  vector<long long>p,c;
  cin>>D>>G;
  p.resize(D);
  c.resize(D);
  for(int i=0;i<D;i++){
    cin>>p[i]>>c[i];
  }
  long long res=1<<29; //2^29までもつ2しんすうで
  for(int bit=0;bit<(1<<D);bit++){//2^Dまで2進数でforでbitをまわす
    long long sum=0;
    long long num=0;
    for(int i=0;i<D;i++){
      if(bit&(1<<i)){//bitのi行目が1のときに1を出力してif文が実行される。
        sum+=c[i]+p[i]*100*(i+1);
        num+=p[i];
      }

    }
    if(sum>=G){
      res=min(res,num);
    }else{
      for(int i=D-1;i>=0;i--){
        if(bit&(1<<i)){
          continue;
        }
        for(int j=0;j<p[i];j++){
          if(sum>=G){
            break;
          }
          sum+=100*(i+1);
          num++;
        }

      }
      res=min(res,num);


    }



  }
  cout<<res<<endl;


  





  


}


  
  



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 998244353;
const int N = 100010;
int n, cnt[N];
int powmod(int a, int n, int p){
	int r = 1;
	for(; n; n >>= 1, a = (ll)a * a % p)
		if(n & 1) r = (ll)r * a % p;
	return r;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		int x;
		cin >> x;
		if(i == 1 && x != 0){
			cout << 0 << "\n";
			return 0;
		}
		cnt[x]++;
	}
	if(cnt[0] != 1){
		cout << 0 << "\n";
		return 0;
	}
	int ans = 1;
	for(int i = 1; i < n; i++)
		ans = (ll)ans * powmod(cnt[i - 1], cnt[i], mod) % mod;
	for(int i = n - 1; i >= 1; i--)
		if(cnt[i] > 0 && cnt[i - 1] == 0){
			ans = 0;
			break;
		}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int n,m;
    long long k;
    long long a[200005];
    long long b[200005];
    vector<long long> asum;
    vector<long long> bsum;
    
    asum.push_back(0);
    bsum.push_back(0);
    
    cin >> n >> m >> k;
    for (int i = 0;i < n;i++){
        cin >> a[i];
        if (i == 0){
            asum.push_back(a[i]);
        }
        else {
            asum.push_back(asum[i] + a[i]);
        }
    }
    for (int i = 0;i < m;i++){
        cin >> b[i];
        if (i == 0){
            bsum.push_back(b[i]);
        }
        else {
            bsum.push_back(bsum[i] + b[i]);
        }
    }
    
    if (k  >= asum[n-1] + bsum[m-1]){
        cout << n+m << endl;
    }
    else {
        long long ans = 0;
        long long res;
        for (int i = 0;i <= n;i++){
            long long t = k - asum[i];
            if (t < 0){
                res = 0;
            }
            else if ( t == 0){
                res = i;
            }
            else {
                auto iter = upper_bound(bsum.begin(),bsum.end(),t);
                long long x = iter - bsum.begin() - 1;
                res = x + i;
            }
            ans = max(res,ans);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 10544
S = str(input())
N = len(S)

def f():
    for erase in range(1, N + 1):
        new = S[0 : N - erase]
        if len(new) % 2 == 1: continue
        flg = 1
        for i in range((N - erase) // 2):
            if new[i] != new[(N - erase) // 2 + i]: 
                flg = 0
                break
        if not flg: continue
        return len(new)

print(f())

Measured memory_bytes: 38384
#include<stdio.h>
int main(void)
{
   int a,b,c;
   scanf("%d %d %d",&a,&b,&c);
   if(a==0&&b==0&&c==1){
   printf("Open\n");
   }
   else if(a==1&&b==1&&c==0){
   printf("Open\n");
   }
   else{
   printf("Close\n");
   }
   return 0;
   }

Measured memory_bytes: 1012
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
constexpr long long INF = 1e18;
#define IN(a, x, b) (a<=x && x<b)



signed main(){
	int N;
	cin>>N;
	vector<int>a(N);
	REP(i,N){
		cin>>a[i];
	}
	sort(ALL(a));
	int ans = 0;
	REP(i,N){
		FOR(j,i+1,N){
			int ma = a[i]+a[j];
			int mi = abs(a[i]-a[j]);
			int lo = upper_bound(ALL(a),mi)-a.begin();
			int up = lower_bound(ALL(a),ma)-a.begin();
			//cout<<a[i]<<" "<<a[j]<<" "<<up-lo<<endl;
			int t = up-lo;
			if(IN(a[lo],a[i],a[up-1]+1))t--;
			if(IN(a[lo],a[j],a[up-1]+1))t--;
			ans += t;
		}
	}
	cout<<ans/3<<endl;
}

Measured memory_bytes: 384
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int n;
    cin>>n;
    f(i,1,9)
    {
        f(j,1,9)
        {
            if(i*j==n)
            {
                cout<<"Yes"<<endl;
                return  0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;

}





































Measured memory_bytes: 3604
#include <iostream>

using namespace std;
int main()
{
    int K;
    int arr[32] = {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};
    cin >> K;
    cout << arr[K-1];

}

Measured memory_bytes: 256
h, w = map(int, input().split())
ans = 0
s = []
a = []
q = []
for i in range(h):
    s.append(input())


for yy in range(h):
    for xx in range(w):
        a = []
        for i in range(h):
            a.append([0] * w)

        d = 1
        q = [(xx, yy)]
        while True:
            nq = []
            while len(q) > 0:
                p = q.pop()
                x, y = p
                if x < 0 or x >= w or y < 0 or y >= h:
                    continue
                if s[y][x] == '#':
                    continue
                if a[y][x] > 0:
                    continue
                a[y][x] = d
                nq.append((x - 1, y))
                nq.append((x + 1, y))
                nq.append((x, y - 1))
                nq.append((x, y + 1))
            if len(nq) == 0:
                break
            q = nq
            d += 1

        b = []
        for i in range(h):
            b.extend(a[i])
        b = sorted(b, reverse=True)
        ans = max(ans, b[0])
print(ans - 1)

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

#define o(output) cout << output << endl

using namespace std;

string s;
int a,b,c,d;

int main(){
  cin >> s;
  for (int i=0;i<3;i++){
    if(s[i]=='1'){
      a++;
    }
  }
  o(a);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);

		int n=sc.nextInt();
		int a=0;
		int b=0;
		int c=0;

		for(int i=n;i<1000;i++){
		 c=i/100;
	 	 b=i/10-c*10; 
		 a=i%100-b*10;
			if(a==b && b==c){
				System.out.println(i);
				break;
			}
		}



	}
}


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


int main(){
  int n,l;
  cin >> n >> l;
  
  vector<string>s(n);
  rep(i,n) cin >> s[i];
  sort(s.begin(),s.end());
  
  for (string x : s){
    cout << x;
  }
  cout << endl;

}

Measured memory_bytes: 256
import sys
N=int(sys.stdin.readline())
values = []
res = 1
values=sys.stdin.readline().split()
for v in values:
    if int(v) == 0:
        print(0)
        exit(0)

for v in values:
    res *= int(v)
    if res > 1000000000000000000:
        print(-1)
        exit(0)
print(res)


Measured memory_bytes: 19468
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    double solve(vector<int>& X, vector<int>& Y, string& dir) {
        int n = X.size();

        auto calc = [&](double T) {
            const double INF = 1e20;
            double l = INF;
            double r = -INF;
            double t = -INF;
            double b = INF;
            for (int i = 0; i < n; ++i) {
                double x = X[i], y = Y[i];
                if (dir[i] == 'L') {
                    x -= T;
                } else if (dir[i] == 'R') {
                    x += T;
                } else if (dir[i] == 'U') {
                    y += T;
                } else {
                    y -= T;
                }
                l = min(l, x);
                r = max(r, x);
                b = min(b, y);
                t = max(t, y);
            }
            // cout << l << " " << r << " " << t << " " << b << " " << T << endl;
            double res = (r - l) * (t - b);
            return res;
        };

        double res = 1e20;
        double lo = 0, hi = 1e9;
        for (int i = 0; i < 200; ++i) {
            auto l = lo + (hi - lo) / 3;
            auto r = hi - (hi - lo) / 3;

            if (calc(l) >= calc(r)) {
                lo = l;
            } else {
                hi = r;
            }
        }

        res = calc(lo);

        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    cin >> n;
    vector<int> X(n);
    vector<int> Y(n);
    string D;
    for (int i = 0; i < n; ++i) {
        int x, y;
        char d;
        cin >> x >> y >> d;
        X[i] = x;
        Y[i] = y;
        D += d;
    }

    Solution sol;
    cout << sol.solve(X, Y, D) << "\n";


    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#define REP(i,j,n) for(int i=j;i<n;i++)
#define SORT(x) sort(x.begin(),x.end())

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a - 1)*(b - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N=II()
B=[INTMAX] + LI() + [INTMAX]

A=[]
for i in range(N):
    A.append(min(B[i], B[i+1]))
print(sum(A))


Measured memory_bytes: 3064