akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL<<60;
const long long MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

int main () {

    string s;cin>>s;
    if (s[0]==s[1]&&s[1]==s[2]) {
        cout<<"No"<<endl;
    } else {
        cout<<"Yes"<<endl;
    }

}

Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0], 10);
  var v = input[1].split(" ");
  var c = input[2].split(" ");
  var t = [];
  var a = 0;
  for (var i = 0; i < n; i++) {
    if ((v[i] - c[i]) > 0) {
      a += v[i] - c[i];
    }
  }
  console.log('%d',a);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
template <typename X>
struct Edge{
  int from;
  int to;
  X cost;

  Edge() = default;

  Edge(int from, int to, X cost = 1) : from(from), to(to), cost(cost) {}
};

template <typename X>
class Graph{
private:
  int n;
  int m;
  vector<vector<Edge<X>>> edge;
  vector<vector<X>> d;
  X inf = 1e+17;
  
public:
  Graph(int n) : n(n) {
    edge.resize(n);
  }

  Graph(int n, int m, vector<int> a, vector<int> b, vector<X> c) : n(n), m(m){
    edge.resize(n);
    rep(i,m) {
      add_edge(a[i], b[i], c[i]);
      add_edge(b[i], a[i], c[i]);
    }
  }

  void add_edge(int from, int to, X cost = 1) {
    edge[from].emplace_back(from, to, cost);
  }

  void dijkstra(int s) {
    d.resize(n);
    d[s].resize(n ,inf);
    d[s][s] = 0;
    using pi = pair<int, X>;
    // auto compare = [](const pi& a, const pi& b) -> bool { return a.second < b.second; };
    priority_queue<pi, vector<pi>, greater<pi>> pq;
    pq.emplace(s, 0);
    while( !pq.empty() ) {
      pi p = pq.top(); pq.pop();
      int v = p.first; // 頂点
      X dist = p.second; // s->vの最短距離
      if(d[s][v] < p.second) continue;
      for(auto w: edge[v]) {
	if(chmin(d[s][w.to], d[s][v] + w.cost)) {
	  pq.emplace(w.to, d[s][w.to]);
	}
      }
    }
  }

  X get_d(int u, int v) { return d[u][v]; }
  X get_inf() { return inf; }
  
};

int main()
{
  int n,m,s,t;cin >> n >> m >> s >> t;
  s--; t--;
  vector<int> u(m), v(m);
  vector<ll> a(m), b(m);
  rep(i,m) {
    cin >> u[i] >> v[i] >> a[i] >> b[i];
    u[i]--; v[i]--;
  }

  Graph<ll> gpen(n, m, u, v, a);
  Graph<ll> gpsn(n, m, u, v, b);

  gpen.dijkstra(s);
  gpsn.dijkstra(t);

  vector<ll> res(n);
  rep(i,n) {
    res[i] = gpen.get_d(s, i) + gpsn.get_d(t, i);
  }

  ll M = 1e+15;
  ll tmp = M;
  vector<ll> ans(n);
  for(int i = n - 1;i >= 0;--i) {
    tmp = min(tmp, res[i]);
    ans[i] = M - tmp;
  }

  rep(i,n) cout << ans[i] << "\n";
  
  
  return 0;
}


Measured memory_bytes: 28332
import java.util.Scanner;
import java.lang.Math;
public class Main {
  public static void main (String[]args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    int h = sc.nextInt(); 
    int w = sc.nextInt();
    int white_cells = H*W; //はじめの白ますの数
    white_cells -= h*W; //ｈ行分塗りつぶす
    white_cells -= w*(H-h);//ｗ＊（H-h）個塗りつぶす
    System.out.println(white_cells);

  
  }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  
  vector<int> vote(N);  // N個の票数データ
  
  // 票数データを受け取る(入力)
   for (int i = 0; i < N; i++) {
    cin >> vote.at(i);
   }
  
  // 総投票数をsumとおく
  int sum = 0;
  
    for (int i = 0; i < N; i++) {
    sum += vote.at(i);
  }
  
  // 配列の中で1/4M以上のものの個数を数える(＝aとおく)
int a = 0;

 for (int i = 0; i < N; i++) {
   if (vote.at(i) * (M*4) >= sum) {
     a++;
   }
 }
  
   if (a < M) {
    cout << "No" << endl;
  }
  
  else {   
    cout << "Yes" << endl;
  }
  
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

using namespace std;
typedef long long ll;

int p[103];

int main()
{
    FAST_IO;
    int n;
    cin >> n;
    p[0] = 0;
    for (int i = 1; i <= n; i++) {
        cin >> p[i];
        p[i] += p[i-1];
    }
    int ans = 1e9 + 7;
    for (int i = 2; i <= n; i++)
        if (abs(p[n] - 2*p[i]) < ans)
            ans = abs(p[n] - 2*p[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
//1000000000000223
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int n ;
ld x[60], y[60], ans;
ld solve(ld xx, ld yy)
{
    ld ans=0;
    for(int i=1; i<=n; i++)
        ans=max(ans,hypot(xx-x[i],yy-y[i]));
    return ans;
}
ld solve2(ld xx)
{
    ld low=-1e3, high=1e3, m1, m2, cur;
    for(int i=1; i<=70; i++)
    {
        m1=low+(high-low)/3;
        m2=high-(high-low)/3;
        ld ans1=solve(xx,m1), ans2=solve(xx,m2);
        cur=min(ans1,ans2);
        if(ans1<ans2)
            high=m2;
        else
            low=m1;
    }
    return cur;
}
ld solve1()
{
    ld low=-1e3, high=1e3, m1, m2;
    for(int i=1; i<=70; i++)
    {
        m1=low+(high-low)/3;
        m2=high-(high-low)/3;
        ld ans1=solve2(m1), ans2=solve2(m2);
        ans=min(ans1,ans2);
        if(ans1<ans2)
            high=m2;
        else
            low=m1;
    }
    return ans;
}
int main()
{
    IO
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>x[i]>>y[i];
    cout<<fixed<<setprecision(10)<<solve1();
    return 0;
}


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

int main(int argc, char *argv[])
{
    int a, b, c;
    
    std::cin >> a >> b >> c;

    if ((a == b && a != c)||(a == c && a != b)||(b == c && a != b)) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<max(0,c-(a-b))<<endl;
  return(0);
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"go/token"
	"go/types"
	"os"
	"strings"
)

var stdin = bufio.NewScanner(os.Stdin)
var op = []string{"+", "-"}

func main() {
	stdin.Scan()
	arr := strings.Split(stdin.Text(), "")
	for i := 0; i < 2; i++ {
		for j := 0; j < 2; j++ {
			for k := 0; k < 2; k++ {
				ev := arr[0] + op[i] + arr[1] + op[j] + arr[2] + op[k] + arr[3]
				result, _ := types.Eval(token.NewFileSet(), nil, token.NoPos, ev)
				if fmt.Sprintf("%v", result.Value) == "7" {
					fmt.Println(ev + "=7")
					return
				}
			}
		}
	}
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
main()
{
    ll d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Struct Declaration */
struct node {
  int key;
  struct node *parent;
  struct node *left;
  struct node *right;
};

typedef struct node * NodePointer;

/* Prototype Declaration */
void insert(int);
void printBinaryTree(void);
void printPreorder(NodePointer);
void printInorder(NodePointer);

/* Global variable */
NodePointer root;

/* Main */
int main() {
  int i, n, k;
  char command[15];

  root = (NodePointer)malloc(sizeof(struct node));
  root = NULL;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) {
    scanf("%s", command);
    if ( strcmp(command, "insert") == 0 ) {
      scanf("%d", &k);
      insert(k);
    }else if ( strcmp(command, "print") == 0 ) {
      printBinaryTree();
    }
  }

  return 0;
}

/* Insert to Binary Tree */
void insert(int keydata) {
  NodePointer x = root;
  NodePointer y = NULL;
  NodePointer z;

  z = (NodePointer)malloc(sizeof(struct node));

  z->key = keydata;
  z->left = NULL;
  z->right = NULL;

  //Set Parent of New Node
  while (x != NULL) {
    y = x;
    if ( z->key < x->key ) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  
  if ( y == NULL ) root = z;
  else {
    if ( z->key < y->key ) y->left = z;
    else y->right = z;
  }
}

/* Print Binary Tree */
void printBinaryTree() {
  //Inorder Walk
  printInorder(root);
  printf("\n");
  //Preorder Walk
  printPreorder(root);
  printf("\n");
}

/* Preorder Walk */
void printPreorder(NodePointer u) {
  if ( u == NULL ) return;

  printf(" %d", u->key);
  printPreorder(u->left);
  printPreorder(u->right);
}

/* Inorder Walk */
void printInorder(NodePointer u) {
  if ( u == NULL ) return;

  printInorder(u->left);
  printf(" %d", u->key);
  printInorder(u->right);
}

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

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i = 0; i < n; i++) cin >> d[i];
  
  int ans = 0;
  for(int i = 0; i < n-1; i++){
    for(int j = i+1; j < n; j++) ans += d[i]*d[j];
  }
  
  cout << ans << endl;
  return 0;
}

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

int main() {
int64_t result=1;
int A,B,C,k,D,b,s;
cin>>A>>B;

map<int,int> m;
map<int,int> n;
 
  
  if(A>=B){s=B;b=A;}
  else{s=A;b=B;}
  
C=A;for(int i=2; i<=b;i++){
	 k=0;m[i]=0;
	while(C%i ==0){k++;
	m[i]=k; C=C/i;        
	}}	
 C=B;for(int i=2; i<=b;i++){
 k=0;n[i]=0;
	while(C%i ==0){k++;
	n[i]=k; C=C/i;
	}}

  if(A>=B){C=B;D=A;}
  else{C=A;D=B;}
 
	for(int i=2; i<=b; i++){  
      
	if(m.at(i)>0 && n.at(i)>0){ 
	  if(m.at(i)>=n.at(i)){for(int j=1;j<=m.at(i);j++){if(result%s ==0 &&result%b ==0){break;}result *= i; }}
	  else{for(int j=1;j<=n.at(i);j++){if(result%s ==0 &&result%b ==0){break;} result *= i;} }}

	if(m.at(i)>0 && n.at(i)==0){for(int j=1;j<=m.at(i);j++){if(result%s ==0 &&result%b ==0){break;} result *= i;}}  
	if(m.at(i)==0 && n.at(i)>0){for(int j=1;j<=n.at(i);j++){if(result%s ==0 &&result%b ==0){break;} result *= i;}}
	 
	}
/*
for(int i=C; i<=D;i++){
  
  if(A>=B){if(m.at(i)>0){for(int j=0;j<m.at(i);j++){result*=i;}}}
  else{if(n.at(i)>0){for(int j=0;j<n.at(i);j++){result*=i;}}}
}*/
	cout<<result<<endl; 
}

Measured memory_bytes: 9600
X = []
Y = []
Z = []
for i in range(3):
    x, y, z = map(int, input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
N = int(input())

b = list(map(int, [input() for i in range(N)]))

for i in range(N):
    
    if X[0] == b[i]:
        X[0] = 'OK'
    if X[1] == b[i]:
        X[1] = 'OK'
    if X[2] == b[i]:
        X[2] = 'OK'
    if Y[0] == b[i]:
        Y[0] = 'OK'
    if Y[1] == b[i]:
        Y[1] = 'OK'
    if Y[2] == b[i]:
        Y[2] = 'OK'
    if Z[0] == b[i]:
        Z[0] = 'OK'
    if Z[1] == b[i]:
        Z[1] = 'OK'
    if Z[2] == b[i]:
        Z[2] = 'OK'

if (X[0] == X[1] == X[2]
    or Y[0] == Y[1] == Y[2]
    or Z[0] == Z[1] == Z[2]
    or X[0] == Y[0] == Z[0]
    or X[1] == Y[1] == Z[1]
    or X[2] == Y[2] == Z[2]
    or X[0] == Y[1] == Z[2]
    or X[2] == Y[1] == Z[0]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
 
    int N; cin >> N; ll K; cin >> K;
    ll sum = 0;
    ll data[N];
    F0R(i, N) cin >> data[i];
    F0R(i, N) sum += data[i];
    vl facs;
    FOR(i, 1, 25000) {
        if (sum % i == 0) {
            ll A = i;
            ll B = sum / i;
            facs.pb(A);
            facs.pb(B);
        }
    }
 
    ll ans = 1;
    F0R(i, sz(facs)) {
        multiset<ll> vals;
        ll totalCost = 0;
        ll used = 0;
 
        F0R(j, N) {
            vals.insert(data[j] % facs[i]);
            totalCost += facs[i] - (data[j] % facs[i]);
        }
        for (auto it = vals.begin(); it != vals.end(); it++) {
            used += *it;
            totalCost -= facs[i] - *it;
            if (used == totalCost && used <= K) ans = max(ans, facs[i]);
        }
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
void fst()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
 
                                                                                                                                                                                       
 
int32_t main()
{
    int a;
    cin>>a;
    cout<<a +a*a + a*a*a;
}

Measured memory_bytes: 3612
a = input().split()
b = input().split()
c = input().split()
n = int(input())
key = []
ans = []
for i in range(n):
    key.append(input())
for i in key:
    if i in a:
        ans.append(a.index(i)+1)
for i in key:
    if i in b:
        ans.append(b.index(i)+4)
for i in key:
    if i in c:
        ans.append(c.index(i)+7)
ans.sort()
x = 0
if 1 in ans and 2 in ans and 3 in ans:
    x += 1
if 4 in ans and 5 in ans and 6 in ans:
    x += 1
if 7 in ans and 8 in ans and 9 in ans:
    x += 1
if 1 in ans and 4 in ans and 7 in ans:
    x += 1
if 2 in ans and 5 in ans and 8 in ans:
    x += 1
if 3 in ans and 6 in ans and 9 in ans:
    x += 1
if 1 in ans and 5 in ans and 9 in ans:
    x += 1
if 3 in ans and 5 in ans and 7 in ans:
    x += 1
if x > 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  ll K;
  cin >> K;
  vl A(K);
  rep(i,K) {
    cin >> A[i];
  }
  reverse(rng(A));
  if(A[0] > 2) {
    cout << -1 << endl;
    return 0;
  }
  ll a = A[0];
  ll b = 2*A[0]-1;
  srep(i,1,K) {
    if(A[i-1] == A[i]) continue;
    ll bb = b;
    ll ba = a;
    ll x = (A[i-1]+(b/A[i-1])*A[i-1])/A[i];
    if(A[i]*x >= A[i-1]+(b/A[i-1])*A[i-1]) {
      x--;
    }
    ll y = A[i]-1;
    b = A[i]*x+y;
    if(A[i] >= a) {
      a = A[i];
    } else {
      a = ((a+A[i]-1)/A[i])*A[i];
    }
    if(a > (bb)) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(void){
   int h,n,i;
   scanf("%d %d",&h,&n);
   int a[n];
   for(i=0;i<n;i++){
      scanf("%d",&a[i]);
      h-=a[i];
   }
   if(h<=0){
      printf("Yes\n");
   } else {
      printf("No\n");
   }
   return 0;
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define INF 999999999
typedef long long ll;
using namespace std;
int main() {
    int N, A;
    cin >> N >> A;
    cout << N*N - A << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define F first
#define S second
#define rep(i, st, ed) for(ll i=st; i<ed; ++i)
#define repn(i, st, ed) for(ll i=st; i<=ed; ++i)
#define repb(i, ed, st) for(ll i=ed; i>=st; --i)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define PI acosl(-1.0)
#define mp(a, b) make_pair(a, b)
#define eps 1e-9
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int M = 1e9 + 7;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;
ll iv[N];
ll powM(ll a, ll b, ll M = M){ll res = 1;for(;b;a=a*a%M,b/=2) if(b&1) res=res*a%M;return res;}
ll nckbig(int n, int k){ll ans = 1;for(int i=1; i<=k; ++i){ans = ans*(n-i+1)%M*iv[i]%M;}return ans;}
ll caliv(){iv[1] = 1;for(int i=2; i<N; i++){iv[i] = M-M/i*iv[M%i]%M;}}
ll f1[N], f2[N];
ll calf(){f1[0] = f2[0] = 1;for(int i=2; i <N; ++i){f1[i] = f1[i-1]*i%M;f2[i] = f2[i-i]*iv[i]%M;}}
ll nck(int n, int k){return f1[n]*f2[n-k]%M*f2[k]%M;}
ll npk(int n, int k){return f1[n]*f2[n-k]%M;}
ll Rnck(int big){if(big){caliv();}else{calf();}}
int ans[5];
int vis[5];
void solve()
{
  int n, m;
  cin>>n>>m;
  rep(i, 0, m){
    int a, b;
    cin>>a>>b;
    if(vis[a] == 1 && ans[a] != b){
      cout<<-1<<endl;
      return;
    }
    ans[a] = b;
    vis[a] = 1;
  }
  bool ok = true;
  if(n != 1 && ans[1] == 0){
    if(vis[1] == 1){
      cout<<-1<<endl;
      return;
    }
    else ans[1] = 1;
  }
  rep(i, 1, n+1) cout<<ans[i];
  cout<<endl;
}


int main()
{
    FAST
    ll Tests = 1;
    //cin>>Tests;
    while(Tests--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
//26

int a[200000];
signed main(){
	int n, k, mn = INF;
	scanf("%lld%lld", &n,&k);
	rep(i,n)scanf("%lld", &a[i]);
	rep(i,n)chmin(mn, a[i]);
	
	int ans = 0, cnt = 0, p = 0;
	if(k == n)ans = 1;
	else ans = (n+-k+k-2)/(k-1)+1;
	printf("%lld\n", ans);
	return 0;
}





Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a > 9 || b > 9) {
            System.out.println(-1);
        } else {
            System.out.println(a * b);
        }
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
  ll Min = min(a, b);
  ll Max = max(a, b);
  return Min / gcd(a, b) * Max;
}

int main() {
  int N;
  cin >> N;
  vector<ll> T(N);
  rep(i, N) cin >> T[i];

  ll ans = 1;
  rep(i, N) { ans = lcm(ans, T[i]); }
  cout << ans << endl;
}

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

void solve(){

    int n;
    cin>>n;
    vector<int> a(n);
    
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    
    int max = a[0];
    
    long long sum =0;
    for(int i=1; i<n ; i++){
        if(a[i] < max){
            sum += (max-a[i]);
        }
        else if(max < a[i]){
            max = a[i];
        }
    }
    
    cout<<sum<<endl;
return;

}
int main() {
	// your code goes here

        solve();
    
    return 0;
}



Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastInOut ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);  

ll N;
int  main() {
  fastInOut
  cin >> N;
 
	if (N % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}
	
	ll ans = N / 10;
	N /= 10;
 
	ll p5 = 5;
	while (p5 <= N) {
		ans += N / p5;
		p5 = p5 * 5;
	}
	cout << ans << endl;
      return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int K,S;
    cin >> K >>S;
    int X,Y;
    int count=0;
    for(X=0;X<=K;X++){
      for(Y=0;Y<=K;Y++){
        if(S-X-Y>=0 && S-X-Y<=K)count++;
      }
    }
    cout << count;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N;

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

  int ans = pow(N, 3);

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

Measured memory_bytes: 384
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;
ll MODP = 998244353;

ll kai(ll x,ll y){
  if(y == 0)return 1;
  if(y == 1)return x;
  if(y&1){
    return (x*kai(x,y-1))%MOD;
  }else{
    ll t = kai(x,y/2);
    return (t*t)%MOD;
  }
}

ll comb(ll a,ll b,vector<ll> &p){
  if(a == 0)return 1;
  if(b == 0)return 1;
  ll ans = p[a+b];
  ans = (ans*kai(p[a],MOD-2))%MOD;
  ans = (ans*kai(p[b],MOD-2))%MOD;
  return ans;
}

int main(){
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll ans = a*c;
  if(ans < a*d)ans = a*d;
  if(ans < b*c)ans = b*c;
  if(ans < b*d)ans = b*d;
  cout << ans << endl; 

  return 0;
}


Measured memory_bytes: 3620
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
   
#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, x[9], y[9], pos[9];
ld ans;

inline ld dist (int a, int b) {
   return sqrt (sqr (x[a] - x[b]) + sqr (y[a] - y[b]));
}

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n;
   ld res = 1;
   for (int i = 1; i <= n; i ++) cin >> x[i] >> y[i], pos[i] = i, res = res * i;
   do {
      for (int i = 1; i < n; i ++)
         ans += dist (pos[i], pos[i + 1]);
   }while (next_permutation (pos + 1, pos + n + 1));
   cout << fixed << setprecision (9) << ans / res;
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

Measured memory_bytes: 256
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a;
    cin>>a;
    ll ans=a+(a*a)+(a*a*a);
	cout << ans;	
}




Measured memory_bytes: 3652
#include <stdio.h>

int x,y ;

int main(void){

    scanf ("%d%d",&x,&y) ;
    
    if ( x==1 || x==3 || x==5 || x==7 || x==8 || x==10 || x==12 ){
        
        if ( y==1 || y==3 || y==5 || y==7 || y==8 || y==10 || y==12 ) {
            printf ("Yes\n") ;
        } else {
            printf ("No\n") ;
        }
        
    } else if ( x==4 || x==6 || x==9 || x==11 ){
        
        if ( y==4 || y==6 || y==9 || y==11 ){
            printf ("Yes\n") ;
        } else {
            printf ("No\n") ;
        }
        
    } else if ( x==2 ){
        
        if ( y==2 ){
            printf ("Yes\n") ;
        } else {
            printf ("No\n") ;
            
        }
    } else {
        
    }

    return 0 ;
    
}

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

const int N = 1e6 + 100;

vector<int> col[2];
vector<int> G[N];

void dfs(int u, int p, int c = 0) {
    for(int v : G[u]) {
        if(v == p) continue;
        dfs(v, u, c ^ 1);
    }
    col[c].emplace_back(u);
}

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    for(int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs(1, -1);

    if(col[1].size() < col[0].size()) swap(col[0], col[1]);
    vector<int> opts[3];
    for(int i = 1; i <= n; i++) {
        opts[i % 3].push_back(i);
    }
    vector<int> res(n+1);

    if(col[0].size() <= opts[0].size()) {
        while(col[0].size() > 0) {
            int u = col[0].back();
            res[u] = opts[0].back();
            col[0].pop_back();
            opts[0].pop_back();
        }
        for(int f = 0; f < 3; f++) {
            while(opts[f].size() > 0) {
                int u = col[1].back();
                res[u] = opts[f].back();
                col[1].pop_back();
                opts[f].pop_back();
            }
        }
    }
    else {
        while(opts[2].size() > 0) {
            int u = col[0].back();
            res[u] = opts[2].back();
            col[0].pop_back();
            opts[2].pop_back();
        }
        while(col[0].size() > 0) {
            int u = col[0].back();
            res[u] = opts[0].back();
            col[0].pop_back();
            opts[0].pop_back();
        }
        for(int f = 0; f < 3; f++) {
            while(opts[f].size() > 0) {
                int u = col[1].back();
                res[u] = opts[f].back();
                col[1].pop_back();
                opts[f].pop_back();
            }
        }
    }

    for(int i = 1; i <= n; i++) cout << res[i] << " ";

    return 0;
}



Measured memory_bytes: 41076
#include <iostream>
//#include <iomanip>
#include <algorithm>
#include <numeric>
//#include <queue>
#include <math.h>
#include <vector>
//#include <string>
typedef long long LL;
using namespace std;

int main(){
    LL n;
    LL tmp;
    LL num=0;
    LL ans;
    vector<LL> a;
    vector<LL> a_tmp;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp;
        a.push_back(tmp);
        a_tmp.push_back(abs(tmp));
        if(tmp!=abs(tmp)){
            num++;
        }
    }
    sort(a_tmp.begin(),a_tmp.end());
    ans = accumulate(a_tmp.begin(),a_tmp.end(), 0LL);
    if(num%2!=0){
        ans -= a_tmp[0]*2;
    }
    cout << ans << endl;
}

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

using ll = long long;
const ll MOD = 998244353;
const ll INF = 1e18;

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N) {
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    int ans = 0;
    rep(i, N - 2) {
        for (int j = i + 1; j < N - 1; j++) {
            for (int k = j + 1; k < N; k++) {
                if (L[k] < L[i] + L[j]) ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def main(): 
  N = int(input())
  str_num = input().split()

  num_list = []
  for i in str_num:
    num_list.append(int(i))

  num_list.sort(reverse=True)

  ans = num_list[0]

  LIMIT_NUM = 10**18

  if 0 in num_list:
    print(0)
    return

  for i in range(1,N):
    ans *= num_list[i]
    if ans > LIMIT_NUM:
      print(-1)
      return

  print(ans)


main()

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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    if (s[1] == 'B')
        s[1] = 'R';
    else s[1] = 'B';
    cout << s;

    return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;

  int C[VMAX+1];
  int n, i, j;
  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for ( i = 0; i <= VMAX; i++ ) C[i] = 0;

  for ( i = 0; i < n; i++ ){
    scanf("%d", &A[i + 1]);
    C[A[i + 1]]++;
  }

  for ( i = 1; i <= VMAX; i++ ) C[i] = C[i] + C[i - 1];

  for ( j = 1; j <= n; j++ ){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");

  return 0;
}

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

using namespace std;

typedef long long int ll;

inline void deBugMode() {
    #ifndef ONLINE_JUDGE
    freopen("debug.in", "r", stdin);
    #endif // ONLINE_JUDGE
}

inline void optimizeIt() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
}

inline int ABS(const int &x) {
    return max(x, -x);
}

const int NMax = 1e5 + 5;
const int LIM = 1e5;
const int MOD = 1000000007;

int main(){
    //deBugMode();
    optimizeIt();

    int n, m;
    string s;

    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        cin >> s;
        cout << s << "\n" << s << "\n";
    }

    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 998244353
#define INF 10000000000000001
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define vc vector
#define vll vector<long long>
#define pll pair<long long,long long> 
#define pb push_back
#define ll long long
#define all(v) v.begin(),v.end()
#define T ll test;cin>>test; while(test--)
#define rep(i,a,n) for(ll i=a;i<(long long)n;++i)
#define repr(i,n,a) for(ll i=n;i>(long long)a;--i)
#define MAX 1000005
using namespace std;
int main()
{
/*	string s,t;
	int cnt=0;
	cin>>s>>t;
	rep(i,0,3)
	if(s[i]==t[i])
	cnt++;
	cout<<cnt<<endl;*/
	ll a,b;
	cin>>a>>b;
	if((b-1)%(a-1)==0)
	cout<<(b-1)/(a-1);
	else
	cout<<(b-1)/(a-1)+1;
}


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

int main() {
	long int n,d,count=0;
	cin>>n>>d;
	long int a,b;
	for(long int i=0;i<n;i++){
	    cin>>a>>b;
	    if(sqrt(a*a+b*b)<=d) count++;
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 3676
#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4,ansx,ansy;
	int q;
	scanf("%d",&q);

	for(int i=0;i<q;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		ansx = ((x2-x1)*(y3*(x4-x3)+x3*(y3-y4))-(x4-x3)*(y1*(x2-x1)+x1*(y1-y2)))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
		if(x1 != x2){
			ansy = ((y2-y1)*ansx+y1*(x2-x1)+x1*(y1-y2))/(x2-x1);
		}else{
			ansy = ((y4-y3)*ansx+y3*(x4-x3)+x3*(y3-y4))/(x4-x3);
		}
		printf("%.10lf %.10lf\n",ansx,ansy);
	}

    return 0;
}

Measured memory_bytes: 2744
#include <iostream>
using namespace std;
typedef long long ll;
static const ll Z = 1 << 21;
#define rep(i,s,n)for(ll i = s;i<n;i++)
char s[Z];
char t[Z];

int main() {
	cin >> s >> t;
	char* S = &s[0];
	char* T = &t[0];

	while (*S != '\0' && T != '\0') {
		if (*S != '\0')	cout << *S++;
		if (*T != '\0') cout << *T++;
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 2304
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
t=0
for p in ['012345','152304','215043','310542','402351','513240']:
 f=[d[int(j)]for j in p];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])


Measured memory_bytes: 5604
# coding: utf-8

import math

ans = []

while True:
    if int(input()) == 0:
        break
    data = list(map(int, input().strip().split()))
    ave_data = sum(data) / len(data)
    ans += [math.sqrt(sum([(i - ave_data) ** 2 for i in data]) / len(data))]
    
print('\n'.join(map(str, ans)))

Measured memory_bytes: 7732
n, y = map(int, input().split())

for a in range(n+1):
    for b in range(n-a+1):
        c = n-(a+b)
        if y == a*10000+b*5000+c*1000:
            print(a, b, c)
            quit()
        elif y == c*10000+b*5000+a*1000:
            print(c, b, a)
            quit()

print(-1, -1, -1)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<ios>
using namespace std;
int W,n,w,v;
int dp[1001];
int cnt;
main()
{
	while(cin>>W,W)
	{
		cnt++;
		cin>>n;
		for(int i=0;i<=W;i++)dp[i]=0;
		for(int i=0;i<n;i++)
		{
			scanf("%d,%d",&v,&w);
			for(int i=W;i>=w;i--)dp[i]=max(dp[i],dp[i-w]+v);
		}
		while(W>0&&dp[W]==dp[W-1])W--;
		cout<<"Case "<<cnt<<":\n"<<dp[W]<<"\n"<<W<<"\n";
	}
}



Measured memory_bytes: 3160
#include<iostream>
#include<set>
#include<vector>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

// void print(set<char> s) {
//   for (set<char>::iterator it = s.begin(); it != s.end(); it++) {
//     cout << *it << " ";
//   }
//   cout << endl;
// }

int main(){
    int n, q;
    string s;
    cin >> n >> s >> q;
    vector<set<int>> is(26);
    rep(i, n) is[s[i]-'a'].insert(i); 
    rep(qi, q){
        int ty;
        cin >> ty;
        if(ty == 1){
            int i; char c;
            cin >> i >> c;
            i--;
            is[s[i]-'a'].erase(i);
            s[i] = c;
            is[s[i]-'a'].insert(i);
        }else{
            int l, r;
            cin >> l >> r;
            l--;
            int ans = 0;
            rep(i, 26){
                auto it = is[i].lower_bound(l);
                if(it != is[i].end() && *it < r) ans++;
            }
            printf("%d\n", ans);
        }
    }
    return 0;
    // set<char> s;
    // s.insert('a');
    // s.insert('G');
    // s.insert('s');
    // s.insert('l');
    // s.insert('A');
    // s.insert('a');
    // print(s);//AGals

}

Measured memory_bytes: 24312
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,N;
  cin>>H>>N;
  vector <int> A(N);
  for(int i=0;i<N;i++){
  cin>>A.at(i);
  }
  int sum=0;
  for(int i=0;i<N;i++){
  sum+=A.at(i);
  }
  if(H<=sum) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
int n,k,l;
vector<int> Gr[200000];
vector<int> Gt[200000];

int rid[200000];
int tid[200000];

pair<int,int> p[2000000];

void dfs(int i,int j,vector<int> G[],int used[]) {
	used[i] = j;

	REP(k,G[i].size()) {
		if(used[G[i][k]] < 0) {
			dfs(G[i][k],j,G,used);
		}
	} 
}

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

	REP(i,k) {
		int p,q;
		cin >> p >> q;
		p--;q--;

		Gr[p].pb(q);Gr[q].pb(p);
	}
	REP(i,l) {
		int r,s;
		cin >> r >> s;
		r--;s--;

		Gt[r].pb(s);Gt[s].pb(r);
	}


	REP(i,n) {
		rid[i] = -1;
	}
	int c = 0;
	REP(i,n) {
		if(rid[i] < 0) {
			dfs(i,c++,Gr,rid);
		}
	}
	REP(i,n) {
		tid[i] = -1;
	}
	c = 0;
	REP(i,n) {
		if(tid[i] < 0) {
			dfs(i,c++,Gt,tid);
		}
	}

	REP(i,n) {
		p[i] = pair<int,int>(rid[i],tid[i]);
	}
	sort(p,p+n);

	REP(i,n) {
		auto l = lower_bound(p,p + n,pair<int,int>(rid[i],tid[i]));
		auto r = upper_bound(p,p + n,pair<int,int>(rid[i],tid[i]));
		cout << r - l << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 21248
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int getV(string str, int index) {
    return str[index] - '0';
}

int main() {

    string str;
    cin >> str;

    for (int bit = 0; bit < (1 << 3); bit++) {
        int sum = getV(str, 0);
        string ans = "";
        ans += str[0];
        for (int i = 0; i < 3; i++) {
            if (bit & (1 << i)) {
                sum += getV(str, i + 1);
                ans += '+';
                ans += str[i + 1];
            } else {
                sum -= getV(str, i + 1);
                ans += '-';
                ans += str[i + 1];
            }
        }
        if (sum == 7) {
            ans += "=7";
            cout << ans << endl;
            return 0;
        }
    }

    return 0;
}











































































Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Double> list = new ArrayList<Double>();
		String str = "";
		while((str=br.readLine())!=null){
			list.add(Double.parseDouble(str));
		}
		Collections.sort(list);
		System.out.println(list.get(list.size()-1) - list.get(0));
	}
}

Measured memory_bytes: 16980
n, m = [int(c) for c in input().split()]
A = {}
for a in input().split():
    a = int(a)
    A[a] = A.get(a, 0) + 1
# print(A)

for i in range(m):
    b, c = [int(c) for c in input().split()]
    A[c] = A.get(c, 0) + b
# print(A)

A = sorted([(k, v) for k, v in A.items()], reverse=True)
ans, num = 0, n
for k, v in A:
    # print(k, v, min(num, v))
    ans += k * min(num, v)
    num -= min(num, v)
    if num == 0:
        break
print(ans)

Measured memory_bytes: 104728
#include <iostream>
#include <math.h>

using namespace std;

int main() {
	int n;
	double a, b, c;

	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a >> b >> c;

		if(sqrt((a * a) + (b * b)) == c || sqrt((a * a) + (c * c)) == b || sqrt((b * b) + (c * c)) == a) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

Measured memory_bytes: 1220
#include<stdio.h>
#include<string.h>

int main(){
    int n, i, a=0, b=0;
    scanf("%d", &n);
    char s1[n], s2[n];
    for(i=0;i<n;i++){
    scanf("%s %s", s1, s2);
    if ( strcmp(s1, s2) == 0 ){
        a++;
        b++;
    } 
    else if ( strcmp(s1, s2) > 0 ) a=a+3;
    else if ( strcmp(s1, s2) < 0 ) b=b+3;
    }
printf("%d %d\n", a, b);
    return 0;
}



Measured memory_bytes: 2064
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
if(s[0]==s[1]&&s[1]==s[2]&&s[0]=='R')
  cout<<3<<endl;
else if((s[0]==s[1]&&s[1]=='R')||(s[1]==s[2]&&s[1]=='R'))
cout<<2<<endl;
else if(s[0]=='R'||s[1]=='R'||s[2]=='R')
cout<<1<<endl;
else
cout<<0<<endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << endl;
    
}

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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int k = sc.nextInt();
		ArrayList<Integer> A = new ArrayList<Integer>();
		int B = 0;
		int count = 1;
		long ans = 0;

		for(int i = 0; i < s.length()-1; i++) {
			if(s.charAt(i+1) == s.charAt(i)) {
				count++;
			}else {
				A.add(count);
				count = 1;
			}
		}

		A.add(count);

		/*for(int a: A)
			System.out.printf("%d ", a);*/

		if(s.charAt(0) == s.charAt(s.length()-1)) {

			if(A.size() == 1) {

				ans = A.get(0);
				ans = ans*k;
				ans = ans/2;

			}else {

				int fnum1 = A.get(0);
				int fnum2 = A.get(A.size()-1);
				B = fnum1+fnum2;
				A.remove(A.size()-1);
				A.remove(0);

				for(int a: A) {
					ans += a/2;
				}

				ans += B/2;
				ans = ans*(k-1);
				ans += fnum1/2;
				ans += fnum2/2;

				for(int a: A) {
					ans += a/2;
				}

			}

		}else {

			for(int a: A) {
				ans += a/2;
			}

			ans = ans*k;
		}

		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 22608
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cmath>

using namespace std;

#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

//10^9 + 7
const ll MOD = 1000000007;


int main() {
	ll N;
	cin >> N;

	cout << ceil(N / 2.0) << endl;
}

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

using namespace std;

char j_s_board[10][10];
int idx,width;

int jtos(string jfen){
  std::vector<char> board[10];
  int len=jfen.length();
  idx=0;width=0;
  for(int i=0;i<len;i++){
    if(jfen[i]=='/') idx++;
    else{
      if(jfen[i]=='b'){
        board[idx].push_back('b');
        width++;
      }
      else{
        int j=jfen[i]-'0';
        for(int k=0;k<j;k++){
          board[idx].push_back('.');
          width++;
        }
      }
    }
  }
  for(int i=0;i<idx+1;i++) for(int j=0;j<width/(idx+1);j++) j_s_board[i][j]=board[i][j];
  return 0;
}

string stoj(){
  string res="";
  for(int i=0;i<idx+1;i++){
    char num='0';//.?????£?¶?????????°
    for(int j=0;j<width/(idx+1);j++){
      if(j_s_board[i][j]=='.') num++;
      else{
        if(num!='0') res+=num;
        res+='b';
        num='0';
      }
    }
    if(num!='0') res+=num;
    if(i<idx) res+="/";
  }
  return res;
}

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

  string jfen;
  while(cin>>jfen,jfen!="#"){
  jtos(jfen);
  int a,b,c,d;cin>>a>>b>>c>>d;
  char tmp=j_s_board[a-1][b-1];
  j_s_board[a-1][b-1]=j_s_board[c-1][d-1];
  j_s_board[c-1][d-1]=tmp;
  string ans=stoj();
  cout<<ans<<endl;
}
}

Measured memory_bytes: 3228
#include<iostream>

#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main()
{
    int n;  cin >> n;
    int p[n];   rep(i, n) cin >> p[i];
    int r[n];   rep(i, n) r[i] = i + 1;

    int cnt = 0;
    rep(i, n){
        if((p[i] == r[i]) == false){
            cnt++;
        }
    }

    if(cnt == 2 || cnt == 0){
        cout << "YES";
    }
    else{
        cout << "NO";
    }
    cout << endl;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val o = sc.next
  val iE = sc.next

  val e = if(o.length != iE.length) iE :+ '@' else iE

  val res = (o zip e).foldLeft(""){case(str,(oCh, eCh)) =>
      if(eCh == '@') str :+ oCh
      else str :+ oCh :+ eCh
  }

  println(res)
}


Measured memory_bytes: 27092
#include <iostream>
using namespace std;
#include <stdio.h>
#define W 30
#define N 30

int main()
{
	int w, n;
	int a[W];
	int temp;
	int x, y;
	
	cin >> w;
	cin >> n;
	for (int i = 0; i < w; i++) {
		a[i] =i + 1;
	}
	
	for (int i = 0; i < n; i++) {
		scanf("%d, %d", &x, &y);
		temp = a[x - 1];
		a[x - 1] = a[y - 1];
		a[y - 1] =temp;
	}
	
	for (int i = 0; i < w; i++) {
		cout << a[i]  << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 1240