akhauriyash/Code-Regression huggingface dataset:
/******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define int ll
ll po(ll a, ll x, ll m) { if (x == 0) {return 1;} ll ans = 1; ll k = 1;  while (k <= x) {if (x & k) {ans = ((ans * a) % m);} k <<= 1; a *= a; a %= m; } return ans; }
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE
int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int h, w;
	int k;
	cin >> h >> w >> k;
	int ans   = 0;
	char mat[h][w];
	forr(i, h) {
		forr(j, w) {
			cin >> mat[i][j];
		}
	}
	for (int i = 0; i < (1 << h); i++) {
		for (int j = 0; j < (1 << w); j++) {
			int tmp = 0 ;
			for (int x = 0; x < h; x++) {
				for (int y = 0; y < w; y++) {
					//cout << i << "\n";
					if ((i & (1 << x))  == 0 and (j & (1 << y)) == 0 and mat[x][y] == '#') {
						//cout << i << " " << j << "\n";
						tmp++;
					}
				}
			}

			ans += (tmp == k);
		}
	}
	cout << ans << "\n";
	return 0;
}

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

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

int bridges = 0;

void dfs (int start, int par, vector <int> & f, vector <int> & h, vector <vector <int>> & g, vector <bool> & used, int curr_h) {
    used[start] = true;
    h[start] = curr_h;
    f[start] = curr_h;
    for (auto elem : g[start]) {
        if (elem != par) {
            if (!used[elem]) {
                dfs(elem, start, f, h, g, used, curr_h + 1);
                f[start] = min(f[start], f[elem]);
                if (f[elem] > h[start]) ++bridges;
            }
            else f[start] = min(f[start], h[elem]);
        }
    }
}

int main()
{
  IO;
  int n, m; cin >> n >> m;
  vector <vector <int>> g(n);
  for (int i = 0; i < m; ++i) {
      int v, u; cin >> v >> u;
      --v; --u;
      g[v].push_back(u);
      g[u].push_back(v);
  }
  vector <int> f(n), h(n);
  vector <bool> used(n);
    dfs(0, -1, f, h, g, used, 0);
  
  cout << bridges << endl;
  
	return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
a=""
for i in range(w+2):
    a=a+"a"
S=[a]
for i in range(h):
    S.append("a"+input()+"a")
S.append(a)
for i in range(1,h+1):
    for j in range(1,w+1):
        if S[i][j]==".":
            num=0
            for u in range(-1,2):
                for v in range(-1,2):
                    if S[i+u][j+v]=="#":
                        num+=1
            S[i]=S[i][:j]+str(num)+S[i][j+1:]
for i in range(1,h+1):
    print(S[i][1:w+1])

Measured memory_bytes: 3064
# https://atcoder.jp/contests/abc043/tasks/abc043_b

import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    ans = []
    for s in S:
        if s != "B":
            ans.append(s)
        else:
            if ans:
                ans.pop()
    print("".join(ans))

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 61964
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, number_500;
  cin >> N >> A;	//Nは整数、Aは一円硬貨の枚数
  
  
  number_500 = N / 500;	//500円硬貨の枚数を格納
  
  if (N % 500 == 0) {
   	cout << "Yes" << endl; 
  }
  
  else if(number_500 > 0){
    if (N - number_500 * 500 <= A){
     cout << "Yes" << endl; 
    }
    
    else if (A == 0 || A < N - number_500 * 500) {
     cout << "No" << endl;
    }
    
  }
  
  else {
    if(A >= N - number_500 * 500)
      cout << "Yes" << endl;
  }
  
    
  
}

Measured memory_bytes: 256
l1 = [i for i in input().rstrip()]
l2 = ""
l3 = ""

for s in l1:
  l2 += s
  if "apple" in l2:
    l2 = l2.replace("apple","peach")
    l3 += l2
    l2 = ""
  elif "peach" in l2:
    l2 = l2.replace("peach","apple")
    l3 += l2
    l2 = ""
l3 += l2
print(l3)

Measured memory_bytes: 7456
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        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};
        System.out.println(a[n - 1]);
    }
}

Measured memory_bytes: 20820
#include<stdio.h>

int main(){
  int n,i;
  scanf("%d",&n);
  long long a[n];
  unsigned long long ans=1;
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
  }
  for(i=0;i<n;i++){
    if(a[i]==0){
      printf("0\n");
      return 0;
    }
  }
  for(i=0;i<n;i++){
    if(a[i]>1000000000000000000/ans){
      printf("-1\n");
      return 0;
    }
    ans*=a[i];
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 2440
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/



int H, W, C[10][10], A[202][202];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> H >> W;
    rep(i, 0, 10) rep(j, 0, 10) cin >> C[i][j];
    rep(y, 0, H) rep(x, 0, W) cin >> A[y][x];

    rep(k, 0, 10) rep(i, 0, 10) rep(j, 0, 10) C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
    int ans = 0;
    rep(y, 0, H) rep(x, 0, W) if (0 <= A[y][x]) ans += C[A[y][x]][1];
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <stack>

using namespace std;

int main()
{
  char s[100];
  stack<int> st;
  
  while (scanf("%s", s) != EOF)
    if (s[0] == '+') {
       int temp = st.top();
       st.pop();
       st.top() += temp;
    } else if (s[0] == '-') {
       int temp = st.top();
       st.pop();
       st.top() -= temp;
    } else if (s[0] == '*') {
       int temp = st.top();
       st.pop();
       st.top() *= temp;
    } else
      st.push(atoi(s));
  
  printf("%d\n", st.top());
}


Measured memory_bytes: 2760
#include <bits/stdc++.h>
using namespace std;
#define MAXNUM 222222
#define rep(i,s,t) for(int i=s;i<t;i++)
char s[MAXNUM];
int main()
{
    int a,b,c,d,n;scanf("%d%d%d%d%d%s",&n,&a,&b,&c,&d,s+1);
    bool flag1=1,flag2=1,flag3=1;
    rep(i,a+1,c)flag1&=(s[i]!='#'||s[i+1]!='#');
    rep(i,b+1,d)flag2&=(s[i]!='#'||s[i+1]!='#');
    if(c>d)
    {
        flag3=0;
        rep(i,b,d+1)flag3|=(s[i]!='#'&&s[i-1]!='#'&&s[i+1]!='#');
    }
    if(flag1&&flag2&&flag3)printf("Yes\n");
    else printf("No\n");
}

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

int n,cnt;
double p,q,a;
const double eps = 1e-7;

bool eq (double x, double y) {
  x-=y;x=x<0?-x:x;
  return x<eps;
}

bool les (double x, double y) {
  return x-y<eps;
}

void rec (double sum, double mul, int prev, int depth) {
  if(eq(sum,p)&&depth>=1){cnt++;return;}
  if(depth==n)return;
  for(int i=prev;;++i){
    double v=sum+1.0/i;
    if(les(v,p)){if(les(mul*i,a)){rec(v,mul*i,i,depth+1);}else{return;}}
  }
}

int main () {
  while(cin>>p>>q>>a>>n,p&&q&&n&&a){
    p/=q;
    cnt=0;
    rec(0,1,1,0);
    cout<<cnt<<endl;
  }
}

Measured memory_bytes: 3160
#include <stdio.h>
int main(void){
    int h,m,s,S;
    
    scanf("%d",&S);
    
    h=S/3600;
    m=(S-h*3600)/60;
    s=(S-(h*3600+m*60));
    
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;
}



Measured memory_bytes: 2100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# 文字列の読み込み
str = input()
a = list(str)

s=0
t=0

for i in range(len(a)):
  if a[i] == "S":
    s=s+1
  else:
    if s > 0:
      s=s-1
    else:
      t=t+2
print(t)


Measured memory_bytes: 4840
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_map>
# include <unordered_set>
# include <thread>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ui32 = unsigned int;
constexpr ll INFLL = 1e18;

#define CHECK_IMPL1(cond)              \
if (!(cond)) {                         \
    DEBUG("expected cond: " << #cond); \
    assert(cond);                      \
}

#define CHECK_IMPL2(cond, message)                                            \
if (!(cond)) {                                                                \
    DEBUG("expected cond: " << #cond << " failed with message: " << message); \
    assert(cond);                                                             \
}
#define CHECK_IMPL(_1, _2, NAME, ...) NAME
#define CHECK(...) CHECK_IMPL(__VA_ARGS__, CHECK_IMPL2, CHECK_IMPL1, CHECK_IMPL0)(__VA_ARGS__)

#ifdef __APPLE__
#define DEBUG(message) std::cerr << message << "\n";
#else
#define DEBUG(message)
#endif

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  ll s = 0;
  multiset<int> diffs;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
  }
  for (int i = 0; i < n; i++) {
    diffs.insert(a[(i + 1) % n] - a[i]);
  }
  if (s % (n * (n + 1LL) / 2LL) != 0) {
    cout << "NO\n";
    return;
  }
  ll count = s / (n * (n + 1LL) / 2LL);
  ll target = count;
  for (auto x : diffs) {
    if (x == target) {
      continue;
    }
    if (x > target) {
      cout << "NO\n";
      return;
    }
    if ((target - x) % n != 0) {
      cout << "NO\n";
      return;
    }
    count -= (target - x) / n;
  }
  if (count == 0) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
#ifdef __APPLE__
  freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  int t = 1;
//  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 5376
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
def main():
  MOD = 10**9+7
  N = int(input())
  edge = [[] for _ in range(N+1)]
  dp = [[0]*2 for i in range(100005)]
  # dp[v][c]: 頂点vを色cの根とする部分木の塗り分け方の総数
  # 葉が決まると順々に求まっていく
  for i in range(N-1):
      x,y = map(int,input().split())
      edge[x].append(y)
      edge[y].append(x)

  # 0:white,1:black
  def dfs(v,last=-1):
      dp[v][0] = 1
      dp[v][1] = 1
      for nv in edge[v]:
          if nv == last:
              continue
          dfs(nv, v)
          dp[v][0] = dp[v][0] * ((dp[nv][0] + dp[nv][1]) % MOD) % MOD
          dp[v][1] = dp[v][1] * dp[nv][0] % MOD


  dfs(1)
  print((dp[1][0] + dp[1][1])%MOD)
if __name__ == '__main__':
  main()

Measured memory_bytes: 126768
#include <stdio.h>
int partition(int *, int, int);

int main(){
  int n;
  int i;
  int A[100000];
  int p;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  p=partition(A,0,n-1);

  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i==p) printf("]");
    if(i<n-1) printf(" ");
    if(i==p-1) printf("[");
  }
 
  printf("\n");

  return 0;
  
}

int partition(int A[],int p,int r){
  int i,j;
  int x;
  int tmp;
  
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i=i+1;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }

  tmp=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp;

  return i+1;

}

Measured memory_bytes: 996
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n; cin >> n;
    vector<vector<pair<int, int>>> v(n);
    REP(i, n) {
        int a; cin >> a;
        REP(k, a) {
            int x, y; cin >> x >> y;
            v[i].push_back(make_pair(x, y));
        }
    }
    int ans = 0;
    for (int bits = 1; bits < (1 << n); bits++) {
        bool f = true;
        vector<int> h(n, 0);
        for (int i = 0; i < n; i++) {
            int x = (bits >> i) & 1;
            if (x == 1) h[i] = 1;
        }
        for (int i = 0; i < n; i++) {
            if (h[i]) {
                for (auto e:v[i]) {
                    if (h[e.first - 1] != e.second) f = false;
                }
            }

        }
        int count = 0;
        for (int i = 0; i < h.size(); i++) if (h[i] == 1) count++;
        if (f) {
            ans = max(ans, count);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $N);

$ans = 0;
for($i=1; $i<=$N ;$i++){
    if($i % 3 == 0 || $i % 5 == 0){
        continue;
    }else{
        $ans += $i;
    }
}
echo $ans;

?>

Measured memory_bytes: 16156
// Christmas Eve Eve

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

    sort(h.begin(), h.end());

    int diff = 1000000000;
    for (int i = 0; i <= h.size() - k; i++) {
        if (h[i+k-1] - h[i] < diff) {
            diff = h[i+k-1] - h[i];
        }
    }

    cout << diff << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
#ifdef ONLINE_JUDGE
#define D(...)
#else
#define D(...)cerr<<__LINE__<<":"<<"["<<#__VA_ARGS__<<"]->",P(__VA_ARGS__)
#endif
void P(){cerr<<endl;} 
template<typename H,typename...T>void P(H h,T...t){cerr<<h<<" ";P(t...);}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    map<int,int>mp1,mp2;
    for(int i=0,x;i<n;++i){
        cin>>x;
        if(i%2){
            mp1[x]++;
        }
        else
            mp2[x]++;
    }
    vector<pair<int,int>>vp1,vp2;
    for(auto x:mp1){
        vp1.emplace_back(x.second,x.first);
    }
    for(auto x:mp2){
        vp2.emplace_back(x.second,x.first);
    }
    sort(all(vp1),greater<pair<int,int>>());
    sort(all(vp2),greater<pair<int,int>>());
    if(vp1[0].second==vp2[0].second){
        int cnt1=vp1[0].first;
        if(int(vp2.size())>1)
            cnt1+=vp2[1].first;
        int cnt2=vp2[0].first;
        if(int(vp1.size())>1)
            cnt2+=vp1[1].first;
        cout<<n-max(cnt1,cnt2);
    }
    else{
        cout<<n-vp1[0].first-vp2[0].first;
    }
}

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

#define fo1(i, n) for (int i = 0; i < n; i++)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int((x).size())
using ll = long long; using vi = vector<int>; using ii = pair<int,int>;
const int oo = 0x3f3f3f3f; const ll OO = ll(oo)*oo; const int N = 100005;
#ifndef DEBUG
#define endl '\n'
#define debugf(...)
#else
#define debugf(...) printf(__VA_ARGS__)
#endif

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

    ll a, b;
    cin >> a >> b;

    set<ll> A;
    set<ll> B;
    for (ll i = 1; i*i <= a; i++) {
        if (a % i == 0) {
            A.emplace(i);
            if (i*i != a)
                A.emplace(a / i);
        }
    }
    for (ll i = 1; i*i <= b; i++) {
        if (b % i == 0) {
            if (A.count(i)) {
                B.emplace(i);
            }
            if (i*i != b && A.count(b / i)) {
                B.emplace(b / i);
            }
        }
    }

    ll ans = 0;
    for (ll x : B) {
        bool found = false;
        for (ll i = 2; i*i <= x && !found; i++) {
            if (x % i == 0) {
                if (B.count(i)) {
                    found = true;
                }
                if (i*i != x && B.count(x / i)) {
                    found = true;
                }
            }
        }
        if (!found) {
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 896
/*In the name of ALLAH, Most Gracious, Most Merciful*/
#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define bitcount                __builtin_popcount
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)                __gcd(a,b)
#define lcm(a, b)                ((a)*(b))/gcd(a,b)
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const int MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname);
int range_check(int val, int min, int max) {
	if (val < min) {
		return min;
	}
	if (val > max) {
		return max;
	}
	return val;
}
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (d == 1) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname) {
	ofstream ofs(fname);
	if (ofs.fail()) { cerr << "cannot open file. :" + fname << endl; return -1; }
	for (auto dp_row : dp) {
		for (auto dp_cell : dp_row) {
			ofs << dp_cell << ",";
		}
		ofs << endl;
	}
	ofs.close();
	return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.algorithm;
import std.string;
import std.file;
import std.math;

int main() {
	string l;
	int[] stack;
	while((l = readln(), l.length)){
		l = l.split("\n")[0];
		
		if(!l.length || !l.split[0].length) break;
		int d = to!int(l.split[0]);
		
		int s = 0;
		for(int x = 0; x < 600; x += d){
			s += x * x * d;
			}
		
		printf("%d\n", s);
		
		}
	return 0;
	}

Measured memory_bytes: 1104
K, A, B = map(int, input().split())

if B - A <= 2:
    print(K + 1)
    exit()

x = (K - (A - 1)) // 2 * (B - A) + A
if (K - (A - 1)) % 2 != 0:
    x += 1

print(max(x, K + 1))


Measured memory_bytes: 9096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
// #define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

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

  string S;
  cin >> S;
  map<string, string> ans{{"Sunny", "Cloudy"}, {"Cloudy", "Rainy"}, {"Rainy", "Sunny"}};
  cout << ans[S] << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
S=input()

I=[0]*N
I[0]=1 if S[0]=='#' else 0
for i in range(1,N):
    I[i]=I[i-1]+(1 if S[i]=='#' else 0)

ans=N
for i in range(N+1):
    LB = 0 if i==0 else I[i-1]
    RW = 0 if i==N else N-i - (I[N-1]-(0 if i==0 else I[i-1]))
    ans=min(ans,LB+RW)

print(ans)


Measured memory_bytes: 11240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793
const int INF = 100000000;
int dx[] = {0,1,-1,0,1,-1,1,-1};
int dy[] = {1,0,0,-1,1,-1,-1,1};

int main(){
    vector<int> v(5);
    int maxw = 0, idx = 0;
    for(int i = 0; i < 5; i++){
        int a;
        cin >> a;
        v[i] = a;
        int wait = (130 - a) % 10;
        if(wait > maxw){
            maxw = wait;
            idx = i;
        }
    }
    int ans = 0;
    for(int i = 0; i < 5; i++){
        if(i == idx) continue;
        ans += v[i] + (130 - v[i]) % 10;
    }
    ans += v[idx];
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

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

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

ll waz = 76543217;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main()
{
    IO;

    int H, W, K; cin >> H >> W >> K;

    vector<vector<char> > c(H, vector<char>(W));

    rep(i, H) {
        rep(j, W) {
            cin >> c[i][j];
        }
    }

    int ans = 0;

    for (int i = 0; i < (1 << H); ++i) {
        for (int j = 0; j < (1 << W); ++j) {
            int kosuu = 0;
            for (int x = 0; x < H; ++x) {
                for (int y = 0; y < W; ++y) {
                    if (i & 1 << x) {
                        if (j & 1 << y) {
                            if (c[x][y] == '#') {
                                ++kosuu;
                            }
                        }
                    }
                }
            }
            if (kosuu == K) { ++ans; }
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3196
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

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

bool f(int x){
  if(to_string(x).size() % 2 == 1) return true;
  else return false;
}

signed main(){
  
  int n; cin >> n;
  int ans = 0;
  for(int x = 1; x <= n; x++){
    if(f(x)) ans++;
  }
  cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int N,M,K;
string S[1000];
int board[1000][1000];
int sum1[1000][1000];
int sum2[1000][1000];
int sum3[1000][1000];
int main()
{
	scanf("%d%d%d",&N,&M,&K);
	for(int i=0;i<N;i++)cin >> S[i];
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			if(S[i][j]=='J')board[i][j]=0;
			else if(S[i][j]=='O')board[i][j]=1;
			else board[i][j]=2;
		}
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			int cou=0;
			if(board[i][j]==0)cou=1;
			if(i>0)cou+=sum1[i-1][j];
			if(j>0)cou+=sum1[i][j-1];
			if(i>0&&j>0)cou-=sum1[i-1][j-1];
			sum1[i][j]=cou;
		}
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			int cou=0;
			if(board[i][j]==1)cou=1;
			if(i>0)cou+=sum2[i-1][j];
			if(j>0)cou+=sum2[i][j-1];
			if(i>0&&j>0)cou-=sum2[i-1][j-1];
			sum2[i][j]=cou;
		}
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			int cou=0;
			if(board[i][j]==2)cou=1;
			if(i>0)cou+=sum3[i-1][j];
			if(j>0)cou+=sum3[i][j-1];
			if(i>0&&j>0)cou-=sum3[i-1][j-1];
			sum3[i][j]=cou;
		}
	}
	for(int i=0;i<K;i++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		a--;b--;c--;d--;
		int ans1=sum1[c][d],ans2=sum2[c][d],ans3=sum3[c][d];
		if(a>0)ans1-=sum1[a-1][d];
		if(b>0)ans1-=sum1[c][b-1];
		if(a>0&&b>0)ans1+=sum1[a-1][b-1];
		if(a>0)ans2-=sum2[a-1][d];
		if(b>0)ans2-=sum2[c][b-1];
		if(a>0&&b>0)ans2+=sum2[a-1][b-1];
		if(a>0)ans3-=sum3[a-1][d];
		if(b>0)ans3-=sum3[c][b-1];
		if(a>0&&b>0)ans3+=sum3[a-1][b-1];
		printf("%d %d %d\n",ans1,ans2,ans3);
	}
	return 0;
}

Measured memory_bytes: 17852
X = int(input())

e = [0 for _ in range(X+1)]
e[1] = 1
for i in range(2, X):
    v = i*i
    while v <= X:
        e[v] = 1
        v *= i
        
for i in range(X, 0, -1):
    if e[i] == 1:
        print(i)
        break

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

int main() {
    int n;
    cin>>n;
    vector <long long> vec(n,0);
    vector <long long> presum(n,0);
    vector <vector <long long>> cost(n,vector <long long>(n,LLONG_MAX));
    long long pre=0;
    for(int i=0;i<n;i++){cin>>vec[i];pre+=vec[i];presum[i]=pre;}
    for(int i=0;i<n;i++)cost[i][i]=0;
    for(int i=2;i<=n;i++){
        for(int j=0;j<=n-i;j++){
            int r=j+i-1;
            long long sub=(j==0)?0:presum[j-1];
            for(int k=j;k<=j+i-2;k++)cost[j][r]=min(cost[j][r],cost[j][k]+cost[k+1][r]);
            cost[j][r]+=(presum[r]-sub);
        }
    }
    cout<<cost[0][n-1]<<endl;
}

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

typedef long long ll;
typedef long double ld;
template <typename T> 
using lim = numeric_limits<T>;
template <typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using indexed_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int MOD = 1e9+7;
const int N = 2005;
ll fact[N];
ll ifact[N];

ll perm(int n, int k){
    if (k > n) return 0;
    return fact[n]*ifact[n-k]%MOD;
}

ll combi(int n, int k){
    return perm(n,k)*ifact[k]%MOD;
}

ll modpow(ll b, ll e){
    ll ans = 1;
    while(e > 0){
        if (e&1) ans = ans*b%MOD;
        b = b*b%MOD;
        e >>= 1;
    }
    return ans;
}

ll modinv(ll x){
    return modpow(x, MOD-2);
}

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

    fact[0] = 1;
    for (int i = 1; i < N; i++)
        fact[i] = i*fact[i-1]%MOD;

    ifact[N-1] = modinv(fact[N-1]);
    for (int i = N-2; i >= 0; i--)
        ifact[i] = (i+1)*ifact[i+1]%MOD;

    int n, k; cin >> n >> k;
    for (int i = 1; i <= k; i++){
        cout << combi(n-k+1, i)*combi(k-1,i-1)%MOD << "\n";
    }
}

Measured memory_bytes: 3644
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
    
    int n,k;
    cin>>n>>k;
    
    int x[100];
    
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    
    int count=0;
    
    for(int i=0;i<n;i++){
        if(x[i]>=k-x[i]){
            count+=2*(k-x[i]);
        }else{
            count+=2*x[i];
        }
        
    }
    
    
    
    cout<<count<<endl;
    
   
    return 0;
}








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

int main() {
  int N;
  string S;
  cin >> N >> S;
  if (N % 2 == 1) cout << "No" << endl;
  else {
    if (S.substr(0, N/2) == S.substr(N/2)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 3616
import sys
from itertools import product

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def nei(s, i, j, H, W):
    return (i+1 < H and s[i+1][j] == '#') \
        or (0 <= i-1 and s[i-1][j] == '#') \
        or (j+1 < W and s[i][j+1] == '#') \
        or (0 <= j-1 and s[i][j-1] == '#')


def main():
    H, W = mi()
    s = [input() for i in range(H)]
    for i in range(H):
        for j in range(W):
            if s[i][j] == '#' and not nei(s, i, j, H, W):
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 67568
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		long k = sc.nextLong();
		sc.close();

		long cnt = 0;
		int cc = 0;
		for(int i = 0;i < ch.length;i++) {
			if(ch[i] == ch[0]) {
				cc++;
			}else {
				break;
			}
		}
		for(int i = 0;i < ch.length -1;i++) {
			if(ch[i]==ch[i+1]) {
				cnt++;
				ch[i+1]='$';
			}
		}
		long flg = 0;
		if(ch[0]==ch[ch.length-1]) {
			flg++;
			if(cc>0 && cc%2==0) {
				flg--;
			}
		}
		if(ch.length==1) {
			System.out.println(k/2);
			return;
		}
		if(ch.length==cc) {
			System.out.println((k*ch.length)/2);
			return;
		}
		System.out.println(cnt*k+(flg)*(k-1));
	}
}


Measured memory_bytes: 21972
#include <atcoder/all>
#include <bits/stdc++.h>

using namespace std;
using namespace atcoder;

using lint = long long;
#define rep(i, n) for(lint i = 0; i < lint(n); i++)
#define repu(i, a, b, s) for(lint i = lint(a); i < lint(b); i += lint(s))
#define repd(i, a, b, s) for(lint i = lint(a); i > lint(b); i += lint(s))
#define endl "\n"
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;

void solve() {
    lint N, M;
    cin >> N >> M;

    scc_graph g(N);
    rep(i, M) {
        lint a, b;
        cin >> a >> b;
        g.add_edge(a, b);
    }

    auto ans = g.scc();
    cout << ans.size() << endl;
    for(auto &&it : ans) {
        cout << it.size() << " ";
        rep(i, it.size()) { cout << (i == 0 ? "" : " ") << it[i]; }
        cout << endl;
    }
}

int main(int argc, char *argv[]) {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}

Measured memory_bytes: 40108
N = input()

if N<=2:
  print "No"
  exit(0)

for i in range(100):
  if 2**i==N:
    print "No"
    exit(0)

print "Yes"

print 1, 3
print 3, 2
print 2, N+1
print N+1, N+3
print N+3, N+2

for i in range(4, N, 2):
  print i+1, i
  print i, 1
  print 1, N+i+1
  print N+i+1, N+i

if N%2==0:
  print N, N-2
  x = N^(N-2)^1
  if x==3:
    print 3, N+N
  else:
    print x+N, N+N


Measured memory_bytes: 6276
#include <bits/stdc++.h>
#include <map> // pair
#include <string>
using namespace std;

int main(){
  char a,b;
  cin>>a>>b;
  int A,B;
  A=a-'0';
  B=b-'0';
  string As,Bs,ans;
  for(int i=0;i<B;i++){
    As.push_back(a);
  }
  for(int i=0;i<A;i++){
    Bs.push_back(b);
  }
  if(A<B)ans=As;
  else ans = Bs;

  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 2e5+10;
const int mod = 1e9 + 7;
inline LL qpow(LL a,LL t) {LL ans=1LL;a%=mod;for (;t;t>>=1,a=a*a%mod) if (t&1) ans=ans*a%mod;return ans;}
LL fac[maxn],inv[maxn];
int prime[maxn],tot = 0;
bool vis[maxn];
void init(){
    fac[0]=fac[1]=1;
    for(int i=2;i<maxn;i++) fac[i] = fac[i-1] * i % mod;
    inv[maxn-1]=qpow(fac[maxn-1], mod-2);
    for (int i=maxn-2;i>=0;i--) inv[i] = inv[i+1] * (i+1) % mod;

    tot = 0;
    for(int i = 2; i < maxn; i++)if (!vis[i]){
        prime[++tot] = i;
        if (i > sqrt(maxn)) continue;
        for (int j= i * i; j<maxn;j+=i) vis[j] = true;
    }
}
int n,m;
LL C(int p,int q){
    return fac[p] * inv[q] % mod * inv[p-q] % mod;
}
void work(){
    cin>>n>>m;
    LL ans = 1;
    for (int i=1,x;i<=tot && m > 1;i++){
        int cnt = 0; x = prime[i];
        while (m % x == 0) {m/=x;cnt++;}
        if (cnt > 0) ans = ans * C(cnt + n - 1,n-1) % mod;
    }
    if (m > 1) ans = ans * n % mod;
    cout<<ans<<endl;
}
int main(){
    init();
    work();
    return 0;
}


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

int main() {
	string s, t;
	int tot = 0;
	cin >> s >> t;
	for(int i = 0; i < s.size(); i++)
		if(s[i] != t[i]) tot++;
	cout << tot << endl;
	return 0;
}

Measured memory_bytes: 3856
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ld = long double;

const int N = 19;
ll a[N];
vector<pair<ll, ll>> dp[N][N];

int main() {
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
    cin >> n;
    rep(i, n) {
        cin >> a[i];
        dp[i][i] = {{0, 0}};
    }
    for (int d = 1; d <= n - 2; d++)
        for (int i = 1, j = d + 1; j <= n - 1; i++, j++) {
            vector<pair<ll, ll>> t;
            for (int k = i; k < j; k++)
                for (auto &p1 : dp[i][k])
                    for (auto &p2 : dp[k + 1][j])
                        t.push_back({p1.first + p1.second + p2.first + a[k], p2.second + p1.second + p2.first + a[k]});
            sort(all(t));
            for (auto &pp : t)
                if (dp[i][j].empty() || dp[i][j].back().second > pp.second)
                    dp[i][j].push_back(pp);
        }
    ll ans = 1e18;
    for (auto &pp : dp[1][n - 1])
        ans = min(ans, pp.first + pp.second);
    cout << ans + a[0] + a[n - 1];
}



Measured memory_bytes: 640
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

int main()
{
	string a, b;
	cin >> a >> b;

	int num = stoi(a + b);

	int s = sqrt(num);

	if (s * s == num) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}






Measured memory_bytes: 3592
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from numba import njit


@njit
def main(n):
    ans = 0
    for i in range(1, n + 1):
        ans += i * (n // i) * (n // i + 1) // 2
    print(ans)


if __name__ == '__main__':
    n = int(readline())
    main(n)


Measured memory_bytes: 109064
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        point: [(isize, isize, usize); n], 
    }

    let mut x = 0;
    let mut y = 0;
    let mut h = 0;

    for p in point.iter() {
        if p.2 != 0 {
            x = p.0;
            y = p.1;
            h = p.2;
            break;
        }
    }
    'loop_x: for cx in 0..101 {
        'loop_y: for cy in 0..101 {
            let cernter_h = (x - cx).abs() as usize+ (y - cy).abs() as usize + h;

            'inner: for p in point.iter() {
                let (x, y, h) = *p;
                if cernter_h <= (x - cx).abs() as usize + (y - cy).abs() as usize && h == 0{
                    continue 'inner;
                } else if cernter_h != (x - cx).abs() as usize + (y - cy).abs() as usize + h {
                    continue 'loop_y;
                }
            }
            println!("{} {} {}", cx, cy, cernter_h);
            break 'loop_x;
        }
    }
}


Measured memory_bytes: 4352
a = list(map(int, list(input())))

def calc(x, y, sym):
    if sym == 0:
        return x + y
    else:
        return x - y

def symbol(sym):
    if sym == 0:
        return '+'
    else:
        return '-'

for i in range(2):
    for j in range(2):
        for k in range(2):
            tmp = calc(a[0], a[1], i)
            tmp = calc(tmp, a[2], j)
            tmp = calc(tmp, a[3], k)
            if tmp == 7:
                b = list(map(symbol, [i, j, k]))
                print("{}{}{}{}{}{}{}=7".format(a[0], b[0], a[1], b[1], a[2], b[2], a[3]))
                break
        else:
            continue
        break
    else:
        continue
    break


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC091A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;
            var word = Console.ReadLine().Split(' ');
             a = int.Parse(word[0]);
             b = int.Parse(word[1]);
             c = int.Parse(word[2]);

            if (a + b >= c) 
                Console.WriteLine("Yes");
            
            else if (a + b <= c) 
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


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

using namespace std;

const int SIZE = 1e5 + 7;

vector<int> g[SIZE];
long memo[SIZE][2];

const long M = 1e9 + 7;

void add_self(long& a, long b) {
    a += b;
    if (a >= M) a -= M;
}

void mul_self(long& a, long b) {
    a *= b;
    a %= M;
}

const int BLACK = 1;
const int WHITE = 0;

int dfs(int p, int color, int u) {
    long& res = memo[u][color];
    if (res != -1) return res;
    res = 1;
    for (int v : g[u]) {
        if (v == p) continue;
        long value = dfs(u, WHITE, v);
        if (color == WHITE) add_self(value, dfs(u, BLACK, v));
        mul_self(res, value);
    }
    return res;
}

int main(int argc, char *argv[])
{
    int N;
    cin >> N;
    for (int i = 1; i < N; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    memset(memo, -1, sizeof memo);
    long res = dfs(-1, BLACK, 0);
    add_self(res, dfs(-1, WHITE, 0));
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 15616
s = input()
t = input()
l = ["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"]

s_m = l.index(s[0])
s_M = l.index(s[0])
for i in s:
    if l.index(i) < s_m:
        s_m = l.index(i)
    if l.index(i) > s_M:
        s_M = l.index(i)

t_m = l.index(t[0])
t_M = l.index(t[0])
for j in t:
    if l.index(j) < t_m:
        t_m = l.index(j)
    if l.index(j) > t_M:
        t_M = l.index(j)

if s_m == s_M == t_m == t_M:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")
elif s_m < t_M:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
  int n ;
  cin>>n ;
  int a[n][2] ;
  int k=0 ;
  for(int i=0;i<n;i++)
   cin>>a[i][0]>>a[i][1] ;
      for(int i=0;i<n;i++)
      {if(a[i][0]==a[i][1])
       k++ ;
       else k=0 ;
       if(k==3){
           cout<<"Yes" ;
          return 0 ; 
       }
      }
  
  cout<<"No" ;
  
  
}


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

const double EPS = 1e-10;
bool EQ(double a, double b){return fabs(a-b) < EPS;}
typedef complex<double> Point;
#define X real()
#define Y imag()
namespace std {
  bool operator == (const Point &a, const Point &b) {
    return EQ(a.X, b.X) && EQ(a.Y, b.Y);
  }
  bool operator < (const Point &a, const Point &b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}
struct Segment {
  Point p1, p2;
  Segment(){};
  Segment(Point p1, Point p2) : p1(p1), p2(p2) {};
};
typedef Segment Line;
typedef vector<Point> Polygon;
double dot(Point a, Point b){return real(conj(a) * b);}
double cross(Point a, Point b){return imag(conj(a) * b);}

const int COUNTER_CLOCKWISE = +1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = +2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;
int ccw(Point a, Point b, Point c) {
  Point x = b - a;
  Point y = c - a;
  if(cross(x, y) > EPS) return COUNTER_CLOCKWISE;
  if(cross(x, y) < -EPS) return CLOCKWISE;
  if(dot(x, y) < -EPS) return ONLINE_BACK;
  if(norm(x) < norm(y)) return ONLINE_FRONT;
  return ON_SEGMENT;
}

#define curr(P,i) P[i]
#define next(P,i) P[(i+1)%P.size()]
#define prev(P,i) P[(i+P.size()-1) % P.size()]
bool isConvex(Polygon P) {
  for(int i = 0; i < P.size(); ++i)
    if(ccw(prev(P,i), curr(P,i), next(P,i)) == CLOCKWISE) return false;
  return true;
}

int main() {
  int n,x,y;
  Polygon P;
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>x>>y;
    P.push_back(Point(x,y));
  }
  cout<<isConvex(P)<<endl;
  return 0;
}



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

using namespace std;

typedef long long  ll;

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

    int n;

    cin >> n;
    vector<int> a(n);
    int aa = 2 * n, bb = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        bb += 2 * a[i];
    }

    if (bb % aa == 0) {
        int y = 0;
        for (int i = 0; i < n; ++i)
            y += (a[i] - bb / aa) * (a[i] - bb / aa);
        cout << y << endl;
    }
    else {
        int x1 = floor((double)bb / aa), y1 = 0;
        int x2 = ceil((double)bb / aa), y2 = 0;
        for (int i = 0; i < n; ++i) {
            y1 += (x1 - a[i]) * (x1 - a[i]);
            y2 += (x2 - a[i]) * (x2 - a[i]);
        }

        cout << min(y1, y2) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int n = sc.nextInt();
        PriorityQueue<Integer> q = new PriorityQueue<>(Collections.reverseOrder());
        for(int i = 0; i < n; i++){
            q.offer(sc.nextInt());
        }
        long res = 0;
        Queue<Integer> max = new LinkedList<>();
        max.offer(q.poll());
        res += max.poll();
        max.offer(q.poll());
        while(!q.isEmpty()){
            int curr = max.poll();
            max.offer(q.poll());
            res += curr;
            if(!q.isEmpty()){
                max.offer(q.poll());
                res += curr;
            }
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 65056
#include<bits/stdc++.h>
using namespace std;
int t[1000001],x[1000001],y[1000001];
int main(){
	int n,i,f=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d%d",&t[i],&x[i],&y[i]);
		if((t[i]-x[i]-y[i])%2==1||(t[i]-x[i]-y[i])<0){printf("No\n");f=1;break;}
	}
	if(f==0)printf("Yes\n");
	return 0;
}

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

typedef long long ll;

ll pow_int(ll a, ll n)
{
    ll i;
    ll ans = 1;
    for(i = 0;i < n;++i){
        ans *= a;
    }
    return ans;
}

int main()
{
    int MOD = 1e9+7;
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    vector<int> digit(61,0);
    ll t = 1;
    for(i = 0;i < n;++i){
        for(j = 0;j < 61;++j){
            if(a.at(i) & (t << j)){
                ++digit.at(j);
            }
        }
    }
    ll ans = 0;
    for(i = 0;i < 61;++i){
        ans += digit.at(i)*(n-digit.at(i))%MOD*(pow_int(2,i)%MOD);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

const int MAX_N = (int)(100 + 5);

int n;
int a[MAX_N];

int ans = -1;

int main(void){
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%d", &(a[i]));
  }

  for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j) {
    ans = max(ans, abs(a[i] - a[j]));
  }

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 256