akhauriyash/Code-Regression huggingface dataset:
n=int(input())
p = list(input().split())
q = list(input().split())

#combinations、組み合わせ、順列
from itertools import permutations, combinations,combinations_with_replacement,product
a=list(map(str,(range(1,n+1))))
t = sorted([''.join(i) for i in permutations(a)])
print(abs(t.index(''.join(p)) - t.index(''.join(q))))

Measured memory_bytes: 6296
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static String input;
	public static void main(String[] args) {
		while(read()){
			solve();
		}
	}
	
	static boolean read(){
		if(!sc.hasNext())return false;
		input = sc.next();
		return true;
	}
	
	static void solve(){
		int joi = 0, ioi = 0;
		for(int i = 0; i < input.length()-2; i++){
			StringBuffer sb = new StringBuffer(input.substring(i, i+3));
			if( sb.toString().equals("JOI") )joi++;
			if( sb.toString().equals("IOI") )ioi++;
		}
		System.out.println(joi);
		System.out.println(ioi);
	}

}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main() {
  int n ; 
  cin >> n ;
  vector<ll>vec(n);
  rep(i,n){
    cin>>vec[i];
  }
  sort(vec.begin(),vec.end());
  int sum=1;
  int ans=0;
  if(n==1) cout<<1<<endl;
  else{
    rep(i,n-1){
      if(vec[i]==vec[i+1])sum++;
      else{
        if(sum%2==1) ans++;
        sum=1;
      }
      if(i==n-2){
        if(sum%2==1) ans++;
      }
    }
    cout<<ans<<endl;
  }
 
  
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    string res = "";
  	rep(i,3){
      	string in;
      	cin >> in;
      	res += in[0]-32;
    }
  	cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#coding: utf-8
N, K = (int(n) for n in input().split())
A = [int(n) for n in input().split()]

def is_ok(X):
    ret = 0
    for log in A:
        ret += -(-log//X) - 1
    return ret <= K

def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

print(meguru_bisect(0, max(A)+1))


Measured memory_bytes: 30516
n = int(input())
count1 = 0

for i in range(1, n + 1, 2):
    count2 = 0

    for j in range(1, i + 1):
        if i % j == 0:
            count2 += 1

    if count2 == 8:
        count1 += 1

print(count1)

Measured memory_bytes: 2940
N = int(input())
S = input()
mod = 7 + 10 ** 9

word = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m"\
    ,"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y","z"]
count = [1] * 26
for i in range(N):
    count[word.index(S[i])] += 1
Total = 1
for c in count:
    Total *= c
    Total %= mod
print(Total - 1)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  vector<int> v(3);
  rep (i, 3) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  int ans = 0;
  ans += abs(v[1] - v[0]);
  ans += abs(v[2] - v[1]);
  P(ans);
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	vector<int> a(3);
	int k;
	cin >> a[0] >> a[1] >> a[2] >> k;
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < k; i++) a[0] *= 2;
	cout << a[0] + a[1] + a[2] << endl;
}

Measured memory_bytes: 256
class Node:
    def __init__(self,num,leftchild,rightchild):
        self.id = num
        self.parent = -1
        self.sibling = -1
        self.degree = 0
        self.depth = 0
        self.height = 0
        self.type = 'leaf'
        self.leftchild = leftchild
        self.rightchild = rightchild
    
    def get_infomation(self):
        print('node {0}: parent = {1}, sibling = {2}, degree = {3}, depth = {4}, height = {5}, {6}'.format(self.id,self.parent,self.sibling,self.degree, self.depth,self.height,self.type))
 
def set_propaties(num,parent,sibling,depth):
    if num == -1:     
        return -1
    node = tree[num]
    lc = node.leftchild
    rc = node.rightchild
    node.parent = parent
    node.sibling = sibling
    node.depth = depth
    node.degree = (node.leftchild != -1) + (node.rightchild != -1)
    if lc != -1 or rc != -1:
        node.type = 'internal node'
    node.height = max(set_propaties(lc, num, rc, depth + 1),set_propaties(rc, num, lc, depth + 1)) + 1
    return node.height

n = int(input())
tree = [None]*n

root_num = int(n*(n-1)/2)

for x in range(n):
    num, leftchild, rightchild = list(map(int,input().split()))
    node = Node(num, leftchild, rightchild)
    tree[num] = node
    root_num -= (max(0, leftchild) + max(0, rightchild))

set_propaties(root_num, -1, -1, 0)
tree[root_num].type = 'root'

for n in tree:
    n.get_infomation()
    


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

#define MAX 100010
#define NIL -1

struct Node{
    int parent;
    int left;
    int right;
};

Node T[MAX];

void Preoader(int u)
{
    if( u==NIL )
        return;
    cout << ' ' << u;
    Preoader(T[u].left);
    Preoader(T[u].right);
}

void Inorder(int u){
    if( u==NIL )
        return;
    Inorder(T[u].left);
    cout << ' ' << u;
    Inorder(T[u].right);
}

void Postorder(int u){
    if( u==NIL )
        return;
    Postorder(T[u].left);
    Postorder(T[u].right);
    cout << ' ' << u;

}


int main()
{
    int n;
    cin >> n;
    for(int i=0; i<n ; ++i){
        T[i].parent = NIL;
        T[i].left = NIL;
        T[i].right = NIL;
    }

    for(int i=0; i<n; ++i){
        int v, l, r;
        cin >> v >> l >> r;
        T[v].left = l;
        T[v].right = r;
        if( l != NIL )
            T[l].parent = v;
        if( r != NIL )
            T[r].parent = v;
    }

    int root;
    for(int i=0; i<n; i++){
        if( T[i].parent == NIL)
            root=i;
    }

    cout << "Preorder" << endl;
    Preoader(root);
    cout << endl;
    cout << "Inorder" << endl;
    Inorder(root);
    cout << endl;
    cout << "Postorder" << endl;
    Postorder(root);
    cout << endl;

    return 0;
}



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

int gcd(int a, int b) {
    int n = (a < b) ? a : b;
    
    if(a % n == 0 && b % n == 0) {
        return n;
    }
    for(int i = n / 2 ; i > 0; --i) {
        if(a % i == 0 && b % i == 0) {
            return i;
        }
    }
}
int main(void) {
    int a, b;
    
    cin >> a >> b;
    
    cout << gcd(a, b) << endl;
    
    return 0;
    
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;



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

    int T;
    cin >> T;
    rep(t, T) {
        int N, D;
        cin >> N >> D;
        cout << 127 * (N - 1) + (N % 2 ? D : D ^ 127) << endl;
    }

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

constexpr int N = 100001;
int pss[N], pst[N];

int main()
{
    string s, t;
    int q, a, b, c, d;
    cin >> s >> t >> q;
    for (int i = 0; i < s.size(); ++i)
        pss[i + 1] = pss[i] + 1 - 2 * (s[i] == 'A');
    for (int i = 0; i < t.size(); ++i)
        pst[i + 1] = pst[i] + 1 - 2 * (t[i] == 'A');
    while (q--)
    {
        cin >> a >> b >> c >> d;
        if ((pss[b] - pss[a - 1] - pst[d] + pst[c - 1]) % 3)
            cout << "NO\n";
        else
            cout << "YES\n";
    }
    return 0;
}


Measured memory_bytes: 1664
N=int(input())
X=list(map(int,input().split())) 

start=min(X)
end=max(X)
ans=10**10
for p in range(start,end+1):
    point=0
    for x in X:
        point=point+(p-x)**2
    ans=min(ans,point)

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <functional>
#include <utility>
#define INF 9999999
using namespace std;
typedef long long int ll;

int main() {
	string l;
	cin >> l;

	int l_ = stoi(l);
	int s = 0;
	for (int i = 0; i < l.size(); i++) {
		s += l[i] - '0';
	}

	if (l_ % s == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int kame, turu;
	int sumAsi;
	int sumHiki;

	cin >> sumHiki >> sumAsi;

	for (kame = 0; kame <= sumHiki; kame++) {
		if (kame * 4 + (sumHiki - kame) * 2 == sumAsi)
			break;
	}
	if (kame <= sumHiki)
		cout << "Yes";
	else
		cout << "No";

	return 0;

}

Measured memory_bytes: 3604
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;


public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			Long[] an = new Long[3*n];
			for (int i = 0; i < 3*n; i++) {
				an[i] = in.nextLong();
			}

			long ans = Long.MIN_VALUE;
			Queue<Long> q1 = new PriorityQueue<>((a, b) -> (int)(a-b));
			Queue<Long> q2 = new PriorityQueue<>((a, b) -> (int)-(a-b));

			long[] sum1 = new long[n+1];
			long[] sum2 = new long[n+1];

			for (int i = 0; i < n; i++) {
				q1.add(an[i]);
				sum1[0] += an[i];
			}

			for (int k = n; k < 2*n; k++) {
				q1.add(an[k]);
				sum1[k-n+1] += sum1[k-n]+an[k];
				sum1[k-n+1] -= q1.remove();
			}


			for (int i = 3*n-1; i >= 2*n; i--) {
				q2.add(an[i]);
				sum2[0] += an[i];
			}

			for (int k = 2*n-1; k >= n; k--) {
				q2.add(an[k]);
				sum2[2*n-k] += sum2[2*n-k-1]+an[k];
				sum2[2*n-k] -= q2.remove();
			}

			for (int i = 0; i <= n; i++) {
				ans = Math.max(ans, sum1[i]-sum2[n-i]);
			}

			out.println(ans);

		}
	}

	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 int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

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

	}

}


Measured memory_bytes: 65796
import sys
sys.setrecursionlimit(10 ** 9)

def rec(n):
  if dp[n] != -1:
    return dp[n]
  else:
    max_n = 0
    for i in graph[n]:
      max_n = max(max_n, rec(i)+1)
    dp[n] = max_n
    return dp[n]
  
N, M = list(map(int, input().split()))

dp = [-1]*N # nを始点としたときの最大値

graph = [[] for _ in range(N)]
for _ in range(M):
  xi, yi = list(map(int, input().split()))
  graph[xi-1].append(yi-1)

ans = 0
for n in range(N):
  ans = max(rec(n), ans)
print(ans)

Measured memory_bytes: 65200
/*input
5 4 2
2 1 1
3 3 4
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	int n,m,q;
	cin>>n>>m>>q;
	int l=0,r=n,d=0,u=m;
	while(q--){
		int type,x,y;
		cin>>x>>y>>type;
		if(type==1) l=max(l,x);
		else if(type==2) r=min(r,x);
		else if(type==3) d=max(d,y);
		else u=min(u,y);
	}
	if(u<d) u=d;
	if(r<l) r=l;
	cout<<(u-d)*(r-l)<<'\n';
	return 0;
}


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

int main(){
    std::string s; std::cin >> s;
    int A = s[0] - '0';
    int B = s[1] - '0';
    int C = s[2] - '0';
    int D = s[3] - '0';
    if (A + B + C + D == 7)
        std::cout << A << "+" << B << "+" << C << "+" << D << "=7" << std::endl;
    else if(A + B + C - D == 7)
        std::cout << A << "+" << B << "+" << C << "-" << D << "=7" << std::endl;
    else if (A + B - C + D == 7)
        std::cout << A << "+" << B << "-" << C << "+" << D << "=7" << std::endl;
    else if (A - B + C + D == 7)
        std::cout << A << "-" << B << "+" << C << "+" << D << "=7" << std::endl;
    else if (A - B + C - D == 7)
        std::cout << A << "-" << B << "+" << C << "-" << D << "=7" << std::endl;
    else if (A - B - C + D == 7)
        std::cout << A << "-" << B << "-" << C << "+" << D << "=7" << std::endl;
    else if (A + B - C - D == 7)
        std::cout << A << "+" << B << "-" << C << "-" << D << "=7" << std::endl;
    else if (A - B - C - D == 7)
        std::cout << A << "-" << B << "-" << C << "-" << D << "=7" << std::endl;

    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    int long long a , b ;
    cin >> a >> b ;
    int ans = 1 ;
    for(long long i = 2 ; i * i <= a ; i++ ){
        if( a % i != 0 ) continue ;
        while(a % i == 0){
            a /= i ;
        }
        if (b % i != 0) continue;
		ans++;
    }
    if (a != 1 && b % a == 0) ans++;
	cout << ans << endl;

    return 0 ;
}

 


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int solve(int n, int k[]) {
    int has_two = false;
    int count = 0;
    for (int i = 0; i< n; ++i) {
        if (k[i] >= 2) {
            has_two = true;
        }
        if (k[i] > 0) {
            ++count;
        }
    }
    if (has_two) {
        return count + 1;
    }
    return -1;
}

int main() {
    int n, answer;
    int k[10000];
    while (true) {
        cin >> n;
        if (n == 0) {
            return 0;
        }
        for (int i = 0; i < n; ++i) {
            cin >> k[i];
        }
        answer = solve(n, k);
        if (answer < 0) {
            cout << "NA" << endl;
        } else {
            cout << answer << endl;
        }
    }
}

Measured memory_bytes: 1200
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define FLOAT setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
#define INSIDE(i,j,H,W) ((i) >= 0 && (i) < (H) && (j) >= 0 && (j) < (W))
#define YesNo(b) (b ? "Yes" : "No")
#define YESNO(b) (b ? "YES" : "NO")
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const double EPS = 1.0e-9;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }

// all_of
// partial_sum, adjacent_difference

#if _DEBUG
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#endif

#if 1234567891
#include <array>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N;
int T[102], V[102];
int L[102], R[102];
double A[40001];
int main() {
	int tsum = 0;
	cin >> N;
	T[0] = 0; V[0] = 0;
	T[N + 1] = 0; V[N + 1] = 0;
	REP(i, 1, N + 1) {
		cin >> T[i];
		L[i] = tsum;
		tsum += T[i];
		R[i] = tsum;
	}
	REP(i, 1, N + 1) {
		cin >> V[i];
	}
	L[N + 1] = R[N + 1] = tsum;

	REP(j, 0, tsum * 2) {
		double k = j / 2.0;
		double mn = INF;
		REP(i, 0, N + 2) {
			double lim;
			if (k < L[i]) {
				lim = V[i] + L[i] - k;
			} else if(k > R[i]) {
				lim = V[i] + k - R[i];
			} else {
				lim = V[i];
			}
			if (mn > lim) {
				mn = lim;
			}
		}
		A[j] = mn;
	}

	double sum = 0;
	REP(j, 0, tsum * 2) {
		sum += A[j] * 0.5 + ((A[j + 1] > A[j]) - (A[j + 1] < A[j])) * 0.125;
	}
	cout << FLOAT <<  sum << endl;
	return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
"""
Created on Tue Mar  5 20:10:22 2019

@author: yuta
"""

A,B,C = list(map(int,input().split()))

def same(a,b,c):
    x = [a,b,c]
    x_sort = sorted(x)
    dif = x_sort[1] - x_sort[0]
    if dif % 2 == 0:
        count = dif/2 + x_sort[2] - x_sort[1]
    else:
        x_sort[0] += 1
        x_sort[2] += 1
        dif2 = x_sort[1] - x_sort[0]
        count = 1 + dif2/2 + x_sort[2] - x_sort[1]
    print(int(count))
same(A,B,C)

Measured memory_bytes: 3064
local a = io.read("*n")
local b = io.read("*n")
local c = io.read("*n")

local d = math.max(a, b)
local e = 0
local f = 0
if d == a then
    e = math.max(b, c)
    f = math.min(b, c)
else
     e = math.max(a, c)
    f = math.min(a, c)
end
local aa = math.max(d, e)
local bb = math.min(d, e)
local sum = aa*10 + bb + f
print(sum)



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

int main() {
  int n;
  cin >> n;
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  int ans = 1e9;
  for (int i = 1; i < n; i++) {
    int l = 0, r = 0;
    for (int j = 0; j < i; j++) l += w[j];
    for (int j = i; j < n; j++) r += w[j];
    ans = min(ans, abs(l-r));
  }
  cout << ans << endl;
  return 0;  
}    


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

#define FOR(i, j, n) for (int i(j); i < n; ++i)
#define FORR(v, c) for (auto &v : c)
#define F first
#define S second
#define SQ(x) (x)*(x)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define dbg(x) cerr<<#x<<" = " << (x) << endl
#define pnl(x) cout << x << '\n'
#define pns(x) cout << x << ' '
#define read(x) cin >> x
#define read2(x,y) cin >> x >> y
#define read3(x, y, z) cin >> x >> y >> z
#define read4(a, b, c, d) cin >> a >> b >> c >> d
#define readv(v) FORR(c,v) read(c)

struct Arrete { int v, c;};
struct Point {int x, y; double distance(Point other) const {return sqrt(SQ(x-other.x)+SQ(y-other.y));}};

typedef	vector<int>	vi;
typedef pair<int,int>	ii;
typedef vector<string>	vs;
typedef vector<ii>	vii;
typedef vector<Arrete>	vg;
typedef vector<long long>	vl;
typedef	long long ll;

const int	NB_D = 4;
const int	DY[] = {-1, 1, 0, 0};
const int	DX[] = {0, 0, -1, 1};

int		main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int n;
	read(n);
	FOR(i,1,10) FOR(j,1,10)
	{
		if (i*j==n)
		{
			pnl("Yes");
			return 0;
		}
	}
	pnl("No");
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void) {

	char s;

	scanf("%c",&s);

	if(s=='S'){
		printf("Cloudy");
	}else if(s=='C'){
		printf("Rainy");
	}else{
		printf("Sunny");
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 128
#include <stdio.h>
int main()
{
    int a[25][25];
    int i,j,H,W,h,w,count=0;
    scanf("%d%d",&H,&W);
    scanf("%d%d",&h,&w);
    for(i=1;i<=H;i++)
    {
        for(j=1;j<=W;j++)
        {
            a[i][j]=0;
        }
    }
    for(i=1;i<=h;i++)
    {
        for(j=1;j<=W;j++)
        {
            a[i][j]=1;
        }
    }
    for(i=h+1;i<=H;i++)
    {
        for(j=1;j<=w;j++)
        {
            a[i][j]=1;
        }
    }
    for(i=1;i<=H;i++)
    {
        for(j=1;j<=W;j++)
        {
            if(a[i][j]==0)
                count++;
        }
    }
    printf("%d\n",count);
    return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p[i];

    double ans = -1;
    double s = 0;
    queue<int> q;
    rep(i,n) {
        p[i]++;
        s += p[i];
        q.push(p[i]);
        if (q.size() > k) {
            s -= q.front();
            q.pop();
        }
        if (q.size() == k) ans = max(ans, s);
    }

    printf("%.10f\n", ans/2);
    return 0;
}

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

int main() {
  ll n, r;
  cin >> n >> r;
  if (n >= 10) {
    cout << r << endl;
  } else {
    cout << r + 100*(10-n) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. NOMURA-A.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP        PIC X(100).
01 H1         PIC 9(02).
01 M1         PIC 9(02).
01 H2         PIC 9(02).
01 M2         PIC 9(02).
01 K          PIC 9(04).
01 W          PIC 9(04).
01 OUT        PIC ZZZ9.
*>
PROCEDURE DIVISION.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ' '
      INTO H1 M1 H2 M2 K.
*>
  COMPUTE W = H2 * 60 + M2 - (H1 * 60 + M1).
  COMPUTE OUT = W - K.
*>
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.


Measured memory_bytes: 3940
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

int H,W;
vector<string> S;

int dp[101][101][7][7][7];//dw,fr,ri
struct State{
    int dw,fr,ri;
    State(int dw,int fr,int ri):dw(dw),fr(fr),ri(ri){}
    State(){}
};

State toR(State now){
    State nex=now;
    nex.ri=7-now.dw;
    nex.fr=now.fr;
    nex.dw=now.ri;
    return nex;
}
State toL(State now){
    State nex=now;
    nex.ri=now.dw;
    nex.fr=now.fr;
    nex.dw=7-now.ri;
    return nex;
}
State toD(State now){
    State nex=now;
    nex.ri=now.ri;
    nex.fr=7-now.dw;
    nex.dw=now.fr;
    return nex;
}
State toU(State now){
    State nex=now;
    nex.ri=now.ri;
    nex.fr=now.dw;
    nex.dw=7-now.fr;
    return nex;
}

const int INF=1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

bool bfs(){
    rep(i,H) rep(j,W) rep(k,7) rep(l,7) rep(m,7) dp[i][j][k][l][m]=INF;
    queue<pair<pair<int,int>,State>> Q;
    Q.push(mkp(mkp(0,0),State{6,2,3}));
    dp[0][0][6][2][3]=0;

    while(!Q.empty()){
        auto f=Q.front();
        Q.pop();
        int x=f.first.first;
        int y=f.first.second;
        State now=f.second;

        rep(k,4){
            int nx=x+dx[k];
            int ny=y+dy[k];
            if(nx<0||ny<0||nx>=H||ny>=W) continue;
            State nex;
            if(k==0) nex=toR(now);
            else if(k==1) nex=toD(now);
            else if(k==2) nex=toL(now);
            else nex=toU(now);

            if(S[nx][ny]=='#') continue;
            if(S[nx][ny]-'0'!=nex.dw) continue;
            
            if(dp[nx][ny][nex.dw][nex.fr][nex.ri]==INF){
                dp[nx][ny][nex.dw][nex.fr][nex.ri]=0;
                Q.push(mkp(mkp(nx,ny),nex));
            }
        }
    }

    rep(k,7) rep(l,7) rep(m,7) if(dp[H-1][W-1][k][l][m]!=INF) return true;
    return false;
}

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

  cin>>H>>W;
  S.resize(H);
  rep(i,H) cin>>S[i];

  if(bfs()) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}



Measured memory_bytes: 16656
N, M = map(int, input().split())
H = list(map(int, input().split()))

A_B = [[] for _ in range(N)]
A_B.insert(0, 0)
H.insert(0, 0)

for c in range(M):
    A, B = map(int, input().split())
    A_B[A].append(B)
    A_B[B].append(A)

ans = 0

for c in range(1, N + 1):
    for co in range(len(A_B[c])):
        if H[c] <= H[A_B[c][co]]:
            break
    else:
        ans += 1

print(ans)

Measured memory_bytes: 29500
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 10005;
const int mod = 1000000007;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int x;
  cin>>x;
  cout<<(x+1)/2<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;

int main() {
    string str;
    cin >> str;
    int ans = 0;
    int cnt = 0;
    for (int i = 0; i < str.size(); i++) {
        if(str.at(i) == 'R') {
            cnt++;
        }else{
            ans = max(cnt,ans);
            cnt = 0;
        }
    }
    if (ans != 0) {
        cout << ans << endl;
    }else{
        cout << cnt << endl;
    }
}

Measured memory_bytes: 3620
while True:
  lst = list(map(int, input().split()))
  if not lst[0]:
    break
  lst.sort()
  rad = (lst[0] ** 2 + lst[1] ** 2 ) ** (1 / 2) / 2  
  n = int(input())
  for _ in range(n):
    print("OK" if int(input()) > rad else "NA")
  


Measured memory_bytes: 5616
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;
int n, k;
llong T[MAX];

int check(llong p){
  int i = 0;
  for(int j = 0 ; j < k ; j++){
    llong s = 0;
    while(s + T[i] <= p){
      s += T[i];
      i++;
      if(i == n) return n;
    }
  }
  return i;
}

int solve(){
  llong left = 0;
  llong right = 100000 * 10000;
  llong mid;
  while(right - left > 1){
    mid = (left + right) / 2;
    int v = check(mid);
    if(v >= n) right = mid;
    else left = mid;
  }

  return right;
}

main(){
  cin >> n >> k;
  for(int i = 0 ; i < n ; i++){
    cin >> T[i];
  }
  llong ans = solve();
  cout << ans << endl;
}

Measured memory_bytes: 3880
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int ans=0;
int n,m;
int g[101][101];

void bfs(int x,vector<int>s){
	if(x==n){
		if(s.size()==0||s.size()==1)return;
		int tmp =0;
		for(int i=0;i<s.size();i++){
			int mi = inf;
			for(int j=0;j<s.size();j++){
				if(i==j)continue;
				mi = min(mi,g[s[i]][s[j]]);
			}
			tmp += mi;
		}
		ans = max(ans,tmp);
		return;
	}
	bfs(x+1,s);
	bool flag = 1;
	for(int i=0;i<s.size();i++){
		if(g[x][s[i]]==0)flag = 0;
	}
	if(flag){
		s.PB(x);
		bfs(x+1,s);
	}
	return;
}



int main(){
	cin >> n >> m;
	int u,v,f;
	for(int i=0;i<m;i++){
		cin >> u >> v >> f;
		u--;
		v--;
		g[u][v] = f;
		g[v][u] = f;
	}
	vector<int> s;
	bfs(0,s);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3224
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut v: Vec<isize> = (0..n).map(|_| read()).collect();

    v.sort();
    let mut ans: f64 = v[0] as f64;
    for i in 1..n {
        ans = (ans + v[i] as f64) / 2.0;
    }

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <cstdio>
#include <algorithm>
const long long MOD = 1000000007;
int a[100], N;
long long f[51][100][100], O;
inline void add(long long &x, long long y)
{
	x = x + y < MOD ? x + y : x + y - MOD;
}
int main()
{
	scanf("%d", &N);
	for (int i = 1; i < N + N; i++)
		scanf("%d", a + i);
	std::sort(a + 1, a + N + N);
	f[1][0][0] = 1;
	for (int i = 2; i <= N; i++)
	{
		int last = a[N + i - 2] - a[N - i + 2];
		for (int j = 0; j <= last; j++)
			for (int k = 0; j + k <= last; k++)
			{
				int L = j + (a[N + i - 1] != a[N + i - 2]), R = k + (a[N - i + 1] != a[N - i + 2]);
				for (int u = 1; u <= L; u++)
					add(f[i][L - u][R + 1], f[i - 1][j][k]);
				for (int u = 1; u <= R; u++)
					add(f[i][L + 1][R - u], f[i - 1][j][k]);
				add(f[i][L][R], f[i - 1][j][k]);
			}
	}
	for (int i = 0; i <= N + N - 2; i++)
		for (int j = 0; i + j <= N + N - 2; j++)
			add(O, f[N][i][j]);
	printf("%lld\n", O);
	return 0;
}


Measured memory_bytes: 2432
#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()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    int n;
    ll k;
    cin>>n>>k;

    ll sum=0;
    vector<pair<ll,ll>> v;
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        v.push_back({a,b});
    }
    sort(all(v));
    rep(i,n){
        sum+=v[i].second;
        if(sum>=k){
            cout<<v[i].first<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 5372
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
int main(){
    vector<int> v(3001),w(3001);int i = 0;
    for(;;){
        int a, b;
        cin >> a >> b;
        if(a == 0 && b == 0){
            break;
        }
        if(a > b){
            swap(a,b);
        }
        v[i] = a; w[i] = b;
        i++;
    }
    rep(j,i){
        cout << v[j] << " " << w[j] << endl;
    }
}


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

int main() {
    int a, b, c;
    int count = 0;
    cin >> a >> b >> c;
    for (int i=a; i < b+1; i ++) {
        if(c%i==0) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3112
#include<cstdio>
#include<iostream>
 
using namespace std;
 
int main(void){
 
    long double x1,y1,x2,y2,x3,y3,x4,y4;
    int n;
 
    cin>>n;
 
    for(int i=0;i<n;i++){
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(y2-y1==0){
            if(y4-y3==0) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        else if((x2-x1)/(y2-y1)==(x4-x3)/(y4-y3)) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
 
    return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  int k, s;
  cin >> k >> s;
  
  int ans = 0;
  for(int x = 0; x <= k; ++x) {
    for(int y = 0; y <= k; ++y) {
      int z = s - x - y;
      if(0 <= z && z <= k) {
        ++ans;
      }
    }
  }
  
  cout << ans << endl;
  return 0;
}       

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long sum = 1;
    long max = 1000000000000000000L;
    boolean isMax = false;

    for (int i = 0; i < n; i++) {
      long a = sc.nextLong();
      if (a== 0) {
        sum = 0;
        break;
      }
      if (!isMax) {
        sum *= a;
      }
      if (sum > max || sum == 0) {
        sum = -1;
        isMax = true;
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 48348
# -*- coding: utf-8 -*-
"""
Bitset II - Enumeration of Subsets I
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_11_A&lang=jp

"""
n = int(input())
print('0:')
for x in range(1, 2**n):
    bits = [i for i, b in enumerate(f'{x:b}'[::-1]) if b == '1']
    print(f'{x}: {" ".join(map(str, bits))}')



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

int main()
{
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for (int i = 0; i < M; ++i) {
    cin >> B[i];
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    int sum = C;
    int aj;
    for (int j = 0; j < M; ++j) {
      cin >> aj;
      sum += (B[j] * aj);
    }
    
    if (sum > 0) {
      ans++;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define M 999999
int T[M];
main(i,j,r){
	for(T[0]=T[1]=1,i=2;i<M;i++)
		if(!T[i])
			for(j=2*i;j<M;j+=i)T[j]=1;
	for(;scanf("%d",&i),i;printf("%d\n",r))
		for(r=0,j=i+1;j<=2*i;j++)
			if(!T[j])r++;
exit(0);}

Measured memory_bytes: 0
in_str = input()
length_str = len(in_str)
inner_count = 0
inner_length = 0
for i in range(len(in_str)):
    if (in_str[i] == "A") or (in_str[i] == "C") or (in_str[i] == "G") or (in_str[i] == "T"):
        inner_count +=1

    else :
        if inner_length <= inner_count:
            inner_length = inner_count
        inner_count = 0

if inner_length <= inner_count:
            inner_length = inner_count
print(inner_length)

Measured memory_bytes: 3064
#include<stdio.h>
int n;
int data[4][3][10];
void proc(){
  for(int i=0;i<4;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<10;k++){
        printf(" %d",data[i][j][k]);
      }
      printf("\n");
    }
    if(i<3)printf("####################\n");
  }
}

void inp(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    --a;--b;--c;d;
    data[a][b][c]+=d;
  }
}

int main(){
  inp();
  proc();
  return 0;
}

Measured memory_bytes: 1020
import bisect
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, A, B, C = list(map(int, sys.stdin.buffer.readline().split()))
S = [sys.stdin.buffer.readline().decode().rstrip() for _ in range(N)]


def get_idx(c):
    ret = []
    for i, s in enumerate(S):
        if c == s:
            ret.append(i)
    ret.append(N)
    return ret


ab_idx = get_idx('AB')
ac_idx = get_idx('AC')
bc_idx = get_idx('BC')

# 0,0 にしなければいい
a, b, c = A, B, C
ans = []
ok = True
for i, s in enumerate(S):
    pa, pb, pc = a, b, c
    if s == 'AB':
        if a == b == 0:
            ok = False
            break
        elif a > b:
            a -= 1
            b += 1
        elif a < b:
            a += 1
            b -= 1
        elif a == b == 1:
            ai = ac_idx[bisect.bisect_left(ac_idx, i)]
            bi = bc_idx[bisect.bisect_left(bc_idx, i)]
            if ai < bi:
                a += 1
                b -= 1
            else:
                a -= 1
                b += 1
        else:
            a -= 1
            b += 1
    if s == 'AC':
        if a == c == 0:
            ok = False
            break
        elif a > c:
            a -= 1
            c += 1
        elif a < c:
            a += 1
            c -= 1
        elif a == c == 1:
            ai = ab_idx[bisect.bisect_left(ab_idx, i)]
            ci = bc_idx[bisect.bisect_left(bc_idx, i)]
            if ai < ci:
                a += 1
                c -= 1
            else:
                a -= 1
                c += 1
        else:
            a -= 1
            c += 1
    if s == 'BC':
        if c == b == 0:
            ok = False
            break
        elif c > b:
            c -= 1
            b += 1
        elif c < b:
            c += 1
            b -= 1
        elif c == b == 1:
            ci = ac_idx[bisect.bisect_left(ac_idx, i)]
            bi = ab_idx[bisect.bisect_left(ab_idx, i)]
            if ci < bi:
                c += 1
                b -= 1
            else:
                c -= 1
                b += 1
        else:
            c -= 1
            b += 1

    if pa < a:
        ans.append('A')
    elif pb < b:
        ans.append('B')
    elif pc < c:
        ans.append('C')
    else:
        assert False
if ok:
    print('Yes')
else:
    print('No')
    exit()
print(*ans, sep='\n')


Measured memory_bytes: 22524
// I look at my watch
// it say nine twenty-five
// And I think oh God
// I'm still alive
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) int((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(int i = int(a); i < int(b); ++i)
#define roF(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld;

string ss[]={"Sunny","Cloudy","Rainy"};


int main(){	
	string s;cin>>s;
	int id=-1;
	For(i,0,3){
		if(s==ss[i])id=i;
	}
	id=(id+1)%3;
	cout<<ss[id]<<endl;

	return 0;
}


Measured memory_bytes: 3568
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    string s;
    cin>>s;
    if(s.size()<26){
	bool k[26]={0};
	lol(i,s.size())k[s[i]-'a']=true;
	lol(i,26){
	    if(k[i]==false){
		s.push_back(i+'a');
		break;
	    }
	}
	cout<<s<<endl;
    }
    else{
	if(s=="zyxwvutsrqponmlkjihgfedcba"){
	    cout<<"-1"<<endl;
	    return 0;
	}
	for(int i=s.size()-2;i>=0;i--){
	    if(s[i]<s[i+1]){
		for(int j=0;j<26;j++){
		    if(j<i)cout<<s[j];
		    if(i==j){
			char t='a';
			for(int k=25;k>j;k--){
			    if(s[k]>s[i]){
				t=s[k];
				break;
			    }
			}
			cout<<t;
		    }
		}
		cout<<endl;
		break;
	    }
	}
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

template <int MOD>
struct Fp
{
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD)
    {
        if (val < 0)
            val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator-() const noexcept
    {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp &operator+=(const Fp &r) noexcept
    {
        val += r.val;
        if (val >= MOD)
            val -= MOD;
        return *this;
    }
    constexpr Fp &operator-=(const Fp &r) noexcept
    {
        val -= r.val;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr Fp &operator*=(const Fp &r) noexcept
    {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp &operator/=(const Fp &r) noexcept
    {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b)
        {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr bool operator==(const Fp &r) const noexcept
    {
        return this->val == r.val;
    }
    constexpr bool operator!=(const Fp &r) const noexcept
    {
        return this->val != r.val;
    }
    friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept
    {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept
    {
        if (n == 0)
            return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1)
            t = t * a;
        return t;
    }
};

const int MOD = 1'000'000'007;
using mint = Fp<MOD>;

mint dp[710][2010];

int main()
{
    int n;
    cin >> n;
    mint ten = 1;
    for (int i = 0; i < n; i++)
    {
        ten = ten * 10;
    }
    mint nine = 1;
    for (int i = 0; i < n; i++)
    {
        nine = nine * 9;
    }
    mint eight = 1;
    for (int i = 0; i < n; i++)
    {
        eight = eight * 8;
    }
    cout << ten - nine - nine + eight << endl;
    return 0;
}


Measured memory_bytes: 3572
# -*- coding: utf-8 -*-
# 標準入力の取得
N, K = list(map(int, input().split()))
d = []
A = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))


def main() -> None:
    """Entry point
    """
    # 求解処理
    # お菓子を持っているすぬけ君の人数を全体から引く
    persons = set()
    for A_i in A:
        for A_ij in A_i:
            persons.add(A_ij)

    result = N - len(persons)

    # 結果出力
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9172
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  int N;
  std::cin >> N;

  std::vector<int> d(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> d[i];
  }
  std::sort(d.begin(), d.end());
  const auto itr = std::unique(d.begin(), d.end());
  std::cout << (itr - d.begin()) << std::endl;
}

Measured memory_bytes: 3596
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
left = []
right = []
for _ in range(n):
    l,r = li()
    left.append(l)
    right.append(r)
    
left.sort(reverse=True)
right.sort(reverse=False)

ans_l = 0
last = 0
for i in range(n):
    if left[i] - last < 0:
        ans_l += abs(last)
        break
    else:
        ans_l += (left[i] - last) 
        last = left[i]
    
    if last - right[i] < 0:
        ans_l += abs(last)
        break
    else:
        ans_l += (last - right[i])
        last = right[i]
    
ans_r = 0
last = 0
for i in range(n):
    if last - right[i] < 0:
        ans_r += abs(last)
        break
    else:
        ans_r += (last - right[i])
        last = right[i]
    
    if left[i] - last < 0:
        ans_r += abs(last)
        break
    else:
        ans_r += (left[i] - last) 
        last = left[i]
    


print(max(ans_l, ans_r))

Measured memory_bytes: 11488
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int main()
{
	int a,c;
	cin>>a>>c;
	cout<<c*2-a;
}

Measured memory_bytes: 256
from collections import defaultdict as dd
N = int(input())
A = list(map(int, input().split()))

D = dd(int)
for a in A:
  D[a] += 1
a = 0
b = 0

for k, v in D.items():
  if v != 1:
    if k > b:
      b = k
    if b > a:
      b, a = a, b
    if v >= 4:
      if k > b:
        b = k
      if b > a:
        b, a = a, b
print (a*b)

Measured memory_bytes: 69016