akhauriyash/Code-Regression huggingface dataset:
#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;

vector<vector<pair<int,int>>> g;
int dist[500050];
const int INF=1e9;

void dijkstra(int s,int t){
  for(int i=0;i<g.size();i++) dist[i]=INF;
  dist[s]=0;
  priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> PQ;
  PQ.push(mkp(0,s));
  
  while(!PQ.empty()){
    auto f=PQ.top();
    PQ.pop();

    int now=f.second;
    int cost=f.first;
    if(dist[now]<cost) continue;
    if(now==t) return;

    for(int i=0;i<g[now].size();i++){
      int nex=g[now][i].first;
      int neco=g[now][i].second;
      if(dist[nex]>dist[now]+neco){
        dist[nex]=dist[now]+neco;
        PQ.push(mkp(dist[nex],nex));
      }
    }
  }
  return;
}

int main(){
  int X,Y,Z,N,M,S,T;
  cin>>X>>Y>>Z>>N>>M>>S>>T;
  vector<int> A(N),B(N);
  rep(i,N) cin>>A[i]>>B[i];
  vector<int> C(M),D(M);
  rep(i,M) cin>>C[i]>>D[i];

  g.resize(N+M+X+Y+Z+1);
  for(int i=0;i<N;i++){
    A[i]--;B[i]--;
    g[i].push_back(mkp(N+M+A[i],0));
    g[N+M+A[i]].push_back(mkp(i,1));
    g[i].push_back(mkp(N+M+X+B[i],0));
    g[N+M+X+B[i]].push_back(mkp(i,1));
  }
  for(int i=0;i<M;i++){
    C[i]--;D[i]--;
    g[N+i].push_back(mkp(N+M+X+C[i],0));
    g[N+M+X+C[i]].push_back(mkp(N+i,1));
    g[N+i].push_back(mkp(N+M+X+Y+D[i],0));
    g[N+M+X+Y+D[i]].push_back(mkp(N+i,1));
  }

  S--;T--;
  dijkstra(S,N+T);
  if(dist[N+T]==INF) cout<<-1<<endl;
  else cout<<dist[N+T]<<endl;

  return 0;
}



Measured memory_bytes: 32304
import java.util.*;

public class Main {
    static boolean solve(int i, int m, int n, int A[]) {
        if(m == 0) return true;
        if(i >= n) return false;
        return solve(i + 1, m, n, A) || solve(i + 1, m - A[i], n, A);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A;
        A = new int[n]; 
        for(int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        for(int i = 0; i < q; i++) {
            int m = sc.nextInt();
            if(solve(0, m, n, A)) System.out.println("yes");
            else System.out.println("no");
        }
    }
}


Measured memory_bytes: 26796
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#include<deque>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

int main() {
	//七日目

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

	int n = 0;
	bool nomake = false;
	int a[100000] = {};
	map<int, int> m;
	ll ans = 1;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		m[a[i]]++;
	}
	if (n % 2 == 1) {
		if (m[0] > 1) {
			nomake = true;
		}
		for (int i = 2; i <= n - 1; i += 2) {
			if (m[i] != 2) {
				nomake = true;
			}
		}
		for (int i = 1; i < n; i += 2) {
			ans *= 2;
			ans = ans % MOD;
		}
	}
	else {
		for (int i = 1; i < n - 1; i += 2) {
			if (m[i] != 2) {
				nomake = true;
			}
		}
		for (int i = 2; i <= n; i += 2) {
			ans *= 2;
			ans = ans % MOD;
		}
	}
	if (nomake == true) {
		cout << 0 << endl;
		return 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  string s;
  cin>>s;
  vector<int> cnt(n),vec(n);
  for (int i = 0; i < n; ++i)
  {
    vec[i]=s[i]-'0';
  }

  set<int> st;
  for (int i = n-1; i >= 0; --i)
  {
    cnt[i]=st.size();
    st.insert(vec[i]);
  }
  int64_t ans=0;
  set<int> top;
  for (int i = 0; i < n-2; ++i)
  {
    if(top.find(vec[i])!=top.end()) continue;
    set<int> tmp;
    int j=1;
    while(tmp.size()!=cnt[i])
    {
      if(tmp.find(vec[i+j])!=tmp.end())
      {
        j++;
        continue;
      }
      tmp.insert(vec[i+j]);
      ans+=cnt[i+j];
      j++;
    }
    top.insert(vec[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] t = new int[n];
        for (int i = 0; i < n; i++) {
            t[i] = Integer.parseInt(sc.next());
        }
        int m = Integer.parseInt(sc.next());
        int[] p = new int[m];
        int[] x = new int[m];
        for (int i = 0; i < m; i++) {
            p[i] = Integer.parseInt(sc.next());
            x[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        int sum = Arrays.stream(t).sum();
        String[] time = new String[m];
        for (int i = 0; i < m; i++) {
            int diff = t[p[i] - 1] - x[i];
            time[i] = Integer.toString(sum - diff);
        }

        String result = String.join("\n", time);

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 27092
#include <iostream>
using namespace std;
int main(void){
    // Your code here!

    int a,b;
    char op;
    
    cin >>a>>op>>b;
    
    while(op != '?'){
        switch (op){
            case '+':
            cout <<a+b<<endl;
            break;
            case '-':
            cout <<a-b<<endl;
            break;
            case '*':
            cout <<a*b<<endl;
            break;
            case '/':
            cout <<a/b<<endl;
            break;
            
        }
        cin >>a>>op>>b;
    }
    
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n, k; cin >> n >> k;
  vector<bool> v(15, true);
  rep(i, k){
    int a; cin >> a;
    v[a] = false;
  }
  for(int i = 1; i <= 100000; i++){
    int j = i;
    bool f = true;
    while(j > 0){
      int k = j % 10;
      j/=10;
      if(!v[k])f = false;
    }
    if(f && i >= n){
      cout << i << endl;
      system("pause");
      return 0;
    }
  }
  system("pause");
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=2;i<n;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
#define stringc(s) string s; cin >> s;
using namespace std;
int main() {
  stringc(s);
  string a="No";
  r1(i, 3) if (s.at(i)=='7') a="Yes";
  cout << a << endl;
}


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

int main(){
int h,m,s,ah,am,as,x;
for(int i=0;i<=2;i++){
cin>>h>>m>>s>>ah>>am>>as;
as=as-s;
if(as<0){
as=60+as;
am-=1;
}
am=am-m;
if(am<0){
am=60+am;
ah-=1;
}
ah=ah-h;
cout<<ah<<' '<<am<<' '<<as<<'\n';
}
return 0;
}

Measured memory_bytes: 1160
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) ((int)(x).size())
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1e9;
// const ll INF = 1e15;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------


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

  int N;
  cin >> N;

  VI s(N);
  int sum = 0;
  REP(i, N) {
    cin >> s[i];
    sum += s[i];
  }

  if (sum % 10 > 0) {
    cout << sum << endl;
    return 0;
  }

  SORT(s);
  REP(i, N) {
    if (s[i] % 10 > 0) {
      cout << sum - s[i] << endl;
      return 0;
    }
  }

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

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
  int n,a[210],flag,ans=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  while(1){
    for(int i=0;i<n;i++){
      if(a[i]%2){
        printf("%d\n",ans);
        return 0;
      }
      a[i]/=2;
    }
    ans++;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int r,s,p;
int ci(char c){
  if(c=='r') return p;
  else if(c=='s') return r;
  else return s;
}

int main(){
  int i,j;
  int n,k;
  cin>>n>>k;
  cin>>r>>s>>p;
  string t;
  cin>>t;
  vector<char> a(n);
  ll ans=0;
  for(i=0;i<n;i++){
    if(i-k<0){
      ans+=ci(t[i]);
      a[i]=t[i];
    }
    else if(a[i-k]==t[i]){
      a[i]='x';
    }
    else {
      ans+=ci(t[i]);
      a[i]=t[i];
    }
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 512
while 1:
 n=int(input())
 if n==0:break;
 a=[]
 for i in range(n):
  a+=[list(map(int,input().split()))]
  a[i]+=[sum(a[i])]
  for s in a[i]:print("%5d"%s,end='')
  print()
 for c in zip(*a):print("%5d"%sum(c),end='')
 print()


Measured memory_bytes: 5600
def II(): return int(input())
def LMI(): return list(map(int,input().split()))

n=II()
dice=[LMI() for _ in range(n)]
flag=0
for i in range(n-2):
    if dice[i][0]==dice[i][1]:
        if dice[i+1][0]==dice[i+1][1]:
            if dice[i+2][0]==dice[i+2][1]:
                flag+=1

if flag>0:
    print("Yes")
else:
    print("No")

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

int main () {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b, k = 0;
  cin >> n;
  vector<vector<int> > G(n + 1);
  vector<pair<int, int> > vp;
  for (int i = 1; i < n; ++i) {
    cin >> a >> b;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
    vp.emplace_back(a, b);
  }
  
  map<pair<int, int>, int> m;
  vector<int> used(n+1, 0), pre_line(n+1, 0);
  queue<int> q; q.push(1);
  used[1] = 1;
  while (!q.empty()) {
    int u = q.front(); q.pop();
    int color = 1;
    if (G[u].size() > k) k = G[u].size();
    for (auto v : G[u]) {
      if (used[v]) continue;
      if (pre_line[u] == color) ++color;
      pre_line[v] = m[make_pair(u, v)] = m[make_pair(v, u)] = color++;
      used[v] = 1;
      q.push(v);
    }
  }
  cout << k << endl;
  for (auto elem : vp) {
    cout << m[elem] << endl;
  }
}

Measured memory_bytes: 20088
#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;

int main()
{
    Bint n, sum = 0, dig = 0;

    cin >> n;
    if (n % 9 == 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}


Measured memory_bytes: 3728
#include<iostream>
using namespace std;
#include<iomanip>
#define _USE_MATH_DEFINES
#include<cmath>
#include<numeric>
#include<algorithm>

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

    int *a = new int[n];
    long long sum = 0;
    for (int i =0;i<n;i++){
        cin >> a[i];
        sum += a[i];
    }
    int *min = min_element(a,a+n);
    int *max = max_element(a,a+n);
/*    int sum = accumulate(a,a+n,0); */
    cout << *min << " ";
    cout << *max << " ";
    cout << sum << endl;

    delete[] a;

    return 0;
}

Measured memory_bytes: 3128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 0x7fffffff
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
const int MAX=1e5+10;
const double eps=1e-6;

int n,cnt=0;
int s[100];

void dfs(int node,int flag){
	if(node==n){
		if(flag%2==0)
			cnt++;
		//cout<<flag<<endl;
		return;
	}
	dfs(node+1,flag*s[node+1]);
	dfs(node+1,flag*(s[node+1]-1));
	dfs(node+1,flag*(s[node+1]+1));
	return;
}

int main(){
    #ifdef ONLINE_JUDGE
    #else
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    #endif

    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>s[i];
    }
    dfs(1,s[1]);
    dfs(1,s[1]-1);
    dfs(1,s[1]+1);
    cout<<cnt<<endl;

    return 0;	
}

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

int main() {
    int n, k, s = 1;

    cin >> n >> k;

    for (int i = 0; i < n; ++i) {
        if (s * 2 > s + k)
            s += k;
        else
            s *= 2;
    }

    cout << s;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int input1;
	int input2;
	char input3[102];
	
	scanf("%d %d", &input1, &input2);
	scanf("%s", input3);
	
	input3[input2-1] = input3[input2-1] + 32;
	
	printf("%s", input3);
	
	return 0;
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

void dump(vector<int> &v) {
  REP(i, v.size()) {
    cout << v[i];
    if (i != v.size() - 1) cout << " ";
  }
  cout << endl;
}

void insert_sort(vector<int> &A) {
  FOR(i, 1, A.size()) {
    auto v = A[i];
    auto j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    dump(A);
  }
}

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  dump(A);
  insert_sort(A);
}



Measured memory_bytes: 3100
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 5e3 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b, c;
	cin >> a >> b >> c;
	for (int i = 0; i <= b; i++)
	{
		if (i * a % b == c)
			puts("YES"), exit(0);
	}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x,y,a,b,c; 
multiset<long long> strong,weak;
multiset<long long>::iterator it;
vector<long long> v;
long long tttt,p[100100],q[100100],r[100100],sp,sr,tot_red,tot_green;
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	cin>>x>>y>>a>>b>>c;
	for(int i=1;i<=a;i++)
		cin>>p[i];
	for(int i=1;i<=b;i++)
		cin>>q[i];
	for(int i=1;i<=c;i++)
		cin>>r[i];
	sort(p+1,p+a+1);
	reverse(p+1,p+a+1);
	sort(q+1,q+b+1);
	reverse(q+1,q+b+1);
	sort(r+1,r+c+1);
	reverse(r+1,r+c+1);
	//get red apples first
	for(int i=1;i<=x;i++){
		sp+=p[i];
	}
	for(int i=1;i<=c;i++){
		v.push_back(r[i]);
	}
	for(int i=1;i<=y;i++){
		v.push_back(q[i]);
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for(int i=0;i<y;i++){
		strong.insert(v[i]);
		tot_green+=v[i];
	}
	for(int i=y;i<v.size();i++)
		weak.insert(v[i]);
	long long res=0LL;
	for(int i=0;i<=min(x,c);i++){
		//pick i-Reds in R
		tot_red=sp+sr;
		sp-=p[x-i];
		sr+=r[i+1];
		if(!strong.count(r[i])){
		}
		else if(weak.count(r[i])){
			it=weak.find(r[i]);
			weak.erase(it);
		}
		else{
			it=strong.find(r[i]);
			strong.erase(it);
			tot_green-=r[i];
			tttt=*weak.rbegin();
			strong.insert(tttt);
			it=weak.find(tttt);
			weak.erase(it);
			tot_green+=tttt;
		}
		res=max(res,tot_red+tot_green);
	}
	cout<<res<<endl;
	return 0;
}


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

using namespace std;

int main(){


	int N;
	int kusi[300];


	cin >> N;
	

	for(int i=0; i<2*N; i++){

		cin >> kusi[i];
	}

	sort(kusi,kusi+(2*N));
	int ans=0;
	
		for(int i=0; i<2*N; i++){

		if(i%2 == 0 || i==0){
			
			ans +=kusi[i];
		}
	}

	cout <<ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


int main(){
    LL h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    LL ans = (h2*60+m2-h1*60-m1 + 60*24)%(60*24) - k;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3192
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			sum += max(sc.nextInt(), 40);
		}
		System.out.println(sum / 5);
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

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

Measured memory_bytes: 17308
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String[] s = S.split("");
    if (s[2].equals(s[3]) && s[4].equals(s[5])){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 35500
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = nextInt()
    var d = mutableListOf<Int>()

    repeat(n) {
        d.add(nextInt())
    }

    println(d.toSet().size)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()

fun println(value : Any) {
    pw.println(value)
}

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

int is_prime(int n)
{
    for(int i = 2;i * i <= n;i++)
        if(n % i == 0) 
            return 0;
    return 1;
}
int prime[1002];
ll mod = 1e9 + 7;
int main()
{
    int n,p[1002];
    int count = 0;
    for(int i = 2;i <= 1002;i++)
        if(is_prime(i)) 
            prime[count++] = i;
    ll res;
    while(cin >> n)
    {
        res = 1;
        memset(p,0,sizeof(p));
        int maxp=0;
        for(int i = 1;i <= n;i++)
        {
            int m = i;
            for(int j = 0;j < count;j++)
                while( m % prime[j] == 0)
                {
                    m /= prime[j];
                    p[j]++;
                    if( j > maxp)
                    maxp = j;
                }
        }
        for(int i = 0;i <= maxp;i++)
            res = (res * (p[i] + 1)) % mod;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 256
(defun split (str)
  (labels ((inner (rest-str-list stack-str-list temp-out)
                  (if rest-str-list
                      (let ((now-char (car rest-str-list)))
                        (cond ((eq #\space now-char) (inner (cdr rest-str-list)
                                                            '()
                                                            (cons (concatenate 'string (reverse stack-str-list))
                                                                  temp-out)))
                              (t (inner (cdr rest-str-list)
                                        (cons now-char stack-str-list)
                                        temp-out))))
                      (reverse (cons (concatenate 'string (reverse stack-str-list))
                                     temp-out)))))
          (inner (concatenate 'list str)
                 '()
                 '())))

(defun input-to-list (str)
  (mapcar #'parse-integer (split str)))

(defvar bingo-card (loop for i from 0 to 2
                         collect (input-to-list (read-line))))
(defvar n (read))
(defvar hit-nums (loop for i from 1 to n
                       collect (read)))

(defun hit (card num)
  (loop for line in card
        collect (loop for a in line
                      collect (if (eq num a)
                                  0
                                  a))))

(defun mark (card nums)
  (if nums
      (mark (hit card (car nums)) (cdr nums))
      card))

(defun line-checkp (line)
  (if (zerop (apply #'+ line))
      line
      nil))

(defun pick (card)
  (concatenate 'list
               card
               (loop for i from 0 to 2
                     collect (loop for line in card
                                   collect (nth i line)))
               (list (loop for i from 0 to 2
                           collect (nth i (nth i card)))
                     (loop for i from 0 to 2
                           collect (nth (- 2 i) (nth i card))))))

(princ (if (some #'line-checkp (pick (mark bingo-card hit-nums)))
           "Yes"
           "No"))

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

using namespace std;
using Int = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string a, b;
  cin >> a >> b;
  int n = (int) a.length();
  int m = (int) b.length();
  vector<vector<int>> dp(n + 1, vector<int>(m + 1));
  for(int i = 1; i <= n; ++i) {
    for(int j = 1; j <= m; ++j) {
      if(a[i - 1] == b[j - 1]) {
        dp[i][j] = 1 + dp[i - 1][j - 1];
      } else {
        dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
      }
    }
  }
  string res = "";
  int x = n, y = m;
  while(x >= 1 && y >= 1) {
    if(a[x - 1] != b[y - 1]) {
      if(dp[x - 1][y] > dp[x][y - 1]) x--;
      else y--;
    } else {
      res += a[x - 1];
      x--, y--;
    }
  }
  reverse(res.begin(), res.end());
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  b=0;
  cin>>a;
  vector<int> vec(a);
  for(int i=0;i<a;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int d=101;
  for(int j=a-1;j>=0;j--){
    if(d>vec.at(j)){
      d=vec.at(j);
      b++;
    }
    else if(d==vec.at(j)){
      continue;
    }
  }
  cout<<b<<endl;
}

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

int main() {
	int n;cin>>n;
	vector<string> s(n);
	for(int i=0; i<n; i++){
		cin >> s.at(i);
	}
	sort(s.begin(),s.end());
	s.erase(unique(s.begin(),s.end()),s.end());
	cout << s.size() << endl;
}


Measured memory_bytes: 9548
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    if(str[str.length()-1]!='s')
    {
        str+="s";
    }
    else
    {
        str+="es";
    }
    cout<<str<<endl;
    return 0;
}

Measured memory_bytes: 3576
n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
    x2, y2, h2 = map(int, input().split())
    x[i] = x2
    y[i] = y2
    h[i] = h2
ans = [0,0,0]
for i in range(101):
    for j in range(101):
        l = 0
        while h[l] == 0:
            l += 1
        #print(l)
        val = h[l] + abs(i-x[l]) + abs(j-y[l])
        flg = True
        for k in range(n):
            if val != h[k] + abs(i-x[k]) + abs(j-y[k]) and h[k] != 0:
                flg = False
            if h[k] == 0 and abs(i-x[k]) + abs(j-y[k]) < val:
                flg = False
        if flg == True:
            ans = [i,j,val]
print(' '.join(map(str,ans)))


Measured memory_bytes: 3064
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    string pat = "";
    for(int i=0; i<26; i++) pat += (char)('a' + i);
    for(int i=0; i<26; i++) pat += (char)('A' + i);

    const int S = 52;
    int N;
    while(cin >> N, N) {
        vector<int> K(N);
        for(int i=0; i<N; i++) cin >> K[i];

        string ans = "";
        string s; cin >> s;
        int len = s.length();
        for(int i=0; i<len; i++) {
            int idx = pat.find(s[i]);
            int val = K[i % N];
            val %= S;
            idx = (idx - val + S) % S;
            ans += pat[idx];
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int a, b, x;
  cin >> a >> b >> x;
  if (a <= x && x <= a+b) {
    dump("YES");
  }
  else {
    dump("NO");
  }
  return 0;
}


Measured memory_bytes: 256
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
    Mbak Seulgi Dong
*/
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod = 1e9+7;
int a[200200], b[200200], cnt[200200];
int seulgi[200200];
int main()
{
    int n,i,j,k,x,y,ans,curr,temp,m;
    int tc;
    cin >> n;
    int maxi = 0;
    for(i=1;i<=n;i++) {
        cin >> a[i];
        cnt[a[i]]++;
        maxi = max(maxi, cnt[a[i]]);
    }
    for(i=1;i<=n;i++) {
        cin >> b[i];
        cnt[b[i]]++;
        maxi = max(maxi, cnt[b[i]]);
    }
    for(i=1;i<=n;i++) cnt[i]=0;
    for(i=1;i<=n;i++) cnt[b[i]]++;
    if(maxi > n) {
        printf("No\n");
    } else {
        printf("Yes\n");
        int skip = 0;
        int now = 1;
        i = 1;
        int batas = 0;
        while(1) {
            if(a[i] == b[now]) {
                skip++;
                batas = 0;
                now--;
                if(now < 1) now = n;
                i--;
                if(i < 1) i = n;
            } else {
                now++;
                batas++;
                if(now > n) now = 1;
            }
            i++;
            if(i > n) i = 1;
            if(batas >= n) break;
        }
        for(i=1;i<=n;i++) {
            seulgi[i] = b[(i-skip-1+n)%n+1];
            cout << seulgi[i] << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 6756
def main():
    input_sentence = input().split(" ")[0]
    input_len = len(input_sentence)
    count = 0
    half_ind = input_len//2
    front_st = input_sentence[:half_ind]
    back_st = input_sentence[half_ind:][::-1]
    for (f, b) in zip(front_st, back_st):
        if f != b:
            count += 1
    print(count)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
def main():
    A,B = map(int,input().split())
    if B == 1:
        print(0)
        return
    tap = A
    ans = 1
    while True:
        if tap >= B:
            print(ans)
            return
        tap+=A-1
        ans+=1


if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>

int main()
{
    int n, s[1000];
    double m, a;
    int i;
    
    while(1){
    	scanf("%d", &n);
    	if (n == 0) break;
    	m = 0; a = 0;
        for (i = 0; i < n; i++){
            scanf("%d", &s[i]);
            m += s[i];
        }
        m /= n;
        for (i = 0; i < n; i++){
            a += (s[i] - m) * (s[i] - m);
        }
        a /= n;
        printf("%.8f\n", sqrt(a));    
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a); i > (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod1=1000000007;
ll mod2=67280421310721;
ll mod3=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b%2==1)
		{
			res*=a;
			res%=mod3;
		}
		a*=a;
		a%=mod3;
		b>>=1;
	}
	return res;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		int n;
		cin>>n;
		ll s=0;
		FOR(i,1,n+1)
		{
			if(i%3!=0 && i%5!=0)
			{
				s+=i;
			}
		}
		cout<<s;
	}
	return 0;
}


Measured memory_bytes: 3652
N = int(input())
S = list(input())

LARGE = 998244353

res = 1

cnt_dict = dict()
cnt_dict["R"] = 0
cnt_dict["G"] = 0
cnt_dict["B"] = 0
cnt_dict["GB"] = 0
cnt_dict["BR"] = 0
cnt_dict["RG"] = 0

heap_dict = dict()
heap_dict["GB"] = []
heap_dict["BR"] = []
heap_dict["RG"] = []

inverse = {"R": "GB", "G": "BR", "B": "RG"}

for i in range(3*N):

    # input
    cnt_dict[S[i]] += 1

    if cnt_dict[inverse[S[i]]] > 0:
        res *= heap_dict[inverse[S[i]]].pop() * cnt_dict[inverse[S[i]]]
        res %= LARGE
        cnt_dict[S[i]] -= 1
        cnt_dict[inverse[S[i]]] -= 1
    elif cnt_dict["R"] * cnt_dict["G"] > 0:
        if S[i] == "R":
            heap_dict["RG"].append(cnt_dict["G"])
        else:
            heap_dict["RG"].append(cnt_dict["R"])
        cnt_dict["RG"] += 1
        cnt_dict["R"] -= 1
        cnt_dict["G"] -= 1
    elif cnt_dict["B"] * cnt_dict["R"] > 0:
        if S[i] == "B":
            heap_dict["BR"].append(cnt_dict["R"])
        else:
            heap_dict["BR"].append(cnt_dict["B"])
        cnt_dict["BR"] += 1
        cnt_dict["B"] -= 1
        cnt_dict["R"] -= 1
    elif cnt_dict["G"] * cnt_dict["B"] > 0:
        if S[i] == "G":
            heap_dict["GB"].append(cnt_dict["B"])
        else:
            heap_dict["GB"].append(cnt_dict["G"])
        cnt_dict["GB"] += 1
        cnt_dict["G"] -= 1
        cnt_dict["B"] -= 1

if __name__ == "__main__":
    for i in range(1, N+1):
        res *= i
        res %= LARGE
    print(res)


Measured memory_bytes: 63632
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;


int main(){FIN

    ll n,k;cin>>n>>k;
    vll x(n); REP(i,n) cin>>x[i];
    ll ans =inf;
    for(ll i=0; i+k-1<n; i++){
        ll s = x[i];
        ll g = x[i+k-1];
        ll dis=0;
        if (s>=0) dis=g;
        else if(g<=0) dis=-s;
        else dis = g-s+min(g,-s);
        ans = min(ans,dis); 
        if (s>=0) break;
    }   
    cout<<ans<<endl;
    return 0;
}

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n; cin>>n;
  n%=10; string s;
  if(n==3) s="bon";
  else if(n==0||n==1||n==6||n==8) s="pon";
  else s="hon";
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int64_t path(vector<int64_t> f,vector<int64_t> fi,int p,int r,int c){
  return f.at(r+c)*fi.at(r)%p*fi.at(c)%p;
}
int main(){
  int r1,c1,r2,c2;
  cin>>r1>>c1>>r2>>c2;
  int p=1000000007;
  int n=r2+c2+2;
  vector<int64_t> f(n+1,1);
  for(int i=1;i<=n;i++)
    f.at(i)=f.at(i-1)*i%p;
  vector<int64_t> fi(n+1,1);
  int q=p-2;
  vector<bool> b;
  while(q>0){
    b.push_back(q%2==1);
    q/=2;
  }
  for(int d=(int)b.size()-1;d>=0;d--){
    fi.at(n)=fi.at(n)*fi.at(n)%p;
    if(b.at(d))
      fi.at(n)=fi.at(n)*f.at(n)%p;
  }
  for(int i=n;i>=1;i--)
    fi.at(i-1)=fi.at(i)*i%p;
  cout<<(path(f,fi,p,r2+1,c2+1)-path(f,fi,p,r2+1,c1)-path(f,fi,p,r1,c2+1)+path(f,fi,p,r1,c1)+p*2)%p<<endl;
}

Measured memory_bytes: 159408
# coding: utf-8
from math import ceil
from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
A.sort()
a = A[-1]
ans = ceil(a / 2)
b = float("inf")
for i in range(N-1):
    if abs(b - ans) > abs(A[i] - ans):
        b = A[i]
print(a, b)

Measured memory_bytes: 14428
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		while(scan.hasNext()){
			String strArray[] = scan.nextLine().split(" ");
			String longest = "",most = "";
			int c,r=0,l=0;

			for(String str1: strArray){
				c=0;
				for(String str2: strArray){
					if(str1.equals(str2)){
						c++;
					}
				}
				if(c>r){
					r=c;
					most=str1;
				}
				if(longest.length() < str1.length()){
					longest = str1;
				}
			}
			System.out.println(most + " " + longest);
		}

	}
}

Measured memory_bytes: 16144
import java.util.*;

class Main {
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
 
		int n = sc.nextInt();
		//TreeMapでソートして格納する
		Map<String, Integer> map = new TreeMap<>();
		int max = 1;
 
		for (int i = 0; i < n; i++) {
			String S = sc.next();
			
			//同じものが含まれていなければmapにSと値1を代入
			//同じものが含まれていたら値に+1をして
			//Math.maxで比較してmaxに代入する
			if (map.containsKey(S)) {
				map.put(S, map.get(S) + 1);
				max = Math.max(max, map.get(S));
			} else {
				map.put(S, 1);
			}
		}
		//max値とキーの値が等しければそのキーを出力
		for (String key : map.keySet()) {
			if (max == map.get(key)) {
				System.out.println(key);
			}
		}
	}
} 

Measured memory_bytes: 80692
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int a, p;
    cin >> a >> p;
    p += a * 3;
    int ans = p / 2;
    cout << ans << endl;
}

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

namespace ABC066A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b, c, s;

			string[] word = Console.ReadLine().Split(' ');

			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			c = int.Parse(word[2]);

			//アルゴリズム１
			//int x = a + b;
			//int y = b + c;
			//int z = c + a;

			// x, y, zの最小値
			//s = x;
			//if (y < s) s = y;
			//if (z < s) s = z;
			
			
			
			
			//アルゴリズム２
		   // a, b, cの最大値を求める
			int m = a;
			if (b > m) m = b;
			if (c > m) m = c;

			//最大値を除く金額の和
			s = a + b + c - m;

			Console.WriteLine(s);

			Console.ReadLine();
				
				
		}
	}
}


Measured memory_bytes: 27508
# -*- coding: utf-8 -*-
"""
Created on Sun May 10 20:54:38 2020

@author: Kei
"""


S = input()
T = input()
T2=T[0:len(S)]

#del T2[len(S)]

if T2 == S:
    print("Yes")
else:
    print("No")
    

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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc=new Scanner(System.in);
		ArrayList<Long>nArrayList=new ArrayList<>();
		String N=sc.next();
		String[] n=N.split("");
		Long[] nArray=new Long[n.length];
		long K=sc.nextLong();
		
		for(int i=0;i<n.length;i++) {
			nArray[i]=Long.parseLong(n[i]);
			nArrayList.add(nArray[i]);
		}
		
		for(int i=0;i<K;i++) {
			if(nArrayList.get(i)!=1) {
				System.out.println(nArrayList.get(i));
				break;
			}else if(i==K-1) {
				System.out.println(1);
			}	
		}		
	}

}


Measured memory_bytes: 35892
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      char[] array = s.toCharArray();
      Arrays.sort(array);
      int count = 0;
      for(int i = 1;i < s.length();i++){
      	if(array[i]==array[i-1])count++;
      }
      if(count == 0)System.out.println("yes");
      else System.out.println("no");
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

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

    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double x = H * 2*PI / 12 + M/60 * 2*PI / 12;
    double y = M * 2*PI / 60;
    double theta = min(abs(x-y), 2*PI - abs(x-y));
    double c = A*A + B*B - 2 * A * B * cos(theta);
    cout << sqrt(c) << endl;
}

Measured memory_bytes: 4228
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = Integer.parseInt((""+A) + B);
        if (isSquare(C)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    static boolean isSquare(int n){
        double fsqrt = Math.sqrt(n);
        int m = (int) fsqrt;
        return m*m == n;
    }


    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () {
            s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 23252
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    int a;
    for(auto ch:s) a+=(ch-'0');
    if(a%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    cout << 2*n*3.141592 << endl;
    return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int 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;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path; vl A, T;
//***********//
int main() {
	cin >> N >> K;
	ll R, S, P;
	cin >> R >> S >> P;
	string T;
	cin >> T;
	vl lose(N);
	for (i = 0; i < K; i++) {
		if (T[i] == 'r') {
			ans += P;
		}
		else if (T[i] == 's') {
			ans += R;
		}
		else {
			ans += S;
		}
		lose[i] = 0;
	}
	for (i = K; i < N; i++) {
		if (T[i] == T[i - K] && lose[i-K] == 0) {
			lose[i] = 1;
		}
		else{
			if (T[i] == 'r') {
				ans += P;
			}
			else if (T[i] == 's') {
				ans += R;
			}
			else {
				ans += S;
			}
			lose[i] = 0;
		}
	}
	cout << ans;
}

Measured memory_bytes: 1280
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=998244353;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	llint i,ans=0,n,wa=0;cin>>n;
	map<llint,int>A;
	A[0]=1;
	for(i=0;i<n;i++){
		llint x;cin>>x;wa+=x;
		ans+=A[wa];A[wa]++;
	}
	cout<<ans<<endl;
	return 0;
}


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

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

	vector<double> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}

	while (v.size() >= 2) {
	    sort(v.begin(), v.end());
		double f = v[0];
	    double s = v[1];  
	    v.push_back((f + s) / 2);
	    v.erase(v.begin(), v.begin() + 2);
	}

	cout << v[0] << "\n";
	return 0;
}

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

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

  if(S == "SUN"){
    cout << 7 << endl;
  }else if(S == "MON"){
    cout << 6 << endl;
  }else if(S == "TUE"){
    cout << 5 << endl;
  }else if(S == "WED"){
    cout << 4 << endl;
  }else if(S == "THU"){
    cout << 3 << endl;
  }else if(S == "FRI"){
    cout << 2 << endl;
  }else if(S == "SAT"){
    cout << 1 << endl;
  }
  return 0;
}



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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);

    int N, M, C;
    cin >> N >> M >> C;

    vector<int> bs(M);

    for (int i = 0; i < M; ++i)
        cin >> bs[i];

    int ans = 0;

    while (N--)
    {
        vector<int> as(M);

        for (int i = 0; i < M; ++i)
            cin >> as[i];

        int sum = C;

        for (int i = 0; i < M; ++i)
            sum += as[i]*bs[i];

        ans += sum > 0 ? 1 : 0;
    }
 
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256