akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public static final String UNRESTORABLE = "UNRESTORABLE";

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.nextString();
            String t = in.nextString();

            if (t.length() > s.length()) {
                out.println(UNRESTORABLE);
                return;
            }

            int d = s.length() - t.length();
            TreeSet<String> treeSet = new TreeSet<>();
            out:
            for (int i = 0; i <= d; i++) {
                for (int j = 0; j < t.length(); j++) {
                    if (s.charAt(s.length() - 1 - i - j) == '?') continue;

                    if (s.charAt(s.length() - 1 - i - j) != t.charAt(t.length() - 1 - j)) continue out;
                }

                char[] ans = new char[s.length()];
                for (int j = 0; j < s.length(); j++) {
                    if (s.length() - t.length() - i <= j && j < s.length() - i) {
                        ans[j] = t.charAt(j - (s.length() - t.length() - i));
                    } else {
                        if (s.charAt(j) == '?') {
                            ans[j] = 'a';
                        } else {
                            ans[j] = s.charAt(j);
                        }
                    }
                }
                treeSet.add(String.valueOf(ans));
            }

            out.println(treeSet.isEmpty() ? UNRESTORABLE : treeSet.first());
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 22996
def check(res,a,f,k):
    for sa,sf in zip(a,f):
        if sa*sf <= res:
            continue
        k -= sa - (res // sf)
        if k < 0:
            return False
    return True


def nibun(l,r,a,f,k):
    if r == l:
        return l
    flag = (l+r)//2
    if check(flag,a,f,k):
        return nibun(l,flag,a,f,k)
    else:
        return nibun(flag+1,r,a,f,k)

def main():
    n,k = map(int,input().split())
    a= list(map(int,input().split()))
    f= list(map(int,input().split()))

    a.sort()
    f.sort(reverse=True)

    return nibun(0,10**13,a,f,k)


print(main())

Measured memory_bytes: 119500
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())

long calcB(long a, long x){
  long b = pow(abs(pow(a,5)-x),0.20);
  if(pow(a,5) < x) {
    b*=-1; 
  }
  return b;
}

int main()
{
    long x=0L;
    cin >> x;
    
    long a = ceil(pow(x,0.20));
    long b = calcB(a,x);

    int cnt=0;
    while(pow(a,5) - pow(b,5) != x || cnt>100){
      a -=1 ;
      b = calcB(a,x);
    }

    if(pow(a,5) - pow(b,5) != x){
      cnt=0;
      long a = ceil(pow(x,0.20));
      while(pow(a,5) - pow(b,5) != x || cnt>100){
        a +=1 ;
        b = calcB(a,x);
      }
    }

    cout << a << " " << b << endl;
}


Measured memory_bytes: 4016
#include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
#define MAX 3001

int dp[MAX][MAX];

string getLCS(string &s, string &t, int len){
    int i = 0, j = 0;
    string LCSstring;
    while(len>0){
        if(s[i]==t[j]){
            LCSstring.push_back(s[i]);
            i++;
            j++;
            len--;    
        }
        else{
            if(dp[i][j+1] > dp[i+1][j]){
                j++;
            }
            else{
                i++;
            }
        }
    }
    return LCSstring;
}

int lenLCS(string &s, int i, string &t, int j){
    if(i>=s.size()||j>=t.size()){
        return  0;
    }
    if(dp[i][j]!=-1){
        return dp[i][j];
    }

    if(s[i]==t[j]){
        return dp[i][j] = 1 + lenLCS(s, i+1,t, j+1);
    }
    else{
        return dp[i][j] = max(lenLCS(s,i+1,t,j), lenLCS(s, i, t,j+1));
    }
}

string solve(string s, string t){
    memset(dp, -1, sizeof dp);
    int l = lenLCS(s,0,t,0);
    return getLCS(s, t, l);
}
int main() {
    string s, t;
    cin >> s >> t;
    cout << solve(s, t) << endl;
}


Measured memory_bytes: 39216
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define mp make_pair
#define pb push_back
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int main() {
	int A, B;
	cin >> A >> B;
	int t = abs(A - B);
	if (t % 2 == 0) {
		int x = max(A, B);
		cout << x - t/2 << endl;
	} else {
		cout << "IMPOSSIBLE" << endl;
	}
    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()
    val t = sc.next()

    var overlap = 0
    for (i in n downTo 0) {
        if (s.slice(n - i until n) == t.slice(0 until i)) {
            overlap = i
            break
        }
    }
    println(2 * n - overlap)
}


Measured memory_bytes: 31392
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])cout << "Yes" <<endl;
    else cout << "No" <<endl;
    return 0;
}

Measured memory_bytes: 256
// E - Sum of gcd of Tuples (Hard)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD 1000000007
ll modpow(ll a,ll n){return n?modpow(a*a%MOD,n/2)*(n%2?a:1)%MOD:1;}

int main(){
	int N,K; cin>>N>>K;
	vector<ll> cnt(K+1); // [gcd:[1,K]] gcd 毎の個数
	ll ans = 0;
	for(int g=K; g>=1; --g){ // g: gcd を固定
		ll c = modpow(K/g, N); // g の倍数の個数
		for(int n=2; n*g<=K; ++n) c -= cnt[n*g]; // g*1 以外を除去
		ans += c * g % MOD;
		cnt[g] = c;
	}
	cout<< ans % MOD <<endl;
}

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

int main() {
  string s;
  cin >> s;
  int x_cnt = s.length() - 1;

  string ans = "x";
  rep (i, x_cnt) ans += "x";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
MOD = 10**9+7

n = int(input())
s = input()

if s[0] == "W" or s[-1] == "W":
    print(0)
    exit()

kai = [1 for _ in range(n+1)]
for i in range(1, n+1):
    kai[i] = kai[i-1] * i
    kai[i] %= MOD

def mul(a, b):
    return (a * b) % MOD

a = "L"
l = ["L", "R"]
c = 0

for i in range(1, len(s)):
    if s[i] == s[i-1]:
        c = not c
    a = a + l[c]


ans = 1
num = 0
for i in range(len(s)):
    if a[i] == "L":
        num += 1
    else:
        ans *= num
        ans %= MOD
        num -= 1

if num > 0:
    print(0)
    exit()

ans *= kai[n]
ans %= MOD

print(ans)


Measured memory_bytes: 7528
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <set>
#include <map>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  string N;
  std::cin >> N;
  for(int i=0;i<N.size()-1;i++){
    if(N[i]==N[i+1]){
      std::cout << "Bad" << '\n';
      return 0;
    }
  }
  std::cout << "Good" << '\n';
  return 0;
}


Measured memory_bytes: 888
import heapq


h, w = map(int, input().split())
costs = []
for i in range(10):
    line = list(map(int, input().split()))
    costs.append(line)

mini_cost_to_1_from = [10**4] * 10
mini_cost_to_1_from[1] = 0

for num in range(10):
    if num == 1:
        continue
    seen = [False] * 10
    todo = []
    for to in range(10):
        if num == to:
            continue
        cost = costs[num][to]
        heapq.heappush(todo, [cost, to])

    while todo:
        cost, node = heapq.heappop(todo)
        if node == 1:
            mini_cost_to_1_from[num] = cost
            break

        if seen[node]:
            continue

        seen[node] = cost

        for to in range(10):
            if node == to:
                continue
            if seen[to]:
                continue
            add = costs[node][to]
            heapq.heappush(todo, [cost+add, to])

num_count = [0] * 11
for i in range(h):
    wall = list(map(int, input().split()))
    for num in wall:
        num_count[num] += 1

ans = 0
for num in range(10):
    ans += num_count[num] * mini_cost_to_1_from[num]

print(ans)


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

int numOfLetterInStr(string s1, string s2) {
  int foundNum = 0;
  REP(i, 27) {
    if(s1.find('a' + i) != std::string::npos
      && s2.find('a' + i) != std::string::npos
    ) {
      foundNum++;
    }
  }
  return foundNum;
}

int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  FOR(i, 1, S.length() - 2) {
    int num = numOfLetterInStr(S.substr(0, i), S.substr(i));
    ans = max(ans, num);
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
char a[]={"CODEFESTIVAL2016"},b[20];
int main()
{
	int sum=0;
	for(int i=0;i<16;i++)
	{
		cin>>b[i];
		if(b[i]!=a[i])
			sum++;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int n = Integer.valueOf(arr01[0]);

        long mysum = 0;

        int cnt = 0;

        while (cnt <= n) {

            if (!(cnt % 3 == 0 || cnt % 5 == 0)) {
                mysum += cnt;
            }

            cnt += 1;

        }

        System.out.println(mysum);

    }

}


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


int checkACGT(string S){
	int sz = S.size();
	for(int i=0; i<sz; i++){
		if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i]=='T') continue;
		else return 0;
	}
	return 1;
}

int main() {
	string S;
	cin >> S;
	
	int w = S.size();
	int f=0;
	for(int i=1; i <= S.size(); i++){
		for(int j=0; j < i; j++){
			string sb = S.substr(j, w);
			if(checkACGT(sb)) {f=1; break;}
		}
		if(f) break;
		w--;
	}
	cout << w;
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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; }
const int INF = 1e9;
const ll MOD = 1000000007;

using Graph = vector<vector<int>>;

ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}
ll mul(ll l, ll r) {
    ll ret =1;
    for(int i=0; i<l-r+1; ++i) {
        ret*=i+r;
        ret%=MOD;
    }
    return ret;
}
ll com(ll n, ll k) {
    ll ret1 = mul(n,n-k+1);
    ll ret2 = mul(k,1);
    ll ret3 = modPow(ret2, MOD-2);
    return ret1*ret3%MOD;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n; cin >> n;
    vi A(n);
    map<ll,ll> mp;
    rep(i,n) {
        ll a;
        cin >> a;
        A[i] = a;
        mp[a]++;
    }
    ll all = 0;
    for(auto x:mp) {
        all += x.second*(x.second-1)/2;
    }
    rep(i,n) {
        cout << all-(mp[A[i]]-1) << "\n";
    }
    
}



Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll solve(ll n, vector<ll> a) {

  ll res = 0;
  ll sum = 0;
  ll right = 0;
  for(ll left = 0;left<n; left++) {
    while(right < n && (sum ^ a[right]) == (sum + a[right])) {
      sum += a[right];
      right++;
    }

    if(left == right) {
      res++;
    } else {
      res += (right - left);
    }
    sum -= a[left];
  }

  return res;
}

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(ll i=0;i<n;i++) {
    cin >> a[i];
  }
  cout << solve(n, a);
}

Measured memory_bytes: 6420
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n;
    cin>>n;
    vector<int> a(n),b(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    reverse(all(b));
    bool f=true;
    int st,fn;
    rep(i,n){
        if(a[i]==b[i] && f){
            f=false;
            st=i;
            fn=i;
        }
        else if(a[i]==b[i]){
            fn=i;
        }
        else if(!f){
            break;
        }
    }
    if(f){
        Yes;
        rep(i,n) cout<<b[i]<<" ";
        cout<<endl;
        return 0;
    }

    rep(i,n){
        if(st>fn) break;
        if(a[i]==b[st]) continue;
        if(b[i]==a[st]) continue;
        if(st<=i && i<=fn) continue;
        swap(b[i],b[st]);
        st ++;
    }
    rep(i,n){
        if(a[i]==b[i]){
            No;
            return 0;
        }
    }
    Yes;
    rep(i,n) cout<<b[i]<<" ";
    cout<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 4780
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
    int n;cin>>n;
    vector<pair<pair<string,int>,int>>p;
    rep(i,n){
        string s;
        int t;cin>>s>>t;
        p.emplace_back(make_pair(s,-t),i);
    }
    sort(ALL(p));
    vector<int>v(n);
    rep(i,n){
        v[i] = p[i].second+1;
    }
    rep(i,n)cout<<v[i]<<endl;
}



Measured memory_bytes: 256
combinations :: Int -> [a] -> [[a]]
combinations 0 _      = [[]]
combinations _ []     = []
combinations n (x:xs) = [x:y | y <- combinations (n - 1) xs] ++ combinations n xs

main :: IO ()
main = do
    n <- readLn :: IO Int
    d <- map read . words <$> getLine :: IO [Int]
    let cmb = combinations 2 d
    print . sum $ [a * b | [a,b] <- cmb]


Measured memory_bytes: 1020
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long max = 0L;
        long ans = 0L;
        for (int i = 0; i < n; i++) {
            long a = sc.nextLong();
            if(max < a){
                max = a;
            }else{
                ans += max - a;
            }
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 58268
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
int n, k;

int main(){
	IOS
	int ans=0;
	cin >> n >> k;
	while(n){
		n/=k;
		ans++;
	}
	cout << ans << endl;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

int main()
{
  vector<int> a(5); rep(i, 5) cin >> a[i];

  int min_a = 1<<30, min_i = -1;
  for (int i = 0; i < 5; ++i) {
    if (a[i]%10 != 0 and min_a > a[i]%10) {
      min_a = a[i]%10;
      min_i = i;
    }
  }

  for (int i = 0; i < 5; ++i) {
    if (i == min_i) continue;
    if (a[i] % 10 != 0) {
      a[i] += (10-a[i]%10);
    }
  }

  cout << accumulate(ALL(a), 0) << endl;
}

Measured memory_bytes: 256
N = gets.to_i

hash = Hash.new 0
1.upto(99) do |x|
    r = x**2
    break if r > N
    1.upto(99) do |y|
        r2 = r + y**2 + x*y
        break if r2 > N
        1.upto(99) do |z|
            r3 = r2 + z**2 + x*z + y*z
            if r3 > N
                break
            else
                hash[r3] += 1
            end
        end
    end
end

1.upto(N) do |i|
    puts hash[i]
end

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

void solve () {
    int n;
    cin >> n;
    int mn = 1e9;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (mn > x) {
            ans++;
        }
        mn = min (x, mn);
    }
    cout << ans;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3636
s=input()
S=s.split()
a=0
b=0
c=0
a=int(S[0])+int(S[1])
b=int(S[0])-int(S[1])
c=int(S[0])*int(S[1])
if a>=b and a>=c:
    print(a)
elif b>=a and b>=c:
    print(b)
elif c>=a and c>=b:
    print(c)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>

#define MOD 1000000007
//#define MOD 7

using namespace std;

int main(void){
    // Your code here!
    long long n, max_value = 0, min_value = LLONG_MAX;
    
    cin >> n;
    if(n % 2 == 0)
        cout << n << endl;
    else
        cout << n * 2 << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		String inStr;
		inStr = inp();
		String[] in;
		in = inStr.split(" ");

		int W = Integer.valueOf(in[0]);
		int H = Integer.valueOf(in[1]);
		int x = Integer.valueOf(in[2]);
		int y = Integer.valueOf(in[3]);
		int r = Integer.valueOf(in[4]);

		if (x >= r && y >= r && x + r <= W && y + r <= H)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

	private static String inp() throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		return br.readLine();
	}

}

Measured memory_bytes: 24456
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <cstdio>
using namespace std;

template<typename T> class union_find{
	unordered_map<T,T> parent;
public:
	T root(T a){
		if(parent.find(a)==parent.end())parent[a]=a;
		return parent[a]==a?a:(parent[a]=root(parent[a]));
	}
	int same(T a,T b){return root(a)==root(b);}
	int unite(T a,T b){
		T x=root(a),y=root(b);if(x==y)return 0;
		parent[x]=y;
		return 1;
	}
	int size(){
		unordered_set<T>se;
		for(auto &e:parent)se.insert(root(e.first));
		return se.size();
	}
};

int main(){
	int n,i;
	vector<pair<int,int> >v(6);
	union_find<int>uf;
	unordered_map<int,int>cnt;
	int f=0;
	for(i=0;i<6;i++){
		scanf("%d%d",&v[i].first,&v[i].second);
		if(v[i].first>v[i].second)swap(v[i].first,v[i].second);
		uf.unite(v[i].first,v[i].second);
		cnt[v[i].first]++;
		cnt[v[i].second]++;
	}
	sort(v.begin(),v.end());
	puts(all_of(cnt.begin(),cnt.end(),[](pair<const int,int> &a){return a.second%4==0;}) && uf.size()==1 && v[0]==v[1] && v[2]==v[3] && v[4]==v[5] ? "yes" : "no");
}

Measured memory_bytes: 2692
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define double long double
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

double dx[4] = { 0, 1, 0, -1};
double dy[4] = {-1, 0, 1, 0};
string dir = "DRUL";

int n;
vector<double> x, y;
vector<char> d;

// double xx[4] = {}
// double yy[4] = {INF, 0, INF, 0}

double calc(double m){
    double MAXy = -INF, MAXx = -INF;
    double MINy = INF, MINx = INF;
    rep(i, 0, n){
        int idx = dir.find(d[i]);
        double nx = x[i] + m * dx[idx];
        double ny = y[i] + m * dy[idx];
        chmax(MAXx, nx);
        chmax(MAXy, ny);
        chmin(MINx, nx);
        chmin(MINy, ny);
    }
    return (MAXx - MINx) * (MAXy - MINy);
}

signed main(){
    cin >> n;
    x.resize(n); y.resize(n); d.resize(n);
    rep(i, 0, n){
        cin >> x[i] >> y[i] >> d[i];
        // int idx = dir.find(d[i]);
        // if(idx == 0){

        // }else if(idx == 1){

        // }else if(idx == 2){
            
        // }else{

        // }
    }
    double l = 0, r = 1e9;
    double MIN = INF;
    rep(i, 0, 200){
    // while(fabs(r - l) > 1e-10){
        double m1 = (l * 2 + r) / 3;
        double m2 = (l + r * 2) / 3;
        double t1 = calc(m1);
        double t2 = calc(m2);
        if(t1 < t2) r = m2;
        else l = m1;
        chmin(MIN, t1);
        chmin(MIN, t2);
    }
    printf("%.10Lf\n", MIN);
}

Measured memory_bytes: 3456
// 入力マクロ
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
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)*}
    };
}
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)*}
    };
}
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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

use std::cmp::max;

fn main() {
    input! {
        n: usize, w: usize,
        p: [(usize, usize); n]
    }

    let mut dp = vec![vec![0; w+1]; n+1];

    for i in 1..n+1 {
        for j in 0..w+1 {
            dp[i][j] = if j >= p[i-1].0 {
                max(dp[i-1][j - p[i-1].0] + p[i-1].1, dp[i-1][j])
            } else {
                dp[i-1][j]
            };
        }
    }

    let ans = dp[n][w];
    println!("{}", ans);
}


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

using namespace std;

int solve(int arr[], int n) {
    int res = 0;
    sort (arr, arr+n);
    for (int i = 0; i < n; i++) 
        for (int j = i+1; j < n; j++)
            for (int k = j+1; k < n; k++) 
                if (arr[i] + arr[j] > arr[k] && arr[i] != arr[j] && arr[j] != arr[k])
                    res++;
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    scanf("%d", &n);
    int arr[n];
    for (int i = 0; i < n; i++) 
        scanf("%d", &arr[i]);
    printf("%d\n", solve(arr, n));    
    return 0;
}


Measured memory_bytes: 3860
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> A = new ArrayList<>();
        List<Integer> B = new ArrayList<>();
        List<Integer> C = new ArrayList<>();
        for(int i=0; i<N; i++){
            A.add(scanner.nextInt());
        }
        for(int i=0; i<N; i++){
            B.add(scanner.nextInt());
        }
        for(int i=0; i<N-1; i++){
            C.add(scanner.nextInt());
        }
        
        int score = 0;
        for(int i=0; i<N; i++){
            score += B.get(i);
        }
        for(int i=0; i<N-1; i++){
            if(A.get(i)+1 == A.get(i+1)){
                score += C.get(A.get(i)-1);
            }
        }

        System.out.println(score);

    }
}

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

int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    vector<int> a(n);
    for (int &i: a) scanf("%d", &i);
    vector<int> dp(k+5);
    dp[0] = 1;
    vector<int> temp(k+5);
    vector<int> sm(k+5, 1);
    for (int i=0; i<n; i++) {
        for (int j=0; j<=k; j++) {
            dp[j] = m(sm[j]-(j-a[i]>0?sm[j-a[i]-1]:0));
        }
        sm[0] = dp[0];
        for (int j=1; j<=k; j++) {
            sm[j] = m(sm[j-1]+dp[j]);
        }
    }

    printf("%d\n", dp[k]);
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)
// コンパイル　g++ -std=c++17 a.cpp


int main() {
    ll k, s;
    cin >> k >> s;
    ll x, y, z;
    ll ans = 0;
    rep(i,k+1){
        x = i;
        rep(j,k+1){
            y = j;
            if(x + y <= s && s - x - y <= k){
                ans++;
            }
        }
    }
    cout << ans << endl;

}


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

int main(void) {
	int K; cin >> K;
	string S; cin >> S;

	if (S.size() <= K) {
		cout << S << endl;
	}
	else {
		for (int i = 0; i < K; i++) {
			cout << S[i];
		}
		cout << "..." << endl;
	}

	return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n, ans = 0;
    scanf("%d", &n);
    vector< vector<char> > s(3, vector<char>(n));
    for (int i = 0; i < 3; ++i) scanf("%s", s.at(i).begin());
    for (int i = 0; i < n; ++i) {
        string t = "";
        for (int j = 0; j < 3; ++j) if (t.find(s.at(j).at(i)) == string::npos) t += s.at(j).at(i);
        ans += t.size();
    }
    printf("%d\n", ans - n);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1 << 20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector< pair <int, int> > adj[MAX];

void dijkstra()
{
    priority_queue< pair <int, int> > PQ;
    int color[MAX];
    int d[MAX];
    for (int i = 0; i < n; i++)
    {
        d[i] = INFTY;
        color[i] = WHITE;
    }

    d[0] = 0;
    PQ.push(make_pair(0, 0));
    color[0] = GRAY;

    while (!PQ.empty())
    {
        pair<int, int> f = PQ.top();
        PQ.pop();
        int u = f.second;
        color[u] = BLACK;

        if (d[u] < f.first * (-1))
        {
            continue;
        }

        for (int j = 0; j < adj[u].size(); j++)
        {
            int v = adj[u][j].first;
            if (color[v] == BLACK)
            {
                continue;
            }
            if (d[v] > d[u] + adj[u][j].second)
            {
                d[v] = d[u] + adj[u][j].second;
                PQ.push(make_pair(d[v] * (-1), v));
                color[v] = GRAY;
            }
        }
    }

    for (int i = 0; i < n; i++)
    {
        cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
    }
}

int main()
{
    int k, u, v, c;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            cin >> v >> c;
            adj[u].push_back(make_pair(v, c));
        }
    }
    dijkstra();
    return 0;
}


Measured memory_bytes: 8060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,M,a,b,c,ans=0; cin>>N>>M;
  vector<vector<ll>>Z(N+1,vector<ll>(N+1,1e9)), Q(N+1,vector<ll>(N+1,1e9));
  for(int i=1; i<=M; i++){
    cin>>a>>b>>c;
    Z[a][b]=c;
    Z[b][a]=c;
  }
  for(int i=1; i<=N; i++){Z[i][i]=0;}
  Q=Z;
  for(int k=1; k<=N; k++){
    for(int i=1; i<=N; i++){
      for(int j=1; j<=N; j++){
        Z[i][j]=min(Z[i][j],Z[i][k]+Z[k][j]);
      }
    }
  }
  for(int i=1; i<=N; i++){
    for(int j=1; j<=N; j++){
      if(Z[i][j]!=Q[i][j] && Q[i][j]!=1e9){
        ans++;
//        cout<<"i:"<<i<<" j:"<<j<<" Z:"<<Z[i][j]<<" Q:"<<Q[i][j]<<endl;
      }
    }
  }
  cout<<ans/2<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(min(a,b)>0)
    {
        cout<<"Positive"<<endl;
    }
    else if(min(a,b)<=0&&max(a,b)>=0)
    {
        cout<<"Zero"<<endl;
    }
    else if(max(a,b)<0&&a!=b)
    {
        int ans=abs(max(a,b))-abs(min(a,b));
        if(ans%2==0)
        {
            cout<<"Negative"<<endl;
        }
        else
        {
            cout<<"Positive"<<endl;
        }
    }
    else if(a==b)
    {
        if(a==b)
        {
            cout<<"Zero"<<endl;
        }
        else if(a<0)
        {
            cout<<"Negative"<<endl;
        }
        else
        {
            cout<<"Positive"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import itertools

Q = int(input())
l = [0 for q in range(Q)]
r = [0 for q in range(Q)]
for q in range(Q):
  l[q], r[q] = map(int, input().split(' '))
max_r = max(r)
prime_numbers = [True for n in range(max_r+1)]
similar_numbers = [False for n in range(max_r+1)]
 
prime_numbers[0], prime_numbers[1] = False, False    # 1 is not a prime number
for divisor in range(2, max_r//2 + 1):
  if prime_numbers[divisor]:
    for multipler in range(2, max_r//divisor + 1):
      prime_numbers[divisor * multipler] = False
      
for N in range(1, max_r + 1, 2):
  if prime_numbers[N] and prime_numbers[(N+1)//2]:
    similar_numbers[N] = True
accumulate_sim_nums = list(itertools.accumulate(map(int, similar_numbers)))
    
for q in range(Q):
  print(accumulate_sim_nums[r[q]]-accumulate_sim_nums[l[q]-1])

Measured memory_bytes: 21744
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std ;
int main(){
string s ;
cin >> s ;
int n=0 ;
int l=s.size();
for(int i=0 ; i<l ; i++){
   if(s[i]=='+'){
    n++ ;
   }
   else
     n-- ;

}
cout << n  ;



return 0 ;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    int c = 0;
    while (n != 1) {
      n = even(n) ? n / 2 : n * 3 + 1;
      c++;
    }
    cout << c << endl;
  }
}

Measured memory_bytes: 3012
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a); i > (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod=1000000007;
//ll mod=67280421310721;
//ll mod=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b%2==1)
		{
			res*=a;
			res%=mod;
		}
		a*=a;
		a%=mod;
		b>>=1;
	}
	return res;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		int n,k;
		cin>>n>>k;
		ll ans=0,v;
		int o[k+1];
		FOR(i,1,k+1)
		o[i]=i;
		FOR(i,1,k+1)
		{
			v=k/i;
			for(int j=2*i;j<(k+1);j+=i)
			{
				o[j]-=o[i];
			}
			ans+=(po(v,n)*o[i]);
			ans%=mod;
//			cout<<ans<<' ';
		}
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 4040
def main():
    x,y = map(int,input().split())
    p = list(map(int,input().split()))

    number = sum(p[0:y])
    bigNumber = number

    for i in range(x-y):

        number = number - p[i] + p[i+y]

        if number > bigNumber:
            bigNumber = number

    print((bigNumber + y) / 2)

main()


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

int main() {
#ifdef PAUNSVOKNO
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20);
    ll q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    s = min({ s, h * 2, q * 4 });
    d = min(d, s * 2);
    cout << n / 2 * d + (n % 2) * s << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <string>

using namespace std;

int main()
{
	set<char> s;
	string str;
	cin >> str;
	for (auto val : str)
		s.insert(val);
	(s.size() == 2) ? cout << "Yes" : cout << "No";
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 100000;
int main()
{
  int n,i;
  long long t=0,res=0;
  long long a[N_MAX];
  cin >> n;
  for(i=0;i<n;i++)
    cin >> a[i];
  sort(a,a+n,greater<long long>());
  for(i=1;i<n;i++)
    if(a[i]==a[i-1])
      if(t==0){
        t=a[i];
        i++;
      }else{
        res=a[i]*t;
        break;
      }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1024
'use strict'

const main = (input) => {
    const arr = input.split(' ').map(v => parseInt(v)).sort((a, b) => a - b)
    if(arr[0] + arr[1] === arr[2]){
        console.log('Yes')
    }else{
        console.log('No')
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 21064
x,y=gets.split.map &:to_i
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
puts (a.include?(x) && a.include?(y)) || (b.include?(x) && b.include?(y)) || (c.include?(x) && c.include?(y)) ? 'Yes' : 'No'

Measured memory_bytes: 1788
#include <stdio.h>
main(){int i,n,o,b,p;char s[32];for(scanf("%d ",&n);n--;printf("%d\n", p))for(o=3,b=p=0;o;b&=7){scanf("%s ",s);if(*s=='O')o--;if(s[1]=='O')b=b<<4|8;if(s[1]=='I')b=b<<1|1;for(i=8;i<128;i<<=1)if(b&i)p++;}}

Measured memory_bytes: 0
#include<cstdio>
using namespace std;

const int N=2e5+5;
int a[N],n;
int c[N];
long long ans;

signed main()
{
	scanf("%d",&n);
	for(register int i=1;i<=n;i++)
		scanf("%d",a+i);
	
	for(register int i=1;i<=n;i++)
		ans+=c[a[i]],c[a[i]]++;
	for(register int i=1;i<=n;i++)
	{
		c[a[i]]--;
		ans-=c[a[i]];
		printf("%lld\n",ans);
		ans+=c[a[i]];
		c[a[i]]++;
	}
}

Measured memory_bytes: 3584
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL x = 0; std::cin >> x;
  LL cnt = (x / 11) * 2;

  LL v = (x/11) * 11;
  if (v < x) {
    ++cnt;
    v += 6;
  }
  if (v < x) {
    ++cnt;
    v += 5;
  }
  std::cout << cnt << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int i,j,k,l,n,count;
    while(scanf("%d",&n)!=EOF){
        count=0;
        for(i=0;i<10;i++){
            for(j=0;j<10;j++){
                for(k=0;k<10;k++){
                    for(l=0;l<10;l++){
                        if(i+j+k+l==n){
                            count++;
                            l=9;
                        }
                    }
                }
            }
        }
        printf("%d\n",count);
    }
    
    return 0;
}


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

int main()
{
  int N;
  cin>>N;
  int v[N];
  for(int i=0; i<N; i++) cin>>v[i];
  int mn = 999999999;

  for(int i=-100; i<=100; i++)
  {
    int c = 0;
    for(int j=0; j<N; j++)
     c += ( (v[j] - i) * (v[j] - i) );
    mn = min(mn, c);
  }
  cout<<mn<<endl;/*
  int m = 0;
  for(int i=0; i<N; i++)
  {
    cin>>v[i];
    m += v[i];
  }
  m = ceil((float)m/N);

  int c = 0;
  for(int i=0; i<N; i++)
   c += ( (v[i] - m) * (v[i] - m) );
  cout<<c<<endl;*/
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int N;
long mod=1e9+7,ans=1;
int cnt[3];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)
	{
		int A;cin>>A;
		int id=-1,L=0;
		for(int j=0;j<3;j++)
		{
			if(cnt[j]==A)
			{
				if(id<0)id=j;
				L++;
			}
		}
		if(L==0)
		{
			cout<<0<<endl;
			return 0;
		}
		ans=ans*L%mod;
		cnt[id]++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
#include<iomanip>
using std::setprecision;
int main(){
  int n,m,p;
  int k;
  double d = 0;
  vector<int> v;
  int sum,ans;
  while(cin >> n >> m >> p){
    if(n == 0 && m == 0&& p == 0){
      break;
    }
    sum = 0;
    v.clear();
    for(int i = 0;i < n;i++){
      cin >> k;
      v.push_back(k);
      sum += k*100;
    }
    d = double(p)/100;
    sum = int(sum - sum*d);
    if(v[m-1] == 0){
      ans = 0;
    }else{

      ans = int(sum/v[m-1]);
    }

    cout << ans << endl;

  }
}

Measured memory_bytes: 3048
/* 
/*-----------------------------------------------*/
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long int ll;
typedef vector<ll> vll;
/*-----------------------------------------------*/
// #define DBGMODE
#ifdef DBGMODE
	#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
	#define debug(...)
#endif
/*-----------------------------------------------*/
bool is_part (char c) {
	if (c == 'A' || c == 'G' || c == 'T' || c == 'C') return true;
	return false;
}
/*-----------------------------------------------*/
int main() {
	#ifdef DBGMODE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	char str[100];
	scanf("%s", str);
	int cnt = 0, mx = 0, n = strlen(str);
	for (int i = 0; i < n; i++) {
		if (is_part(str[i])) cnt++;
		else cnt = 0;
		mx = max(cnt, mx);
	}
	printf("%d\n", mx);
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	map<ll, int> cnt;
	for(int i=0; i<n; i++){
		ll a;
		cin >> a;
		cnt[a]++;
		if(cnt[a]>1){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 12800
from fractions import Fraction


def main():

    N = int(input())
    a = list(map(int,input().split()))
    aList = []
    
    for i in a:
        tmp = Fraction(1,i)
        aList.append(tmp)

    pre = sum(aList)
    print(pre.denominator/pre.numerator)



if __name__== "__main__":
    main() 











Measured memory_bytes: 5304
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

typedef pair<int, int> pii;
const int N = 1 << 18 | 1;
const int inf = int(1e9);

pii f[N];
int n, k, a[N], g[N];

void maximize(pii& x, pii y) {
    vector<pii> v = {mp(a[x.fi], x.fi), mp(a[x.se], x.se), mp(a[y.fi], y.fi), mp(a[y.se], y.se)};
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    x.fi = v.back().se, x.se = v[v.size() - 2].se;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> k; n = 1 << k;
    for(int i = 0; i < n; ++i) {
        cin >> a[i]; f[i].fi = i;
    }
    for(int i = 0; i < k; ++i) {
        for(int j = 1; j < n; ++j)
            if(j >> i & 1) maximize(f[j], f[j ^ (1 << i)]);
    }
    for(int i = 1; i < n; ++i) {
        g[i] = max(g[i - 1], a[f[i].fi] + a[f[i].se]);
        cout << g[i] << '\n';
    }
}


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

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

 int wa = a +  b;
 int hiku = a- b;
 int seki = a*b;

 int max1 = max(wa,hiku);
  int max2 = max(max1, seki);



  cout << max2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define INF 0x7fffffff
#define LL_INF 0x7fffffffffffffff
#define MOD 1000000007
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
vector<vector<int>> v(200005);
bool visit[200005];
int d[200005];
int parent[200005];
int child_num[200005];
ll f[200005];
ll ans = 1;
int n;
ll ans_[200005];

void dfs(int start, int depth)
{
	visit[start] = true;
	d[start] = depth;
	for(int i : v[start]){
		if(!visit[i]) {
			dfs(i, depth+1);
			parent[i] = start;
		}
	}
}

int p(int start)
{
	int ret = 0;
	for(int i : v[start]){
		if(i != parent[start]){
			ret += p(i);
		}
	}
	return child_num[start] = ret + 1;
}

ll power(ll a, ll n) {
	ll res = 1;
	while(n > 0) {
		if(n & 1) {
			res *= a;
			res %= MOD;
		}
		a *= a;
		a %= MOD;
		n >>= 1;
	}
	return res;
}

void get_ans(int start)
{
	if(child_num[start]==1) return;
	ans = (ans * (f[child_num[start] -1])) % MOD;
	for(int i : v[start]) {
		if(d[i] < d[start]) continue;
		ans *= power(f[child_num[i]], MOD - 2);
		ans %= MOD;
		get_ans(i);
	}
}

void dfs2(int start)
{
	visit[start] = true;
	for(int i : v[start]){
		if(!visit[i]) {
			ans_[i] = (ans_[start] * f[child_num[i]] ) % MOD;
			ans_[i] = (ans_[i] * power(f[n - child_num[i]], MOD - 2))  % MOD;
			ans_[i] = (ans_[i] * f[n - child_num[i]-1])  % MOD;
			ans_[i] = (ans_[i] * power(f[child_num[i] -1], MOD - 2)) % MOD;
			dfs2(i);
		}
	}
}

int main(void)
{
	 cin >> n;
	int from, to;
	for(int i=1;i<n;i++){
		scanf("%d %d", &from, &to);
		v[from].pb(to);
		v[to].pb(from);
	}
	dfs(1, 0);
	p(1);
	f[0] = 1;
	for(int i=1;i<=n;i++) {
		f[i] = (f[i-1] * i) % MOD;
	}
	get_ans(1);
	ans_[1] = ans;
	for(int i=1;i<=n;i++) visit[i] = false;
	dfs2(1);
	for(int i=1;i<=n;i++) cout << ans_[i] << endl;
	return 0;
}


Measured memory_bytes: 19572
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    if(a<b)cout<<"a < b"<<endl;
    if(a>b)cout<<"a > b"<<endl;
    if(a==b)cout<<"a == b"<<endl;
}


Measured memory_bytes: 3080