akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
def resolve():
    s=input()
    n=len(s)
    ans=0
    from itertools import product
    for A in product(range(2),repeat=n-1):
        k=s[0]
        for i in range(n-1):
            k+='+' if A[i] else ''
            k+=s[i+1]
        ans+=eval(k)
    print(ans)
resolve()


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC162A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine();

            if (N.Contains('7')) Console.WriteLine("Yes");
            else Console.WriteLine("No");

        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String RNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int RInt => int.Parse(RNext());
        public static long RLong => long.Parse(RNext());
        public static int[] RInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] RLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string RString => RNext();
        //以下未テスト
        public static int[] RIntsC(int c) => Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
        public static long[] RLongsC(int c) => Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
        public static char[][] RMap(int h) => Enumerable.Repeat(0, h).Select(x => Console.ReadLine().ToCharArray()).ToArray();
    }

    static class Debug
    {
        static public void Draw2D<T>(T[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            T[,] map2 = new T[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = (T)(object)0;
                    else if (i == 0) map2[i, j] = (T)(object)(j - 1);
                    else if (j == 0) map2[i, j] = (T)(object)(i - 1);
                    else map2[i, j] = map[i - 1, j - 1];
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write((dynamic)map2[i, j] % 10);
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D(int[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 25812
#include <stdio.h>
 
int main()
{
    int a,b;
    char op;
     
    while(1){
        scanf("%d %c %d",&a,&op,&b);
     
        if(op=='?') break;
        if(op=='+') printf("%d\n",a+b);
        if(op=='-') printf("%d\n",a-b);
        if(op=='*') printf("%d\n",a*b);
        if(op=='/') printf("%d\n",a/b);
    }
     
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    map<char, vector<int>> s;
    for (int i = 0; i < n; i++) {
        string ss;
        cin >> ss;
        map<char, int> c;
        for (auto& e : ss) c[e]++;
        for (char i = 'a'; i <= 'z'; i++) s[i].push_back(c[i]);
    }

    string ans = "";
    for (auto& e : s) {
        int m = *min_element(begin(e.second), end(e.second));
        ans += string(m, e.first);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def c_755(N):
    from itertools import product
    ans = 0
    for d in range(3, 10):
        # d桁ごとに '357' のみからなる数を生成する(99以下は七五三数でない)
        for s in product('357', repeat=d):
            # '357' のみからなるが、数字のどれかが0個なので七五三数でない
            if not all([s.count('3'), s.count('5'), s.count('7')]):
                continue
            v = int(''.join(s))
            if v <= N:
                ans += 1
    return ans

N = int(input())
print(c_755(N))

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
using namespace std;
using ll = long long;

int main() {
    ll N, K, Q; cin >> N >> K >> Q;
    vector<ll> cnt(N);
    for (ll i = 0; i < Q; i++) {
        ll v; cin >> v; v--;
        cnt[v]++;
    }
    for (ll i = 0; i < N; i++) {
        if (Q - cnt[i] < K) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


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

using pii = pair<int, int>;
using ll = long long;

constexpr ll INF = 1e18;

int main() {
    string s;
    cin >> s;
    int X = 0;
    for(int i = 0; i < s.size(); ++i) {
        X += s[i] - '0';
    }
    if(stoi(s) % X == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

using namespace std;

int h[100001];

int main() {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        h[i] = temp;
    }
    sort(h, h + n);
    int ans = -1;
    for (int i = 0; i <= n - k; i++) {
        int diff = h[i + k - 1] - h[i];
        if (ans < 0 || diff < ans)
            ans = diff;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll a[1000000];
ll b[1000000];
ll c[1000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(int to, int cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;
ll possible[10000000];
int main() {
	cin>>N;
	rep(i,0,N){
		cin>>a[i];
	}
	sort(a,a+N);
	if(N%2==1){
		ll frontcount1=0;
		ll backcount1=N-1;
		ll frontcount2=0;
		ll backcount2=N-1;
		b[0]=a[N/2];
		c[0]=a[N/2];
		rep(count,1,N){
			if(count%2){
				b[count]=a[frontcount1];
				c[count]=a[backcount2];
				frontcount1++;
				backcount2--;
			}else{
				b[count]=a[backcount1];
				c[count]=a[frontcount2];
				frontcount2++;
				backcount1--;
			}
		}
		ans=0;
		rep(i,1,N){
			ans+=abs(b[i]-b[i-1]);
		}
		ll tmp=0;
		rep(i,1,N){
			tmp+=abs(c[i]-c[i-1]);
		}
		cout<<max(ans,tmp)<<endl;
	}else{
		b[0]=a[(N/2)-1];
		c[0]=a[N/2];
		ll frontcount1=0;
		ll backcount1=N-1;
		ll frontcount2=0;
		ll backcount2=N-1;
		rep(count,1,N){
			if(count%2==0){
				b[count]=a[frontcount1];
				c[count]=a[backcount2];
				frontcount1++;
				backcount2--;
			}else{
				b[count]=a[backcount1];
				c[count]=a[frontcount2];
				frontcount2++;
				backcount1--;
			}
		}
		ans=0;
		rep(i,1,N){
			ans+=abs(b[i]-b[i-1]);
		}
		ll tmp=0;
		rep(i,1,N){
			tmp+=abs(c[i]-c[i-1]);
		}
		cout<<max(ans,tmp)<<endl;
	}
	return 0;
}


Measured memory_bytes: 10496
#!python3.8
# -*- coding: utf-8 -*-
# abc166/abc166_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, K = i2nn()
    sunuke = [1] * N
    for _ in range(K):
        i2s()
        for A in i2nn():
            sunuke[A - 1] = 0
    print(sum(sunuke))
    return

main()


Measured memory_bytes: 9168
def monthable(n):
    n = int(n)
    if n <= 12 and n >= 1:
        return True
    else:
        return False

s = input()
s1,s2 = s[:2], s[2:]

if monthable(s1) and monthable(s2):
    print("AMBIGUOUS")
elif monthable(s1) and not monthable(s2):
    print("MMYY")
elif not monthable(s1) and monthable(s2):
    print("YYMM")
else:
    print("NA")

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

int main(){
   int N;
  cin >> N;
  vector<int> W(N);
  int a = 0;
  for(int i=0;i<N;i++){
     cin >> W.at(i);
    a+=W.at(i);
  }
  int  b;
  for(int i=0;a>=0;i++){
    b=a;  
    a-=2*W.at(i);  
  }
  cout << min(a*(-1),b) << endl;
  }

Measured memory_bytes: 256
A, B, C, D = list(map(int, list(input())))

def int_to_pm(x):
    if x == 0:
        return '+'
    else:
        return '-'

for i in range(2):
    for j in range(2):
        for k in range(2):
            ans = A + (1-2*i)*B + (1-2*j)*C + (1-2*k)*D
            if ans == 7:
                print(str(A) + int_to_pm(i) + str(B) + int_to_pm(j) + str(C) + int_to_pm(k) + str(D) + '=7')
                break
        else:
            continue
        break
    else:
        continue
    break

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main()
{
	int a, b;
	cin >> a;
	cin >> b;
	if (a == b) 
	{
		cout << "a == b" << endl; 
		return 0;
	}
	if (a > b)
	{
		cout << "a > b" << endl;
	}
	else
	{
		cout << "a < b" << endl;
	}
	return 0;
}


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

typedef long long ll;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  map<ll,ll> mp;
  for (int i = 0; i < N; i++) {
    mp[A.at(i)]++;
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  ll a, b = 0;
  for (int i = 0; i < N; i++) {
    if (mp[A.at(i)] >= 2) {
      if (a == 0) {
        a = A.at(i);
        if (mp[A.at(i)] >= 4) {
          b = A.at(i);
          break;
        }
      }
      if (a != 0 && a != A.at(i) && b == 0) {
        b = A.at(i);
        break;
      }
    }
  }

  ll c = a * b;
  cout << c << endl;
}

Measured memory_bytes: 7296
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k, s;
    cin >> n >> k >> s;
    V res;
    if (s == 1e9)
    {
        rep(i, n)
        {
            if (i < k)
            {
                res.push_back(1e9);
            }
            else
            {
                res.push_back(1);
            }
        }
        rep(i, n)
        {
            cout << res[i] << " ";
        }
        cout << endl;
        return 0;
    }
    rep(i, n)
    {
        if (i < k)
        {
            res.push_back(s);
        }
        else
        {
            res.push_back(1e9);
        }
    }
    rep(i, n)
    {
        cout << res[i] << " ";
    }
    cout << endl;
}


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

#define ff first
#define ss second
#define endl '\n'

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

	int n, l;
	cin >> n >> l;

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

	sort(s, s+n);
	for (const string x : s) {
		cout << x;
	}

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
// abc145_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

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


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s;
  cin >> s;
  rep(i, s.size()) { cout << ((i == 5 || i == 13) ? ' ' : s[i]); }
  cout << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define For(i, l, r) for(register int i = (l), _end_ = (int)(r); i <= _end_; ++i)
#define Fordown(i, r, l) for(register int i = (r), _end_ = (int)(l); i >= _end_; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
   int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar() ) x = (x<<1) + (x<<3) + (ch ^ '0');
    return x * fh;
}

int main () {
	int n, a;
	cin >> n >> a;
	if (n % 500 > a) puts("No");
	else puts("Yes");
    return 0;
}


Measured memory_bytes: 256
/*input
1 2 3
*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<long,long>
#define vi          vector<long long>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repi(i,a,b) for(ll i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define clr(x) memset(x, 0, sizeof(x))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
//#define ordered_set tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update>;

ll sub(ll a, ll b){return (a-b+hell)%hell;}
ll add(ll a, ll b){return (a+b)%hell;}
ll mul(ll a, ll b){return (a*b)%hell;}
vector<ll>adj[100005];
bool vis[100005];
ll siz,edges;
void dfs(ll i)
{
	vis[i]=1;
	//siz++;
	for(ll j=0;j<adj[i].size();j++)
	{		
		edges++;
		if(!vis[adj[i][j]])
			dfs(adj[i][j]);
	}
}
const ll mod = 1000000007;
ll mpow(ll base, ll exp) {
  base %= mod;
  ll result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

int main()
{
fIO;
ll n,sum=0,t=1,m,ans,a,b,c;

//cin >> t;
while(t--){
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b;
	














}
	
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String alpha = sc.next();
        if (Character.isUpperCase(alpha.charAt(0))) {
            System.out.println("A");
        } else {
            System.out.println("a");
        }
    }
}

Measured memory_bytes: 26768
import itertools

dishes = []
for _ in range(5):
  dishes.append(int(input()))

ans = float('inf')
for v in itertools.permutations(range(5), 5):
  result = 0
  for i in range(4):
    if dishes[v[i]] % 10 == 0:
      result += dishes[v[i]]
    else:
      result += (dishes[v[i]]//10)*10 + 10
  result += dishes[v[4]]
  ans = min(ans, result)

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
   int A,b;
   scanf("%d%d",&A,&b);

   if(1<=A && A<=100 && 1<=b && b<=100){
        if((A+b)%3==0 || A%3==0 || b%3==0) printf("Possible");
        else  printf("Impossible");
   }
    return 0;
}

Measured memory_bytes: 1720
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define bit(n,m)(((n)>>(m))&1)



//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g,color,cost;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[200010];//適宜変える
	int id[100010];//適宜変える
}G;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}

G g;
ll q;
void readgraph(){
	//適宜変える
	ll n;
	scanf("%lld%lld",&n,&q);
	rep(i,0,n-1){
		ll x,y,col,cos;
		scanf("%lld%lld%lld%lld",&x,&y,&col,&cos);
		x--,y--;
		g.e[2*i].s=x;
		g.e[2*i].g=y;
		g.e[2*i].color=col;
		g.e[2*i].cost=cos;
		g.e[2*i+1].s=y;
		g.e[2*i+1].g=x;
		g.e[2*i+1].color=col;
		g.e[2*i+1].cost=cos;
	}
	g.vcnt=n;
	g.ecnt=2*n-2;
	qsort(g.e,g.ecnt,sizeof(E),esort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//番兵
}

#define VCNT 100010
int dep[VCNT];
int oya[20][VCNT];
#undef VCNT
ll lcainitdfs(int v){
	rep(i,g.id[v],g.id[v+1]){
		if(!dep[g.e[i].g]){
			oya[0][g.e[i].g]=v;
			dep[g.e[i].g]=dep[v]+1;
			lcainitdfs(g.e[i].g);
		}
	}
}
void lcainit(int root){
	dep[root]=1;
	lcainitdfs(root);
	rep(k,1,20)rep(v,0,g.vcnt)oya[k][v]=oya[k-1][oya[k-1][v]];
}
int lca(int u,int v){
	int du=dep[u];
	int dv=dep[v];
	if(du<dv){
		int t;
		t=du;du=dv;dv=t;
		t= u; u= v; v=t;
	}
	rep(k,0,20)if(bit(du-dv,k))u=oya[k][u];

	if(u==v)return u;
	for(int k=19;k>=0;k--)if(oya[k][u]!=oya[k][v]){
		u=oya[k][u];
		v=oya[k][v];
	}
	return oya[0][u];
}

int u[100010];
int v[100010];
int l[100010];
int color[100010];
int cost[100010];
int pos[100010];
int crrpos[100010];

int queryidx[300010];
ll ans[100010];
ll ccnt[100010];
ll ccost[100010];
ll totalcost;

void dfs(int v,int pre){
	rep(idx,pos[v],pos[v+1]){
		int i=queryidx[idx];
		int flag=1;
		if(i<0){
			i=-i;
			flag=-2;
		}
		i--;
		ll val=totalcost-ccost[color[i]]+ccnt[color[i]]*cost[i];
		ans[i]+=val*flag;
	}
	rep(i,g.id[v],g.id[v+1]){
		if(g.e[i].g!=pre){
			ccnt [g.e[i].color]++;
			ccost[g.e[i].color]+=g.e[i].cost;
			totalcost+=g.e[i].cost;
			dfs(g.e[i].g,v);
			totalcost-=g.e[i].cost;
			ccost[g.e[i].color]-=g.e[i].cost;
			ccnt [g.e[i].color]--;			
		}
	}
}

int main(){
	readgraph();
	lcainit(0);
	rep(i,0,q){
		scanf("%d%d%d%d",color+i,cost+i,u+i,v+i);
		u[i]--,v[i]--;
	}
	rep(i,0,q){
		l[i]=lca(u[i],v[i]);
		pos[u[i]+1]++;
		pos[v[i]+1]++;
		pos[l[i]+1]++;
	}
	rep(i,1,g.vcnt+3)crrpos[i]=pos[i]+=pos[i-1];
	rep(i,0,q){
		queryidx[crrpos[u[i]]++]=i+1;
		queryidx[crrpos[v[i]]++]=i+1;
		queryidx[crrpos[l[i]]++]=-i-1;
	}
	dfs(0,-1);
	rep(i,0,q)printf("%lld\n",ans[i]);
}

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

int main(){
  string S; cin >> S;
  int N=S.size();
  int win=0;
  for(int i=0; i<N; i++){
    if(S[i]=='o') win++;
  }
  if(15-N+win>=8) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<string.h>
#include <algorithm>
#include<math.h>
#include<vector>
#include <queue>
#include <deque> 
#define ll long long
#define M 1000000007 
#define MM 998244353
using namespace std;
 
int main()
{
    long long int n, sum = 0;
    cin >> n;

    long long int a[1000000] = {0}, x;

    for (long long int i = 0; i < n; i++)
    {
   		cin >> x;
   		a[x-1]++;
   		sum = sum + x;
    }

    // for (long long int i = 0; i < n; i++)
    // {
   	// 	cout << a[i] << " ";
    // }

    long long int q;
    cin >> q;

    long long int b[q], c[q];

    for (long long int i = 0; i < q; i++)
    {
    	cin >> b[i] >> c[i];
    }

    for (long long int i = 0; i < q; i++)
    {
    	sum = sum + (c[i] - b[i])*(a[b[i] - 1]);
    	cout << sum << endl;
    	a[c[i] - 1] = a[c[i] - 1] + a[b[i] - 1];
    	a[b[i] - 1] = 0;
    }

    return 0;
}

Measured memory_bytes: 13000
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50 == X:
                cnt+=1
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define ff first
#define ss second
#define inp(a) int a; cin>>a;
#define inpa(a,n) vector<int>a(n+2); FOR(i,1,n) cin>>a[i];
#define PI 3.141592653589793238
#define vec(x) vector<x>
#define pii pair<int,int>
#define mem(a,b) memset(a, b, sizeof a)
#define FOR(i,j,n) for(int i= j; i<=n; i++)
#define CASE int t; cin>>t; while(t--)
#define prec(n) fixed<<setprecision(n)
#define print(x) for(auto c : x) cout << c << " ";
#define dbg(x) cerr << #x << " :: "<< x << endl;
#define dbg2(x,y) cerr << #x << " :: "<<x <<"\t" << #y << " :: "<<y <<endl;
const int INF = 1e9 + 7;
const int maxn = 1e6 + 3;
const int MOD = 1e9 + 7; 
//////////// template ends here //////////////////////////

vec(int)dp(maxn, -1);
vec(int)h(maxn, 0);

int topdown(int n){

	if(n == 1){
		return 0;
	}

	if(dp[n] != -1)
		return dp[n];

	int sub1 = maxn, sub2 = maxn;
	if(n-1 > 0)
		sub1 = topdown(n-1) + abs(h[n] - h[n-1]);
	if(n-2 > 0)
		sub2 = topdown(n-2) + abs(h[n] - h[n-2]);
	dp[n] = min(sub1, sub2);
	return dp[n];
}


void solve(){

	inp(n);
	FOR(i,1,n)
		cin>>h[i];

	cout << topdown(n) << endl;



}




int32_t main(){
	#ifndef ONLINE_JUDGE 
		freopen ("input.txt","r",stdin);
		freopen ("output.txt","w",stdout);
	#endif	
	 ios::sync_with_stdio(0); 
	 cin.tie(0); cout.tie(0);
	//CASE{
		solve();
	//}

	cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >>d;
  if (abs(c - a) <= d || abs(b - a) <= d && abs(c - b) <= d) {
    cout <<"Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <unordered_map>

const unsigned long long M = 1000000007;
using namespace std;

unordered_map<unsigned long long, unsigned long long> calc_factors(unsigned long long n){
	unordered_map<unsigned long long, unsigned long long> factors; 
	unsigned long long org_n = n;
	unsigned long long max = ceil(sqrt(n));
	unsigned long long x = 2;
	while(x <= max){
		if(n % x == 0){
			if(factors.find(x) != factors.end()){
				factors[x] += 1;
			}else{
				factors[x] = 1;
			}
			n /= x;
			max = ceil(sqrt(n));
		}else{
			x += 1;
		}
	}
	if(n != 1){
		if(factors.find(n) != factors.end()){
			factors[n] += 1;
		}else{
			factors[n] = 1;
		}
	}
	return factors;
}


int main(void){
	unsigned long long N;
	cin >> N;
	
	unsigned long long data[N];
	
	for(unsigned long long i = 0; i < N; i ++){
		cin >> data[i];
	}
	
	unordered_map<unsigned long long, unsigned long long> total_factors; 
	for(unsigned long long i = 0; i < N; i ++){
		unsigned long long A = data[i];
		auto factors = calc_factors(A);
		
		for(auto iter = factors.begin(); iter != factors.end(); iter ++) {
			if(total_factors.find(iter->first) == total_factors.end()){
				total_factors[iter->first] = iter->second;
			}else if(total_factors[iter->first] < iter->second){
				total_factors[iter->first] = iter->second;
			}
		}
	}
	unsigned long long total = 0;
	for(unsigned long long i = 0; i < N; i ++){
		unsigned long long A = data[i];
		auto factors = calc_factors(A);
		unsigned long long B = 1;
		for(auto iter = total_factors.begin(); iter != total_factors.end(); iter ++) {
			unsigned long long factor = iter->first;
			unsigned long long count = iter->second;
			if(factors.find(factor) != factors.end()){
				count -= factors[factor];
			}
			for(unsigned long long j = 0; j < count; j ++){
				B = (B * factor) % M;
			}
		}
		total = (total + B) % M;
	}
	
	cout << total << endl;
	
	return 0;
}



Measured memory_bytes: 896
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

// 解説AC

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

    int n;
    map<int, int> m;
    cin >> n >> m['A'] >> m['B'] >> m['C'];
    vector<string> commands(n);
    for (int i = 0; i < n; i++) cin >> commands[i];

    // 選択を記録する配列
    // 長さ0なら不可能を意味する
    // シミュレーション中にゲームが不可能であることがわかるかもしれないため、
    // 答えを出力するのではなく配列に入れる
    vector<char> answers;

    // シミュする
    for (int i = 0; i < n; i++) {
        const char f = commands[i][0], b = commands[i][1];

        // どちらも0なら不可能
        if (m[f] == 0 && m[b] == 0) {
            answers = {};
            break;

            // 一方が0ならもう一方を選択する
        } else if (m[f] == 0) {
            m[f]++, m[b]--;
            answers.push_back(f);

        } else if (m[b] == 0) {
            m[f]--, m[b]++;
            answers.push_back(b);

            // 両方が1以上のとき
            // このゲームでは両方が0になることを避けたい
            // 次のsにfがでるならばfを選ぶ
        } else if (i < n - 1 && commands[i + 1].find(f) != string::npos) {
            m[f]++, m[b]--;
            answers.push_back(f);

            // 出ないならばbを選ぶ
            // どちらも出る、最後の選択ならどちらでもいい
        } else {
            m[f]--, m[b]++;
            answers.push_back(b);
        }
    }

    if (answers.size()) {
        cout << "Yes" << endl;
        for (auto&& i : answers) {
            cout << i << endl;
        }

    } else
        cout << "No" << endl;
}


Measured memory_bytes: 6692
def gcd(x, y):
    y, x = sorted([x, y])
    while y > 0:
        t = y
        y = x % y
        x = t
    return x

n = int(input())
t = [int(input()) for i in range(n)]

lcm = 1
for i in range(n):
    lcm = lcm * t[i] // gcd(lcm, t[i])

print(lcm)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    string s; cin >> s;
    ll n = s.size();
    rep(i,n-1){
        if(s[i] == s[i+1]){
            print2(i+1,i+2);
            return 0;
        }
    }
    rep(i,n-2){
        if(s[i]==s[i+2]){
            print2(i+1,i+3);
            return 0;
        }
    }
    cout << "-1 -1" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;cin>>n;

    vector<pair<int, int>> ary[n];
    rep(i,n)
    {
        int a;cin>>a;
        rep(j,a)
        {
            int x,y;
            cin >> x >> y;
            x--;
            ary[i].push_back(make_pair(x,y));
        }
    }
    int syoziki = 0;
    int count_n = 0;
    
    for (ll bit = 0; bit < (1<<n); ++bit)
    {
        count_n = 0;
        bool flag = true;
        rep(i,n)
        {
            if (bit & (1<<i))
            {
                count_n++;
                for (auto itr = ary[i].begin();itr!=ary[i].end();++itr)
                {
                    pair<int, int> tmp_num = *itr;
                    // if ((ary[tmp_num.first] == 1 && (bit & (1 << tmp_num.first))) || (ary[tmp_num.first] == 0 && !(bit & (1 << tmp_num.first))))
                    if ((tmp_num.second == 1 && (bit & (1 << tmp_num.first))) || (tmp_num.second == 0 && !(bit & (1 << tmp_num.first))))
                    {
                        // pass
                    }
                    else
                    {
                        flag = false;
                    }
                    
                }
            }
        }

        if (flag)
        {
            syoziki = max(syoziki, count_n);
            // cout <<"bit: " << bit << endl;
            // cout << "count_n " << count_n << endl;
            // cout << endl;
        }
    }
    print(syoziki);
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
//pbds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>   using orderedSet =tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;
///use less_equal in pbds template to work as multiset...................................................
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
//BFS+DFS
#define boundary(i,j) (i>=0 && i<n && j>=0 && j<m)
int X[]={-1,1,0,0};
int Y[]={0,0,1,-1};
/*
struct cmp{
bool operator()(const pii &a,const pii &b)
{
    if(a.first==b.first) return a.second<b.second;///second value small to big
    else return a.first>b.first;///first value big to small
}
};
///in pq true means swap required  ,false means swap  not required...
set<pii,cmp>st;
priority_queue<pii,deque<pii>,cmp>pq;
*/
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int n;
     cin>>n;
     int ans=0;
     for(int i=1; i<n; i++)
     {
         int x=n/i;
         if(n%i==0) --x;
         ans+=x;
     }
     cout<<ans<<endl;
}




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

upper = list(map(int,input().split()))
down = list(map(int,input().split()))

scores = []
for i in range(N):
    score = 0
    flag = 0
    for j in range(N):
        if i == j and flag == 0:
            score += upper[j]
            score += down[j]
            flag = 1
        elif flag == 0:
            score += upper[j]
        elif flag == 1:
            score += down[j]
    scores.append(score)

print(max(scores))

Measured memory_bytes: 9104
n,W = map(int,input().split())
wvl = []
for _ in range(n):
   w,v = map(int,input().split())
   wvl.append((w,v))

dp = [[0 for i in range(W+1)] for _ in range(n)]

for i in range(W+1):
    if wvl[0][0] <= i:
        dp[0][i] = wvl[0][1]

for i in range(1,n):
    for j in range(W+1):
        if j-wvl[i][0] >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-wvl[i][0]] + wvl[i][1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[-1][-1])

Measured memory_bytes: 171528
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long x,y,k=1,a,n,w;
    long long sum=0,c=0;
    int d;
    cin>>n>>w;
    long long dp[n+1][w+1];
    int wt[n],v[n];
    for (size_t i = 0; i < n; i++)
    {
        cin>>wt[i]>>v[i];
    }
    for (size_t i = 0; i < n+1; i++)
    {
        for (size_t j = 0; j < w+1; j++)
        {
            if(i==0 || j==0)
            dp[i][j]=0;
            else if (wt[i-1]<=j)
            dp[i][j]=max(v[i-1]+dp[i-1][j-wt[i-1]],dp[i-1][j]);
            else if(wt[i-1]>j)
            {
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    cout<<dp[n][w]<<'\n';
    
	return 0;
}

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

void Main()
{
  int N;
  cin >> N;
  N++;
  ll saved = 0;
  vector<int> A(N), B(N);
  rep(i,N) {
    cin >> A[i];
    //cout << A[i] << endl;
  }
  rep(i,N-1) {
    cin >> B[i];
    //cout << B[i] << endl;
  }
  rep(i,N-1){
    saved += min(A[i],B[i]);
    //cout << saved << endl;
    B[i] = max(B[i]-A[i],0);
    saved += min(B[i], A[i+1]);
    //cout << saved << endl;
    A[i+1] = max(A[i+1]-B[i], 0);
  }
  cout << saved << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> r(n + 1), g(n + 1), b(n + 1);
  for (int i = n - 1; i >= 0; i--) {
    r[i] = r[i + 1];
    g[i] = g[i + 1];
    b[i] = b[i + 1];
    if (s[i] == 'R') r[i]++; 
    if (s[i] == 'G') g[i]++;
    if (s[i] == 'B') b[i]++;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
    if (s[i] != s[j]) {
      char c = 'R' + 'G' + 'B' - s[i] - s[j];
      int x = j + j - i;
      if (c == 'R') ans += r[j] - (s[min(n, x)] == 'R');
      if (c == 'G') ans += g[j] - (s[min(n, x)] == 'G');
      if (c == 'B') ans += b[j] - (s[min(n, x)] == 'B');
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadInts();
            if (input[0] <= input[2] && input[2] <= input[1])
            {
                WriteLine("Yes");
            }
            else
            {
                WriteLine("No");
            }
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int n;
long long a[3003], dp[3003][3003]; // dp[l][r]

int main(){
	cin >> n;
	for (int i=0;i<n;i++) cin >> a[i];
	for (int len=0;len<n;len++){
		for (int i=0;i<n;i++){
			if (i+len>=n) continue;
			if (len==0) dp[i][i]=a[i];
			else if (len&1){ // even size, Jiro's turn
				dp[i][i+len]=min(dp[i][i+len-1]-a[i+len],dp[i+1][i+len]-a[i]);
			}
			else{ // odd size, Taro's turn
				dp[i][i+len]=max(dp[i][i+len-1]+a[i+len],dp[i+1][i+len]+a[i]);
			}
		}
	}
//	for (int i=0;i<n;i++){
//		for (int j=i;j<n;j++){
//			cout << dp[i][j] << " ";
//		}
//		cout << "\n";
//	}
	cout << (n%2==0 ? -dp[0][n-1] : dp[0][n-1]) << "\n";
}

Measured memory_bytes: 70016
program main

  implicit none
  
  !character(10) :: s, t, u
  integer :: a, b, c, n
  

  read(*,*) a, b, c
  
  n = 0
  if( a == b ) then
    n = n + 1
  end if
  if( a == c ) then
    n = n + 1
  end if
  if( b == c ) then
    n = n + 1
  end if

  if ( n == 1 ) then
    print*, "Yes"
  else
    print*, "No"
  end if
  
end program main


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

int a,b,c,d;
void solve(){
   while(true){
       c=c-b;
       if(c<=0){
           cout<<"Yes"<<endl;
            break;
       }
       a=a-d;
       if(a<=0){
           cout<<"No"<<endl;
           break;
       }
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>a>>b>>c>>d;
    solve();
    return 0;
}

Measured memory_bytes: 3656
n, m, c = map(int,input().split())
b = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]
count = 0
tmp = 0
for i in range(n):
    for j in range(m):
        tmp += a[i][j] * b[j]
    count += 1 if tmp + c > 0 else 0
    tmp = 0
print(count)

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

int main(){
  int h, a;  cin >> h >> a;
  int ans =0;
  while(h>0){
    h-=a;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt();
        for(int i=0;i<(int)Math.max(a,b);i++){
            System.out.print((int)Math.min(a,b));
        }
        System.out.println();
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    //cout << 4 * a * b << endl;
    //cout << c * c + a * a + b * b + 2 * (a * b - c * a - b * c) << endl;
    if (4 * a * b < c * c + a * a + b * b + 2 * (a * b - c * a - b * c) && c - a - b > 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,K;
    Scd2(N,K);

    int D,a;
    vi b(N);
    Rep(i,K){
        Scd(D);
        Rep(j,D) {
            Scd(a);
            b[--a]++;
        }
    }

    int ans = 0;
    Rep(i,N) ans += ( b[i] == 0 );

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

    return 0;
}



Measured memory_bytes: 3792
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	private static int nowSosuu = 1;
	private static ArrayList<Integer> array = new ArrayList<Integer>();

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();

		System.out.printf(n + ":");

		if(checkSosuu(n)) {
			System.out.printf(" " + n);
		}
		else {
			while(n != 1) {
				setNextSosuu();
				while(n % nowSosuu == 0) {
					System.out.printf(" %d", nowSosuu);

					n /= nowSosuu;
				}
			}
		}
		System.out.println("");

		scan.close();
	}

	private static void setNextSosuu() {
		while(true) {
			nowSosuu++;
			if(checkNotMultiple(nowSosuu)) {
				array.add(nowSosuu);
				return;
			}
		}
	}

	private static boolean checkNotMultiple(int num) {
		for(int i = 0; i < array.size(); i++) {
			if(num % array.get(i) == 0) {
				return false;
			}
		}
		return true;
	}

	private static boolean checkSosuu(int n) {
		for(int i = 2; i < Math.sqrt(n); i++) {
			if(n % i == 0) {
				return false;
			}
		}
		return true;
	}
}


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

using namespace std;


int main()
{
    int d,n;
    cin>>d>>n;
    if(d==0)
    {
        if(n==100)cout<<101;
        else
            cout<<n;
    }
    else if(d==1)
    {
        if(n == 100)cout<<100*100+100;
        else
            cout<<100*n<<endl;
    }
    else
    {
        if(n==100)cout<<10000*100+10000<<endl;
        else
            cout<<10000*n<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    fun gcd(a: Long, b: Long): Long {
        return if (b > 0) gcd(b, a % b) else a
    }

    fun lcm(a: Long, b: Long): Long {
        return a * b / gcd(a, b)
    }

    fun lcm(param: List<Long>): Long {
        if (param.size == 1) return param[0]
        var l = lcm(param[0], param[1])
        for (i in 2 until param.size) l = lcm(l, param[i])
        return l
    }
    val (n, m) = readLine()!!.split(' ').map(String::toLong)
    val aList = readLine()!!.split(' ').map(String::toLong).distinct()


    val map = aList.map {
        var ts = 2L
        while (it % ts == 0L) ts *= 2
        ts
    }
    if (map.distinct().size != 1) {
        println(0)
        return
    }

    val lcm = lcm(aList.map { it / 2 })
    println(Math.round(m.toDouble() / lcm.toDouble() / 2.0))
}

Measured memory_bytes: 55124
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    int ansW = 100 * A, ansS = 0;
    double maxcon = 0.0;

    int na = F / (100 * A);
    for (int a = 0; a <=na; a++) {
        int nb = (F - 100 * A*a) / (100 * B);
        for (int b = 0; b <= nb; b++) {
            int nc = (F - 100 * A*a - 100 * B*b) / C;
            for (int c = 0; c <= nc; c++) {
                int nd = (F - 100 * A*a - 100 * B*b - C*c) / D;
                for (int d = 0; d <= nd; d++) {
                    int W = 100 * (A*a + B*b);
                    int S = C*c + D*d;
                    if (W + S <= F) {
                        double con;
                        if (W + S == 0)con = 0;
                        else con = 100.0*S / (W + S);
                        if (con > maxcon&&con <= 100.0*E / (100.0 + E)) {
                            maxcon = con;
                            ansW = W;
                            ansS = S;
                        }
                    }
                }
            }
        }
    }

    cout << ansW + ansS << " " << ansS << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = ni();
        }
        int all = a[0];
        for (int i = 1; i < N; i++) {
            all = all ^ a[i];
        }
        for (int i = 0; i < N; i++) {
            out.print(all ^ a[i]);
            out.print(" ");          
        }
    }

 
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 56420
def main():
    n = int(input())
    ac,wa,tle,re = 0,0,0,0
    for i in range(n):
        s = input()
        if s=='AC':
            ac+=1
        elif s=='WA':
            wa+=1
        elif s=='TLE':
            tle+=1
        else:
            re+=1
    print('AC x {}'.format(ac))
    print('WA x {}'.format(wa))
    print('TLE x {}'.format(tle))
    print('RE x {}'.format(re))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9136