akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
//int p = 998244353;
long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2);
	x *= x; x %= p;
	if (n % 2 == 1) { x *= a; x %= p; }
	return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
	for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
	inv_kai = kai;
	rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
	int a = kai[n] * inv_kai[r]; a %= p;
	a *= inv_kai[n - r]; a %= p;
	return a;
}
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) {pa[x] = y;}
}


#define T vel
T mul(T &a,T &b) {//calcureate a(b(x))
	int sz = a.size();
	vel c(sz);
	rep(i, sz) { c[i] = a[b[i]]; }
	return c;
}
T rui1(T &a, int n) {
	if (n == 1) { return a; }
	T x = rui1(a, n / 2);
	x = mul(x, x);
	if (n % 2 == 1) { x = mul(x, a); }
	return x;
}
int solve(string s) {
	int n = s.size();
	vel list(1,0);
	for (int i = 1; i < n; i++) {
		if (s[i] != s[i - 1]) { list.push_back(i); }
	}
	list.push_back(n);
	int sz = list.size();
	int ans = 0;
	rep(i, sz-1) {
		ans += (list[i + 1] - list[i]) / 2;
	}
	return ans;
}
signed main(){
	int n; cin >> n;
	vvel d(n, vel(n,201));
	rep(i, n) { d[i][i] = 0; }
	V<string> s(n);
	rep(i, n) {
		cin >> s[i];
		rep(j, n) {
			if (s[i][j] == '1') {
				d[i][j] = 1;
			}
		}
	}
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	int ans = 0;
	rep(i, n) {
		rep(j, n) {
			if (s[i][j] == '1') {
				if (d[0][i] % 2 == d[0][j] % 2) {
					cout << -1 << endl; return 0;
				}
			}
			mmax(ans, d[i][j]);
		}
	}
	cout << ans+1 << endl;
	return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef unsigned int uint;
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

const int MX = 100005;

set<int> T[MX];
int chk[MX];
char C[MX];

pii dfs(int x, int p){
	pii r = pii(0, 0);
	int cur = (T[x].size()%2 == 0) != (C[x] == 'B');
	for(int c : T[x]){
		if(c == p) continue;
		pii t = dfs(c, x);	
		r.first = max({r.first, t.first, r.second + t.second + cur});
		r.second = max(r.second, t.second);
	}
	r.second += cur;
	return r;
}

int main()
{
	int N;
	scanf("%d", &N);
	for(int i = 1; i < N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		T[a].insert(b);
		T[b].insert(a);
	}
	scanf("%s", C+1);
	queue<int> Q;
	for(int i = 1; i <= N; i++) if(T[i].size() == 1) Q.push(i);
	while(Q.size()){
		int p = Q.front(); Q.pop();
		if(C[p] == 'W') continue;
		chk[p] = 1;
		int n = *T[p].begin();
		T[p].clear();
		T[n].erase(p);
		if(T[n].size() == 1) Q.push(n);
	}
	int r = 0;
	for(int i = 1; i <= N; i++) if(!chk[i]) r = i;
	if(r == 0) return !printf("0\n");

	int ans = -2;
	for(int i = 1; i <= N; i++){
		if(!chk[i]) ans += 2;
		if((T[i].size()%2 == 0) != (C[i] == 'B')) ans++;
	}
	pii t = dfs(r, -1);
	ans -= t.first * 2;
	printf("%d\n", ans);
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  ll n,m,v,p;
  cin >> n >> m >> v >> p;
  vector<ll> a(n);
  rep(i,n)cin >> a[i];
  sort(ALL(a),greater<int>());
  ll l = p-1,r = n;
  while(r-l > 1){
    ll k = 1ll*m*(n-v);
    int i = (l+r)/2;
    for(int j = p-1;j < i;j++){
      if(abs(a[j]-a[i]) > m)k = 0;
      k -= 1ll*abs(a[j]-a[i]);
    }
    if(k >= 0)l = i;
    else r = i;
  }
  cout << r << endl;



  return 0;
}

Measured memory_bytes: 4036
#include <stdio.h>

int Max(int, int);

int main(void){
  int a,b;
  int c,d; // cは最大公約数、dは最小公倍数。

  while(scanf("%d %d" ,&a ,&b) != EOF){

    c = Max(a , b );
    d =  a / c * b;

    printf("%d %ld\n" ,c ,d);

  }

  return 0;
}


int Max(int a, int b){

  int rem;

  if(a == 0 || b == 0 ) return 0;

  while( ( rem = a % b ) != 0 ){

    a = b;
    b = rem;

  }

  return b;
}

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

int main(void){
  int n;
  scanf("%d\n",&n);

  char s[n][100];
  int t[n];
  for (int i = 0; i < n; i++) {
    scanf("%s %d\n", s[i] ,&t[i]);
  }

  char x[100];
  scanf("%s\n", x);

  int  flag=0;
  int sum=0;
  for (int i = 0; i < n; i++) {
    if(flag == 1){
      sum += t[i];
    }
    if(strcmp(x, s[i]) == 0){
      flag = 1;
    }
  }

  printf("%d\n", sum);

  return(0);
}


Measured memory_bytes: 128
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

mod = 10**9+7

def mul(a, b):
    n = len(a)
    c = [[0]*n for i in range(n)]
    for i in range(n):
        for j in range(n):
            for k in range(n):
                c[i][j] += (a[i][k]*b[k][j])%mod
    return c

def pow(a, n):
    b = [[0]*len(a) for i in range(len(a))]
    for i in range(len(a)):
        b[i][i] = 1
    while n:
        if n&1:
            b = mul(a, b)
        a = mul(a, a)
        n >>=1
    return b

n,k = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]

b = pow(a, k)
ans = sum(sum(i) for i in b) % mod
print(ans)

Measured memory_bytes: 72284
n = int(input())
t, a = map(int, input().split())
h = [int(i) for i in input().split()]

min = max(h)
ans = []

for i, j in enumerate(h):
    ans.append([abs(t*1000 - (j * 6) - a*1000),i+1])

print(sorted(ans)[0][1])

Measured memory_bytes: 3188
n=int(input())
h=list(map(int,input().split()))
t=0
s=0
if n==1:
    print("Yes")
else:
    for i in range(n-1):
        t+=(h[i+1]-h[i])
        if t>=0:
            t=0
        if t<=-2:
            s+=1
    if s>=1:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 85280
import sys
input = sys.stdin.readline
N = int(input())
k = 0
for i in range(1, N + 2):
  if i * (i - 1) == N * 2:
    k = i
    break
if k == 0:
  print("No")
  exit(0)
res = [[] for _ in range(k + 1)]
p = 1
print("Yes")
print(k)
for i in range(2, k + 1):
  for j in range(1, i):
    res[i].append(p)
    res[j].append(p)
    p += 1
for i in range(1, k + 1):
  print(str(len(res[i])) + " " + " ".join(list(map(str, res[i]))))

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

ll f(int n){
    int res = 0;
    while(n%2 != 1){
        res++;
        n /= 2;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    ll a;
    ll ans = 0;
    rep(i,n){
        cin >> a;
        ans+= f(a);
    }
    //解説
    cout << ans << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

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

using namespace std;
typedef unsigned long long ll;
int main() {
	char a , b, c ,d;
	cin>>a>>b>>c>>d;
	if(((a==b&&c==d)||(a==c&&b==d)||(a==d&&b==c))&&(a!=b||a!=c||a!=d)){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
int main(int argc,char** argv){
  int N,M;
  std::cin >> N >> M;
  int H[N];
  for(int i=0;i<N;i++) std::cin >> H[i];
  bool isGood[N];
  for(int i=0;i<N;i++) isGood[i] = true;
  for(int i=0;i<M;i++){
    int A,B;
    std::cin >> A >> B;
    A--;B--;
         if(H[A]>H[B]) isGood[B] = false;
    else if(H[A]<H[B]) isGood[A] = false;
    else isGood[A] = isGood[B] = false;
  }
  int ret = 0;
  for(int i=0;i<N;i++){
    if(isGood[i])ret++;
    //if(isGood[i]) std::cout << i << " good" << std::endl;
  }
  std::cout << ret << std::endl;
  return 0;
}


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

int main () {
  int i, n, N, l, r;
  
  cin >> N;
  
  n = 0;
  
  for (i = 0; i < N; i++) {
    cin >> l >> r;
    n += r - l + 1;
  }
  
  cout << n << endl;
}

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

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

	int n;
	cin>>n;
	set<int> st;
	for(int i=0; i<n; ++i){
		int x; cin>>x; st.insert(x);
	}
	if( st.size() == n ){ cout<<"YES\n"; }
	else{ cout<<"NO\n"; }

	return 0;
}


Measured memory_bytes: 9600
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}


int main(){
  ll n,m; cin >> n >> m; ll ans = 1;
  vl pown(60);
  
  nCrprep();
  
  pown[0] = 1;
  rep(i,59){
    pown[i+1] = mod(pown[i]*n);
  }
  
  auto res = prime_factorize(m);
    
  for(auto p : res){
    ll ind = p.second;
    ans *= nCr(n+ind-1,ind);
    ans = mod(ans);
  }
  
  
  cout << ans << endl;
  
  
}

Measured memory_bytes: 50500
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxNode = 55, maxLim = 25;
template<const int nbNode, const int nbEdge> struct Graph {
    int tot, head[nbNode], to[nbEdge << 1], next[nbEdge << 1];
    Graph() { memset(head, -1, sizeof(head)); }
    void AddEdge(int u, int v) {
        to[++tot] = v;
        next[tot] = head[u];
        head[u] = tot;
    }
};
Graph<maxNode, maxNode> Tree;
int nbNode, limNum, fa[maxNode], dep[maxNode];
ll setCover[1 << 20];
void dfs(int now, int from) {
    dep[now] = dep[from] + 1;
    fa[now] = from;
    for (int pt = Tree.head[now]; ~pt; pt = Tree.next[pt])
        if (Tree.to[pt] != from)
            dfs(Tree.to[pt], now);
}
int count1_(int num) {
    int ret = 0;
    for (int wei = 0; wei < limNum; ++wei)
        if ((1 << wei) & num)
            ++ret;
    return ret;
}
int count2_(ll num) {
    int ret = 0;
    for (int wei = 0; wei < nbNode - 1; ++wei)
        if ((1ll << wei) & num)
            ++ret;
    return ret;
}
signed main() {
    scanf("%d", &nbNode);
    for (int i = 1; i < nbNode; ++i) {
        int uNode, vNode;
        scanf("%d%d", &uNode, &vNode);
        Tree.AddEdge(uNode, vNode);
        Tree.AddEdge(vNode, uNode);
    }
    scanf("%d", &limNum);
    dfs(1, 0);
    for (int i = 1; i <= limNum; ++i) {
        int uNode, vNode;
        scanf("%d%d", &uNode, &vNode);
        if (dep[uNode] < dep[vNode])
            swap(uNode, vNode);
        while (dep[uNode] > dep[vNode]) {
            setCover[1 << (i - 1)] |= 1ll << (uNode - 2);
            uNode = fa[uNode];
        }
        while (uNode != vNode) {
            setCover[1 << (i - 1)] |= 1ll << (uNode - 2);
            setCover[1 << (i - 1)] |= 1ll << (vNode - 2);
            uNode = fa[uNode];
            vNode = fa[vNode];
        }
    }
    setCover[0] = 0;
    for (int state = 1; state < (1 << limNum); ++state) {
        int last = state & (-state);
        if (last == state) continue ;
        setCover[state] = setCover[state ^ last] | setCover[last];
    }
    ll ans = 0;
    for (int state = 1; state < (1 << limNum); ++state) {
        int notCover = nbNode - count2_(setCover[state]) - 1;
        ll fu = ((count1_(state)) & 1) ? 1 : -1;
        ans += fu * (1ll << notCover);
    }
    printf("%lld\n", (1ll << (nbNode - 1)) - ans);
    return 0;
}

Measured memory_bytes: 8448
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.println(a*b);
	 }
}


Measured memory_bytes: 35704
n=int(input())
a=input()
b=input()
c=input()
cnt=0
for i in range(n):
  if a[i]==b[i] and b[i]==c[i]:
    continue
  if a[i]==b[i] or c[i]==b[i] or a[i]==c[i]:
    cnt+=1
  else:
    cnt+=2
print(cnt)

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

using namespace std;

const int md = 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  auto powr = [&](int base, int power) {
    int res = 1;
    while (power > 0) {
      if (power & 1) {
        res = 1ll * res * base % md;
      }
      base = 1ll * base * base % md;
      power >>= 1;
    }
    return res;
  };
  vector<vector<int>> div(k + 1);
  for (int d = 1; d <= k; d++) {
    for (int j = d + d; j <= k; j += d) {
      div[j].push_back(d);
    }
  }
  vector<int> dp(k + 1);
  int ans = 0;
  for (int g = k; g > 0; g--) {
    (dp[g] += powr(k / g, n)) %= md;
    for (int d : div[g]) {
      (dp[d] += md - dp[g]) %= md;
    }
    (ans += 1ll * g * dp[g] % md) %= md;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 13996
/****************************************

	LostMartian

****************************************/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <utility>
#include <climits>
#include <numeric>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <cassert>
using namespace std;
typedef long long ll;
#define rep(i,m,n) for(ll i=m; i<n; i++)
#define repr(i,m,n) for(ll i=m; i>=n; i--)
#define vll vector<ll >
#define vvl vector<vector<ll > >
#define pi pair<ll, ll >
#define pb push_back
#define mk make_pair
#define sz size()
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define d(x) cout<<"Value of "#x" = "<<x<<"\n";
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define LOCAL #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
int main()
{
	clock_t z = clock();
	FAST
	//LOCAL
	ll n, k;
	cin>>n>>k;
	ll a[n];
	ll s=0;
	rep(i,0,n) {
		cin>>a[i];
	}
	ll sum=0;
	sort(a, a+n);
	rep(i,0,n-k) {
		sum+=a[i];
	}
	cout<<sum<<"\n";
	

	debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
	return 0;
}


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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second

const long long MOD = 1000000007;


int main(){
    ll n;
    cin >> n;
    vector<pair<ll, pair<ll, ll> > > v;
    ll X, Y, H;
    rep(i, n){
        ll x, y, h;
        cin >> x >> y >> h;
        v.push_back(mp(x, mp(y, h)));
        if(h > 0){
            X = x;
            Y = y;
            H = h;
        }
    }

    rep(xp, 101){
        rep(yp, 101){
            ll h = H+abs(xp-X)+abs(yp-Y);
            bool flag = true;
            rep(k, n){
                if(max(h - abs(xp-v[k].fi) - abs(yp-v[k].se.fi), 0LL) != v[k].se.se){
                    flag = false;
                }
            }
            if(flag){
                cout << xp << " " << yp << " " << h << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<chrono>
#define ll long long
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, H, N, M, L, K, W, X, Y, Z;
ll ans = 0;
int main() {
	cin >> L;
	vector<tuple<int,int,int>>path;
	vector<bool>flag;
	while (L != 2) {
		if (L & 1) {
			L--;
			flag.push_back(1);
		}
		else {
			L /= 2;
			flag.push_back(0);
		}
	}
	path.push_back(make_tuple(1, 2, 0));
	path.push_back(make_tuple(1, 2, 1));
	N = 2;
	ll l = 2;
	for (int i = flag.size() - 1; i >= 0; i--) {
		if (flag[i]) {
			path.push_back(make_tuple(1, N, l));
			l++;
		}
		else {
			for (int j = 0; j < path.size(); j++) {
				get<2>(path[j]) *= 2;
			}
			path.push_back(make_tuple(N, N + 1, 0));
			path.push_back(make_tuple(N, N + 1, 1));
			N++;
			l *= 2;
		}
	}
	cout << N <<" "<< path.size() << endl;
	for (tuple<int, int, int> i : path)
		cout << get<0>(i) <<" "<< get<1>(i) <<" "<< get<2>(i) << endl;
}


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

#define MOD 998244353


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

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}
  
  

int main() {
    ll n,a,b;
    cin>>n>>a>>b;
    if(a == 0)cout<<0<<endl;
    else if(n<=a+b && n>a)cout<<a<<endl;
    else if(n<=a+b && n<a)cout<<n<<endl;
    else if(n%(a+b)>a) cout<<n/(a+b)*a+a<<endl;
    else if(n%(a+b)<a) cout<<n/(a+b)*a+n%(a+b)<<endl;
    return 0;
}
    
    



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

using namespace std;

int H, W, an;
int dr[4] = {1, -1, 0, 0}, dc[4] = {0, 0, 1, -1};
vector<string> maze;

void bfs(int r, int c)
{
    set<pair<int, int>> s;
    queue<tuple<int, int, int>> q;
    s.insert({r, c});
    q.push(make_tuple(r, c, 0));
    int d;
    while (q.size()) {
        tie(r, c, d) = q.front();
        q.pop();
        for (int i = 0; i < 4; ++i) {
            int x = r+dr[i], y = c+dc[i];
            if (x < 0 || y < 0 || x >= H || y >= W || maze[x][y] == '#' || s.count({x, y})) continue;
            s.insert({x, y});
            q.push(make_tuple(x, y, d+1));
        }
    }
    an = max(an, d);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> H >> W;
    maze.resize(H);
    for (string &s: maze) cin >> s;

    for (int r = 0; r < H; ++r) for (int c = 0; c < W; ++c) if (maze[r][c] == '.') {
        bfs(r, c);
    }
    cout << an << '\n';
    return 0;
}


Measured memory_bytes: 256
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime
Q = int(input())
ans = [0] * (10**5+1)
prime = primes(10**5)
for i in range(1,10**5+1):
    if prime[i] == 1 and prime[(i+1)//2] == 1:
        ans[i] = ans[i-1] + 1
        continue
    ans[i] = ans[i-1]
for i in range(Q):
    l, r = map(int, input().split())
    print(ans[r]-ans[l-1])

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

using namespace std;
using ll = long long;
using ld = long double;

void solve() {
  int n;
  cin >> n;
  int ac = 0, wa = 0, tle = 0, re = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s == "AC") {
      ++ac;
    } else if (s == "WA") {
      ++wa;
    } else if (s == "TLE") {
      ++tle;
    } else {
      ++re;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<string>
#include<iomanip>
#include<bits/stdc++.h>
using namespace std;

/*define*/
#define rep(i, n) for(int i=0; i<n; ++i)
#define endl "\n"
typedef long long ll;

const long long mod = 1e18;
const long long INF=1e9;
int ci;


int main(){
    int x;
    cin >> x;
    if(x>=30) cout << "Yes" << endl;
    else cout <<"No" << endl;
}

Measured memory_bytes: 3632
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int n;
  cin >> n;
  
  int cnt=0;
  vector<int> p(n);  
  rep(i,n){
  cin>>p[i];
    if(p[i]%2==1)cnt++;
  }
  
  cout << (cnt%2==0?"YES":"NO") << endl;
  
}

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

int N, M, Q;
vector<vector<int> > G, psum, rpsum, cpsum;

int main() {
    scanf("%d %d %d", &N, &M, &Q);

    G = vector<vector<int> >(N, vector<int>(M));
    for(int i = 0; i < N; i++) {
        scanf("\n");
        for(int j = 0; j < M; j++) {
            char t; scanf("%c", &t);
            G[i][j] = t - '0';
        }
    }

    psum = vector<vector<int> >(N, vector<int>(M, 0));
    rpsum = vector<vector<int> >(N, vector<int>(M - 1, 0));
    cpsum = vector<vector<int> >(M, vector<int>(N - 1, 0));

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < M; j++) {
            psum[i][j] = G[i][j];
            if(i) psum[i][j] += psum[i - 1][j];
            if(j) psum[i][j] += psum[i][j - 1];
            if(i && j) psum[i][j] -= psum[i - 1][j - 1];
        }
    }
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < M - 1; j++) {
            rpsum[i][j] = (G[i][j] && G[i][j + 1]);
            if(j) rpsum[i][j] += rpsum[i][j - 1];
        }
        if(i) {
            for(int j = 0; j < M - 1; j++) {
                rpsum[i][j] += rpsum[i - 1][j];
            }
        }
    }
    for(int i = 0; i < M; i++) {
        for(int j = 0; j < N - 1; j++) {
            cpsum[i][j] = (G[j][i] && G[j + 1][i]);
            if(j) cpsum[i][j] += cpsum[i][j - 1];
        }
        if(i) {
            for(int j = 0; j < N - 1; j++) {
                cpsum[i][j] += cpsum[i - 1][j];
            }
        }
    }

    for(int i = 0; i < Q; i++) {
        int r1, c1, r2, c2; scanf("%d %d %d %d", &r1, &c1, &r2, &c2);
        r1--; c1--; r2--; c2--;

        int ans = psum[r2][c2];
        if(r1) ans -= psum[r1 - 1][c2];
        if(c1) ans -= psum[r2][c1 - 1];
        if(r1 && c1) ans += psum[r1 - 1][c1 - 1];

        if(c2) ans -= rpsum[r2][c2 - 1] - (r1? rpsum[r1 - 1][c2 - 1] : 0);
        if(c1) ans += rpsum[r2][c1 - 1] - (r1? rpsum[r1 - 1][c1 - 1] : 0);
        if(r2) ans -= cpsum[c2][r2 - 1] - (c1? cpsum[c1 - 1][r2 - 1] : 0);
        if(r1) ans += cpsum[c2][r1 - 1] - (c1? cpsum[c1 - 1][r1 - 1] : 0);

        printf("%d\n", ans);
    }
}


Measured memory_bytes: 64640
#include <stdio.h>

#define INPUT_MAX 1000000000
#define INPUT_MIN 1


typedef unsigned char	U08;
typedef unsigned long	U32;


static void Denominator_Division_Void( U32 u32_1st_num, U32 u32_2nd_num );

int main()
{
		
	U32 u32_1st_num;			
	U32 u32_2nd_num;			
	
	scanf("%ld %ld", &u32_1st_num, &u32_2nd_num );
	
	if( ( INPUT_MIN <= u32_1st_num ) && ( INPUT_MAX >= u32_1st_num ) )
	{
		if( ( INPUT_MIN <= u32_2nd_num ) && ( INPUT_MAX >= u32_2nd_num ) )
		{

			Denominator_Division_Void( u32_1st_num, u32_2nd_num );
		}
	}
	
	return 0;
}

static void Denominator_Division_Void( U32 u32_1st_num, U32 u32_2nd_num )
{
	U32 u32_dividend;
	U32 u32_divisor;			
	U32 u32_remainder = 1;		
	

	if( u32_1st_num >= u32_2nd_num )
	{
		u32_dividend = u32_1st_num;
		u32_divisor = u32_2nd_num;
	}
	else
	{
		u32_dividend = u32_2nd_num;
		u32_divisor = u32_1st_num;
	}
	

	while( 0 != u32_remainder )
	{
		u32_remainder = u32_dividend % u32_divisor;
		u32_dividend = u32_divisor;
		u32_divisor = u32_remainder;
	}
	printf("%ld\n",u32_dividend);
	
}


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

int main()
{
  int n;
  int b;
  cin>>n;
  vector<int> ar(n,0);
  vector<int> a(n,0);
    for (int k = 0; k < n ; k++){
        cin>>b;
        ar[k]=b;
    }
  int i;
  a[0]=0;
  a[1]=abs(ar[0]-ar[1]);
  i=2;
  	for (i; i < n; i++){
     if(abs(ar[i-1]-ar[i])+a[i-1]<=abs(ar[i-2]-ar[i])+a[i-2]){
       a[i]=abs(ar[i-1]-ar[i])+a[i-1];
     }
      else{
        a[i]=abs(ar[i-2]-ar[i])+a[i-2];
      }
  	}
      cout<<a[n-1];
}


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

int main() {
  int N;
  cin >> N;
  int c = 0;
  int t = N;
  while (t > 0) {
  	c += t%10;
    t /= 10;
  }
  if (N%c == 0) {
  	cout << "Yes" << endl;
  } else {
  	cout << "No" << endl;
  }
  
}

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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {

            string[][] bingo =
            {
                Console.ReadLine().Split(),
                Console.ReadLine().Split(),
                Console.ReadLine().Split(),

            };

            var n = int.Parse(Console.ReadLine());

            for(int i = 0; i < n; i++)
            {
                var num = Console.ReadLine();
                for(int j = 0; j < 3; j++)
                {
                    for(int k = 0; k < 3; k++)
                    {
                        if (bingo[j][k] == num) bingo[j][k] = "#";
                    }
                }
            }

            var ans = "No";
            for (int i = 0; i < 3; i++)
            {
                if (bingo[i][0] == bingo[i][1] && bingo[i][1] == bingo[i][2]) ans = "Yes";
                if (bingo[0][i] == bingo[1][i] && bingo[1][i] == bingo[2][i]) ans = "Yes";
                if (bingo[0][0] == bingo[1][1] && bingo[1][1] == bingo[2][2]) ans = "Yes";
                if (bingo[0][2] == bingo[1][1] && bingo[1][1] == bingo[2][0]) ans = "Yes";

            }

            

          

            Console.WriteLine(ans);
        
            
        }
    }
}


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

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

typedef long long ll;
typedef long double ld;

const int MAXN = 11;
const int MAXQ = 51;

int n, m, q;
int arr[MAXN];
int a[MAXQ], b[MAXQ], c[MAXQ], d[MAXQ];
ll ans = 0;

ll calc() {
	ll res = 0;
	for (int i = 0; i < q; ++i) {
		int dif = arr[b[i]] - arr[a[i]];
		if (dif == c[i]) res += d[i];
	}
	return res;
}

void rec(int ind) {
	if (ind == n) {
		ans = max(ans, calc());
		return;
	}
	if (ind == 0) {
		for (int el = 1; el <= m; ++el) {
			arr[ind] = el;
			rec(ind + 1);
		}
	} else {
		for (int el = arr[ind - 1]; el <= m; ++el) {
			arr[ind ] = el;
			rec(ind + 1);
		}
	}
}

void solve() {
	cin >> n >> m >> q;
	for (int i = 0; i < q; ++i) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		--a[i]; --b[i];
	}
	rec(0);
	cout << ans << "\n";
}

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

Measured memory_bytes: 3660
import java.util.*;

public class Main{
    static HashMap<String,HashSet<String>> map;
    static HashSet<String> ans;
    static HashSet<String> counted;

    static void solve(String s){
	if(counted.contains(s)){
	    return;
	}
	counted.add(s);
	if(!map.containsKey(s)){
	    ans.add(s);
	    return;
	}

	for(String ns : map.get(s)){
	    solve(ns);
	}
    }

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

	while(true){
	    int n = sc.nextInt();
	    if(n == 0) break;

	    map = new HashMap<String,HashSet<String>>();

	    String start = null;

	    for(int i = 0; i < n; i++){
		String[] s = sc.next().replaceAll("\\.", "").split("\\:");
		String[] ss = s[1].split("\\,");
		HashSet<String> set = new HashSet<String>();

		if(i == 0){
		    start = s[0];
		}

		for(int j = 0; j < ss.length; j++){
		    set.add(ss[j]);
		}

		map.put(s[0], set);
	    }

	    ans = new HashSet<String>();
	    counted = new HashSet<String>();
	    solve(start);

	    System.out.println(ans.size());
	}
    }
}

Measured memory_bytes: 13000
s = input()
t = input()
S = []
T = []
Ans = []
for i in range(len(s)):
	S.append(s[i])
S.sort()
moziretu1 = "".join(S)

for i in range(len(t)):
	T.append(t[i])
T.sort(reverse=True)
moziretu2 = "".join(T)

if S < T:
	print('Yes')

else:
	print('No')
	

Measured memory_bytes: 3064
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    H,W = LMIIS()
    table = [0]*H
    for i in range(H):
        table[i] = input()
    num_route = [[0]*W for _ in range(H)]

    if table[0][0] == '#':
        num_route[0][0] = 1

    for i in range(1,W):
        if table[0][i] == '#' and table[0][i] != table[0][i-1]:
            num_route[0][i] = num_route[0][i-1] + 1
        else:
            num_route[0][i] = num_route[0][i-1]

    for i in range(1,H):
        if table[i][0] == '#' and table[i][0] != table[i-1][0]:
            num_route[i][0] = num_route[i-1][0] + 1
        else:
            num_route[i][0] = num_route[i-1][0]
    
    for i in range(1,H):
        for j in range(1,W):
            l = u = 0
            if table[i][j] == '#' and table[i][j] != table[i][j-1]:
                l = num_route[i][j-1] + 1
            else:
                l = num_route[i][j-1]
            if table[i][j] == '#' and table[i][j] != table[i-1][j]:
                u = num_route[i-1][j] + 1
            else:
                u = num_route[i-1][j]
            num_route[i][j] = min(l,u)
            
    #print(num_route)
    print(num_route[H-1][W-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 67308
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
6
1 2 4 6 16 32 64
)");
#define cin input
#endif

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

	multiset<int, greater<int>> a;

	REP (i, n)
	{
		int x;
		cin >> x;
		a.insert(x);
	}

	int r = 0;

	for (auto it = a.begin(); it != a.end(); ++it)
	{
		int x = 1;
		for (int t = *it; t; t >>= 1)
			x <<= 1;
		x -= *it;
		auto it2 = a.upper_bound(x);
		if (it2 == a.begin())
			continue;
		--it2;
		if (it2 == it)
			continue;
		if (*it2 != x)
			continue;
		a.erase(it2);
		++r;
	}

	cout << r << endl;

	return 0;
}


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

int main() {
int H, W;
int count = 0;
char a = 'x';
cin >> H >> W;
vector<vector<char>> data(H, vector<char>(W,a));
vector<vector<char>> horizon_delete(H, vector<char>(W,a));
vector<vector<char>> vertical_delete(H, vector<char>(W,a));
//データ取り込み
for (int i = 0; i < H; i++){
	for (int j = 0; j < W; j++){
    cin >> data.at(i).at(j);
    }
}

//水平成分消す
for (int i = 0; i < H; i++){
	for (int j = 0; j < W; j++){
		if (data.at(i).at(j) == '#'){
    	count++;
    	}
    }
  	if (count != 0){
    	for (int j = 0; j < W; j++){
        	horizon_delete.at(i).at(j) = data.at(i).at(j);
        }
    }
  	count = 0;
}

//垂直成分消す
for (int i = 0; i < W; i++){
	for (int j = 0; j < H; j++){
		if (horizon_delete.at(j).at(i) == '#'){
    	count++;
    	}
    }
  	//全部.なら転写しない
  	if (count != 0){
    	for (int j = 0; j < H; j++){
        	vertical_delete.at(j).at(i) = horizon_delete.at(j).at(i);
        }
    }
  	count = 0;
}
//.と＃だけ書き出す
for (int i = 0; i < H; i++){
  	count = 0;
	for (int j = 0; j < W; j++){
    	if (vertical_delete.at(i).at(j) == a){
        count++;
        }
    }
    if (count == W){
    continue;
    }
    else {
	for (int j = 0; j < W; j++){
        if (vertical_delete.at(i).at(j) != a){
    	cout << vertical_delete.at(i).at(j);
        }
    	if (j == W - 1){
    	cout << endl;
    	}
    }
    }
}
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 2000200
#define mod 1000000007
using namespace std;
namespace IO{
	int Top=0;char SS[20];
	void write(int x){
		if(!x){putchar('0');return;} if(x<0) x=-x,putchar('-');
		while(x) SS[++Top]=x%10,x/=10;
		while(Top) putchar(SS[Top]+'0'),--Top;
	}
	int read(){
		int nm=0; char cw=getchar(); for(;!isdigit(cw);cw=getchar());
		for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0'); return nm;
	}
}using namespace IO;
int add(int x,int y){return (x+y>=mod)?x+y-mod:x+y;} 
int mul(int x,int y){return (LL)x*(LL)y%mod;}
int mus(int x,int y){return (x-y<0)?x-y+mod:x-y;}
void upd(int &x,int y){x=add(x,y);}
int qpow(int x,int sq){
	int res=1;
	for(;sq;sq>>=1,x=mul(x,x)) if(sq&1) res=mul(res,x);
	return res;
}
int n,m,G[M],F[M],S[M],fac[M],ifac[M],ans;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),F[0]=S[0]=1;
	for(int i=1;i<=n;i++) F[i]=i>2?S[i-3]:0,upd(F[i],F[i-1]),S[i]=add(S[i-1],F[i]);
	for(int i=0;i<n;i++) upd(ans,mul(F[i],i+(i<n-1)));
	for(int i=0;i<n-1;i++) upd(ans,mul(F[i],mul(n-1,n-1)));
	upd(ans,F[n]),write(ans),putchar('\n');return 0;
}

Measured memory_bytes: 12544
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 200009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
ll vet[maxn];
ll ans[maxn];
ll vis[maxn];
vector<ll> adj[maxn];
vector<ll> lis;
void dfs(ll x){
  auto it = (ll)(lower_bound(all(lis),vet[x])-lis.begin());
  bool acrescentou=false;
  ll antigo=-1;
  if(it==lis.size())lis.push_back(vet[x]),acrescentou=true;
  else antigo=lis[it],lis[it]=vet[x];
  vis[x]=1;   
  ans[x]=lis.size();
  for(auto e:adj[x]){
    if(vis[e]==-1){
      dfs(e);
    }
  }
  if(acrescentou)lis.pop_back();
  else lis[it]=antigo;

}
void addedge(ll a,ll b){
  adj[a].push_back(b);
  adj[b].push_back(a);
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin>>n;
  rep(i,1,n+1)cin>>vet[i];
  memset(vis,-1,sizeof vis);
  ll n2=n-1;
  while(n2--){
    ll a,b;
    cin>>a>>b;
    addedge(a,b);
  }
  vector<ll>lis2;
  dfs(1);
  rep(i,1,n+1)cout<<ans[i]<<'\n';
  return 0;   
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)          \
  sort(x.begin(), x.end()); \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << "(" << #x << ", " << #y << ") = " \
                          << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

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

  cout << fixed << setprecision(20);

  int n;
  cin >> n;

  cout << n * 2 * M_PI << endl;

  return 0;
}

Measured memory_bytes: 3800
n, k = map(int, input().split())

ans = 0
check = [True for i in range(n)]

for i in range(k):
    d = int(input())
    tmp = list(map(int, input().split()))
    for ii in tmp:
        check[ii - 1] = False

for c in check:
    if c:
        ans += 1
print(ans)


Measured memory_bytes: 9056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long gcd(long long a, long long b){
    if (b == 0) return a;
    return gcd(b, a % b);
}
int main() {  
    ll a, b;
    cin >> a >> b;
    ll n = gcd(a, b);
    ll ret = 1;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            ret++;
            while (n % i == 0) {
                n /= i;
            }
        }
    }
    if (n != 1) ret++;

    cout << ret << "\n";
    return 0;

}



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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M){
    if(N == M) cout << YES << endl;
    else cout << NO << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    cin >> n;
    pair<long long, long long>v[n + 3];
    for(long long i = 1; i <= n; i++){
        long long x;
        cin >> x;
        v[i] = {x, i};
    }
    sort(v + 1, v + n + 1, greater<pair<long long, long long> >());
    long long dp[n + 3][n + 3];
    dp[1][0] = v[1].first * abs(v[1].second - n);
    dp[1][1] = v[1].first * abs(v[1].second - 1);
    for(int i = 2; i <= n; i++){
        dp[i][0] = dp[i - 1][0] + v[i].first * abs(v[i].second - (n - i + 1));
        dp[i][i] = dp[i - 1][i - 1] + v[i].first * abs(v[i].second - i);
        for(int j = 1; j < i; j++){
            dp[i][j] = max(dp[i - 1][j] + v[i].first * abs(v[i].second - (n - i + j + 1)), dp[i - 1][j - 1] + v[i].first * abs(v[i].second - j));
        }
    }
    long long ans = 0;
    for(int i = 0; i <= n; i++){
        ans = max(ans, dp[n][i]);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 26296
import sys
input = sys.stdin.readline
N = int(input())
S = list(input())

e, w = 0, 0
right, left = [], []
for s in S:
    if s == 'E':
        e += 1
    else:
        w += 1
    left.append([e, w])
ss = list(reversed(S))
e, w = 0, 0
for s in ss:
    if s == 'E':
        e += 1
    else:
        w += 1
    right.append([e, w])
right.reverse()
ans = 10**6

for i in range(N):
    if i == 0:
        ans = min(ans, right[1][0])
    elif i == N - 1:
        ans = min(ans, left[-2][1])
    else:
        ans = min(ans, right[i + 1][0] + left[i - 1][1])
print(ans)


Measured memory_bytes: 88352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		var S = GetStrings(N);
		var T = GetString();

		int l = 0;
		int r = 0;
		for(int i = 0; i < N; i++)
		{
			var Z = S[i].Replace("?", "z");
			if(String.Compare(Z, T, StringComparison.Ordinal) < 0)
				l++;

			var A = S[i].Replace("?", "a");
			if(String.Compare(A, T, StringComparison.Ordinal) > 0)
				r++;
		}

		WriteLine(string.Join(" ", Enumerable.Range(l + 1, N - r - l + 1)));
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 13396
import scala.io.StdIn.{readInt,readLine}

object Main {
  def main(args:Array[String]) = {
   val n = readInt
   val p = new Array[Long](n+1)
   val m = { for(i<- 0 to 100) yield { { for(j<-0 to 100) yield Long.MaxValue }.toArray } }.toArray

   (1 to n).foreach { i =>
     val q = readLine.split(" ").map(_.toLong)
     p(i-1) = q(0)
     p(i) = q(1)
   }

   (1 to n).foreach { i => m(i)(i) = 0 }
   for(i<-2 to n) {
     for(j<-1 to n-i+1) {
       val k = i+j-1
       for(l<-j to k-1) {
         val value = m(j)(l)+m(l+1)(k)+p(j-1)*p(l)*p(k)
         m(j)(k) = if(m(j)(k)>value) value else m(j)(k)
       }
     }
   }
   println(m(1)(n))
  }
}

Measured memory_bytes: 45396
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
x, a, b = M()
if a>=b:
    print('delicious')
elif (b-a) <= x:
    print('safe')
else:
    print('dangerous')

Measured memory_bytes: 74048
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>

using namespace std;

int gcd(int m,int n){
	if(m == 0 || n == 0){
		return 0;
	}
	while(m != n){
		if(m > n){
			m -= n;
		}
		else{
			n -= m;
		}
	}
	return m;
}

int icm(int m,int n){
	if(m == 0 || n == 0){
		return 0;
	}
	return ((m / gcd(m,n)) * n);
}

int main(){
	int m = 0,n = 0;
	int resGcd = 0,resIcm = 0;
	while(cin >> m >> n){
		resGcd = gcd(m,n);
		resIcm = icm(m,n);
		cout << resGcd << " " << resIcm << endl;
	}
	return 0;
}

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

const long long mod=1000000007LL;

void dijk(int s, vector<vector<pair<int,int>>> &E, vector<long long> &D, vector<long long> &cnt)
{
    int N=D.size(),vis[N+10];
    for (int i = 0; i < N; ++i)
    {
        D[i]=10000000000000000LL;
    }
    for (int i = 0; i < N; ++i)
    {
        vis[i]=0;
    }
 	for (int i = 0; i < N; ++i)
 	{
 		cnt[i]=0;
 	}

    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> que;
 
    D[s] = 0LL;
    cnt[s] = 1LL;
    que.push({ 0, s });
 
    while (!que.empty()) 
    {
        auto q = que.top(); que.pop();
 
        long long cst = q.first;
        int cu = q.second;
 
        if (vis[cu]) continue;
        vis[cu] = 1;
 
        for(auto &p:E[cu]) 
        {
            int to = p.first;
 
           	if (vis[to]==0)
           	{
           		if (D[cu]+p.second<D[to])
           		{
           			D[to]=D[cu]+p.second;
           			cnt[to]=cnt[cu];
           			que.push({D[to],to});
           		}
           		else if (D[cu]+p.second==D[to])
           		{
           			cnt[to]+=cnt[cu];
           			cnt[to]%=mod;
           		}
           	}
        }
    }
}

int main(int argc, char const *argv[])
{
	int n,m;
	cin>>n>>m;
	int s,t;
	cin>>s>>t;--s;--t;
	int u,v,d;
    vector<vector<pair<int,int>>> edge(n);
	for (int i = 0; i < m; ++i)
	{
		cin>>u>>v>>d;--u;--v;
		edge[u].push_back({v,d});
		edge[v].push_back({u,d});
	}
    vector<long long> ds(n),dt(n),cs(n),ct(n);
    dijk(s,edge,ds,cs);
    dijk(t,edge,dt,ct);
    long long ans=cs[t]*cs[t]%mod;
    for (int i = 0; i < n; ++i)
    {
    	if (ds[i]+dt[i]==ds[t]&&ds[i]*2LL==ds[t])
    	{
    		long long tmp=cs[i]*ct[i]%mod;
    		ans-=tmp*tmp%mod;
    		ans%=mod;
    	}
    }
    for (int i = 0; i < n; ++i)
    {
    	for (auto v:edge[i])
    	{
    		long long l=(long long)v.second;
    		if (ds[i]+l+dt[v.first]==ds[t]&&ds[i]*2LL<ds[t]&&dt[v.first]*2LL<ds[t])
    		{
    			long long tmp=cs[i]*ct[v.first]%mod;
    			ans-=tmp*tmp%mod;
    			ans%=mod;
    		}
    	}
    }
    ans%=mod;
    if (ans<0)
    {
    	ans+=mod;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 15444