akhauriyash/Code-Regression huggingface dataset:
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

const MOD: i64 = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        mut a: [i64; n]
    }

    a.sort();
    let mut t = 0;
    let mut l = 0;
    let mut r = n - 2;
    let mut c = [a[n - 1]; 2];
    for i in 0..n - 1 {
        let a1 = (c[0] - a[l]).abs();
        let a2 = (c[0] - a[r]).abs();
        let a3 = (c[1] - a[l]).abs();
        let a4 = (c[1] - a[r]).abs();

        if a1 >= a2 && a1 >= a3 && a1 >= a4 {
            c[0] = a[l];
            l += 1;
            t += a1
        } else if a2 >= a3 && a2 >= a4 {
            c[0] = a[r];
            r -= 1;
            t += a2
        } else if a3 >= a4 {
            c[1] = a[l];
            l += 1;
            t += a3
        } else {
            c[1] = a[r];
            r -= 1;
            t += a4
        }
    }

    println!("{}", t);
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    set<int>s;
    int a,b,c;cin >>a>>b>>c;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    cout <<s.size()<<endl;
    return 0;
}

Measured memory_bytes: 3588
// C - Lining Up
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

	int amax = 0;
	vector<int> A(N);
	for(int i=0; i<N; i++){
		int a; cin>>a;
		A[a]++;
		amax = max(amax, a+1);
	}

	int ans = 1;
	int odd = (N-1)%2;
	for(int i=odd; i<N; i+=2){
		int a = A[i];
		if(!odd && i==0 && a==1) continue;
		if(a!=2){
			cout<< '0' <<endl;
			return 0;
		}
		ans = ans * a % MOD;
	}
	cout<< ans <<endl;
}

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

int main(){
  ll n;
  cin >> n;
  ll ans=(n+1)*n/2;
  vector<ll> a(n+5);
  for(int i=2;i<=n;i++){
    for(int j=i;j<=n;j+=i){
      a[j]++;
    }
    ans+=a[i]*i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 81380
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
long long a,b,k;
int main()
{
    cin>>k>>a>>b;
    if(k<=a)
	{
		puts("1");
	}
    else if(a<=b)
	{
		puts("-1");
	}
    else
	{
		cout<<((k-a)/(a-b)+bool((k-a)%(a-b)))*2+1;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;
 
 
const int MAX_N = int(1e6) + 10;
long long int MOD=1e9+7;
const long long int INF=1e18;
 
typedef long long int ll;
typedef unsigned long long int llu;
 
 
 
inline ll mul(ll a,ll b){
 
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll c=a*b;
    c=(c+MOD)%MOD;
    return c;
}
inline ll add(ll a,ll b){
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll ans=(a+b);
    ans=(ans+MOD)%MOD;
    return ans;
}
ll power(ll a,ll b,ll c=0){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mul(ans,a);
        }
        a=mul(a,a);
        b=b/2;
    }
    return ans;
}
 
  
 
 
#define all(x) (x).begin(),(x).end()
 
 
 
 
//s.reserve(32768); //updated !
//s.max_load_factor(0.25);
 

 
int main(){
   
   int a,b;
   cin>>a>>b;
   cout<<max(0,a-2*b)<<endl;
   


   
    
}
 
 
 
    
 
 
 
    
 
 
 
    
    
    
 
 
 
 
    
 
 
    
 
    
 
 
 
 
 
 
    
    
 
    
 
    
 
 
 
 
    
 


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define fori(j,n) for(ll i=j;i<n;i++)
#define forb(n,j) for(ll i=n-1;i>=0;i--)
#define endl "\n"
#define pb push_back
#define ll long long
#define mp make_pair
#define ff first
#define ss second
#define vec vector<ll>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

void wldd()
{
	ll n;
	cin >> n;
	ll a[n];
	fori(0, n)
	{
		cin >> a[i];
	}
	ll ans = 0;
	fori(1, n)
	{
		if (a[i] < a[i - 1])
		{
			ans += (a[i - 1] - a[i]);
			a[i] += a[i - 1] - a[i];
		}
	}
	cout << ans << endl;
}
int32_t main()
{
	IOS;
	/*ll t;
	cin >> t;
	while (t--)*/ wldd();
	return 0;
}

Measured memory_bytes: 5128
#include<iostream>
#include<vector>
#include<cmath>
#include<iomanip>
#include<complex>
#include<algorithm>

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

using namespace std;

const double pi = 2*acos(0.0);
const double infty = 1e40;
const double eps = 1e-14;
typedef complex<double> point;

point rot(point p, double theta){
  return p * polar(1.0,theta);
}

bool eq(double a, double b){
  return abs(b-a)<eps;
}

double getTArea(point a, point b, point c){
  double A = abs(a-b);
  double B = abs(b-c);
  double C = abs(c-a);
  double s = (A+B+C)/2.;
  return sqrt(s*(s-A)*(s-B)*(s-C));
}

double getArea(double p1, double p2){
  if( p2 < p1 ) p2 += 1;
  double th = 2*pi*(p2-p1);
  point a = rot(point(1,0),2*pi*p1);
  point b = rot(point(1,0),2*pi*p2);
  
  if( th > pi ) return th/2 + getTArea(a,b,point(0,0));
  return th/2 - getTArea(a,b,point(0,0));
}

#define MAX_NM 45
static double dp[MAX_NM][MAX_NM][MAX_NM];

int main()
{
  while(true){
    double res = 0;
    int n,m;
    vector<double> p;
    
    cin >> n >> m;
    if(n==0 && m==0)break;
    for(int i = 0; i < n; ++i){
      double pp;
      cin >> pp;
      p.push_back( pp );
    }
    sort(p.begin(),p.end());
 
    rep(i,0,MAX_NM)rep(j,0,MAX_NM)rep(k,0,MAX_NM){
      dp[i][j][k] = infty;
    }
    
    // start, count, cur
    rep(i,0,n){
      rep(j,0,m){
        dp[i][0][i] = 0;
        rep(k,0,n){
          rep(l,1,n){
            int kk = (i+k) % n;
            int nk = (i+k+l) % n;
            if( k+l >= n ) continue;
            
            //cout << i << ' ' << j << ' ' << kk << " : " << dp[i][j][kk] << endl;
            
            if( dp[i][j+1][nk] > dp[i][j][kk] + getArea( p[kk], p[nk] ) ){
                dp[i][j+1][nk] = dp[i][j][kk] + getArea( p[kk], p[nk] );
                //cout << "  to1 : " << i << ' ' << j+1 << ' ' << nk << " : " << dp[i][j+1][nk] << endl;
            }
            /*
            if( dp[i][j][nk] >   dp[i][j][kk] ){
                dp[i][j][nk] =   dp[i][j][kk];
              cout << "  to2 : " << i << ' ' << j << ' ' << nk << " : " << dp[i][j][nk] << endl;
            }
            */
          }
        }
      }
    }

    //cout << "---" << endl;
    rep(i,0,n)rep(k,0,n){
      if(dp[i][m-1][k]>=infty-eps) continue;
      //cout << i << ' ' << m-1 << ' ' << k << " : " << ' ' << pi - (getArea(p[k],p[i])+dp[i][m-1][k] ) << endl;
      res = max( res, pi - (getArea(p[k],p[i])+dp[i][m-1][k] ) );
    }
    //    cout << pi-dp[0][1][4][3] << endl;

    cout << fixed << setprecision(6) << res << endl;
    //return 0;
  }
  return 0;
}

Measured memory_bytes: 0
l , k = [int(i) for i in input().split()]

INIT = 0
tableB = [INIT] * 110
tableW = [INIT] * 110
tableW[0] = 1

for i in range(1,l+1):
  tableB[i] += tableW[i-1]
  if i - k >= 0:
    tableB[i] += tableW[i-k]
  tableW[i+1] = tableB[i]

print(sum(tableB))
#print(tableB)



Measured memory_bytes: 5604
object Main extends App {
  val scanner = new java.util.Scanner(System.in)
  val n = scanner.nextInt()

  val info = (1 to n).map { _ =>
    val b = scanner.nextInt()
    val f = scanner.nextInt()
    val r = scanner.nextInt()
    val v = scanner.nextInt()

    (b-1, f-1, r-1, v)
  }

  val init = Array.fill(4, 3, 10)(0)

  val outputs = info.foldLeft(init) {
    case (acc, (b, f, r, v)) =>
      acc(b)(f)(r) += v
      acc
  }

  val output = outputs.map { office =>
    office.map { floor => 
      " " + floor.mkString(" ")
    }.mkString("\n")
  }.mkString("\n" + "#" * 20 + "\n")

  println(output)
}

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

int main() {
	
	int q, t, f;
	char c;
	bool dir = true;
	string s, fr = "", bk = "";
	cin >> s;
	cin >> q;
	while (q--) {
		cin >> t;
		if (t == 1)
			dir = !dir;
		else {
			cin >> f >> c;
			if (f == 1) {
				if (dir)
					fr += c;
				else
					bk += c;
			} else {
				if (dir)
					bk += c;
				else
					fr += c;
			}
		}
	}
	if (dir) {
		reverse(fr.begin(), fr.end());
		cout << fr;
		cout << s;
		cout << bk;
	} else {
		reverse(bk.begin(), bk.end());
		reverse(s.begin(), s.end());
		cout << bk;
		cout << s;
		cout << fr;
	}
	return 0;
}


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

int main(void){

    static int n,m,ans=0,tmp=0 ;
    static char s[120][15],t[120][15] ;
    
    scanf ("%d",&n) ;
    
    for (int i=0; i<n; i++ ){
        
        scanf ("%s",s[i]) ;
    }
    
    scanf ("%d",&m) ;
    
    for (int i=0; i<m; i++ ){
    
        scanf ("%s",t[i]) ;
        
    }
    
    for (int i=0; i<n; i++ ){
        
        tmp = 0;
        
        for (int j=0; j<n; j++ ){
            
            if ( strcmp(s[i],s[j])==0 ){
                
                tmp ++ ;
                
            }
        }    
        
        for (int j=0; j<m; j++ ){
            
            if (strcmp(s[i],t[j])==0 ){
                
                tmp-- ;
                
            }
        }
        
        if ( ans<tmp ){
            
            ans = tmp ;
            
        }
    }

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

Measured memory_bytes: 128
#include<stdio.h>
int main(void){
	int a[3];
	int i,j,temp;
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
	
	for(i=0;i<3;i++){
		for(j=i+1;j<3;j++){
			if(a[i]>a[j]){
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
	printf("%d %d %d\n",a[0],a[1],a[2]);			
	
	return 0;
}

Measured memory_bytes: 596
function Main(input) {
  input = input.trim()
  input = input.split(" ").map(Number);
  if(Math.abs(input[0]-input[1])>Math.abs(input[0]-input[2])) console.log("B");
  else console.log("A")
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    ll H,W,N;
    cin >> H >>W >> N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    int c[H][W];
    int y = 0;
    int x =0;
    int dx =1;
    for(int i=0;i<N;i++){
        while(a[i]>0)
        {
            c[y][x] = (i+1);
            a[i]--;
            if(x+dx>=0 && x+dx<W){
                x+=dx;
                
            }else{
                y++;
                dx*= -1;
            }
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
          cout << c[i][j] <<" ";
        }
    cout <<"\n";
    }
    return 0;
}

Measured memory_bytes: 3596
import java.util.*;
public class Main {

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

        int ja=0,ab=0;
        int pass=0;
        String s=scan.next();
        for(int i=0;i<n;i++){
            if(s.charAt(i)=='a' ){
                if(pass<a+b) {
                    System.out.println("Yes");
                    ja++;
                    pass++;
                }
                else
                    System.out.println("No");
            }
            if(s.charAt(i)=='b' ){
                if(pass<a+b && ab<b) {
                    System.out.println("Yes");
                    ab++;
                    pass++;
                }
                else
                    System.out.println("No");

            }
            if(s.charAt(i)=='c')
                System.out.println("No");
        }

    }
}

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

int main(){
  long long int n, f1=2, f2=1, fn;
  cin >> n;
  for (int i = 1; i <= n; ++i){
        fn = f1 + f2;
        f1 = f2;
        f2 = fn;
    }
    cout << f1;
    return 0;
}


Measured memory_bytes: 3596
h, w = map(int, input().split())
wall = []
for i in range(h):
    wall.append(list(input()))
for i in range(h):
    for j in range(w):
        if wall[i][j] == "#":
            try:
                if wall[i+1][j]=="#":
                    continue
            except:
                pass
            try:
                if wall[i][j+1]=="#":
                    continue
            except:
                pass
            try:
                if wall[i-1][j]=="#":
                    continue
            except:
                pass
            try:
                if wall[i][j-1]=="#":
                    continue
            except:
                pass
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	
	int dp[n] = {0};
	dp[0] = 0;
	dp[1] = abs(a[1]-a[0]);
	for(int i = 2; i < n; i++){
		dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout << dp[n-1];

	return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define rep(i,l,r) for(int i=l;i<r;i++)
#define bep(i,l,r) for(int i=l;i>=r;i--)
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define el '\n'
#define sz(s) s.size()
#define all(v) v.begin(),v.end()
#define mii map<int,int>
#define mr  make_pair
using namespace std;
int mod = 1e9+7;
int inf = 1e18;
const int N = 5e5+999;
int powmod(int a,int b) {int res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}

signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
       int n;
       cin>>n;
       set<int> st;
       int x;
       rep(i,0,n)
       {
           cin>>x;
           st.insert(x);
       }
       if(sz(st)==n)
       cout<<"YES"<<el;
       else
       cout<<"NO"<<el;
       

    }
   return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

typedef complex<double> P;

const int N = 400;
const double EPS = 1e-6;
const double INF = 1e77;

int n;
vector<P> vec;
bool vis[N];

bool equals(double a, double b){
  return abs(a - b) < EPS;
}

double dot(P a, P b){
  return real(conj(a) * b);
}

double cross(P a, P b){
  return imag(conj(a) * b);
}

double dist(P a, P b){
  return abs(a - b);
}

int ccw(P p0, P p1, P p2){
  P a = p1 - p0;
  P b = p2 - p0;
  if(cross(a, b) > EPS) return 1;
  if(cross(a, b) < -EPS) return -1;
  if(dot(a, b) < -EPS) return 2;
  if(norm(a) < norm(b)) return -2;
  return 0;
}

double getr(P s, P t, P v){
  int jd = ccw(s, v + s, t);
  if(jd == 1){
    return dot(v, t - s) / (abs(v) * abs(t - s));
  }else if(jd == -1){
    return 2 * M_PI - dot(v, t - s) / (abs(v) * abs(t - s));
  }else if(jd == 2) return M_PI;
  else if(jd == -2) return 0.0;
  return -1;
}

main(){
  while(cin >> n && n){
    vec.clear();
    for(int i=0;i<n;i++){
      double a, b;
      cin >> a >> b;
      vec.push_back(P(a, b));
    }
    fill(vis, vis+n, false);
    P pos = P(0, 0);
    P v = P(0, 1);
    double ans = 0.0;
    for(int j=0;j<n;j++){
      int id;
      double mr = INF, md = INF;
      for(int i=0;i<n;i++){
        if(vis[i]) continue;
        double r = getr(pos, vec[i], v);
        if(mr > r){
          id = i;
          mr = r;
          md = dist(pos, vec[i]);
        }else if(equals(mr, r)){
          double d = dist(pos, vec[i]);
          if(md > d){
            id = i;
            mr = r;
            md = d;
          }
        }
      }
      //cout << pos << ' ' << vec[id] << ' ' << dist(pos, vec[id]) << endl;
      ans += md;
      vis[id] = true;
      v = vec[id] - pos;
      pos = vec[id];
    }
    printf("%.1f\n", ans);
  }
}

Measured memory_bytes: 1288
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    string s;
    int sum=0;
    cin>>s;

    for(int i=0; i<4; i++){
        if(s[i]=='+') sum++;
        else sum--;
    }

    cout<<sum<<endl;

    return 0;
}



Measured memory_bytes: 3600
#include <stdio.h>
int main(void){
  int n,h[100000];
  int i, x = 0, sum = 0, max = 0;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&h[i]);
    if(x >= h[i]){
      sum = sum + 1;
    }
    else{
      if(sum > max){
        max = sum;
      }
      sum = 0;
    }
    x = h[i];
  }
  if(sum > max){
        max = sum;
  }
  printf("%d",max);
  return 0;
}


Measured memory_bytes: 512
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;

int solve() 
{
	//happy coding

	int n;
	cin>>n;
	string s;
	cin>>s;
	string z = s.substr(0,n);
	if(s==z){
		cout<<s<<endl;
	}else{
		cout<<z<<"..."<<endl;
	}
	

	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 3632
N=int(input())
P=[int(_) for _ in input().split()]
M=[0]*N
M[0]=P[0]

c=1
for i in range(1,N):
  if M[i-1]>=P[i]:
    c+=1
    M[i]=P[i]
  else:
    M[i]=M[i-1]

print(c)


Measured memory_bytes: 25768
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

pair< V<>, V< pair<int, int> > > lowlink(const VV<>& g, V<>& ord, V<>& low, int r = 0) {
  int n = g.size();
  ord.assign(n, -1); // pre-order
  low.assign(n, -1); // 後退辺を高々1回通って到達できる頂点のordのmin
  V<> articulation_points;
  V< pair<int, int> > bridges;
  int t = 0;
  auto dfs = [&](const auto& dfs, int v, int p) -> void {
    ord[v] = low[v] = t++;
    int d = 0;
    bool f = false;
    for (int w : g[v]) if (w != p) {
      if (ord[w] == -1) {
        dfs(dfs, w, v);
        low[v] = min(low[v], low[w]);
        f |= ord[v] <= low[w];
        if (ord[v] < low[w]) bridges.emplace_back(minmax(v, w));
        ++d;
      } else {
        low[v] = min(low[v], ord[w]);
      }
    }
    if (v == r and d >= 2 or v != r and f) {
      articulation_points.push_back(v);
    }
  };
  dfs(dfs, r, -1);
  sort(begin(articulation_points), end(articulation_points));
  sort(begin(bridges), end(bridges));
  return {articulation_points, bridges};
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  V<> d(n);
  VV<> 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);
    ++d[a], ++d[b];
  }
  if (m < 9) return cout << "No" << '\n', 0;
  for (int i = 0; i < n; ++i) if (d[i] & 1) {
    return cout << "No" << '\n', 0;
  }
  for (int i = 0; i < n; ++i) if (d[i] >= 6) {
    return cout << "Yes" << '\n', 0;
  }
  V<> ord, low;
  V<> as = lowlink(g, ord, low).first;
  sort(begin(as), end(as));
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    cnt += d[i] == 4;
  }
  if (cnt >= 3) return cout << "Yes" << '\n', 0;
  if (cnt < 2) return cout << "No" << '\n', 0;
  for (int i = 0; i < n; ++i) if (d[i] == 4) {
    if (binary_search(begin(as), end(as), i)) return cout << "Yes" << '\n', 0;
  }
  cout << "No" << '\n';
} 


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

using namespace std;

#define N 1000000
#define MOD 998244353

int fpow(int x, int p) {
    int ret = 1;
    while (p) {
        if (p & 1) ret = 1LL * ret * x % MOD;
        x = 1LL * x * x % MOD;
        p >>= 1;
    }
    return ret;
}

int n, m, fac[N + 5], facinv[N + 5];

int C(int n, int m) {
    return 1LL * fac[n] * facinv[m] % MOD * facinv[n - m] % MOD;
}

int main() {
    fac[0] = 1;
    for (int i = 1; i <= N; ++i) fac[i] = 1LL * fac[i - 1] * i % MOD;
    facinv[N] = fpow(fac[N], MOD - 2);
    for (int i = N; i >= 1; --i) facinv[i - 1] = 1LL * facinv[i] * i % MOD;
    scanf("%d%d", &n, &m);
    if (n < m) swap(n, m);
    int ans = 0;
    for (int i = 1; i <= m; ++i)
        ans = (ans + 1LL * C(2 * i, i) * C(n + m - 2 * i, n - i) % MOD) % MOD;
    ans = 1LL * ans * fpow(2, MOD - 2) % MOD * fpow(C(n + m, n), MOD - 2) % MOD;
    ans = (ans + n) % MOD;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
string jz(int n,int p)
{
    string st="";
    int d;
    char c;
    do
    {
        d=n%p;
        n=n/p;
        if(p==16)
        {
            if(d<10) c=d+'0';
            else c=d+55;
        }
        else
        {
            c=d+'0';
        }
        st=c+st;
    }while(n>0);
    return st;
}
int main()
{
    int n,p;
    cin>>n>>p;
    cout<<jz(n,p).size();
    return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N, M; cin >> N >> M;
  vector<int> box(N + 1, 1);
  vector<bool> ans(N + 1);
  REP(i, N + 1) {
    if(i == 0) continue;
    if(i == 1) ans[i] = true;
    else ans[i] = false;
  }
  REP(i, M) {
    int x, y; cin >> x >> y;
    if(ans[x] == true) {
      if(box[x] > 1) {
        ans[x] = true;
        ans[y] = true;
      } else if(box[x] == 1) {
        ans[x] = false;
        ans[y] = true;
      }
    }
    box[x]--;
    box[y]++;
  }
  int res = 0;
  REP(i, N + 1) {
    if(ans[i] == true) res++;
  }
  cout << res << endl;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
	double xa,ya,ra,xb,yb,rb,l;
	cin >> xa >> ya >> ra >> xb >> yb >> rb;
	l = sqrt(pow((xa-xb),2)+pow((ya-yb),2));
	if(l > ra + rb) 
	  cout << 0 << endl;	
	else if(ra > l + rb) 
	  cout << 2 << endl;	
	else if(rb > l + ra) 
	  cout << -2 << endl;	
	else 
	  cout << 1 << endl;  
  }
  return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long ll;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

signed main(){
    lint N, M;
    cin >> N >> M;
    lint l=1, r=N;
    REP(i, M){
        lint a, b; cin>>a>>b;
        l = max(l, a);
        r = min(r, b);
    }
    if(r>=l) cout << r-l+1 << endl;
    else cout << 0 << endl;
    return 0;
}

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

int main(void)
{
    string s;
    cin >> s;
    int i;
    int count = 0;

    for(i=0;i<s.length();i++){
        if( s[i] == '1' ){
            count++;
        }
    }
    cout << count << endl;
}

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

int main() {
  int N, M, b, c, d, f;
  c = 0, d = 0, f = 0;
  cin >> N >> M;
  vector<vector<char>> a(N, vector<char>(M));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      cin >> a.at(i).at(j);
    }
  }
  for (int i = 0; i < N; i++) {
    b = 0;
    for (int j = 0; j < M; j++) {
      if (a.at(i).at(j) == '#') {
        b = 1;
      }
    }
    if (b == 0) {
      for (int j = 0; j < M; j++) {
        a.at(i).at(j) = '1';
      }
      c++;
    }
  }
  for (int i = 0; i < M; i++) {
    b = 0;
    for (int j = 0; j < N; j++) {
      if (a.at(j).at(i) == '#') {
        b = 1;
      }
    }
    if (b == 0) {
      for (int j = 0; j < N; j++) {
        a.at(j).at(i) = '1';
      }
      d++;
    }
  }
  vector<vector<char>> e(N - c);
  for (int i = 0; i < N; i++) {
    b = 0;
    for (int j = 0; j < M; j++) {
      if (a.at(i).at(j) == '#') {
        b = 1;
      }
    }
    if (b == 0) {
      f++; 
    }
    for (int j = 0; j < M; j++) {
      if (a.at(i).at(j) != '1') {
        e.at(i - f).push_back(a.at(i).at(j));
      }
    }
  }
  for (int i = 0; i < N - c; i++) {
    for (int j = 0; j < M - d; j++) {
      cout << e.at(i).at(j);
    }
    cout << endl;
  }
}

Measured memory_bytes: 3668
n = int(input())
p = [int(x) for x in input().split()]

cnt = 0
for i in range(1,n-1):
  if (max(p[i-1],p[i],p[i+1]) != p[i])and(min(p[i-1],p[i],p[i+1]) != p[i]):
    cnt += 1
print(cnt)

Measured memory_bytes: 3060
import java.util.stream.*;
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int x = scanner.nextInt();
        if (x == 1 || x == 2 * n - 1) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
            if (n == 2) {
                IntStream.range(1, 2 * n).forEach(System.out::println);
            } else {
                int[] ans = new int[2 * n - 1];
                Set<Integer> use = IntStream.range(1, 2 * n).boxed().collect(Collectors.toSet());
                if (x == 2) {
                    ans[n - 2] = 3;
                    ans[n - 1] = 2;
                    ans[n] = 1;
                    ans[n + 1] = 4;
                    use.removeAll(Arrays.asList(1, 2, 3, 4));
                } else {
                    ans[n - 2] = x - 1;
                    ans[n - 1] = x;
                    ans[n] = x + 1;
                    ans[n + 1] = x - 2;
                    use.removeAll(Arrays.asList(x - 2, x - 1, x, x + 1));
                }
                int i = 0;
                for (int j : use) {
                    if (i >= 2 * n - 1) {
                        break;
                    }
                    ans[i] = j;
                    if (++i == n - 2) {
                        i += 4;
                    }
                }
                Arrays.stream(ans).forEach(System.out::println);
            }
        }
    }
}

Measured memory_bytes: 58204
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

bool ispal(string s)
{
    string s1="";
    for(int i=s.length()-1;i>-1;i--)
    {
        string t(1,s[i]);
        s1+=t;
    }
    if(s==s1)
        return true;
    return false;
}

int main()
{
    fastio;
    string s;
    cin >> s;
    int n=s.length();
    if(ispal(s) and ispal(s.substr(0,n/2)) and ispal(s.substr(n/2+1,n/2)))
        cout << "Yes" << endl;
    else
        cout<< "No" << endl; 
}

Measured memory_bytes: 256
mod = 998244353

class ModComb:
    def __init__(self, MAX):
        fac = [1, 1]
        finv = [1, 1]
        inv = [0, 1]
        for i in range(2, MAX):
            fac.append(fac[i - 1] * i % mod)
            inv.append(mod - inv[mod % i] * (mod // i) % mod)
            finv.append(finv[i - 1] * inv[i] % mod)
        self.fac, self.finv, self.mod = fac, finv, mod

    def nCk(self, n, k):
        if n < k or n < 0 or k < 0:
            return 0
        fac, finv, mod = self.fac, self.finv, self.mod
        return fac[n] * (finv[k] * finv[n - k] % mod) % mod

N, A, B, K = map(int, input().split())

mc = ModComb(3 * 10 ** 5 + 10)

ans = 0
for a in range(N + 1):
    b, r = divmod(K - A * a, B)
    if r != 0:
        continue
    ans += mc.nCk(N, a) * mc.nCk(N, b) % mod
    ans %= mod

print(ans)


Measured memory_bytes: 38980
n=int(input())
a=sorted(list(map(int,input().split())))
if a[0]==0:
  print(0)
  exit()
if a[-1]>pow(10,18):
  print(-1)
  exit()
ans=1
for i in a:
  ans*=i
  if ans>pow(10,18):
    print(-1)
    exit()
print(ans)

Measured memory_bytes: 21472
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.size()-1;i++)
		if(s[i]==s[i+1]){
		cout<<"Bad"<<endl;
		return 0;}
	cout<<"Good"<<endl;
	return 0; 
 } 

Measured memory_bytes: 256
import numpy as np

H, W, K = [int(s) for s in input().split()]

c_mat = []

for _ in range(H):
    row = input()
    cs = []
    
    for j in range(W):
        if row[j] == ".":
            cs.append(0)
        else:
            cs.append(1)


    c_mat.append(cs)

c_np = np.array(c_mat, dtype=np.int)


count = 0

# 色を塗る
for h in range(2**H):
    for w in range(2**W):
        c_np_tmp = np.copy(c_np)

        for i in range(H):
            if (h >> i) % 2 == 1:
                c_np_tmp[i, :] = 0

        for j in range(W):
            if (w >> j) % 2 == 1:
                c_np_tmp[:, j] = 0

        if c_np_tmp.sum() == K:
            count += 1

print(count)


Measured memory_bytes: 27260
import java.util.Scanner;


public class Main {
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		for(;;)
		{
			int w = scanner.nextInt();
			int h = scanner.nextInt();
			
			if(w==0 && h==0)
			{
				break;
			}
			
			for(int i=0; i<w; i++)
			{
				for(int j=0; j<h; j++)
				{
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println("");
		}
	}
}

Measured memory_bytes: 34788
import java.io.*;
import java.util.*;

public class Main {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();
        int[] into = new int[n];
        for (int i = 0; i < m; i++) {
            int a = in.nextInt() - 1;
            int b = in.nextInt() - 1;
            into[a]++;
            into[b]++;
        }
        for (int i = 0; i < n; i++) {
            System.out.println(into[i]);
        }
    }
}


class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

double dp[20002][102];
int yui[20002][102];
int n;

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

    cin >> n;
    vector<int> time(n);
    for (int i = 0; i < n; i++) {
        Int(tmp);
        if (i) time[i] = time[i-1] + tmp;
        else time[i] = tmp;
    }
    vector<int> fast(n);
    for (int i = 0; i < n; i++) {
        cin >> fast[i];
    }

    yui[0][0] = 1;

    int ptr = 0;
    rep(i, time.back()) {
        if (i == time[ptr]) ptr++;
        rep(j, fast[ptr]+1) {
            if (yui[i][j]) {
                if (j < fast[ptr]) {
                    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 0.5 + (double)j);
                    dp[i+1][j] = max(dp[i+1][j], dp[i][j] + 0.25 + (double)j);
                    yui[i+1][j+1] = 1;
                }
                dp[i+1][j] = max(dp[i+1][j], dp[i][j] + (double)j);
                yui[i+1][j] = 1;
                if (j >= 1) {
                    dp[i+1][j-1] = max(dp[i+1][j-1], dp[i][j] + ((double)j - 0.5));
                    yui[i+1][j-1] = 1;
                }
            }
        }
    }

    cout << Decimal << dp[time.back()][0] << endl;

    return 0;
}


Measured memory_bytes: 32128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}


int main(){
	int n, x;
	cin >> n >> x;
	while(n!=0 || x!=0){
		int ans = 0;
		for(int i=1; i<n; i++){
			for(int j=i+1; j<n; j++){
				int k = x - i - j;
				if(j < k && k <= n) ans++;
			}
		}
		cout << ans << endl;	
		cin >> n >> x;
	}

	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll N;
  std::cin >> N;
  std::vector<ll> A(N);
  for(int i=0;i<N;i++) std::cin >> A[i];
  ll left = 0, right = 0, now=0, ans = N, r_reg=0;
  while(right <= N){
    if(right == N){
      ans += (((right - r_reg) * (right - r_reg - 1)) / 2) + (right - r_reg)*(r_reg-left);
      break;
    }else if((now+A[right]) != (now ^ A[right])){
      ans += (((right - r_reg) * (right - r_reg - 1)) / 2)+(right - r_reg)*(r_reg-left);
      r_reg = right;
      while((now+A[right]) != (now ^ A[right])){
        now -= A[left];
        left++;
      }
      now += A[right];
      right++;
    }else{
      now += A[right];
      right++;
    }
  }
  std::cout << ans << '\n';
  return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  VL xs(N);
  cin >> xs;
  SORT(xs);

  cout << xs.back() << " ";
  LL ans = xs[0];
  for(auto m: xs){
	if(min(m, xs.back()-m) > min(ans, xs.back()-ans) && m != xs.back())
	  ans = m;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main(){
  int N, L;
  string str[100];
  string ans;

  cin >> N >> L;

  for(int i = 0; i < N; i++) cin >> str[i];

  for(int i = 0; i < N-1; i++){
    for(int j = i+1; j < N; j++){
      if(str[i]>str[j]){
        string tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
      }
    }
  }

  for(int i = 0; i < N; i++){
    ans += str[i];
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int x;
    cin >> x;
    if (x < 1200)
        cout << "ABC"
             << "\n";
    else
        cout << "ARC"
             << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
using namespace std;
int main(){
  int A,B,C,D;
  cin >>A>>B>>C>>D;
  if(A*B>=C*D) cout <<A*B;
  else cout <<C*D;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {

	/*
	 * 問題URL : https://onlinejudge.u-aizu.ac.jp/#/problems/0117
	 */

	private static final int INFINITY = Integer.MAX_VALUE/2;

	public static void main(String[] args) throws Exception {
		//入力
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int K[][] = new int[N][N];
		for(int i=0; i<N; i++) {
			for(int j=0; j<N; j++) {
				K[i][j] = INFINITY;
			}
		}
		int m = Integer.parseInt(br.readLine());
		for(int i=0; i<m; i++) {
			String str[] = br.readLine().trim().split(",");
			int a = Integer.parseInt(str[0])-1;
			int b = Integer.parseInt(str[1])-1;
			K[a][b] = Integer.parseInt(str[2]);
			K[b][a] = Integer.parseInt(str[3]);
		}
		String str[] = br.readLine().split(",");
		int start = Integer.parseInt(str[0])-1;
		int goal = Integer.parseInt(str[1])-1;
		int V = Integer.parseInt(str[2]);
		int P = Integer.parseInt(str[3]);

		//Floyd-Warshall法
		for(int k=0; k<N; k++) {
			for(int i=0; i<N; i++) {
				for(int j=0; j<N; j++) {
					if(K[i][j] > K[i][k] +K[k][j]) {//Integer.MAX_VALUEを使っているとここでオーバーフローを起こしておかしくなる
						K[i][j] = K[i][k] +K[k][j];
					}
				}
			}
		}

		//出力
		System.out.println(V -P -K[start][goal] -K[goal][start]);
	}

}



Measured memory_bytes: 24244
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

const int N = 250000;

int n;
long long ans[N];
int a[N];

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

ordered_set treap[N * 2];

int main() {
  ios :: sync_with_stdio(false);
  string s; cin >> s;
  auto Update = [&]() {
    int index = -1;
    if (!treap[a[n] - 1 + N].size()) {
      index = -1;
    } else {
      index = *treap[a[n] - 1 + N].find_by_order(treap[a[n] - 1 + N].size() - 1);
    }
    ans[n] = ans[n - 1];
    ans[n] += (treap[a[n] + N].size()) - treap[a[n] + N].order_of_key(index);
    treap[a[n] + N].insert(n); 
  };
  treap[0 + N].insert(0);
  for (char x: s) {
    if (x == '(') {
      ++n;
      a[n] = a[n - 1] + 1;
      Update();
    } else if (x == ')') {
      ++n;
      a[n] = a[n - 1] - 1;
      Update();
    } else {
      treap[a[n] + N].erase(n);
      --n;
    }
    cout << ans[n] << endl;
  }
}


Measured memory_bytes: 54072
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long n,m,i,j,dp[3005][3005],l[3005],r[3005],mod=1000000007,cnt[3005],x,y;
string st;
int main()
{
	cin>>n>>m>>st;
	st=" "+st;
	for (i=1;i<=n;i++) 
	{
		cnt[i]=cnt[i-1]+st[i]-'0';
	}
	for (i=1;i<=n;i++)
	{
		l[i]=i;
		r[i]=i;
	}
	for (i=1;i<=m;i++)
	{
		cin>>x>>y;
		r[x]=max(r[x],y);
	}
	for (i=1;i<=n;i++)
	{
		r[i]=max(r[i],r[i-1]);
	}
	dp[0][0]=1;
	for (i=1;i<=n;i++)
	{
		for (j=0;j<=r[i];j++)
		{
			if (j>cnt[r[i]]) break;
			if (j>=cnt[r[i]]-r[i]+i)
			{
				dp[i][j]=dp[i-1][j]+dp[i-1][j-1];
				dp[i][j]%=mod;
			}
		}
	}
	cout<<dp[n][cnt[n]];
	return 0;
}

Measured memory_bytes: 68352
def factorization(n,m):
    temp = n
    temp2 = m
    cnt=1
    for i in range(2, int(-(-min(n,m)**0.5//1))+1):
        if temp%i==0:
            if temp2%i == 0:
                cnt += 1
                while temp2%i==0:
                    temp2 //= i
            while temp%i==0:
                temp //= i
        elif temp2%i == 0:
            while temp2%i==0:
                temp2 //= i

    if temp != 1 and temp2 != 1:
        if max(temp, temp2) % min(temp, temp2) == 0: cnt += 1

    return cnt

a, b = map(int,input().split())
print(factorization(a,b))


Measured memory_bytes: 3188
#include<iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int N, M;
    cin >> N;
    int T[N];
    rep(i,N) cin >> T[i];
    cin >> M;
    int P[M], X[M];
    rep(i,M) cin >> P[i] >> X[i];
    int sum=0;
    rep(i,N) sum+=T[i];
    for(int i=0; i<M; i++){
        int ans=sum;
        int tmp=P[i]-1;
        //cout << tmp << endl;
        int sub=T[tmp]-X[i];
        ans-=sub;
        cout <<ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)

int n, m;
vector <int> fac;

int main() {
	cin >> n >> m;
	FOR(i, 1, int(sqrt(m))) {
		if (m % i == 0) {
			fac.push_back(i);
			fac.push_back(m/i);
		}
	}
	sort(fac.begin(), fac.end(), greater<int>());
	for (auto it:fac) {
		if (m / it >= n) {
			cout << it;
			return 0;
		}
	}
	cout << 1;
}


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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    cin >> a;
    cout << a + a*a + a*a*a << "\n";
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;
int main() {
    int N;
    int A[20], B[21], C[21];
    cin >> N;
    for (int i=0; i<N; i++) cin >> A[i];
    for (int i=1; i<N+1; i++) cin >> B[i];
    for (int i=1; i<N; i++) cin >> C[i];

    int score = 0;
    int before = -1;
    for (int i=0; i<N; i++) {
        score += B[A[i]];
        if (before != -1 && before + 1 == A[i]) {
            score += C[before];
        }
        before = A[i];
    }
    cout << score << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int A,B,C;
    scanf("%d %d %d",&A,&B,&C);
    int max,mid,min;
    if(A>B){
        max = A;
        mid = B;
    }else{
        max = B;
        mid = A;
    }
    if(C>max){
        min = mid;
        mid = max;
        max = C;
    }else{
        if(C>mid){
            min = mid;
            mid = C;
        }else{
            min = C;
        }
    }

    int count = 0;
    count = max-mid;
    min = min+count;
    int diff = max-min;
    if(diff%2==0){
        count += diff/2;
    }else{
        count += diff/2 + 2;
    }
    printf("%d\n",count);
    return 0;
}

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

int main() {
	char S[4];
	int i,sum=0;

	for (i=0; i < 4; i++) {
		cin >> S[i];
		if (S[i] == '+') {
			sum += 1;
		}
		else { sum -= 1; }
	}

	cout << sum;

	return 0;
}

Measured memory_bytes: 256