akhauriyash/Code-Regression huggingface dataset:
//written by: rishav2416
#include <bits/stdc++.h>
#define ll long  long
#define lli long long int
#define ld long double
#define mod 1000000007
#define max_char 128
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lbd lower_bound
#define ubd upper_bound
#define PI 3.141592653589793238
#define pf push_front
#define all(x) x.begin(),x.end()
#define input(arr,n) for(ll c1=0;c1<n;c1++)cin>>arr[c1];
#define arrinit(arr,n,k) for(ll c1=0;c1<n;c1++) arr[i]=k;
#define rep(i,a,n) for( ll i=a ; i<n ; i++)
#define revrep(i,a,n) for(ll i=a; i>=n ; i--)
#define mems(x, y) memset(x, y, sizeof(x))
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define INF 1e18a



ll power(ll base,ll pow, ll mo)
{
   ll res=1;
   while(pow)
   {
        if (pow%2!=0)  res=(res*base)%mo;
        base=(base*base)%mo;
        pow/=2;
   }
   return res;
}


std::string str="All Good Till Here";

/////////////////////////////////////////////////////////////////////////////////

int32_t main()
{
    fastio
	ll tt,i,j,x;
	//cin>>tt;
  tt=1;
    cin>>x;
    rep(i,-120,121)
    {
      rep(j,-121,121)
      {
        if((ll)(pow(i,5)-pow(j,5))==x)
        {
          cout<<i<<" "<<j<<"\n";
          return 0;
        }
      }
    }

}


Measured memory_bytes: 4008
#include <stdio.h>
#include <stdlib.h>

#define MAX 4

int main()
{
char s[MAX+1];
int number;
int t, u;
int a=0;


scanf("%s",s);

number=atoi(s);
u=number%100;
t=(number-u)/100;


if(1<=u && u<=12)
a=1;
if(1<=t && t<=12)
a=2;
if(1<=u && u<=12 && 1<=t && t<=12)
a=3;

switch(a) {
case 0:
printf("NA\n");
break;
case 1:
printf("YYMM\n");
break;
case 2:
printf("MMYY\n");
break;
case 3:
printf("AMBIGUOUS\n");
break;
}

return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
)

func main() {
	var A int
	var B int
	var S string

	fmt.Scanf("%d %d", &A, &B)
	fmt.Scanf("%s", &S)

	if len(S) != A+B+1 {
		fmt.Println("No")
		return
	}

	for i := 0; i < A; i++ {
		if !IsNum(S[i]) {
			fmt.Println("No")
			return
		}
	}

	if S[A] != '-' {
		fmt.Println("No")
		return
	}

	for i := A + 1; i < A+B+1; i++ {
		if !IsNum(S[i]) {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

func IsNum(c byte) bool {
	return '0' <= c && c <= '9'
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll

typedef vector<int> vi;
typedef pair<int,int> pii;

int grid[5005][5005];

void compress(vi &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

void cumulativesum(int h,int w){
  int i,j;
  rep(i,h)rep(j,w-1) grid[i][j+1]+=grid[i][j];//yoko
  rep(j,w)rep(i,h-1) grid[i+1][j]+=grid[i][j];//tate
}

int sum(int i,int j,int k,int l){//y,x??§??????????°???§
  return grid[k][l]-grid[i][l]-grid[k][j]+grid[i][j];
}

signed main(void) {
  int i,j;
  int n;
  cin>>n;
  pair<pii,pii> p[5000];
  vi x,y;
  rep(i,n){
    cin>>p[i].first.first>>p[i].first.second>>p[i].second.first>>p[i].second.second;
    x.push_back(p[i].first.first);
    x.push_back(p[i].second.first);
    y.push_back(p[i].first.second);
    y.push_back(p[i].second.second);
  }

  compress(x);
  compress(y);

  rep(i,n){
    int lx=lower_bound(all(x),p[i].first.first)-x.begin();
    int ly=lower_bound(all(y),p[i].first.second)-y.begin();
    int rx=lower_bound(all(x),p[i].second.first)-x.begin();
    int ry=lower_bound(all(y),p[i].second.second)-y.begin();

    grid[lx][ly]++;
    grid[rx][ry]++;
    grid[lx][ry]--;
    grid[rx][ly]--;
  }

  cumulativesum(5000,5000);//?´???????


  ll ans=0;
  rep(i,2*n)rep(j,2*n)
    if(grid[j][i]) ans+=(x[j+1]-x[j])*(y[i+1]-y[i]);

  cout<<ans<<endl;
}

Measured memory_bytes: 198904
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;

int main()
{
    int H, W, N;
    cin >> H >> W >> N;
    int s = 0;
    while (N > 0) {
        s++;
        N -= max(H, W);
    }
    
    cout << s;
    
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define inf1 1000000000
#define endl '\n'
ll height[200005];
ll beauty[200005];
ll segtree[900000];
ll query(ll v,ll tl,ll tr,ll l,ll r)
{
	if(l>r)
		return 0;
	if(tl==l && tr==r)
		return segtree[v];
	else
	{
		ll tm=(tl+tr)/2;
		ll a=query(2*v,tl,tm,l,min(r,tm));
		ll b=query(2*v+1,tm+1,tr,max(l,tm+1),r);
		return max(a,b);
	}
}
void update(ll v,ll tl,ll tr,ll pos,ll val)
{
	if(tl==tr)
	{
		segtree[v]=val;
		return;
	}
	else
	{
		ll tm=(tl+tr)/2;
		if(pos<=tm)
			update(2*v,tl,tm,pos,val);
		else
			update(2*v+1,tm+1,tr,pos,val);
		segtree[v]=max(segtree[2*v],segtree[2*v+1]);
		return;
	}
}
int main()
{
	fastio;
	#ifdef APNA_IO
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++)
		cin>>height[i];
	for(ll i=1;i<=n;i++)
		cin>>beauty[i];
	for(ll i=1;i<=n;i++)
	{
		ll a=query(1,1,n,1,height[i]-1);
		update(1,1,n,height[i],a+beauty[i]);
	}
	cout<<segtree[1]<<endl;
	return 0;
}

Measured memory_bytes: 10368
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
using namespace std;
struct node{
  int p;
  string s;
  vector<int> c;
  bool d;
};
int main(){
  int n,m;
  while(cin>>n>>m,n||m){
    vector<node> v;
    node no;
    no.p=-1;
    no.d=true;
    v.push_back(no);
    int i,j,k;
    string s,b;
    int p;
    k=1;
    for(i=0;i<n;i++){
      cin >> s;
      for(j=0;j<s.size();j++) {
	if(s[j]=='/') {
	  s[j]=' ';
	  
	}
      }
      stringstream ss(s);
      p=0;
      while(ss>>s){
	bool f =false;
	for(j=0;j<v[p].c.size();j++){
	  if(v[v[p].c[j]].s==s){
	    f=true;
	    v[p].d=true;
	    p=v[p].c[j];
	    break;
	  }
	}
	if(!f){
	  no.p=p;
	  no.s=s;
	  no.d=false;
	  v[p].d=true;
	  v[p].c.push_back(v.size());
	  p=v.size();
	  v.push_back(no);
	}
      }
    }
    
    //for(i=0;i<v.size();i++) cout <<i<< ":"<<(v[i].d?"d:":"f:")<<v[v[i].p].s<<"/"<<v[i].s<< endl;
    
    for(i=0;i<m;i++){
      string s1,s2;
      int id1=-1,id2=-1;
      cin >> s1 >> s2;
      
      bool d1=true,d2=true;;
      
      for(j=0;j<s1.size();j++){
	if(s1[j]=='/') {
	  s1[j]=' ';
	  if(j==s1.size()-1){
	    s1+="index.html";
	    d1=false;
	  }
	}
      }
      for(j=0;j<s2.size();j++) {
	if(s2[j]=='/'){
	  s2[j]=' ';
	  if(j==s2.size()-1){
	    s2+="index.html";
	    d2=false;
	  }
	}
      }
      bool nf=false;
      
      stringstream ss1(s1);
      p=0;
      while(ss1>>s1){
	nf=true;
	if(p==-1) break;
	if(s1==".") {
	  nf=false;
	  continue;
	}
	if(s1=="..") {
	  if(v[p].d){
	    nf=false;
	    p=v[p].p;
	    continue;
	  }else{
	    nf=true;
	    break;
	  }
	}
	for(j=0;j<v[p].c.size();j++){
	  if(v[v[p].c[j]].s==s1){
	    nf=false;
	    p=v[p].c[j];
	    break;
	  }
	}
	if(nf) break;
      }
      if(!nf) id1=p;

      stringstream ss2(s2);
      p=0;
      while(ss2>>s2){
	nf=true;
	if(p==-1) break;
	if(s2==".") {
	  nf=false;
	  continue;
	}
	if(s2=="..") {
	  if(v[p].d){
	    nf=false;
	    p=v[p].p;
	    continue;
	  }else{
	    nf=true;
	    break;
	  }
	}
	for(j=0;j<v[p].c.size();j++){
	  if(v[v[p].c[j]].s==s2){
	    nf=false;
	    p=v[p].c[j];
	    break;
	  }
	}
	if(nf) break;
      }
      
      if(!nf) id2=p;
      if(id1==-1||id2==-1) nf=true;
      else{
	if(!d1&&v[id1].d) nf=true;
	if(!d2&&v[id2].d) nf=true;

	if(v[id1].d){
	  bool ff=true;
	  for(j=0;j<v[id1].c.size();j++){
	    if(v[v[id1].c[j]].s=="index.html"&&!v[v[id1].c[j]].d) ff = false;
	  }
	  if(ff) nf=true;
	}
	
	if(v[id2].d){
	  bool ff=true;
	  for(j=0;j<v[id2].c.size();j++){
	    if(v[v[id2].c[j]].s=="index.html"&&!v[v[id2].c[j]].d) ff = false;
	  }
	  if(ff) nf=true;
	}
	
      }
      
      //cout << id1 << ":"<<id2 << endl;
      if(nf) cout << "not found" << endl;
      else if(id1==id2) cout << "yes" << endl;
      else if(d2&&v[id1].s=="index.html"&&v[id1].p==id2) cout << "yes" << endl;
      else if(d1&&v[id2].s=="index.html"&&v[id2].p==id1) cout << "yes" << endl;
      else cout << "no" << endl;
      
    }
  }
  return 0;
}

Measured memory_bytes: 1268
/*Rummy*/
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> p;

int main(void){
  //??£?????¨????????°????????????
  //string ????????§????????????
  int n;
  cin >> n;
  vector<int> b(9,0);
  char s;
  for(int o=0;o<n;o++){
    vector<bool> flag(9,false);
  for(int i=0;i<9;i++){
    cin >> b[i];
  }
  for(int i=0;i<9;i++){
    cin >> s;
    if(s=='R')b[i]+=10;
    else if(s=='G')b[i]+=20;
    else b[i]+=30;
  }
  sort(b.begin(),b.end());
  int cnt=0;
  for(int i=0;i<9;i++){
    for(int j=i+1;j<9;j++){
      for(int k=j+1;k<9;k++){
        if(flag[i]==false && flag[j]==false && flag[k]==false){
          if(b[i]==b[j] && b[i]==b[k] && b[j]==b[k]){
            cnt++;
            flag[i]=flag[j]=flag[k]=true;
            break;
          }else if(b[i]==b[j]-1 && b[i]==b[j]-1 && b[j]-1==b[k]-2){
            cnt++;
            flag[i]=flag[j]=flag[k]=true;
            break;
          }
        }
      }
    }
  }
  if(cnt==3)cout << 1 << endl;
  else cout << 0 << endl;
}
  return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
	for(int i=1;i<s.size();i++)if(s[i]==s[i-1]){printf("%d %d\n",i,i+1);return 0;}
	for(int i=1;i<s.size();i++)if(s[i]==s[i-2]){printf("%d %d\n",i-1,i+1);return 0;}
	printf("-1 -1\n");
	return 0;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		print();
	}

	private static void print() {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			int numberOfReceivedDataset = Integer.parseInt(str);

			for (int i = 1; i <= numberOfReceivedDataset; i++) {
				str = br.readLine();
				String[] nums = str.split(" ", 0);

				int x = Integer.parseInt(nums[0]);
				int y = Integer.parseInt(nums[1]);
				int z = Integer.parseInt(nums[2]);

				int xToSecondPower = x * x;
				int yToSecondPower = y * y;
				int zToSecondPower = z * z;

				if (xToSecondPower + yToSecondPower == zToSecondPower) {
					System.out.println("YES");
				} else if (zToSecondPower + yToSecondPower == xToSecondPower) {
					System.out.println("YES");
				} else if (zToSecondPower + xToSecondPower == yToSecondPower) {
					System.out.println("YES");
				} else {
					System.out.println("NO");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 25972
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int N = 100000;
const int mo = 1e9 + 7;
const int oo = 0x3f3f3f3f;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int n, m;
int p[N + 5];

struct Matrix {
    int ret[3][3];

    Matrix(const bool& t = 0) {
        memset(ret, 0, sizeof ret);
        if(t) ret[0][0] = ret[1][1] = ret[2][2] = 1;
    }
} A, B;

Matrix operator * (const Matrix& a, const Matrix& b) {
    Matrix c;
    for(int i = 0; i < 3; ++i)
        for(int j = 0; j < 3; ++j)
            for(int k = 0; k < 3; ++k) if(a.ret[i][k] && b.ret[k][j])
                c.ret[i][j] = (c.ret[i][j] + 1ll * a.ret[i][k] * b.ret[k][j]) % mo;
    return c;
}

Matrix operator ^ (const Matrix& a, int exp) {
    Matrix res = 1, base = a;
    for(; exp > 0; exp >>= 1) {
        if(exp & 1)
            res = res * base;
        base = base * base;
    }
    return res;
}

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif 

    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; ++i) {
        scanf("%d", p + i);
    }

    if(n == 1) return puts("1"), 0;

    A.ret[0][0] = 1;
    A.ret[1][0] = 2;
    A.ret[2][0] = 1;

    B.ret[0][0] = 1; B.ret[0][1] = 1; B.ret[0][2] = 2; 
    B.ret[1][0] = 1; B.ret[1][1] = 2; B.ret[1][2] = 2; 
    B.ret[2][0] = 0; B.ret[2][1] = 1; B.ret[2][2] = 1; 

    int cur = 1;
    for(int i = 0; i < m; ++i) {
        A = (B ^ (p[i] - cur)) * A;
        cur = p[i];
        A.ret[1][0] -= A.ret[0][0];
    }

    A = (B ^ (n - cur)) * A;
    printf("%d\n", (A.ret[0][0] + mo) % mo);
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector <int> a(n);
    rep(i, n) cin >> a[i];

    while(true)
    {
        int min_num = 2e9;
        rep(i, n)
        {
            if(a[i] != 0 && min_num > a[i])
            {
                min_num = a[i];
            }
        }

        bool no_change = true;
        rep(i, n)
        {
            if(a[i] != 0 && a[i] != min_num)
            {
                a[i] %= min_num;
                no_change = false;
            }
        }

        if(no_change)
        {
            break;
        }
    }

    rep(i, n)
    {
        if(a[i] != 0)
        {
            cout << a[i] << endl;
            break;
        }
    }
    return 0;
}

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

int ans[2005];

int main(){
  int n,x,y;
  cin>>n>>x>>y;
  x--; y--;
  vector<int> g[2005];
  rep(i,n){
    if(i<n-1) g[i].push_back(i+1);
    if(i>0) g[i].push_back(i-1);
  }
  g[x].push_back(y);
  g[y].push_back(x);
  rep(i,n){
    int d[2005];
    rep(j,n) d[j]=-1;
    queue<int> q;
    q.push(i);
    d[i]=0;
    while(q.size()){
      int p1=q.front(); q.pop();
      for(auto p2:g[p1]){
	if(d[p2]==-1){
	  d[p2]=d[p1]+1;
	  q.push(p2);
	}
      }
    }
    rep(j,n){
      ans[d[j]]++;
    }
  }
  rep(i,n-1){
    cout<<ans[i+1]/2<<endl;
  }
  return 0;
}




Measured memory_bytes: 384
import java.util.*;

public 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 x = sc.nextInt();
    int y = sc.nextInt();
    int answer = 0;

    if (a / 2 + b / 2 < c) {
      answer = a * x + b * y;
    } else {
      if (x < y) {
        if (b < c * 2) {
          answer = c * x * 2 + b * (y - x);
        } else {
          answer = c * y * 2;
        }
      } else {
        if (a < c * 2) {
          answer = c * y * 2 + a * (x - y);
        } else {
          answer = c * x * 2;
        }
      }
    }

    System.out.println(answer);
  }
}


Measured memory_bytes: 21588
n = int(input())
array = list(map(int, input().split()))
status = 0
past = 0
count = 1
for i in range(1, n):
    past = status
    if(array[i-1] < array[i]):
        if(status == 0):
            past = 1
        status = 1
    elif(array[i-1] > array[i]):
        if (status == 0):
            past = 2
        status = 2

    if(status != past):
        count += 1
        i += 2
        past = 0
        status = 0
        continue

print(count)

Measured memory_bytes: 14252
#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-1; i < n; i++)
#define INF 2000000000
#define ALL(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値))
//vector<intなど> 変数名(要素数,初期値)
using namespace std;
#define MOD 998244353
typedef long long ll;
//gcd,lcmセット
ll gcd(ll a, ll b){
   if (a%b == 0) return b;
   else return gcd(b, a%b);
}
ll lcm(ll a, ll b){	
   return a*b/gcd(a, b);
}
bool isPrime(ll x){
    int i;
    if(x < 2)return false;
    else if(x == 2) return true;
    if(x%2 == 0) return false;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return false;
    return true;
}
//dfsではvector<vector<int>> g(n);で◎
int main(){
    double l;
    cin>>l;
    l/=3.0;
    cout<<fixed<<l*l*l<<endl;
}

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

int main(void){
    int N;
    cin >> N;
    int a;
    if(64 <= N && N <= 100) {a = 64;} 
    else if(32 <= N && N < 64) {a = 32;}
    else if(16 <= N && N < 32) {a = 16;}
    else if(8 <= N && N < 16) {a = 8;}
    else if(4 <= N && N < 8) {a = 4;}
    else if(1 < N && N < 4) {a = 2;}
    else {a = 1;}
    
    cout << a<< endl;
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	int c[3][3];
	rep(i,3)rep(j,3)cin>>c[i][j];
	int d1 = c[0][1]-c[0][0];
	int d2 = c[0][2]-c[0][0];
	string ans = "Yes";
	rep1(i,3)rep(j,3){
		if(c[i][1]-c[i][0] == d1&&c[i][2]-c[i][0]==d2){
			continue;
		}
		else{
			ans = "No";
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
const ll MOD=1e9 + 7;

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

    ll n;
    cin>>n;

    for(ll i=1;i<=50000*2;i++){
        long double val = (i*1.08);
        ll tmp = val;
        if(tmp==n)return cout<<i , 0;
    }
    cout<<":(";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll A,B,C,D;
	cin >> A >> B >> C >> D;
	ll X = A + B - C - D;
	if (X > 0)cout << "Left" << endl;
	if (X == 0)cout << "Balanced" << endl;
	if (X < 0)cout << "Right" << endl;
}

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

int main()
{
    int n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
     cin>>arr[i];
     
    sort(arr,arr+n);
    
    int ans=0;
    for(int i=0;i<k;i++)
      ans+=arr[i];
      
    cout<<ans<<endl;  
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int a,b; cin >> a >> b;
    cout << (a+b)%24 << endl;
    return 0;
}

Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::cmp;

fn main() {
    let (a, b, c, d) = get!(usize, usize, usize, usize);
    println!("{}", cmp::max(a*b, c*d));
}

Measured memory_bytes: 4352
/*
Keep clam  Believe youself
*/
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<stack>
#include<set>
#include<cmath>
#define Xiaobo main
using namespace std;
const int maxn=2e5+7;
const int mod=1e9+7;
const double eps=1e-15;
const double pi=acos(-1);
const int INF=0x3f3f3f3f;
typedef long long ll;
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b);}
//别急 dp找状态 问题看看本身的规律 贪心找方法
ll a[maxn];
ll n,k;
bool ok(ll x) 
{
	ll sum=0;
	for(int i=0;i<n;i++) {
		if(a[i]*a[i]<=x) sum--;
		if(a[i]<0) {
			ll mx=x/a[i];
			while(mx*a[i]>x) mx++;
			int id=lower_bound(a,a+n,mx)-(a);
			sum+=n-id;
		}
		else if(a[i]>0) {
			ll mx=x/a[i];
			while(mx*a[i]>x) mx--;
			int id=upper_bound(a,a+n,mx)-(a);
			sum+=id;
		}
		else {
			if(x>=0) sum+=n;
		}
	}	
	return sum/2>=k;
} 
int Xiaobo()
{
	
	cin>>n>>k;
	for(int i=0;i<n;i++) scanf("%lld",&a[i]);
	sort(a,a+n);
	ll l=-1e18,r=1e18,ans=0;
	while(l<=r) {
		ll mid=(l+r)/2;
		if(ok(mid)) {
			r=mid-1;
			ans=mid;
		}
		else l=mid+1;
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define fr(i1,m) for(int i1=0;i1<m;i1++)
using namespace std;
int main()
{
    long a[10010];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]+a[1]==a[2])
    {
        cout<<"Yes\n";
    }
    else
        cout<<"No\n";
        return 0;

}




Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
	string s;
	cin >> s;
	cout << s.substr(0, 5) << " " << s.substr(6, 7) << " " << s.substr(14, 5) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10 ;
vector<int> G[maxn] ;
int l[maxn], r[maxn] ;
int ans[maxn] ;
bool pre[maxn] ;
void addEdge (int u, int v) {
	G[u].push_back (v) ;
	G[v].push_back (u) ;
}
bool find_ans = 1 ;
void dfs (int v, int fa) {
	int L = -1e9, R = 1e9 ;
	for (int i = 0; i < G[v].size(); i ++) {
		int to = G[v][i] ;
		if (to == fa) continue ;
		dfs (to, v) ;
		if (l[to] <= -1e9 || r[to] >= 1e9) continue ;
		if (L <= -1e9 || R >= 1e9) L = l[to] - 1, R = r[to] + 1 ;
		else {
			if (L % 2 != (l[to] - 1) % 2) find_ans = 0 ;
			L = max (L, l[to] - 1); R = min (R, r[to] + 1) ;
		}
	}
	//printf("v:%d l:%d r:%d\n", v, L, R) ;
	if (L > R) find_ans = 0 ;
	l[v] = L; r[v] = R ;
	if (pre[v] && L > 1e-9 && R < 1e9 && (ans[v] % 2 != l[v] % 2 || ans[v] < l[v] || ans[v] > r[v])) find_ans = 0 ;
	if (pre[v]) l[v] = r[v] = ans[v] ;
}
void dfs2 (int v, int fa) {
	for (int i = 0; i < G[v].size(); i ++) {
		int to = G[v][i] ;
		if (to == fa) continue ;
		if (ans[v] + 1 >= l[to] && ans[v] + 1 <= r[to]) ans[to] = ans[v] + 1 ;
		else ans[to] = ans[v] - 1 ;
		dfs2 (to, v) ;
	}
}
int main() {
	int n, k ;
	scanf("%d", &n) ;
	for (int i = 1; i < n; i ++) {
		int u, v ;
		scanf("%d%d", &u, &v) ;
		addEdge (u, v) ;
	}
	scanf("%d", &k) ;
	for (int i = 1; i <= k; i ++) {
		int v, p ;
		scanf("%d%d", &v, &p) ;
		ans[v] = p; pre[v] = 1 ;
	}
	dfs (1, 0) ;
	//for (int i = 1; i <= n; i ++) printf("v:%d %d %d\n", i, l[i], r[i]) ;
	if (!find_ans) printf("No\n") ;
	else {
		printf("Yes\n") ;
		if (!pre[1]) ans[1] = l[1] ;
		dfs2 (1, 0) ;
		for (int i = 1; i <= n; i ++) printf("%d\n", ans[i]) ;
	}
	return 0 ;
}

Measured memory_bytes: 19788
def solve():
    data = read()
    result = think(data)
    write(result)


def read():
    n = read_int(1)[0]
    return read_line(n)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    count = 0
    current_char = ''
    for i in range(len(data)):
        if current_char == data[i]:
            continue
        current_char = data[i]
        count += 1
    return count


def write(result):
    print(result)


if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    # import sys
    # sys.setrecursionlimit(10000)
    solve()


Measured memory_bytes: 3316
#include <iostream>

#define MAX_SET (1000)

using namespace std;

void draw_rectangle(int H, int W);

int main()
{  
    int  i;
    int* H = new int[MAX_SET + 1];
    int* W = new int[MAX_SET + 1];  
    int  size;

    for (int i = 0; i < MAX_SET + 1; i++) {
         do {
             cin >> H[i] >> W[i];
         } while (H[i] > 300 || W[i] > 300);

         if (H[i] == 0 && W[i] == 0) {	   
             size = i; 
	     break;
         }
    }
   
    for (int i = 0; i < size; i++) {
         draw_rectangle(H[i], W[i]);         
         cout << endl;
    }

    delete[] H;
    delete[] W;
 
    return (0);
} 

void draw_rectangle(int H, int W)
{   
     for (int i = 1; i <= H; i++) {
          for (int j = 1; j <= W; j++) {
	       cout << "#";
          }

          cout << endl;
     }
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int N, D;
  cin >> N >> D;
  vector<int> x(N), y(N);
  rep(i, N) cin >> x[i] >> y[i];
  int ans = 0;
  rep(i, N){
    if(sqrt(pow(x[i], 2) + pow(y[i], 2)) <= D) ++ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4828
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

void printvv(const vector<vector<int>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, M; cin >> N >> M;
	int L; cin >> L;
	vector<vector<int>>dp(N, vector<int>(N, INF));
	rep(i, 0, N)dp[i][i] = 0;
	vector<vector<int>>ans = dp;
	loop(M) {
		int a, b, c; cin >> a >> b >> c;
		a--, b--;
		dp[a][b] = dp[b][a] = c;
	}
	rep(k, 0, N) {
		rep(i, 0, N) {
			rep(j, 0, N) {
				chmin(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}
	printvv(dp);
	rep(i, 0, N) {
		rep(j, 0, N) {
			if (dp[i][j] <= L) {
				chmin(ans[i][j], 1ll);
			}
		}
	}
	rep(k, 0, N) {
		rep(i, 0, N) {
			rep(j, 0, N) {
				chmin(ans[i][j], ans[i][k] + ans[k][j]);
			}
		}
	}
	printvv(ans);
	int Q; cin >> Q;
	loop(Q) {
		int s, t; cin >> s >> t;
		s--, t--;
		cout << (ans[s][t] == INF ? -1 : ans[s][t] - 1) << endl;
	}


	return 0;
}


Measured memory_bytes: 2048
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    t = S()
    flag = True
    for i in range(len(s)):
        if s[i] == t[i]:
            continue
        else:
            flag = False
    if len(s) + 1 != len(t):
        flag = False
    if flag:
        print("Yes")
    else:
        print("No")

main()



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

using namespace std;

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	string n;
	cin >> n;
	for (char c: n) {
		if (c == '7') {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;cin>>S;
  int N=S.size(),flag=1;
  for(int i=0;i<7;i++){
    string A=S.substr(0,i),B=S.substr(N+i-7);
    if(A+B=="keyence"){
      flag=0;
      break;
    }
  }
  if(S.substr(0,7)=="keyence")flag=0;
  
  if(flag==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    const int lower = max(a,c);
    const int upper = min(b,d);

    cout << max(0, upper - lower) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int k;
    string s;
    cin >> k >> s;
    int l = s.length();
    if (l <= k)
        cout << s << endl;
    else {
        for (int i = 0; i < k; i++)
            cout << s[i];
        cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[n + 1];
  a[n] = 0;
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
    a[n] += a[i];
    a[i] *= 2;
  }
  a[n + 1] /= 2;
  int ans = a[n];
  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      if(a[j] < a[j + 1]){
        int t = a[j];
        a[j] = a[j + 1];
        a[j + 1] = t;
      }
    }
  }
  if(a[1] == ans){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 128
N, A, B, C, D = map(int, input().split())
S = "#" + input() + "#"

# twoblock = S[A:].count("##")


def twoblock(start, end):
    return S[start : end + 1].count("##")


tripledot = S[B - 1 : D + 2].count("...")

if twoblock(A, C) or twoblock(B, D):
    print("No")
    exit()

if C > D:
    if tripledot == 0:
        print("No")
        exit()

print("Yes")



Measured memory_bytes: 9364
import math
N, M = map(int, input().split())
if N - M > 1 or M - N > 1:
    key = 0
elif N == M:
    key = math.factorial(N) * math.factorial(M)
    key *= 2
else:
    key = math.factorial(N) * math.factorial(M)
print(key % 1000000007)


Measured memory_bytes: 5184
N, K = gets.chomp.split.map(&:to_i)
V = gets.chomp.split.map(&:to_i)
# T = gets.chomp.chars
# N, K = gets.chomp..to_i

def solve
  ans = 0  
  0.upto([K, N].min).each do |k| # k is the count of extract operation
    0.upto(k).each do |l|  # l is the count of left.
      r = k - l # r is the count of r
      minus = []
      sum = 0
      0.upto(l-1).each do |i|
        if V[i] < 0
          minus << V[i]
        end
        sum += V[i]
      end
      (N-r).upto(N-1).each do |i|
        if V[i] < 0
          minus << V[i]
        end
        sum += V[i]
      end
      minus.sort!  # increasing order
      # Now, we can revert item [K-k, minus.size] times.
      cnt = [K-k, minus.size].min
      cnt.times do |i|
        sum -= minus[i]
      end
      
      if (ans < sum)
        ans = sum
      end
    end
  end
  
  p ans
end

solve

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

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

	vector<int> sticks(n);

	for(int i = 0; i < n; i++){
		int l;
		cin >> l;
		sticks.push_back(l);
	}

	sort(sticks.begin(), sticks.end(), greater<int>());

	int length = 0;
	for(int i = 0; i < k; i++){
		length += sticks[i];
	}

	cout << length << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
#include <boost/multiprecision/integer.hpp>


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

int N; cin >> N;
VI D(N); rep(i, 0, N) cin >> D[i];
const int m =  998244353;
VI cnt(N, 0); for(int d:D) ++cnt[d];

int64_t ans = 1;
if (D[0] || cnt[0] >= 2) cout << "0\n";
else {
    rep(i, 2, N){
        ans *= boost::multiprecision::powm(cnt[i-1], cnt[i], m);
        ans %= m;
    }
    cout << ans%m << "\n";
}

}

// 境界，出力文字列 チェック
// まずは全探索，次にDP
// 制限を見る
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef string::const_iterator State;

int expression(State &begin);

int number(State &begin){
  int num=0;
  while(isdigit(*begin)){
    num*=10;
    num+=(*begin-'0');
    begin++;
  }
  return num;
}

int program(State &begin){
  int num;
  if(*begin=='('){
    begin++;
    num=expression(begin);
    begin++;
  }
  else num=number(begin);
  return num;
}

int term(State &begin){
  int num=program(begin);
  while(1){
    if(*begin=='*'){
      begin++;
      num*=program(begin);
    }else if(*begin=='/'){
      begin++;
      num/=program(begin);
    }else break;
  }
  return num;
}

int expression(State &begin){
  int num=term(begin);
  while(1){
    if(*begin=='+'){
      begin++;
      num+=term(begin);
    }else if(*begin=='-'){
      begin++;
      num-=term(begin);
    }
    else break;
      
  }
  return num;
}




signed main(){
  cin.tie(0);	
  //ios::sync_with_stdio(false);
  int n;
  cin>>n;
  rep(i,n){
    string s;
    cin>>s;
    State begin=s.begin();
    cout<<expression(begin)<<endl;
  }

  return 0;
}



    




Measured memory_bytes: 3148
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N = int(input())

    d = N // 15

    print(N * 800 - d * 200)


main()


Measured memory_bytes: 5024
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;


int main() {

	cin.tie(0);

	int a, b, c;
	cin >> a >> b >> c;

	if (b - a == c - b) cout << "YES";
	else cout << "NO";

	return 0;
}

Measured memory_bytes: 256
words = []
w = input()
n = input()
change = []
for val in range(1,n+1):
	x = map(int,raw_input().split(','))
	change.append(x)
kekka = range(1,w+1)
for val in range(1,n+1):
	a = kekka[change[val-1][0]-1]
	b = kekka[change[val-1][1]-1]
	kekka[change[val-1][0]-1] = b
	kekka[change[val-1][1]-1] = a
for x in kekka:
	print x

Measured memory_bytes: 4244
import numpy as np
from scipy.spatial import distance
from scipy.sparse.csgraph import floyd_warshall
n = int(input())
xy = np.zeros((n, 2))
for i in range(n):
    xy[i, 0], xy[i, 1] = (int(x) for x in input().split())
c = distance.cdist(xy, xy, metric='euclidean')
cost = floyd_warshall(c)
print(np.sum(c)/n)

Measured memory_bytes: 19344
fn main(){
    let s: Vec<char> = read_chars();
    let r1 = s.first().unwrap() == &'A';
    let r2 = (2..s.len()-1).map(|i| {if s[i] == 'C' {1} else {0}}).sum::<usize>() == 1;
    let r3 = s.iter().map(|c| {if c.is_uppercase() {1} else {0}}).sum::<usize>() == 2;
    println!("{}", if r1 && r2 && r3 {"AC"} else {"WA"});
}

use std::io::*;
use std::str::*;


fn read_chars() -> Vec<char> {
    let s = stdin().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<Vec<char>>();
    s
}

Measured memory_bytes: 4352
/*
	Created by Rahul Goel.
*/

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1000000000;

#define pii pair < int, int >
#define vi vector < int >
#define vvi vector < vector < int > >
#define vpii vector < pair < int, int > >
#define vvpii vector < vector < pair < int, int > > >
#define pb push_back
#define f first
#define s second
#define mp make_pair

int main()
{
	int n, m;
	cin >> n >> m;
	if(n==m)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


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

using namespace std;
typedef long long int lld;
lld power(lld x, lld y)
{
    if(y==0)
    return 1;
    else if(y==1)
    return x;
    else if(y%2)
    return power(x, 1)*power(x, y-1)%998244353;
    else
    return power(x, y/2)*power(x, y/2)%998244353;
}
lld f(lld m, lld n, lld a)
{
    lld i=m;
    i*=power(m-1, n-a-1);
    i%=998244353;
    
    
    return i;
}
lld yuk(lld x)
{
    lld i;
    i=power(x, 998244351);
    return i;
}
int main() {
    
    long long int m, n, k, i, dap=0, comb[200001]={1};
    cin>>n>>m>>k;
    if(m==1)
    {
        if(n<=(k+1))
        cout<<"1";
        else
        cout<<"0";
    }
    else
    {
    for(i=1;i<=k;i++)
    {
        comb[i]=comb[i-1]*(n-i)%998244353*yuk(i)%998244353;
    }
    for(i=0;i<=k;i++)
    {
    dap+=f(m, n, i)*comb[i];
    dap%=998244353;
    }
    cout<<dap;
    
    }
    
    return 0;
}

Measured memory_bytes: 5200
#include<iostream>
using namespace std;
int main(){
char a[222222];
long i,c[1000],ans=0;
cin>>a;
for(i=0;i<1000;i++)
c[i]=0;
for(i=0;a[i]!='\0';i++){
ans-=c[a[i]];
c[a[i]]++;
}
ans+=i*(i-1)/2+1;
cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define maxn 1000010
#define mx 1000000
template <typename T>inline T read()
{
    register T sum=0;
    register char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
int n,prim[maxn];
int main()
{
	read(n);
	for(int i=2;i<=mx;i++)
	{
		if(!prim[i])
		{
			if(i>=n)
			{
				printf("%d\n",i);
				return 0;
			}
			prim[++prim[0]]=i;
		}
		for(int j=1;j<=prim[0]&&i*prim[j]<=mx;j++)
		{
			prim[i*prim[j]]=true;
			if(i%prim[j]==0)
				break;
		}
	}
    return 0;
}

Measured memory_bytes: 4096
#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std;
int main (){
    int s,w;
    cin >> s>>w;
    if(s>w) cout << "safe" << endl;
    else cout << "unsafe" << endl;
    return 0;
}

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

int keta(int n){ return (n<10? 1: keta(n/10)+1);}
int main(){
  int N; cin>>N;
  int r = 0;
  for(int i=1;i<N+1;i++){
    if(keta(i)&1) r++;
  }
  cout << r;
}

Measured memory_bytes: 256
s = list(input())
k = int(input())
for i in range(len(s)):
    if s[i] == "a":
        continue
    c = ord(s[i]) - ord("a")
    if k >= (26 - c):
        k -= 26 - c
        s[i] = "a"
s[-1] = chr(((ord(s[-1]) - ord("a")) + k) % 26 + ord("a"))
print("".join(s))


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

using int64 = long long int;
using Vint = vector<int>;
using Vint64 = vector<int64>;
using Wint = vector<Vint>;
using pii = pair<int, int>;

const int MOD = 1e9 + 7;

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto (i) = (vec).begin(); (i) != (vec).end(); (i)++)
#define vrREP(i, vec) for(auto (i) = (vec).end()-1;(i) != (vec).begin()-1;(i)--)

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


int main(void){
  string s; cin >> s;
  REP(i, s.size() - 1) if(s.at(i) == s.at(i + 1)){
    cout << i + 1 << " " << i + 2 << "\n";
    return 0;
  }
  REP(i, s.size() - 2) if(s.at(i) == s.at(i + 2)){
    cout << i + 1 << " " << i + 3 << "\n";
    return 0;
  }
  cout << "-1 -1\n";
  return 0;
}

Measured memory_bytes: 512
import java.util.LinkedList;
import java.util.Scanner;

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

        LinkedList<String> ll = new LinkedList<String>();

        for (int i = 0; i < n; i++) {
            if (i % 2 == n % 2) {
                ll.addLast(sc.next());
            } else {
                ll.addFirst(sc.next());
            }
        }
        sc.close();

        ll.stream().forEach(s -> System.out.print(s + " "));

    }
}

Measured memory_bytes: 85388
n = int(input())
s = input()
max = 0
for i in range(1, n):
    b = []
    count = 0
    x = s[:i]
    y = s[i:]
    for c in x:
        if c in y:
            if c not in b:
                b.append(c)
                count += 1
    if count > max:
        max = count
print(max)

Measured memory_bytes: 39024