akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int n;
  cin>>n;
  string s;
  cin>>s;
  string l = "";
  char now;
  REP(i,n){
    if(i==0){
      now = s[i];
      continue;
    }
    if(s[i]==now){
      if(i==n-1){
        l += now;
      }
      continue;
    }else{
      l += now;
      now = s[i];
      if(i==n-1){
        l += now;
      }
    }
  }
  
  int ans = l.size();
  if(ans==0){
    ans = 1;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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 main(){
  int N;
  cin >> N;
  vector<double> x(N),y(N);
  vector<double> diff(N);
  for(int i=0; i<N; i++){
    cin >> x[i];
  }
  for(int i=0; i<N; i++){
    cin >> y[i];
  }
  for(int i=0; i<N; i++){
    diff[i] = abs(x[i]-y[i]);
  }
  ll sum_1=0;
  double sum_2=0;
  double sum_3=0;
  ll sum_inf = 0;
  for(int i=0; i<N; i++){
    sum_1 += diff[i];
    sum_2 += pow(diff[i],2);
    sum_3 += pow(diff[i],3);
    chmax(sum_inf,(ll)diff[i]);
  }
  sum_2 = pow(sum_2,1.0/2.0);
  sum_3 = pow(sum_3,1.0/3.0);
  cout << fixed << setprecision(10) << sum_1 << endl;
  cout << fixed << setprecision(10) << sum_2 << endl;
  cout << fixed << setprecision(10) << sum_3 << endl;
  cout << fixed << setprecision(10) << sum_inf << endl;
  return 0;
}



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

using ll = long long; 

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

  set <int> A;
  int a;
  bool YES = true;
  for (int i=0; i<N; ++i){
    cin >> a;
    if (A.count(a)){
      YES = false;
      break;
    }
    A.insert(a);
  }

  if(YES){
    cout << "YES" <<endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 9600
# coding: utf-8
import numpy as np


def main():
    
    taps = list(input())
    
    for i, tap in enumerate(taps):
        if i % 2 == 0 and tap in ('R', 'U', 'D'):
            pass
        elif i % 2 == 1 and tap in ('L', 'U', 'D'):
            pass
        else:
            print('No')
            return 0
    print('Yes')
    
    return 0
    
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 12504
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    double a , sum;
    sum = 0;
    string b ;
    int n ;
    
    cin >> n;

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

        if( b == "JPY"){
          sum += a;
        }else {
          sum += a * 380000.0 ;
        }
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,bool>
#define mp make_pair

using namespace std;

const int nax = 1e6 + 5;

int cnt[nax];

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

    int n; cin>>n;
    for(int i=1;i<nax;i++)
    {
        for(int j=i;j<nax;j+=i) cnt[j]++;
    }

    ll ans = 0;

    for(int i=1;i<n;i++)
    {
        ans += cnt[n-i];
    }

    cout<<ans;

    return 0;
}


Measured memory_bytes: 7552
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define M 1000010

int main(){
	IOS;
	vector<string> v;
	v.pb("SUN");v.pb("MON");v.pb("TUE");v.pb("WED");v.pb("THU");v.pb("FRI");v.pb("SAT");
	ll cnt=0;
	string s;cin>>s;
	ll idx=0;
	rep(i,0,7)if(s==v[i])idx=i;
	// cout<<idx;
	rep(i,(idx+1),(idx+1)+7){
		ll j=(i)%7;
		cnt++;
		if(v[j]=="SUN")break;
	}
	cout<<cnt;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <unordered_map>
#define Debug 0
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 998244353;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

//最大公約数
template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//最小公倍数
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

//入出力高速化(非同期化)
void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

void solve() {
    int y, m, d;
    cin >> y >> m >> d;
    if (y <= 30 || (y == 31 &&  m < 5)) {
        cout << "HEISEI";
        cout << " ";
        cout << y;
        cout << " ";
        cout << m;
        cout << " ";
        cout << d;
        cout << endl;
    } else {
        cout << "?";
        cout << " ";
        cout << y-30;
        cout << " ";
        cout << m;
        cout << " ";
        cout << d;
        cout << endl;
    }
}

int main(){
    vector<string> ans;
    while (1) {
        string nengo;
        cin >> nengo;
        if (nengo == "HEISEI") solve();
        else break;
    }
}






Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n;
	while(cin>>n){
		if(n==0) break;
		vi d(n);
		rep(i,0,n) cin>>d[i];
		sort(all(d));
		lint ans=0;
		vi wait(n);
		rep(i,1,n){
			wait[i]=wait[i-1]+d[i-1];
		}
		rep(i,0,n){
			ans+=wait[i];
		}
		o(ans);
	}
}

Measured memory_bytes: 1288
N,A = map(int,input().split())
x = list(map(int,input().split()))
X = sum(x)

dp = [[[0 for k in range(X+1)] for j in range(N+1)] for i in range(N)]

for i in range(N):
    for j in range(i+1):
        dp[i][1][x[j]] += 1

for i in range(N-1):
    for j in range(1,i+2):
        for k in range(X+1):
            if 1 <= k-x[i+1] <= X:
                dp[i+1][j+1][k] = dp[i][j+1][k] + dp[i][j][k-x[i+1]]
            else:
                dp[i+1][j+1][k] = dp[i][j+1][k]

ans = 0
for j in range(1,N+1):
    if 1 <= A*j <= X:
        ans += dp[N-1][j][A*j]

print(ans)

Measured memory_bytes: 94044
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.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; }

ll H,W;

bool is_ok(ll x,ll y){
  if(x<0||x>=W||y<0||y>=H) return false;
  return true;
}


int main()
{
  cin>>H>>W;
  vector<string> S(H); rep(i,H) cin>>S[i];
  
  rep(y,H){
    rep(x,W){
      if(S[y][x]=='#') continue;
      
      ll count=0;
      if(is_ok(x-1,y-1)&&S[y-1][x-1]=='#') count++;
      if(is_ok(x-1,y)&&S[y][x-1]=='#') count++;
      if(is_ok(x-1,y+1)&&S[y+1][x-1]=='#') count++;
      if(is_ok(x,y+1)&&S[y+1][x]=='#') count++;
      if(is_ok(x+1,y+1)&&S[y+1][x+1]=='#') count++;
      if(is_ok(x+1,y)&&S[y][x+1]=='#') count++;
      if(is_ok(x+1,y-1)&&S[y-1][x+1]=='#') count++;
      if(is_ok(x,y-1)&&S[y-1][x]=='#') count++;
      
      S[y][x]=(char)('0'+count);
    }
  }
  
  rep(i,H) cout<<S[i]<<endl;
  return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main() {
    int Z1, Z2, X1, X2, Z, Zx, Xy, Yz;
    scanf("%d %d %d %d %d", &Z1, &X1, &Z2, &X2, &Z);
    Zx = Z1 * 60 + X1;
    Xy = Z2 * 60 + X2;
    Yz = Xy - Zx - Z;
    printf("%d", Yz);
    return 0;
}

Measured memory_bytes: 1704
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int64 x,y;
  scanf("%lld%lld",&x,&y);
  int cnt=0;
  while(x<=y){
    cnt++;
    x*=2;
  }
  printf("%d\n",cnt);
  return;
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 128
//Totka hai dosto
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
const int inf=1e18;
int32_t main()
{
	int n,m,x;
	cin>>n>>m>>x;
	int ans=inf;
	int c[n];int lev[m];
	int a[n][m];
	for(int i=0;i<n;i++)
	{
		cin>>c[i];
		for(int j=0;j<m;j++)
		cin>>a[i][j];
	}
	int tc;
	for(int mask=0;mask<(1<<n);mask++)
	{
		
		memset(lev,0,sizeof lev);
		tc=0;
		for(int i=0;i<n;i++)
		{
			if(mask&(1<<i))
			{
				for(int j=0;j<m;j++)
				lev[j]+=a[i][j];
				tc+=c[i];
			}
			
		}
		
		bool ok=1;
		for(int i=0;i<m;i++)
		{
			if(lev[i]<x)ok=0;
		}
		if(ok)ans=min(ans,tc);
		
	}
	if(ans==inf)
	{
		puts("-1");
	}
	else cout<<ans;
	
	
}

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

std::vector<std::vector<int>> t_arr;
std::vector<long long> a_arr, p_arr;

void dfs(int current, int parent, long long acc){
  acc += p_arr[current];
  a_arr[current] = acc;
  for(auto&& it: t_arr[current]){
    if(it == parent) continue;
    dfs(it, current, acc);
  }
}

int main(){
  int N,Q;
  std::cin >> N >> Q;

  t_arr.resize(N);
  p_arr.resize(N);
  a_arr.resize(N);

  for(int i = 0; i < N-1; i++){
    int a,b;
    std::cin >> a >> b;
    a--; b--;
    t_arr[a].push_back(b);
    t_arr[b].push_back(a);
  }
  for(int i = 0; i < Q; i++){
    int p,x;
    std::cin >> p >> x;
    p--;
    p_arr[p] += x;
  }

  dfs(0, -1, 0);

  for(int i = 0; i < N; i++){
    std::cout << a_arr[i] << ((i==N-1)?"\n":" ");
  }

  return 0;
}



Measured memory_bytes: 25856
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#define N 100005
using namespace std;

typedef long long ll;
ll n, X, Y, Z, mx = -9e19, x[N], y[N];
struct st {
	ll a, b, c;
} d[N];
priority_queue<ll, vector<ll>, greater<ll> > qu;

bool comp(st p, st q) {
	return p.a - p.b > q.a - q.b;
}
int main()
{
	ll i;
	cin >> X >> Y >> Z;
	n = X + Y + Z;
	for (i = 1; i <= n; i++) {
		scanf ("%lld %lld %lld", &d[i].a, &d[i].b, &d[i].c);
	}
	sort(d + 1, d + n + 1, comp);

	for (i= 1; i <= n - Y; i++) {
		x[i] = x[i - 1] + d[i].a - d[i].c;
		qu.push(d[i].a - d[i].c);
		if (i > X) {x[i] -= qu.top(); qu.pop();}
	}
	while (!qu.empty()) qu.pop();
	for (i = n; i >= X + 1; i--) {
		y[i] = y[i + 1] + d[i].b - d[i].c;
		qu.push(d[i].b - d[i].c);
		if (i <= n - Y) {y[i] -= qu.top(); qu.pop();}
	}
	for (i = X; i <= n - Y; i++) {
		mx = max(mx, x[i] + y[i + 1]);
	}
	for (i = 1; i <= n; i++) mx += d[i].c;
    cout << mx;
    return 0;
}


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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
// #define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 313;
string z,z2;
int n,k;
int dp[MAX][MAX][MAX];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> z >> k;
  n = SZ(z);
  z2 = z;
  reverse(ALL(z));
  R(i,n+1)R(j,n+1)R(kk,k+1){
    if(i < n && j < n && z[i] == z2[j]){
      maxi(dp[i+1][j+1][kk], dp[i][j][kk] + 1);
    }
    maxi(dp[i+1][j+1][kk+1], dp[i][j][kk] + 1);
    maxi(dp[i+1][j][kk], dp[i][j][kk]);
    maxi(dp[i][j+1][kk], dp[i][j][kk]);
  }
  int res = 0;
  debug(dp[4][4][1]);
  R(i,n){
    maxi(res,1 + dp[i][n-i-1][k] * 2);
  }
  R(i,n+1){
    maxi(res,dp[i][n - i][k] * 2);
  }
  cout << res << "\n";
}


Measured memory_bytes: 116992
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

x, y = na()
# a+b = x
# 2a+4b = y
b = (y-2*x)//2
a = x-b
if a >= 0 and b >= 0 and 2*a+4*b == y:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 79756
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N, M;
int K[100010];
vector<int> G[100010];
int par[100010];

int root(int x) {
  return par[x] == x ? x : root(par[x]);
}

void merge(int x, int y) {
  x = root(x); y = root(y);
  if (x == y) return;
  par[y] = x;  
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> K[i];
    for (int j = 0; j < K[i]; j++) {
      int L;
      cin >> L;
      G[--L].emplace_back(i);
    }
  }
  iota(par, par + N, 0);
  for (int i = 0; i < M; i++) {
    if (G[i].empty()) continue;
    for (int j : G[i]) {
      merge(G[i].front(), j);
    }
  }
  set<int> st;
  for (int i = 0; i < N; i++) {
    st.insert(root(i));
  }
  cout << (st.size() == 1 ? "YES" : "NO") << endl;
  
  return 0;
}

Measured memory_bytes: 4736
from math import pi,cos,sqrt
a,b,h,m = map(int,input().split())
hr = 0.5*(h*60+m)
mn = m*6
theta = abs(hr-mn)
angle = theta
angle = (angle*pi) / 180
ans = sqrt(a*a + b*b - 2*a*b*cos(angle))
print(round(ans,10))


Measured memory_bytes: 9372
class Dice:
    def __init__(self, e1, e2, e3, e4, e5, e6):
        self.eye1 = e1
        self.eye2 = e2
        self.eye3 = e3
        self.eye4 = e4
        self.eye5 = e5
        self.eye6 = e6
    
    def roll_e(self):
        tmp_eye   = self.eye3
        self.eye3 = self.eye1
        self.eye1 = self.eye4
        self.eye4 = self.eye6
        self.eye6 = tmp_eye
    
    def roll_n(self):
        tmp_eye   = self.eye5
        self.eye5 = self.eye1
        self.eye1 = self.eye2
        self.eye2 = self.eye6
        self.eye6 = tmp_eye
    
    def roll_s(self):
        tmp_eye   = self.eye2
        self.eye2 = self.eye1
        self.eye1 = self.eye5
        self.eye5 = self.eye6
        self.eye6 = tmp_eye
    
    def roll_w(self):
        tmp_eye   = self.eye4
        self.eye4 = self.eye1
        self.eye1 = self.eye3
        self.eye3 = self.eye6
        self.eye6 = tmp_eye
    
    def roll_h(self):
        tmp_eye   = self.eye2
        self.eye2 = self.eye3
        self.eye3 = self.eye5
        self.eye5 = self.eye4
        self.eye4 = tmp_eye
    
    def get_eye1(self):
        return self.eye1
    
    def get_eye2(self):
        return self.eye2

    def get_eye3(self):
        return self.eye3

e1, e2, e3, e4 ,e5, e6 = map(int,input().split())
dice1 = Dice(e1, e2, e3, e4 ,e5, e6)
roll = int(input())
for i in range(roll):
    t1, t2 = map(int,input().split())
    while t1 != dice1.get_eye1():
        dice1.roll_e()
        if t1 != dice1.get_eye1():
            dice1.roll_n()
        else:
            break
    while t2 != dice1.get_eye2():
        dice1.roll_h()
    print(dice1.get_eye3())


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

deque<char>q; 
int main() {
  string S;
  cin>>S;
  int Q;
  cin>>Q;
  for(char c:S){
    q.push_back(c);
  }
  int count=0;
  rep(i,Q){
    int f;
    char c;
    cin>>f;
    if(f==1){
      count++;
    }else{
      int f2;
      cin>>f2>>c;
      if(f2==1){
        if(count%2==0){
          q.push_front(c);
        }else{
          q.push_back(c);
        }
      }else{
        if(count%2==0){
          q.push_back(c);
        }else{
          q.push_front(c);
        }      
      }
    }
  }
  if(count%2==1){
    reverse(q.begin(),q.end());
  }
  rep(i,q.size()){
    cout<<q[i];
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 896
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }


    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var input = Reads();
        var a = input[0];
        var b = input[1];
        if (b % a == 0)
            Console.WriteLine(a + b);
        else
            Console.WriteLine(b - a);

        Console.Out.Flush();
    }
}

Measured memory_bytes: 13268
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;

/**
 * Star Watching
 */
public class Main {

	static final int[][] OP1 = {{7, 22}, {8, 23}, {9, 24}, {10, 12}, {13, 18}};
	static final int[][] OP2 = {{1, 28}, {2, 29}, {3, 30}, {15, 16}, {19, 21}};
	static final int[][] OP3 = {{1, 24}, {4, 27}, {7, 30}, {10, 21}, {16, 18}};
	static final int[][] OP4 = {{3, 22}, {6, 25}, {9, 28}, {12, 19}, {13, 15}};

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int n = Integer.parseInt(line);
			for (int i = 0; i < n; i++) {
				line = br.readLine();
				byte[] puzzle = new byte[31];
				for (int j = 0; j < line.length() / 2 + 1; j++) {
					puzzle[j + 1] = (byte) (line.charAt(j * 2) - '0');
				}

				int ans = 0;
				Deque<byte[]> queue = new ArrayDeque<byte[]>();
				queue.offer(puzzle);

				while (queue.size() > 0) {
					byte[] p = queue.poll();
					if (judge(p)) {
						ans = p[0];
						break;
					} else {
						for (int j = 0; j < 4; j++) {
							queue.offer(operate(p, j));
						}
					}
				}
				System.out.println(ans);
			}
		} // end while
	} // end main

	static boolean judge(byte[] p) {
		boolean ret = true;
		if (p[1] != (p[1] | p[2] | p[3] | p[4] | p[5] | p[6] | p[7] | p[8] | p[9])) {
			ret &= false;
		}
		if (p[22] != (p[22] | p[23] | p[24] | p[25] | p[26] | p[27] | p[28] | p[29] | p[30])) {
			ret &= false;
		}
		if (p[10] != (p[10] | p[11] | p[12])) {
			ret &= false;
		}
		if (p[13] != (p[13] | p[14] | p[15])) {
			ret &= false;
		}
		if (p[16] != (p[16] | p[17] | p[18])) {
			ret &= false;
		}
		if (p[19] != (p[19] | p[20] | p[21])) {
			ret &= false;
		}
		return ret;
	}

	static byte[] operate(byte[] p, int o) {
		byte[] _p = Arrays.copyOf(p, p.length);
		int[][] _o = null;
		switch (o) {
			case 0:
				_o = OP1;
				break;
			case 1:
				_o = OP2;
				break;
			case 2:
				_o = OP3;
				break;
			case 3:
				_o = OP4;
				break;
		}
		for (int i = 0; i < _o.length; i++) {
			byte tmp = _p[_o[i][0]];
			_p[_o[i][0]] = _p[_o[i][1]];
			_p[_o[i][1]] = tmp;
		}
		_p[0]++;
		return _p;
	}
}

Measured memory_bytes: 49024
#include <bits/stdc++.h>
#include <unordered_map>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
using namespace std;
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];


void solve()
{
    string s, t;
    cin>>s>>t;

    int ans = 0;

    rep(i, s.size())
    {
        if(s[i] != t[i])
        {
            ans++;
        }
    }

    cout<<ans<<endl;

}

int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 15692
fun main(args: Array<String>) {
    abc149d()
}

fun abc149d() {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val points = readLine()!!.split(' ').map { it.toInt() }
    val t = readLine()!!.map {
        when (it) {
            'r' -> 2
            's' -> 0
            else -> 1
        }
    }.toIntArray()

    val grouped = t.withIndex().groupBy { it.index % k }
        .map { it.value.map { iv -> iv.value } }

    var answer = 0L

    for (g in grouped) {
        val sum = Array(g.size) { 0 }
        val before = Array(g.size) { -1 }
        sum[0] = points[g.first()]
        before[0] = g.first()

        for (i in 1..g.lastIndex) {
            val value = g[i]
            if (before[i - 1] != value) {
                sum[i] = sum[i - 1] + points[value]
                before[i] = value
            } else {
                sum[i] = sum[i - 1]
            }
        }

        answer += sum.last()
    }

    println(answer)
}


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

int main() {
    string s;
    std::cin >> s;
    for (int i = 0; i < s.length(); i++) {
        if(i%2==0){
            if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D'){
                
            }else{
                std::cout << "No" << std::endl;
                return 0;
            }
        }else{
            if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'){
                
            }else{
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }
    std::cout << "Yes" << std::endl;
}


Measured memory_bytes: 256
///In the name of GOD
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MXN = 400 + 10;
const ll Mod = 1e9 + 7;
ll n, c;
ll L[MXN], R[MXN], dp[MXN][MXN], pd[MXN][MXN];
ll power(ll a, ll b){
    return (!b ? 1 : power(a * a % Mod, b / 2) * (b % 2 ? a : 1) % Mod);
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> n >> c;
    for(int i = 1; i <= n; i ++) cin >> L[i];
    for(int i = 1; i <= n; i ++) cin >> R[i];
    for(int i = 0; i < MXN; i ++){
        for(int j = 0; j < MXN; j ++){
            pd[i][j] = ((!i ? 0 : pd[i - 1][j]) + power(i, j)) % Mod;
        }
    }
    for(int cp = 0; cp <= c; cp ++){
        for(int j = L[1]; j <= R[1]; j ++){
            dp[1][cp] = (dp[1][cp] + power(j, cp)) % Mod;
        }
    }
    for(int i = 2; i <= n; i ++){
        for(int cp = 0; cp <= c; cp ++){
            for(int a = 0; a <= cp; a ++){
                ll now = (pd[R[i]][a] - pd[L[i] - 1][a] + Mod) * dp[i - 1][cp - a] % Mod;
                dp[i][cp] = (dp[i][cp] + now) % Mod;
            }
        }
    }
    cout << dp[n][c] << '\n';
    return 0;
}
/*!
    I CHOOSE TO HAVE FAITH,
    BECAUSE WITHOUT THAT,
    I HAVE NOTHING....
    ITS THE ONLY THING THAT'S KEEPING ME GOING.
*/
//! N.N


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
 
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair
 
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
const int INF = 2e9;
const int MOD = 1e9 + 7;

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

    int n; cin >> n;
    vector<pii> person(n);
    for (auto &xv : person) cin >> xv.first >> xv.second;
    sort(all(person));
    forn(i,n) person[i].first = i;
    set<pii> big, big_rev, small;
    vi suf(n+1);
    suf.back() = INF;
    dforsn(i,0,n) suf[i] = min(suf[i+1], person[i].second);

    vi dp(1,1), cum(1,0);
    cum.pb(1);
    forn(i,n) {
        auto xv = person[i];
        int x,v; tie(x,v) = xv;

        big.emplace(x,v);
        big_rev.emplace(v,x);

        while (!big_rev.empty()) {
            auto elem = *big_rev.begin();
            if (elem.first < suf[i+1]) {
                small.insert(elem);
                big_rev.erase(elem);
                swap(elem.first, elem.second);
                big.erase(elem);
            }
            else break;
        }
        int idx;
        if (small.empty()) {
            dp.pb(2*dp[i]%MOD);
        }
        else {
            idx = n+2;
            if (!small.empty()) idx = min(idx, small.rbegin()->second);
            if (!big.empty()) idx = min(idx, big.begin()->first);

            auto cur = cum.back() - cum[idx];
            if (cur < 0) cur += MOD;
            dp.pb(cur);
        }
        cum.pb(cum.back() + dp.back());
        if (cum.back() >= MOD) cum.back() -= MOD;
    }
    cout << dp.back();

    return 0;
}


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

int main(){
  
  string s;
  cin >> s;
  
  int count = 0; //１の数を記録するvariable
  
  for (int i = 0; i < 3; i++) {
    if(s.at(i) == '1'){
      count++;
    }
    
  }
  
  cout << count << endl;
  
}



Measured memory_bytes: 256
K,N=map(int,input().split())

array=input().split()
A=[]
for i in array:
    A.append(int(i))

dist=[]
for i in range(N):
    if i!=N-1:
        dist.append(A[i+1]-A[i])
    else:
        dist.append((K-A[i])+A[0])

dist=sorted(dist)

ans=0
for i in range(N-1):
    ans+=dist[i]

print(ans)

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

int main() {

  int N;
  cin >> N;

  vector<int> a(N);
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum = sum ^ a[i];
  }

  for (int i = 0; i < N; i++) {
    int ans = a[i] ^ sum;
    cout << ans << " ";
  }

  cout << endl;

  return 0;

}

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

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
#define ll long long
using namespace std;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

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

  ll N;
  cin >> N;

  ll count = 0;
  for (int i=1; i*i <= N; i++) {
    for (int j=i; j <= N; j++) {
      if (N - i*j <= 0) break;
      if (i == j) {
        count++;
      } else {
        count+=2;
      }
    }
  }
  print(count);
}


Measured memory_bytes: 3652
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

// test
func Test() {

	input := `3
0 0 3 0 0 2 3 2
0 0 3 0 1 1 1 4
0 0 3 0 1 1 2 2`
	solve(bufio.NewScanner(strings.NewReader(input)))
}

// main
func main() {
	solve(bufio.NewScanner(os.Stdin))
	//Test()
}

// logic
func solve(sc *bufio.Scanner) {


	sc.Scan()
	q, _ := strconv.Atoi(sc.Text())
	result := make([]int, q)
	for i:=0; i < q; i++ {
		sc.Scan()
		valuesStr := strings.Split(sc.Text(), " ")
		values := make([]int, len(valuesStr))
		for i, v := range valuesStr {
			values[i], _ = strconv.Atoi(v)
		}
		ax := values[2] - values[0]
		bx := values[6] - values[4]
		ay := values[3] - values[1]
		by := values[7] - values[5]
		// 内積=0: 90度
		dot := ax * bx + ay * by
		if dot == 0 {
			result[i] = 1
		}

		// 外積=0: 180度
		cross := ax * by - ay * bx
		if cross == 0 {
			result[i] = 2
		}
	}

	for _, v := range result {
		fmt.Println(v)
	}
}



Measured memory_bytes: 1352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=3000+10;
inline ll quick_pow(ll base,ll n,ll mod) {
	ll ans=1;
	while(n) {
		if(n&1ll)
			ans=ans*base%mod;
		base=base*base%mod;
		n>>=1;
	}
	return ans;
}
ll c[maxn][maxn];
ll g[maxn][maxn];
int main() {
	ll n,mod;
	scanf("%lld%lld",&n,&mod);
	for(int i=1; i<=n; i++) {
		c[i][0]=1;
		c[i][i]=1;
		for(int j=1; j<i; j++)
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	}
	for(int i=0; i<=n; i++) {
		g[i][0]=1;
		for(int j=1; j<=i; j++)
			g[i][j]=(g[i-1][j-1]+g[i-1][j]*(j+1)%mod)%mod;
	}
	ll ans=0;
	for(int i=0; i<=n; i++) {
		ll k=c[n][i];
		if(i&1)
			k=(mod-k)%mod;
		ll kind=quick_pow(2,n-i,mod);
		ll x=quick_pow(2,n-i,mod-1);
		x=quick_pow(2,x,mod);
		ll cnt=0,y=1;
		for(int j=0; j<=i; j++) {
			cnt=(cnt+(g[i][j]*y%mod))%mod;
			y=kind*y%mod;
		}
		ans=(ans+(k*cnt%mod*x%mod))%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 139904
#include <stdio.h>

int main(){
    char c,a;
    scanf("%c",&c);
    switch (c)
    {
        case 'A':
            a = 'T';
            break;

        case 'T':
            a = 'A';
            break;

        case 'G':
            a = 'C';
            break;

        case 'C':
            a = 'G';
            break;

        default:
            break;
    }
    printf("%c",a);
}

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

int calc(int a,int b,int n){
  if(n==0)
    return a+b;
  if(n==1)
    return a-b;
};

int main(){
  int N;
  cin>>N;
  int a[4]={};
  char n[2]={'+','-'};
  a[3]=N/1000;//4
  a[2]=N/100-a[3]*10;//3
  a[1]=N/10-a[3]*100-a[2]*10;//2
  a[0]=N-a[3]*1000-a[2]*100-a[1]*10;//1
  for(int o=0;o<2;o++)
    for(int p=0;p<2;p++)
      for(int q=0;q<2;q++)
        if(calc(calc(calc(a[3],a[2],o),a[1],p),a[0],q)==7){
          cout<<a[3]<<n[o]<<a[2]<<n[p]<<a[1]<<n[q]<<a[0]<<"=7";
          return 0;
        }


}


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

int n, s, a;
long long b[3001][3001], c[3001][3001];
const long long M = 998244353;

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

	for (int i = 1; i <= n; i++) {
		cin >> a;

		b[i][0] = 1;
		c[i][0] = 1;
		b[i][a] = 1;
		c[i][a] = 1;

		for (int j = 0; j <= s; j++) {
			b[i][j] = (b[i][j] + b[i - 1][j]) % M;
			c[i][j] = (c[i][j] + b[i - 1][j] + c[i - 1][j]) % M;

			if (j >= a) {
				b[i][j] = (b[i][j] + b[i - 1][j - a]) % M;
				c[i][j] = (c[i][j] + b[i - 1][j - a]) % M;
			}
		}
	}

	cout << c[n][s] << endl;	
}


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

using namespace std;

int N, M, S[15], D[100];
int dp[1 << 15][100];

int rec(int idx, int bit, int sum)
{
  if(idx == M) return (0);
  if(~dp[bit][idx]) return (dp[bit][idx]);
  int ret = rec(idx + 1, bit, sum) + abs(D[idx] - sum);
  for(int i = 0; i < N; i++) {
    if((bit >> i) & 1) continue;
    ret = min(ret, rec(idx, bit | (1 << i), sum + S[i]));
  }
  return (dp[bit][idx] = ret);
}

int main()
{

  while(scanf("%d %d", &N, &M), N) {
    for(int i = 0; i < N; ++i) {
      scanf("%d", &S[i]);
    }
    for(int i = 0; i < M; ++i) {
      scanf("%d", &D[i]);
    }
    sort(D, D + M);
    memset(dp, -1, sizeof(dp));
    printf("%d\n", rec(0, 0, 0));
  }
}

Measured memory_bytes: 16076
#include <bits/stdc++.h>
#include <set>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 


int main() {
  int n,k; cin >> n >> k;
  int a = 0;
  int ans =0;
  vector<int> x(n);
  rep(i,n) {
    cin >> x[i];
    ans += min(x[i]-a,k-x[i]);
  }
  cout << ans*2 << endl;

  return 0;
  

}

Measured memory_bytes: 256
alp="abcdefghijklmnopqrstuvwxyz"
s=input()
t=input()
l=len(s)
a=[]
b=[]

for i in alp:
  a.append(s.count(i))
  b.append(t.count(i))

a.sort()
b.sort()

if a==b:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int H,W;
	int i,j,num=0;
	char a;

	scanf("%d %d",&H,&W);

	for(i=0;i<H;i++)
		for(j=0;j<W;j++){
			scanf(" %c",&a);
			if(a=='#'){
				num++;
			}
		}

	printf("%s\n",num==H+W-1 ? "Possible":"Impossible");
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < 10; i++) {
			list.add(Integer.parseInt(br.readLine()));
		}

		Collections.sort(list);
		Collections.reverse(list);

		for (int i = 0; i <= 2; i++) {
			System.out.println(list.get(i));
		}

	}

}

Measured memory_bytes: 17032
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!long);
    auto N = s[0].to!int;
    auto C = s[1];
    auto X = new long[](N);
    auto V = new long[](N);
    foreach (i; 0..N) {
        s = readln.split.map!(to!long);
        X[i] = s[0];
        V[i] = s[1];
    }

    auto dp1 = new long[](N);
    auto dp2 = new long[](N);

    dp1[0] = V[0] - X[0];
    dp2[N-1] = V[N-1] - (-X[N-1] + C);

    foreach (i; 1..N) {
        dp1[i] = dp1[i-1] + V[i] - (X[i] - X[i-1]);
    }

    foreach_reverse (i; 0..N-1) {
        dp2[i] = dp2[i+1] + V[i] - (X[i+1] - X[i]);
    }

    long ans = max(0, dp1.reduce!max, dp2.reduce!max);


    auto dpdp1 = new long[](N);
    auto dpdp2 = new long[](N);
    dpdp1[0] = dp1[0];
    dpdp2[N-1] = dp2[N-1];
    foreach (i; 1..N) dpdp1[i] = max(dp1[i], dpdp1[i-1]);
    foreach_reverse (i; 0..N-1) dpdp2[i] = max(dp2[i], dpdp2[i+1]);


    foreach (i; 0..N-1) {
        long tmp = dp1[i] - X[i] + dpdp2[i+1];
        ans = max(ans, tmp);
    }
    foreach_reverse (i; 1..N) {
        long tmp = dp2[i] - (-X[i]+C) + dpdp1[i-1];
        ans = max(ans, tmp);
    }

    ans.writeln;
}


Measured memory_bytes: 5244
import qualified Data.Set as S
import qualified Data.ByteString.Char8 as B
import qualified Data.Array.IArray as A
import qualified Data.IntMap.Strict as M
import Control.Monad

readIntPair :: B.ByteString -> [(Int, Int)]
readIntPair = map (pair . map readInt . B.words) . B.lines

pair :: [t] -> (t, t)
pair [x, y] = (x, y)
pair _ = undefined

main = do
  n <- readLn
  es <- readUndirectedEdge <$> replicateM (n-1) B.getLine
  [q,k] <- map read . words <$> getLine
  xys <- readIntPair <$> B.getContents
  let g = buildG (1,n) es
  let m = dijkstra g k
  putStrLn $ unwords $ map (show . transit m) xys

transit m (x,y) = m M.! x + m M.! y  

type Bound = (Vertex, Vertex)
type Vertex = Int
type Weight = Int
type Edge = ((Vertex, Vertex), Weight)
type Graph = A.Array Vertex [(Vertex, Weight)]

buildG :: Bound -> [Edge] -> Graph
buildG b = A.accumArray (flip (:)) [] b . map (\((s, t), w) -> (s, (t, w)))

from :: Graph -> Vertex -> [(Vertex, Weight)]
from = (A.!)

readUndirectedEdge :: [B.ByteString] -> [Edge]
readUndirectedEdge = concatMap (constructTwoWay . map readInt . B.words)

constructTwoWay :: [Int] -> [Edge]
constructTwoWay [s,t,w] = [((s, t), w), ((t, s), w)]
constructTwoWay _ = undefined

readInt :: B.ByteString -> Int
readInt = maybe undefined fst . B.readInt

type Memo = M.IntMap Weight

dijkstra :: Graph -> Vertex -> Memo
dijkstra g s = _dijkstra g q0 m0
  where
   q0 = singleton (0, s)
   m0 = M.singleton s 0

_dijkstra :: Graph -> PriorityQueue -> Memo -> Memo
_dijkstra g q m
  | isEmpty q = m
  | otherwise = _dijkstra g q2 m1
  where
    ((w0, s), q1) = deleteFindMin q
    m1 = foldr (\(t, w) acc -> M.insertWith min t (w0 + w) acc) m vns
    q2 = foldr (\(t, w) acc -> insert (w0 + w, t) acc) q1 vns
    vns = filter (\(t, w) -> M.notMember t m || w0 + w <= m M.! t) (from g s)

type PriorityQueue = S.Set (Weight, Vertex)

isEmpty :: PriorityQueue -> Bool
isEmpty = S.null

singleton :: (Weight, Vertex) -> PriorityQueue
singleton = S.singleton

insert :: (Weight, Vertex) -> PriorityQueue -> PriorityQueue
insert = S.insert

deleteFindMin :: PriorityQueue -> ((Weight, Vertex), PriorityQueue)
deleteFindMin = S.deleteFindMin


Measured memory_bytes: 91260
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	int r;
	cin >> r;
	cout << 3 * r * r << endl;





	return 0;
}


Measured memory_bytes: 256
s = input()
A = s.split(' ')
B = [int(i) for i in A]
a, b, c = B[0], B[1], B[2]

if c-a-b <= 0:
    print('No')
else:
    L = 4 * a * b
    R = (c-a-b) ** 2
    print('Yes' if (L < R) else 'No')

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

double xp,yp;

double length(double x1,double y1,double x2,double y2){
  double a,b,c;
  
  if(x2>x1){
    a=x2-x1;
  }
  else{
    a=x1-x2;
  }
  if(y2>y1){
    b=y2-y1;
  }
  else{
    b=y1-y2;
  }
  c=a*a+b*b;
  c=sqrt(c);
  return(c);
}

double radius(double a,double b,double c){
  double r,temp;
  double numerator,denominator;
  numerator=a*b*c;
  temp=(a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c);
  denominator=sqrt(temp);
  r=numerator/denominator;
  return(r);
}

coordinates(double x1,double y1,double x2,double y2,double x3,double y3){
  double x,y;
  double a1,b1,c1,a2,b2,c2;
  
  a1=2*(x2-x1);
  b1=2*(y2-y1);
  c1=(x1*x1)-(x2*x2)+(y1*y1)-(y2*y2);
  a2=2*(x3-x1);
  b2=2*(y3-y1);
  c2=(x1*x1)-(x3*x3)+(y1*y1)-(y3*y3);
  xp=((b1*c2)-(b2*c1))/((a1*b2)-(a2*b1));
  yp=((c1*a2)-(c2*a1))/((a1*b2)-(a2*b1));
}

int main(void){
  double x1,y1,x2,y2,x3,y3;
  double r;
  double a,b,c;
  int n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
    a=length(x1,y1,x2,y2);
    b=length(x1,y1,x3,y3);
    c=length(x2,y2,x3,y3);
    r=radius(a,b,c);
    coordinates(x1,y1,x2,y2,x3,y3); 
    printf("%.3f %.3f %.3f\n",xp,yp,r);
  }
  return(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
#define A_MAX 1000000

using namespace std;
 
int scanint() { 
	char c = getchar_unlocked();
	int x = 0;
	for(; (c<48)||(c>57);c = getchar_unlocked());
	for(; (c>47)&&(c<58);c = getchar_unlocked())
		x = 10 * x + c - 48;
    return x;
} 
 
int min_factor[A_MAX + 1];
int q[A_MAX + 1];
int a[A_MAX + 1];

int main() {
 
    vector<int> primes;
    for (int i = 2; i <= A_MAX; ++i) {
        if (!min_factor[i]) {
            min_factor[i] = i;
            primes.push_back(i);
        }
        for (int p : primes) {
            int n = i * p;
            if (n > A_MAX) {
                break;
            }
            min_factor[n] = p;
            if (p == min_factor[i]) {
                q[n] = q[i];
                break;
            } else {
                q[n] = i;
            }
        }
    }
 
    int N = scanint();
    for (int i = 0; i < N; ++i) {
        ++a[scanint()];
    }
 
    bool is_pairwise_coprime = true;
    for (int n = A_MAX; n > 1; --n) {
        if (a[n] > 1) {
            if (a[n] == N) {
                printf("not coprime\n");
                return 0;
            }
            is_pairwise_coprime = false;
        }
        a[min_factor[n]] += a[n];
        a[q[n]] += a[n];
    }
    if (is_pairwise_coprime) {
        printf("pairwise coprime\n");
    } else {
        printf("setwise coprime\n");
    }
 
    return 0;
}

Measured memory_bytes: 15464
# https://atcoder.jp/contests/abc112/tasks/abc112_d

# 答えansの満たす条件
# ans<=M//Nである
# M%ans==0である


# 仮説:M//Nからansを--して、M%ans==0となるansが答え
# でももしN=2, M=10*9+7とかだったらTLE思想

N, M = list(map(int, input().split()))

ans = M // N
for a in range(ans, 0, -1):
    if M % a == 0:
        print(a)
        exit()


Measured memory_bytes: 40044
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n,k;
    cin >> n >> k;
    int l[n];
    for (int i = 0; i < n; i++) cin >> l[i];
    sort(l, l+n, greater<int>());

    int sum = 0;
    for (int i = 0; i < k; i++) {
        sum += l[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int power(int a)
{
        int b;
        if (a == 0)
        {
                b = 1;
        }
        else if (a == 1)
        {
                b = 100;
        }
        else
        {
                b = 100 * 100;
        }
        return b;
}

int main()
{
        //input->compute->output//
        int A, B;
        cin >> A >> B;
        if (B == 100)
        {
                cout << power(A) * (B + 1) << endl;
                return 0;
        }

        cout << power(A) * B << endl;

        return 0;
}


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

int main(){
  string s;
  int flag = 0;
  cin >> s;

  for(int i = 0; i < s.length(); ++i){
    if(s[i] == 'C') flag = 1;
    if(s[i] == 'F' && flag == 1){
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;
}

Measured memory_bytes: 256
N=int(input())
A=[int(x)for x in input().split()]
B=[int(x)for x in input().split()]
C=[int(x)for x in input().split()]
ans=sum(B)
for i in range(len(A)-1):
    if A[i]+1==A[i+1]:
        ans+=C[A[i]-1]
print(ans)

Measured memory_bytes: 3064
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

int main(void){
	scanf("%d %d %d %d",&n,&m,&k,&t);
	if(n!=k){printf("1\n");return 0;}
	if(n==k){printf("0\n");return 0;}
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(), a.end());
    string res = "YES";
    rep(i,n-1) if(a.at(i+1) == a.at(i)) res = "NO";
    cout << res << endl;
}


Measured memory_bytes: 1792