akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define gcd(x,y) __gcd(x,y)
#define PI 3.14159265
#define endl "\n"
#define count_ones __builtin_popcountl
#define piii pair<int,pair<int,int>>
const int N=1e5+20,MOD=(int)(1e9)+7;
const int oo = 0x3f3f3f3f;
typedef long long ll;
using namespace std;
ll modPower(ll x, ll y,ll p){
    ll res=1;
    x%=p;
    while(y>0){
        if(y&1) res=(res*x)%p;
        y=y>>1; 
        x=(x*x)%p;
    }
    return res;
}
void boost(){
	ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}
ll GCD(ll a, ll b){
	if(a==0)return b;
	return GCD(b%a,a);
}
/* -------------------------------------- */

/* -------------------------------------- */
int main() {
	boost();
	ll n;cin>>n;ll a[n];ll sum=0;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		a[i]*=2;
		if(i%2==0)
		sum+= a[i];
		else sum-=a[i];
	}
	vector<int> b(n);
	b[0]=sum/2;
	for(int i=1;i<n;i++){
		b[i] = a[i-1]/2 - b[i-1]/2;
		b[i]*=2;
	}
	for(auto p :b )cout<<p<<" ";
	
//	for(auto a : ans)cout<<2*a<<" ";
	
	
	
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )

using namespace std;

const int N = 1e5 + 5;

int n, ar[N], L, up[N][20], r = 1, ans;

main ()
{
    cin >> n;

    for (int i = 1; i <= n; i++)
        scanf("%d", &ar[i]);

    cin >> L;

    for (int i = 1; i <= n; i++)
    {
        while (r <= n && ar[r] - ar[i] <= L) r++;
        r--;
        up[i][0] = r;
    }
    for (int j = 1; j <= 18; j++)
        for (int i = 1; i <= n; i++)
            up[i][j] = up[ up[i][j - 1] ][j - 1];
    int q, x, y;
    cin >> q;
    while (q--)
    {
        ans = 0;

        cin >> x >> y;

        if (x > y)
            swap(x, y);

        for (int i = 18; i >= 0; i--)
        {
            if ( up[x][i] < y )
                ans += (1 << i),
                x = up[x][i];
        }
        cout << ans + 1 << endl;
    }
}


Measured memory_bytes: 9088
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  ll a[N]={0};
  ll t;
  for(int i=0;i<N;i++){
    cin >> t;
    a[i]=t-i;
  }
  sort(a,a+N);
  ll m=a[N/2];
  ll ans=0;
  for(int i=0;i<N;i++){
    ans+=abs(a[i]-m);
  }
  cout  << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
//SC
#include<iostream>
using namespace std;

int main()
{
	int a,b;
	char op;
	while(1){
	cin >> a >> op >> b;
	switch(op){
		case '+' :
		cout << a+b << endl;
		break;
		case '-' :
		cout << a-b << endl;
		break;
		case '*':
		cout << a*b << endl;
		break;
		case '/':
		cout << a/b << endl;
		break;
		case '?':
		goto END;
	}
	}
	END:
	return 0;
}


Measured memory_bytes: 3060
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
const int maxd = 2e5+10;
struct
{
    int v,net;
}e[maxd<<1];
int f[maxd],eid,v[maxd];
void init()
{
    eid=0;
    memset(f,-1,sizeof(f));
}
void insert(int x,int y)
{
    e[eid].v = y;
    e[eid].net = f[x];
    f[x] = eid++;
}
int vis[maxd],ans[maxd];
void dfs(int x,int sum)
{
    sum+= v[x]; ans[x] =sum;
    vis[x] = 1;
    for(int i=f[x];i+1;i = e[i].net)
    {
        int v = e[i].v;
        if(vis[v]) continue;
        dfs(v,sum);
    }
}
int main()
{
    // freopen("a.in","r",stdin);
    // freopen("k.out","w",stdout);
    int n,m;init();
    scanf("%d %d",&n,&m);
    for(int i=1;i<n;i++)
    {
        int x,y;
        scanf("%d %d",&x,&y);
        insert(x,y);insert(y,x);
    }
    for(int i=1;i<=m;i++)
    {
        int x,y;
        scanf("%d %d",&x,&y);
        v[x] += y;
    }
    dfs(1,0);
    for(int i=1;i<=n;i++) printf("%d ",ans[i]);
    return 0;
}

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

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

    double edge = (double)l / 3;

    printf("%.10f\n", edge*edge*edge);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// ll mod=1000000007;
 
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,i,j,k,temp,temp2,n,m,x,y,sum=0,o;
    string a;
    cin >> a;
    cout << a.substr(0,3);
}


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

void area(double,double,double);//面積//
void around(double,double,double);//周囲//
void height(double,double,double);//aを底辺とした時の高さ//

int main(void){

	double a,b,c;//aとbは辺,cは角度(度数法),sは面積,lは周囲,hは高さ//

	scanf("%lf %lf %lf",&a,&b,&c);
	
	area(a,b,c);
	around(a,b,c);
	height(a,b,c);
	
	return 0;
}

void area(double a,double b,double c){

	double s;
	c/=180;
	c*=3.14159265;
	s=sinl(c)*a*b/2;
	printf("%lf\n",s);
}
void around(double a,double b,double c){
	
	double l;
	
	l=a+b+sqrt(a*a+b*b-2*a*b*cosl(c/180*3.141592));
	printf("%lf\n",l);
}

void height(double a,double b,double c){
	
	double base,s;

	c/=180;
	c*=3.14159265;
	s=sinl(c)*a*b/2;
	base=s/a*2;
	printf("%lf\n",base);
}

Measured memory_bytes: 652
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderCs
{
    class Program
    {
        static void Main()
        {

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

            if (2000 < Arg || Arg == 100) Console.WriteLine(1);
            else if (Arg < 100) Console.WriteLine(0);
            else
            {

                var Num = Arg / 100;
                var Surplus = ((Arg % 100) - 1) / 5;

                if (Surplus < Num) Console.WriteLine(1);
                else Console.WriteLine(0);

            }

        }


    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        sc.close();
        if ((Math.abs(b - a) <=d && Math.abs(c - b) <= d) || Math.abs(c - a) <= d) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

int boo(int n) {
    return n < 22 ? n : 0;
}

int score(int[] c) {
    int ans;
    int one;
    foreach(ci; c) {
        if(ci == 1) {
            ++one;
        } else {
            ans += min(10, ci);
        }
    }
    while(one > 1) {
        ++ans;
        --one;
    }
    if(one == 0) {
        return boo(ans);
    } else {
        return max(boo(ans+1), boo(ans+11));
    }
}

void main(){
    while(true) {
        auto c = readInts();
        if(c.length == 1 && c[0] == 0) {
            return;
        }
        writeln(score(c));
    }
}

Measured memory_bytes: 2404
#include<bits/stdc++.h>
#define L long long
using namespace std;
const int q=1000000007;
int n,a[1000010],b[1000010],p;
inline int C(int n,int m)
{
	if(m<0 || m>n)
	  return 0;
	return (L)a[n]*b[m]%q*b[n-m]%q;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i;
	scanf("%d",&n);
	a[0]=1;
	for(i=1;i<=n;i++)
	  a[i]=(L)a[i-1]*i%q;
	b[0]=b[1]=1;
	for(i=2;i<=n;i++)
	  b[i]=q-(L)q/i*b[q%i]%q;
	for(i=2;i<=n;i++)
	  b[i]=(L)b[i]*b[i-1]%q;
	for(i=0;i<n;i++)
	  p=(p+a[n-1]-(L)C(i-1,n-1-i)*a[i]%q*a[n-1-i])%q;
	p=(p+q)%q;
	printf("%d\n",p);
	return 0;
}


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

int main(int argc, char const *argv[])
{
    int x, y, s;
    while(1) {
        cin >> x >> y;
        if (x==0 && y==0)
        {
            break;
        }
        if (x>y)
        {
            s = x;
            x = y;
            y = s;
        }
        cout << x << " " << y << endl;
    }
    return 0;
}

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

typedef long long ll;

// Vectors
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define print(msg) cout << msg << endl

const int INF = 1e9;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> arr(n);
    //int total = 0;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }

    ll total = 0;
    int currMax = arr[0];
    for (int i = 0; i < n; ++i) {
        currMax = max(arr[i], currMax);
        total += (currMax - arr[i]);
    }

    cout << total << "\n";

    return 0;
}

Measured memory_bytes: 3924
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int[][] ary = new int[4][13];
        for(int i = 0, n = scn.nextInt(); i < n; i++) {
            String s = scn.next();
            int p, v = scn.nextInt();
            if(s.equals("S")) {
                p = 0;
            } else if(s.equals("H")) {
                p = 1;
            } else if(s.equals("C")) {
                p = 2;
            } else {
                p = 3;
            }
            ary[p][~-v]++;
        }
        for(int i = 0; i < 52; i++) {
            if(ary[i / 13][i % 13] < 1) {
                switch(i / 13) {
                  case 0:
                    System.out.print("S");
                    break;
                  case 1:
                    System.out.print("H");
                    break;
                  case 2:
                    System.out.print("C");
                    break;
                  case 3:
                    System.out.print("D");
                    break;
                }
                System.out.println(" " + (i % 13 + 1));
            }
        }
    }
}

Measured memory_bytes: 18064
import java.util.*;

public class Main {
    //-------------------------------------------------------------//
    public static final void main(String[] args) {
        new Main().solve();
    }
    //-------------------------------------------------------------//
    private final Scanner sc = new Scanner(System.in);

    void solve() {
        int H = sc.nextInt();
        int W = sc.nextInt();

        for (int i = 0; i < W + 2; i++) System.out.print("#");
        System.out.println();

        for (int i = 0; i < H; i++) {
            System.out.print("#");
            System.out.print(sc.next());
            System.out.print("#");
            System.out.println();
        }

        for (int i = 0; i < W + 2; i++) System.out.print("#");
        System.out.println();
    }
}

Measured memory_bytes: 23380
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

using namespace std;

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

int main() {

	ll q, h, s, d;
	ll n;

	cin >> q >> h >> s >> d;
	cin >> n;

	ll x = min(4 * q, min(2 * h, s));

	ll ans = 0;

	if (d < 2 * x) {
		ans = (n / 2)*d + (n % 2)*x;
	}
	else {
		ans = n*x;
	}

	cout << ans << endl;
	
	return 0;

}


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

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

int main(){
    vector<ll> a(88,0);
    a[0]=a[1]=1;
    for(int i=2;i<88;i++){
        a[i]=a[i-1]+a[i-2];
    }
    ll q; cin>>q;
    rep(_,q){
        ll x,y,ans,cnt=0; cin>>x>>y;
        if(x<y) swap(x,y);
        for(int i=85;i>=1;i--){
            if(x==1 && y==1){
                ans=1; break;
            }
            if(a[i+1]<=x && a[i]<=y){
                ans=i; break;
            }
        }
        if(ans==1){
            for(int i=1;i<=y;i++) cnt=(cnt+x/i)%MOD;
            if(x==2 && y==2) cnt=(cnt+1)%MOD;
        }
        else{
            ll X,Y;
            for(int i=0;i<ans;i++){
                if(i==0){
                    X=a[ans]; Y=a[ans+1];
                }
                else{
                    X=a[ans]+a[i]*a[ans-i-1];
                    Y=a[ans+1]+a[i]*a[ans-i];
                }
                if(X<=y) cnt=(cnt+(x-Y+X)/X)%MOD;
                if(X<=x) cnt=(cnt+(y-Y+X)/X)%MOD;
            }
        }
        printf("%lld %lld\n",ans,cnt);
    }
}


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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
#define mem(a,b) memset(a,b,sizeof(a))
#define shutdown ios::sync_with_stdio(false)
#define MAX 10e18+1000
#define INF 0x3f3f3f3f
#define MAR 10e5+100

int main() {
    shutdown;
    char a,b;
    cin>>a>>b;
    int c=a-b;
    if(c>0)
        cout<<">"<<endl;
    else if(c<0)
        cout<<"<"<<endl;
    else
        cout<<"="<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  	double N,K;
    cin >> N >> K;
  double ans=0;
  for(int n=1;n<N+1;n++){
    if(n>=K){
      ans += 1/N;
      continue;
    }
      double l;
  	l=log2(K/n);
 	 int L;
  	L=ceil(l);
   double s=pow(0.5 , L);
    ans += (1/N)*s;
  }
  cout << setprecision(12) << ans << endl;
}

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

using namespace std;

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

	vector<vector<int>> g(N);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for (const auto &edges : g) {
		cout << edges.size() << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include <numeric>
#include<map>
 
 
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1e13
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
 
typedef long long int ll;
#define MOD 1000000007

vector<ll> Eratosthenes(ll n,vector<ll>& arr){

	for(ll i = 0; i < n;i++){
		arr[i] = 1;
	}
	for(ll i = 2; i < sqrt(n); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) < n; j++){
				arr[i *(j + 2)] = 0;
			}
		}
    }
    return arr;
}


int main(){


    ll n;
    
    while(cin >> n){
        ll m = n * 10;
        ll ans_mini = INF,ans_maxi = INF;
        vector<ll> arr(m);
        arr = Eratosthenes(m,arr);        
        REP(i,arr.size()){
            if(i < n && arr[i]){
                ans_mini = i;
            }
            if(i > n && arr[i]){
                ans_maxi = i;
                break;
            }
        }
        cout << ans_mini << " " << ans_maxi << endl;
    }
    
    return 0;
}


Measured memory_bytes: 10908
#include <bits/stdc++.h>
using namespace std;
int N,A,B,C;
vector<int> L;
int ans=(1<<30);
void dfs(int cur,int a,int b,int c,int mp){
    if(cur==N){
        if(a>0&&b>0&&c>0){
            ans=min(ans,abs(a-A)+abs(b-B)+abs(c-C)+mp-30);
        }
        return;
    }
    dfs(cur+1,a+L[cur],b,c,mp+10);
    dfs(cur+1,a,b+L[cur],c,mp+10);
    dfs(cur+1,a,b,c+L[cur],mp+10);
    dfs(cur+1,a,b,c,mp);
}
int main(){
    cin>>N>>A>>B>>C;
    for(int i=0;i<N;i++){
        int k;cin>>k;
        L.push_back(k);
    }
    dfs(0,0,0,0,0);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+5;
int main() {
	int n;cin>>n;
	std::vector<int> V(n);
	for(int i=0;i<n;i++) cin>>V[i];
    sort(V.begin(),V.end());
	int ans=0;
	for(int i=0;i<n;i++) {
		for(int j=i+1;j<n;j++) {
			for(int k=j+1;k<n;k++) {
				if(V[i]+V[j]>V[k]
					&&V[i]!=V[j]&&V[j]!=V[k]) ans++;
			}
		}
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
void sort_as(int a[],int size) 
{
    int tmp;
    for (int i=0;i<size-1;i++) {
        for (int j=i+1;j<size;j++) {
            if (a[i]>a[j]) {
                tmp=a[i];
                a[i]=a[j];
                a[j]=tmp;
            }
        }
    }
}
int main() {
    int n,k;
    int p[1000];
    int tmp;
    scanf("%d %d",&n,&k);
    for (int i=0;i<n;i++) {
        scanf("%d",&p[i]);
    }
    sort_as(p,n);
    int sum=0;
    for (int i=0;i<k;i++) sum+=p[i];
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <numeric>
#include <complex>
using namespace std;

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

string field[220];
string afield[220];

int main() {
    int H, W;

    cin >> H >> W;
    rep(i, H) {
        cin >> field[i];
    }
    for (int i = 1; i <= H * 2; i += 2) {
        afield[i] = field[i / 2];
        afield[i + 1] = field[i / 2];
    }

    for (int i = 1; i <= H * 2; i++) {
        cout << afield[i] << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    int ans = 0;
    REP(k1, 10) {
        REP(k2, 10) {
            REP(k3, 10) {
                int nowidx = 0;
                REP(i, N) {
                    if(nowidx == 0) {
                        if(S[i]-'0' == k1) nowidx++;
                    } else if(nowidx == 1) {
                        if(S[i]-'0' == k2) nowidx++;
                    } else {
                        if(S[i]-'0' == k3) {
                            ans++;
                            break;
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
	int n[100] = {0};
	int a, b;
	int f = 0;
	while ( cin >> a >> b ) {
		n[a - 1]++;
		n[b - 1]++;
		if ( a == 0 ) {
			f = 0;
			for ( int i = 0; i < 100; i++ ) {
				if ( ( i < 2 && n[i] % 2 == 0 ) || ( i >= 2 && n[i] % 2 == 1 ) )
					f = 1;
				n[i] = 0;
				
			}
			if ( f == 0 ) cout << "OK" << endl;
			else cout << "NG" << endl;
			n[100] = {0};
		}
	}

	
}

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

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)

const int INF = 100000000;

using namespace std;


int main() {
	int a, b;
	char c;
	cin >>a >> c >> b;
	if (c == '+')cout << a + b << endl;
	else cout << a - b << endl;

	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for n in range(m)]
cnt = [0]*n
cnt.insert(0,"X")
for i in range(m):
	for j in range(2):
		cnt[ab[i][j]] += 1
cnt.pop(0)
for s in range(len(cnt)):
	print(cnt[s])

Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9L+7;
int n;
vector<int> inp;
vector<int> dp;


int main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        
        if( s == "RRR") cout<<3<<endl;
        else if(s == "RRS") cout<<2<<endl;
        else if(s == "RSR") cout<<1<<endl;
        else if(s == "SRR") cout<<2<<endl;
        else if(s == "SSR") cout<<1<<endl;
        else if(s == "SRS") cout<<1<<endl;
        else if(s == "RSS") cout<<1<<endl;
        else if(s == "SSS") cout<<0<<endl;
        
    }
    
}


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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int n,i,j,k,x,y,z,sum=1000;
    cin>>n;
    long long int A[n+1];
    vector<long long int>vt;
    for(i=1;i<=n;i++){
        cin>>A[i];
    }
    for(i=2;i<=n;i++){
       if(A[i]>A[i-1])
       vt.push_back(i);
    }
    if(vt.empty())
        cout<<1000;
    else{
        i=1;
        y=300;
        for(j=0;j<vt.size();j++){
            y=300;
            while(i<vt[j]){
                y=min(y,A[i]);
                i++;
            }
            //cout<<y<<" "<<vt[j]<<" "<<sum<<endl;
            sum=(sum/y)*A[vt[j]]+sum%y;
        }
        cout<<sum;
    }
    return 0;
}


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

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //-----------------------------------------
    int A, B, C;
    cin >> A >> B >> C;
    
    if((A==B&&B==C) || (A!=B && A!=C && B!=C))
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <cstdio>
#include <cctype>
#include <vector>
#include <cstring>
#include <algorithm>
#define pc putchar
#define gc() getchar()
typedef long long LL;
//const int N=

inline int read()
{
	int now=0,f=1;register char c=gc();
	for(;!isdigit(c);c=='-'&&(f=-1),c=gc());
	for(;isdigit(c);now=now*10+c-48,c=gc());
	return now*f;
}

int main()
{
	int K=read(),A=read(),B=read();
	if(B>A+2)
	{
		if(K<=A) return printf("%d\n",K+1),0;
		K-=A-1;
		LL ans=1ll*(K/2)*(B-A);
		if(K&1) ++ans;
		printf("%lld\n",ans+A);
	}
	else printf("%d\n",K+1);

	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {

    static <T extends Comparable<? super T>> boolean nextPermutation(T[] sequence) {
        int first = getFirst(sequence);
        if (first == -1) return false;
        int toSwap = sequence.length - 1;
        while (sequence[first].compareTo(sequence[toSwap]) >= 0) --toSwap;
        swap(sequence, first++, toSwap);
        toSwap = sequence.length - 1;
        while (first < toSwap) swap(sequence, first++, toSwap--);
        return true;
    }

    static <T extends Comparable<? super T>> int getFirst(T[] sequence) {
        for (int i = sequence.length - 2; i >= 0; --i)
            if (sequence[i].compareTo(sequence[i + 1]) < 0) return i;
        return -1;
    }

    static <T extends Comparable<? super T>> void swap(T[] sequence, int i, int j) {
        T tmp = sequence[i];
        sequence[i] = sequence[j];
        sequence[j] = tmp;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] graph = new int[n][n];
        for (int i = 0; i < n; ++i) Arrays.fill(graph[i], 0);
        for (int i = 0; i < m; ++i) {
            int from = sc.nextInt() - 1;
            int to = sc.nextInt() - 1;
            graph[from][to] = 1;
            graph[to][from] = 1;
        }

        Integer[] perm = new Integer[n];
        for (int i = 0; i < n; ++i) perm[i] = i;
        int res = 0;
        do {
            if (perm[0] != 0) continue;
            boolean flag = true;
            for (int i = 0; i < n - 1; ++i) {
                if (graph[perm[i]][perm[i + 1]] == 0) flag = false;
            }
            if (flag) ++res;
        } while (nextPermutation(perm));

        System.out.println(res);
    }
}

Measured memory_bytes: 24528
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define vvl vector<vector<ll>>
#define vl  vector<ll>
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
typedef long long ll;
#define pb push_back
const ll MOD = 1000000007;
const double PI = acos(-1);
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
//int n,q;
//int ans;
//string s;

signed main(){
	acc_io;
	int n,m;
	cin>>n>>m;
	vvl p(n+1,vl());
	rep(i,0,m){
		int a,b;
		cin>>a>>b;
		p.at(a).pb(b);
		p.at(b).pb(a);
	}
	int a[n+1];
	int ok=0;
	int ans=0;
	rep(i,1,n+1) a[i]=i;
	do{
//		rep(i,1,n+1) cout<<a[i]<<" ";
//		cout<<endl;
		rep(i,1,n){
			ok=0;
			rep(j,0,p.at(a[i]).size()){
//				cout<<i<<":";
//				cout<<p.at(a[i]).at(j)<<":"<<a[i+1]<<endl;
				if( p.at(a[i]).at(j)==a[i+1] ){
//					cout<<i<<":OK"<<endl;
					ok=1;
					break;
				}
			}
			if(ok==0) break;
		}
		if(ok==1) ans++;
		ok=0;
	}while(next_permutation(a+2,a+n+1));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
s = input()
t = input()

s1 = s + s
count = [0] * len(s)

for i in range(len(s)):
    for j in range(len(s)):
        if s1[i + j] == t[j]:
            count[i] += 1

print("Yes" if max(count) == len(s) else "No")


Measured memory_bytes: 2940
#include<cstdio>
#include<map>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<cctype>
#include <iostream>
using namespace std;
int num[100011];
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        int i;
        for(i=0;i<n;i++)
            scanf("%d",&num[i]);
        long long a1=0;
        long long s=0;
        if(num[0]>0)
            s=num[0];
        else
        {
            a1+=abs(num[0])+1;
            s=1;
        }
        for(i=1;i<n;i++)
        {
            if((s>0&&s+num[i]<0)||(s<0&&s+num[i]>0))
                s+=num[i];
            else
            {
                a1+=abs(s+num[i])+1;
                if(s>0)
                {
                    s=-1;
                }
                else
                {
                    s=1;
                }
            }
        }
        long long a2=0;
        if(num[0]<0)
            s=num[0];
        else
        {
            a2+=abs(num[0])+1;
            s=-1;
        }
        for(i=1;i<n;i++)
        {
            if((s>0&&s+num[i]<0)||(s<0&&s+num[i]>0))
                s+=num[i];
            else
            {
                a2+=abs(s+num[i])+1;
                if(s>0)
                {
                    s=-1;
                }
                else
                {
                    s=1;
                }
            }
        }
        printf("%lld\n",min(a1,a2));
    }
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<algorithm>
using namespace std;
int max(int a,int b){return a>b?a:b;}
int main(){
	int n,i;
	int a,b,c;
	int d[100];
	scanf("%d",&n);
	scanf("%d %d %d",&a,&b,&c);
	for(i=0;i<n;i++)scanf("%d",&d[i]);
	sort(d,d+n);
	reverse(d,d+n);
	int ans=c/a;
	int t=c;
	int p=a;
	for(i=0;i<n;i++){
		t+=d[i];
		p+=b;
		ans=max(ans,t/p);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1040
import copy
 
N = int(input())
H = list(map(int, input().split()))
 
cnt = 0
mv = 0
 
for i in range(N-1):
    
    if H[i] >= H[i+1]:
        cnt += 1
 
    else:
        if cnt > mv:
            mv = copy.copy(cnt)
        cnt = 0
 
if cnt > mv:
    mv = copy.copy(cnt)
        
 
print(mv)

Measured memory_bytes: 14764
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	l := make([]int, n+1)
	l[0] = 2
	l[1] = 1
	for i := 2; i <= n; i++ {
		l[i] = l[i-1] + l[i-2]
	}
	fmt.Println(l[n])
}


Measured memory_bytes: 512
#include <stdio.h>
int main(void){
    // Here your code !
    int n,b,f,r,v;
    int inf[4][3][10]={0};
    int i,j,k,l,m;
    
    scanf("%d",&n);
    for(i = 0;i < n;i++){
        scanf("%d%d%d%d",&b,&f,&r,&v);
        inf[b-1][f-1][r-1] += v;
    }
    for(i = 0;i < 4;i++){
        for(j = 0;j < 3;j++){
            for(k = 0;k < 10;k++){
                printf(" %d",inf[i][j][k]);
            }
            printf("\n");
        }
        if(i != 3){
            printf("####################\n");
        }
    }
    return 0;
}

Measured memory_bytes: 612
import math
from functools import reduce,lru_cache

K = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

@lru_cache(maxsize=None)
def calc_temp_2(k):
    temp_2 = 0
    for j in range(1,k):
        for l in range(j+1,k):
            temp_2 += gcd(k, j, l) * 2
        temp_2 += gcd(k,j)
    return temp_2

@lru_cache(maxsize=None)
def dp(k):
    if k == 1:
        return 1
    else:
        temp_1 = sum([gcd(k, i) for i in range(1,k)])
        temp_2 = calc_temp_2(k)
        return dp(k-1) + k + temp_1 * 3 + temp_2 * 3

print(dp(K))

Measured memory_bytes: 9824
#include<iostream>
#include<cstdio>
#define M 1000001
using namespace std;

int main(){
    int H, W;
    while(true){
        cin >> H >> W;
        if (W == 0 && H == 0) break;
        for(int i = 0; i < H; i ++){
            for(int j = 0; j < W; j ++){
                if(i == 0 || i == H - 1 || j == 0 || j == W - 1){
                    cout << '#';
                }else{
                    cout << '.';
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


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

using namespace std;

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

int main() {
  int N;
  cin >> N;
  vector<long long> A(N + 1);
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  // 0: -1個，使わない
  // 1: -1個，使う
  // 2: +1個，使わない
  // 3: +1個，使う
  vector<vector<long long>> dp(N + 5, vector<long long>(4, -1e15));
  dp[0].assign(4, 0);
  for (int i = 1; i <= N; i++) {
    if (i % 2) {
      chmax(dp[i][0], max(dp[i - 1][2], dp[i - 1][3]));
      if (i >= 2) chmax(dp[i][1], max(dp[i - 2][0], dp[i - 2][1]) + A[i]);
      dp[i][2] = 0;
      chmax(dp[i][3], dp[i - 1][2] + A[i]);
    } else {
      chmax(dp[i][0], max(dp[i - 1][0], dp[i - 1][1]));
      if (i >= 2) chmax(dp[i][1], max(dp[i - 2][0], dp[i - 2][1]) + A[i]);
      chmax(dp[i][2], dp[i - 1][3]);
      chmax(dp[i][3], dp[i - 1][0] + A[i]);
    }
  }
  long long ans;
  if (N % 2) {
    ans = max(dp[N][0], dp[N][1]);
  } else {
    ans = max(dp[N][2], dp[N][3]);
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 18836
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const int MAX = 105;

int t = 0;
pair<int, int> ans[MAX];
bool seen[MAX];
vector<int> to[MAX];

void dfs(int u) {
  if (seen[u]) return;
  seen[u] = true;
  ans[u].first = ++t;
  for (int v: to[u]) {
    dfs(v);
  }
  ans[u].second = ++t;
}

int main() {
  int n, u, k, v;
  cin >> n;
  rep(i, n) {
    cin >> u >> k;
    rep(j, k) {
      cin >> v;
      to[u].push_back(v);
    }
  }

  rep(i, n+1) seen[i] = false;
  FOR(i, 1, n+1) sort(to[i].begin(), to[i].end());

  FOR(i, 1, n+1) dfs(i);

  FOR(i, 1, n+1) {
    cout << i << " " << ans[i].first << " " << ans[i].second << endl;
  }



  
  return 0;
}


Measured memory_bytes: 3148
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int N, K; cin >> N >> K;

    if (K == 0) {
        cout << (long long)N * N << '\n';
        return;
    }

    long long ans = 0;
    for (int b = K+1; b <= N; b++) {
        int num = b - K;
        ans += num * (N / b);
        if (N % b >= K) ans += N % b - (K - 1);
    }
    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <set>
#include <vector>
#include <stdlib.h>

#define FOR(i, l, r) for (i = (l); i < r; i++ )

using namespace std;
typedef long long ll;

#define MAX_N (500010)

struct Node{
    int key;
    Node *p_p;
    Node *p_l;
    Node *p_r;
};

int m;

Node *T = NULL;


void insert(int k) {
    Node *p_y = NULL;		// parent of x
    Node *p_x = T;
    Node *p_z = (Node *)malloc(sizeof(Node));
    
    p_z->key = k;
    p_z->p_p = p_z->p_l = p_z->p_r = NULL;

    while ( p_x != NULL ) {
	p_y = p_x;
	if ( k < p_x->key ) {
	    p_x = p_x->p_l;
	}
	else {
	    p_x = p_x->p_r;
	}
    }

    p_z->p_p = p_y;		// parent of z is y.
    
    if ( p_y == NULL ) {		// T is NULL.
	T = p_z;
    }
    else if ( k < p_y->key ) {	// z is left child of y.
	p_y->p_l = p_z;

    }
    else {			// z is right child of y.
	p_y->p_r = p_z;
    }

    return;
}

void preorder( vector<int> *p_v, Node *p_x ) {
    if ( p_x == NULL ) return;
    else {
	p_v[0].push_back(p_x->key);
	preorder(p_v, p_x->p_l);
	preorder(p_v, p_x->p_r);	
    }
    
    return;
}

void inorder( vector<int> *p_v, Node *p_x ) {
    if ( p_x == NULL ) return;
    else {
	inorder(p_v, p_x->p_l);
	p_v[0].push_back(p_x->key);	
	inorder(p_v, p_x->p_r);	
    }
    
    return;
}

bool find( Node *p_x, int k ) {
    if ( p_x == NULL ) return false;
    else {
	if ( k == p_x->key ) {
	    return true;
	}
	else if ( k < p_x->key ) {
	    return find( p_x->p_l, k );
	}
	else {
	    return find( p_x->p_r, k );
	}
    }
}

int main()
{
    scanf("%d", &m);
    for ( int i = 0; i < m; i++ ) {
	char str[100];
	scanf("%s", str);
	if ( str[0] == 'i' ) {	// insert
	    int k;
	    scanf("%d", &k);
	    insert(k);
	}
	else if ( str[0] == 'f' ) { // find
	    int k;
	    scanf("%d", &k);
	    printf("%s\n", find(T, k) ? "yes" : "no" );
	}
	else {			// print
	    vector<int> pre;
	    vector<int> in;
	    preorder( &pre, T );
	    inorder( &in, T );

	    for ( int i = 0; i < in.size(); i++ ) {
		printf(" %d", in[i]);
	    }
	    printf("\n");
	    for ( int i = 0; i < pre.size(); i++ ) {
		printf(" %d", pre[i]);
	    }
	    printf("\n");	    
	}
    }
    
    return 0;
}

Measured memory_bytes: 26308
//============================================================================
    // Name        : f.cpp
    // Author      :
    // Version     :
    // Copyright   : Your copyright notice
    // Description : Hello World in C++, Ansi-style
    //============================================================================
     
    #include <iostream>
    #include<vector>
    using namespace std;
     
    int main() {
    	long long n;cin>>n;
    	if(n==2){
    		cout<<1<<endl;
          return 0;
    	}
    	int mans=0;
    	for(long long i=1;i*i<=n-1;i++){
    		if((n-1)%i==0){
    			mans+=2;
    			if(i*i==n-1){
    				mans--;
    			}
    		}
    	}
    	mans--;
    	vector<long long> v;
    	v.push_back(n);
    	for(long long i=2;i*i<=n;i++){
    		if(n%i==0){
    			v.push_back(i);
    			if(i*i!=n){
    				v.push_back(n/i);
    			}
    		}
    	}
    	int nans=0;
    	for(int i=0;i<v.size();i++){
    		long long tempn=n;
    		long long tempk=v[i];
    		while(tempn>=tempk){
    			if(tempn%tempk==0){
    				tempn/=tempk;
    			}else{
    				tempn%=tempk;
    			}
     
    		}
    		if(tempn==1)nans++;
    	}
    	cout<<mans+nans<<endl;
    	return 0;
    }

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;

class MyClass
{
    public static void Main(string[] args)
    {
        var n = 0;
        var wordlist = new List<string>();
        var pagelist = new List<int>();
        var str = "";
        while ((str = Console.ReadLine()) != null)
        {
            var input = str.Split();
            wordlist.Add(input[0]);
            pagelist.Add(int.Parse(input[1]));
            n++;
        }

        var sortedlist = new List<string>(wordlist);
        sortedlist.Sort();
        var previous = "";
        foreach (var item in sortedlist)
        {
            if (item == previous)
            {
                continue;
            }
            previous = item;
            Console.WriteLine(item);
            var page = new List<int>();
            for (int i = 0; i < n; i++)
            {
                if (wordlist[i] == item)
                {
                    page.Add(pagelist[i]);
                }
            }
            page.Sort();
            Console.WriteLine(string.Join(" ", page));
        }
    }
}


Measured memory_bytes: 14700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
#define MOD 1000000007
#define INF 1000000

int main()
{
  ll A,B,K;cin>>A>>B>>K;
  
  if (K<=A)
  {
    cout<<A-K<<" "<<B<<endl; 
  }
  else if(A<K && (K-A)<=B)
  {
    cout<<0<<" "<<B-(K-A)<<endl; 
  }
  else 
  {
    cout<<0<<" "<<0<<endl; 
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
const long long MOD = 1e9 + 7, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}
 
 
 
signed main(){
	int N;
	cin>>N;
	vector<vector<int>>a(N,vector<int>(N-1));
	set<pair<int,int>>flg;
	vector<int>to(N,-1);
	REP(i,N)REP(j,N-1){
		cin>>a[i][j];
		a[i][j]--;
		if(j == 0){
			to[i] = a[i][j];
		}
	}
	vector<int>now(N,0);
	REP(i,N){
		if(to[to[i]] == i){
			flg.insert({min(i,to[i]),max(i,to[i])});
		}
	}
	int turn = 0;
	while(!flg.empty()){
		set<pair<int,int>>nflg;
		while(!flg.empty()){
			auto p = *flg.begin();
			flg.erase(flg.begin());
			now[p.first]++;
			now[p.second]++;
			if(now[p.first]<N-1)to[p.first] = a[p.first][now[p.first]];
			if(now[p.second]<N-1)to[p.second] = a[p.second][now[p.second]];
			if(now[p.first]<N-1&&to[to[p.first]] == p.first)nflg.insert({min(p.first,to[p.first]),max(p.first,to[p.first])});
			if(now[p.second]<N-1&&to[to[p.second]] == p.second)nflg.insert({min(p.second,to[p.second]),max(p.second,to[p.second])});
		}
		flg = nflg;
		turn++;
	}
	int ok = 1;
	REP(i,N){
		if(now[i]!=N-1)ok = 0;
	}		
	if(ok)cout<<turn<<endl;
	else cout<<-1<<endl;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long n, m, q;
    cin >> n;
    vector <int> qw (100000);
    q=0;
    for (int i=0; i<n; ++i)
    {
        int f;
        cin >> f;
        qw[f-1]+=1;
        q+=f;
    }
    cin >> m;
    for (int i=0; i<m; ++i)
    {
        long long f, d;
        cin >> f >> d;
        q-=qw[f-1]*f;
        q+=qw[f-1]*d;
        qw[d-1]+=qw[f-1];
        qw[f-1]=0;
        cout << q << endl;
    }
}


Measured memory_bytes: 3764
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
// #define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }
  void solve()
  {
  	int n;
  	cin>>n;
  	vi v(n);
  	int g=0;
  	forn(i,n){cin>>v[i];
g=__gcd(g,v[i]);
  	}
  	vi mem(1e6+3,0);
  	vi lf(1e6+3,1e7);
  	for(int i=1;i<=1e6;i++)lf[i]=i;
  	for(int i=2;i<=1e6;i++)
  	{

  		for(int j=i;j<=1e6;j+=i)lf[j]=min(lf[j],i);
  	}
vector<int>type(n);
bool sh=false;
for(int i=n-1;i>=0;i--)
{
	int x=v[i];
	bool is=false;
	while(x>1)
	{
int currf=lf[x];
if(mem[currf])is=true;
while(x%currf==0)x/=currf;
mem[currf]++;
	}
	sh|=is;

}
if(!sh)type[0]=1;
else if(g==1)type[0]=2;
else type[0]=0;

	if(type[0]==0)cout<<"not coprime ";
	else if(type[0]==1)cout<<"pairwise coprime ";
	else cout<<"setwise coprime ";	


  }
  
  int main()
  {
ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
    #endif
int t=1;
while(t--)
{
  solve();
}

    return 0;
  }


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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int main()
{
    double r ; cin >> r;
    cout << 2 *  r * 3.14;
}


Measured memory_bytes: 3784
#include <cstdio>
#include <cstdlib>

#define siz 10000000

char buf[siz], *bit = buf;

inline int nextInt(void) {
	register int ret = 0;
	register int neg = false;

	for (; *bit < '0'; ++bit)
		if (*bit == '-')neg ^= true;

	for (; *bit >= '0'; ++bit)
		ret = ret * 10 + *bit - '0';

	return neg ? -ret : ret;
}

int n, m;

int pre[100005];

inline int ask(int p) {
	int ret = 0;
	for (; p; p -= p&-p)
		ret += pre[p];
	return ret;
}

inline void add(int p, int k) {
	for (; p <= n; p += p&-p)
		pre[p] += k;
}

signed main(void) {
	fread(buf, 1, siz, stdin);

	n = nextInt();
	m = nextInt();

	for (int i = 1; i <= m; ++i) {
		int c = nextInt();
		if (c)	// get(i)
			printf("%d\n", ask(nextInt()));
		else	// add(s, t, x)
		{
			int x = nextInt();
			int y = nextInt();
			int k = nextInt();
			add(x, k); add(y + 1, -k);
		}
	}

	//system("pause");
}

Measured memory_bytes: 4320
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define is(s) freopen((const char*)(s),"r",stdin)
#define os(s) freopen((const char*)(s),"w",stdout)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
//#define x first
//#define y second

using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(a==b&&b==c)
	cout<<"No"<<endl;
	else if(a==b||a==c||b==c)
	cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;}


Measured memory_bytes: 256
program grid_game
  implicit none
  integer              :: h, w, n
  integer, allocatable :: x(:), y(:)
  integer              :: i, j, k, l, act, width
  read(*,*) h, w, n
  allocate(x(n),y(n))
  do k = 1, n
     read(*,*) x(k), y(k)
  end do
  call merge_sort(n,y,x)
  call merge_sort(n,x,y)
  act = h
  width = 1
  k = 1
  do i = 1, h
     do while (x(k) .lt. i+1 .and. k .le. n)
        k = k + 1
     end do
     if (x(k) .gt. i+1) then
        width = width + 1
        cycle
     end if
     l = k
     do while (x(k) .eq. i+1 .and. k .le. n .and. y(k) .le. width)
        k = k + 1
     end do
     if (l .ne. k) then
        act = i
        exit
     end if
     if (y(k) .ne. width+1) width = width + 1
  end do
  deallocate(x,y)
  write(*,'(i0)') act
  stop
contains
  subroutine merge_sort(n,x,y)
    implicit none
    integer, intent(in)    :: n
    integer, intent(inout) :: x(n), y(n)
    integer                :: number, length, i, ubound
    number = n
    length = 1
    do while (number .gt. 1)
       do i = 1, number/2
          ubound = min(2*i*length,n)
          call merge(x(2*(i-1)*length+1:(2*i-1)*length),x((2*i-1)*length+1:ubound), &
               & y(2*(i-1)*length+1:(2*i-1)*length),y((2*i-1)*length+1:ubound))
       end do
       length = 2*length
       number = (number+1)/2
    end do
    return
  end subroutine merge_sort

  subroutine merge(x1,x2,y1,y2)
    implicit none
    integer, intent(inout) :: x1(:), x2(:), y1(:), y2(:)
    integer                :: x(size(x1)+size(x2)), y(size(y1)+size(y2))
    integer                :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(x1)
    n2 = size(x2)
    do while (i1 .le. n1 .and. i2 .le. n2)
       if (x1(i1) .le. x2(i2)) then
          x(i1+i2-1) = x1(i1)
          y(i1+i2-1) = y1(i1)
          i1 = i1+1
       else
          x(i1+i2-1) = x2(i2)
          y(i1+i2-1) = y2(i2)
          i2 = i2+1
       end if
    end do
    if (i1 .le. n1) then
       x(i1+i2-1:n1+n2) = x1(i1:n1)
       y(i1+i2-1:n1+n2) = y1(i1:n1)
    else if (i2 .le. n2) then
       x(i1+i2-1:n1+n2) = x2(i2:n2)
       y(i1+i2-1:n1+n2) = y2(i2:n2)
    end if
    x1 = x(1:n1)
    x2 = x(n1+1:n1+n2)
    y1 = y(1:n1)
    y2 = y(n1+1:n1+n2)
    return
  end subroutine merge
end program grid_game

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

int main() {
  int n;
  cin >> n;
  double x,ans=0;
  string u;
  for (int i=0; i<n; i++) {
    cin >> x >> u;
    if (u == "BTC")
      x *= (double)380000;
    ans += x;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        String ans = "1";
        long count = 0l;
        for (int i = 0; i < s.length() ; i++) {
            String ss = s.substring(i, i + 1);
            if(s.substring(i, i +1).equals("1")) {
                count++;
            }
            else if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        if(count >= k) System.out.println("1");
        else System.out.println(ans);
    }
}

Measured memory_bytes: 35624