akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cerr << #v << " = "; array_out(v , __VA_ARGS__ );} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
using P = pair<ll,ll>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
/////////////////
void solve(){
  ini(N , M);
  vi g(N,0) , h(N,0);
  rep(i,M){
    ini(a,b); a--; b--;
    if(a==0) g[b] = 1;
    if(b==N-1) h[a] = 1;
  }
  rep(i,N){
    if(g[i] == 1 && h[i] == 1) die("POSSIBLE");
  }
  die("IMPOSSIBLE");
}



Measured memory_bytes: 1792
N = int(input())
S = input()
def Z_algo(S):
    n = len(S)
    LCP = [0]*n
    i = 1
    j = 0
    c = 0#最も末尾側までLCPを求めたインデックス
    for i in range(1, n):
        #i番目からのLCPが以前計算したcからのLCPに含まれている場合
        if i+LCP[i-c] < c+LCP[c]:
            LCP[i] = LCP[i-c]
        else:
            j = max(0, c+LCP[c]-i)
            while i+j < n and S[j] == S[i+j]: j+=1
            LCP[i] = j
            c = i
    for i in range(1,n):
        if i <= LCP[i]:
            LCP[i] = i
    return LCP
ans = 0
for i in range(N):
    T = S[i:]
    R = Z_algo(T)
    R.pop(0)
    R.append(0)
    ans = max(max(R),ans)
print(ans)


Measured memory_bytes: 52444
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String r = sc.next();
        int cnt = 0;
        for (int i = 0; i < 3; i++) {
            if (s.charAt(i) == r.charAt(i) ) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }    
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin>>a>>b>>c;
  for(int i=a;i<=a*b+1000;i+=a){
    if(i%b==c){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
}

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

int main(){
    int N;
    cin >> N;
    vector<long long> A(N, 0);
    vector<long long> B(N);
    for(int i = 0; i < N; i++){
        cin >> B[i];
        if(i % 2 == 0)A[0] += B[i];
        else A[0] -= B[i];
    }
    for(int i = 1; i < N; i++)A[i] = 2 * B[i - 1] - A[i - 1];
    for(auto ans : A)cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2944
from collections import defaultdict
N = int(input())

T = [input() for i in range(N)]
S = [0] * N
P = [0] * N
d = defaultdict(list)

mylist = []
for i in range(N):
    S[i], P[i] = map(str, T[i].split())
    d[S[i]].append(int(P[i]))    

s_d = sorted(d)
ans = []
for i in s_d:
    A = d[i]
    so_A = sorted(A, reverse=True)
    for j in so_A:
        ans.append(i + ' ' + str(j))

for k in ans:
    print(T.index(k) + 1)

Measured memory_bytes: 3316
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>

int n;
static const int nmax = 2005;
static const int INFTY = (1 << 21);
static const int WHITE = 0; // Not visited
static const int GRAY = 1;  // Visited
static const int BLACK = 2; // In MST
std::array<std::array<int, nmax>, nmax> adjmat;
std::array<int, nmax> d, p;
std::array<int, nmax> color;

void prim()
{
  color.fill(WHITE);
  d.fill(INFTY);
  p.fill(-1);

  int v = 0;
  d[v] = 0;
  color[v] = GRAY;

  while (true)
    {
      auto mincost = INFTY;

      // Find minimum cost vertex from current MST
      for (int i=0; i<n; ++i)
        {
          if (color[i] != BLACK && d[i] < mincost)
            {
              mincost = d[i];
              v = i;
            }
        }

      // Break if no update
      if (mincost == INFTY) break;

      // Include v in MST
      color[v] = BLACK;

      // Update minimum cost outside current MST
      for (int i=0; i<n; ++i)
        {
          if (color[i] != BLACK && adjmat[v][i] != -1 && adjmat[v][i] < d[i])
            {
              d[i] = adjmat[v][i];
              color[i] = GRAY;
              p[i] = v;
            }
        }
    }
}

int main ()
{
  std::cin >> n;
  for (int i=0; i<n; ++i)
    {
      for (int j=0; j<n; ++j)
        std::cin >> adjmat[i][j];
    }

  prim();

  int ans = 0;
  //std::for_each(d.begin(), d.begin()+n, [&](auto x){ans+=x;});
  for (int i=0; i<n; ++i)
    {
      if (p[i] != -1)
        ans += adjmat[i][p[i]];
    }
  std::cout << ans << std::endl;
}



Measured memory_bytes: 3548
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  vector<int> A(3);
  for(int i=0; i<3; i++)
    cin >> A[i];
  sort(A.begin(), A.end());
  cout << A[2] - A[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, m; cin >> n >> m;
	vector<ll> p(m), y(m);
	vector<vector<ll>> v(n);
	rep(i, 0, m - 1)
	{
		cin >> p[i] >> y[i]; --p[i];
		v[p[i]].push_back(y[i]);
	}
	rep(i, 0, n - 1)
	{
		sort(all(v[i]));
	}
	rep(i, 0, m - 1)
	{
		ll u = p[i];
		printf("%06d", u + 1);
		ll it = lower_bound(all(v[u]), y[i]) - v[u].begin();
		printf("%06d\n", it + 1);
	}
}

Measured memory_bytes: 8576
#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>;
typedef vector<int> vi;
using Graph = vector<vector<int>>;

int main() {
  int N;
  string S, T;
  cin >> N >> S >>T;

  rep (i, N) {
    cout << S[i] << T[i];
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 3564
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
using static CS_Contest.Utils;

namespace CS_Contest {
	using Li = List<int>;
	using LLi = List<List<int>>;
	class Program {
        static void Main(string[] args) {
			new Calc().Solve();
			return;
        }

		private class Calc {
			public void Solve() {
				int N = ReadInt();
				var items = ReadLong(' ');
				long t = items[0], a = items[1];
				REP(N-1, x => {
					var TA = ReadInt(' ');
					if (TA[0] >= t && TA[1] >= a) {
						t = TA[0];a = TA[1];
					}
					else {
						long k = Max((t + TA[0] - 1) / TA[0], (a + TA[1] - 1) / TA[1]);
						t = k * TA[0]; a = k * TA[1];
					}
				});
				(t + a).WL();
				return;
			}
		}
    }

	
	
    public static class Utils {
		public static int INF = (int)(1e9);
        public static void WL(this object obj) => WriteLine(obj);
        public static void WL(this string obj) => WriteLine(obj);
        public static void WL<T>(this IEnumerable<T> list) => list.ToList().ForEach(x => x.WL());
		public static int ReadInt() => int.Parse(ReadLine());
		public static List<int> ReadInt(char s) => ReadLine().Split(s).Select(int.Parse).ToList();
		public static long ReadLong() => long.Parse(ReadLine());
		public static List<long> ReadLong(char s) => ReadLine().Split(s).Select(long.Parse).ToList();
		public static void REP(int n,Action<int> act) {
			for (int i = 0; i < n; i++) {
				act(i);
			}
		}
		public static void RREP(int n,Action<int> act) {
			for (int i = n-1; i >=0; i--) {
				act(i);
			}
		}
		public static void REP(long n, Action<int> act) => REP((int)n, act);
		public static void RREP(long n, Action<int> act) => RREP((int)n, act);

		public static void Yes() => "Yes".WL();
		public static void No() => "No".WL();
		public static void YES() => "YES".WL();
		public static void NO() => "NO".WL();


		public static int ManhattanDistance(int x1, int y1, int x2, int y2) => Abs(x2 - x1) + Abs(y2 - y1);

		public class Tree {
			public LLi Graph;
			public Tree(int nodes) {
				Graph = new LLi();
				REP(nodes, x => {
					Graph.Add(new Li());
				});
			}
			public void Add(int x,int y) {
				Graph[x].Add(y);
				Graph[y].Add(x);
			}
		}
    }
}


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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  map<pair<ll, ll>, ll> mp1, mp2;
  map<int, ll> mp3;
  for(int i=1;i<=n;++i) {
    ll rev = 0;
    ll a = i%10;
    if(a == 0) continue;
    int tmp = i;
    while(tmp >= 10) {
      rev *= 10;
      rev += tmp % 10;
      tmp /= 10;
    }
    rev *= 10;
    rev += tmp % 10;
    //cout << rev << endl;
    ll b = tmp;
    //if(a == b) {
      //mp3[a]++;
    //} else {
      mp1[{a, b}]++;
      if(rev <= n) mp2[{b, a}]++;
    //}
  }
  ll cnt = 0;
  for(auto &e: mp1) {
    //cout << e << endl;
    cnt += e.second * mp1[{e.first.second, e.first.first}];
  }
/*   cout << cnt << endl;
  for(auto &e: mp3) {
    cout << e << endl;
    cnt += e.second * e.second;
  } */

  cout << cnt << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL

template<typename T>
struct SegTree{
  const T e = 0; //単位元
  vector<T> dat;
  int n;
  SegTree(int n_): n(), dat(4*n_, e){
    int x = 1;
    while(n_ > x) x *= 2;
    n = x;
  }

  SegTree(vector<T> v): n(), dat(4*v.size(), e){
    int x = 1;
    int n_ = v.size();
    while(n_ > x) x *= 2;
    n = x;
    for(int i = 0; i < n_; i++) dat.at(i+n-1) = v.at(i);
    for(int i = n-2; i >= 0; i--) dat.at(i) = __gcd(dat.at(2*i+1), dat.at(2*i+2)); //演算
  }

  void set(int i, T x){dat.at(i + n-1) = x;}
  void build(){
    for(int i = n-2; i >= 0; i--) dat.at(i) = __gcd(dat.at(2*i+1), dat.at(2*i+2)); //演算
  }

  void update(int i, T x){
    i += n-1;
    dat.at(i) = x;
    while(i > 0){
      int i = (i-1)/2;
      dat.at(i) = __gcd(dat.at(2*i+1), dat.at(2*i+2)); //演算
    }
  }

  T query_sub(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return e;
    else if(a <= l && r <= b) return dat.at(k);
    else{
      T vl = query_sub(a, b, 2*k+1, l, (l+r)/2);
      T vr = query_sub(a, b, 2*k+2, (l+r)/2, r);
      return __gcd(vl, vr); //演算
    }
  }
  T query(int a, int b){return query_sub(a, b, 0, 0, n);}
};

int main(){
  int N;
  cin >> N;
  SegTree<ll> tree(N);
  for(int i = 0; i < N; i++){
    ll x;
    cin >> x;
    tree.set(i, x);
  }
  tree.build();
  ll ans = 0;
  for(int i = 0; i < N; i++){
    chmax(ans, __gcd(tree.query(0, i), tree.query(i+1, N)));
  }
  cout << ans << endl;
}

Measured memory_bytes: 3328
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Array.Sort(A);
		long[] sum = new long[N+1];
		for(int i=0;i<N;i++) sum[i + 1] = sum[i] + A[i];
		int cnt = 0;
		for(int i=1;i<=N;i++){
			if(sum[i] <= X){
				cnt++;
				continue;
			}
			break;
		}
		if(cnt == N && sum[N] != X) cnt--; 
		
		Console.WriteLine(cnt);
		
		
	}
	int N;
	long X;
	long[] A;
	public Sol(){
		var d = ria();
		N = d[0]; X = d[1];
		A = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11348
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	class C{
		int pos, step, start;
		public C(int pos, int step, int start) {
			this.pos = pos;
			this.step = step;
			this.start = start;
		}
		
	}
	
	private void doit(){
		while(true){
			int max = sc.nextInt();
			if(max == 0) break;
			int n = sc.nextInt();
			int [] data  = new int[n + 2];
			for(int i = 1; i <= n; i++){
				data[i] = sc.nextInt();
			}
			n += 2;
			LinkedList<C> open = new LinkedList<Main.C>();
			open.add(new C(0, 0, 0));
			boolean [][] close = new boolean[n][n];
			close[0][0] = true;
			while(! open.isEmpty()){
				C now = open.poll();
				if(now.pos == n-1){
					continue;
				}
				for(int i = 1; i <= max; i++){
					int npos = now.pos + i;
					if(n <= npos){
						npos = n-1;
					}
					if(data[npos] != 0){
						npos = npos + data[npos];
						if(0 > npos){
							npos = 0;
						}
						if(npos >= n){
							npos = n-1;
						}
					}
					if(! close[now.start][npos]){
						close[now.start][npos] = true;
						open.add(new C(npos, now.step + 1, now.start));
					}
					if(! close[npos][npos]){
						close[npos][npos] = true;
						open.add(new C(npos, 0, npos));
					}
				}
			}
			boolean ans = true;
			for(int i = 0; i < n; i++){
				if(close[i][n-1] == false && close[i][i]){
					ans = false;
					break;
				}
			}
			System.out.println(ans ? "OK" : "NG");
		}
	}
	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

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

using P = pair<int, int>;
struct Edge { int to, cost; };

void input(int N, vector<vector<Edge>> &G, vector<P> &A) {
    sort(A.begin(), A.end());
    rep(i, 1, N) {
        int cost = A[i].first - A[i-1].first;
        G[A[i].second].push_back({A[i-1].second, cost});
        G[A[i-1].second].push_back({A[i].second, cost});
    }
}

int main() {
    int N;
    cin >> N;
    vector<P> X(N), Y(N);
    rep(i, 0, N) {
        int x, y;
        cin >> x >> y;
        X[i] = P(x, i);
        Y[i] = P(y, i);
    }
    vector<vector<Edge>> G(N);
    input(N, G, X);
    input(N, G, Y);
    priority_queue<P, vector<P>, greater<P>> Q;
    vector<int> visited(N);
    Q.push(P(0, N-1));
    int ans = 0;
    while(!Q.empty()) {
        P p = Q.top(); Q.pop();
        int cur = p.second;
        int cost = p.first;
        if(visited[cur]) continue;
        visited[cur] = 1;
        ans += cost;
        for(auto &e : G[cur]) {
            if(visited[e.to]) continue;
            Q.push(P(e.cost, e.to));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11384
#include <stdio.h>
int main(){
  int n,q;
  scanf("%d%d",&n,&q);
  int  ans[n];
  ans[0] = 0;
  char s[n+2];
  scanf("%s",s);
  int i;
  for(i=1;i<n;i++){
    if (s[i-1] == 'A' && s[i] == 'C'){
      ans[i] = ans[i-1]+1;
    }else{
      ans[i] = ans[i-1];
    }
  }
  for(i=0;i<q;i++){
    int l, r;
    scanf("%d%d",&l,&r);
    printf("%d\n", ans[r-1]-ans[l-1]);
  }
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color, D; vll path;
//***********//
int main() {
	long double A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;
	long double sum = 0, suger = 0, P = 0;
	for (long double i = 0; i <= F/(100*A); i++) {
		for (long double j = 0; j <= (F-A*i)/(100*B); j++) {
			for (long double k = 0; k <= (F-A*100*i-B*100*j)/C ; k++) {
				for (long double l = 0; l <= (F - A * 100 * i - B * 100 * j - C * k) / D; l++) {
					long double w = 100 * A * i + 100 * B * j;
					long double s = C*k + D*l;
					if (s > E * (w/100)) continue;
					else if (s == 0) continue;
					else if ((100 * s) / (w + s) > P) {
						P = (100 * s) / (w + s);
						sum = w + s;
						suger = s;
					}
					//debug(w, s, P);
				}
			}
		}
	}
	if (P == 0) {
		cout << 100 * A << " " << suger;
	}
	else {
		cout << sum << " " << suger;
	}
}

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

int main() {
    string ss, t;
    cin >> ss >> t;
    priority_queue<string, vector<string>, greater<string>> can;
    for (size_t i = 0; i + t.size() <= ss.size(); i++) {
        bool f = true;
        for (size_t j = 0; j < t.size(); j++) {
            if (ss[i+j] != t[j] && ss[i+j] != '?') f = false;
        }
        if (!f) continue;
        string tmp = ss;
        copy(begin(t), end(t), begin(tmp) + i);
        replace(begin(tmp), end(tmp), '?', 'a');
        can.push(tmp);
    }

    cout << (can.empty() ? "UNRESTORABLE" : can.top()) << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int x[] = new int[n];
		int xSort[] = new int[n];
		for (int i=0; i<n; i++){
			x[i] = sc.nextInt();
			xSort[i] = x[i];
		}
		Arrays.sort(xSort);
		int median1 = xSort[(n/2)-1];
		int median2 = xSort[n/2];
		for (int i=0; i<n; i++){
			if (x[i] <= median1){
				System.out.println(median2);
			} else {
				System.out.println(median1);
			}
		}
	}
}


Measured memory_bytes: 94852
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int n, x, y;
	scanf("%d %d %d", &n, &x, &y);
	x--, y--;
	int c[n];
	fill(c, c + n, 0);
	for (int i = 0; i < n; i++){
		for (int j = i + 1; j < n; j++){
			c[min(j - i, abs(x - i) + 1 + abs(y - j))]++;
		}
	}
	for (int i = 1; i < n; i++) printf("%d\n", c[i]);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <numeric>
int main(){
  int n,m,wa[100001]={},i,ac[100001]={},p,a,b=0;
  std::string s;
  std::cin>>n>>m;
  for(i=0;i<m;++i){
    std::cin>>p>>s;
    if(s=="AC")ac[p-1]=1;
    else (ac[p-1]?0:++wa[p-1]);
  }
  a = std::accumulate(ac, ac+n, 0);
  for(i=0;i<n;++i)b+=ac[i]*wa[i];
  std::cout<<a<<' '<<b<<"\n";
}
    

Measured memory_bytes: 1152
n = int(input())
l = [[0 for j in range(9)]for i in range(9)]
for i in range(1,n+1):
  if i % 10 != 0:
    s_i = str(i)
    l[int(s_i[-1])-1][int(s_i[0])-1] += 1

ans = 0
for i in range(9):
  for j in range(9):
    ans += l[i][j] * l[j][i]
print(ans)

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

int main(void)
{
	int n;
	bool d[31] ={};

	for(int i = 0; i < 28; i++){
		cin >> n;
		d[n] = true;

	}

	for(int i = 1; i <= 30; i++){
		if(!d[i])
			cout << i << endl;
	}
	return 0;

}

Measured memory_bytes: 1160
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    print(A*B)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define debug(x) cerr<<#x<<" = "<<x
#define sp <<"  "
#define el <<endl
#define fgx cerr<<" ---------------------------------------------- "<<endl
#define uint unsigned int 
#define ULL unsigned long long
#define DB long double
#define LDB long double
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define rint register int 
namespace IO{
	const int BS=(1<<23)+5; int Top=0;
	char Buffer[BS],OT[BS],*OS=OT,*HD,*TL,SS[20]; const char *fin=OT+BS-1;
	char Getchar(){if(HD==TL){TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);} return (HD==TL)?EOF:*HD++;}
	void flush(){fwrite(OT,1,OS-OT,stdout),OS=OT;}
	void Putchar(char c){*OS++ =c;if(OS==fin)flush();}
	void write(int x){
		if(!x){Putchar('0');return;} if(x<0) x=-x,Putchar('-');
		while(x) SS[++Top]=x%10,x/=10;
		while(Top) Putchar(SS[Top]+'0'),--Top;
	}
	inline LL read(){
		LL nm=0; bool fh=true; char cw=getchar();
		for(;!isdigit(cw);cw=getchar()) fh^=(cw=='-');
		for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
		return fh?nm:-nm;
	}
} using namespace IO;
#define mod 998244353
namespace CALC{
	inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);}
	inline int mns(int x,int y){return (x-y<0)?(x-y+mod):(x-y);}
	inline int mul(int x,int y){return (LL)x*(LL)y%mod;}
	inline void upd(int &x,int y){x=(x+y>=mod)?(x+y-mod):(x+y);}
	inline void dec(int &x,int y){x=(x-y<0)?(x-y+mod):(x-y);}
	inline int qpow(int x,LL sq){int res=1;for(;sq;sq>>=1,x=mul(x,x))if(sq&1)res=mul(res,x);return res;}
}using namespace CALC;
#define M 500020
char ch[M]; int n;
int main(){
	scanf("%s",ch); n=strlen(ch);
	for(int i=0;i<n;i++) putchar(ch[i]=='P'?'P':'D');
	puts(""); return 0;
}

Measured memory_bytes: 3852
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long int lli;
const double EPS = 1e-8;

int main(){
    while(1){
        int an,bn,r;
        cin >> an >> bn >> r;
        if(an==0 && bn==0) break;

        vector<int> x(an), y(an);
        for(int i=0; i<an; i++){
            cin >> x[i] >> y[i];
        }
        vector<vector<double> > b(10000);
        for(int i=0; i<bn; i++){
            int x,y;
            cin >> x >> y;
            b[x].push_back(y);
        }
        for(int i=0; i<10000; i++){
            sort(b[i].begin(), b[i].end());
        }

        lli ans=0;
        for(int i=0; i<an; i++){
            for(int d=-4*r; d<=4*r; d++){
                if(x[i]+d < 0 || 10000 <= x[i]+d) continue;
                double w = sqrt(16*r*r -d*d);
                ans += lower_bound(b[x[i]+d].begin(), b[x[i]+d].end(), y[i] +w +EPS)
                        - lower_bound(b[x[i]+d].begin(), b[x[i]+d].end(), y[i] -w -EPS);
            }
        }
        cout << ans << endl;
    } 
    return 0;
}


Measured memory_bytes: 4888
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <vector>
#include <math.h>
#include <stack>
#include <map>
#define x first 
#define y second 
using namespace std;
typedef long long LL;
const int N = 1e5+5;
const int INF = 0x3f3f3f3f;
int main(){
  vector<int>a;
  a.clear();
  for(int i=0;i<3;++i){
    int x;scanf("%d",&x);
    a.push_back(x);
  }
  sort(a.begin(),a.end());
  if(a[0]==5&&a[1]==5&&a[2]==7)printf("YES\n");
  else printf("NO\n");
  return 0;
}

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

const int64_t MAX = 510000;
const int64_t MOD = 1000000007;

int64_t fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
int64_t COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  int64_t N,M,K;
  cin>>N>>M>>K;

  COMinit();
  int64_t ans=0;
  for(int i=0;i<N;++i){
    for(int j=0;j<M;++j){
      if(i!=0 && j!=0) ans += 2*(i+j)*(M-j)*(N-i);
      else ans += (i+j)*(M-j)*(N-i); 
      ans %= MOD;
    }
  }
  ans *= COM(N*M-2,K-2);
  cout<<ans%MOD<<endl;
}

Measured memory_bytes: 12160
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>
#include <queue>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

void solve_A(){
    char s;
    cin >> s;
    if(isupper(s)){
        cout << "A" << endl;
    } else cout << "a" << endl;
}

void solve_B(){
    int n, k;
    cin >> n >> k;
    int p[n];
    REP(i,n) cin >> p[i];

    sort(p, p+n);
    ll ans = 0;
    REP(i, k){
        ans += p[i];
    }
    cout <<ans << endl;
}

ll N;

void dfs(vector<string> &A){
    if(A.size() == N){
        cout << A[N] << endl;
    }

    for(int i = 0; i <= 25; i++){
        
        
        
    
    }

}

void solve_C(){
    cin >> N;

    queue<string> que;
    for(int i = 0; i <= 25; i++){
        char s = 'a' + i;
        string str(1,s);
        que.push(str);
        if(i+1 == N){
            cout << str << endl;
            return;
        }
    }

    int ctr = 26;
    while(1){
        string s = que.front();
        que.pop();
        for(int i = 0; i <= 25; i++){
            char add = 'a' + i;
            string add_s(1, add);
            que.push(s + add_s);
            ctr++;
            if(ctr == N){
                cout << s + add_s << endl;
                return;
            }
        }
    }

}

ll power(ll n, ll r){
    ll ans = 1;
    while(r > 0){
        if((r&1) == 1){
            ans = ans * n;
        }
        n *= n;
        r >>= 1;
    }
    return ans;
}

void solve_C_re(){
    cin >> N;
    ll check = 25 * N + 1;
    int keta = 0;
    for(int i = 1; i < 12; i++){
        if(power(26, i) <= check && check <= power(26, i+1)){
            keta = i;
            break;
        }
    }
    

    ll n = N - (power(26, keta) - 1 )/ 25;
   
    while(keta > 0){  
        int num = n / power(26, keta-1);
        ll rem = n % power(26, keta-1);
        //cout << num << ", " << rem << endl;
        keta --;
        char s;
        if(num == 26){
            s = 'a';
            cout << s;
        }
        else s = 'a'+num;
        cout << s;
        n = rem;
    }
    cout << endl;
}

void solve_D(){
    int n;
    cin >> n;
    int a[n];
    vector<int> num(100005, 0);
    ll sum = 0;
    REP(i,n){
        cin >> a[i];
        num[a[i]]++;
        sum += a[i];
    }

    int q;
    cin >> q;
    REP(i,q){
        int b, c;
        cin >> b >> c;
        sum += (c - b) * num[b];
        cout << sum << endl;
        num[c] += num[b];
        num[b] = 0;
    }
}

int main(void){
    solve_D();
    
    return 0;
}

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

int main(){
	string s;
	cin>>s;
	int i,a,g=0,p=0,t;
	for(i=0;i<s.length();i++){
		if(s[i]=='g') g++;
		if(s[i]=='p') p++;
	}
	t=s.length()/2-p;
	if(t<0) t=0;
	cout<<t<<endl;
	return 0;
}
	

Measured memory_bytes: 512
N, K = [int(i) for i in input().split()]
S = input()

si = [1]
si.extend(2+i for i, (s1, s2) in enumerate(zip(S, S[1:])) if s1 != s2)
si.append(N + 1)


def f(i, si):
    return si[min(i + 2*K + 1, len(si)) - 1] - si[i-1]

j0 = min(1 + 2*K + (1 if S[0] == "1" else 0), len(si)) - 1
x0 = si[j0] - 1

x = [x0]
x.extend(f(i+1, si) for i in range(2 if S[0] == "1" else 1, len(si), 2))
print(max(x)) 

Measured memory_bytes: 9192
import java.util.Scanner;

class Main {
    public static void main( String args[] ) {

      for( int i = 1; i < 10; i++ ) {
        for( int r = 1; r < 10; r++) {
          System.out.println( i + "x" + r + "=" + (i * r) );
        }
      }

    }
}

Measured memory_bytes: 24204
while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    sn=[]
    for i in range(n):
        sn.append(int(input()))
    c=[]
    for j in range(0,n-k+1):
        if j==0:
            fsum = sum(sn[0:k])
        else:
            fsum = fsum + sn[j+k-1] - sn[j-1]
        c.append(fsum)
    print(max(c))


Measured memory_bytes: 11688
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define sz(x) (int)(x.size())
#define lt(x) (int)(x.length())
#define MOD 1000000007 
#define mx 200003

long long n, a[mx], b[mx];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++)
		cin >> b[i];
	queue<int> bisa;
	for(int j = 0; j < n; j++){
		int i = (j - 1 + n) % n;
		int k = (j + 1) % n;
		if(b[j] > b[i] + b[k] && b[j] > a[j])
			bisa.push(j);
		if(b[j] < a[j]){
			cout << -1 << '\n';
			return 0;
		}
	}
	long long jaw = 0;
	// debug(sz(bisa));
	// debug(bisa.front());
	while(1){
		// for(int i = 0; i < n; i++)
			// cout << b[i] << ' ';
		// cout << '\n';
		if(bisa.empty())
			break;
		int j = bisa.front();
		bisa.pop();
		// debug(j);
		int i = (j - 1 + n) % n;
		int k = (j + 1) % n;
		if(a[j] >= b[i] + b[k]){
			if((b[j] - a[j]) % (b[i] + b[k]) > 0){
				cout << -1 << '\n';
				return 0;
			}
			jaw += (b[j] - a[j]) / (b[i] + b[k]);
			b[j] = a[j];
		}
		else{
			long long sisa = b[j] % (b[i] + b[k]);
			if(sisa < a[j]){
				cout << -1 << '\n';
				return 0;
			}
			jaw += b[j] / (b[i] + b[k]);
			b[j] = sisa;
		}
		if(b[i] > (b[(i - 1 + n) % n] + b[(i + 1) % n]) && b[i] > a[i])
			bisa.push(i);
		if(b[k] > (b[(k - 1 + n) % n] + b[(k + 1) % n]) && b[k] > a[k])
			bisa.push(k);
	}
	for(int i = 0; i < n; i++){
		if(b[i] != a[i]){
			cout << -1 << '\n';
			return 0;
		}
	}
	cout << jaw << '\n';
}

Measured memory_bytes: 3840
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;

#define PI 3.14159265358979323846264338327950L

double res;

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

    int N;
    double V[60];
    cin >> N;
    for(int i = 0; i < N; i++ )
    {
        cin >> V[i];
    }
    sort(V, V + N);
    for(int i = 0; i < N-1; i++ )
    {
        V[i + 1] = (V[i] + V[i+1])/2;
    }
    cout << V[N-1] << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
q = int(input())
k = list(map(int, input().split()))
for ki in k:
    ans = 0
    DMC = [0]*3
    for i in range(n):
        if s[i] == "D":
            DMC[0] += 1
        elif s[i] == "M":
            DMC[1] += 1
            DMC[2] += DMC[0]
        elif s[i] == "C":
            ans += DMC[2]
        if i >= ki-1:
            j = i-ki+1
            if s[j] == "D":
                DMC[0] -= 1
                DMC[2] -= DMC[1]
            elif s[j] == "M":
                DMC[1] -= 1
    print(ans)

Measured memory_bytes: 58716
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N;
    rep(i,N+1){
        if(!i) continue;
        if(i%3==0) {cout << " " << i; continue;}
        int x=i;
        while(x>0){
            if(x%10==3){cout << " " << i; break;}
            x/=10;
        }
    }
    cout << endl;
    return 0;
}


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

long long H, W, N, L[100009], R[100009]; vector<long long>D;

long long solve(vector<pair<long long, long long>>V) {
	long long cnt = 0, res = 0, pos = 0;

	while (pos < V.size()) {
		while (pos < V.size() && V[pos].first <= res) {
			res = min(res, V[pos].second); pos++;
		}
		cnt++; res = (1 << 30);
	}
	return cnt;
}

int main() {
	cin >> N >> W >> H;
	for (int i = 0; i < N; i++) {
		int px, py; char c;
		cin >> px >> py >> c;

		if (c == 'N') {
			long long BASE = px;
			L[i] = BASE - (H - py); R[i] = BASE + (H - py);
		}
		if (c == 'E') {
			long long BASE = W + (H - py);
			L[i] = BASE - (W - px); R[i] = BASE + (W - px);
		}
		if (c == 'S') {
			long long BASE = W + H + (W - px);
			L[i] = BASE - py; R[i] = BASE + py;
		}
		if (c == 'W') {
			long long BASE = W + H + W + py;
			L[i] = BASE - px; R[i] = BASE + px;
		}
		L[i] += ((W + H) * 2); L[i] %= ((W + H) * 2);
		R[i] += ((W + H) * 2); R[i] %= ((W + H) * 2);
		D.push_back(L[i]);
		D.push_back(R[i]);
	}
	sort(D.begin(), D.end());
	D.erase(unique(D.begin(), D.end()), D.end());

	long long LENG = (H + W) * 2;
	long long ans = (1 << 30);

	for (int i = 0; i < D.size(); i++) {
		vector<pair<long long, long long>>vec;
		for (int j = 0; j < N; j++) {
			long long GL = (L[j] - D[i] + LENG) % LENG;
			long long GR = (R[j] - D[i] + LENG) % LENG;
			if (GL > GR) GL = 0;
			vec.push_back(make_pair(GL, GR));
		}
		sort(vec.begin(), vec.end());
		long long rem = solve(vec);
		ans = min(ans, rem);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3236
// 19:30
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <tuple>
#include <utility>
using namespace std;
typedef long long ll;
#define for1(i,n) for (ll i=0;i<(n);(i)++)
#define for2(i,m,n) for (ll (i)=(m);(i)<(n);(i)++)
#define for3(i,m,n,d) for (ll (i)=(m);(i)<(n);(i)+=(d))
#define INF (1LL << 60)

void solve()
{
  vector<ll> prime;
  for2(i,2,1001) {
    for (auto p : prime) {
      if (i % p == 0) {
        break;
      }
    }
    prime.push_back(i);
  }

  ll N;
  const ll MOD = 1000000007;
  cin >> N;
  ll ans = 1;
  map<ll,ll> div;
  for2(i,2,N+1) {
    ll num = i;
    for (auto p : prime) {
      while (num % p == 0) {
        div[p]++;
        num /= p;
      }
      if (num == 1) break;
    }
  }
  for (const auto& pa : div) {
    //cout << pa.first << ":" << pa.second << endl;
    ans = (ans * ((pa.second + 1) % MOD)) % MOD;
  }
  cout << ans << endl;
}

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


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

using namespace std;

#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int;
#define ull unsigned long long int;

const int INF = 1e9 + 7;
const int N = 1e5+5;


int main() {

	IO;

	int n;
	cin >> n;
	
	cout << (n==0 ? 1 : 0);

}


Measured memory_bytes: 3620
#include<iostream>

int main(){

    std::string w;
    std::cin >> w;

    char letter;
    int count;
    for (int i = 0; i < 26; ++i)
    {   
        letter = (char)('a' + i); 
        count = 0;
        for (int j = 0; j < w.length(); ++j)
            if (w[j] == letter)
                count++;
        if ((count % 2) > 0)
        {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    std::cout << "Yes" << std::endl;    

    return 0;
}

Measured memory_bytes: 256
def resolve():
    from bisect import bisect_right
    n,m,k=map(int,input().split())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    A,B=[0],[0]
    x,y=0,0
    for i in range(n):
        x+=a[i]
        A.append(x)
    for j in range(m):
        y+=b[j]
        B.append(y)
    ans=0
    for i in range(n+1):
        if A[i]>k:
            break
        bi=bisect_right(B,k-A[i])-1
        ans=max(ans,i+bi)
    print(ans)

if __name__ == '__main__':
    resolve()

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

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            var c = IO.ReadLineToString();
            var ans = (char)(c[0] + 1);

            Console.WriteLine(ans);
            Console.ReadKey();
        }

    }

    static class Func
    {
        static public long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public long Factorial(long a) { return a == 1 ? a : a * Factorial(a - 1); }


        public static double ToAngle(this double radian)
        {
            return (double)(radian * 180 / Math.PI);
        }

        public static double ToRadian(this double angle)
        {
            return (double)(angle * Math.PI / 180);
        }

        static public long Conbination(long n, long m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * Conbination(n - 1, m - 1) / m;
        }

        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    static class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }

        static public int ReadLineToInt() { return int.Parse(Console.ReadLine()); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }

        static public List<int> ReadLineToIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }

        static public List<double> ReadLineToDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }

        static public void WriteStrings(object[] strings) { foreach (var o in strings) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13140
def c_dice_and_coin(N, K):
    ans = 0.0
    for i in range(1, N + 1):
        t, p = 1, 0
        while i * t < K:
            t *= 2
            p += 1
        ans += 1 / (2**p)
    return ans / N

N, K = [int(i) for i in input().split()]
print(c_dice_and_coin(N, K))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

int main() {
    #ifdef LOCAL
    assert(freopen("a.in", "r", stdin));
    #else
    #endif
    ld a, b;
    cin >> a >> b;
    cout.precision(10);
    cout << fixed;
    cout << a * b / (a + b) << '\n';
}


Measured memory_bytes: 256
L = input()

MOD = 10 ** 9 + 7
LEN = len(L)
ans = 0
cnt = 0

for i in range(LEN):
    if L[i] == '1':
        ans += pow(2, cnt, MOD) * pow(3, LEN - i - 1, MOD)
        cnt += 1
ans += pow(2, cnt, MOD)
print(ans % MOD)


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<ll,ll> P;

ll ans[] = {4,4,9,4,7,10,18,5,21,8,16,11,11,19,19,6,14,22,22,9,9,17,17,12,25,12,113,20,20,20,108,7,28,15,15,23,23,23,36,10,111,10,31,18,18,18,106,13,26,26,26,13,13,114,114,21,34,21,34,21,21,109,109,8,29,29,29,16,16,16,104,24,117,24,16,24,24,37,37,11,24,112,112,11,11,32,32,19,32,19,94,19,19,107,107,14,120,27,27,27};
set<ll> s;

int main(){

	fastcin();
	int s;cin >> s;cout << ans[s-1] << '\n';

	return 0;
}


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

int main(){
	set<string> gacha;
	int n;
	cin>>n;
	string s;
	
	while(n--){
		cin>>s;
		gacha.insert(s);
	}
	
	cout<<gacha.size()<<endl;
	return 0;
}

Measured memory_bytes: 19224
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;

void main()
{
	while (1) {
		auto x = readln.chomp.to!int;
		if (!x) break;
		int cnt;
		while (x != 1) {
			if (x % 2) x = x * 3 + 1;
			else x /= 2;
			cnt++;
		}
		cnt.writeln;
	}
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> v1;
typedef vector<v1> v2;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll mod = 1000000007;
const ll INF = 1ll << 50;


ll g[301][301];
ll h[301][301];
ll n,m,l;
ll q;
ll s,t;
priority_queue<v1,vector<v1>,greater<v1>> pq;
ll visit[301];
ll ans = -1;

int main(){
  cin >> n >> m >> l;
  for(ll i = 0;i <= n;i++){
    for(ll j = 0;j <= n;j++){
      g[i][j] = INF;
    }
  }
  for(ll i = 0;i < m;i++){
    ll a,b,c;
    cin >> a >> b >> c;
    g[a][b] = g[b][a] = c;
  }
  for(ll k = 1;k <= n;k++){
    for(ll i = 1;i <= n;i++){
      for(ll j = 1;j <= n;j++){
        g[i][j] = min(g[i][j],g[i][k]+g[k][j]);
      }
    }
  }
  for(ll i = 1;i <= n;i++){
    for(ll j = 1;j <= n;j++){
      h[i][j] = g[i][j] <= l ? 1 : INF;
    }
  }
  for(ll k = 1;k <= n;k++){
    for(ll i = 1;i <= n;i++){
      for(ll j = 1;j <= n;j++){
        h[i][j] = min(h[i][j],h[i][k]+h[k][j]);
      }
    }
  }

  cin >> q;
  for(ll i = 0;i < q;i++){
    cin >> s >> t;
    cout << (h[s][t] == INF ? -1 : h[s][t]-1) << endl;
  }
}


Measured memory_bytes: 1920
import java.util.*;
public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int N = sc.nextInt(), A = sc.nextInt(), B = sc.nextInt();
	    int ans = Math.min(N*A, B);
	    System.out.println(ans);
	}
}

Measured memory_bytes: 35456
import { readFileSync } from 'fs'
function main() {
  const input: string = readFileSync('/dev/stdin', 'utf8')
  const [N, line] = input.split('\n')
  const array = line.trim().split(' ').map(v => parseInt(v))
  let count = 0

  for (let i = 0; i < array.length; i++) {
    if (count >= array.length - i) { 
      break
    } 
    if (i === 0
      || (count === 0 && array[i] > array[i - 1] && array[i] >= array[i + 1])
      || (count === 1 && array[i] > array[i - 1] && array[i] >= array[i + 1] && array[i + 1] >= array[i + 2])
      || (array[i] > array[i - 1] && array[i] >= array[i + 1] && array[i + 1] >= array[i + 2] && array[i + 2] >= array[i + 3])
      ) {
      let localCount = 0
      const thisArray = array.slice(i)
      for (let j = 0; j < thisArray.length; j++) {
        if (thisArray[j] >= thisArray[j + 1]) {
          localCount++
        } else {
          break
        }
      }
      if (localCount > count) count = localCount
    }
  }
  console.log(count)
}
main()

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

int main()
{
	int n;
	cin>>n;
	string a[n+1];
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n-1;i++){
		int len=a[i].length();
		if (a[i][len-1]!=a[i+1][0]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	sort(a,a+n);
	for(int i=1;i<n;i++) if (a[i]==a[i-1]){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

#define N 20

int n;

bool canMake(int A[], int i, int m) {
    if (m == 0) {
        return true;
    }

    if (i == n) {
        return false;
    }

    if (canMake(A, i + 1, m - A[i]) || canMake(A, i + 1, m)) {
        return true;
    } else {
        return false;
    }
}

int main() {
    cin >> n;

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

    int q;
    cin >> q;
    int M[201];
    for (int i = 0; i < q; i++) {
        cin >> M[i];
    }
    for (int i = 0; i < q; i++) {
        if (canMake(A, 0, M[i])) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
}


Measured memory_bytes: 3100